koreth@panarthea.ebay.sun.com (Steven Grimm) (09/18/90)
Submitted-by: rosenkra%c1yankee@convex.com (Bill Rosenkranz)
Posting-number: Volume 3, Issue 95
Archive-name: nroff110pat2
This is patch 2 for nroff v1.10 for atari TOS.
It adds the .mc command (margin characters, useful for change bars).
It also adds some additional special character escapes (e.g. \(br, \(pl, etc)
and cleans up a few things. The manpage is changed to reflect the .mc
capability.
The patch is supplied as diff -c files (*.dif). This is a shar file. the
diffs were done on an ST and the file names have "\" in the path, if that
matters to your patch program... [I didn't uuencode this, on the assumption
that if you can use "patch" you can probably unshar as well. -sg]
NOTE: Apply this patch after patch 1.
Enjoy...
-bill rosenkranz
rosenkra%c1yankee@convex.com
------ cut here -------- cut here -------- cut here -------- cut here ------
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# If this archive is complete, you will see the following message at the end:
# "End of shell archive."
#
# Contents:
# README command.c.dif escape.c.dif low.c.dif main.c.dif
# nroff.h.dif nroff.man.dif text.c.dif mc.ms mc.out
#
# Wrapped by rosenkra@cray.com on Wed Jul 25 02:13:25 1990
#
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f README -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"README\"
else
echo shar: Extracting \"README\" \(894 characters\)
sed "s/^X//" >README <<'END_OF_README'
X
XThis is patch 2 for nroff v1.10 for atari TOS.
X
XIt adds the .mc command (margin characters, useful for change bars).
XIt also adds some additional special character escapes (e.g. \(br, \(pl, etc)
Xand cleans up a few things. The manpage is changed to reflect the .mc
Xcapability.
X
XA test file is added to test the .mc command. The file is called "mc.ms"
Xand should be executed with:
X
X
X % nroff -ms mc.ms >mc.out
X
Xor
X
X % nroff -ms -po5 mc.ms >mc.out
X
Xto test things out. Read this file as well since it shows how to use .mc.
XThe file mc.out is also included in this patch.
X
XThis command seems to preserve the same bugs from the "real" unix nroff.
XTo use change bars, it is best to cause a break before and after the change:
X
X ...
X .br \" start changes...
X .mc \(br 0.2i
X ...
X These are the changes.
X ...
X .mc
X .br \" end changes...
X ...
X
XEnjoy...
X
X
X-bill rosenkranz
Xrosenkra%c1yankee@convex.com
X
X
END_OF_README
if test 894 -ne `wc -c <README`; then
echo shar: \"README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f command.c.dif -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"command.c.dif\"
else
echo shar: Extracting \"command.c.dif\" \(2295 characters\)
sed "s/^X//" >command.c.dif <<'END_OF_command.c.dif'
X*** old\command.c Sun Jul 22 11:34:48 1990
X--- command.c Tue Jul 24 22:55:10 1990
X***************
X*** 840,846 ****
X */
X maceval (p, macexp);
X break;
X! case NA:
X /*
X * no adjust
X *
X--- 840,846 ----
X */
X maceval (p, macexp);
X break;
X! case MC:
X /*
X * margin character (change bars)
X *
X***************
X*** 842,847 ****
X break;
X case NA:
X /*
X * no adjust
X *
X * .na
X--- 842,866 ----
X break;
X case MC:
X /*
X+ * margin character (change bars)
X+ *
X+ * .mc [c [N]]
X+ *
X+ * currently forced to "|", 2 spaces to the right, right
X+ * margin only...
X+ */
X+ val = getval (p, &argtyp);
X+ if (argtyp == '\r' || argtyp == '\n')
X+ mc_ing = FALSE; /* turn off... */
X+ else
X+ {
X+ mc_ing = TRUE; /* turn on... */
X+ mc_space = 2; /* force these for now... */
X+ mc_char = '|';
X+ }
X+ break;
X+ case NA:
X+ /*
X * no adjust
X *
X * .na
X***************
X*** 1173,1178 ****
X if (c1 == 'f' && c2 == 't') return (FT);
X if (c1 == 'h' && c2 == 'e') return (HE);
X if (c1 == 'i' && c2 == 'f') return (IF);
X if (c1 == 'i' && c2 == 'g') return (IG);
X if (c1 == 'i' && c2 == 'n') return (IN);
X if (c1 == 'j' && c2 == 'u') return (JU);
X--- 1192,1199 ----
X if (c1 == 'f' && c2 == 't') return (FT);
X if (c1 == 'h' && c2 == 'e') return (HE);
X if (c1 == 'i' && c2 == 'f') return (IF);
X+ /* if (c1 == 'i' && c2 == 'e') return (IE);*/
X+ /* if (c1 == 'e' && c2 == 'l') return (EL);*/
X if (c1 == 'i' && c2 == 'g') return (IG);
X if (c1 == 'i' && c2 == 'n') return (IN);
X if (c1 == 'j' && c2 == 'u') return (JU);
X***************
X*** 1184,1189 ****
X if (c1 == 'm' && c2 == '2') return (M2);
X if (c1 == 'm' && c2 == '3') return (M3);
X if (c1 == 'm' && c2 == '4') return (M4);
X if (c1 == 'n' && c2 == 'a') return (NA);
X if (c1 == 'n' && c2 == 'e') return (NE);
X if (c1 == 'n' && c2 == 'f') return (NF);
X--- 1205,1211 ----
X if (c1 == 'm' && c2 == '2') return (M2);
X if (c1 == 'm' && c2 == '3') return (M3);
X if (c1 == 'm' && c2 == '4') return (M4);
X+ if (c1 == 'm' && c2 == 'c') return (MC);
X if (c1 == 'n' && c2 == 'a') return (NA);
X if (c1 == 'n' && c2 == 'e') return (NE);
X if (c1 == 'n' && c2 == 'f') return (NF);
END_OF_command.c.dif
if test 2295 -ne `wc -c <command.c.dif`; then
echo shar: \"command.c.dif\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f escape.c.dif -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"escape.c.dif\"
else
echo shar: Extracting \"escape.c.dif\" \(1131 characters\)
sed "s/^X//" >escape.c.dif <<'END_OF_escape.c.dif'
X*** old\escape.c Mon Mar 5 22:17:12 1990
X--- escape.c Tue Jul 24 19:15:26 1990
X***************
X*** 934,939 ****
X if (c1 == 'i' && c2 == '1') {*c = 0xF4; return (2);} /* integral1 */
X if (c1 == 'i' && c2 == '2') {*c = 0xF5; return (2);} /* integral2 */
X
X /*
X * greek
X */
X--- 934,950 ----
X if (c1 == 'i' && c2 == '1') {*c = 0xF4; return (2);} /* integral1 */
X if (c1 == 'i' && c2 == '2') {*c = 0xF5; return (2);} /* integral2 */
X
X+ if (c1 == 'b' && c2 == 'r') {*c = 0x7C; return (2);} /* box v rule */
X+ if (c1 == 'b' && c2 == 'v') {*c = 0x7C; return (2);} /* bold vert */
X+ if (c1 == 'p' && c2 == 'l') {*c = 0x2B; return (2);} /* math plus */
X+ if (c1 == 'm' && c2 == 'i') {*c = 0x2D; return (2);} /* math minus */
X+ if (c1 == 'e' && c2 == 'q') {*c = 0x3D; return (2);} /* math equal */
X+ if (c1 == '*' && c2 == '*') {*c = 0x2A; return (2);} /* math star */
X+ if (c1 == 's' && c2 == 'l') {*c = 0x2F; return (2);} /* slash */
X+ if (c1 == 'u' && c2 == 'l') {*c = 0x5F; return (2);} /* underrule */
X+ if (c1 == 's' && c2 == 'c') {*c = 0xDD; return (2);} /* section */
X+
X+
X /*
X * greek
X */
END_OF_escape.c.dif
if test 1131 -ne `wc -c <escape.c.dif`; then
echo shar: \"escape.c.dif\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f low.c.dif -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"low.c.dif\"
else
echo shar: Extracting \"low.c.dif\" \(815 characters\)
sed "s/^X//" >low.c.dif <<'END_OF_low.c.dif'
X*** old\low.c Thu Mar 29 00:29:50 1990
X--- low.c Tue Jul 24 22:59:48 1990
X***************
X*** 56,61 ****
X
X if (co.outp > 0)
X {
X co.outbuf[co.outp] = '\r';
X co.outbuf[co.outp+1] = '\n';
X co.outbuf[co.outp+2] = EOS;
X--- 56,64 ----
X
X if (co.outp > 0)
X {
X+ /*
X+ * handle margin char (change bar) here for all filled lines
X+ */
X co.outbuf[co.outp] = '\r';
X co.outbuf[co.outp+1] = '\n';
X co.outbuf[co.outp+2] = EOS;
X***************
X*** 59,64 ****
X co.outbuf[co.outp] = '\r';
X co.outbuf[co.outp+1] = '\n';
X co.outbuf[co.outp+2] = EOS;
X put (co.outbuf);
X }
X co.outp = 0;
X--- 62,70 ----
X co.outbuf[co.outp] = '\r';
X co.outbuf[co.outp+1] = '\n';
X co.outbuf[co.outp+2] = EOS;
X+
X+ do_mc (co.outbuf);
X+
X put (co.outbuf);
X }
X co.outp = 0;
END_OF_low.c.dif
if test 815 -ne `wc -c <low.c.dif`; then
echo shar: \"low.c.dif\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main.c.dif -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"main.c.dif\"
else
echo shar: Extracting \"main.c.dif\" \(5418 characters\)
sed "s/^X//" >main.c.dif <<'END_OF_main.c.dif'
X*** old\main.c Tue Jul 24 03:43:34 1990
X--- main.c Tue Jul 24 22:53:12 1990
X***************
X*** 62,67 ****
X hold_screen = FALSE;
X debugging = FALSE;
X stepping = FALSE;
X out_stream = stdout;
X err_stream = stderr;
X dbg_stream = stderr;
X--- 62,68 ----
X hold_screen = FALSE;
X debugging = FALSE;
X stepping = FALSE;
X+ mc_ing = FALSE;
X out_stream = stdout;
X err_stream = stderr;
X dbg_stream = stderr;
X***************
X*** 251,256 ****
X time_t tval;
X char *ctim;
X
X tval = time (0L);
X dc.fill = YES;
X dc.dofnt = YES;
X--- 252,262 ----
X time_t tval;
X char *ctim;
X
X+ /*
X+ * misc global flags, etc...
X+ */
X+ mc_space = 2;
X+ mc_char = '|';
X tval = time (0L);
X ctim = ctime (&tval);
X
X***************
X*** 252,257 ****
X char *ctim;
X
X tval = time (0L);
X dc.fill = YES;
X dc.dofnt = YES;
X dc.lsval = 1;
X--- 258,268 ----
X mc_space = 2;
X mc_char = '|';
X tval = time (0L);
X+ ctim = ctime (&tval);
X+
X+ /*
X+ * basic document controls...
X+ */
X dc.fill = YES;
X dc.dofnt = YES;
X dc.lsval = 1;
X***************
X*** 290,296 ****
X */
X for (i = 0; i < MAXREGS; i++)
X {
X! rg[i].rname[0] = rg[i].rname[1] = rg[i].rname[2] = rg[i].rname[3] = '\0';
X rg[i].rauto = 1;
X rg[i].rval = 0;
X rg[i].rflag = RF_READ;
X--- 301,310 ----
X */
X for (i = 0; i < MAXREGS; i++)
X {
X! rg[i].rname[0] = EOS;
X! rg[i].rname[1] = EOS;
X! rg[i].rname[2] = EOS;
X! rg[i].rname[3] = EOS;
X rg[i].rauto = 1;
X rg[i].rval = 0;
X rg[i].rflag = RF_READ;
X***************
X*** 298,304 ****
X }
X
X
X-
X /*
X * this should be checked...
X */
X--- 312,317 ----
X }
X
X
X /*
X * predefined regs. these are read/write:
X */
X***************
X*** 300,311 ****
X
X
X /*
X- * this should be checked...
X- */
X- ctim = ctime (&tval);
X-
X-
X- /*
X * predefined regs. these are read/write:
X */
X i = 0;
X--- 313,318 ----
X
X
X /*
X * predefined regs. these are read/write:
X */
X i = 0;
X***************
X*** 462,468 ****
X
X
X /*
X! * these are read only:
X */
X strcpy (rg[i].rname, ".$"); /* num of args at current macro*/
X rg[i].rauto = 1;
X--- 469,475 ----
X
X
X /*
X! * these are read only (by user):
X */
X strcpy (rg[i].rname, ".$"); /* num args at current macro*/
X rg[i].rauto = 1;
X***************
X*** 464,470 ****
X /*
X * these are read only:
X */
X! strcpy (rg[i].rname, ".$"); /* num of args at current macro*/
X rg[i].rauto = 1;
X rg[i].rval = 0;
X rg[i].rflag = RF_READ;
X--- 471,477 ----
X /*
X * these are read only (by user):
X */
X! strcpy (rg[i].rname, ".$"); /* num args at current macro*/
X rg[i].rauto = 1;
X rg[i].rval = 0;
X rg[i].rflag = RF_READ;
X***************
X*** 624,629 ****
X rg[i].rflag = RF_READ;
X rg[i].rfmt = '1';
X
X pg.curpag = 0;
X pg.newpag = 1;
X pg.lineno = 0;
X--- 631,639 ----
X rg[i].rflag = RF_READ;
X rg[i].rfmt = '1';
X
X+ /*
X+ * page controls...
X+ */
X pg.curpag = 0;
X pg.newpag = 1;
X pg.lineno = 0;
X***************
X*** 648,653 ****
X pg.ehlim[RIGHT] = pg.ohlim[RIGHT] = dc.rmval;
X pg.eflim[RIGHT] = pg.oflim[RIGHT] = dc.rmval;
X
X co.outp = 0;
X co.outw = 0;
X co.outwds = 0;
X--- 658,666 ----
X pg.ehlim[RIGHT] = pg.ohlim[RIGHT] = dc.rmval;
X pg.eflim[RIGHT] = pg.oflim[RIGHT] = dc.rmval;
X
X+ /*
X+ * output buffer controls...
X+ */
X co.outp = 0;
X co.outw = 0;
X co.outwds = 0;
X***************
X*** 652,657 ****
X co.outw = 0;
X co.outwds = 0;
X co.lpr = FALSE;
X for (i = 0; i < MAXLINE; ++i)
X co.outbuf[i] = EOS;
X
X--- 665,671 ----
X co.outw = 0;
X co.outwds = 0;
X co.lpr = FALSE;
X+ co.outesc = 0;
X for (i = 0; i < MAXLINE; ++i)
X co.outbuf[i] = EOS;
X
X***************
X*** 655,660 ****
X for (i = 0; i < MAXLINE; ++i)
X co.outbuf[i] = EOS;
X
X for (i = 0; i < MXMDEF; ++i)
X mac.mnames[i] = NULL_CPTR;
X for (i = 0; i < MACBUF; ++i)
X--- 669,677 ----
X for (i = 0; i < MAXLINE; ++i)
X co.outbuf[i] = EOS;
X
X+ /*
X+ * macros...
X+ */
X for (i = 0; i < MXMDEF; ++i)
X mac.mnames[i] = NULL_CPTR;
X for (i = 0; i < MACBUF; ++i)
X***************
X*** 658,664 ****
X for (i = 0; i < MXMDEF; ++i)
X mac.mnames[i] = NULL_CPTR;
X for (i = 0; i < MACBUF; ++i)
X! mac.mb[i] = '\0';
X for (i = 0; i < MAXPBB; ++i)
X mac.pbb[i] = '\0';
X mac.lastp = 0;
X--- 675,681 ----
X for (i = 0; i < MXMDEF; ++i)
X mac.mnames[i] = NULL_CPTR;
X for (i = 0; i < MACBUF; ++i)
X! mac.mb[i] = EOS;
X for (i = 0; i < MAXPBB; ++i)
X mac.pbb[i] = EOS;
X mac.lastp = 0;
X***************
X*** 660,666 ****
X for (i = 0; i < MACBUF; ++i)
X mac.mb[i] = '\0';
X for (i = 0; i < MAXPBB; ++i)
X! mac.pbb[i] = '\0';
X mac.lastp = 0;
X mac.emb = &mac.mb[0];
X mac.ppb = NULL_CPTR;
X--- 677,683 ----
X for (i = 0; i < MACBUF; ++i)
X mac.mb[i] = EOS;
X for (i = 0; i < MAXPBB; ++i)
X! mac.pbb[i] = EOS;
X mac.lastp = 0;
X mac.emb = &mac.mb[0];
X mac.ppb = NULL_CPTR;
X***************
X*** 665,670 ****
X mac.emb = &mac.mb[0];
X mac.ppb = NULL_CPTR;
X
X for (i = 0; i < Nfiles+1; ++i)
X sofile[i] = NULL_FPTR;
X }
X--- 682,690 ----
X mac.emb = &mac.mb[0];
X mac.ppb = NULL_CPTR;
X
X+ /*
X+ * file descriptors (for sourced files)
X+ */
X for (i = 0; i < Nfiles+1; ++i)
X sofile[i] = NULL_FPTR;
X }
END_OF_main.c.dif
if test 5418 -ne `wc -c <main.c.dif`; then
echo shar: \"main.c.dif\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f nroff.h.dif -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"nroff.h.dif\"
else
echo shar: Extracting \"nroff.h.dif\" \(1192 characters\)
sed "s/^X//" >nroff.h.dif <<'END_OF_nroff.h.dif'
X*** old\nroff.h Sun Jul 22 11:40:44 1990
X--- nroff.h Tue Jul 24 22:38:10 1990
X***************
X*** 425,430 ****
X char *skipbl ();
X char *getfield ();
X
X int comand ();
X int comtyp ();
X int gettl ();
X--- 425,431 ----
X char *skipbl ();
X char *getfield ();
X
X+ int do_mc ();
X int comand ();
X int comtyp ();
X int gettl ();
X***************
X*** 506,511 ****
X int hold_screen;
X int debugging;
X int stepping; /* paging */
X char tmpdir[256];
X char termcap[1030];
X char s_standout[20];
X--- 507,515 ----
X int hold_screen;
X int debugging;
X int stepping; /* paging */
X+ int mc_ing = 0; /* turned off */
X+ int mc_space = 2;
X+ char mc_char = '|';
X char tmpdir[256];
X char termcap[1030];
X char s_standout[20];
X***************
X*** 549,554 ****
X extern int hold_screen;
X extern int debugging;
X extern int stepping;
X extern char tmpdir[];
X extern char termcap[];
X extern char s_standout[];
X--- 553,561 ----
X extern int hold_screen;
X extern int debugging;
X extern int stepping;
X+ extern int mc_ing;
X+ extern int mc_space;
X+ extern char mc_char;
X extern char tmpdir[];
X extern char termcap[];
X extern char s_standout[];
END_OF_nroff.h.dif
if test 1192 -ne `wc -c <nroff.h.dif`; then
echo shar: \"nroff.h.dif\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f nroff.man.dif -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"nroff.man.dif\"
else
echo shar: Extracting \"nroff.man.dif\" \(1594 characters\)
sed "s/^X//" >nroff.man.dif <<'END_OF_nroff.man.dif'
X*** old\nroff.man Tue Jul 24 15:33:02 1990
X--- nroff.man Wed Jul 25 00:21:16 1990
X***************
X*** 328,333 ****
X This command affects the footer the same way the \.m1
X command affects the header.
X .\"
X .IP .na
X Noadjust.
X Ajdustment is turned off; the right margin is ragged.
X--- 328,341 ----
X This command affects the footer the same way the \.m1
X command affects the header.
X .\"
X+ .IP .mc
X+ Margin character. The first argument is the character to use,
X+ the second is the distance to the right of the right margin
X+ to place the margin character. Useful for change bars.
X+ No arguments turns the capability off. Note that with this
X+ nroff, the margin character is always a vertical bar ("|")
X+ and this distance is always 2 spaces (0.2i).
X+ .\"
X .IP .na
X Noadjust.
X Ajdustment is turned off; the right margin is ragged.
X***************
X*** 643,649 ****
X documented.
X Good luck!
X .SH REQUEST SUMMARY
X! The following table summarizes the nroff requests:
X .nf
X .ne 8
X .cc +
X--- 651,657 ----
X documented.
X Good luck!
X .SH REQUEST SUMMARY
X! The following table summarizes the nroff requests currently available:
X .nf
X .ne 8
X .cc +
X***************
X*** 740,745 ****
X +ne 4
X Miscellaneous
X
X .pm t - all - print macro names
X .fl - - B flush output buffer
X
X--- 748,754 ----
X +ne 4
X Miscellaneous
X
X+ .mc c N - off E,m margin char c, seperation N
X .pm t - all - print macro names
X .fl - - B flush output buffer
X
END_OF_nroff.man.dif
if test 1594 -ne `wc -c <nroff.man.dif`; then
echo shar: \"nroff.man.dif\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f text.c.dif -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"text.c.dif\"
else
echo shar: Extracting \"text.c.dif\" \(4090 characters\)
sed "s/^X//" >text.c.dif <<'END_OF_text.c.dif'
X*** old\text.c Thu Mar 29 00:47:06 1990
X--- text.c Tue Jul 24 23:43:40 1990
X***************
X*** 104,109 ****
X * centered (.ce)
X */
X center (p);
X put (p);
X --dc.ceval;
X }
X--- 104,110 ----
X * centered (.ce)
X */
X center (p);
X+ do_mc (p);
X put (p);
X --dc.ceval;
X }
X***************
X*** 112,117 ****
X /*
X * all blank line
X */
X put (p);
X }
X else if (dc.fill == NO)
X--- 113,119 ----
X /*
X * all blank line
X */
X+ do_mc (p);
X put (p);
X }
X else if (dc.fill == NO)
X***************
X*** 119,124 ****
X /*
X * unfilled (.nf)
X */
X put (p);
X }
X else
X--- 121,127 ----
X /*
X * unfilled (.nf)
X */
X+ do_mc (p);
X put (p);
X }
X else
X***************
X*** 602,607 ****
X */
X
X register int i;
X
X if (dc.prflg == TRUE && n > 0)
X {
X--- 605,611 ----
X */
X
X register int i;
X+ register int j;
X
X
X if (dc.prflg == TRUE && n > 0)
X***************
X*** 603,608 ****
X
X register int i;
X
X if (dc.prflg == TRUE && n > 0)
X {
X for (i = 0; i < n; ++i)
X--- 607,613 ----
X register int i;
X register int j;
X
X+
X if (dc.prflg == TRUE && n > 0)
X {
X for (i = 0; i < n; ++i)
X***************
X*** 607,612 ****
X {
X for (i = 0; i < n; ++i)
X {
X prchar ('\n', out_stream);
X }
X prchar ('\r', out_stream);
X--- 612,630 ----
X {
X for (i = 0; i < n; ++i)
X {
X+ /*
X+ * handle blank line with changebar
X+ */
X+ if (mc_ing == TRUE)
X+ {
X+ for (j = 0; j < pg.offset; ++j)
X+ prchar (' ', out_stream);
X+ for (j = 0; j < dc.rmval; ++j)
X+ prchar (' ', out_stream);
X+ for (j = 0; j < mc_space; j++)
X+ prchar (' ', out_stream);
X+ prchar (mc_char, out_stream);
X+ }
X prchar ('\n', out_stream);
X prchar ('\r', out_stream);
X }
X***************
X*** 608,613 ****
X for (i = 0; i < n; ++i)
X {
X prchar ('\n', out_stream);
X }
X prchar ('\r', out_stream);
X }
X--- 626,632 ----
X prchar (mc_char, out_stream);
X }
X prchar ('\n', out_stream);
X+ prchar ('\r', out_stream);
X }
X }
X }
X***************
X*** 609,615 ****
X {
X prchar ('\n', out_stream);
X }
X- prchar ('\r', out_stream);
X }
X }
X
X--- 628,633 ----
X prchar ('\n', out_stream);
X prchar ('\r', out_stream);
X }
X }
X }
X
X***************
X*** 808,811 ****
X }
X
X return (w);
X }
X--- 826,937 ----
X }
X
X return (w);
X+ }
X+
X+
X+
X+
X+ /*------------------------------*/
X+ /* do_mc */
X+ /*------------------------------*/
X+ do_mc (p)
X+ char *p;
X+ {
X+
X+ /*
X+ * add margin char (change bar) for .nf and .ce lines.
X+ *
X+ * filled lines handled in robrk(). blank lines (.sp) handled in skip().
X+ * note: robrk() calls this routine, too.
X+ */
X+
X+ register char *ps;
X+ register int nspaces;
X+ register int i;
X+ register int has_cr;
X+ register int has_lf;
X+ int len;
X+ int nesc;
X+
X+
X+ if (mc_ing == FALSE)
X+ return;
X+
X+
X+ len = strlen (p);
X+
X+
X+ /*
X+ * get to the end...
X+ */
X+ ps = p;
X+ while (*ps)
X+ ps++;
X+
X+
X+ /*
X+ * check for cr and lf
X+ */
X+ ps--;
X+ has_lf = 0;
X+ has_cr = 0;
X+ while (ps >= p && (*ps == '\r' || *ps == '\n'))
X+ {
X+ if (*ps == '\n')
X+ has_lf++;
X+ else
X+ has_cr++;
X+
X+ len--;
X+ ps--;
X+ }
X+ if (has_lf < has_cr)
X+ has_lf = has_cr;
X+ else if (has_cr < has_lf)
X+ has_cr = has_lf;
X+
X+
X+ /*
X+ * remove any trailing blanks here
X+ */
X+ while (ps >= p && *ps == ' ')
X+ {
X+ ps--;
X+ len--;
X+ }
X+ *++ps = EOS;
X+
X+
X+ /*
X+ * add trailing spaces for short lines. count escapes, subtract
X+ * from len. use rmval for rigth margin (minus tival which is
X+ * added later in put).
X+ */
X+ nesc = countesc (p);
X+ len -= nesc;
X+ nspaces = dc.rmval - dc.tival - len;
X+ for (i = 0; i < nspaces; i++, ps++)
X+ *ps = ' ';
X+
X+
X+ /*
X+ * add the bar...
X+ */
X+ for (i = 0; i < mc_space; i++, ps++)
X+ *ps = ' ';
X+ *ps++ = mc_char;
X+
X+
X+ /*
X+ * replace cr, lf, and EOS
X+ */
X+ while (has_lf--)
X+ {
X+ *ps++ = '\r';
X+ *ps++ = '\n';
X+ }
X+ *ps = EOS;
X+
X+
X+ return;
X }
END_OF_text.c.dif
if test 4090 -ne `wc -c <text.c.dif`; then
echo shar: \"text.c.dif\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f mc.ms -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"mc.ms\"
else
echo shar: Extracting \"mc.ms\" \(1780 characters\)
sed "s/^X//" >mc.ms <<'END_OF_mc.ms'
X.\" test .mc capability. execute with: nroff -ms mc.ms
X.\" tests .mc on centered, filled, unfilled text.
X.ce 1
X.mc \(br 0.2i
XTesting the Margin Character Command
X.mc
X.SH
XOVERVIEW
X.LP
XThis is a test of the \.mc command in nroff.
XIt adds a character in the right margin when on and leaves if off otherwise.
X.br
X.mc | 2
X.LP
XThese lines should have a change bar.
XTurn on margin character mode by adding an \.mc command with at least one
Xargument.
XNote that nroff currently ignores the argument, except to turn on the mode.
XThe margin character is currently always a vertical bar ("|") and is located
X2 spaces to the right of the right margin.
X.mc
X.br
XNow it should be off.
XTurn off mc mode with an \.mc command with no arguments.
X.LP
XYou can add margin characters to no fill areas as well.
Xnroff will automatically add enough spaces to fill the line and make the
Xcharacter line up with the right margin as with fill mode.
X.sp
X.nf
XThis is a no fill area.
XHere is a change bar in a no fill area (note the blank
Xline is changed as well):
X.mc \(br 0.2i
X
XTHIS LINE IS CHANGED!
X.mc
XNO MORE CHANGES!!!
XIf the line is longer than the right margin, the
Xmargin character is appended to the line:
X.mc \(br 0.2i
XTHIS IS A VERY,VERY,VERY,VERY,VERY,VERY,VERY,VERY,VERY,VERY LONG LINE...
X.mc
XNO MORE CHANGES HERE!!!
X.fi
X.br
X.mc \(br 0.2i
X.SH
XNEW SECTION
X.LP
XHere is an entire section added.
XIt should have change bars for all lines, including the spaces before
Xthe section heading.
X.LP
XThis \.mc capability contains the same bugs as the normal unix \.mc
Xcommand.
XYou should put a \.br command before the \.mc which ends the margin
Xcharacter section to force the character on lines which end before
Xthe entire line is filled.
X.mc
X.br
X.SH
XFINALE
X.LP
XIt section should not have any more change bars.
END_OF_mc.ms
if test 1780 -ne `wc -c <mc.ms`; then
echo shar: \"mc.ms\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f mc.out -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"mc.out\"
else
echo shar: Extracting \"mc.out\" \(2579 characters\)
sed "s/^X//" >mc.out <<'END_OF_mc.out'
X |
X |
X
X |
X |
X Testing the Margin Character Command |
X
X
XOVERVIEW
X
XThis is a test of the .mc command in nroff. It adds a
Xcharacter in the right margin when on and leaves if off
Xotherwise.
X |
XThese lines should have a change bar. Turn on margin |
Xcharacter mode by adding an .mc command with at least one |
Xargument. Note that nroff currently ignores the argument, |
Xexcept to turn on the mode. The margin character is |
Xcurrently always a vertical bar ("|") and is located 2 |
Xspaces to the right of the right margin. |
XNow it should be off. Turn off mc mode with an .mc command
Xwith no arguments.
X
XYou can add margin characters to no fill areas as well.
Xnroff will automatically add enough spaces to fill the line
Xand make the character line up with the right margin as with
Xfill mode.
X
XThis is a no fill area.
XHere is a change bar in a no fill area (note the blank
Xline is changed as well):
X |
XTHIS LINE IS CHANGED! |
XNO MORE CHANGES!!!
XIf the line is longer than the right margin, the
Xmargin character is appended to the line:
XTHIS IS A VERY,VERY,VERY,VERY,VERY,VERY,VERY,VERY,VERY,VERY LONG LINE... |
XNO MORE CHANGES HERE!!!
X |
X |
XNEW SECTION |
X |
XHere is an entire section added. It should have change bars |
Xfor all lines, including the spaces before the section |
Xheading. |
X |
XThis .mc capability contains the same bugs as the normal |
Xunix .mc command. You should put a .br command before the |
X.mc which ends the margin character section to force the |
Xcharacter on lines which end before the entire line is |
Xfilled. |
X
X
XFINALE
X
XIt section should not have any more change bars.
X
X
X
X
X
X
X
X 25 July 1990
X
X
END_OF_mc.out
if test 2579 -ne `wc -c <mc.out`; then
echo shar: \"mc.out\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0