IMD 1.18: 22/01/1996 5:15:44 micro cornucopia kaypro user group disk 6 word processing utilities     6-DISK DOCCHOP C CHOP COM CP C CP COMCRC COMCRCKLISTCRC D COMDUMP C DUMP COM' !"#EDIT COM$%&'()*+,-./0123EDIT COML456789:;<=EDIT DOCP>?@ABCDEFGEDIT HLPHENTAB C IJENTAB COMKLM KAYPRO USER DISK #6 ----------------------------------------------------------------------- Contributed by Gordon Banks 1360 Scaife Hall, U of Pittsburgh Pittsburgh,PA 15261 ROFF: A UNIX-like text formatter that allows pretty-printing of files created with a text editor. Documentation in ROFF.DOC. ----------------------------------------------------------------------- Contributed by Rex Buddenburg 1910 Ash EPSMODE4ASM6NOPQRSTEPSMODE4COM UVFONT DATWMS C XMS COMYZ[\README TXT]ROFF COM^_`abcdefghijklmROFF COMnoROFF DOCoutputfile MS: This program allows you to specify how many linefeeds you want between lines in a file (multiple space). RTW: This program remvoves trailing whitespace from a text file. USAGE: RTW ' a la UNIX. The only restriction is that the device or filename following one of these angle brackets must not have a space prece#include /* copyright (c) 1982 Peter Baker */ /* chop - chop ( truncate ) a file after n bytes */ static char usage[] = "Usage: chop n infile outfile"; main( argc, argv ) int argc; char **argv; { FILE fdin, fdout, byte; int n, i; if( argc != 4 ) fatal( usage ); else if( ( fdin = fopen( argv[2], "rb" ) ) == NULL ) fatal( "Chop cannot open input file" ); else if( ( fdout = fopen( argv[3], "wb" ) ) == NULL ) fatal( "Chop cannot open output file" ); else { n putfile >outputfile TRUNC: This program truncates each line in a text file at a specified column. USAGE: TRUNC -n outputfile (where n is the column #) WRAP: This program pretty prints a file. See WRAP.DOC. ----------------------------------------------------------------------- To verify the files on this disk type CRC. ----------------------------------------------------------------------- -----------------------------------------------------------------------  * < (%*#"+!"!9 * <]!9 * < ʍ*#"+!9  <ʇ!Ê!"!"!9 * !0X!9 * !9Y *#"+Ó* ! 9 * "**"""!9"*++" ͳ*!9͎`*++" ͋>*++" }2: *++" >*++" "**++" >!!9 !9 }2!9 "!9 "!!9 * ding. i.e. wrap f1.txt >LST: is in good form wrap f1.txt > LST: will be misunderstood Some of the utilities will give you a usage prompt when you enter them. As for the others, usage is described below. CHOP: This program will chop off a file after n bytes. CP: This program will copy from one file or device to another. DUMP: This program will dump a binary file (or whatever) in HEX so you can search through the file for binary patterns= atoi( argv[1] ); for( i = 0 ; i < n ; i++ ) { byte = getc( fdin ); if( byte == EOF ) break; else putc( byte , fdout ); } fclose( fdout ); fclose( fdin ); } } fatal( msg ) char *msg; { printf( "\n%s\n", msg ); }    *   ,*#"+ -: z!9 Ê*#"+!9 }*6Ê!9 : ͬ ÊÊ56E`*#"+ <ʝ!"* !0X* !9Y ã* *#"+ "! }2! "$" !""*#"+ ë!"$!9 $!0}2!" !9 $!0}2!" !9 $!9 -!9 |ʝ!9 # + -*+"o! 5du(oDx`cos!9 ! c!9 0!9 A-MD!x<z>jS\>))# & =N#F#xN~#~#77 "> w+ Xw w##w w #~+:ƒ~##ͨ@~#.ʔͨÃ*++ͨw#Úxa O! ~_#V!$% r+sbk#| "> w+ Xw w##w w #~+:ƒ~##ͨa ~ #  ~#F6,pw62S  !9 y=Ͱ O>wd < !` s 6#6 ~+œ % s#r{ { ڽ ! ͹ #^!!B w#w!` ~< 6 !u ~r G!g  } *^ xu >w# %% {=Ͱbʄ x -  - h&{  ! ~!g N#FwG+wO#͈ { ھ  +!9~ !| ~b ! 5 > 6> *^ w`i# ᯾ ; fclose( infile ); fclose( outfile ); } error( msg ) char *msg; { printf( msg ); exit( -1 ); } nally copy *+"!X!: -+*"!9 ""*+"#*$<h*".|g|h*+"#*"""!""*"* ͏ʁ*"!̀ ʥ*"|ʚ!--*"* <ʿ*"!ͫ* <*"! *"!ͫ$* <*"! * +*"""*+%": %"8 %"6  " " " y 6"X +6+!^6*F+N+Sb3!!9~#ʯ jO"ʃ'ʃ +}|+#~ʚ6#~#<>!4j6#6*!**# |͟ ! "r!! "# j  #include /* copyright (c) 1982 Peter Baker */ /* cp - copy from one file to another */ /* optionally copy a binary file ( -b option ) */ char use[] = "\nUsage: cp [-b] fromfile tofile\n"; main( argc, argv ) char *argv[]; int argc; { FILE infile, outfile; int binfile; char c; if( argc < 3 ) error( use ); /* error exits! */ if( *argv[1] == '-' ) { if( argc != 4 ) error( use ); /* error exits! */ if( *(argv[1]+1) == 'B' ) /* 'b' for unix systems!!! */%,!% |!!9n&: ʬ ɯ2/ >Y 7*!9 !P :/ w!B xwP #4>2/ >2. :Z x x :. O’ ! DMg :.    ! Write error - Disk full $`i0 !9~=+ͰV+^+F+N~og~#fos#r}o|g}o|g}o|g|!,|}!::,ɯ|&!|}!-c|c}#zx!t--{!-zz{z#zz{z!||g}oÞ|g}oì)ù{ozg+|/g}/oDM!z>S\)) =ɯz|Can't open > or < file.$w*G C ! 9RC *G "G !*}ʰ - =:W <*X  2W  ͖ [   • > _*X ~+#4N s>  > ! ͹ :Z [ 2W _~   > ʭ  !*# } ͬ > ! ͹ } .  > _ !"# con:rdr:pun:lst:  _~O7 !   # i& ~ ! binfile = true; else error( use ); /* error exits! */ } else binfile = false; if( binfile ) infile = fopen( argv[2], "rb" ); else infile = fopen( argv[1], "r" ); if( infile == 0 ) error( "\nCannot open input file\n" ); if( binfile ) outfile = fopen( argv[3], "wb" ); else outfile = fopen( argv[2], "w" ); if( outfile == 0 ) { fclose( infile ); error( "\nCannot open output file\n" ); } while( ( c = getc( infile ) ) != EOF ) putc( c, outfile )  # Usage: cp [-b] fromfile tofile ;*(*&*$! 9 !m Q!ͪ! 9 ## F ʱ! 9 * ʃ!ͪ! 9 ## # F ʦ!"(î!ͪ÷!"(*(|! 9  ! "$! 9 ## ! "$*$F !ͪ*(|-! 9  ! "&H! 9  ! "&*&F a*$ͩ !ͪ!9*$7 }#* ʌ!9 *&Ͷ a*$ͩ *&ͩ "$"&"(30!9 8! Usage: cp [-b] fromfile tofile rbr Cannot open input file  >w# %/ {=ͺ N#F"h ͒ { Ҽ+d *h !\  s{ # +*h F! >bʎ x 7  7 h&{ ) ! ~!q N#FwG+wO#͒ {  +!9~ ! ~b ! 5 > 6> *h w`i# ᯾ %,!/ |!!9n&: ʶ ɯ29 >c !9 !Z :9 w!L xwZ #4>29 >28 :dĂ x :8 Oœ ! DMq :8    ! Write error - Disk full $`i : !9~=+ͺV+^+F+N~og~,! **+*, ",*+%"D %"B %"@  " " " y 6"b+6+!^6*F+N+]l3!%!9~#ʹ tO"ʍ'ʍ +}|+#~ʤ—6#~#<>!#4t6#6*#!%**-|ͩ ! "r!+ "-t Can't open > or < file.$w*Q M! 9RM*Q"Q!*}ʺ7 2:a<*b 2a ͠e ( Ÿ> _*b~+#4N s> (> ! :de2a_~   > ʷ #CRC.COM 5.0 6/18/82CRCKFILE???!9" 1 M @ CRC Ver 5.0 CTL-S pauses, CTL-C aborts :] O@ ++Searching for CRCKLIST file++@ Now searching for "CRCKFILE" file++ !  1 .) F!  ͡]͸! ͔0CRCKLIST???CRCKFILE???!9" M à*,*.}|ډ!".*,{z{** u*.".G*.",!".***,}>*.#".ɯ22)! ",". <  NO FILECRC FILE$!   >. @ Checking wiwbw Cannot open output file "!9" * ++"  ͽ* !9͘ j* ++"  ͕H* ++"  }2$:$ * ++"  H* ++"  "%*%* ++"  H!!9 !9 }2$!9 ""!9 "%!!9 *" * *" * * 6*"#""+ 7:$ Ä!9  Ô*%#"%+!9 }*%6Ô!9 :$ Ͷ ÔÔ?@Oj*"#""+ F ʧ!"'*" !0b *" !9c * í*' *"#""+ "'! }2)#fos#r}o|g}o|g}o|g|!,|}!D D ,ɯ|0 !|}!-m |m }- zʂ !~ --{!-z„ {„ - z„ {„ !||g}oè |g}oö ) {ozg+|/g}/oDM!z> S\)) = ɯz | MD!x<z> jS\>))(# 0 =  N#F#xX~#~#AA "> w+ bw w##w w #~+:~##Ͳ@~#.ʞͲÍ*++Ͳw#äsa O! ~_#V!$/r+sbk#| "> w+ bw w##w w #~+ !*-} Ͷ > ! } 8  > _ !"# con:rdr:pun:lst:  _~O7 !   # i& ~ !k ~ # $ ~#F6,pw62]  !9 y=ͺ$ Y>wn <$ !j s 6#6 ~+¦ /s#r{$ { ! #^!!L w#w!j ~<$ 6) ! ~r G!q  } *h xu th file - ! ~T #M M 2 2 2 2 ! >2 3o: : @ ***No CRC Files found***$> ʉ ʉw#: <2 P6: .6@ Can not parse string ! ~ʽT #ñM ! > 6 #6^#6! ~T #! 4M #x] #e w~ T #>2 @ - s M@ File not found ! 4 >2 o: G: „: G: „@ *Match* 2 ! 4@ <-- is, was --> : ) > T : ) M 2 ! 4<2 ~# @ Not a space between CRC values<2 G-CATALOG???! "."*!",*"#""+ õ!".!9 .!0}2)!"*!9 .!0}2)!"*!9 .!9 7!9 |ʧ!9 # + 7*'+"'y! ?d#u2oNxjcys!9 ! m !9 0!9 A7*'+"'!b +:) 7 : *,!9 ",*'+"'#*.F r*,.|g|r*'+"'#*, ",!",*,**͙ ʋ*,!͊ * ʯ *,|ʤ!-7*,**F *,!͵ **F *,! *,!͵ .**F *  @ ++ Now searching for "-CATALOG" file++ !  ) .) ! ”>.”#””͡”››tK››͸›* =: =͔="  ʳ ª~#.  ¿~  #~  .+~#0:0~#!A.O.Gy~#0M0 K MMɷ:m2 FSÄCRCKLIST$$$››tK›, › **}|!"*{z*~]*"Ü  DISK FULL: CRCFILE$!"*~ .C CRC = D5 74 --> FILE: CHOP .COM CRC = FF D2 --> FILE: CP .COM CRC = A6 63 --> FILE: CP .C CRC = 79 B9 --> FILE: DUMP .C CRC = 12 5A --> FILE: DUMP .COM CRC = 97 1B --> FILE: ENTAB .C CRC = 80 38 --> FILE: ENTAB .COM CRC = A5 70 --> FILE: WRAP .C CRC = 8C 83 --> FILE: WRAP .COM CRC = 95 33 --> FILE: WRAP .DOC CRC = F7 05 --> FILE: MS .C CRC = 1C 72 --> FILE: MS .COM CRC = 46 AC --> FILE: RTW .C CRC = D6  match - : ̓ : J M @ Quantity of lines failed parse test - : ̓ : ~ M @ Quantity of file(s) not found - : ̓ * d͔  ͔ 0T  Җ Wyʩ 0T 0ztiil Hit Space: KK : k Used: /k Not used: k *% DMf : remain on 1 !9" ! J> # ->! . *ͪe> # < * v K  K  K !B r+s+p+qA ?  p*A *? :]$Ž l]Q !]6 !E 6!C 6 :C *C &l ~2D U¼:E 2 :D S:E 2:D F:E 2:D V:E 2:D P:E 2 :D N2E !*#"ɯ2i2}! "!"]]2 s : ~# ++FILE NOT FOUND++$: F*}’">͇†]<  CANNOT CLOSE CRCFILE$CRCKLISTCRCSK FULL: CRCFILE$  w# !]͐ DONE$!e S!]Q !eZ @ --> FILE: XXXXXXXX.XXX CRC = oS) \<‘@ ++OPEN FAILED++ !" !" * | ʹ) \!~2 #" Ý: ) > T : ) @ ++FILE READ EB5 --> FILE: RTW .COM CRC = 1D 49 --> FILE: TRUNC .C CRC = 0F 7B --> FILE: TRUNC .COM CRC = F7 D8 --> FILE: CRC .COM CRC = B2 07 --> FILE: D .COM CRC = 66 48 --> FILE: 6-DISK .DOC CRC = 09 43 --> FILE: EPSMODE4.COM CRC = CE DA --> FILE: EPSMODE4.ASM CRC = 38 04 --> FILE: ROFF2 .C CRC = 6A E0 --> FILE: ROFF1 .C CRC = 79 2B --> FILE: ROFF .H CRC = 8F 8A --> FILE: ROFF .COM CRC = 5E 5B --> FILE: ROFF .DOC CRC = 68 96 --> FILE: SIGNS .COM CRC = BD 15 --> FILE: FONT .DAT CRC = E8 92 --> FILE: EDIT .COM CRC = 7C 20 --> FILE: EDIT .DOC CRC = 14 8B --> FILE: EDIT .HLP CRC = 8D B2 --> FILE: CHOP C 4Ø:!4:!5(  ! I3= : [= t:\a:\=_: :] t ?]\ : ҃! 6?Î : 2   ]Q  ?\\ : DM, Q ! "= *3 ##)*= "; */ &# "! *3 #"#  !! "% >!1 . 2' \: 2 : ʩ: ƀo&"* ~ʛ*# +"# ** DMY қ** DM  *; q#p* " . ** #DM*; -e**  *; w* #" )*= *; s#r*; "; : 2 !S 6!"V * "n >!S d*S &T ) ^#V"K O!l ^#V"M :S =2S M K  a*K "G *RROR++ <* |): o% |g}o" 2  ; 0T ~T #~A > T > _h : F{͇2h2|: ʲ !\   :\2 ! \  \ ! \  \! \  \<7=Ɓo&   ]  2h2|2   ~$#~# x  : F} *}= ">͇1 ] #define MAXWIDTH 100 /* maximum number of bytes on a line */ unsigned staddr; /* starting address */ int aflag = 0; /* 0 if no addresses, 1 if addresses req'd */ int b7flag = 0; /* 0 if leave bit 7 alone on display */ int cflag = 0; /* 0 if no ascii chars, 1 if req'd */ int gcnt = 0; /* 0 for no group count, > 0 for spec'd grouping */ int width = 32; /* default of 32 bytes per line */ main( argc, argv ) int argc; char **argv; { static FILE fd; static int curarg; _{ozgO{ozgi`N#Fogo&og_{_z#W OK = Y -S {-_ ! s+p+q*  ͼ 2 <2 : ! ڗ  K ! 4Á ! 6: =! ڻ * & NK ! 4œ >3  03} Z; { ) # E fd; { static char byte, bytstr[MAXWIDTH+1]; static int pos; /* current position in byte string */ static unsigned addr; addr = staddr; pos = 0; putchar( '\n' ); if( aflag ) putaddr( addr ); while( ( byte = getc( fd ) ) != EOF ) { if( gcnt && ( ( pos % gcnt ) == 0 ) ) { if( pos > 0 ) /* don't do it at the beginning of line */ { putchar( ' ' ); /* a space is a reasonable separator */ } } bytstr[pos++] = printable( byte ); printf( "%2x", byte & 0xf^#V"; *;  ͪ  *; q#pÝn* " ! p+q* )*= ^#V"; ! 6> ! i* &*; >OK : <2 E:/ *; ^#V*% DMf kK : *; Nf E*; ~ڻWK þE *; ~SK E = ! 6:! ':/ : = !: = : <2 * " !" >! .  * *&͵ "( * *&͵ > j*( #"( *DM*( V"( !" (   K!" }2 : <2 O:* * * "    >! = * DM** +" *( * " Ø* #" *& /* current argument count */ curarg = 1; /* start with 1st actual arg */ while( --argc > 0 ) { while( *argv[curarg] == '-' ) { switch( *(argv[curarg]+1) ) { case 'A': case 'a': aflag++; staddr = atoi( argv[curarg]+2 ); break; case 'B': case 'b': b7flag++; break; case 'C': case 'c': cflag++; break; case 'G': case 'g': gcnt = atoi( argv[curarg]+2 ); break; case 'W': case 'w': width = atoi( arg/* copyright (c) 1982 Peter Baker */ /* dump - dump an object (binary) file in hex, optionally preceded by an address. format: dump [-an -b -c -gn -wn] fname [options] [fname] ... where: -an selects an address preceding each line of hex starting at n -b clear bit7 on ascii dump but not on hex -c dump characters (ascii) at the end of each line -gn groups the hex every n bytes. (default = 4) -wn sets the width to n bytes per line n is some decimal number */ #inclf ); if( pos == width ) { if( cflag ) { bytstr[pos] = '\0'; /* terminate the string */ printf( " %s", bytstr ); } pos = 0; putchar( '\n' ); if( aflag ) putaddr( addr ); } addr++; } if( cflag && ( pos > 0 ) ) { bytstr[pos] = '\0'; printf( "\t%s", bytstr ); } putchar( '\n' ); } putaddr( hexad ) unsigned hexad; { printf( "%4x: ", hexad ); } usage() { printf( "\nUsage: dump [-an -b -c -gn -wm] fname [options] [fname] ..." ); *( * " 3*1 #" " " *5 " > # R : B * +" ! +s#r( ! 6: " * ~2 * #" * +" > ʶ : 2 Ғ * +" : <2 O>ҳ ! 6* #" * ~2 p ̓: AOK = * Ͱ= * ͷ= * Ͱ= *# ͷ= * Ͱ= . g S -A >>!  ~?l W >#^ : /!:' —  ʑ #‹  W ʢ #™ i`N#FogDM!>))덑o|g =¼ DM!>)) = ^#V) ^#V|g}o v[curarg]+2 ); if( width > MAXWIDTH ) { printf( "\nmaximum width = %d\n", MAXWIDTH ); width = 32; } break; default: usage(); } curarg++; argc--; } if( argc < 1 ) { usage(); /* no filename for the argument */ } if( ( fd = fopen( argv[curarg], "rb" ) ) != NULL ) { dump( fd ); fclose( fd ); } else { printf( "\ndump cannot open %s\n", argv[curarg] ); } curarg++; } } dump( fd ) register FIL  printf( "\n where: -an selects addresses preceding each line" ); printf( " starting at n" ); printf( "\n -b reset bit 7 on character dump" ); printf( "\n -c character dump at end of each hex line" ); printf( "\n -gn groups the hex every n bytes" ); printf( "\n -wn set the width to n bytes per line" ); printf( "\n n is a decimal in any of the above" ); putchar( '\n' ); exit( 1 ); } /* isprint - is the character a prial in any of the above***!"!9^*Xͥ^!9^*X͉ͥz!9^*X͉ͥʑÎ*#"+/Ã!"!9^*Xͥ!9^*X͉ͥ*#"+!9^Xͥ!!"!"!9^*X!0-!9^*X!9͉fA*#"+* :! 9^*X"6**:""" !9"*++"^ *!9*++"^ ç*++"^}2:Y*++"^. ç*++"^*!9^"*")!"'! f*|]*)h*͖}2#͉)* |ʆ*'* [͉ͥʢ*'!ͽʢ! f*'#"'+:Y}͏!}:Y&͗* *'͑* |*'6͏!!͗!"'! f*|*)h*)#")+]* |<*'!ͽ͉[*'6͏!!͗! f"͏!!9^͗͏!͗͏!͗͏!͗͏!͗͏!F͗͏!͗͏!͗͏!͗! f!) !9X! !9X6#~#<8 >J ! 4 6#6* ! * |5 !F 8"H U r! 8" b  o  Can't open > or < file.$) w* ڬ ! 9Rڬ * " !;*H }͖^4: <*  2   ʇ > _* ~+#4N s> ͇ > !": 8 2 _~; Q L > Y ZbY!* }z> ! "} — > _ntable character. */ isprint( c ) char c; { return ( ( c >= ' ' ) && ( c <= '~' ) ) ? true : false; } /* convert c to a printable character, reset bit 7 if req'd */ printable( c ) char c; { if( b7flag ) { c &= 0x7f; /* clear bit7 */ } return ( isprint( c ) ) ? c : '.'; } tf( "\t%s", bytstr ); } putchar( '\n' ); } putaddr( hexad ) unsigned hexad; "**++"^G ç!!9^. !9X}2!9^"c !9^"!!9^. *X͉| *X͉͉ʕ *#"+X͖ c :Y !9Xf *#"+!9X}*6 !9X:Y ͞ *#"+Xͥ !"*X!0+ *X!9͉X 7 * :*#"+X"4 ! }2! ""!"*#"+X !"!9^͍ 1 !0}2!"!9^͍ 1 !0}2!"!9^͍ 1 !9^͖ 1 !9^X| !9^#c+X͖ *+!~͉!!*|0!9X&}o}!9X|K!9XN!. maximum width = %d rb dump cannot open %s %2x %s %s%4x: Usage: dump [-an -b -c -gn -wm] fname [options] [fname] ... where: -an selects addresses preceding each line starting at n -b reset bit 7 on character dump -c character dump at end of each hex line -gn groups the hex every n bytes -wn set the width to n bytes per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ʧ!!*~#fo##s#r\*n}*L!!)!! w#w\*n}7! ^#Vr+s*L*^#Vr+s*ns͐*L6!|X!!*6#6!|u!!\|ʎ\\”!!! \ ! \# ! /! /{|!!)!!! ! 2\#\ ^#Vr+s$ ! w#w͐|Ҭ!͐k*"~#fo|ʐ!͐!#)͐k*"~#fo͐k*"##~#fo! #)Þ!͐!-#)! ^#Vr+s!!!@#)!!b#)!!!!!!&9edit.hlp%c%s Line too long ?? %s Write?? edit.tmp%d ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ ! %d %d-in memory -in temp file-Illegal type at %d line numb>>u>ʃ>j>g>n+>%>r7>ʈ>wC>ʨ>fO>>#[>J>>g>u>ʑ>q>ʮ>s‹>9>x—>*>g£>6>v¯>ʆ>=»>ʔ>%>ʳ>:>ʨ>^>/>&>ʝ>">>~>ʤ>!> >@>ʯ!>*'>ʺ!!! w#w|@!!`is#rzp͐ ͐͐*s#r@!! 6#62|ʍ!!`is#rzʼ!͐͐*s#rÍ!|!!\|!!\!\#*n&!e! s#r͐\?!͐! ^#Vr+s!")!\!k")\#! s#r͐\\hڥ!͐! ^#Vr+sj!|ʶ!!\\\|!!\*s#r\! s#r͐\\h,!͐! ^#Vr+s!|=!!\|L!!k|hn\!")Ú!\\\‰Ú*^#Vr+sL!|ʫ!!\\!!\*s#r!\e! s#r͐\!! \#\#*s#r!! 5|9!!\++++|L!!\k*! 8#|w!!*^#Vr+s!! 5|ʜ!!! ;!! 5|ʼ!!! >!\#*n}=*^#Vr+s! 5|!!! * A!!!* D|6!!)G* !")!|X!!*~#fo|g}os#r!|ʃ!!*w#w!|ʟ!!*6#6!\#*n}!*^#Vr+s! 6#6! w#w|!!\ |͐er %d %d-being used by parsel %d-lru = %d %d-Not being used Kathy, don't do that, it tickles Now Kathy, stop fooling around È#ï[!9DM!#ͅ#͐n}ʰ#͐!#ͅ#͐n}#͐!#ͅ# %s%s# *^#Vr+s**#\*n}$!M|$$!\|9$\*s#r\|T$\*##s#r\\ځ$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#r! ~#fo͐s#r̓̓! `i! (Q|BRÉRÚQ̓.Q! ̓1QM|xR!̓4Q̓*s#r!9ÛRa4T!w9DM`i͕͐R!! ! `i͘RR!9!9DMMc |R!Mc k* 6![!9Overflow error! Overflow error! %s ^^^^^^^| ^^^^^^^| .Overflow error! Overflow error! Ö[ _!9DM! ͓͐[ø[ _xb!y9DM! `iͲ[`i͵[!9[xdgd\e!9DM͐|\[ì\͐+++|\![ì\͐##^#Vr+s|•\!͐͐~#fo[`is#r!|h\͐##^#Vr+sì\͐##͐?+s#r͐͐s#r͐^#Vr+sn&ì\!9û\e!9DM͐\!͐~#fo͸\!9DM! n&|ͯ]!  s! ^#Vr+sÉa! n}$a! 6#6! ^#Vr+s~#fo! s#r͐n}ʉa͐|ʉa! ^#Vr+s! ^#Vr+sns! ^#Vr+s! ^#Vr+s?a͐6! ! s#r! n}a! ^#Vr+s!|a! ^#Vr+s! n}a!0a! såa͐! ^#Vr+sns{ b! ^#Vr+sa! n}:b! ^#Vr+s!|:b! ^#Vr+s6 bPb! ^#Vr+s`insfb! ^#Vr+s`insG_͐6!9~bÿ !9DM͐n}ʨb! ^#Vr+sn&{bÆb!9DM! n&|ͯb! n&|ͩbb!9DM͐͐ -c͐^#Vre both the filename and drive designation are optional. Comment 1) After any change that rearranges lines, the line numbers are automatically adjusted, so it's a good idea to look at the code again before you make any more changes, to check out the new line numbers - unless you LIKE suprise deletions and substitutions, in which case, by ALL MEANS go ahead and live dangerously! Comment 2) Whenever I say, "specified range of lines", I mean two numbers separated by a comma, like 1,3 or ault filename to "file" $= tells you last line number .= tells you current line number (useful if you've turned off the numbers) u=com sets the user command to "com" u= tells you what the user command is *************************************************************** Commands Concerning Files *************************************************************** I know, I know, they're ALL concerned with files, but read on... COMMAND r x:filename Reads in file "filename" fro+s͐c͐0"c͐7s!&xc͐ ͐͐ ͉͐b`is͐ ͐͐ )͐b`in&#&xc!9Çc\!9DM`iw#w͐~#fon&̈́c}c͐ ?͐^#Vr+snѯg`is#rÕc͐c!9cd!9DM! n&c|d! n&d! n&&!9DM! n&|ͯId! n&|ͩ _ bd  7:O*:woʇd2w&!o ªd . &ódÜf7:,*Ͱd:*d}|2q ed:qw 10,999. Comment 3) A dollar sign ($) stands for the last line of the file; within a search string it stands for end-of-line. A period (.) stands for the current line in the file; within a search string it stands for "any character" - a sort of wild card. ******************************************************************** Miscellaneous Commands ******************************************************************** COMMAND DESCRIPTION Control-P Will send everything typed on the scree The Fantastic Great Wonderful EDIT by Scott Fluhrer and Neal Somos This file created May 7, 1981 by Kathy Bacon. This is supposed to be a help file for Scott's QED editor in BDS C. When in EDIT itself, you can get a brief listing of the available commands, but here I tried to give a little more explan- ation and a few examples of some of the niftier features, for anyone who hasn't used an editor of this type before. EDIT can be invoked by typing A>EDIT x:filename wherm drive x. The default is the currently logged in disk if no designation is given. w x:filename Writes "filename" to disk x. Again, "x" is optional. So, for that matter, is the filename: if you don't specify, it will use the current default filename (there is a default even if you've never specified one during your EDITing - it USED to write out a file with the descriptive title " ", but that wasn't too cool...) f Tells you the current default filename. f=file Sets d! {w7,2q*&:q):Te=Te=r:qo&7:)~:,"s!"u*|ʲe**s·e! ~²e6*u*+"*"*u#"u~e# !\&! :w&o !, fee7*f\!* f7:)~:,"s!"u*|*uʚf*~#qf"*s*ušf#"u*+"^f , FNxg>Goyf$d thereafter to the printer. To stop, type another Control-P. h Will list a brief description of all commands u This is the "user-defined-command". To set it, you just say u=com and u is set equal to "com". "com" can be anything you want - a complicated search-and-substitute you'll be doing a lot, a ".,$" , or whatever. # Toggles the line numbers on or off. < Turns the prompts on. > Turns the prompts off. = Has various uses: f=file sets def  the default filename to "file". q Quits the editor. If you try to quit without first writing the file (via "w") to disk, EDIT will scream (well, ACTUALLY it will only BEEP) at you. If you don't want your most recent changes anyway, and you find this behavior obnoxious, read on... q! Quits quietly. n x:filename This command will cause "filename" to be read form drive x and be used to EDIT the file you are in - i.e. "filename" should be a file of EDIT commands. This can be us******************************************* Print Commands *********************************************************** All line number designations for these commands are OPTIONAL. -------------------------------------------------- (line#)p Displays the line designated, and sets dot (.) to "line#". (range)l Displays the range of lines specified, showing all control characters as up-arrows followed by some character. A tab (^I) is the only control character that this editor ALLO range of lines specified. (line#)i INSERTS lines of text BEFORE the (opt.) line number. To stop, type a single period (.) on a line. (line#)j JOINS the line following "line#" to the end of "line#", making the two one line. (range)m(dest) MOVES the range of lines specified to the destination specified. They are deleted from their original location. (range)t(dest) COPIES the range of lines specified to the destination specified. The lines are NOT deleted form their orig/string/ Will search FORWARD through the file for the next occurrence of "string", and print it out. ?string? Will search BACKWARD through the file for the last occurrence of "string". A "print" is implied. g/string/ Will search and print out all occurrences of "string" in the file. v/string/ Will print out all lines in the file which DO NOT contain "string". The "Search and Substitutes": --------------------------- (range)s/search/replace/ Will substitute "replace" for thed to add one of your files to another (there's no explicit command for this). Copy the text you want to add into a file, precede it with an "a" for append, and follow it with a period ".", and then use the file to EDIT the file you want to add the text to. NOTE!! If a filename is not specified, it will use the current default filename - which will probably NOT contain EDIT commands.... **************************************************************** Commands Concerning LiWS you to put in, but other sneaky little devils culd creep in... (range) Displays the range specified with all control characters shown as an up-arrow followed by a letter . The only control character this editor will allow you to insert is a tab (^I) but others may creep in, the sneaky little devils. (line#): Prints from (line#) to (line# + 16); sets dot equal to (line#). (line#)& Prints from (line# - 16) to (line#), leaves dot at (line#). (line#)" Prints from (line# +inal location. Example: 141>a 142 line one of ridiculous text 143 line two 144 third boring line 145 fourth insipid line 146 boring boring boring 147 . 146>142,143m146 146>142,146 142 third boring line 143 fourth insipid line 144 line one of ridiculous text 145 line two 146 boring boring boring 146>146t142 146>142,147 142 boring boring boring 143 third boring line 144 fourth insipid line 145 line one of ridiculous text 146 line two 147 boring boring boring ****************e FIRST occurrence of "search" on all lines in "range". (range)s/search/replace/p Will do the same, but will print the final result. (range)s/search/replace/gp Will substitute for ALL occurrences on each line. The "Interactive Substitute": ---------------------------- (range)x/search/replace/p Will search and display each occurrence (singly, of course!) of "search" in "range". The search string will be marked on each line by up-arrows (^); if a tab ines **************************************************************** (line#)a APPENDS lines of text AFTER the (optional) line number. To stop, type a single period (.) on a line. (line#)ac APPEND COMMENT to (line#). This will automatically add a "/*" onto the line you specify - you then type in the text of your comment, and hit , and it adds the closing "*/". (range)c CHANGES the line or lines specified. To stop, type a single period on a line. (range)d DELETES the line or 1) up to (line# + 17), leaves dot at (line#). (line#)~ Prints from (line# - 16) up to (line#), sets dot to (line# - 16). (line#)% Prints from (line# - 8) up to (line# + 8) to show the context of a line. ***************************************************************** Search and Substitute Commands ***************************************************************** These come in several flavors.....depending on your tastes... The General "Searches": ----------------------   s in the search string it will be marked by vertial lines (|). After displaying the search string, it will wait for you to reply : type a period (.), and it will do the substitution of "replace" for "search"; answer with a carriage return and it will NOT. A "/" is generally used to delimit the search and replace strings, but another character can be used, like a "@". -------------------------------------------------- There are also some "special charanged q! - Quits quietly & - .-16,.p r - Reads in files " - .+1,.+17p s - Search and substitute ~ - .-16,.p '.' set to .-16 t - Line copy = - Tells you what ., $, etc is u - User defined command # - Toggles line numbers v - Global if not > - Turns prompts off w - Writes out a file < - Turns prompts on x - Interactive substitute / - Forward search h - Help (I don't know what to do!) ? - Backward search Turns prompts on x - Interactive substitute / - Forward search he (snooze) /* a boring function */ 313 . 312>s/(*~)/&,fizzle/p 312 snore (snooze, fizzle) /* a boring function */ 312>s//&,zzzzz/p 312 snore (snooze, fizzle, zzzzz) /* a boring function */ 312> The combination "*." stands for any number of any character. Note that it matches the LONGEST occurrence of the search string. This is useful, but can be tricky if you're not careful. Notice also that it will remember the last search string if you just say // , but can be tricky if you're not carefer blanks */ col++; } if( c == EOF ) break; putchar( c ); if( c == NEWLINE ) col = 1; else col++; } } /* * example: if tabsize == 8 then tab stops will be at: * 1 9 17 25 33 ... */ settab( tabs, tabsize ) char *tabs; int tabsize; { int i; for( i = 1 ; i < MAXLINE ; i++ ) if( (i % tabsize) == 0 ) tabs[i+1] = true; else tabs[i+1] = false; } BOOLEAN tabpos( col, tabs ) char *tabs; int col; { if( col > MAXLINE ) return( true ); elsacters" that can appear in these "search" and "replace" strings: CHARACTER MEANING & In a "replace" string, "&" stands for the string you just searched for. $ In a "search" string, stands for the end-of-line. ^ Stands for the beginning-of-line. * Zero, one, or many of the character immediately following it. . A "wild-card": any character. ~ "not" character: a match will occur for anything EXCEPT the character immediately following the "~". /* copyright (c) 1982 Peter Baker */ #include /* * Replace blanks by tabs using standard input and output. * * Heavily derived from Software Toolworks by Kernighan and Plauger. */ #define BOOLEAN int #define MAXLINE 133 #define BLANK ' ' #define TAB 0X09 #define NEWLINE '\n' main( argc, argv) char *argv[]; int argc; { int c; /* int because it has to be able to hold EOF */ int col, i, newcol; BOOLEAN tabpos(); BOOLEAN tabs[MAXLINE]; int tabsize; /* ta - Appends text to lines \ - Force character ac - Appends comments to lines ~ - Not character c - Changes lines . - Any character d - Deletes lines * - 0, 1, or many characters g - Global search ^ - Begining of line i - Inserts text before lines $ - End of line j - Joins two lines together & - The searched for string l - Prints line with control characters m - Line move n - Use a command file ^ - .,$ p - Prints lines % - Display context q - Quits : - .,.+16p '.' unche return( tabs[col] ); } / if( argc > 1 ) { if( *(argv[1]+1) == 'T' ) tabsize = atoi( argv[1]+2 ); else  You could try to find "th~is", for example. This is especially useful if you're a lousy speller. \ The "force" character: if you want to actually look for a string containing one of these special characters, precede it with a "\" to "force" it into the string. Some Example Substitutions: -------------------------- 309>a 310 I think I am losing my mind. 311 . 310>s/t*.n/am so bore/p 310 I am so bored. 310>s/so/& & & /p 310 I am so so so bored. 310>a 311 312 snorab at every tabsize'th column */ if( argc > 1 ) { if( *(argv[1]+1) == 'T' ) tabsize = atoi( argv[1]+2 ); else tabsize = 8; } else tabsize = 8; settab( tabs, tabsize ); col = 1; while( 1 ) /* repeat until break */ { newcol = col; while( (c = getchar()) == BLANK ) /* collect blanks */ { newcol++; if( tabpos( newcol, tabs ) ) { putchar( TAB ); col = newcol; } } while( col < newcol ) { putchar( BLANK ); /* output leftov  E!9* * ***!9! !̀ t!9! ##! # h k!9! ##! ##" q!" z!" ! 9* K!"!|/*" u"h * #" +* ! 9ͯ|! )* "Ü** ͏ ! )*#"+*#h /*)*h $!",*#"+Î"""" " ! 9*I!"I*I!͏ ʪq*I#"I+U*I!9!  h ʘ*I#!9! 6ç*I#!9! 6f"I!9! !̀ !!9! !9!  ***!"!9! *z> S\)) = ɯ) z | MD!x<= z>B jS\>))J # R =B N#F#xz ~#~#c c  " > w+ „ w w##w w #~+:¯ ~## @~#. ï * ++ w# :a O! ~_#V!$Qr+sbk#| "!  # i& ~!~<#.F~#F6,pw62 !9! y= F{ >ww#&%Q {= bʰx Y%Yh&{ K!~!N#FwG+wO#ʹ{ @+!9~  !~bi d,comp ; Query compressed call pmsg call conin cpi 'Y' jz yescom cpi 'y' jz yescom lxi d,nn call pmsg mvi c,146 ; turn off compressed mode call list jmp next2 yescom: lxi d,yy call pmsg mvi c,15 ; turn on compressed mode call list next2: lxi d,dbw ; Query double width call pmsg mvi c,1BH ; double width lead-in (Graftrax +) call list mvi c,'W' call list call conin cpi 'Y' jz yesdbw cpi 'y' jz yesdbw lxi d,nn call pmsg mvi c,0 ; turn double width o h $!9! * h L @!9! * h L WT*#"+I!"!9! * h Œ!9! * h L ʼ*#"+!9!  h ʶ!ù!"!"!9! * !0̈́ !9! * !9ͅ L ,*#"+* ! 9! * "** """*+%"f%"d%"b " " "y 6"+6+!^6*F+N+ʎ3!G!9~# ʖO"ʯ'ʯ +}|+#~¹6#~#<> !E4Ö6#6*E!G *O|!  ; This program queries user for various EPSON MX-80FT ; modes and sets them accordingly. ; Written by James R. Hossenlopp 9/5/1982 ; 3465 Big Ridge Road, Spencerport, N.Y. 14559 ; for general CPM systems cout equ 0002 ; Console out function cin equ 0001 ; Console in function string equ 0009 ; String output function BDOS equ 0005 ; Standard CPM entry PRINT equ 0005 ; List output function READBUF equ 000ah ; Read console buffer function org 100h ; set for com file LXI H ! 5 >  6> * w`i#& ᯾B %,!Q |!!9n&: ɯ2[ >Å !9! !|:[ w!nxw| #4>2[ >2Z :Ĥ x :Z O¾ ! DMÓ :Z    ! Write error - Disk full $`i \ !9~=+ V+^+F+N~og~#fos#r}o|g}o|g}o|g|!,|}!f f ,ɯ|R !|}!-Ï | }O zʤ ! --{!-z¦ {¦ O z¦ {¦ !||g}o |g}o ) {ozg+|/g}/oDM!ff (Graftrax +) call list jmp next3 yesdbw: lxi d,yy call pmsg mvi c,1 ; turns on double width (Graftrax +) call list next3: lxi d,emp ; Query emphasized call pmsg call conin cpi 'Y' jz yesemp cpi'y' jz yesemp lxi d,nn call pmsg mvi c,1bh call list mvi c,'F' ; turns off emphasized mode call list jmp next5 yesemp: lxi d,yy call pmsg mvi c,1bh call list mvi c,'E' ; turns on emphasized mode call list next5: lxi d,italic ; Query italicized call pmsg ca" r!M"O%Ö2 Can't open > or < file.$w*s o! 9Ro*s"s! * }Yta:<* 2 Ç J > _*~+#4N s> J> !:͇2_~   >  % !*O}=> !} Z > _ !"# con:rdr:pun:lst: _~O7%,0 ; SAVE CPM ORIGINAL STACK FOR SMOOTH RETURN DAD SP SHLD OLDSP LXI SP,STKTOP lxi d,intro ; List Header call pmsg ; send string lxi d,double ; Query double strike call pmsg call conin ; yes or no ( Y or N ) cpi 'Y' jz yesds cpi 'y' jz yesds lxi d,nn ; no call pmsg mvi c,1bh ; escape call list mvi c,'H' ; turn off double strike call list jmp next1 yesds: lxi d,yy call pmsg ; yes mvi c,1bh call list mvi c,'G' ; turn on double strike call list next1: lx  ll conin cpi 'y' jz yesita cpi 'Y' jz yesita lxi d,nn call pmsg mvi c,1bh call list mvi c,'5' call list next10: lxi d,papout ; Query paper out sensor option call pmsg mvi c,1bh ; Start escape sequence call list call conin cpi 'y' jz igpout cpi 'Y' jz igpout lxi d,nn call pmsg mvi c,'9' ; Enable paper out sensor call list next11: nop ; was perf skip but setting top of form seemed ; to cancel it. next12: lxi d,0ffffh ; Pause before repainting header l CALL LIST ; NOT EXACTLY A FULL FORM MVI C,'C' ; FORM = 113.14286 CALL LIST MVI C,113 CALL LIST jmp cpm yesita: lxi d,yy ; Yes send italics command call pmsg mvi c,1bh call list mvi c,'4' call list jmp next10 igpout: lxi d,yy ; Yes disable paper out sensor call pmsg mvi c,'8' ; ignore paper out sensor call list jmp next11 yperf: lxi d,yy ; Yes jump over perforations call pmsg mvi c,'N' call list mvi c,3 ; Jump by three (3) lines call list jmp cpm1 concall list call conin cpi 'y' jz yperf cpi 'Y' jz yperf lxi d,nn call pmsg mvi c,'O' ; Disable auto jump over perforations call list cpm1: mvi a,0dh ; All Done ! call conout mvi a,0ah call conout LHLD OLDSP SPHL RET ; return to CPM next7: lxi d,yy ; Set 1&1/2 line feed. call pmsg mvi c,1bh call list mvi c,'A' call list mvi c,18 call list ; mvi c,1bh ; Remove for Graftrax80 ; call list ; mvi c,'2' ; call list MVI C,1BH ; SET FORM TO 44 LINES CALL LISTmphasized Mode? ( Y or {N} ) ==>$' nn db 13,'No,$' yy db 13,'Yes,$' norm db 13,10,10,' Normal Line Feed? ( {Y} or N ) ==>$' half1 db 13,10,10,' 1&1/2 Normal Line Feed? ( Y or {N} ) ==>$' space2 db 13,10,10,' Double Line Feed? ( Y or {N} ) ==>$' complf db 13,10,10,' Compressed Line Feed? ( Y or {N} ) ==>$' italic db 13,10,10,' Italicized Mode? ( Y or {N} ) ==>$' papout db 13,10,10,' Ignore Paper Out Sensor? ( Y or {N} ) ==>$' perf db 13,10,10,' Skip Over Page Perfoll: dcr e nop nop nop nop jnz lll dcr d jnz lll lxi d,intro ;Repaint header call pmsg lxi d,norm ; Normal line feed? call pmsg call conin cpi 'n' jz next6 cpi 'N' jz next6 lxi d,yy call pmsg mvi c,1bh call list mvi c,'A' call list mvi c,12 call list ; mvi c,1bh ; Remove for Graftrax80 ; call list ; mvi c,'2' ; call list MVI C,1BH ; SET FORM TO 66 LINES CALL LIST MVI C,'C' CALL LIST MVI C,66 CALL LIST jmp cpm next6: lxi d,nn ; One and 1out: PUSH B PUSH D PUSH H MOV E,A ; PASS CHAR. IN "E" FOR CPM CALL MVI C,cout ; CONSOLE OUT FUNCTION CALL CALL BDOS POP H POP D POP B RET conin: MVI C,cin ; CONSOLE IN FUNCTION CALL CALL BDOS RET PMSG: MVI C,string ; STRING OUTPUT FUNCTION CALL CALL BDOS RET list: PUSH B PUSH D PUSH H MOV E,C ; PASS CHAR. IN "E" FOR CPM CALL MVI C,PRINT ; LIST DEVICE FUNCTION CALL CALL BDOS POP H POP D POP B RET NOCR: LDAX D ; SIMILAR TO STRING ROUTINE BUT DOES NO MVI C,'C' CALL LIST MVI C,44 CALL LIST jmp cpm next8: lxi d,yy ; Set double spaced line feeds call pmsg mvi c,1bh call list mvi c,'A' call list mvi c,24 call list ; mvi c,1bh ; Remove for Graftrax80 ; call list ; mvi c,'2' ; call list MVI C,1BH ; SET FORM TO 33 LINES CALL LIST MVI C,'C' CALL LIST MVI C,33 CALL LIST jmp cpm next9: lxi d,yy ; Set compressed line feed call pmsg mvi c,1bh call list mvi c,'1' call list MVI C,1BH ; SET FORM TO 113 LINESration? ( Y or {N} ) ' db 13,10,' provides auto formfeed at page length - three lines' db 13,10,' answer here please ==>$' BUFF: DS 32 ; CONSOLE BUFFER OLDSP: DS 2 DS 64 ; STACK AREA, 32 LEVEL STKTOP: DS 2 end /2 line feed? call pmsg lxi d,half1 call pmsg call conin cpi 'y' jz next7 cpi 'Y' jz next7 lxi d,nn call pmsg spc2: lxi d,space2 ; Double spaced? call pmsg call conin cpi 'y' jz next8 cpi 'Y' jz next8 lxi d,nn call pmsg cmplf: lxi d,complf ; Compressed line feed? call pmsg call conin cpi 'y' jz next9 cpi 'Y' jz next9 lxi d,nn call pmsg cpm: lxi d,perf ; Query auto form feed before perforations call pmsg mvi c,1bh ; Start escape sequence T CPI '$' ; AUTOMATICALLY SEND CR AT END OF STRING RZ CALL CONOUT INX D JMP NOCR intro db 0CH,1AH,'Epson MX80-F/T with Graftrax + Set-up Program',13,10 db 'Answer questions yes or no by entering ( Y or N )',13,10 db ' Just entering Carriage Return will enter default value { }$' comp db 13,10,10,' Compressed Mode? ( Y or {N} ) ==>$' double db 13,10,10,' Double Strike Mode? ( Y or {N} ) ==>$' dbw db 13,10,10,' Double Width Mode? ( Y or {N} ) ==>$' emp db 13,10,10,' E  !9"12ͮͮͨY6y6ͮʹHʹF$ͮʹGʹnͮͨYgygͮʹr$ͮʹͮʹWʹͨYʝyʝͮʹè$ͮʹͮͨYyͮʹFʹ$ͮʹEʹͮͨygYgͮʹ5ʹͮʹͨyzYzͮ9ʹ((ͮ*ͮͨntNt$ͮʹAʹ ʹʹCʹBʹͮVͮͨyYͮͮͨyYͮͮͨyEYEͮBͮʹͨyʈYʈͮOʹ> ͛> ͛*$ͮç;***! 9̓ +++ͮ 9ʹ!ͼ!N! 9̓ ̓ !] " }ʹ!! 9̓ ̓ ͼ!N! 9̓ ##̓ #B"!9*ͻ }#ͮ !9} ͋ !9}  !"** *#"+! ͋ Ò"""3 Usage: ms -n infile r ms can't open %s for reading *@*>*<!"<!9̓ *<}  ƒ!9̓ *<}  ͮ Ÿ!9̓ *<}  ͮ ʶó*<#"<+Tè!"@!9̓ *<}  !9̓ *<}  ͮ *<#"<+!9̓AʹʹʹCʹ,ʹ$ͮʹAʹʹʹCʹ!ʹ$ͮʹ1ʹʹCʹqʹ$ͮʹ4ʹ$ͮ8ʹ$$ͮNʹʹ_ Y$͛ Epson MX80-F/T with Graftrax + Set-up Program Answer questions yes or no by entering ( Y or N ) Just entering Carriage Return will enter default value { }$ Compressed Mode? ( Y or {N} ) ==>$ Double Strike Mode? ( Y or {N} ) ==>$ Double Width Mode? ( Y or {N} ) ==>$ Emph/* copyright (c) 1982 Peter Baker */ /* multiple space from an input file to the standard output */ /* ms -n infile */ #include main( argc, argv ) int argc; char **argv; { FILE fd; int i, n; char c; if( argc != 3 ) { printf( "\nUsage: ms -n infile \n" ); exit( 1 ); } if( ( fd = fopen( argv[2], "r" ) ) == NULL ) { printf( "\nms can't open %s for reading\n", argv[2] ); exit( 2 ); } n = atoi( argv[1]+1 ); while( ( c = getc( fd ) ) != EOF ) { putchDJQ_QQQa ^QQ_QQ^b NQPPPQNc \RQQQR\d _PP^PP_e _PP^PPPf NQPPSQNg QQQ_QQQh _DDDDD_i AAAAQIFj QRTXTRQk PPPPPP_l Q[UQQQQm QYUUUSQn DJQQQJDo ^QQ^PPPp DJQQUJEq ^QQ^TRQr NQPNAQNs _DDDDDDt QQQQQQNu QQQQQJDv QQQQU_Qw QJJDJJQx QQJDDDDy _ABDDH_z @@@@@@@ .IJ .IJ1 .IJ2 . .1 .2 .Š K.Ԡ T. u. }  !!"@!">!9̓ *<} !0 R!9̓ *<} !9 ͮ ʋf*<#"<+!*> _! 9̓ *<} ">[*@*>_"<">"@!9"*++"̓ A*!9*++"̓ *++"̓ }2:~ *++"̓ S*++"̓ "**++"̓ l!!9̓ S!9} }2!9̓ "͈!9̓ "!!9̓ S*} ͮ ʡ*} ͮ ͮ ʺ*#"+} ͻÈ:~ !9} ͋ *#"+!9} }*6!9} :~ : asized Mode? ( Y or {N} ) ==>$ No,$ Yes,$ Normal Line Feed? ( {Y} or N ) ==>$ 1&1/2 Normal Line Feed? ( Y or {N} ) ==>$ Double Line Feed? ( Y or {N} ) ==>$ Compressed Line Feed? ( Y or {N} ) ==>$ Italicized Mode? ( Y or {N} ) ==>$ Ignore Paper Out Sensor? ( Y or {N} ) ==>$ Skip Over Page Perforation? ( Y or {N} ) provides auto formfeed at page length - three lines answer here please ==>$ar( c ); if( c == '\n' ) { for( i = 1 ; i < n ; i++ ) putchar( '\n' ); } } } toi( argv[1]+2 ); else   *#"+} +!"*} !0 P*} !9 ͮ }\1* _*#"+} "Y! }2! ""!"*#"+} 9!"!9̓ ͲV!0}2!"!9̓ ͲV!0}2!"!9̓ ͲV!9̓ ͻV!9̓ } |+!9̓ #͈ +} ͻ*+"! ͏VVduoxcs͈!9̓ ! z!9̓ 0É!9̓ Aͻ*+"! ʯ:~ ͻÏ^0*!9̓ "*+"#* *.|g|*+"#*W"!"**#~+:~##6@~#."6*4++6w#(*a O! ~_#V!$ͳr+sbk#| "4> w+ w w##w w  6#6 ~+* ͳs#r{ʨ { K !. G #^!! w#w! ~<ʨ 6ͭ ! ~rʚ G! ̓ }ʙ * xuʏ >w#ˆ %ͳ {=>b x ʻ ʇ ʻ h&{ ͭ ! ~! N#FwG+wO# { L â +!9~ v ! ~bs !p 5q > v 6> * w`i#͈ ᯾¤ %,!ͳ |!!9n&:p : ɯ2 > 1!9̓ ! : w! xw #4>2 >2 : f xS *K͞+PGoZ'+FÎr7 :2!q: ʊ *M8 ^#V#*~#fo^#*~#fo^#V#*n^#*n^#V# ~#fo^#& ~#fo!+!#!+!#!+!+}|z{|}|z7||7zZZ)|/g}/o#|͉k|/g}/o#ɯ2qZZk:q|/g}/o#|/g}/o#:q<2qqDM!xxGyO҃)v|͔`i|)Öxڷz/W{/_ѯzW{_=yOxGæ2qZZ͉M|}ȯ|g}o)|/g}/o*!ͮ 3͏*|(!-ͻ*Zá* M*!9q* g*! {q*!9Ͳ* ʑ*! {Ü*+*ͤ Z"*+%" %" %"  " " " y 6"+6+!^6*F+N+3!!9~#= O"' +}|+#~(6#~#<]>o!46#6*! *|Z- !k] "mzr!] "ڇ Can't open > or < file.$Nw* ! 9R*"!`*m}> ͻ ʰ:<* 2 The files named .CPM are actually .COM files for CP/M. If you copy the files to a CP/M system without using 22DISK, just rename all *.CPM to .COM : O ! DM : S 9  !Y Write error - Disk full $`iPþ !9~=+>V+^+F+N~og~#fos#r}o|g}o|g}o|g|!,|}! ,ɯ|ʴ !|}!- | }ʱ z!--{!-z{ñ z{!||g}o,|g}o:)G{ozg+|/g}/oDM!z>nS\))v =nɯËzW|WMD!x<Ÿz>ڤjS\>))Ҭ# Ҵ =¤WWN#F#x~#~# "4> w+ w w##w w #z/W{/_!9~#fo! ! ! ! ! ! !9~#A"s!`*"!"!Y">2>2>22!"!"!@"!" ʞ!F#x±~#±!b2r~# "2r+}|~#G:rx"2r+w# +6#!6#2w2x*s!>r<o&F=-` r'~h6!+`W?_!~7z?` :>ª@w#.¶66*>?w#> w#.7:77$  ʬ # > _*~+#4N s> ͬ> !* G :] 2_~`  v q  > ~  ; ʇ ~ !*}ʟ : > !. G } ¼  > _ !"# con:rdr:pun:lst: Y Y _~O7Ç !6    #l i& ~h ! ~ʞ # è ~#F6,pw62  P!9̓ y=>ʨ >w <ʨ ! s  !a{   `OE!y6$ -7rBo&))T])))!y*:":l.3::2:":|!}Ž!.3ʤ!‘!/3>G>)͢3é!#ͫ'͜))̓(Ͱ0!͐&+ͽ1#͜%! /3,(r&͐&͜))̓(G(~m7#^#V#"Ͱ0)))R~+̽1G~`2:2:#~2:~?>S"=2:#^#V#^#V#":^#V":::}"*:!::@ʎ"":*:#w":*:~ʪ"µ"*ͽ19+":*:+":!=":6!=":*:~*=X"?Xc!*EX*GX*IX*KX#!B! n&! ~#fo!CXu *CX*IX*KX"MXcf!9uU2!9DM! ~#fo#n&r`is! ~#fo##n&r! s`in}F! n}I!i`in}F! n}O!i`in}T! n}I!i`in}B! n}P!i`in}B,! n}R,!i`in}CF! n}EF!i`in}H`! n}E`!i`in}Iz! n}Nz!i`in}L”! n}S”!i`in}N®! n}F®! i`in}P! n}L! i`in}R! n}M! i`in}S! n}P! i`in}f! ! ~#foo ! s#r*)X|z ! n&! ~#fo!? n get_val returned arg_val=%d, arg_typ= %c !l *)X|ʕ ! Ë !l `i~#fo>§ >v > ³ >ʂ >¿ >ʎ > >ʔ > > > > > >% > >S > >ʀ > >ʭ > > >+ >> 7 >7>C >d>O >y> [ >ʎ>g >> s > cr !"-Xcr !"-Xcr c!!!! n&! ~#fo!/Xu cr *5X!!! n&! ~#fo!1Xu c*5X+!!!Ç0,#q#!o9DM*)X|L! ~#fo!5A TEXT:<%s>!! ~#fon} y! ~#fon} y! ~#fon} †! ~#fo*9X8*9X+"9X! ~#fo! s#r! s#r! ~#fon}8! ~#fon} ! ~#fon} ! ~#fon} ! ^#Vr+s! ^#Vr+sns5! ^#Vr+s! ^#Vr+sn&|g}osð*7Xh! ~#fo ! ~#fo *7X+"7Xð! ~#fon} *-X|! ~#fo ð`i! ~#fo+|°`iÏó!9Ç0tÌù3!9DM*)X|*AX! ~#fo! SPACE %d li*:*:s#r#*:s#r#*:s#r#*:s#r#*:s#r#::w#":*:*:s#r#*:s#r#*:s#r#*:s#r#*:s#r#::w#":*:+~2:+V+^+":V+^+":V+^+":Vö(Ç0Â-Cþ01ð X1f ü&/!_9DM! ~#fo! ͡! Version 5.1 !ͤ !ͧ!")X! ~#fo+|b!&U USAGE: format file1 more than one file OK !ͤͪ! ^#Vr+s! ^#Vr+s!Ҥ ! ^#Vr+s~#fo`iͭ`i!ü Now processing <%s>!ͤ`in}-! n}D!")Xn! `iͰ#|! `i!  U! n}L! i`in}Mc! n}10!i! n}2A!i! n}3R!i! n}4c!i!i!9Áþ0=Í2ü2!w9DM! ~#fo! u`i6#6`i~#fo! n} `i~#fo! n} `i~#fo! n} `i^#Vr+sã`i~#fo! x! ~#fo`i~#fo! ns! ~#fon}+0! ~#fon}-<`i^#Vr+sW! ~#fon&{|W!k`i~#fo! ~k!9ÀÇ0|3!9DM*)X|ʷ!aY!ì brk: OUTBUF=<%s>!w!aYz`is#rz`i~#foaY6 `i~#fo#aY6!aY}!"_Y>2aY!9 n&! ~#fo!3Xu *3X"1Xc!*1X#!P! n&! ~#fo!5Xu c!!!! n&! ~#fo!EXu c!!!! n&! ~#fo!GXu c!!!! n&! ~#fo!IXu c!!!! n&! ~#fo!KXu cr !!!! n&! ~#fo!7Xu c!!!! n&! ~#fo!9Xu c!OX! ~#fox c!X! ~#fox c!!!! n&! ~#fo!;Xu *;X{ c*AX!{ !!y*=X#! n&! ~#fo!=Xu ne(s), LINENO= %d!Ϳ*AX*MX1*AX|<*MX#*AX! ~#fo*AX! ~#fo"AX*)X|ʙ*AX!Î LINENO = %d!Ϳ*AX*MXҪúÇ0þ0=!w9DM*)X|! ~#fo! GETTL command line= <%s>!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2! ^#Vr+s͐s{ 1͐͐ #1͐++n} 1! ^#Vr+s6 #2`i^#Vr+sz#2͐ [1! s#rz#2͐¦1͐?2͐ ͐^1͐6͐ L2!9[2>!9DM! n&X2|ʂ2! n&Ç2! n&!9DM! n&0ͯڸ2! n&9ͯ2Í2!9DM`iw#w! 6#6͐ n! s{ 2! n} 3! ^#Vr+sfo! s#r͐n}T;͐|T;! ^#Vr+s! ^#Vr+sns! ^#Vr+s! ^#Vr+s ;͐6! ! s#r! n}—;! ^#Vr+s!җ;! ^#Vr+s6 p;͐! ^#Vr+sns{;! ^#Vr+s×;! n};! ^#Vr+s!;! ^#Vr+s6 ;! n&HA!9WAQA!9DM͐͐ ҧA͐^#Vr+s͐ ҔA͐0ÜA͐7s!&A͐ ͐͐ ͉͐TA`is͐ ͐͐ )͐TA`in&#&A!9BÍ2!9DM`iw#w͐~#fon&A}NB͐ ?͐^#Vr+snѯg`is#rB͐UB!9!9DM! n} ͝ʍB! n} ͝ʍB! n} ͝×B^B!9DM͐~#fon`is͔B|B͐^#Vr+sßB`in&B!9BmCU2Í2!9DM! n&B! s For more details on the directed I/O (NDIO in our version) see NDIO.C Sample calls: A>roff filename1 filename2 filename3 +) this would send the formatted version of these three files to the console and to the cp/m list device A>roff filename1 +)]>filename1 this would format filename1 and send it to the list device, console, robot-typewriter, and back to filename1. For more details on using the directed I/O, see NDIO.C Note the difference between ) which redirects to the *:w7*!9& 6C#6O#6M7G*!\&*!l&!~#fopG> +#~aG##UG!pG!w#}G:**ʔG*!ѷ! , FNxg>GoyG$ve the form of a period followed by two letters. A command line should have nothing on it but the command and its arguments (if any); any text would be lost. A command argument can be either ABSOLUTE or RELATIVE : .in 5 sets the indent value to 5 spaces .in +5 sets the indent value to the CURRENT value plus 5 .ls -1 sets the line spacing value to the current value minus one Also, all commands have a minimum and maximum value that will weed ouB|C! n&sCC! n&B}>C! n&sCC!! n! n&+bC!kC! n&vCçC>!9DM! n&pC|ͣ£C! n&sC|ͣ!9DM! n&AͯC! n&Zͯ 7:O*o` !\&!7*!+D&*!;D&+D!, !\&!TELkhDGÇ0C7*o^#V#zpD+V+^+{D*m_D!D!bDeDBroken pipe 7,2q*&:q):D=D=r:qo&DCçD7*Dlist device with \n's expanded to \r \n, and } which redirects to the printer (same port) but without expanding \n's. N.B.: dio.c accepts +outfile as output to both file and console, ndio.c does not (it wants +>foo ). Using ROFF, you can make nice printouts of a file, with as little or as much help from the program as you want, depending on the commands. There are default values for all parameters, so if you don't put any commands in at all, your file will come out with filMay 7, 1981 ROFF This version of ROFF, based on the formatter in Kernighan and Plauger's book SOFTWARE TOOLS, is written in BDS C, and employs the directed i/o functions that go along with that package. Well, half of the directed I/O anyway - it doesn't use redirected input because I wanted to be able to format more than one file at a run. Please ignore any "odd" comments to myself in ROFF1.C and ROFF2.C; I tried to find them all but there may be a few extra silly remarks around. t any odd command settings (like setting the line spacing to zero, for example. It won't let you do that, but it could be changed if you REALLY have a burning desire to do so). Some commands cause a "break", which is noted in the table below. Before such a command goes into effect, the current line of text is put out, whether it is completely filled or not. (this is what happens at the end of a paragraph, for example.) A LINE BEGINNING WITH SPACES OR A TAB WIL\!*D7:)~:,"s!"u*|*uʂE*~#YE"*s*u‚E#"u*+"FE#7*|DM**EڶE> : | T | : : | H | : : | | |-----------------------------------------------| | | margin 3 | | |--*********** Command Break? Default Function ------- ------ ------- --------- .bp n yes n = +1 begin page numbered n .br yes cause a break .ce n yes n = 1 center next n lines .fi yes start filling lines .fo string no empty sets footer to string .he string no empty sets header to string .in n no n = 0 sets indent value to n .ls n no n = 1 sets line spacing to n .m1 no n = 2 sets topmost margin to n .m2 no n = 2 sets 2nd top margin tou don't have to turn the fill on and off if it's already on ) ------------------------------------ A new paragrah may be caused by using the temporary indent command, like .ti +5 or by simply beginning the paragraph with a tab, as you would if you were just typing. ------------------------------------ Headers and Footers. A page number can be incorporated into any header or footer by putting a "#" in the title where you want the number to go: .he This is  /* * roff -a text formatter (based on SOFTWARE TOOLS by Kernighan & Plauger) * * This program appears in the BDS C Users Group "Just Like Mom's" * disk. I found no mention of the Author(s) of this program so I guessed * the authorship based on the style of comments describing functions, which * also appears in "crypt.c" written by kathy bacon and neal somos. * * * * Suggestion for compiling and linking (change to suit). * Note roff1 mentioned twice in clink command. * * cc1 ro /* right margin -> default PAGEWIDTH */ int CEVAL; /* set equal to number of lines to be centered */ /* default is 0 */ int ULVAL; /* set equal to number of lines to be underlined */ int SPVAL; /* blank lines to be spaced down */ int CURPAG; /* current output page number; init = 0 */ int NEWPAG; /* next output page number; init = 1 */ int LINENO; /* next line to be printed; init = 0 */ int PLVAL; /* page length in lines; init=66 */ int M1VAL; /* margin before#define NEWLINE '\n' #define TAB '\t' #define BLANK ' ' #define SQUOTE 0x27 /* single quote */ #define DQUOTE 0x22 /* double quote */ #define PAGELEN 66 #define FI 1 /* fill lines */ #define TI 2 /* temporary indent */ #define BP 3 /* begin page */ #define BR 4 /* causes break */ #define CE 5 /* center line(s) */ #define IN 7 /* left indent */ #define LS 8 /* line spacing */ #define NF 9 /* no fill */ #define PL 10 /* set page length */ #define RM 11 /* set right margin */ /* 7 MAY 81 */ /* based on the formatter presented in Kernighan and Plauger's SOFTWARE TOOLS, modified for BDS C */ #include "ROFF.H" main(argc, argv) int argc; char **argv; { char filename[20], line[ MAXLINE ]; struct _buf iobuf; dioinit (&argc, argv); /* directed I/O */ fprintf(STDERR,"\nVersion 5.1\n"); while (0) putchar('\7'); debug = FALSE; if (argc == 1) { fprintf(STDERR,"\nUSAGE: format file1\n more than one file OK "); exit(); } argv++; while ( --argc ff1.c -e 5000 -o * cc1 roff2.c -e 5000 -o * cc1 ndio.c -o * clink roff1 roff2 roff1 ndio -o roff -s * * Note that dio.h used with ndio is not the same as distributed with BDS C * * Above notes by Chuck Forsberg * */ /* 4 MAY 81 */ #include "bdscio.h" #include "ndio.h" int debug; int PAGESTOP; #define STDERR 4 /* send error messages to console while in DIO */ #define DEBUG ( debug != 0 ) #define HUGE 135 /* generally large number */ #define PAGEWIDTH 80 /* see RM_DEF */ and including header */ int M2VAL; /* margin after header */ int M3VAL; /* margin after last text line */ int M4VAL; /* bottom margin, including footer */ int BOTTOM; /* last live line */ char HEADER[ MAXLINE ]; /* header title */ char FOOTER[ MAXLINE ]; /* footer title */ /* defaults for global parameters */ #define FI_DEF 1 #define LS_DEF 1 #define IN_DEF 0 #define RM_DEF 80 #define TI_DEF 0 #define CE_DEF 0 #define UL_DEF -1 #define M1_DEF 2 #define M2_DEF 2 #define M3 #define SP 12 /* add blank line(s) */ #define UL 13 /* underline line(s) */ #define FO 14 /* footer title */ #define HE 15 /* header title */ #define M1 16 /* top margin */ #define M2 17 /* second top margin */ #define M3 18 /* first bottom margin */ #define M4 19 /* bottom-most margin */ int FILL; /* set to YES or NO */ int LSVAL; /* line spacing value -> default will be 1 */ int TIVAL; /* temporary indent -> default 0 */ int INVAL; /* left indent -> default 0 */ int RMVAL;> 0 ) { strcpy (filename, *argv++); /* get next argument */ fprintf(STDERR,"\nNow processing <%s>",filename ); if (filename[0] == '-' && filename[1]=='D') { debug=TRUE; continue; } if (ERROR == fopen( filename, &iobuf )) { fprintf(STDERR,"\ncan not open <%s>", filename ); continue; } init_defaults(); while ( fgets( line, &iobuf ) != 0 ) /*until EOF or CPMEOF */ { if (line[0] == COMMAND ) comand (line); else text (line); } if (LINENO  #define COMMAND '.' /* all commands starts with this */ #define CONSOLE -5 /* one of output options */ #define PRINTER -4 /* another */ #define FILE -3 /* another */ #define UNKNOWN -1 /* returned if doesn't recg. command */ #define NO_VAL -32760 /* returned when no argument w/commad */ #define WE_HAVE_A_WORD 1 /* returned by getwrd func. */ #define NO 0 #define YES 1 #define UNDERLINE '\137' #define CR 0x0D #define BACKSPACE '\b' #define NUMSIGN '#' /* for title strings */ _DEF 2 #define M4_DEF 2 int DIR; /* for "spreading" of lines */ int OUTWRDS; /* no. words in outbuf; init = 0 */ char OUTBUF [ MAXLINE*2 ]; /* lines to be filled collected here */   > 0 || OUTBUF[0] !='\0') space (HUGE); /* flush last output */ fprintf(STDERR,"\nDone processing <%s>", filename ); } /* end while (--argc > 0 ) */ dioflush(); } /* end main() */ /******************************************************************** initializes the global variables governing the execution of the format commands. ********************************************************************/ init_defaults() { FILL = FI_DEF; /* yes we want filled lines */ LSVAL tring ) char *string; { char local[ MAXLINE ]; int i, j, k; strcpy ( local, string ); for (i=0; local[i]==' ' || local[i]=='\t' || local[i]=='\n' ; i++); for (j=0; (string[j]=local[i]) != '\0' ; i++, j++ ) ; return; } /********************************************************************* Truncates white-space characters at the end of a string. *********************************************************************/ trunc_bl (string) char *string; { char *ptr; int k) return( FI ); if ( let1=='F' && let2=='O') return( FO ); if ( let1=='T' && let2=='I') return( TI ); if ( let1=='B' && let2=='P') return( BP ); if ( let1=='B' && let2=='R') return( BR ); if ( let1=='C' && let2=='E') return( CE ); if ( let1=='H' && let2=='E') return( HE ); if ( let1=='I' && let2=='N') return( IN ); if ( let1=='L' && let2=='S') return( LS ); if ( let1=='N' && let2=='F') return( NF ); if ( let1=='P' && let2=='L') return( PL ); if ( let1=='R' && let2=='M') return( RM ); d lines */ brk(); /* flush out last unfilled */ FILL = YES; break; case NF : /* non-filled lines */ brk(); /* flush out */ FILL = NO; break; /* down and cry */ case BR : /* just cause a break */ brk(); break; case LS : /* set line spacing value */ set (&LSVAL, arg_val, arg_typ, LS_DEF, 1, HUGE ); break; case TI : /* set temporary left indent */ brk(); set ( &TIVAL, arg_val, arg_typ, TI_DEF, 0, RMVAL ); break; case IN : /* set left indent */ set = LS_DEF; /* line spacing = 1 */ INVAL = IN_DEF; /* left margin indent 0 */ RMVAL = RM_DEF; /* right margin = page width */ TIVAL = TI_DEF; /* left margin temporary indent 0 */ CEVAL = CE_DEF; /* next n lines to be centered - 0 */ ULVAL = UL_DEF; /* next n lines to be underlined - 0 */ PAGESTOP = FALSE; PLVAL = PAGELEN; M1VAL = M1_DEF; /* top and bottom margins */ M2VAL = M2_DEF; M3VAL = M3_DEF; M4VAL = M4_DEF; CURPAG = 0; NEWPAG = 1; LINENO = 0; BOTTOM = PLVAL - M3; k = strlen (string); ptr = &string[ k-1 ]; /* char before terminating nul */ while (*ptr==BLANK || *ptr==TAB || *ptr==NEWLINE) *ptr-- = '\0'; } /******************************************************************* performs the formatting command returned by comtyp - sets global variables ( indenting, underlining, etc. ) *******************************************************************/ comand ( line ) char *line; { int c_type; /* command type */ int arg_val; /* argumen if ( let1=='S' && let2=='P') return( SP ); if ( let1=='U' && let2=='L') return( UL ); if ( let1=='M') { if (let2=='1') return( M1 ); if (let2=='2') return( M2 ); if (let2=='3') return( M3 ); if (let2=='4') return( M4 ); } return( UNKNOWN ); /* no match */ } /********************************************************************* Skips white-space characters at the beginning of a string. *********************************************************************/ skip_blanks ( s( &INVAL, arg_val, arg_typ, IN_DEF, 0, RMVAL-1 ); TIVAL = INVAL; break; case RM: /* set right margin */ set ( &RMVAL, arg_val, arg_typ, RM_DEF, TIVAL+1, HUGE ); break; case M1: /* set topmost margin */ set ( &M1VAL, arg_val, arg_typ, M1_DEF, 0, HUGE); break; case M2: /* set second top margin */ set ( &M2VAL, arg_val, arg_typ, M2_DEF, 0, HUGE); break; case M3: /* set first bottom margin */ set ( &M3VAL, arg_val, arg_typ, M3_DEF, 0, HUGE); break; case M4: /* setVAL - M4VAL; OUTWRDS = 0; /* no. of words in outbuf */ OUTBUF [0] = '\0'; DIR = 0; strcpy ( HEADER, "\n" ); strcpy ( FOOTER, "\n" ); } /***************************************************************** this function decodes the command type, returning the type, or UNKNOWN. *******************************************************************/ int comtyp (line) char *line; { char let1, let2; let1 = toupper( line[1] ); let2 = toupper( line[2] ); if ( let1=='F' && let2=='I't value, if any */ char arg_typ; /* relative (+ or -) or absolute */ int i; c_type = comtyp (line); if DEBUG fprintf(STDERR,"\n\nCOMAND %d",c_type); if (c_type == UNKNOWN) /* IGNORE ALIEN ORDERS */ { fprintf(STDERR, "UNKNOWN COMMAND: <%s>\n", line); return; } arg_val = get_val ( line, &arg_typ ); if DEBUG fprintf(STDERR, " \n get_val returned arg_val=%d, arg_typ= %c ", arg_val, arg_typ ); if DEBUG fprintf(STDERR,"\n\n"); switch (c_type) { case FI : /* fille   bottom-most margin */ set ( &M4VAL, arg_val, arg_typ, M4_DEF, 0, HUGE); break; case CE : /* center next arg_val lines */ brk(); set ( &CEVAL, arg_val, arg_typ, CE_DEF, 0, HUGE); break; case UL : /* underline next arg_val lines */ set ( &ULVAL, arg_val, arg_typ, UL_DEF, 1, HUGE ); break; case HE : /* get header title for pages */ gettl ( line, HEADER ); break; case FO : /* get footer title for pages */ gettl ( line, FOOTER ); break; case SP : /* space dow*****************************************************/ center (line) char *line; { TIVAL = max(( RMVAL+TIVAL-strlen(line))/2, 0 ); return; } /************************************************************** get next word from input line ***************************************************************/ int getwrd (in, out ) char *in, *out; { int i, j, n; /* find first non-blank */ skip_blanks (in); replace_char ( in, TAB, BLANK); /* replace tabs w/space */ /* scan off a word */ typ=='-' ) i++; else if ( !isdigit( *typ ) ) return( NO_VAL ); return ( atoi( &local[i] )); } /***************************************************************** sets a global parameter like line-spacing, underlining, etc. Also checks that the new value is within the range of that parameter. Assigns the default for that parameter if no value is specified. ******************************************************************/ set ( param, val, arg_typ, defval, minval, maxval ) int * position in output */ line[j+1] = '\0'; if DEBUG fprintf(STDERR,"\nDIR=%d, nholes=%d, i=%d, j=%d", DIR, nholes, i, j ); for ( ; i 0 ) space (HUGE); set ( &CURPAG, arg_val, arg_typ, CURPAG+1, -HUGE, HUGE); NEWPAG = CURPAG; break; case PL : /* set page length */ set (&PLVAL, arg_val, arg_typ, PAGELEN, M1VAL+M2VAL+M3VAL+M4VAL+1, HUGE); BOTTOM = PLVAL - M3VAL - M4VAL; break; } return; } /******************************************* if ( 1 == (n = sscanf( in, "%s ", out))) { if DEBUG fprintf(STDERR,"\nafter sscanf out = <%s>",out); j = strlen (out); replace_char (out, NEWLINE, BLANK); for (i=0; i 0; nblanks-- ) line[--j] = BLANK; } } if DEBUG fprintf(STDERR,"\nafter spreading, line is:\n<%s>", line); return; } /**************************************************************** end current filled line *****************************************************************/ brk() { int l; if DEBUG fprintf(STDERR,"\nbrk: OUTBUF=<%s>", OUTBUF); if ( 0!= ( l = strlen (OUTBUF))) { OUTBUF[l] = NEWLINE; OUTBUF[l+1] = '\0'; put (OUTBUF); *********************** gets the number ( if any ) associated with any command *******************************************************************/ int get_val ( line, typ ) char *line, *typ; { int i; char local[ MAXLINE ]; strcpy (local, line); /* local copy */ /* skip over the command line */ for (i=1; local[i]!=' ' && local[i]!='\t' && local[i]!='\n' ; i++ ) ; skip_blanks (&local[i]); /* find the number */ *typ = local[i]; /* relative or absolute */ if ( *typ=='+' || ******/ spread ( line, nextra, no_words) char *line; int nextra; /* no. extra places left in line */ int no_words; /* no. words in the line */ { int i, j, nblanks, nholes; if DEBUG fprintf(STDERR,"\n\nspread:line=<%s>, nextra=%d, no_words=%d", line, nextra, no_words ); if (nextra <= 0 || no_words <= 1) return; DIR = !(DIR); nholes = no_words - 1; trunc_bl (line); i = strlen(line) - 1 ; /* last character of string */ j = min (MAXLINE - 2, i + nextra); /* last    } OUTWRDS = 0; OUTBUF[0] = '\0'; return; } { int i; if DEBUG fprintf(STDERR,"\n SKIP %d line(s)", n); for ( i=0; i= 1 */ else putchar( title_str[i]); return; } /******************************************************************* put out num in string of width >= w ******************************************************************/ putdec ( num, w ) int num; int w; { int i, nd; char chars[10]; nd = itoc ( num, chars, 10 ); for ( i=nd + 1; i<=w; i++ ) putchar (BLANK); for ( i=0;i<=nd; i++) putchar ( chars[i] ); return; } /******************************************************** puts out page header *******************************************************************/ phead() { CURPAG = NEWPAG; NEWPAG++; if ( M1VAL > 0 ) { skip ( M1VAL - 1 ); puttl ( HEADER, CURPAG ); } skip ( M2VAL ); LINENO = M1VAL + M2VAL + 1; if DEBUG fprintf(STDERR,"\nLINENO=%d", LINENO); return; } /********************************************************************* puts out page footer *************************************************************************************** replace c1 in string with c2 ****************************************************************/ replace_char (string, c1, c2) char *string, c1, c2; { int i; for (i=0; string[i] != '\0'; i++) if (string[i] == c1) string[i] = c2; return; } /******************************************************************** produces n empty lines *********************************************************************/ skip (n) int n; ************************************************************** convert int num to char string in numstr *********************************************************************/ itoc ( num, numstr, size ) int num; char *numstr; int size; /* largest size of numstr */ { int absnum, i, j, k, d; absnum = abs (num); numstr[0] = '\0'; i = 0; do { i++; d = absnum % 10; numstr[i] = d + '0'; absnum = absnum/10; } while ( absnum != 0 && i 0 ) { puttl ( FOOTER, CURPAG ); skip ( M4VAL - 1 ); } return; } /******************************************************************* put out title line with optional page no. *******************************************************************/ puttl ( title_str, pageno ) char *title_str; int pageno; { int i; for ( i=0; title_st[i] != '\0'; i++ ) if ( title_str[i] == NUMSIGN )    numstr[i] = '-'; } for ( j=0; j", com_line); i=0; whi*****************/ put (line) char *line; { int i, j, k; if DEBUG fprintf(STDERR,"\n\nPUT<%s>",line); if (LINENO == 0 || LINENO > BOTTOM ) phead(); indent (TIVAL); putline (line); TIVAL = INVAL; skip (min (LSVAL-1, BOTTOM-LINENO)); LINENO = LINENO + LSVAL; if DEBUG fprintf(STDERR,"\nLINENO=%d, LSVAL=%d",LINENO, LSVAL); if (LINENO > BOTTOM) pfoot(); return; } /*********************************************************** concatenates the word onto the end of OUTBUF for filled tex********************** yet ANOTHER version of text !!! no. 59,999,999 get it right this time Kath dear *******************************************************/ text (line) char *line; { char wrdbuf [MAXLINE]; int i, j, k; char *p1, *p2; if DEBUG fprintf(STDERR,"\n\nTEXT:<%s>", line); if (line[0] == BLANK || line[0] == NEWLINE || line[0] == TAB) leadbl (line); if (ULVAL > 0) /* set high bits of all non-white space chars */ { ULVAL--; p1 = p2 = line; while (*p2) { if (*p2*****************************/ int count_char (string, ch) char *string, ch; { int n; char *p; p = string; n=0; while (*p) if (*p++ == ch) n++; return (n); } /*********************************************************** remove all occurrences of ch; first, last, and no. of occurrences returned in parameters ************************************************************/ remove_char (string, ch, first, last, n_ch) char *string, ch; int *first, *last, *n_ch; { char *p1, *p2; finle ( com_line[i]!= ' ' && com_line[i]!='\t' && com_line[i]!='\n') i++; strcpy ( local, com_line ); skip_blanks (&local[i]); /* strip quote if found */ if ( local[i]==SQUOTE || local[i]==DQUOTE) i++; strcpy ( ttl, &local[i] ); if DEBUG fprintf(STDERR,"\ntitle = <%s>", ttl); return; } /****************************************************************** space n lines or to bottom of the page *******************************************************************/ space (n) int n;t ************************************************************/ putwrd (wrdbuf) char *wrdbuf; { int i, j, k; char s[MAXLINE], ch; int line_len, outw, new_out_width, wid; int nextra; if DEBUG fprintf(STDERR,"\nwrdbuf = <%s>",wrdbuf); skip_blanks (wrdbuf); trunc_bl (wrdbuf); wid = strlen (wrdbuf); if DEBUG fprintf(STDERR,"\nwid = %d",wid); line_len = RMVAL - TIVAL; outw = strlen (OUTBUF); new_out_width = wid + outw + 1; /* one for blank */ if DEBUG fprintf(STDERR,"\nnew_out_w == TAB || *p2 == BLANK || *p2 == NEWLINE) *p1++ = *p2++; else *p1++ = *p2++ | 0x80; } } if (CEVAL > 0) { center (line); put (line); CEVAL--; } else if ( line[0] == NEWLINE || FILL == NO ) put (line); else while (WE_HAVE_A_WORD == getwrd (line, wrdbuf)) putwrd (wrdbuf); return; } /*********************************************************** put out a line of text with correct indentation underlining if specified *******************************************d_char (string, ch, first, last); *n_ch = count_char (string, ch); p1=p2=string; while (*p1 = *p2++) if (*p1 != ch) p1++; return; } /************************************************************** a new putline routine; sends line to current output ***************************************************************/ putline (line) char *line; { int i; if (ULVAL >=0) { replace_char (line, NEWLINE, CR); puts (line); indent (TIVAL); for (i=0; line[i] != '\0'; i++) if (line[i]  { if DEBUG fprintf(STDERR,"\nSPACE %d line(s), LINENO= %d", n, LINENO); brk(); /* flush out last unfilled line */ if (LINENO > BOTTOM) return; /* end of page */ if ( LINENO == 0 ) /* top of page */ phead(); skip( min( n, BOTTOM+1-LINENO )); /* can't skip past bottom */ LINENO = LINENO + n; /* obvious */ if DEBUG fprintf(STDERR,"\n LINENO = %d", LINENO); if (LINENO > BOTTOM) { pfoot(); /* print footer if bottom */ } return; } /*********************************idth=%d, outw=%d, wid=%d, line_len=%d", new_out_width, outw, wid, line_len ); if (new_out_width > min (line_len, MAXLINE-1)) { nextra = min (line_len, MAXLINE-1) -outw + 1; spread (OUTBUF, nextra, OUTWRDS); brk(); } strcat (OUTBUF, wrdbuf); strcat (OUTBUF, " "); if DEBUG fprintf(STDERR,"\nPUTWRD:OUTBUF=<%s>",OUTBUF); OUTWRDS++; return; } /************************************************************** returns no. of ch in string **********************************  & 0x80) putchar (UNDERLINE); else putchar (line[i]); putchar (CR); putchar (NEWLINE); if (ULVAL==0) ULVAL--; } else puts (line); return; }  return (n); } /*********************************************************** remove all occ ,!9W :X  ,,͝ *#"+W ͤ ?!"*W !0 d*W !9 ͈ ʑpE* 9 *#"+W "m! }2! ""!"*#"+W M!"!9] j!0}2!"!9] j!0}2!"!9] j!9] j!9] W |?!9] #b +W *+"! ͣjj͝ duoxcs͜!9] ! ʎ!9] 0Ý!9] A*+"! :X ãp*!9] "*+"#*ͤ *.|g| *+"#*1 !"# con:rdr:pun:lst: 3 3 _~O7a!   Y #F i& ~B !~x #j  ~#F6,pw62 * !9] y=ʂ ͷ >w <ʂ !s 6#6 ~+ ͍s#r{ʂ { % ! ! #^!!w#w!~<ʂ 6͇ !~rt G!] }s *xui >w#b %͍ {=b x ʕ aʕ h&{ ͇ ! "!"** #*! ͈ Gͣ*|<!-*nõ*ͤ a*! Å*ͤ {*! U Å*! *ͤ ʥ*! U ð*+*~ n"***:X "!}2!"!9] +b !ͼ ͱ"#͈ ͈ *͈ ͈ 5*#"+! 9] *}*ͤ Z*#"+! 9] *}! 9] *6*}2*"""*+%"%"%" " " "y 6"+6+!^6*F+N+3!!9~# O"' +}|+#~6Á!9*!9!"!ͼ ʪ*+"! ʊ!9*W ͈ e!9*W ͈ ͈ ~!9*W ͈ ͈ ʇÊ**#!96!!9"!9%s !9"*++"] U*!9 *++"] -*++"] }2:X *++"] g*++"] "**++"] ̀!!9] g!9W }2!9] "͜!9] "!!9] g*W ͈ ʵ*W ͈ ͈ *#"+W Ü:X !9W e,*#"+!9W }*6~!N#FwG+wO# { & |+!9~ P !~bM !J 5K > P 6> * w`i#b ᯾~ %,!͍ |!!9n&:J  ɯ2 > @!9] !: w!xwҸ #4>2 >2 :@ x- : O ! DM : -   !3 Write error - Disk full $`i* Ø !9~=+V+^+F+N~og~#fos#r}o|g}o|g}o|g|!,|}!¢ ¢ ,ɯ|ʎ !|}!- | }ʋ z ! --{!-z { Ë z {/* * Remove Trailing Whitespace. * From The C Programming Language by Kernighan and Ritchie page 61. */ #include #define MAXLINE 250 main() { int n; char line[MAXLINE]; while( (n = getline(line, MAXLINE) ) > 0 ) { while( --n >= 0 ) if( line[n] != ' ' && line[n] != '\t' && line[n] != '\n' ) break; line[n+1] = '\0'; printf( "%s\n", line ); } } #~#<7>I!46#6*!*|4 !E7 "GTr!7 "an Can't open > or < file.$(w* ګ! 9Rګ*"!:*G}͕ 1:<* 2  ʆ > _*~+#4N s> ͆> ! ! :72_~: P K > X YaX !*}y > ! ! } – > _   !||g}o |g}o )! {ozg+|/g}/oDM!z>H S\))P =H ɯe z1 |1 MD!x~ jS\>))҆ # Ҏ =~ 1 1 N#F#xʶ ~#~#Ÿ Ÿ  "> w+ w w##w w #~+: ~##@~#.  *++w#@"a O! ~_#V!$͍r+sbk#| "> w+ w w##w w #~+: ~##@~#.  * 6 6' 6 6L( 6 6M) 6 6V* 6 6W+w6+!V+^%',nfѯjt!t'^V!ѯjt!t'V+^!'r+s,)%(:%wE%4# 4(å-.:tsl!9!8 ͽ/3esac reppu tpecca lliw margorp sihT :snoitcurtsnI2!2!9!^260;)etalsnart lliw srettel esac rewoL( .sknalb dna sretcarahc:!:!9!w6!V+^%)  W_go!  Y w6++!V+^%  nf^V!Ͷjt!xt'nf!l'W^ !r+s  )%(:%wE%4# 4^)%(:%wE%4# 4*! !9!|'!9|'Rj !Z  ZYXWVUTSRQPONMLKJIHGFEDCBA!  6' 6 6 6 w 6do!nf!t'!W^S3nf!t'!W^S3FÖ O gogo! !!9!w FPP)%(:%wE%4# 4 D Q gogo!!! e3 FRR)%(:%wE%4# 4 S gogo!!! e3 TT)%(:%wE%4# 4s U gogo!V gogo!WXX)%(:%wE%k YÚW_g>@oͬZU| >:>1-.dne ot nruter egairrac a dna doirep a retnE,!,!9! ,023g n}.|45 :enil tupnI ! !9!  6_______!!9!  7 Y8g n}.|. 99)%(:%wE%÷:w6 !V+^% ;nf!t'nf!t'W^S3W!Ͷ0;!Ͷs;)%(:%wE%4# 4 F <w6 !V+^%r=> w 6  w 6w6+!V+^%ҧnf!t'6 )%(:%wE%4# 4N w w w 6 w 6  w 6  w 6d  w 6e! w 6n" w 6o# 6 6$ 6 6% 6 6&[˺(G:}!RDsx怴g3!39 ѯɹ (<Ͷ8x|x| #.w-##w > կNT]F('###U$8C(?U$8:(6+++ (ˆ#w+> ###U$8(G+++ˆ ˎ#Np+y ++Nwy+!wRead beyond EO!PY9G!ݾ Hfn( ~^(Vfnů^ ѯݾ~(!z() ,F̷f | r+sFfn|(Ͷ0n({( x8Ͷ8x > w+6 +*+*+w!|'* w##w!~8 F##N$ $6^#V!}!!!!! !!!F$wString too lonCall by reference precision erroIndex or value out of rangAttempted divide by zerMultiply overfloStack overfloFloating point overflow/underflo -- statement ͳ gn!!ZA"lsgnugn!!za"lҼgnu6 ! ͳ  tad.tnof!9! w6+++!V+^%?@nftuAnf!t'W^!ͶsBgnBtuCnftuDnfW_%Ҫ Ew6Fnf^V!Ͷjt!xt'V+^rsGnfѯjt!t'V+^rsHnftuIw6 !V+^% JKnf^V!Ͷjt!t'V+^& KrsLnf^Vnfѯjt!t'V+^RtuMnfR\ N gog  xT(*t(&F(+f(' (鯼!F$# #PPfnpGxEe ,OG 8xͶ8s('Çx (] (Y (U (Q (M#(1_(-$(){8 [8:8Oa8A8 0OWOzW>( (x3 xpʄfn~!9 G_~((GW>__{(+#ܯ>(#> + ٯgk9~fnw !!9G ᯼!F$# kOfnF+|(Ͷ0#w8GͶ8Bx (; (7(3 x8w+᯼Q!}F$ E%!F$#Ͷ0#|G #qF +(# N$+ $#iF ͂###go  #iF ͂ˆ###Ÿgo!9R`!9 PY FfnV goO  | }~^(Vfn>f(zȯF+mB̫ Nng)))V^G~ (#X(y(8 PG BN#F~++( 8 G F+N+++ݾ~8 (8 Gy OAOTRUEFALSEF~+++N Ő( 8G ( +Ny(G++V^!9~(! Ͷ& ~( !Ͷ&('yG(!4+~&! 4+~&!4+~&! 4+~&!  ͮʋ! Ͷ&Ë ѯݾ !9#ɯ#ɯw~(4+& 6v +&55ɯݾ e! 9!7}((!"9(7>ͪ&w+! 9(  SxDM!=)#0 |z(z/W{/_|(|/g}/o#  -# z"BKgo(0##+"ww##ӯ`iGO%6+++6  6 #6#"(8i*GW^~ # >0D*>_~:(GAG*>_~ > :(*5*+~"x8I!#F$7ø%L(C "O "N  "S "T  "ø%w "8(.(w#H (##a8{0_ %+++f###%(6Y"O"B"ø%%y%4r#f3####͑%"-#!5~< #5~< #5'"-#! 6!'+Fˆ"(w#w#w 44~0#4 #4!!4 #4 #4!F$fnqG+fnp+qG!Dx (- + x:0%08!͈p':000⯸x/Gy/Oɯ e!F$# !T]jjZj_ZfnV^###U$++Fwx+0w+z  z é!wType error on inpuError in input, try again 9x (-(+xx3x0:x3'.(7e(;E(708:8> ͩDM#4 fnr+s+p+q@ H x3'-(+ x394 ~+.(:e(DE(@ (85͚#~0! 6+w+w+w+w  z(6-+goGRw+O'͆͆d͆ ͆E͎G #~-   60 +A~8 ( W  N++++!9ѯɯR0 >0w+ G fnN++| z >  E%+++~(E%###v###%Yø%Y">+++###%`i###͑%Vʜf 8###'|#|#+++(E^(A"!5~< #5~< #5'"x&z## Ư"w#w#w0ˆ++`i(  S_xDM!=()8 )0 0)+} E˸$}(|tx( jtygoRO 0 ###+" w###y +++~### 8r%8U$O8 ( (++q+++++++ˎ#q#xZ#fn##|###+"#fn##|###+"%`i%0%PY%0!F$!!F$!!.F$windex or value exceeds bound|( -E%goR'ͪͪdͪ ͪͪ -- Module!OF$|og ͪͪ|g! F$ͪdͪ ͪͪ!.F$/ R0E% *~+ &^#~ &&~ F&&&~&N&&gi#9A! 6!!%66r#!#w)~6<(3͑%' " ^##wø%!# !# !# !#wDisk erroError in extending filDisk fulDirectory fulBad filename %*^#~ 84 ø%#6%*6O  $ E%ø%%*6#~P( 4^qø%5 $7ø%~OE%#%%~#?%f$###͑%4~0#4 #4!4~0#4 #4!%~%͑% 66=O~- O+ +~0 G+~ (0 WxGxA(DG~ݦc(G͚ DG͈!9ͩͩ! !!  444P!9w ! &~ݮ w~<ݖ w !9w#+! +8 +#ͻ+&8!&! w#!9~ʋË|goR˹T]!9w >ݮ w !9w !&( ! &ʋ~ݖ ( O8yʋ! Ë$0##0""L$q#s#r!(F!#6!*!!4 #4 #4!!+F&( 6##Nq+'6p U$ 6w+(ø%˞ø%###y 8o+++v ~ ###ͪ%Q%+++ˎ˞˦O 0 ###+"+++goO 0 | }! wToo many open output file!; wBad output file nam#}( ##|#(}#7#0!9G AN$+ $&!# r+{PY_>ø%%ø%%Yø%%͑%|#%%6#6͑%xø%%$^%͑%|&R?|&7R|&7R?|&Rb$ɯ7&o|z(z/W{/_|(|/g}/o# ((!= F&goRW_= DM(go(7ɯt <)^&w~w+ *_͝  >*_#"_+!9ͣ ͝  8!;!"c!"a!9ͣ *_͝ !0 u!9ͣ *_͝ !9 ʮÉ*_#"_+D*a  ! 9ͣ *_͝ "a~*c*a "_"a"c*+%"%"%" "5 "3 "1y 6"+6+!^6*F+N+3!!9~#] O"1'1 +}|+#~H;6#~#<}>ʏ!46#6*! *|zM!}"Úr!}"ڧ Can't open > or < file.$nw* ! 9R*"!ɀ *}^ switch (c) { case TAB : col = nexttab( col ); break; case NEWLINE: col = 1; break; default : col++; } } } nexttab( col ) int col; { int i; i = (col-1) % TABSIZE; if( i == 0 ) return col + TABSIZE; else return (TABSIZE-1) + col; } >2>2:&͆ xs :O@ ! DM :s Y  !y Write error - Disk full $`ip !9~=+^ V+^+F+N~og~#fos#r}o|g}o|g}o|g|!,|}! ,ɯ| !|}!- | } z& !" --{!-z( {( z( {( !||g}oL |g}oZ )g {ozg+|/g}/oDM!z>Ž S\))Җ =Ž ɯë zw |w MD!x<¿ z> jS\>)) # = w w N#F#x ~#~#  #~wɯ(#~+*^W#~!OG F+N ngOG F+N F+n`OG F+N+~=(ۯOG F+N+~ =(rW+sɯRɯR1 .D x.D {.נ S.N .OUMS .LAYtPERRR o.T .T o.T .:<* 2 D   C> _*~+#4N s> > !Jg:} 2_~À – ‘ > Þ Ÿ[ʧÞ !*}ʿZ> !Ng}  > _ !"# con:rdr:pun:lst: yy_~O7ç!V  Ÿ#Œi& ~ˆ!~ʾ#°~#F6,pw62?p !9ͣ y=^  ;* **!P"! 9ͣ ! u! 9ͣ ##ͣ e"*! [*w "*! o!r*"!" !9}# * * ʪ!9͝ ͫ!9͝  !9͝ ͫ!9͝ * " !" * #" +   {""" 3*!9ͣ +*͠ "* L!9ͣ *"\*+!9ͣ BB*c*a*_!"_!9ͣ *_͝  ¦!9ͣ *_͝  !9ͣ *_͝  *_#"_+w!"c!9ͣ *_͝  !9ͣ  "T > w+  w w##w w #~+:1 ~##V @~#.B V 1 *T ++V w#H 2a O!1 ~_#V!$r+sbk#|/* copyright (c) 1982 Peter Baker */ /* * Truncate lines at the specified column. Default = 80. */ #include #define NEWLINE '\n' #define TAB '\t' static int TABSIZE = 8; main(argc,argv) char **argv; int argc; { int len, i, col; char c; len=80; if(argc>1) { i=atoi(argv[1]); if( i < 0 ) i = -i; len = ( i<1 ? 1 : i ); } col = 1; while( (c = getchar()) != EOF ) { if( col <= len ) putchar(c); else if( c == NEWLINE ) putchar(c); >w<!s 6#6 ~+Js#r{{ k!Ng#^!!w#w!~<6!#~rʺG!ͣ }ʹ* xuʯ>w#¨%{=^ b2x ʧh&{ !?~!N#FwG+wO#6{ l+!9~ –!*~bʓ!5‘> Ö6> *  w`i#ͨ ᯾%,!|!!9n&:Zɯ2> !9ͣ !:w!xw#4"  /* copyright (c) 1982 Peter Baker */ /* Wrap files to the standard output with any of a number of handy options. This program grew all out of proportion with people continually asking for an extra feature. Please don't curse me for the poor code ... I was only trying to do them a favour. Do not try to add any more features without restructuring the whole thing or it is liable to explode!!! */ #include #define NEWLINE '\n' #define CR '\r' #define TAB '\t' filep = fopen( filename, "r" ); if( filep == 0 ) printf( "\nwrap cannot open: %s\n", filename ); else { wrap(); fclose( filep ); if( length > 0 ) putchar( FORMFEED ); putchar( NEWLINE ); } fnum++; } } wrap() { static int c; /* this is an int so it can hold an EOF */ static int spcs, i, lntemp; fillbuf(); /* this is needed here for some unknown reason */ linecnt = 0; colcnt = indent; pagecnt = 1; if( headings ) prhdg( pagecnt++ ); if( sskip '-w' */ break; case 'p': case 'P': length = atoi( argv[optnum] + 2 ); break; case 'h': case 'H': headings = true; length -= 3; /* to acct for hdg space */ break; case 't': case 'T': tabs = true; tabsize = atoi( argv[optnum] + 2 ); if( tabsize == 0 ) tabsize = 8; /* default */ break; case 'd': case 'D': date = true; headings = true; datecode = argv[optnum] + 2; break; case 'l': he tab if already done */ else putchar( c ); if( c == '\n' ) doindent(); if( headings && ( c == FORMFEED ) ) { prhdg( pagecnt++ ); doindent(); } else if( c == FORMFEED ) doindent(); if( length > 0 ) if( linecnt >= length ) { putchar( FORMFEED ); if( headings ) prhdg( pagecnt++ ); putchar( CR ); /* cursor at col 0 */ doindent(); linecnt = 0; colcnt = indent; } } } prhdg( pagenum ) int pagenum; { putcha#define BKSPC '\b' #define FORMFEED '\f' #define SPACE ' ' #ifndef true #define true 1 #define false 0 #endif /* * See 'wrap.doc' for info and options. */ int BIGBUF = 0x1000; /* 4K ... could be up to ~ 40K */ int width = 80; int length = 60; /* standard 8 1/2 by 11 inch paper */ int headings = false; int tabs = false; int tabsize; int slinenum = 0; /* start printing at line N */ int indent; int date = false; char *filename; FILE filep; char *datecode; int colcnt; inlinenum ) /* wait for the slinenum'th line before we print */ for( lntemp=0 ; lntemp < slinenum ; lntemp++ ) while( ( ( c = bgetc() ) != '\n' ) && ( c != EOF ) ) ; doindent(); while( ( c = bgetc() ) != EOF ) { switch( c ) { case NEWLINE: colcnt = indent; linecnt++; break; case CR: colcnt = indent; break; case TAB: spcs = tabsize - ( (colcnt-indent) % tabsize ); /* this starts tabs at the indent column not 0 */ if( spcs == 0 )  case 'L': slinenum = atoi( argv[optnum] + 2 ); break; case 'i': case 'I': indent = atoi( argv[optnum] + 2 ); break; case 'b': case 'B': BIGBUF = atoi( argv[optnum] + 2 ); break; default: usage(); } optnum++; /* process next option */ } #ifdef DEBUG printf( "argv[1] = %s\n", argv[1] ); printf( "\nwidth = %d\n", width ); printf( "argv[2] = %s\n", argv[2] ); printf( "length = %d\n", length ); #endif while( argc-- ) { filename = argv[fnum]; r( NEWLINE ); doindent(); printf( " File: %s", filename ); printf( " Page: %d", pagenum ); if( date ) printf( " Date: %s", datecode ); putchar( NEWLINE ); putchar( NEWLINE ); } usage() { /* The msg is broken up due to C/80 limiting line length to 100 chars. */ static char *msg = "[-h] [-ttabsize] [-dstring] fname [fname fname ...]"; printf( "\nUsage: wrap [-wpagewidth] [-ppagelength] %s\n", msg ); printf( "where:\t-wN sets the pagewidth to N\n" ); t linecnt; int pagecnt; main( argc, argv ) int argc; char *argv[]; { static int fnum = 1; /* arg # of the first filename if no opt */ static int optnum = 1; if( --argc < 1 ) usage(); /* this exits !! */ while( *argv[optnum] == '-' ) /* options ?? */ { if( --argc < 1 ) /* must be one arg left */ usage(); /* usage() exits! */ fnum++; /* since this arg is an option */ switch( *(argv[optnum] +1) ) { case 'w': case 'W': width = atoi( argv[optnum] + 2 ); /*  spcs = tabsize; colcnt += spcs; if( tabs ) for( i=0 ; i= width ) { putchar( NEWLINE ); doindent(); colcnt = indent; linecnt++; } if( tabs && ( c == TAB ) ) ; /* don't print t#  printf( "\t-pN sets the pagelength to N\n" ); printf( "\t-h turns on headings at the top of each page\n" ); printf( "\t-tN expands tabs to every Nth column\n" ); printf( "\t-dstring sets the date to string and turns on headings\n" ); printf( "\t-lN starts printing at the Nth line of the file\n" ); printf( "\t-iN indents each line N spaces\n" ); printf( "\t-bN sets the file buffer to N bytes\n" ); exit(1); } static unsigned numchars = BIGBUF; /* Number of chars in buffer. Set to BI9  "*!"*R8< !*D au*͵*!jY! ! *!#"!+!"*"!"* |ʟ*#"+ʹ*|!"s*s*y*s#"s+í͈"m6*m#66þh͈"m#6ʳ*mï*"*#"+*"*** * "o*oRH* "o**o"* |ʈ!"q*q*oyʈ}*q#"q+a! r*+"!"*"*#"+K    ä**n! h*"*#"+* |*mint i; for( i=0 ; i !" !9 * R !9 * R6ʱ * #" +!9 Rʫ !î !" !" !9 * !0n !9 * !9o6! * #" +÷ * GBUF to get bgetc() started. */ static int remchars = 0; /* # of available chars remaining in buffer */ static char *begbuf; /* pointer to beginning of buffer */ static char *curbyte; /* pointer to next available byte in buffer */ static char kickit = true; /* initialize flag */ bgetc() { if( remchars-- > 0 ) return( *curbyte++ ); else { if( numchars < BIGBUF ) { numchars = BIGBUF; /* reset for next file */ return( EOF ); } else { fillbuf(); return( bgetcR6 *m*mR%h* |7*mR6P*#"+ʹh`*mR`h*!jʰ**nʰ! * |ʙ*#"+ʹ! h!"*"! h< !*D < !!9 D *|< !*D ! ! < !"* D < !PD < !uD < !D < !D < !D < !' D < !Z D < !| D !*+"#!jʪ*#"+**ͥ*"!͈:|*;"#R < ! D < ! D/@P<!9 +!y?*#)!9  R!9 +!yv*!#"!+*#)!9  #Ô*#)!9  ## "*#)!9  ## "!" *+++"!" *#)!9  ## " * R!" !"!" *#)!9  ##"*#)!9  ## "*#)!9  ## "*#)!9  ## "KwWpPhHtTdD7l7LTiTIqbqBÎ*##"#+?!9 +#|l*!)! !9 * " * * .!9", *, ++",  *, !9ͤv *, ++", ͡ T *, ++", }20 :0 *, ++",  T *, ++", "1 *1 *, ++",  T !!9  !9}20 !9 ".  !9 "1 !!9  *. 6) *. 66B *. #". +C  :0 Ð !9à *1 #"1 +!9}*1 6à !9:0 à à KL [ v *. #". +Rʳ !"3 *. !0n *. !9o6 ù *3  *. #". +"() ); } } } fillbuf() { static unsigned int i; if( kickit ) { if( ( begbuf = sbrk( BIGBUF ) ) == -1 ) { printf( "\nError: cannot allocate buffer.\n" ); printf( "Try smaller buffer size.\n" ); exit(1); } kickit = false; } i = 1; curbyte = begbuf; /* read until either EOF or buffer is full */ while( ( *curbyte++ = getc( filep ) ) != EOF ) if( i == BIGBUF ) break; else i++; remchars = numchars = i; curbyte = begbuf; } doindent() {  !!}2!"*"*#"+*C}#6V**>KVS*#"+*""*"*f!"f*f*yʙÎ*f#"f+r! Ã"fr wrap cannot open: %s File: %s Page: %d Date: %s[-h] [-ttabsize] [-dstring] fname [fname fname ...] Usage: wrap [-wpagewidth] [-ppagelength] %s where: -wN sets the pagewidth to N -pN sets the pagelength to N -h turns on headings at the top of each page -tN expands tabs to every Nth column -dstring sets the$  3 ! }25 ! ": "6 !"8 *. #". + !": !9 : !0}25 !"6 !9 : !0}25 !"6 !9 : !9 C !9 |ʳ !9 #+C *3 +"3 Å !  K) d/ u> oZ xv c s !9 ! y!9 0!9 AC *3 +"3 !n7:5 C @*8!9 "8*3 +"3 #*: R~*8.|g|~*3 +"3 #*8"8!"8 *8*6 ͥʗ*8!͖6ʻ*8 |ʰ!-C *8 )*6 R*8!*6 R*8! *8!:*6!*txu>w#%;{=bʚx CCh&{ 5!~!}N#FwG+wO#͞{ *+!9~ !~b!5> 6> *t w`i#᯾,%,!;|!!9n&:ɯ2E>o27!9 !f:Ew!Xxwf#4>2E>2D:pĎx:DO¨! DM}:D !Write error - Disk full $`iF!9~=+V+^+Fent each line (including headings) N spaces. -bN Will set the file buffer size to N bytes. BUGS: - Sometimes an extra formfeed is inserted at the end of the run? - Tabs can make the line extend past the left margin - A carriage return not expected to do a line feed - Headings must all fit on a line - It should be made recusive so all characters that expand (ie tabs) are correctly handled Patch Locations for WRAP switches R*8! $*6 +*8, "8*+%"P%"N%"L " " "y 6"n+6+!^6*F+N+ix3!1!9~# ʀO"ʙ'ʙ +}|+#~ʰ£6#~#<>!/4À6#6*/!1%*9|͵!"r!7"9À Can't open > or < file.$w*] Y! 9RY*]"]!*}C*:m<*n 2m ͬq 4 «> _*n~+#4N s> 4> !:pq2m_~   >   WRAP ---- Printing Utility This utility will print any number of files with newlines put in at the appropriate column. The default column is 80. Form feeds are also optional by specifying a pagelength. The default is no form feeds. OPTIONS: -wN Sets the page width to N characters wide. Default = 80 -pN Sets the page length to N lines long. Default = 60 If N = 0 then n+N~og~#fos#r}o|g}o|g}o|g|!,|}!PP,ɯ|<!|}!-y|y}9zʎ!--{!-z{9z{!||g}oô|g}o){ozg+|/g}/oDM!z>S\)) =ɯz|MD!x<'z>,jS\>))4# < =,N#F#xd~#~#MM "> w+ nw w##w w #~+:™~##;@~#.ʪ;Ù*++;w#ða O! ~_#V!$;r+sbk#| "> w+ nw w##w Version 1.4 Sept/21/82 Parameter Wrap Patch Default Value Argument Location Decimal Hex Bytes Buffer Size -b4096 0103 4096 00 10 Page Width -w80 0105 80 50 00 Page Length -p60 0107 60 3C 00 Heading flag (Default: off) -h 0109 0 00 00 Tabs flag (Default: off) -t 010B 0 00 00 Tab Size -t8 011D 8 08 00 Start line number -l0 011F 0 00 00 Indent column -i0 0121 0 00 00 !*9}'> !} D > _ !"# con:rdr:pun:lst: _~O7!  #i& ~!w~&#0~#F6,pw62i!9 y=0e>wz<0!vs 6#6 ~+²;s#r{0{ !#^!!Xw#w!v~<065!~r"G!} }o formfeeds are inserted. -h Print the filename and page number at the top of each page. -tN Expand tab characters to every N'th column. -dstring Will print string in the date field of each heading. The heading option is automatically specified with the -d option. NOTE: String must not contain blanks. It is reasonable to enter the date as SEPT/3/82---2:00pm -lN Start printing at line N. -iN Will ind%   The values of these parameters can be altered by patching the WRAP object file. Use DDT to modify the desired options, exit with ^C, then type: SAVE 22 WRAP.COM to save the modified object file. &  '