=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mg/fileio.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -r1.54 -r1.55 --- src/usr.bin/mg/fileio.c 2005/10/13 20:23:01 1.54 +++ src/usr.bin/mg/fileio.c 2005/10/14 06:41:47 1.55 @@ -1,4 +1,4 @@ -/* $OpenBSD: fileio.c,v 1.54 2005/10/13 20:23:01 kjell Exp $ */ +/* $OpenBSD: fileio.c,v 1.55 2005/10/14 06:41:47 kjell Exp $ */ /* This file is in the public domain. */ @@ -19,7 +19,6 @@ #include #include #include -#include static FILE *ffp; @@ -400,90 +399,6 @@ return (TRUE); } -/* - * dirname needs to have enough place to store an additional '/'. - */ -BUFFER * -dired_(char *dirname) -{ - BUFFER *bp; - FILE *dirpipe; - char line[256]; - int len; - - if ((dirname = adjustname(dirname)) == NULL) { - ewprintf("Bad directory name"); - return (NULL); - } - /* this should not be done, instead adjustname() should get a flag */ - len = strlen(dirname); - if (dirname[len - 1] != '/') { - dirname[len++] = '/'; - dirname[len] = '\0'; - } - if ((bp = findbuffer(dirname)) == NULL) { - ewprintf("Could not create buffer"); - return (NULL); - } - if (bclear(bp) != TRUE) - return (NULL); - bp->b_flag |= BFREADONLY; - if (snprintf(line, sizeof(line), "ls -al %s", dirname) - >= sizeof(line)) { - ewprintf("Path too long"); - return (NULL); - } - if ((dirpipe = popen(line, "r")) == NULL) { - ewprintf("Problem opening pipe to ls"); - return (NULL); - } - line[0] = line[1] = ' '; - while (fgets(&line[2], sizeof(line) - 2, dirpipe) != NULL) { - line[strlen(line) - 1] = '\0'; /* remove ^J */ - (void) addline(bp, line); - } - if (pclose(dirpipe) == -1) { - ewprintf("Problem closing pipe to ls : %s", - strerror(errno)); - return (NULL); - } - bp->b_dotp = lforw(bp->b_linep); /* go to first line */ - (void) strlcpy(bp->b_fname, dirname, sizeof(bp->b_fname)); - if ((bp->b_modes[1] = name_mode("dired")) == NULL) { - bp->b_modes[0] = name_mode("fundamental"); - ewprintf("Could not find mode dired"); - return (NULL); - } - bp->b_nmodes = 1; - return (bp); -} - -#define NAME_FIELD 8 - -int -d_makename(LINE *lp, char *fn, int len) -{ - int i; - char *p, *ep; - - strlcpy(fn, curbp->b_fname, len); - if ((p = lp->l_text) == NULL) - return (ABORT); - ep = lp->l_text + llength(lp); - p++; /* skip action letter, if any */ - for (i = 0; i < NAME_FIELD; i++) { - while (p < ep && isspace(*p)) - p++; - while (p < ep && !isspace(*p)) - p++; - while (p < ep && isspace(*p)) - p++; - if (p == ep) - return (ABORT); - } - strlcat(fn, p, len); - return ((lgetc(lp, 2) == 'd') ? TRUE : FALSE); -} #endif /* NO_DIRED */ struct filelist {