Hi tech@,

csh has a compile-time flag FILEC which decide whether it will be
compiled with support for filename completion.  By default it is on.
Compiling with the flag off results in a compile error.  This bug
has at least been present since the code was first checked into
NetBSD.

Since nobody has reported this for so many years, I guess it is
safe to remove this compile-time option.

I'm not sure about the removal of the comment. I can not make
any sense of it, and it talks about this flag.

--
 Peter Brottveit Bock
 

Index: Makefile
===================================================================
RCS file: /cvs/src/bin/csh/Makefile,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile
--- Makefile    13 Jul 2013 16:34:43 -0000      1.11
+++ Makefile    17 Jun 2015 02:53:46 -0000
@@ -6,7 +6,7 @@
 # To profile, put -DPROF in DEFS and -pg in CFLAGS, and recompile.
 
 PROG=  csh
-DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS
+DFLAGS=-DBUILTIN -DNLS -DSHORT_STRINGS
 #CFLAGS+=-g
 #CFLAGS+=-Wall
 CFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
Index: const.c
===================================================================
RCS file: /cvs/src/bin/csh/const.c,v
retrieving revision 1.6
diff -u -p -r1.6 const.c
--- const.c     27 Oct 2009 23:59:21 -0000      1.6
+++ const.c     17 Jun 2015 02:53:46 -0000
@@ -79,9 +79,7 @@ Char STRequal[]               = { '=', '\0' };
 Char STRfakecom[]      = { '{', ' ', '.', '.', '.', ' ', '}', '\0' };
 Char STRfakecom1[]     = { '`', ' ', '.', '.', '.', ' ', '`', '\0' };
 Char STRfignore[]      = { 'f', 'i', 'g', 'n', 'o', 'r', 'e', '\0' };
-#ifdef FILEC
 Char STRfilec[] = { 'f', 'i', 'l', 'e', 'c', '\0' };
-#endif /* FILEC */
 Char STRhistchars[]    = { 'h', 'i', 's', 't', 'c', 'h', 'a', 'r', 's', '\0' };
 Char STRtildothist[]   = { '~', '/', '.', 'h', 'i', 's', 't', 'o', 'r',
                            'y', '\0' };
Index: csh.h
===================================================================
RCS file: /cvs/src/bin/csh/csh.h,v
retrieving revision 1.21
diff -u -p -r1.21 csh.h
--- csh.h       8 Feb 2015 06:01:25 -0000       1.21
+++ csh.h       17 Jun 2015 02:53:46 -0000
@@ -117,10 +117,7 @@ bool    pjobs;                     /* want to print jobs i
 bool    setintr;               /* Set interrupts on/off -> Wait intr... */
 bool    timflg;                        /* Time the next waited for command */
 bool    havhash;               /* path hashing is available */
-
-#ifdef FILEC
 bool    filec;                 /* doing filename expansion */
-#endif
 
 /*
  * Global i/o info
Index: extern.h
===================================================================
RCS file: /cvs/src/bin/csh/extern.h,v
retrieving revision 1.20
diff -u -p -r1.20 extern.h
--- extern.h    8 Feb 2015 06:01:25 -0000       1.20
+++ extern.h    17 Jun 2015 02:53:46 -0000
@@ -103,9 +103,7 @@ int exp0(Char ***, bool);
 /*
  * file.c
  */
-#ifdef FILEC
 int    tenex(Char *, int);
-#endif
 
 /*
  * func.c
@@ -159,9 +157,7 @@ Char        **globall(Char **);
 void     rscan(Char **, void (*)(int));
 void     tglob(Char **);
 void     trim(Char **);
-#ifdef FILEC
 int      sortscmp(const void *, const void *);
-#endif /* FILEC */
 
 /*
  * hist.c
Index: file.c
===================================================================
RCS file: /cvs/src/bin/csh/file.c,v
retrieving revision 1.20
diff -u -p -r1.20 file.c
--- file.c      3 Jun 2015 01:49:35 -0000       1.20
+++ file.c      17 Jun 2015 02:53:46 -0000
@@ -30,8 +30,6 @@
  * SUCH DAMAGE.
  */
 
