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

Diff for /src/usr.bin/uudecode/uudecode.c between version 1.15 and 1.16

version 1.15, 2008/07/05 20:59:42 version 1.16, 2008/07/29 18:25:28
Line 69 
Line 69 
 static FILE *infp, *outfp;  static FILE *infp, *outfp;
 static int base64, cflag, iflag, oflag, pflag, rflag, sflag;  static int base64, cflag, iflag, oflag, pflag, rflag, sflag;
   
 static void     usage(int);  static void     usage(void);
 static int      decode(void);  static int      decode(void);
 static int      decode2(void);  static int      decode2(void);
 static int      uu_decode(void);  static int      uu_decode(void);
 static int      base64_decode(void);  static int      base64_decode(void);
   
 /*  enum program_mode {
  * program modes          MODE_DECODE,
  */          MODE_B64DECODE
 #define MODE_DECODE     0  } pmode;
 #define MODE_B64DECODE  1  
   
 int  int
 main(int argc, char *argv[])  main(int argc, char *argv[])
 {  {
         int rval, ch, mode;          int rval, ch;
         extern char *__progname;          extern char *__progname;
         static const char *optstr[2] = {          static const char *optstr[2] = {
                 "cimo:prs",                  "cimo:prs",
                 "cio:prs"                  "cio:prs"
         };          };
   
         mode = 0;          pmode = MODE_DECODE;
   
         if (strcmp(__progname, "b64decode") == 0) {          if (strcmp(__progname, "b64decode") == 0) {
                 base64 = 1;                  base64 = 1;
                 mode = MODE_B64DECODE;                  pmode = MODE_B64DECODE;
         }          }
   
         setlocale(LC_ALL, "");          setlocale(LC_ALL, "");
         while ((ch = getopt(argc, argv, optstr[mode])) != -1) {          while ((ch = getopt(argc, argv, optstr[pmode])) != -1) {
                 switch(ch) {                  switch(ch) {
                 case 'c':                  case 'c':
                         if (oflag || rflag)                          if (oflag || rflag)
                                 usage(mode);                                  usage();
                         cflag = 1; /* multiple uudecode'd files */                          cflag = 1; /* multiple uudecode'd files */
                         break;                          break;
                 case 'i':                  case 'i':
Line 114 
Line 112 
                         break;                          break;
                 case 'o':                  case 'o':
                         if (cflag || pflag || rflag || sflag)                          if (cflag || pflag || rflag || sflag)
                                 usage(mode);                                  usage();
                         oflag = 1; /* output to the specified file */                          oflag = 1; /* output to the specified file */
                         sflag = 1; /* do not strip pathnames for output */                          sflag = 1; /* do not strip pathnames for output */
                         outfile = optarg; /* set the output filename */                          outfile = optarg; /* set the output filename */
                         break;                          break;
                 case 'p':                  case 'p':
                         if (oflag)                          if (oflag)
                                 usage(mode);                                  usage();
                         pflag = 1; /* print output to stdout */                          pflag = 1; /* print output to stdout */
                         break;                          break;
                 case 'r':                  case 'r':
                         if (cflag || oflag)                          if (cflag || oflag)
                                 usage(mode);                                  usage();
                         rflag = 1; /* decode raw data */                          rflag = 1; /* decode raw data */
                         break;                          break;
                 case 's':                  case 's':
                         if (oflag)                          if (oflag)
                                 usage(mode);                                  usage();
                         sflag = 1; /* do not strip pathnames for output */                          sflag = 1; /* do not strip pathnames for output */
                         break;                          break;
                 default:                  default:
                         usage(mode);                          usage();
                 }                  }
         }          }
         argc -= optind;          argc -= optind;
Line 450 
Line 448 
 }  }
   
 static void  static void
 usage(int mode)  usage(void)
 {  {
         switch (mode) {          switch (pmode) {
         case MODE_DECODE:          case MODE_DECODE:
                 (void)fprintf(stderr,                  (void)fprintf(stderr,
                     "usage: uudecode [-cimprs] [file ...]\n"                      "usage: uudecode [-cimprs] [file ...]\n"

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16