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.rpt < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  9.8 KB

  1. From decwrl!wyse!uunet!allbery Sun Jan 29 20:29:41 PST 1989
  2. Article 791 of comp.sources.misc:
  3. Path: granite!decwrl!wyse!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v06i017: dvi2tty patch 1
  7. Message-ID: <47749@uunet.UU.NET>
  8. Date: 29 Jan 89 20:30:25 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: marcel@duteca.UUCP (Marcel J.E. Mol)
  11. Organization: Delft University of Technology, Dep. of Electrotechnical engineering.
  12. Lines: 219
  13. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  14.  
  15. Posting-number: Volume 6, Issue 17
  16. Submitted-by: marcel@duteca.UUCP (Marcel J.E. Mol)
  17. Archive-name: dvi2tty.Rpatch1
  18.  
  19. [This is the "official" patch 1.  I actually hadn't intended to post the other,
  20. since I had this one... whoops.  ++bsa]
  21.  
  22. Below follow some bug repairs for the dvi2tty program posted recently.
  23. Thanks to everyone who mailed me bugs or sugestions.
  24.  
  25.  
  26. *** ORG/dvi2tty.c
  27. --- dvi2tty.c
  28. **************
  29. *** 1,5
  30.   /******************************************************************************
  31. !  * Marcel Mol: 1988-10-25  (UUCP: dutesta!mol)
  32.    *        dvi2tty.c dvi2tty.h dvistuff.c commands.h
  33.    *               Converted program to C.
  34.    * bogart:/usr/alla/zap/dvitty/dvitty.p  1986-08-15 20:24:31,
  35. --- 1,8 -----
  36.   /******************************************************************************
  37. !  * Marcel Mol: 1989-01-03  (UUCP: duteca!marcel)
  38. !  *               Fixed a bugs concerning pager programs
  39. !  *               and scanning environment variable DVI2TTY.
  40. !  * Marcel Mol: 1988-10-25  (UUCP: duteca!marcel)
  41.    *        dvi2tty.c dvi2tty.h dvistuff.c commands.h
  42.    *               Converted program to C.
  43.    *               improved spacing between words/characters.
  44. **************
  45. *** 2,7
  46.    * Marcel Mol: 1988-10-25  (UUCP: dutesta!mol)
  47.    *        dvi2tty.c dvi2tty.h dvistuff.c commands.h
  48.    *               Converted program to C.
  49.    * bogart:/usr/alla/zap/dvitty/dvitty.p  1986-08-15 20:24:31,
  50.    *               Version to be sent to mod.sources ready.
  51.    * New option since last version:
  52. --- 5,11 -----
  53.    * Marcel Mol: 1988-10-25  (UUCP: duteca!marcel)
  54.    *        dvi2tty.c dvi2tty.h dvistuff.c commands.h
  55.    *               Converted program to C.
  56. +  *               improved spacing between words/characters.
  57.    * bogart:/usr/alla/zap/dvitty/dvitty.p  1986-08-15 20:24:31,
  58.    *               Version to be sent to mod.sources ready.
  59.    * New option since last version:
  60. **************
  61. *** 78,84
  62.                                 /* don't have terminals with Scand. nat. chars */
  63.   #define WANTPAGER   TRUE      /* default: try to pipe through a pager (like  */
  64.                                 /* more) if stdout is tty and no -o switch     */
  65. ! #define DEFPAGER    "/usr/bin/pg"
  66.   
  67.       /*------------------ end of customization constants ---------------------*/
  68.   
  69. --- 82,88 -----
  70.                                 /* don't have terminals with Scand. nat. chars */
  71.   #define WANTPAGER   TRUE      /* default: try to pipe through a pager (like  */
  72.                                 /* more) if stdout is tty and no -o switch     */
  73. ! #define DEFPAGER    "/usr/bin/pg"   /* CHANGE TO YOUR LOCAL PAGER            */
  74.   
  75.       /*------------------ end of customization constants ---------------------*/
  76.   
  77. **************
  78. *** 82,88
  79.   
  80.       /*------------------ end of customization constants ---------------------*/
  81.   
  82. ! #define MAXLEN          100    /* size of char-arrays for strings          */
  83.   
  84.   /*
  85.    * USAGE CODES
  86. --- 86,92 -----
  87.   
  88.       /*------------------ end of customization constants ---------------------*/
  89.   
  90. ! #define MAXLEN          100    /* size of char-arrays for strings            */
  91.   
  92.   /*
  93.    * USAGE CODES
  94. **************
  95. *** 217,222
  96.                          j = strlen(str);
  97.                          break;
  98.               case 'F' :
  99.                          path = str;
  100.                          j = strlen(str);
  101.                          break;
  102. --- 221,227 -----
  103.                          j = strlen(str);
  104.                          break;
  105.               case 'F' :
  106. +                        pager = TRUE;
  107.                          path = str;
  108.                          j = strlen(str);
  109.                          break;
  110. **************
  111. *** 250,255
  112.       pageswitchon = FALSE;       /* show all pages                            */
  113.       sequenceon   = FALSE;       /* selected pages are TeX-numbered           */
  114.       outputtofile = FALSE;       /* write to stdout                           */
  115.       noffd        = FALSE;       /* print formfeed between pages              */
  116.       scascii      = DEFSCAND;    /* scandinavian, compile time option         */
  117.       ttywidth     = 80;          /* default terminal width                    */
  118. --- 255,261 -----
  119.       pageswitchon = FALSE;       /* show all pages                            */
  120.       sequenceon   = FALSE;       /* selected pages are TeX-numbered           */
  121.       outputtofile = FALSE;       /* write to stdout                           */
  122. +     pager        = WANTPAGER;   /* want paging, compile time option          */
  123.       noffd        = FALSE;       /* print formfeed between pages              */
  124.       scascii      = DEFSCAND;    /* scandinavian, compile time option         */
  125.       ttywidth     = 80;          /* default terminal width                    */
  126. **************
  127. *** 257,267
  128.       optset       = "wpPousqlfF";/* legal options                             */
  129.       optwarg      = "wpPoF";     /* options with argument                     */
  130.   
  131. !     if (pager = WANTPAGER)      /* page program, compile time option         */
  132. !         if ((envp = getenv("PAGER")) != NULL)   /* find prefered pager       */
  133. !         path = envp;        /* default pager from env                    */
  134. !         else
  135. !             path = DEFPAGER;    /* pathname of pager program                 */
  136.   
  137.       envp = getenv("DVI2TTY");
  138.       while ((*envp == ' ') && (*envp != '\0'))
  139. --- 263,270 -----
  140.       optset       = "wpPousqlfF";/* legal options                             */
  141.       optwarg      = "wpPoF";     /* options with argument                     */
  142.   
  143. !     if ((path = getenv("PAGER")) == NULL)   /* find default pathname of page */
  144. !             path = DEFPAGER;             /* program in case paging is wanted */
  145.   
  146.       if ((envp = getenv("DVI2TTY")) != NULL) {
  147.           while ((*envp == ' ') && (*envp != '\0'))
  148. **************
  149. *** 263,292
  150.           else
  151.               path = DEFPAGER;    /* pathname of pager program                 */
  152.   
  153. !     envp = getenv("DVI2TTY");
  154. !     while ((*envp == ' ') && (*envp != '\0'))
  155. !          envp++;
  156. !     while (*envp) {                         /* environment var args          */
  157. !         if (strchr(optset, optch = *envp++) != NULL) {
  158. !             /*
  159. !              * we always pass one option, and arrange for optarg ourselfves,
  160. !              * so setoption does not mesh up Argv
  161. !              */
  162. !             if (strchr(optwarg, optch) != NULL) {
  163. !                 while ((*envp == ' ') && (*envp != '\0'))
  164. !                     envp++;
  165. !                 if (*envp == '\0')
  166. !                     usage(noarg);
  167. !                 str = envp;                 /* str points to optarg          */
  168. !                 while ((*envp != ' ') && (*envp != '\0'))
  169. !                     *envp++;                /* set envp just after optarg    */
  170. !                 if (*envp != '\0')
  171. !                     *envp++ = '\0';         /* end optarg string             */
  172. !             }
  173. !             setoption(optch, optset, optwarg, str);
  174. !         }
  175. !         else
  176. !             usage(bdopt);
  177.           while ((*envp == ' ') && (*envp != '\0'))
  178.                envp++;
  179.       }
  180. --- 266,272 -----
  181.       if ((path = getenv("PAGER")) == NULL)   /* find default pathname of page */
  182.               path = DEFPAGER;             /* program in case paging is wanted */
  183.   
  184. !     if ((envp = getenv("DVI2TTY")) != NULL) {
  185.           while ((*envp == ' ') && (*envp != '\0'))
  186.                envp++;
  187.           while (*envp) {                     /* environment var args          */
  188. **************
  189. *** 289,294
  190.               usage(bdopt);
  191.           while ((*envp == ' ') && (*envp != '\0'))
  192.                envp++;
  193.       }
  194.   
  195.       while (--Argc > 0) {                    /* command line args             */
  196. --- 269,298 -----
  197.       if ((envp = getenv("DVI2TTY")) != NULL) {
  198.           while ((*envp == ' ') && (*envp != '\0'))
  199.                envp++;
  200. +         while (*envp) {                     /* environment var args          */
  201. +             if (strchr(optset, optch = *envp++) != NULL) {
  202. +                 /*
  203. +                  * we always pass one option, and arrange for optarg ourselfves,
  204. +                  * so setoption does not mesh up Argv
  205. +                  */
  206. +                 if (strchr(optwarg, optch) != NULL) {
  207. +                     while ((*envp == ' ') && (*envp != '\0'))
  208. +                         envp++;
  209. +                     if (*envp == '\0')
  210. +                         usage(noarg);
  211. +                     str = envp;             /* str points to optarg          */
  212. +                     while ((*envp != ' ') && (*envp != '\0'))
  213. +                         *envp++;            /* set envp just after optarg    */
  214. +                     if (*envp != '\0')
  215. +                         *envp++ = '\0';     /* end optarg string             */
  216. +                 }
  217. +                 setoption(optch, optset, optwarg, str);
  218. +             }
  219. +             else
  220. +                 usage(bdopt);
  221. +             while ((*envp == ' ') && (*envp != '\0'))
  222. +                  envp++;
  223. +         }
  224.       }
  225.   
  226.       while (--Argc > 0) {                    /* command line args             */
  227. -- 
  228. #########################################
  229. # Marcel J.E. Mol                       # They hate you if your're clever
  230. # Delft, University of Technology       # And they despise the fool
  231. # The Netherlands                       # Till you're so fucking crazy
  232. # UUCP: marcel@duteca.UUCP              # You can't follow the rules.
  233. #       duteca!marcel                      #
  234.  
  235.  
  236.