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

Diff for /src/usr.bin/uuencode/uuencode.c between version 1.7 and 1.8

version 1.7, 2004/04/09 22:54:02 version 1.8, 2008/07/05 20:59:42
Line 63 
Line 63 
   
 void encode(void);  void encode(void);
 void base64_encode(void);  void base64_encode(void);
 static void usage(void);  static void usage(int);
   
 FILE *output;  FILE *output;
 int mode;  int mode;
 char **av;  char **av;
   
   /*
    * program modes
    */
   #define MODE_ENCODE     0
   #define MODE_B64ENCODE  1
   
 int  int
 main(int argc, char *argv[])  main(int argc, char *argv[])
 {  {
         struct stat sb;          struct stat sb;
         int base64;          int base64, ch, mode;
         int ch;  
         char *outfile;          char *outfile;
         extern char *__progname;          extern char *__progname;
           static const char *optstr[2] = {
                   "mo:",
                   "o:"
           };
   
         base64 = 0;          base64 = mode = 0;
         outfile = NULL;          outfile = NULL;
   
         if (strcmp(__progname, "b64encode") == 0)          if (strcmp(__progname, "b64encode") == 0) {
                 base64 = 1;                  base64 = 1;
                   mode = MODE_B64ENCODE;
           }
   
         setlocale(LC_ALL, "");          setlocale(LC_ALL, "");
         while ((ch = getopt(argc, argv, "mo:")) != -1) {          while ((ch = getopt(argc, argv, optstr[mode])) != -1) {
                 switch (ch) {                  switch (ch) {
                 case 'm':                  case 'm':
                         base64 = 1;                          base64 = 1;
Line 95 
Line 106 
                         break;                          break;
                 case '?':                  case '?':
                 default:                  default:
                         usage();                          usage(mode);
                 }                  }
         }          }
         argv += optind;          argv += optind;
Line 115 
Line 126 
                 break;                  break;
         case 0:          case 0:
         default:          default:
                 usage();                  usage(mode);
         }          }
   
         av = argv;          av = argv;
Line 216 
Line 227 
 }  }
   
 static void  static void
 usage(void)  usage(int mode)
 {  {
         (void)fprintf(stderr,          switch (mode) {
             "usage: uuencode [-m] [-o outfile] [infile] remotefile\n"          case MODE_ENCODE:
             "       b64encode [-o outfile] [infile] remotefile\n");                  (void)fprintf(stderr,
                       "usage: uuencode [-m] [-o output_file] [file] name\n");
                   break;
           case MODE_B64ENCODE:
                   (void)fprintf(stderr,
                       "usage: b64encode [-o output_file] [file] name\n");
                   break;
           }
         exit(1);          exit(1);
 }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8