/[bison]/bison/src/files.c
ViewVC logotype

Diff of /bison/src/files.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.65 by akim, Tue Jan 8 17:28:18 2002 UTC revision 1.66 by akim, Wed Jan 9 13:03:20 2002 UTC
# Line 253  tr (const char *in, char from, char to) Line 253  tr (const char *in, char from, char to)
253    return (temp);    return (temp);
254  }  }
255    
 /* Gets the extension index in FILENAME. Returns 0 if fails to  
    find an extension.  */  
 static int  
 get_extension_index (const char *filename)  
 {  
   int len;  
   
   len = strlen (filename);  
   
   if (filename[len-- - 1] == '.')  
     return (0);  
   
   while ((len > 0) && (filename[len - 1] != '.'))  
     if (filename[len - 1] == '/')  
       return (0);  
     else  
       len--;  
   
   return (len - 1);  
 }  
   
256  /* Computes extensions from the grammar file extension. */  /* Computes extensions from the grammar file extension. */
257  static void  static void
258  compute_exts_from_gf (const char *ext)  compute_exts_from_gf (const char *ext)
# Line 338  filename_split (const char *filename, Line 317  filename_split (const char *filename,
317    /* If there is an exentension, check if there is a `.tab' part right    /* If there is an exentension, check if there is a `.tab' part right
318       before.  */       before.  */
319    if (*ext    if (*ext
320        && (*ext - *base) > strlen (".tab")        && (*ext - *base) > (int) strlen (".tab")
321        && (!strncmp (*ext - strlen (".tab"), ".tab", strlen (".tab"))        && (!strncmp (*ext - strlen (".tab"), ".tab", strlen (".tab"))
322            || !strncmp (*ext - strlen ("_tab"), "_tab", strlen ("_tab"))))            || !strncmp (*ext - strlen ("_tab"), "_tab", strlen ("_tab"))))
323      *tab = *ext - strlen (".tab");      *tab = *ext - strlen (".tab");
# Line 351  static void Line 330  static void
330  compute_base_names (void)  compute_base_names (void)
331  {  {
332    const char *base, *tab, *ext;    const char *base, *tab, *ext;
   size_t base_length;  
   size_t short_base_length;  
   size_t ext_index;  
333    
334    /* If --output=foo.c was specified (SPEC_OUTFILE == foo.c),    /* If --output=foo.c was specified (SPEC_OUTFILE == foo.c),
335       BASE_NAME and SHORT_BASE_NAME are `foo'.       BASE_NAME and SHORT_BASE_NAME are `foo'.
# Line 365  compute_base_names (void) Line 341  compute_base_names (void)
341       files, remove the ".c" or ".tab.c" suffix.  */       files, remove the ".c" or ".tab.c" suffix.  */
342    if (spec_outfile)    if (spec_outfile)
343      {      {
       const char *cp;  
344        filename_split (spec_outfile, &base, &tab, &ext);        filename_split (spec_outfile, &base, &tab, &ext);
345    
346        /* The full base name goes up the EXT, excluding it. */        /* The full base name goes up the EXT, excluding it. */

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26