ignore & before array
[unix-history] / usr / src / old / more / more.c
index 673bada..f7b6689 100644 (file)
@@ -17,7 +17,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)more.c     5.15 (Berkeley) %G%";
+static char sccsid[] = "@(#)more.c     5.18 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -55,7 +55,7 @@ static char sccsid[] = "@(#)more.c    5.15 (Berkeley) %G%";
 
 #define TBUFSIZ        1024
 #define LINSIZ 256
 
 #define TBUFSIZ        1024
 #define LINSIZ 256
-#define ctrl(letter)   ('letter' & 077)
+#define ctrl(letter)   (letter & 077)
 #define RUBOUT '\177'
 #define ESC    '\033'
 #define QUIT   '\034'
 #define RUBOUT '\177'
 #define ESC    '\033'
 #define QUIT   '\034'
@@ -179,8 +179,11 @@ char *argv[];
     if (nfiles > 1)
        prnames++;
     if (!no_intty && nfiles == 0) {
     if (nfiles > 1)
        prnames++;
     if (!no_intty && nfiles == 0) {
-       fputs("Usage: ",stderr);
-       fputs(argv[0],stderr);
+       char *rindex();
+
+       p = rindex(argv[0], '/');
+       fputs("usage: ",stderr);
+       fputs(p ? p + 1 : argv[0],stderr);
        fputs(" [-dfln] [+linenum | +/pattern] name1 name2 ...\n",stderr);
        exit(1);
     }
        fputs(" [-dfln] [+linenum | +/pattern] name1 name2 ...\n",stderr);
        exit(1);
     }
@@ -398,7 +401,7 @@ magic(f, fs)
                        return(1);
                }
        (void)fseek(f, 0L, L_SET);              /* rewind() not necessary */
                        return(1);
                }
        (void)fseek(f, 0L, L_SET);              /* rewind() not necessary */
-       return(NULL);
+       return(0);
 }
 
 /*
 }
 
 /*
@@ -649,7 +652,7 @@ Sprintf (n)
     *sptr++ = n % 10 + '0';
 }
 
     *sptr++ = n % 10 + '0';
 }
 
-static char bell = ctrl(G);
+static char bell = ctrl('G');
 
 strlen (s)
 char *s;
 
 strlen (s)
 char *s;
@@ -992,7 +995,7 @@ register FILE *f;
                done++;
            break;
        case 'b':
                done++;
            break;
        case 'b':
-       case ctrl(B):
+       case ctrl('B'):
            {
                register int initline;
 
            {
                register int initline;
 
@@ -1038,7 +1041,7 @@ register FILE *f;
            else if (comchar == 'z') dlines = nlines;
            ret (nlines);
        case 'd':
            else if (comchar == 'z') dlines = nlines;
            ret (nlines);
        case 'd':
-       case ctrl(D):
+       case ctrl('D'):
            if (nlines != 0) nscroll = nlines;
            ret (nscroll);
        case 'q':
            if (nlines != 0) nscroll = nlines;
            ret (nscroll);
        case 'q':
@@ -1390,6 +1393,7 @@ va_dcl
            execv (cmd, argp);
            write (2, "exec failed\n", 12);
            exit (1);
            execv (cmd, argp);
            write (2, "exec failed\n", 12);
            exit (1);
+           va_end(argp);       /* balance {}'s for some UNIX's */
        }
        if (id > 0) {
            signal (SIGINT, SIG_IGN);
        }
        if (id > 0) {
            signal (SIGINT, SIG_IGN);