-const char *
-skeleton_find (const char *envvar, const char *skeleton_name)
-{
- const char *res = getenv (envvar);
-
-#if defined (MSDOS) || defined (_WIN32)
- if (!res)
- {
- /* Skeleton file name without path */
- const char *skel_name = strrchr (skeleton_name, '/');
- if (!skel_name)
- skel_name = strrchr (skeleton_name, '\\');
- if (!skel_name)
- skel_name = skeleton_name;
- else
- ++skel_name;
-
- /* File doesn't exist in current directory; try in INIT directory. */
- const char *cp = getenv ("INIT");
- if (cp)
- {
- res = XMALLOC (char, strlen (cp) + strlen (skel_name) + 2);
- sprintf (res, "%s%c%s", cp, '\\', skel_name);
- }
- else if (access (skel_name, 4) == 0) /* Look in current dir. */
- res = skel_name;
- else
- {
- /* Look in program locations dir. */
- extern char *program_name;
- cp = strrchr(program_name, '\\');
- if (!cp)
- return skeleton_name;
- else
- ++cp;
- res = XMALLOC (char, cp - program_name + strlen (skel_name) + 1);
- strncpy (res, program_name, cp - program_name);
- strcpy (res + (cp - program_name), skel_name);
- }
- }
-#endif /* defined (MSDOS) || defined (_WIN32) */
- if (!res)
- res = skeleton_name;
-
- return res;
-}
-\f
-
-/*----------------------------------------------------------------.
-| Compute BASE_NAME, SHORT_BASE_NAME and output files extensions. |
-`----------------------------------------------------------------*/
-
-/* Replace all characters FROM by TO in the string IN.
- and returns a new allocated string. */
-static char *
-tr (const char *in, char from, char to)
-{
- char *temp;
- char *out;
-
- out = XMALLOC (char, strlen (in) + 1);
-
- for (temp = out; *in; in++, out++)
- if (*in == from)
- *out = to;
- else
- *out = *in;
- *out = 0;
- return (temp);
-}
-
-/* Computes extensions from the grammar file extension. */