allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (01/22/89)
Posting-number: Volume 6, Issue 2 Submitted-by: seindal@sleipner.diku.dk.UUCP (Rene' Seindal) Archive-name: dvi2tty.patch1 The following patch is necessary for dvi2tty to work on machines that trap NULL pointers. The posted version didn't test the return value of ``getenv("DVI2TTY")''. Rene' Seindal (seindal@diku.dk). ------------------------------------------------------------------------ *** /tmp/,RCSt1a03240 Thu Jan 5 13:08:24 1989 --- /tmp/,RCSt2a03240 Thu Jan 5 13:08:25 1989 *************** *** 263,294 **** else path = DEFPAGER; /* pathname of pager program */ ! envp = getenv("DVI2TTY"); ! while ((*envp == ' ') && (*envp != '\0')) ! envp++; ! while (*envp) { /* environment var args */ ! if (strchr(optset, optch = *envp++) != NULL) { ! /* ! * we always pass one option, and arrange for optarg ourselfves, ! * so setoption does not mesh up Argv ! */ ! if (strchr(optwarg, optch) != NULL) { ! while ((*envp == ' ') && (*envp != '\0')) ! envp++; ! if (*envp == '\0') ! usage(noarg); ! str = envp; /* str points to optarg */ ! while ((*envp != ' ') && (*envp != '\0')) ! *envp++; /* set envp just after optarg */ ! if (*envp != '\0') ! *envp++ = '\0'; /* end optarg string */ ! } ! setoption(optch, optset, optwarg, str); ! } ! else ! usage(bdopt); ! while ((*envp == ' ') && (*envp != '\0')) ! envp++; } while (--Argc > 0) { /* command line args */ --- 263,295 ---- else path = DEFPAGER; /* pathname of pager program */ ! if ((envp = getenv("DVI2TTY")) != 0) { ! while ((*envp == ' ') && (*envp != '\0')) ! envp++; ! while (*envp) { /* environment var args */ ! if (strchr(optset, optch = *envp++) != NULL) { ! /* ! * we always pass one option, and arrange for optarg ! * ourselfves, so setoption does not mesh up Argv ! */ ! if (strchr(optwarg, optch) != NULL) { ! while ((*envp == ' ') && (*envp != '\0')) ! envp++; ! if (*envp == '\0') ! usage(noarg); ! str = envp; /* str points to optarg */ ! while ((*envp != ' ') && (*envp != '\0')) ! *envp++; /* set envp just after optarg */ ! if (*envp != '\0') ! *envp++ = '\0'; /* end optarg string */ ! } ! setoption(optch, optset, optwarg, str); ! } ! else ! usage(bdopt); ! while ((*envp == ' ') && (*envp != '\0')) ! envp++; ! } } while (--Argc > 0) { /* command line args */