summaryrefslogtreecommitdiff
path: root/usr.bin/mg/fileio.c
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2005-10-14 06:41:48 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2005-10-14 06:41:48 +0000
commit27ade458e6688f238d0be65a6e9340e42c984aac (patch)
tree451cfb6c8460cadeeef1a19d39df7abfa9973570 /usr.bin/mg/fileio.c
parent7bb21effa448a7201adeea9244dcdf9aa9caf151 (diff)
move the dired routines into dired.c where they belong.
ok cloder@
Diffstat (limited to 'usr.bin/mg/fileio.c')
-rw-r--r--usr.bin/mg/fileio.c87
1 files changed, 1 insertions, 86 deletions
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index 8e36eaf759d..9481d16ab57 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -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 <string.h>
#include <fcntl.h>
#include <unistd.h>
-#include <ctype.h>
static FILE *ffp;
@@ -400,90 +399,6 @@ copy(char *frname, char *toname)
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 {