[BACK]Return to tail.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tail

Diff for /src/usr.bin/tail/tail.c between version 1.2 and 1.3

version 1.2, 1996/06/26 05:40:18 version 1.3, 1997/01/12 23:43:07
Line 51 
Line 51 
   
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/stat.h>  #include <sys/stat.h>
   
   #include <err.h>
 #include <errno.h>  #include <errno.h>
 #include <unistd.h>  
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
   #include <unistd.h>
   
 #include "extern.h"  #include "extern.h"
   
 int fflag, rflag, rval;  int fflag, rflag, rval;
Line 71 
Line 74 
 {  {
         struct stat sb;          struct stat sb;
         FILE *fp;          FILE *fp;
         long off;          long off = 0;
         enum STYLE style;          enum STYLE style;
         int ch, first;          int ch, first;
         char *p;          char *p;
Line 93 
Line 96 
                 usage();                                                \                  usage();                                                \
         off = strtol(optarg, &p, 10) * (units);                         \          off = strtol(optarg, &p, 10) * (units);                         \
         if (*p)                                                         \          if (*p)                                                         \
                 err(1, "illegal offset -- %s", optarg);                 \                  errx(1, "illegal offset -- %s", optarg);                \
         switch(optarg[0]) {                                             \          switch(optarg[0]) {                                             \
         case '+':                                                       \          case '+':                                                       \
                 if (off)                                                \                  if (off)                                                \
Line 136 
Line 139 
         argv += optind;          argv += optind;
   
         if (fflag && argc > 1)          if (fflag && argc > 1)
                 err(1, "-f option only appropriate for a single file");                  errx(1, "-f option only appropriate for a single file");
   
         /*          /*
          * If displaying in reverse, don't permit follow option, and convert           * If displaying in reverse, don't permit follow option, and convert
Line 165 
Line 168 
                 }                  }
   
         if (*argv)          if (*argv)
                 for (first = 1; fname = *argv++;) {                  for (first = 1; (fname = *argv++);) {
                         if ((fp = fopen(fname, "r")) == NULL ||                          if ((fp = fopen(fname, "r")) == NULL ||
                             fstat(fileno(fp), &sb)) {                              fstat(fileno(fp), &sb)) {
                                 ierr();                                  ierr();
Line 223 
Line 226 
         int len;          int len;
         char *start;          char *start;
   
         while (ap = *++argv) {          while ((ap = *++argv)) {
                 /* Return if "--" or not an option of any form. */                  /* Return if "--" or not an option of any form. */
                 if (ap[0] != '-') {                  if (ap[0] != '-') {
                         if (ap[0] != '+')                          if (ap[0] != '+')
Line 239 
Line 242 
                         /* Malloc space for dash, new option and argument. */                          /* Malloc space for dash, new option and argument. */
                         len = strlen(*argv);                          len = strlen(*argv);
                         if ((start = p = malloc(len + 3)) == NULL)                          if ((start = p = malloc(len + 3)) == NULL)
                                 err(1, "%s", strerror(errno));                                  err(1, NULL);
                         *p++ = '-';                          *p++ = '-';
   
                         /*                          /*
Line 269 
Line 272 
                                 *p++ = 'n';                                  *p++ = 'n';
                                 break;                                  break;
                         default:                          default:
                                 err(1, "illegal option -- %s", *argv);                                  errx(1, "illegal option -- %s", *argv);
                         }                          }
                         *p++ = *argv[0];                          *p++ = *argv[0];
                         (void)strcpy(p, ap);                          (void)strcpy(p, ap);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3