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

Diff for /src/usr.bin/make/lowparse.c between version 1.29 and 1.30

version 1.29, 2012/09/21 07:55:20 version 1.30, 2012/10/02 10:29:31
Line 42 
Line 42 
 #include "error.h"  #include "error.h"
 #include "lst.h"  #include "lst.h"
 #include "memory.h"  #include "memory.h"
   #include "pathnames.h"
 #ifndef LOCATION_TYPE  #ifndef LOCATION_TYPE
 #include "location.h"  #include "location.h"
 #endif  #endif
Line 126 
Line 127 
         curdir_len = strlen(dir);          curdir_len = strlen(dir);
 }  }
   
   static bool
   startswith(const char *f, const char *s, size_t len)
   {
           return strncmp(f, s, len) == 0 && f[len] == '/';
   }
   
 static const char *  static const char *
 simplify(const char *filename)  simplify(const char *filename)
 {  {
         if (strncmp(curdir, filename, curdir_len) == 0 &&          if (startswith(filename, curdir, curdir_len))
             filename[curdir_len] == '/')  
                 return filename + curdir_len + 1;                  return filename + curdir_len + 1;
         else          else if (startswith(filename, _PATH_DEFSYSPATH,
               sizeof(_PATH_DEFSYSPATH)-1)) {
                   size_t sz;
                   char *buf;
                   sz = strlen(filename) - sizeof(_PATH_DEFSYSPATH)+3;
                   buf = emalloc(sz);
                   snprintf(buf, sz, "<%s>", filename+sizeof(_PATH_DEFSYSPATH));
                   return buf;
           } else
                 return filename;                  return filename;
 }  }
   
Line 472 
Line 486 
         }          }
 }  }
   
 #ifdef CLEANUP  
 void  void
 LowParse_Init(void)  
 {  
         Static_Lst_Init(&input_stack);  
         current = NULL;  
 }  
   
 void  
 LowParse_End(void)  
 {  
         Lst_Destroy(&input_stack, NOFREE);      /* Should be empty now */  
 #if 0  
         Lst_Destroy(&fileNames, (SimpleProc)free);  
 #endif  
 }  
 #endif  
   
   
 void  
 Parse_ReportErrors(void)  Parse_ReportErrors(void)
 {  {
         if (fatal_errors) {          if (fatal_errors) {
 #ifdef CLEANUP  
                 while (Parse_NextFile())  
                         ;  
 #endif  
                 fprintf(stderr,                  fprintf(stderr,
                     "Fatal errors encountered -- cannot continue\n");                      "Fatal errors encountered -- cannot continue\n");
                 exit(1);                  exit(1);

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30