386ix and Parallel Printers
John H
john at design.axis.fr
Sat May 5 10:13:39 AEST 1990
In article <1990Apr21.033100.19633 at pegasus.com>, richard at pegasus.com (Richard Foulk) writes:
> In article <134576 at sun.Eng.Sun.COM> plocher at sun.UUCP (John Plocher) writes:
> >+-- In <3 at ttc.UUCP> marc at ttc.info.com (Marc O'Krent) writes
> >| I have a Toshiba P1340 running under 386ix, and can't get the tabs
> >| to be expanded. Consequently every file with tabs in it causes the
> >+--
> >
> >In the /usr/spool/lp/interface/mumble file you need to change the line
> >that currently reads something like
> > cat $FILE
> >to something like
> > expand $FILE
>
> He'll first have to get a copy of "expand" which doesn't come with 386/ix.
>
> --
> Richard Foulk richard at pegasus.com
I know this isn't right (it isn't even well written) but it works!
#include <stdio.h>
main (int argn, char *argv []) {
/* Expand tabs in input file */
int ch;
int pos = 0;
int tab = 8;
if (argn > 1) {
tab = atoi (argv [1]);
if (tab <= 0 || argn > 2) {
puts ("Usage: expand [ tab_pos ] <in >out");
exit (0);
}
}
while ((ch = getchar ()) != EOF) {
if (ch == '\n') {
pos = 0;
putchar (ch);
}
else if (ch == '\t') {
do {
putchar (' ');
pos += 1;
}
while (pos % tab != 0);
}
else {
putchar (ch);
pos += 1;
}
}
}
John Hughes.
More information about the Comp.unix.i386
mailing list