/[m4]/m4/m4/path.c
ViewVC logotype

Diff of /m4/m4/path.c

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

revision 1.3 by gary, Mon Aug 20 19:42:38 2001 UTC revision 1.4 by gary, Fri Jun 20 15:43:20 2003 UTC
# Line 117  m4_include_init (void) Line 117  m4_include_init (void)
117  /* Functions for normal input path search */  /* Functions for normal input path search */
118    
119  void  void
120  m4_include_env_init (void)  m4_include_env_init (m4 *context)
121  {  {
122    if (no_gnu_extensions)    if (m4_get_no_gnu_extensions_opt (context))
123      return;      return;
124    
125    m4_search_path_env_init (&dirpath, getenv ("M4PATH"), FALSE);    m4_search_path_env_init (&dirpath, getenv ("M4PATH"), FALSE);
126  }  }
127    
128  void  void
129  m4_add_include_directory (const char *dir)  m4_add_include_directory (m4 *context, const char *dir)
130  {  {
131    if (no_gnu_extensions)    if (m4_get_no_gnu_extensions_opt (context))
132      return;      return;
133    
134    m4_search_path_add (&dirpath, dir);    m4_search_path_add (&dirpath, dir);
# Line 139  m4_add_include_directory (const char *di Line 139  m4_add_include_directory (const char *di
139  }  }
140    
141  FILE *  FILE *
142  m4_path_search (const char *dir, char **expanded_name)  m4_path_search (m4 *context, const char *dir, char **expanded_name)
143  {  {
144    FILE *fp;    FILE *fp;
145    struct m4_search_path *incl;    struct m4_search_path *incl;
# Line 155  m4_path_search (const char *dir, char ** Line 155  m4_path_search (const char *dir, char **
155      }      }
156    
157    /* If file not found, and filename absolute, fail.  */    /* If file not found, and filename absolute, fail.  */
158    if (*dir == '/' || no_gnu_extensions)    if (*dir == '/' || m4_get_no_gnu_extensions_opt (context))
159      return NULL;      return NULL;
160    
161    name = (char *) xmalloc (dirpath.max_length + 1 + strlen (dir) + 1);    name = (char *) xmalloc (dirpath.max_length + 1 + strlen (dir) + 1);
# Line 173  m4_path_search (const char *dir, char ** Line 173  m4_path_search (const char *dir, char **
173        fp = fopen (name, "r");        fp = fopen (name, "r");
174        if (fp != NULL)        if (fp != NULL)
175          {          {
176            if (debug_level & M4_DEBUG_TRACE_PATH)            if (BIT_TEST (m4_get_debug_level_opt (context), M4_DEBUG_TRACE_PATH))
177              M4_DEBUG_MESSAGE2 (_("Path search for `%s' found `%s'"), dir, name);              M4_DEBUG_MESSAGE2 (context, _("Path search for `%s' found `%s'"),
178                                   dir, name);
179    
180            if (expanded_name != NULL)            if (expanded_name != NULL)
181              *expanded_name = xstrdup (name);              *expanded_name = xstrdup (name);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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