$NetBSD: patch-aa,v 1.1 2001/03/25 23:47:11 fredb Exp $ --- src/filehandling_functions.c.orig Tue Jun 6 13:48:58 2000 +++ src/filehandling_functions.c @@ -670,10 +670,14 @@ { char curdir[1024]; int i, infolen, wsklen; +#ifndef DFLT_INFOPATH int localdir = 0, globaldir = 0; /* flags, which say if the /usr/local/info * * and /usr/info were defined in $INFOPATH */ int sharedir = 0; /* the same for /usr/share/info */ +#endif char *lang = getenv ("LANG"); + char *infopath; + char *wsk; getcwd (curdir, 1024); @@ -681,29 +685,44 @@ infopathcount = 0; +#ifdef DFLT_INFOPATH + if (getenv ("INFOPATH") == NULL) + { + infopath = xmalloc (strlen (DFLT_INFOPATH) + 100); + strcpy (infopath, DFLT_INFOPATH); + } + else +#else if (getenv ("INFOPATH") != NULL) /* check paths in $INFOPATH variable */ +#endif { - char *infopath = xmalloc (strlen (getenv ("INFOPATH")) + 100); + infopath = xmalloc (strlen (getenv ("INFOPATH")) + 100); /* * +5 (well, +100) of overrun buffer, since the following while loop * can be coded simplier this way */ - char *wsk = infopath; strcpy (infopath, getenv ("INFOPATH")); +#ifdef DFLT_INFOPATH + } + { +#endif infolen = strlen (infopath); for (i = 0; i < infolen; i++) if (infopath[i] == ':') infopath[i] = 0; + wsk = infopath; while (wsk < infopath + infolen) { infopaths = xrealloc (infopaths, (infopathcount + 2) * sizeof (char *)); wsklen = strlen (wsk); +#ifndef DFLT_INFOPATH if (strncmp ("/usr/info", wsk, 9) == 0) globaldir = 1; if (strncmp ("/usr/local/info", wsk, 15) == 0) localdir = 1; if (strncmp ("/usr/share/info", wsk, 15) == 0) sharedir = 1; +#endif if (wsklen) { if (wsk[wsklen - 1] == '/') @@ -734,6 +753,7 @@ xfree (infopath); infopath = 0; } +#ifndef DFLT_INFOPATH if (lang) { infopaths = xrealloc (infopaths, sizeof (char *) * (infopathcount + 15)); @@ -799,6 +819,7 @@ infopathcount++; } } +#endif infopaths[infopathcount] = xmalloc (5); strcpy (infopaths[infopathcount], "."); /* for ./ */ infopathcount++;