diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-12-10 16:33:43 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-12-10 16:33:43 +0000 |
commit | 1f3eb662eba1d792d0aff58cbe37f0976f330bb3 (patch) | |
tree | f2120e877d655bb80cdbc1ef53b45477d7d427c0 /Build | |
parent | 91d1d5325b6cf10a4cac8be6894d2dd548395ca4 (diff) |
remove look_for_cmd() from mingw32.c
git-svn-id: svn://tug.org/texlive/trunk@28490 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/mingw32.c | 101 |
2 files changed, 4 insertions, 101 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 7da5de83abc..15414d79e41 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,7 @@ +2012-12-10 Peter Breitenlohner <peb@mppmu.mpg.de> + + * mingw32.c: Remove look_for_cmd(). + 2012-12-10 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * win32lib.c: remove look_for_cmd(). diff --git a/Build/source/texk/kpathsea/mingw32.c b/Build/source/texk/kpathsea/mingw32.c index 746e7452b34..1567a5f6a7e 100644 --- a/Build/source/texk/kpathsea/mingw32.c +++ b/Build/source/texk/kpathsea/mingw32.c @@ -386,107 +386,6 @@ win32_get_long_filename (char * name, char * buf, int size) return TRUE; } -/* - This does make sense only under WIN32. - Functions: - - look_for_cmd() : locates an executable file - */ - -/* - This part looks for the real location of the program invoked - by cmd. If it can find the program, that's good. Else - command processor is invoked. -*/ - -BOOL -look_for_cmd(const char *cmd, char **app) -{ - char *env_path; - const char *p, *q; - char pname[MAXPATHLEN], *fp; - const char *suffixes[] = { ".bat", ".cmd", ".com", ".exe", NULL }; - const char **s; - char *app_name; - - BOOL go_on; - - *app = NULL; - app_name = NULL; - - /* We should look for the application name along the PATH, - and decide to prepend "%COMSPEC% /c " or not to the command line. - Do nothing for the moment. */ - - /* Another way to do that would be to try CreateProcess first without - invoking cmd, and look at the error code. If it fails because of - command not found, try to prepend "cmd /c" to the cmd line. - */ - - /* Look for the application name */ - for (p = cmd; *p && isspace(*p); p++); - if (*p == '"') { - q = ++p; - while(*p && *p != '"') p++; - if (*p == '\0') { - fprintf(stderr, "Look_for_cmd: malformed command (\" not terminated)\n"); - return FALSE; - } - } - else - for (q = p; *p && !isspace(*p); p++); - /* q points to the beginning of appname, p to the last + 1 char */ - if ((app_name = malloc(p - q + 1)) == NULL) { - fprintf(stderr, "Look_for_cmd: malloc(app_name) failed.\n"); - return FALSE; - } - strncpy(app_name, q, p - q ); - app_name[p - q] = '\0'; - pname[0] = '\0'; -#ifdef TRACE - fprintf(stderr, "popen: app_name = %s\n", app_name); -#endif - - { - char *tmp = getenv("PATH"); - env_path = xmalloc(strlen(tmp) + 3); - strcpy(env_path, ".;"); - strcat(env_path, tmp); - } - - /* Looking for appname on the path */ - for (s = suffixes, go_on = TRUE; go_on; s++) { - if (SearchPath(env_path, /* Address of search path */ - app_name, /* Address of filename */ - *s, /* Address of extension */ - MAXPATHLEN, /* Size of destination buffer */ - pname, /* Address of destination buffer */ - &fp) /* File part of app_name */ - != 0) { -#ifdef TRACE - fprintf(stderr, "%s found with suffix %s\nin %s\n", app_name, *s, pname); -#endif - free(app_name); - app_name = xstrdup(pname); - break; - } - go_on = (*s != NULL); - } - if (go_on == FALSE) { - /* the app_name was not found */ -#ifdef TRACE - fprintf(stderr, "%s not found, concatenating comspec\n", app_name); -#endif - free(app_name); - app_name = NULL; - } - if (env_path) free(env_path); - - *app = app_name; - - return TRUE; - -} - /* special TeXLive Ghostscript */ static int is_dir (char *buff) |