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

Diff for /src/usr.bin/stat/stat.c between version 1.5 and 1.6

version 1.5, 2005/04/03 18:31:00 version 1.6, 2005/04/03 18:38:28
Line 144 
Line 144 
   
 void    usage(const char *);  void    usage(const char *);
 void    output(const struct stat *, const char *,  void    output(const struct stat *, const char *,
             const char *, int, int, int);              const char *, int, int);
 int     format1(const struct stat *,    /* stat info */  int     format1(const struct stat *,    /* stat info */
             const char *,               /* the file name */              const char *,               /* the file name */
             const char *, int,          /* the format string itself */              const char *, int,          /* the format string itself */
Line 167 
Line 167 
 main(int argc, char *argv[])  main(int argc, char *argv[])
 {  {
         struct stat st;          struct stat st;
         int ch, rc, errs, am_readlink;          int ch, rc, errs;
         int lsF, fmtchar, usestat, fn, nonl, quiet;          int lsF, fmtchar, usestat, fn, nonl, quiet;
         char *statfmt, *options, *synopsis;          char *statfmt, *options, *synopsis;
   
         am_readlink = 0;  
         lsF = 0;          lsF = 0;
         fmtchar = '\0';          fmtchar = '\0';
         usestat = 0;          usestat = 0;
Line 181 
Line 180 
         statfmt = NULL;          statfmt = NULL;
         timefmt = NULL;          timefmt = NULL;
   
         if (strcmp(__progname, "readlink") == 0) {          options = "f:FlLnqrst:x";
                 am_readlink = 1;          synopsis = "[-FlLnqrsx] [-f format] [-t timefmt] [file ...]";
                 options = "n";  
                 synopsis = "[-n] [file ...]";  
                 statfmt = "%Y";  
                 fmtchar = 'f';  
                 quiet = 1;  
         } else {  
                 options = "f:FlLnqrst:x";  
                 synopsis = "[-FlLnqrsx] [-f format] [-t timefmt] [file ...]";  
         }  
   
         while ((ch = getopt(argc, argv, options)) != -1)          while ((ch = getopt(argc, argv, options)) != -1)
                 switch (ch) {                  switch (ch) {
Line 292 
Line 282 
                                 warn("%s: stat",                                  warn("%s: stat",
                                     argc == 0 ? "(stdin)" : argv[0]);                                      argc == 0 ? "(stdin)" : argv[0]);
                 } else                  } else
                         output(&st, argv[0], statfmt, fn, nonl, quiet);                          output(&st, argv[0], statfmt, fn, nonl);
   
                 argv++;                  argv++;
                 argc--;                  argc--;
                 fn++;                  fn++;
         } while (argc > 0);          } while (argc > 0);
   
         return (am_readlink ? linkfail : errs);          return (errs);
 }  }
   
 void  void
Line 315 
Line 305 
  */   */
 void  void
 output(const struct stat *st, const char *file,  output(const struct stat *st, const char *file,
     const char *statfmt, int fn, int nonl, int quiet)      const char *statfmt, int fn, int nonl)
 {  {
         int flags, size, prec, ofmt, hilo, what;          int flags, size, prec, ofmt, hilo, what;
         char buf[PATH_MAX];          char buf[PATH_MAX];

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6