Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software: you can redistribute it and/or modify
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software: you can redistribute it and/or modify
find_in_path (const char *progname)
{
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
find_in_path (const char *progname)
{
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
- /* Win32, Cygwin, OS/2, DOS */
+ /* Native Windows, Cygwin, OS/2, DOS */
/* The searching rules with .COM, .EXE, .BAT, .CMD etc. suffixes are
too complicated. Leave it to the OS. */
return progname;
/* The searching rules with .COM, .EXE, .BAT, .CMD etc. suffixes are
too complicated. Leave it to the OS. */
return progname;
- On other systems, let's hope that this program is not installed
- setuid or setgid, so that it is ok to call access() despite its
- design flaw. */
+ On other systems, let's hope that this program is not installed
+ setuid or setgid, so that it is ok to call access() despite its
+ design flaw. */
- {
- /* Found! */
- if (strcmp (progpathname, progname) == 0)
- {
- free (progpathname);
-
- /* Add the "./" prefix for real, that xconcatenated_filename()
- optimized away. This avoids a second PATH search when the
- caller uses execlp/execvp. */
- progpathname = XNMALLOC (2 + strlen (progname) + 1, char);
- progpathname[0] = '.';
- progpathname[1] = '/';
- memcpy (progpathname + 2, progname, strlen (progname) + 1);
- }
-
- free (path);
- return progpathname;
- }
+ {
+ /* Found! */
+ if (strcmp (progpathname, progname) == 0)
+ {
+ free (progpathname);
+
+ /* Add the "./" prefix for real, that xconcatenated_filename()
+ optimized away. This avoids a second PATH search when the
+ caller uses execlp/execvp. */
+ progpathname = XNMALLOC (2 + strlen (progname) + 1, char);
+ progpathname[0] = '.';
+ progpathname[1] = '/';
+ memcpy (progpathname + 2, progname, strlen (progname) + 1);
+ }
+
+ free (path);
+ return progpathname;
+ }