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

Diff for /src/usr.bin/units/units.c between version 1.17 and 1.18

version 1.17, 2011/10/07 20:07:25 version 1.18, 2013/01/04 19:31:28
Line 612 
Line 612 
 usage(void)  usage(void)
 {  {
         fprintf(stderr,          fprintf(stderr,
             "usage: units [-qv] [-f filename] [from-unit to-unit]\n");              "usage: units [-qv] [-f filename] [[count] from-unit to-unit]\n");
         exit(3);          exit(3);
 }  }
   
Line 651 
Line 651 
                 }                  }
         }          }
   
         if (optind != argc - 2 && optind != argc)          argc -= optind;
           argv += optind;
   
           if (argc != 3 && argc != 2 && argc != 0)
                 usage();                  usage();
   
         readunits(userfile);          readunits(userfile);
   
         if (optind == argc - 2) {          if (argc == 3) {
                 strlcpy(havestr, argv[optind], sizeof(havestr));                  strlcpy(havestr, argv[0], sizeof(havestr));
                 strlcpy(wantstr, argv[optind + 1], sizeof(wantstr));                  strlcat(havestr, " ", sizeof(havestr));
                   strlcat(havestr, argv[1], sizeof(havestr));
                   argc--;
                   argv++;
                   argv[0] = havestr;
           }
   
           if (argc == 2) {
                   strlcpy(havestr, argv[0], sizeof(havestr));
                   strlcpy(wantstr, argv[1], sizeof(wantstr));
                 initializeunit(&have);                  initializeunit(&have);
                 addunit(&have, havestr, 0);                  addunit(&have, havestr, 0);
                 completereduce(&have);                  completereduce(&have);

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18