[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.16 and 1.17

version 1.16, 2011/10/06 23:27:04 version 1.17, 2011/10/07 20:07:25
Line 55 
Line 55 
   
 char *NULLUNIT = "";  char *NULLUNIT = "";
   
 #define SEPERATOR       ":"  
   
 int unitcount;  int unitcount;
 int prefixcount;  int prefixcount;
   
Line 113 
Line 111 
         } else {          } else {
                 unitfile = fopen(UNITSFILE, "r");                  unitfile = fopen(UNITSFILE, "r");
                 if (!unitfile) {                  if (!unitfile) {
                         char filename[1000], separator[2] = SEPERATOR;                          fprintf(stderr, "Can't find units file '%s'\n",
                         char *direc, *env;                              UNITSFILE);
                           exit(1);
                         env = getenv("PATH");  
                         if (env) {  
                                 direc = strtok(env, separator);  
                                 while (direc) {  
                                         snprintf(filename, sizeof(filename),  
                                             "%s/%s", direc, UNITSFILE);  
                                         unitfile = fopen(filename, "r");  
                                         if (unitfile)  
                                                 break;  
                                         direc = strtok(NULL, separator);  
                                 }  
                         }  
                         if (!unitfile) {  
                                 fprintf(stderr, "Can't find units file '%s'\n",  
                                     UNITSFILE);  
                                 exit(1);  
                         }  
                 }                  }
         }          }
         while (!feof(unitfile)) {          while (!feof(unitfile)) {

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