home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume06 / dvi2tty.pc1 < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  3.5 KB

  1. From decwrl!purdue!mailrus!csd4.milw.wisc.edu!leah!itsgw!steinmetz!uunet!allbery Sun Jan 22 15:42:27 PST 1989
  2. Article 777 of comp.sources.misc:
  3. Path: granite!decwrl!purdue!mailrus!csd4.milw.wisc.edu!leah!itsgw!steinmetz!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v06i002: dvi2tty bugfix
  7. Message-ID: <46898@uunet.UU.NET>
  8. Date: 21 Jan 89 20:22:28 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: seindal@sleipner.diku.dk.UUCP (Rene' Seindal)
  11. Lines: 81
  12. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  13.  
  14. Posting-number: Volume 6, Issue 2
  15. Submitted-by: seindal@sleipner.diku.dk.UUCP (Rene' Seindal)
  16. Archive-name: dvi2tty.patch1
  17.  
  18. The following patch is necessary for dvi2tty to work on machines that trap
  19. NULL pointers.  The posted version didn't test the return value of
  20. ``getenv("DVI2TTY")''.
  21.  
  22. Rene' Seindal (seindal@diku.dk).
  23.  
  24. ------------------------------------------------------------------------
  25. *** /tmp/,RCSt1a03240    Thu Jan  5 13:08:24 1989
  26. --- /tmp/,RCSt2a03240    Thu Jan  5 13:08:25 1989
  27. ***************
  28. *** 263,294 ****
  29.           else
  30.               path = DEFPAGER;    /* pathname of pager program                 */
  31.   
  32. !     envp = getenv("DVI2TTY");
  33. !     while ((*envp == ' ') && (*envp != '\0'))
  34. !          envp++;
  35. !     while (*envp) {                         /* environment var args          */
  36. !         if (strchr(optset, optch = *envp++) != NULL) {
  37. !             /*
  38. !              * we always pass one option, and arrange for optarg ourselfves,
  39. !              * so setoption does not mesh up Argv
  40. !              */
  41. !             if (strchr(optwarg, optch) != NULL) {
  42. !                 while ((*envp == ' ') && (*envp != '\0'))
  43. !                     envp++;
  44. !                 if (*envp == '\0')
  45. !                     usage(noarg);
  46. !                 str = envp;                 /* str points to optarg          */
  47. !                 while ((*envp != ' ') && (*envp != '\0'))
  48. !                     *envp++;                /* set envp just after optarg    */
  49. !                 if (*envp != '\0')
  50. !                     *envp++ = '\0';         /* end optarg string             */
  51. !             }
  52. !             setoption(optch, optset, optwarg, str);
  53. !         }
  54. !         else
  55. !             usage(bdopt);
  56. !         while ((*envp == ' ') && (*envp != '\0'))
  57. !              envp++;
  58.       }
  59.   
  60.       while (--Argc > 0) {                    /* command line args             */
  61. --- 263,295 ----
  62.           else
  63.               path = DEFPAGER;    /* pathname of pager program                 */
  64.   
  65. !     if ((envp = getenv("DVI2TTY")) != 0) {
  66. !     while ((*envp == ' ') && (*envp != '\0'))
  67. !         envp++;
  68. !     while (*envp) {            /* environment var args                 */
  69. !         if (strchr(optset, optch = *envp++) != NULL) {
  70. !         /*
  71. !          * we always pass one option, and arrange for optarg
  72. !          * ourselfves, so setoption does not mesh up Argv
  73. !          */
  74. !         if (strchr(optwarg, optch) != NULL) {
  75. !             while ((*envp == ' ') && (*envp != '\0'))
  76. !             envp++;
  77. !             if (*envp == '\0')
  78. !             usage(noarg);
  79. !             str = envp;        /* str points to optarg          */
  80. !             while ((*envp != ' ') && (*envp != '\0'))
  81. !             *envp++;    /* set envp just after optarg    */
  82. !             if (*envp != '\0')
  83. !             *envp++ = '\0';    /* end optarg string             */
  84. !         }
  85. !         setoption(optch, optset, optwarg, str);
  86. !         }
  87. !         else
  88. !         usage(bdopt);
  89. !         while ((*envp == ' ') && (*envp != '\0'))
  90. !         envp++;
  91. !     }
  92.       }
  93.   
  94.       while (--Argc > 0) {                    /* command line args             */
  95.  
  96.  
  97.