From 1f3eb662eba1d792d0aff58cbe37f0976f330bb3 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Mon, 10 Dec 2012 16:33:43 +0000 Subject: remove look_for_cmd() from mingw32.c git-svn-id: svn://tug.org/texlive/trunk@28490 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/mingw32.c | 101 ----------------------------------- 1 file changed, 101 deletions(-) (limited to 'Build/source/texk/kpathsea/mingw32.c') 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) -- cgit v1.2.3