v06i017: dvi2tty patch 1
Brandon S. Allbery - comp.sources.misc
allbery at uunet.UU.NET
Mon Jan 30 06:30:25 AEST 1989
Posting-number: Volume 6, Issue 17
Submitted-by: marcel at duteca.UUCP (Marcel J.E. Mol)
Archive-name: dvi2tty.Rpatch1
[This is the "official" patch 1. I actually hadn't intended to post the other,
since I had this one... whoops. ++bsa]
Below follow some bug repairs for the dvi2tty program posted recently.
Thanks to everyone who mailed me bugs or sugestions.
*** ORG/dvi2tty.c
--- dvi2tty.c
**************
*** 1,5
/******************************************************************************
! * Marcel Mol: 1988-10-25 (UUCP: dutesta!mol)
* dvi2tty.c dvi2tty.h dvistuff.c commands.h
* Converted program to C.
* bogart:/usr/alla/zap/dvitty/dvitty.p 1986-08-15 20:24:31,
--- 1,8 -----
/******************************************************************************
! * Marcel Mol: 1989-01-03 (UUCP: duteca!marcel)
! * Fixed a bugs concerning pager programs
! * and scanning environment variable DVI2TTY.
! * Marcel Mol: 1988-10-25 (UUCP: duteca!marcel)
* dvi2tty.c dvi2tty.h dvistuff.c commands.h
* Converted program to C.
* improved spacing between words/characters.
**************
*** 2,7
* Marcel Mol: 1988-10-25 (UUCP: dutesta!mol)
* dvi2tty.c dvi2tty.h dvistuff.c commands.h
* Converted program to C.
* bogart:/usr/alla/zap/dvitty/dvitty.p 1986-08-15 20:24:31,
* Version to be sent to mod.sources ready.
* New option since last version:
--- 5,11 -----
* Marcel Mol: 1988-10-25 (UUCP: duteca!marcel)
* dvi2tty.c dvi2tty.h dvistuff.c commands.h
* Converted program to C.
+ * improved spacing between words/characters.
* bogart:/usr/alla/zap/dvitty/dvitty.p 1986-08-15 20:24:31,
* Version to be sent to mod.sources ready.
* New option since last version:
**************
*** 78,84
/* don't have terminals with Scand. nat. chars */
#define WANTPAGER TRUE /* default: try to pipe through a pager (like */
/* more) if stdout is tty and no -o switch */
! #define DEFPAGER "/usr/bin/pg"
/*------------------ end of customization constants ---------------------*/
--- 82,88 -----
/* don't have terminals with Scand. nat. chars */
#define WANTPAGER TRUE /* default: try to pipe through a pager (like */
/* more) if stdout is tty and no -o switch */
! #define DEFPAGER "/usr/bin/pg" /* CHANGE TO YOUR LOCAL PAGER */
/*------------------ end of customization constants ---------------------*/
**************
*** 82,88
/*------------------ end of customization constants ---------------------*/
! #define MAXLEN 100 /* size of char-arrays for strings */
/*
* USAGE CODES
--- 86,92 -----
/*------------------ end of customization constants ---------------------*/
! #define MAXLEN 100 /* size of char-arrays for strings */
/*
* USAGE CODES
**************
*** 217,222
j = strlen(str);
break;
case 'F' :
path = str;
j = strlen(str);
break;
--- 221,227 -----
j = strlen(str);
break;
case 'F' :
+ pager = TRUE;
path = str;
j = strlen(str);
break;
**************
*** 250,255
pageswitchon = FALSE; /* show all pages */
sequenceon = FALSE; /* selected pages are TeX-numbered */
outputtofile = FALSE; /* write to stdout */
noffd = FALSE; /* print formfeed between pages */
scascii = DEFSCAND; /* scandinavian, compile time option */
ttywidth = 80; /* default terminal width */
--- 255,261 -----
pageswitchon = FALSE; /* show all pages */
sequenceon = FALSE; /* selected pages are TeX-numbered */
outputtofile = FALSE; /* write to stdout */
+ pager = WANTPAGER; /* want paging, compile time option */
noffd = FALSE; /* print formfeed between pages */
scascii = DEFSCAND; /* scandinavian, compile time option */
ttywidth = 80; /* default terminal width */
**************
*** 257,267
optset = "wpPousqlfF";/* legal options */
optwarg = "wpPoF"; /* options with argument */
! if (pager = WANTPAGER) /* page program, compile time option */
! if ((envp = getenv("PAGER")) != NULL) /* find prefered pager */
! path = envp; /* default pager from env */
! else
! path = DEFPAGER; /* pathname of pager program */
envp = getenv("DVI2TTY");
while ((*envp == ' ') && (*envp != '\0'))
--- 263,270 -----
optset = "wpPousqlfF";/* legal options */
optwarg = "wpPoF"; /* options with argument */
! if ((path = getenv("PAGER")) == NULL) /* find default pathname of page */
! path = DEFPAGER; /* program in case paging is wanted */
if ((envp = getenv("DVI2TTY")) != NULL) {
while ((*envp == ' ') && (*envp != '\0'))
**************
*** 263,292
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++;
}
--- 266,272 -----
if ((path = getenv("PAGER")) == NULL) /* find default pathname of page */
path = DEFPAGER; /* program in case paging is wanted */
! if ((envp = getenv("DVI2TTY")) != NULL) {
while ((*envp == ' ') && (*envp != '\0'))
envp++;
while (*envp) { /* environment var args */
**************
*** 289,294
usage(bdopt);
while ((*envp == ' ') && (*envp != '\0'))
envp++;
}
while (--Argc > 0) { /* command line args */
--- 269,298 -----
if ((envp = getenv("DVI2TTY")) != NULL) {
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 */
--
#########################################
# Marcel J.E. Mol # They hate you if your're clever
# Delft, University of Technology # And they despise the fool
# The Netherlands # Till you're so fucking crazy
# UUCP: marcel at duteca.UUCP # You can't follow the rules.
# duteca!marcel #
More information about the Comp.sources.misc
mailing list