Make vinum use libedit instead of libreadline.
authorSimon Schubert <corecode@dragonflybsd.org>
Sun, 22 Jul 2007 22:46:09 +0000 (22:46 +0000)
committerSimon Schubert <corecode@dragonflybsd.org>
Sun, 22 Jul 2007 22:46:09 +0000 (22:46 +0000)
Submitted-by: pavalos@
sbin/vinum/Makefile
sbin/vinum/commands.c
sbin/vinum/v.c

index d7a741f..7a32719 100644 (file)
@@ -1,13 +1,13 @@
 # $FreeBSD: src/sbin/vinum/Makefile,v 1.12.2.2 2001/08/01 09:13:24 obrien Exp $
-# $DragonFly: src/sbin/vinum/Makefile,v 1.8 2006/10/17 00:55:44 pavalos Exp $
+# $DragonFly: src/sbin/vinum/Makefile,v 1.9 2007/07/22 22:46:09 corecode Exp $
 
 PROG=  vinum
 SRCS=  v.c list.c vinumparser.c vinumutil.c vext.h commands.c
 MAN=   vinum.8
 WARNS?=        2
 
-CFLAGS+=       -I${.CURDIR}/../../sys
-DPADD= ${LIBUTIL} ${LIBREADLINE} ${LIBTERMCAP}
-LDADD= -lreadline -ltermcap -ldevstat
+CFLAGS+=       -I${.CURDIR}/../../lib/libedit -I${.CURDIR}/../../sys
+DPADD= ${LIBEDIT} ${LIBTERMCAP} ${LIBDEVSTAT}
+LDADD= -ledit -ltermcap -ldevstat
 
 .include <bsd.prog.mk>
index d1594fc..b15430b 100644 (file)
@@ -34,7 +34,7 @@
  *
  * $Id: commands.c,v 1.14 2000/11/14 20:01:23 grog Exp grog $
  * $FreeBSD: src/sbin/vinum/commands.c,v 1.31.2.6 2003/06/06 05:13:29 grog Exp $
- * $DragonFly: src/sbin/vinum/commands.c,v 1.7 2007/01/20 19:20:39 dillon Exp $
+ * $DragonFly: src/sbin/vinum/commands.c,v 1.8 2007/07/22 22:46:09 corecode Exp $
  */
 
 #define _KERNEL_STRUCTURES
@@ -59,7 +59,6 @@
 #include <sys/linker.h>
 #include <sys/module.h>
 #include <sys/wait.h>
-#include <readline/history.h>
 #include <readline/readline.h>
 #include <devstat.h>
 
index 19e0cca..8a1ca4c 100644 (file)
@@ -34,7 +34,7 @@
  *
  * $Id: v.c,v 1.31 2000/09/03 01:29:26 grog Exp grog $
  * $FreeBSD: src/sbin/vinum/v.c,v 1.26.2.3 2001/03/13 03:04:06 grog Exp $
- * $DragonFly: src/sbin/vinum/v.c,v 1.5 2007/01/20 19:20:39 dillon Exp $
+ * $DragonFly: src/sbin/vinum/v.c,v 1.6 2007/07/22 22:46:09 corecode Exp $
  */
 
 #include <ctype.h>
 #include "vext.h"
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <readline/history.h>
 #include <readline/readline.h>
 #include <sys/linker.h>
 #include <sys/module.h>
 #include <sys/resource.h>
 
 FILE *cf;                                                  /* config file handle */
-FILE *history;                                             /* history file */
+FILE *hist;                                                /* history file */
 char *historyfile;                                         /* and its name */
 
 char *dateformat;                                          /* format in which to store date */
@@ -139,11 +138,11 @@ main(int argc, char *argv[], char *envp[])
            errno);
        exit(1);
     }
-    history = fopen(historyfile, "a+");
-    if (history != NULL) {
+    hist = fopen(historyfile, "a+");
+    if (hist != NULL) {
        timestamp();
-       fprintf(history, "*** " VINUMMOD " started ***\n");
-       fflush(history);                                    /* before we start the daemon */
+       fprintf(hist, "*** " VINUMMOD " started ***\n");
+       fflush(hist);                               /* before we start the daemon */
     }
     superdev = open(VINUM_SUPERDEV_NAME, O_RDWR);          /* open vinum superdevice */
     if (superdev < 0) {                                            /* no go */
@@ -224,8 +223,8 @@ main(int argc, char *argv[], char *envp[])
                if (tokens)
                    parseline(tokens, token);               /* and do what he says */
            }
-           if (history)
-               fflush(history);
+           if (hist)
+               fflush(hist);
        }
     }
     return 0;                                              /* normal completion */
@@ -316,11 +315,11 @@ parseline(int args, char *argv[])
     int j;
     enum keyword command;                                  /* command to execute */
 
-    if (history != NULL) {                                 /* save the command to history file */
+    if (hist != NULL) {                                    /* save the command to history file */
        timestamp();
        for (i = 0; i < args; i++)                          /* all args */
-           fprintf(history, "%s ", argv[i]);
-       fputs("\n", history);
+           fprintf(hist, "%s ", argv[i]);
+       fputs("\n", hist);
     }
     if ((args == 0)                                        /* empty line */
     ||(*argv[0] == '#'))                                   /* or a comment, */
@@ -525,9 +524,9 @@ make_devices(void)
            perror(VINUMMOD ": Can't write to /dev");
        return;
     }
-    if (history) {
+    if (hist) {
        timestamp();
-       fprintf(history, "*** Created devices ***\n");
+       fprintf(hist, "*** Created devices ***\n");
     }
     if (superdev >= 0)                                     /* super device open */
        close(superdev);
@@ -849,7 +848,7 @@ timestamp(void)
     char datetext[MAXDATETEXT];
     time_t sec;
 
-    if (history != NULL) {
+    if (hist != NULL) {
        if (gettimeofday(&now, NULL) != 0) {
            fprintf(stderr, "Can't get time: %s\n", strerror(errno));
            return;
@@ -857,7 +856,7 @@ timestamp(void)
        sec = now.tv_sec;
        date = localtime(&sec);
        strftime(datetext, MAXDATETEXT, dateformat, date),
-           fprintf(history,
+           fprintf(hist,
            "%s.%06ld ",
            datetext,
            now.tv_usec);