sources-request@mirror.UUCP (06/26/86)
Submitted by: cbosgd!pegasus!hansen Mod.sources: Volume 6, Issue 22 Archive-name: context.1 [ Tony Hansen sent me article <728@ncoast.UUCP> from net.sources, a manual page for the recently-posted context program. It was written by Jyrki Yli-Nokari (...!mcvax!enea!tut!jty). Tony also rightly takes me to task for letting things out without any manpages. He's right ("a little quality control goes a long way"); it won't happen again. --r$] --------------------CUT HERE-------------------- #!/bin/sh # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # Contents: context.1 echo x - context.1 sed 's/^XX//' > "context.1" <<'@//E*O*F context.1//' XX.TH CONTEXT 1 "6 June 1985" XX.\" $Header: context.c,v 1.4 85/05/27 21:51:34 bsa Exp $ XX.SH NAME XXcontext \- find context of lines XX.SH SYNOPSIS XX.B context XX[ XX.B nr_of_lines XX] XX.PP XX.SH DESCRIPTION XX.I Context XXfinds the context of located text. It accepts for example XXcc(1) diagnostics as standard input and gives you the context. XX.SH OPTIONS XXIf the optional argument; a number `nr_of_lines' is given, XXcontext(1) prints that much context before XXand after the line in question. XX.SH EXAMPLES XX.nf XX% cc foo.c |& context XX************** XX* "foo.c", line 5: warning: old-fashioned initialization: use = XX***** XX XX main() { XX int i; XX* long ix.v; XX XX i = getpid(); XX if (ix_v = getchar() == EOF) XX************** XX* "foo.c", line 5: syntax error XX***** XX XX main() { XX int i; XX* long ix.v; XX XX i = getpid(); XX if (ix_v = getchar() == EOF) XX************** XX* "foo.c", line 5: warning: old-fashioned initialization: use = XX***** XX XX main() { XX int i; XX* long ix.v; XX XX i = getpid(); XX if (ix_v = getchar() == EOF) XX************** XX* "foo.c", line 5: v undefined XX***** XX XX main() { XX int i; XX* long ix.v; XX XX i = getpid(); XX if (ix_v = getchar() == EOF) XX************** XX* "foo.c", line 8: ix_v undefined XX***** XX long ix.v; XX XX i = getpid(); XX* if (ix_v = getchar() == EOF) XX exit(1); XX exit(0); XX } XX% XX.fi XX.SH "SEE ALSO" XXcc(1), grep(1) XX.SH AUTHOR XXCopyright (C) 1985 by North Coast Programming. XXThis program, and any documentation for it, is copyrighted by North Coast XXProgramming. It may be copied for non-commercial use only, provided that XXany and all copyright notices are preserved. XXPlease report any bugs and/or fixes to: XX.nf XXNorth Coast Programming XX6504 Chestnut Road XXIndependence, OH 44131 XX\&...decvax!cwruecmp!ncoast!bsa XXncoast!bsa@Case.CSNet XXThis manual page by ...!mcvax!enea!tut!jty (Jyrki Yli-Nokari), to XXwhom I give many thanks. @//E*O*F context.1// chmod u=rw,g=rw,o=rw context.1 echo Inspecting for damage in transit... temp=/tmp/sharin$$; dtemp=/tmp/sharout$$ trap "rm -f $temp $dtemp; exit" 0 1 2 3 15 cat > $temp <<\!!! 100 290 1850 context.1 !!! wc context.1 | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp if test -s $dtemp then echo "Ouch [diff of wc output]:" ; cat $dtemp else echo "No problems found." fi exit 0