/[groff]/groff/src/libs/libgroff/relocate.cpp
ViewVC logotype

Diff of /groff/src/libs/libgroff/relocate.cpp

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

revision 1.1 by wl, Sat Apr 2 12:49:11 2005 UTC revision 1.2 by wl, Sat Apr 30 07:03:14 2005 UTC
# Line 35  Line 35 
35  #endif  #endif
36    
37  #define INSTALLPATHLEN (sizeof(INSTALLPATH) - 1)  #define INSTALLPATHLEN (sizeof(INSTALLPATH) - 1)
38  #define DEBUG 0  #ifndef DEBUG
39    # define DEBUG 0
40    #endif
41    
42  extern "C" const char *program_name;  extern "C" const char *program_name;
43    
# Line 82  char *searchpath(const char *name, const Line 84  char *searchpath(const char *name, const
84    // or if NAME is found in the current directory.    // or if NAME is found in the current directory.
85    if (!access (name, F_OK)) {    if (!access (name, F_OK)) {
86      path = new char[path_name_max()];      path = new char[path_name_max()];
87    #ifdef _WIN32
88        path = _fullpath(path, name, path_name_max());
89    #else
90      path = realpath(name, path);      path = realpath(name, path);
91    #endif
92  #if DEBUG  #if DEBUG
93      fprintf(stderr, "searchpath: found `%s'\n", path);      fprintf(stderr, "searchpath: found `%s'\n", path);
94  #endif  #endif
# Line 167  void set_current_prefix() Line 173  void set_current_prefix()
173  # if DEBUG  # if DEBUG
174    fprintf(stderr, "curr_prefix: %s\n", curr_prefix);    fprintf(stderr, "curr_prefix: %s\n", curr_prefix);
175  # endif /* DEBUG */  # endif /* DEBUG */
176  #else /* _WIN32 */  #else /* !_WIN32 */
177    curr_prefix = searchpath(program_name, getenv("PATH"));    curr_prefix = searchpath(program_name, getenv("PATH"));
178    if (!curr_prefix && !strchr(program_name, '.')) {     // try with extensions    if (!curr_prefix && !strchr(program_name, '.')) {     // try with extensions
179      pathextstr = strsave(getenv("PATHEXT"));      pathextstr = strsave(getenv("PATHEXT"));
# Line 178  void set_current_prefix() Line 184  void set_current_prefix()
184    }    }
185    if (!curr_prefix)    if (!curr_prefix)
186      return;      return;
187  #endif /* _WIN32 */  #endif /* !_WIN32 */
188    msw2posixpath(curr_prefix);    msw2posixpath(curr_prefix);
189  #if DEBUG  #if DEBUG
190    fprintf(stderr, "curr_prefix: %s\n", curr_prefix);    fprintf(stderr, "curr_prefix: %s\n", curr_prefix);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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