-#ifdef FILEC
-
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
@@ -645,4 +643,3 @@ ignored(Char *entry)
            return (TRUE);
     return (FALSE);
 }
-#endif                         /* FILEC */
Index: glob.c
===================================================================
RCS file: /cvs/src/bin/csh/glob.c,v
retrieving revision 1.17
diff -u -p -r1.17 glob.c
--- glob.c      8 Feb 2015 06:01:25 -0000       1.17
+++ glob.c      17 Jun 2015 02:53:46 -0000
@@ -875,7 +875,6 @@ Gcat(Char *s1, Char *s2)
        continue;
 }
 
-#ifdef FILEC
 int
 sortscmp(const void *a, const void *b)
 {
@@ -900,4 +899,3 @@ sortscmp(const void *a, const void *b)
     return ((int) Strcmp(*(Char **)a, *(Char **)b));
 #endif
 }
-#endif /* FILEC */
Index: lex.c
===================================================================
RCS file: /cvs/src/bin/csh/lex.c,v
retrieving revision 1.16
diff -u -p -r1.16 lex.c
--- lex.c       8 Feb 2015 06:09:50 -0000       1.16
+++ lex.c       17 Jun 2015 02:53:46 -0000
@@ -1355,7 +1355,6 @@ reread:
            /* was isatty but raw with ignoreeof yields problems */
            if (tcgetattr(SHIN, &tty) == 0 && (tty.c_lflag & ICANON))
            {
-               /* was 'short' for FILEC */
                pid_t     ctpgrp;
 
                if (++sincereal > 25)
@@ -1395,10 +1394,8 @@ bgetc(void)
 {
     int buf, off, c;
 
-#ifdef FILEC
     int numleft = 0, roomleft;
     Char    ttyline[BUFSIZ];
-#endif
     char    tbuf[BUFSIZ + 1];
 
     if (cantell) {
@@ -1445,8 +1442,6 @@ again:
        off = (int) feobp % BUFSIZ;
        roomleft = BUFSIZ - off;
 
-#ifdef FILEC
-       roomleft = BUFSIZ - off;
        for (;;) {
            if (filec && intty) {
                c = numleft ? numleft : tenex(ttyline, BUFSIZ);
@@ -1461,7 +1456,6 @@ again:
                numleft = 0;
            }
            else {
-#endif
                c = read(SHIN, tbuf, roomleft);
                if (c > 0) {
                    int     i;
@@ -1470,9 +1464,7 @@ again:
                    for (i = 0; i < c; i++)
                        ptr[i] = (unsigned char) tbuf[i];
                }
-#ifdef FILEC
            }
-#endif
            if (c >= 0)
                break;
            if (errno == EWOULDBLOCK) {
@@ -1486,12 +1478,8 @@ again:
        if (c <= 0)
            return (-1);
        feobp += c;
-#ifndef FILEC
-       goto again;
-#else
        if (filec && !intty)
            goto again;
-#endif
     }
     c = fbuf[buf][(int) fseekp % BUFSIZ];
     fseekp++;
Index: set.c
===================================================================
RCS file: /cvs/src/bin/csh/set.c,v
retrieving revision 1.14
diff -u -p -r1.14 set.c
--- set.c       8 Feb 2015 05:47:28 -0000       1.14
+++ set.c       17 Jun 2015 02:53:46 -0000
@@ -162,10 +162,8 @@ doset(Char **v, struct command *t)
            dtilde();
            xfree(cp);
        }
-#ifdef FILEC
        else if (eq(vp, STRfilec))
            filec = 1;
-#endif
     } while ((p = *v++) != NULL);
 }
 
@@ -496,10 +494,8 @@ void
 unset(Char **v, struct command *t)
 {
     unset1(v, &shvhed);
-#ifdef FILEC
     if (adrof(STRfilec) == 0)
        filec = 0;
-#endif
     if (adrof(STRhistchars) == 0) {
        HIST = '!';
        HISTSUB = '^';

Reply via email to