home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1440 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  54.4 KB

  1. From: istvan@hhb.UUCP (Istvan Mohos)
  2. Newsgroups: alt.sources
  3. Subject: Subject: ILIB Unix Toolkit in C
  4. Message-ID: <553@hhb.UUCP>
  5. Date: 8 Jun 90 20:57:45 GMT
  6.  
  7.  
  8. ---- Cut Here and unpack ----
  9. #!/bin/sh
  10. # This is part 07 of a multipart archive
  11. if touch 2>&1 | fgrep '[-amc]' > /dev/null
  12.  then TOUCH=touch
  13.  else TOUCH=true
  14. fi
  15. # ============= iman/ifamily.tex ==============
  16. echo "x - extracting iman/ifamily.tex (Text)"
  17. sed 's/^X//' << 'SHAR_EOF' > iman/ifamily.tex &&
  18. X% XREF ifamily igroup inumstrcmp
  19. X
  20. X\def\name{IFAMILY}
  21. X\def\IT{{\bb ifamily()}}
  22. X
  23. X\S{NAME}
  24. X{\bb ifamily} --- tell whether two alhanumeric strings are related
  25. X
  26. X{\bb igroup} --- compute places for separators in string lists
  27. X
  28. X{\bb inumstrcmp} --- alphanumeric comparison of two strings
  29. X
  30. X\S{SYNOPSIS}
  31. X\settabs\+{\bb mdefine SHORTUPMO} & mmm &\cr
  32. X\+{\bb\#define SPACE\_LINE}&\hfill {\bb--1}\cr
  33. X\+{\bb\#define LINE\_ONLY}&\hfill {\bb 0}\cr
  34. X\+{\bb\#define LINE\_SPACE}&\hfill {\bb 1}\cr
  35. X\L
  36. X{\obeylines \bb
  37. Xint
  38. Xifamily (ptr1, ptr2)
  39. Xchar *ptr1;
  40. Xchar *ptr2;
  41. X\L
  42. Xint
  43. Xigroup (ptr1, ptr2, modval)
  44. Xchar *ptr1;
  45. Xchar *ptr2;
  46. Xint modval;
  47. X\L
  48. Xint
  49. Xinumstrcmp (ptr1, ptr2)
  50. Xchar *ptr1;
  51. Xchar *ptr2;
  52. X}
  53. X
  54. X\S{DESCRIPTION}
  55. XAlphanumeric ordering of strings is an important capability in 
  56. Xthe fields of electronic design and logic simulation. 
  57. XPoints of interface to integrated circuits (IC legs or {\myit pins\/}) 
  58. Xtypically are labeled with a name that begins with a leading 
  59. Xalphabetic string, continues with a string of digits, and sometimes 
  60. Xends with another alphabetic string.
  61. XIndividual {\myit pin\/} names
  62. Xwithin groups of functionally related names are made distinct
  63. Xby the integer value embedded in otherwise identical labels.
  64. XGroups of related {\myit pins\/} form a {\myit bus\/}. 
  65. XMotorola's ``68000'' integrated circuits for example, interface
  66. Xwith their electronic environment through an {\myit address bus\/} 
  67. Xof 23 pins labeled {\myit A1\/} through {\myit A23\/}, a 
  68. X{\myit data bus\/} 
  69. Xof 16 pins labeled {\myit D0\/} through {\myit D15\/}, a set of
  70. X{\myit interrupt lines\/} named 
  71. X{\myit IPL0N\/} through {\myit IPL2N\/}, among other {\myit buses\/} 
  72. Xand functionally discreet terminals.
  73. X\L 
  74. XThe generic Unix toolset
  75. Xtends to overlook the somewhat specialized problem of alphanumeric
  76. Xordering.  The shell's own 
  77. Xfilename order leaves things to be desired if the names 
  78. Xcontain multi-byte embedded digit strings: {\myit foo11\/} will
  79. Xfollow {\myit foo1\/}, and {\myit foo2\/} will only appear when
  80. Xall the embedded ``tens'' have been listed.  The ILIB 
  81. Xfunctions \IT, {\bb igroup()} and {\bb inumstrcmp} round out the
  82. Xstring ordering capabilities of the standard functions.
  83. XThis supplemental set also includes {\bb inumsort()}
  84. Xand {\bb inumsearch()} described under {\myit isort()\/} and
  85. X{\myit isearch()\/}, respectively.
  86. X\L
  87. X\IT\ returns TRUE or FALSE to indicate whether
  88. Xthe two null terminated parameter stings
  89. Xare ``related''.  \IT\ considers
  90. Xtwo strings related if either they are identical, or if
  91. Xthe first numerical digit (0-9) in both strings is preceded by
  92. Xidentical leading sub-strings.  For example,
  93. X\smallskip
  94. X\settabs\+ ABCDEFGHIJKLMN & andand & ABCDEFGHIJ &\cr
  95. X
  96. X\+\qquad \dx{abc} & and & \dx{abcd} & are not related,\cr
  97. X\smallskip
  98. X\+\qquad \dx{-+ =123oooo} & and & \dx{-+ =7xxxxx} & are related,\cr
  99. X\smallskip
  100. X\+\qquad \dx{testing123} & and & \dx{testing} & are not related,\cr
  101. X\smallskip
  102. X\+\qquad \dx{7 brides for} & and & \dx{7 brothers} & are related.\cr
  103. X\L
  104. XDuring the evaluation process, \IT\ compares
  105. Xeach successive non-digit character beginning
  106. Xat {\myit ptr1\/} to the same-position
  107. Xcharacter beginning at {\myit ptr2\/}.
  108. XIf the (non-digit) characters don't match, the
  109. Xtwo strings are not related, and the function returns FALSE.
  110. XIf the pointers reach a digit (0-9) simultaneously,
  111. Xthe strings are related, and the function returns TRUE.
  112. XIf same-length, non-digit strings end without a mismatch,
  113. Xthe relation is TRUE.
  114. X\L
  115. X\IT\ considers address~0 ({\myit (char~*)NULL\/}) passed for
  116. Xeither {\myit ptr1\/} or {\myit ptr2\/} an error; and will
  117. Xretaliate by calling
  118. X{\myit ierror()\/} and returning the negative {\myit sys\_nerr\/}.
  119. X\L
  120. X{\bb inumstrcmp} performs a more detailed evaluation of the
  121. Xtwo strings than \IT\ does, returning ``1'' if the
  122. Xstring pointed to by {\myit ptr1\/}
  123. Xis ``alphanumerically'' greater than the string at {\myit ptr2\/};
  124. Xreturning ``-1'' if the second string is greater than the first;
  125. Xand returning ``0'' if the strings are equivalent.
  126. X\L
  127. XThe comparison proceeds byte-by-byte, form left to right.  If
  128. Xthe next examined byte of both strings is a {\myit digit\/},
  129. Xthe {\myit atoi()\/} function is utilized for converting
  130. Xthe encountered digit strings to numbers.
  131. XThe actual digit sub-strings are skipped, and the numerical
  132. Xvalues returned by {\myit atoi()\/} are compared instead.  If these
  133. Xnumbers are identical, the process continues at the
  134. Xnext non-digit bytes.  A not obvious outcome of this process
  135. Xis a blindness toward leading zero digits:
  136. X``agent 007'' is totally indistinguishable for example, from
  137. X``agent 7''.
  138. X\L
  139. XIdentically to \IT, {\bb inumstrcmp()} considers the NULL pointer
  140. Xpassed as {\myit ptr1\/} or {\myit ptr2\/} an error.
  141. X\L
  142. XThe {\bb igroup()} function is a {\myit formatting aid\/}, not
  143. Xparalleling the functionality of any standard library routine.
  144. X{\bb igroup()} computes punctuation for elements of an ordered
  145. Xlist of strings.
  146. XThe list is assumed to contain an arbitrary number of
  147. X{\myit families\/} of alphanumerically related items, as well as
  148. Xdiscreet strings not related to other strings in the list.
  149. X{\myit Family members\/} are assumed to hold adjacent positions in
  150. Xthe list.  The question
  151. X{\bb igroup()} attempts to answer is how to break up the list into
  152. Xsmaller parts for visual display, while retaining the sense of
  153. Xrelations within families, and separating unrelated list items from
  154. Xfamily groups.
  155. XThe printing routine that makes use of the results from
  156. X{\bb igroup()} is assumed to insert extra {\myit white space\/}
  157. Xbetween the computed list segments.
  158. X\L
  159. XThe simplest rule of
  160. X{\bb igroup()} prescribes the separation of
  161. Xsuccessive {\myit unrelated\/} strings of the list at
  162. X{\myit modval\/} intervals, and also, separating
  163. Xsuccessive {\myit related\/} strings at {\myit modval\/} intervals.
  164. XAnother rule forces the immediate completion of a segment and the
  165. Xstarting of a new segment if either the last item (already part of
  166. Xthe current
  167. Xsegment) or the next item evaluated, belongs in a {\myit family\/}
  168. Xbut the other doesn't.
  169. XA third rule causes completion of a segment and the starting of a
  170. Xnew segment if the last item already part of the current segment
  171. Xbelongs to a different {\myit family\/} then the next string of the
  172. Xlist.
  173. X\L
  174. XThe mechanics of {\bb igroup()} require a succession of calls to
  175. X{\bb igroup()} with {\myit ptr1\/} set to the next item of the list,
  176. Xand {\myit ptr2\/} set to the next item after the one dereferenced by
  177. X{\myit ptr1\/}.  In effect,
  178. X{\myit ptr2\/} provides ``look-ahead'' capability in the list,
  179. Xallowing a determination of whether or not the new string at
  180. X{\myit ptr1\/} will prove to be a member of a family just ahead.
  181. XAt the end of the call sequence to
  182. X{\bb igroup()}, a zero length string or
  183. Xa {\myit (char~*)NULL\/} should be passed for
  184. X{\myit ptr2\/}, as a {\myit sentinel\/} value informing
  185. X{\bb igroup()} that the list has ended.  Since the call sequence
  186. Xalmost invariably is coded as a {\myit loop\/}, it is easiest 
  187. Xto just allocate an extra last pointer in the list of pointers
  188. Xdereferencing the strings of the to-be-formatted list, and set this
  189. Xlast pointer to NULL.  The iteration count of the loop can then be
  190. Xone less than the total number of pointers in the list.
  191. X\L
  192. XSimilarly to acquiring look-ahead information,
  193. X{\bb igroup()} retains the memory of the characteristics of the
  194. Xtoken evaluated during the previous call, to ascertain whether or
  195. Xnot the current item is related to the previous one.
  196. XThis internal memory makes
  197. X{\bb igroup()} a {\myit dynamic\/} function.  At the first call,
  198. Xthe {\bb igroup()} state machine automatically comes to life
  199. Xin its initial, ``start'' state.  At the last call
  200. X(when {\myit (char~*)NULL\/} or a zero length string
  201. Xis passed for {\myit ptr2\/}), the
  202. Xstate machine is cleared in preparation for a restart with
  203. Xanother list.  To abort the current list,
  204. X{\myit (char~*)NULL\/} or \key{""} may be passed for
  205. X{\myit ptr1\/} instead;
  206. Xthis also clears the state machine but skips the computation of
  207. Xspacing.
  208. X\L
  209. X{\bb igroup()} returns
  210. XSPACE\_LINE, LINE\_ONLY or LINE\_SPACE.  The
  211. Xthree integer alternatives are defined
  212. Xin {\myit ilib.h\/}.
  213. XSPACE\_LINE indicates that the existing cluster of strings
  214. Xshould be completed and output, followed by extra {\myit white space\/},
  215. Xand that the string dereferenced by {\myit ptr1\/} should begin
  216. Xa new cluster.  LINE\_ONLY recommends that the string of
  217. X{\myit ptr1\/} should be added to the segment currently under
  218. Xconstruction, with no extra
  219. X{\myit white space\/} either before or after the string.
  220. XLINE\_SPACE suggests that the string at
  221. X{\myit ptr1\/} should be added to the current cluster, and then
  222. Xseparated from future strings by extra
  223. X{\myit white space\/}.
  224. XDuring the succession of calls, redundant spacing will be never be
  225. Xproduced: SPACE\_LINE will never follow LINE\_SPACE.
  226. X
  227. X\S{group PROGRAM EXAMPLE}
  228. XAlphanumeric labeling (for example of stars, stadium seats, or
  229. Xelectronic component terminals)
  230. Xrequires word ordering
  231. Xwith alphabetic substrings sorted
  232. Xin alphabetical order, and numerical substrings in numerical
  233. X(decimal) order.
  234. XThe {\bb group} program reads a single file
  235. X(or \stin\ if no file name is given),
  236. Xand writes the alphanumerically sorted lines of the input, to
  237. X\stout.  In addition to sorting the lines to alphanumeric order,
  238. Xthe program also organizes lines into related groups according to
  239. Xthe rules of {\bb igroup()} given above; printing an extra
  240. X{\myit linefeed\/} to partition the output.
  241. X\L
  242. XA mandatory number following the command name on the command line
  243. Xspecifies the maximum number of lines that may comprise a group;
  244. Xif this number is ``1'' the sorted lines are output without
  245. Xseparation.  The input list is sorted into reverse order
  246. Xif the number following the command name is prepended with a dash
  247. X(minus).
  248. XThe maximum size of the input is a function of the
  249. Xavailable dynamic memory:
  250. Xthe entire input is read into core before the sorting commences.
  251. XIn addition to buffer space, a lesser
  252. Xamount of memory is allocated for the list of pointers dereferencing
  253. Xthe individual lines.
  254. X
  255. X\S{OUTPUT EXAMPLE}
  256. XThe command
  257. X\smallskip
  258. X\I{\mytt
  259. Xgroup 5 area.lis | pr -5 -l33 -t}
  260. X\smallskip
  261. Xtakes an unsorted list of {\myit area codes\/} in {\myit area.lis\/},
  262. Xalphanumerically sorts the lines of the list and inserts blank lines
  263. Xat least as often as every five lines (according to the {\bb igroup}
  264. Xrules), then formats the list into five columns with the Unix
  265. X{\myit pr\/}:
  266. X\L
  267. X{\obeylines \mytt
  268. XAK\ \ \ 907\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ MICH\ 313\ \ \ \ \ \ NY\ \ \ 212\ \ \ \ \ \ TEX\ \ 214
  269. XALA\ \ 205\ \ \ \ \ \ IA\ \ \ 319\ \ \ \ \ \ MICH\ 517\ \ \ \ \ \ NY\ \ \ 315\ \ \ \ \ \ TEX\ \ 409
  270. XARK\ \ 501\ \ \ \ \ \ IA\ \ \ 515\ \ \ \ \ \ MICH\ 616\ \ \ \ \ \ NY\ \ \ 516\ \ \ \ \ \ TEX\ \ 512
  271. XAZ\ \ \ 602\ \ \ \ \ \ IA\ \ \ 712\ \ \ \ \ \ MICH\ 906\ \ \ \ \ \ NY\ \ \ 518\ \ \ \ \ \ TEX\ \ 713
  272. X\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ NY\ \ \ 607\ \ \ \ \ \ TEX\ \ 806
  273. XCA\ \ \ 209\ \ \ \ \ \ IDA\ \ 208\ \ \ \ \ \ MINN\ 218
  274. XCA\ \ \ 213\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ MINN\ 507\ \ \ \ \ \ NY\ \ \ 716\ \ \ \ \ \ TEX\ \ 817
  275. XCA\ \ \ 408\ \ \ \ \ \ ILL\ \ 217\ \ \ \ \ \ MINN\ 612\ \ \ \ \ \ NY\ \ \ 718\ \ \ \ \ \ TEX\ \ 915
  276. XCA\ \ \ 415\ \ \ \ \ \ ILL\ \ 309\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ NY\ \ \ 914
  277. XCA\ \ \ 619\ \ \ \ \ \ ILL\ \ 312\ \ \ \ \ \ MISS\ 601\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ UT\ \ \ 801
  278. X\ \ \ \ \ \ \ \ \ \ \ \ \ \ ILL\ \ 618\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ OH\ \ \ 216
  279. XCA\ \ \ 707\ \ \ \ \ \ ILL\ \ 815\ \ \ \ \ \ MO\ \ \ 314\ \ \ \ \ \ OH\ \ \ 419\ \ \ \ \ \ VA\ \ \ 703
  280. XCA\ \ \ 714\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ MO\ \ \ 417\ \ \ \ \ \ OH\ \ \ 513\ \ \ \ \ \ VA\ \ \ 804
  281. XCA\ \ \ 805\ \ \ \ \ \ IND\ \ 219\ \ \ \ \ \ MO\ \ \ 816\ \ \ \ \ \ OH\ \ \ 614
  282. XCA\ \ \ 818\ \ \ \ \ \ IND\ \ 317\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ VT\ \ \ 802
  283. XCA\ \ \ 916\ \ \ \ \ \ IND\ \ 812\ \ \ \ \ \ MONT\ 406\ \ \ \ \ \ OKLA\ 405
  284. X\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ OKLA\ 918\ \ \ \ \ \ WASH\ 206
  285. XCOLO\ 303\ \ \ \ \ \ KANS\ 316\ \ \ \ \ \ NC\ \ \ 704\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ WASH\ 509
  286. XCOLO\ 719\ \ \ \ \ \ KANS\ 913\ \ \ \ \ \ NC\ \ \ 919\ \ \ \ \ \ OREG\ 503
  287. X\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ WIS\ \ 414
  288. XCONN\ 203\ \ \ \ \ \ KY\ \ \ 502\ \ \ \ \ \ NDAK\ 701\ \ \ \ \ \ PA\ \ \ 215\ \ \ \ \ \ WIS\ \ 608
  289. XDC\ \ \ 202\ \ \ \ \ \ KY\ \ \ 606\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ PA\ \ \ 412\ \ \ \ \ \ WIS\ \ 715
  290. XDEL\ \ 302\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ NEB\ \ 308\ \ \ \ \ \ PA\ \ \ 717
  291. X\ \ \ \ \ \ \ \ \ \ \ \ \ \ LA\ \ \ 318\ \ \ \ \ \ NEB\ \ 402\ \ \ \ \ \ PA\ \ \ 814\ \ \ \ \ \ WVA\ \ 304
  292. XFLA\ \ 305\ \ \ \ \ \ LA\ \ \ 504\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ WYO\ \ 307
  293. XFLA\ \ 407\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ NEV\ \ 702\ \ \ \ \ \ PUER\ 809
  294. XFLA\ \ 813\ \ \ \ \ \ MASS\ 413\ \ \ \ \ \ NH\ \ \ 603\ \ \ \ \ \ RI\ \ \ 401
  295. XFLA\ \ 904\ \ \ \ \ \ MASS\ 508\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ SC\ \ \ 803
  296. X\ \ \ \ \ \ \ \ \ \ \ \ \ \ MASS\ 617\ \ \ \ \ \ NJ\ \ \ 201\ \ \ \ \ \ SDAK\ 605
  297. XGA\ \ \ 404\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ NJ\ \ \ 609
  298. XGA\ \ \ 912\ \ \ \ \ \ MD\ \ \ 301\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ TENN\ 615
  299. X\ \ \ \ \ \ \ \ \ \ \ \ \ \ ME\ \ \ 207\ \ \ \ \ \ NMEX\ 505\ \ \ \ \ \ TENN\ 901
  300. XHAW\ \ 808
  301. X\smallskip}
  302. X
  303. X\S{group.c PROGRAM TEXT}
  304. X\listing{../iex/group.c}
  305. X\eject
  306. SHAR_EOF
  307. $TOUCH -am 0607105490 iman/ifamily.tex &&
  308. chmod 0644 iman/ifamily.tex ||
  309. echo "restore of iman/ifamily.tex failed"
  310. set `wc -c iman/ifamily.tex`;Wc_c=$1
  311. if test "$Wc_c" != "13518"; then
  312.     echo original size 13518, current size $Wc_c
  313. fi
  314. # ============= iman/ifilter.tex ==============
  315. echo "x - extracting iman/ifilter.tex (Text)"
  316. sed 's/^X//' << 'SHAR_EOF' > iman/ifilter.tex &&
  317. X% XREF ifilter
  318. X
  319. X\def\name{IFILTER}
  320. X\def\IT{{\bb ifilter()}}
  321. X
  322. X\S{NAME}
  323. X{\bb ifilter} --- read file or \stin\ into buffer at mallocp,
  324. Xreturn buffer size
  325. X
  326. X\S{SYNOPSIS}
  327. X{\obeylines \bb
  328. Xint
  329. Xifilter (fname, mallocp)
  330. Xchar *fname;
  331. Xchar **mallocp;
  332. X}
  333. X
  334. X\S{DESCRIPTION}
  335. XAn alternate to the {\myit iread()\/} function, \IT\ is used to read
  336. Xan entire file, or a complete sequence of inputs from \stin\ until
  337. X{\myit EOF\/}, into internal space.  The accent here is on the
  338. Xcompleteness of the input set: the entire file or the entire
  339. Xset of lines constituting the \stio\ input stream is
  340. Xnecessary for example, to sort input into order.
  341. X\L
  342. XStandard Unix
  343. Xtools find it convenient to check for the presence or absence of
  344. Xa single input file on the command line.  If the file is there, it
  345. Xwill supply the input data; if it is missing, the tool closes
  346. X\stin\ and reopens it as if it was the input file.
  347. X\IT\ similarly allows reading data from \stin\ if the passed
  348. Xfile name {\myit fname\/} is a NULL pointer (pointing to address~0).
  349. X\L
  350. XIf  {\myit fname\/} is non-NULL, \IT\ itself calls {\myit iread()\/}
  351. Xwith its own parameters.  {\myit iread()\/} tests for file access,
  352. X{\myit malloc\/}s a buffer, reads
  353. Xthe file into the buffer, closes the file, and returns the
  354. Xfile size.  An unreported ASCII NUL byte immediately following the
  355. Xlast byte of the buffer, is guaranteed.  The buffer address is
  356. Xreturned in {\myit mallocp\/}.  Errors encountered by {\myit iread()\/}
  357. Xtrigger error reporting via {\myit ierror()\/} in the normal
  358. Xmanner, and error values are
  359. Xpassed back to the routine that called \IT.
  360. X\L
  361. XIf  {\myit fname\/} is NULL, \IT\ calls {\myit freopen()\/}
  362. Xto convert \stin\ into the missing file.  Starting with
  363. Xa dynamically allocated buffer of {\myit BUFSIZ\/} capacity, \IT\
  364. Xthen repeatedly calls {\myit fread()\/} to fill the buffer, while
  365. Xalso increasing the buffer size by
  366. X{\myit BUFSIZ\/} after each {\myit fread()\/}.  If the
  367. X{\myit malloc()\/} or
  368. X{\myit realloc()\/} system calls fail, \IT\ reports the failure
  369. Xvia the {\myit ierror()\/} mechanism.  On {\myit EOF\/}, \IT\
  370. Xadds an extra NUL byte to the end of the collected image, and returns
  371. Xthe image size (and the address of the allocated buffer
  372. Xin {\myit mallocp\/}) identically to {\myit iread()\/}.
  373. X
  374. X\S{SEE ALSO}
  375. X{\myit iread, iwrite, ierror\/}.
  376. X
  377. X\S{EXAMPLE PROGRAM}
  378. XThe {\bb group} program (under the {\myit ifamily()\/} entry),
  379. Xthe {\bb rot} program links (under {\myit irotate()\/}),
  380. X{\bb nest}, and other ILIB example programs of {\myit filter\/}
  381. Xstructure, use
  382. X\IT\ for procuring the full input text prior to commencing
  383. Xtransformations.
  384. X\eject
  385. SHAR_EOF
  386. $TOUCH -am 0509104090 iman/ifilter.tex &&
  387. chmod 0644 iman/ifilter.tex ||
  388. echo "restore of iman/ifilter.tex failed"
  389. set `wc -c iman/ifilter.tex`;Wc_c=$1
  390. if test "$Wc_c" != "2601"; then
  391.     echo original size 2601, current size $Wc_c
  392. fi
  393. # ============= iman/ifonetic.tex ==============
  394. echo "x - extracting iman/ifonetic.tex (Text)"
  395. sed 's/^X//' << 'SHAR_EOF' > iman/ifonetic.tex &&
  396. X% XREF ifonetic
  397. X
  398. X\def\name{IFONETIC}
  399. X\def\IT{{\bb ifonetic()}}
  400. X
  401. X\S{NAME}
  402. X{\bb ifonetic} --- convert phonetic control strings to ASCII bytes
  403. X
  404. X\S{SYNOPSIS}
  405. X{\obeylines \bb
  406. Xint
  407. Xifonetic (start)
  408. Xchar *start;
  409. X}
  410. X
  411. X\S{DESCRIPTION}
  412. XIn order to bypass the {\myit wild card expansion} of a shell,
  413. Xprograms linking with ILIB can allow the user to substitute
  414. Xstraightforward, alphanumeric, ``phonetic control strings'' for
  415. Xnon-alphanumeric characters in command line parameters.
  416. XEach of these control strings is a three-character token prepended
  417. Xby a capital X.  The leading
  418. XX serves as a trigger, forcing \IT\ to recognize and parse
  419. Xthe following three bytes as a ``control token''.
  420. X\L
  421. X\IT\ receives from the caller a
  422. Xnull terminated string beginning at {\myit start\/}.  \IT\ reads the
  423. Xbuffer from
  424. Xleft to right, and collapses each encountered phonetic control token
  425. X(including the trigger byte X) to the real ASCII byte value
  426. Xrepresented by the control token.  If the buffer did in fact contain
  427. Xcontrol tokens, the buffer contents are modified in-place, the
  428. Xstring within gets shorter and is terminated with a NUL byte.
  429. XIf the buffer did not contain control tokens, it is left intact.
  430. X\IT\ returns the byte length of the processed string, not including
  431. Xthe terminal NUL byte.
  432. X\L
  433. XDetails of the phonetic control token system are given in the
  434. Xfollowing paragraphs.  Capital~X was
  435. Xselected as the trigger character because
  436. Xit is the least frequently occurring character in
  437. Xnatural English (and in Unix).
  438. XA ``real'' X character
  439. Xoccurring in the byte stream of command line arguments
  440. Xshould be given as its own phonetic control token \dx{Xexx}, unless
  441. Xit is less than four bytes from the end of the argument.  (In this
  442. Xcase, \IT\ will recognize that there are not enough bytes left for
  443. Xa control token, and will not attempt a conversion.)  The three bytes
  444. Xfollowing any other X in the string are contrasted against a list of
  445. Xvalid control syllables; if there is
  446. Xno match \IT\ uses the literal value of the substring.
  447. X
  448. X\S{CONCERNS OF WILD CARD EXPANSION}
  449. XThe proliferation of wild cards in the various Unix shells can be a
  450. Xmixed blessing.  On one hand, the command line expansion performed by
  451. Xthe shell is perhaps
  452. X{\bb the} key mechanism of {\myit shell programming\/}.  On the other
  453. Xhand, the need to occasionally
  454. Xescape the the shell's expansion mechanism tends to sidetrack the
  455. Xuser's attention from his/her work and re-focus it on shell syntax,
  456. Xbreaking the user's concentration, and sometimes degenerating
  457. Xinto a frustrating ``battle of wits'' against the uncooperative shell.
  458. XA slight lack of orthogonality between the expansion mechanism of
  459. Xdifferent shells, the irregularity and arbitrariness of the ASCII list,
  460. Xa lack of concensus among standard Unix tools as to how (or whether)
  461. Xto handle ``special characters'', all contribute to a list of
  462. Xannoyances.
  463. X\L
  464. XApparently, the only character
  465. Xset universally recognized, unexpanded, and
  466. X``holy'' to all shells and software tools is the {\myit alphanumeric\/}
  467. Xcharacter set, containing twentysix uppercase letters A\mydots Z,
  468. Xtwentysix lowercase letters a\mydots z, and the ten numerals
  469. X0 through 9.  (Contrary to Unix and C, major tools such as
  470. X\TeX\ fail to recognize the underscore as alphanumeric.)
  471. XILIB's phonetic control system provides an alphanumeric
  472. Xname for all non-alphanumeric values of the ASCII character set.
  473. XTo allow control names to be differentiated from normal
  474. Xalphanumeric strings, one letter had to be ``sacrificed'', becoming a
  475. Xwild card unbeknownst to all shells.  The capital letter X is so
  476. Xunder-utilized in everyday usage, that raising it to special status
  477. Xappeared to pose no inconvenience to eventual users.  The system
  478. Xuses X to signal the reader that the next three bytes of the text
  479. Xform a control name.
  480. X
  481. X\S{PHONETIC CONTROL TOKEN SYSTEM}
  482. X{\obeylines \mytt
  483. Xnul\ \ \ \ \ \ \ \ \ \ \ \cir @\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ban\ exc\ \ !\ \ BANg,\ EXClamation
  484. Xsoh\ cca\ \ \ \ \ \ \ \cir A\ \ Start\ Of\ Header\ \ \ \ \ \ \ \ \ \ \ \ quo\ \ \ \ \ \ "\ \ QUOte
  485. Xstx\ ccb\ \ \ \ \ \ \ \cir B\ \ Start\ of\ TeXt\ \ \ \ \ \ \ \ \ \ sha\ pou\ has\ \ \#\ \ SHArp,\ POUnd,\ HASh
  486. Xetx\ ccc\ \ \ \ \ \ \ \cir C\ \ End\ of\ TeXt\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ dol\ \ \ \ \ \ \$\ \ DOLlar
  487. Xeot\ ccd\ \ \ \ \ \ \ \cir D\ \ End\ Of\ Transmission\ \ \ \ \ \ \ \ per\ \ \ \ \ \ \%\ \ PERcent
  488. Xenq\ cce\ \ \ \ \ \ \ \cir E\ \ ENQuiry\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ amp\ \ \ \ \ \ \&\ \ AMPersand
  489. Xack\ ccf\ \ \ \ \ \ \ \cir F\ \ ACKnowledge\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ tic\ apo\ \ '\ \ TICk,\ APOstrophe
  490. Xbel\ ccg\ \ \ \ \ \ \ \cir G\ \ BELl\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ lpa\ \ \ \ \ \ (\ \ Left\ PArenthesis
  491. Xbsp\ cch\ \ (BS)\ \cir H\ \ BackSPace\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rpa\ \ \ \ \ \ )\ \ Right\ PArenthesis
  492. Xtab\ cci\ \ (HT)\ \cir I\ \ horizontal\ TAB\ \ \ \ \ \ \ \ \ \ \ \ \ sta\ ast\ \ *\ \ STAr,\ ASTerisk
  493. Xnew\ ccj\ \ (LF)\ \cir J\ \ NEWline\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ plu\ \ \ \ \ \ +\ \ PLUs
  494. Xver\ cck\ \ (VT)\ \cir K\ \ VERtical\ tab\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ com\ \ \ \ \ \ ,\ \ COMma
  495. Xpag\ ccl\ \ (FF)\ \cir L\ \ PAGe\ break\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min\ das\ \ -\ \ MINus,\ DASh
  496. Xret\ ccm\ \ (CR)\ \cir M\ \ RETurn\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ dot\ poi\ \ .\ \ DOT,\ POInt
  497. Xsou\ ccn\ \ (SO)\ \cir N\ \ Shift\ OUt\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sla\ \ \ \ \ \ /\ \ SLAsh
  498. Xsin\ cco\ \ (SI)\ \cir O\ \ Shift\ IN\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ col\ \ \ \ \ \ :\ \ COLon
  499. Xdle\ ccp\ \ \ \ \ \ \ \cir P\ \ Data\ Link\ Escape\ \ \ \ \ \ \ \ \ \ \ sem\ \ \ \ \ \ ;\ \ SEMicolon
  500. Xdc1\ ccq\ \ \ \ \ \ \ \cir Q\ \ Device\ Control\ 1\ \ \ \ \ \ \ \ \ \ \ les\ lan\ \ <\ \ LESs\ than,\ Left\ ANgle
  501. Xdc2\ ccr\ \ \ \ \ \ \ \cir R\ \ Device\ Control\ 2\ \ \ \ \ \ \ \ \ \ \ equ\ \ \ \ \ \ =\ \ EQUal
  502. Xdc3\ ccs\ \ \ \ \ \ \ \cir S\ \ Device\ Control\ 3\ \ \ \ \ \ \ \ \ \ \ gre\ ran\ \ >\ \ GREater,\ Right\ Angle
  503. Xdc4\ cct\ \ \ \ \ \ \ \cir T\ \ Device\ Control\ 4\ \ \ \ \ \ \ \ \ \ \ que\ \ \ \ \ \ ?\ \ QUEstion
  504. Xnak\ ccu\ \ \ \ \ \ \ \cir U\ \ Negative\ AcKnowledge\ \ \ \ \ \ \ ats\ \ \ \ \ \ @\ \ AT\ Sign
  505. Xsyn\ ccv\ \ \ \ \ \ \ \cir V\ \ SYNchronous\ idle\ \ \ \ \ \ \ \ \ \ \ exx\ eks\ \ X
  506. Xetb\ ccw\ \ \ \ \ \ \ \cir W\ \ End\ Transmission\ Block\ \ \ \ \ lsq\ \ \ \ \ \ [\ \ Left\ SQuare\ bracket
  507. Xcan\ ccx\ \ \ \ \ \ \ \cir X\ \ CANcel\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ bsl\ \ \ \ \ \ \bsl \ \ BackSLash
  508. Xeme\ ccy\ \ (EM)\ \cir Y\ \ End\ of\ MEdium\ \ \ \ \ \ \ \ \ \ \ \ \ \ rsq\ \ \ \ \ \ ]\ \ Right\ SQuare\ bracket
  509. Xsub\ ccz\ \ \ \ \ \ \ \cir Z\ \ SUBstitute\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ car\ cir\ \ \cir \ \ CARet,\ CIRcumflex
  510. Xesc\ \ \ \ \ \ \ \ \ \ \ \cir [\ \ ESCape\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ und\ \ \ \ \ \ \und \ \ UNDerscore
  511. Xfil\ \ \ \ \ \ (FS)\ \cir \bsl \ \ FILe\ separator\ \ \ \ \ \ \ \ \ \ \ \ \ bqu\ gra\ \ `\ \ BackQUote,\ GRAve
  512. Xgro\ \ \ \ \ \ (GS)\ \cir ]\ \ GROup\ separator\ \ \ \ \ \ \ \ \ \ \ \ lcu\ \ \ \ \ \ \lcu \ \ Left\ CUrly\ brace
  513. Xrec\ \ \ \ \ \ (RS)\ \cir \cir \ \ RECord\ separator\ \ \ \ \ \ \ \ \ \ \ pip\ bar\ \ |\ \ PIPe,\ vertical\ BAR
  514. Xuni\ \ \ \ \ \ (US)\ \cir \und \ \ UNIt\ separator\ \ \ \ \ \ \ \ \ \ \ \ \ rcu\ \ \ \ \ \ \rcu \ \ Right\ CUrly\ brace
  515. Xspa\ \ \ \ \ \ (SP)\ \ \ \ \ SPAce\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ til\ \ \ \ \ \ \til \ \ TILde
  516. X\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ del\ \ \ \ \ \ \cir ?\ DELete
  517. X\smallskip}
  518. X\L
  519. XThe easy separation of the previous table into left and right side
  520. Xlists suggests that
  521. Xnon-alphanumeric characters form two
  522. Xgroups almost equal in size: non-printing and printing characters.
  523. XNon-printing characters are ordered within the ASCII list as
  524. Xa linear sequence of byte values from
  525. X0 to 32.  A single non-printing character, {\myit delete\/}
  526. X(DEL, 127) is at the very end of
  527. Xthe ASCII list.  Two- and three-character ``official'' or ``standard''
  528. Xnames had been in
  529. Xuse to reference the non-printing ASCII values, competing with an
  530. Xalternative two-character ``control sequence'' representation.
  531. XThe byte pairs of the latter form begin with a caret \key{\car}.
  532. XFor example, BEL or {\mytt \car G} officially both refer to ASCII~7.
  533. X\L
  534. XThe phonetic system described here, retains the ``official''
  535. Xthree-character
  536. Xnames, but expands or changes
  537. Xtwo-character names
  538. X(BS, HT, LF, VT, etc., shown in parentheses).  The new names
  539. Xare all three characters long, in lowercase.  For
  540. Xconvenience of use, control-byte pairs ending with an
  541. Xalphabetic character ({\mytt \car A}, etc.)
  542. Xare also translated into alternative phonetic
  543. Xidentifiers, by prepending the lowercase
  544. Xalphabetic byte of the control byte pair with ``cc''
  545. X(for ``control character'').  For example, Xnew and Xccj both
  546. Xrepresent the {\myit newline\/} character (ASCII LF, byte value 10).
  547. X\L
  548. XUsing a total of four bytes to represent a single ASCII byte is
  549. Xsomewhat wasteful of space, although not any more so than using
  550. X\dx{\mytt'\bsl 077'}\ for example, to represent \key{\mytt?}
  551. Xin octal notation.
  552. XA four-byte phonetic token can always be specified without the
  553. Xsingle quotes on a shell command line, requiring a string two bytes
  554. Xshorter than its equivalent octal version in the above example.
  555. XBut more importantly, the three bytes of the phonetic name
  556. Xform an easily recognized identifier, produced in most cases by
  557. Xtaking the first syllable of the full official
  558. Xname of the ASCII character in question.
  559. XThe easy syntax means that the user does not have to invest time to
  560. Xlearn a new vocabulary, nor is there a need for conversion reference
  561. Xcards.
  562. X\L
  563. XPhonetic names for characters in the printing byte group were
  564. Xtaken from the first three characters of the written form of
  565. Xa commonly used name of the character; or the first two characters
  566. Xprepended by ``l'' for ``left'' or ``r'' for ``right'' in the case of
  567. Xall symmetrical delimiter
  568. Xpairs; or the first two characters of the name prepended by ``b''
  569. Xif the name followed the ``back'' preposition.
  570. XVarious alternate names are recognized: for example,
  571. Xtypewriters often print
  572. Xthe \# character as {\myit \char36\/} (hence the name of
  573. Xthe ``{\myit pound~define\/}''
  574. Xmacro instead of ``{\myit sharp~define\/}'').  \IT\ understands
  575. Xeither Xpou (pound), Xsha (sharp), or Xhas (hash) as ASCII~35.
  576. XThe alias name that did not get
  577. Xonto the phonetic control list is the abbreviation for ``period'',
  578. Xbecause it would have been in collision with ``percent''.  But 
  579. XXdot and Xpoi (``dot'' and ``point'') are common enough names for
  580. X\key{.}.
  581. X\L
  582. XIn order to keep the list extendible and to allow modifications,
  583. X\IT\ uses binary search into the phonetic keyword map for producing
  584. Xa translation to the real value, instead of hashing, which would
  585. Xhave been
  586. Xfaster.  It is expected that calls to \IT\ would be made from the
  587. Xoperational periphery of processes, excluding \IT\ from becoming
  588. Xpart of a ``bottleneck''.  In this case
  589. Xtrading speed to gain maintainability has advantages.
  590. XThe conversion process uses
  591. Xtwo arrays defined in {\myit ifonetic.h\/}.  The {\myit listfonet\/}
  592. Xarray is a static {\myit char *\/} list, its pointers dereferencing
  593. Xdiscreet identifiers, sorted alphabetically.
  594. XThe {\myit mapfonet\/}
  595. Xarray is a {\myit char\/} list of the ``real'' byte values corresponding
  596. Xto the names of {\myit listfonet\/}.
  597. X\L
  598. XDuring operation, \IT\ recognizes a control token in the passed
  599. Xstring by virtue of the preceding X, and searches
  600. X{\myit listfonet\/} for a match.  The offset of the matching pointer
  601. Xfrom the base address of
  602. X{\myit listfonet\/} is used as the index into
  603. X{\myit mapfonet\/}, producing the real byte value associated with
  604. Xthe control token.
  605. XThe system could easily be made to include {\myit meta\/} byte
  606. Xvalues (in the 128 -- 255) range, by changing {\myit mapfonet\/}
  607. Xto {\myit unsigned char\/} type, and adding new control names
  608. XX128 to X255.
  609. X
  610. X\S{char EXAMPLE PROGRAM}
  611. X{\bb char} is a
  612. Xvery simple routine that expands character ranges
  613. Xgiven on its command line, into space-separated
  614. Xcharacter lists.  The command line
  615. X\smallskip
  616. X\I{\mytt char AF zo 99 1}
  617. X\smallskip
  618. Xspecifies character ranges A--F, z--o, 9--9, and 1--1; and produces the
  619. Xoutput
  620. X\smallskip
  621. X\I{\mytt A B C D E F z y x w v u t s r q p o 9 1}
  622. X\smallskip
  623. XThe output in all cases is terminated
  624. Xwith a {\myit newline\/}.
  625. XLike the other ILIB examples that expect string arguments on the
  626. Xcommand line, {\bb char} submits each string argument to \IT\ in
  627. Xturn, in order to ease typing non-printing or
  628. Xspecial characters in the command line.  Thus,
  629. X\smallskip
  630. X\I{\mytt char XnulXdel}
  631. X\smallskip
  632. Xoutputs a space-separated list of all ASCII characters.
  633. X
  634. X\S{char.c PROGRAM TEXT}
  635. X\listing{../iex/char.c}
  636. X
  637. X\S{xec EXAMPLE PROGRAM}
  638. XILIB program examples expecting string arguments from the command line,
  639. Xall call \IT\ to resolve embedded phonetic control sequences.
  640. XOther programs will likely not be so obliging, however.  The user
  641. Xmay still hide ``special characters'' from the shell, by executing
  642. Xthe target program via {\bb xec} instead of through the shell.
  643. XAs a simple example without control sequences, one may type:
  644. X\smallskip
  645. X\I{\mytt xec echo hello}
  646. X\smallskip
  647. Xto produce identical results as the command
  648. X\smallskip
  649. X\I{\mytt echo hello}
  650. X\smallskip
  651. XIn the latter case, the {\myit echo\/}
  652. Xcommand was directly handed to the shell;
  653. Xin the first case it was {\myit exec'd\/} by {\bb xec}.  The command
  654. Xstructure of {\bb xec} is trivial: its parameters  {\bb must} form
  655. Xa complete command.  At least one argument (the name of the command
  656. Xto be executed) is required to follow {\bb xec} on the command line.
  657. XAny additional arguments are handed over by {\bb xec} to
  658. X\IT\ in a loop, potentially modifying the original list by collapsing
  659. Xembedded phonetic control sequences into the represented object bytes.
  660. XAfter this, {\bb xec} calls {\myit execvp()\/} with the (modified)
  661. X{\myit argv\/} list, causing its own
  662. Xdemise as the specified program overlays the executing process with
  663. Xits own data and text segments.
  664. X\L
  665. XSuppose that the original \dx{\mytt echo hello}\ command was to be
  666. Xexpanded to output three extra blank lines following the
  667. X\dx{\mytt hello}.  Instead of mulling over how to do this in the shell,
  668. Xthe user could just type
  669. X\dx{\mytt xec echo helloXnewXnewXnew}.
  670. X\L
  671. XThe {\myit execvp()\/} call utilized by {\bb xec}  will search the
  672. Xuser's \dol{\myit PATH\/} to find the absolute path to the text
  673. Xof the given command, unless the path is part of the command.
  674. X{\myit execvp()\/} also understands the user's environment,
  675. Xterminal control characters, and so on.  If the text of
  676. Xthe target command is a {\myit shell script\/},
  677. X{\myit execvp()\/} will pass it to the shell executive specified by
  678. Xthe user's \dol{\myit SHELL\/} variable (usually
  679. X{\myit /bin/sh\/}).  If the script was written for a different shell,
  680. Xthis may cause an ``exec format error''.  The remedy in such cases is to
  681. Xadd a new first line to the script, explicitly stating which shell it
  682. Xwas written for, for example:
  683. X\dx{\mytt \#!\ /bin/csh}.
  684. XThe \twokey{\#!} byte pair, the following space, and the full pathname
  685. Xof the shell are mandatory.  The new
  686. Xline will induce {\myit execvp()\/} to
  687. Xexecute the specified script through {\myit /bin/csh\/} instead of via
  688. X\dol{\myit SHELL\/}.
  689. X
  690. X\S{xec.c PROGRAM TEXT}
  691. X\listing{../iex/xec.c}
  692. X
  693. X\S{defilter EXAMPLE PROGRAM}
  694. XTaking {\bb xec} one step further, {\bb defilter} combines
  695. Xthe ``command execution through {\myit execvp()\/}'' idea with the
  696. X``in-place file transformation using the {\myit system(''mv'')\/}
  697. Xcommand'' (utilized by and described under
  698. Xthe {\myit excise\/} example).  The
  699. Xcombined algorithm expects a complete
  700. Xcommand string as its first parameter, followed by a list of files.
  701. XThe text of each of the files in turn, is input
  702. Xto the command, then the original file text is overwritten by
  703. Xthe output produced by
  704. Xthe command.  As a simple example,
  705. X\smallskip
  706. X\I{\mytt defilter sort file1 file2 file3}
  707. X\smallskip
  708. Xuses {\myit sort\/} to alphabetize
  709. Xthe lines of {\myit file1\/}
  710. Xand replaces the original text of {\myit file1\/} with the
  711. Xsorted version; then
  712. Xsorts the lines of {\myit file2\/} and
  713. Xreplaces the original text of {\myit file2\/} with its
  714. Xsorted version; then again,
  715. Xsorts {\myit file3\/} in place.
  716. X\L
  717. XThe command string following {\bb defilter} on the command line
  718. Xshould be the name of an executable object or the name of an
  719. Xexecutable shell script, with or without various
  720. Xoption flags and options understood by the executable; but
  721. Xwithout shell pipes or redirection characters.
  722. XTo avoid some artificial, strained convention that would
  723. Xsignal {\bb defilter} the end of the command string
  724. Xand the beginning of the file list, the
  725. X``to be executed command string''
  726. Xmust form a single token, a single ``arg'' in
  727. Xthe {\myit argv\/} list passed to the {\myit main()\/} function of
  728. X{\bb defilter}.  This is not expected to be a problem, since ---
  729. Xexcept for the most complex command strings --- the command
  730. Xand its options can be just enclosed in quotes.
  731. X\L
  732. XIn generating a new {\myit argv\/} list to be handed down to
  733. X{\myit execvp()\/}, the ILIB function {\myit ilist()\/} breaks the
  734. Xoriginal \dx{\mytt argv\lsq 1\rsq}\ into null terminated
  735. Xstrings (zeroing out spaces and TAB characters of the quoted
  736. Xcommand string), and returns an array of pointers to the
  737. X{\bb defilter} process in {\myit newargv\/}.  To allow
  738. Xelements of the new {\myit argv\/} list to contain spaces or
  739. Xtabs (and other non-alphanumeric characters),
  740. X{\bb defilter} does not call \IT\ when examining the
  741. Xcommand as its own first argument,
  742. Xbut calls \IT\ for each string of {\myit newargv\/} instead.
  743. X\L
  744. XFor each {\myit file\/} argument on its own command line,
  745. X{\bb defilter} maps in the file name as the last argument following
  746. Xthe command particulars in {\myit newargv\/}, and then {\myit fork\/}s
  747. Xa new process that will {\myit exec\/} the target command,
  748. Xreading its standard input (\stin) from {\myit file\/}, and writing
  749. Xits output to the temporary file renamed \stout.
  750. XWhen the child process dies, {\bb defilter} replaces the original
  751. Xtext of {\myit file\/} with the new text of the temporary file,
  752. Xexactly as during the {\myit excise\/} program.  Then the process
  753. Xrepeats, reading and altering the text of the next file in the list.
  754. X\L
  755. XA reasonably complex command example would use the {\myit sed\/}
  756. Xeditor to ``hunt down'' occurrences of the string
  757. X\dx{\mytt hello, world!}\ (not split across line breaks) in
  758. Xfile {\myit F\/}, and directly substitute
  759. X\dx{\mytt bye, cr\bsl"uel world!}\ instead.  To begin with,
  760. Xthe {\myit sed\/} ``substitute'' command would have to be quoted even
  761. Xas a normal shell command, because
  762. X\smallskip
  763. X\I{\mytt sed -e s/hello,\ world!/bye,\ cr\bsl "uel world!/g F}
  764. X\smallskip
  765. Xhas ``holes'' in the exchange strings, and would return (under
  766. XSystem~V) with an error message from {\myit sed\/}:
  767. X\smallskip
  768. X\I{\mytt command garbled: s/hello,}
  769. X\smallskip
  770. XIn the C shell, the {\myit sed\/} command would not even be called:
  771. Xthe {\myit history substitution mechanism\/} would assume that the
  772. Xexclamation marks were to recall a previous command, and would
  773. Xrespond:
  774. X\smallskip
  775. X\I{\mytt /bye,: Event not found.}
  776. X\smallskip
  777. XThen there is the small problem of the \TeX\ {\myit umlaut\/}
  778. Xcontrol sequence (intended
  779. Xto place a double dot over the \key{u} in \dx{\mytt cr\"uel}), which
  780. Xwould evoke a complaint:
  781. X\smallskip
  782. X\I{\mytt Unmatched ".}
  783. X\smallskip
  784. XA plausible attempt to silence all these complaints at once, may
  785. Xlook like:
  786. X\smallskip
  787. X\I{\mytt defilter 'sed -e "s/hello, worldXban/bye, cr\bsl Xquouel worldXban/g"' F}
  788. X\smallskip
  789. XThis would shut up the shell, and deliver the entire {\myit sed\/}
  790. Xcommand to {\bb defilter} in one piece, to be sure.
  791. XBut as mentioned, the current implementation of {\bb defilter}
  792. Xre-tokenizes the ``command'' argument, breaking it apart at spaces
  793. Xand TABs.
  794. XThe new token list would then see a resurgence of the ``holes'':
  795. X\smallskip
  796. X\I{\mytt sed\hole
  797. X-e\hole
  798. X"s/hello,\hole
  799. XworldXban/bye,\hole
  800. Xcr\bsl Xquouel\hole
  801. XworldXban/g"\hole
  802. X}
  803. X\smallskip
  804. XAnother implementation may conceivably use different tokenizing rules,
  805. Xperhaps recreating all or a part of the shell's quoting mechanism;
  806. Xand such an implementation could accept the entire double-quoted
  807. Xsubstitution string as a single argument in the {\myit newargv\/} list.
  808. XApart  from the observation that this ``quoting'' implementation
  809. Xcould hardly be used to expound the merits of phonetic sequence
  810. Xexpansion, it would involve significant amount of tedious detail work
  811. Xto resolve precedences, nesting, escaped quotes (just to name a few
  812. Xof the problems), while almost certainly denying the user
  813. Xthe ability to conceptually separate the quotes resolved by the
  814. Xshell at the top level of the command, from the quotes resolved by
  815. Xthe internal tokenizer, or from quotes intended for the {\myit exec\/}'d
  816. Xcommand itself!
  817. X\L
  818. XThe current rules of quoting for {\bb defilter} are:
  819. X
  820. X\item{1.}
  821. XSurround the command with quotes to make it a single token from the
  822. Xvantage point of the shell.
  823. X
  824. X\item{2.}
  825. XDo not quote inside the command unless the quote character itself is
  826. Xintended to be passed through the {\myit exec\/}'d command.
  827. X
  828. X\item{3.}
  829. XFill in the holes in the command's own arguments with phonetic control
  830. Xsequences.
  831. X\smallskip
  832. XThe final format of the command caters to the syntax
  833. Xrequirements of {\myit sed\/}, escaping the backslash with another
  834. Xbackslash:
  835. X\smallskip
  836. X{\mytt defilter\ 'sed\ -e\ s/hello,XspaworldXban/bye,Xspacr\bsl \bsl XquouelXspaworldXban/g'\ F}
  837. X\smallskip
  838. X
  839. X\S{defilter.c PROGRAM TEXT}
  840. X\listing{../iex/defilter.c}
  841. X\eject
  842. SHAR_EOF
  843. $TOUCH -am 0607110690 iman/ifonetic.tex &&
  844. chmod 0644 iman/ifonetic.tex ||
  845. echo "restore of iman/ifonetic.tex failed"
  846. set `wc -c iman/ifonetic.tex`;Wc_c=$1
  847. if test "$Wc_c" != "21527"; then
  848.     echo original size 21527, current size $Wc_c
  849. fi
  850. # ============= iman/ifrombit.tex ==============
  851. echo "x - extracting iman/ifrombit.tex (Text)"
  852. sed 's/^X//' << 'SHAR_EOF' > iman/ifrombit.tex &&
  853. X% XREF ifrombit itobit
  854. X
  855. X\def\name{IFROMBIT}
  856. X\def\IT{{\bb ifrombit()}}
  857. X\def\ALT{{\bb itobit()}}
  858. X
  859. X\S{NAME}
  860. X
  861. X{\bb ifrombit} --- convert a character string of binary bits to
  862. X{\myit int\/}
  863. X
  864. X{\bb itobit} --- convert a {\myit char, short,\/} or {\myit int\/} into
  865. Xa character string of binary bits
  866. X
  867. X\S{SYNOPSIS}
  868. X{\obeylines \bb
  869. Xint
  870. Xifrombit (bitstring, bits, zero, one)
  871. Xchar *bitstring;
  872. Xint bits;
  873. Xchar zero;
  874. Xchar one;
  875. X\L
  876. Xchar *
  877. Xitobit (val, bits, zero, one)
  878. Xint val;
  879. Xint bits;
  880. Xchar zero;
  881. Xchar one;
  882. X}
  883. X
  884. X\S{DESCRIPTION}
  885. XIn the author's experience the need to convert to and from the
  886. Xbinary radix arises with persistence, albeit infrequently enough
  887. Xthat previous work on implementing the conversions is forgotten
  888. Xor is not on-line anymore.  Including \IT\ and \ALT\ in ILIB
  889. Xrepresents an effort to keep such rarely used but necessary
  890. Xroutines visible and easily accessible.
  891. X\L
  892. X\IT\ reads the {\myit bitstring\/} buffer passed to it, looking for
  893. X{\myit zero\/} and {\myit one\/} characters.  Each {\myit zero\/}
  894. Xcharacter in the string represents a ``binary zero'' bit, each
  895. X{\myit one\/} character represents a ``binary one'' bit.  The
  896. Xactual ASCII values used for
  897. X{\myit zero\/} and {\myit one\/} are irrelevant, but should be
  898. Xnon-NUL.  The leftmost
  899. X{\myit zero\/} or {\myit one\/} character
  900. Xof the buffer is understood to be the ``most significant'' bit of
  901. Xthe binary value of {\myit bitstring\/}.
  902. X\IT\ reads
  903. X{\myit bitstring\/} until it has found {\myit bits\/} number of
  904. X{\myit zero\/}s and {\myit one\/}s, collectively.
  905. XNon-{\myit zero\/} and non-{\myit one\/} characters of the string
  906. Xare skipped.  \IT\ returns the {\myit int\/} value of the
  907. Xbinary number string.
  908. X\ALT\ converts {\myit val\/} to a binary string of digits
  909. X{\myit bits\/} wide, using
  910. X{\myit zero\/} characters to represent binary zero bits,
  911. Xand {\myit one\/} characters as binary one bits, in the digit string.
  912. XThe null terminated string is returned.
  913. X\L
  914. XBoth \IT\ and \ALT\ restrict the size of the binary number
  915. X(expressed by {\myit bits\/}) to be at least one bit, and maximally
  916. X32 bits.  Callers of \IT\ are responsible to pass a {\myit bitstring\/}
  917. Xbuffer containing enough
  918. X{\myit zero\/} and {\myit one\/} characters to satisfy the
  919. X{\myit bits\/} count.  Out-of-bound {\myit bits\/} values cause a
  920. Xcall to {\myit ierror()\/}, returning negative {\myit sys\_nerr\/} from
  921. X\IT\ and {\myit (char *)\/}NULL from \ALT.
  922. X
  923. X\S{banner EXAMPLE PROGRAM}
  924. XThe {\bb banner} program listed here is a functional clone of the
  925. XSystem~V {\myit banner}, echoing command line arguments to the
  926. Xscreen in large letters.  Each argument of the command line is
  927. Xprinted as a line of large text by itself; if a line of text
  928. Xis to contain multiple words, the group of words should be quoted,
  929. Xmaking them a single token on the command line.  {\bb banner} does
  930. Xnot make assumptions about the width of the screen, but it does
  931. Xlimit the size of a single token (text line) to 256 characters.
  932. X(Wide output can be redirected to {\myit rotr\/} or {\myit rotl\/}
  933. Xto reorient the text vertically, making it suitable for printing
  934. X``banners'' on continuous, pinfeed computer paper.)
  935. X\L
  936. XThe token list given to {\bb banner} undergoes ILIB's customary
  937. Xphonetic control character conversion to allow painless inclusion
  938. Xof ``special characters'' within the words, although {\bb banner}
  939. Xdoes not produce output for {\myit control characters\/} with
  940. XASCII values less than 32.  Tokens of the command line are processed
  941. Xsequentially; characters of a token are converted to a seven-line
  942. Xhigh ``banner string''.  The width of the enlarged characters is
  943. Xseven columns, followed by a one-column space.
  944. X\L
  945. XThe shape of each
  946. Xcharacter is retrieved from the twodimensional {\myit char\/} array
  947. X{\myit banchars\/}.  The first dimension of the array is used to index
  948. Xthe array address of a character (by the character's ASCII value).
  949. XThe second dimension indexes the ``width'' contents for the seven
  950. Xlines of a banner character.  Each byte of data in the array
  951. Xrepresents the ``raster image'' of seven consecutive columns
  952. Xof (one of seven horizontal lines of) the enlarged character.
  953. XThe {\myit char\/} data is converted ``on-the-fly'' into
  954. X{\myit weighted binary bits\/} by \ALT; and the character string of
  955. Xbinary bits produced by \ALT\ is concatenated in a line buffer, with
  956. Xone space added between strings.  The line buffer is re-made
  957. Xand printed seven times to produce a banner text line.  A blank
  958. Xline is output after each banner line.
  959. X
  960. X\S{banner.c PROGRAM TEXT}
  961. X\listing{../iex/banner.c}
  962. X
  963. X\eject
  964. SHAR_EOF
  965. $TOUCH -am 0524122790 iman/ifrombit.tex &&
  966. chmod 0644 iman/ifrombit.tex ||
  967. echo "restore of iman/ifrombit.tex failed"
  968. set `wc -c iman/ifrombit.tex`;Wc_c=$1
  969. if test "$Wc_c" != "4510"; then
  970.     echo original size 4510, current size $Wc_c
  971. fi
  972. # ============= iman/ifunclist.tex ==============
  973. echo "x - extracting iman/ifunclist.tex (Text)"
  974. sed 's/^X//' << 'SHAR_EOF' > iman/ifunclist.tex &&
  975. X\def\name{TABLE 2}
  976. X
  977. X\S{Function Returns, Parameters, Chapter Name}
  978. X{\bb
  979. X\settabs\+char * & inumsearch &
  980. X(start, end, tobuf, header, ender, breakc, maxc, more); &\cr
  981. X\smallskip
  982. X\+{\smallcaps Value}&{\smallcaps Name}&{\smallcaps Parameters}&{\smallcaps Manual Entry}\cr
  983. X\L
  984. X\+char*&ialntok&(start, end, wbuf);\linef&{\myletr IALNTOK}\cr
  985. X\+char*&ianymatch&(start, end, str);\linef&{\myletr IMATCH}\cr
  986. X\+char*&ianytok&(start, end, wbuf);\linef&{\myletr IALNTOK}\cr
  987. X\+int&ibcmp&(s1, s2, bytes);\linef&{\myletr IBCMP}\cr
  988. X\+void&ibcopy&(tobuf, frombuf, bytes);\linef&{\myletr IBCMP}\cr
  989. X\+void&iblank&(start, end);\linef&{\myletr IBLANK}\cr
  990. X\+int&ibreakl&(start, end, tobuf, header, ender, breakc, maxc, all);\linef&{\myletr IBREAKL}\cr
  991. X\+char*&ictok&(start, end, wbuf);\linef&{\myletr IALNTOK}\cr
  992. X\+char*&icopy&(start, end);\linef&{\myletr ICOPY}\cr
  993. X\+int&icount&(type);\linef&{\myletr ICOUNT}\cr
  994. X\+void&icue&(ptr);\linef&{\myletr ICUE}\cr
  995. X\+int&idamage&(error);\linef&{\myletr IERROR}\cr
  996. X\+char*&idate&(format);\linef&{\myletr IDATE}\cr
  997. X\+void&idump&(start, end, ch);\linef&{\myletr IDUMP}\cr
  998. X\+int&iego&(ptr, wbuf, delim, ext);\linef&{\myletr IEGO}\cr
  999. X\+int&ierror&(ustr);\linef&{\myletr IERROR}\cr
  1000. X\+int&iexpect&(start, end, word, skiptok, toktype);\linef&{\myletr IEXPECT}\cr
  1001. X\+int&ifamily&(ptr1, ptr2);\linef&{\myletr IFAMILY}\cr
  1002. X\+int&ifilter&(fname, mallocp);\linef&{\myletr IFILTER}\cr
  1003. X\+int&ifonetic&(start);\linef&{\myletr IFONETIC}\cr
  1004. X\+int&ifrombit&(bitstring, bits, zero, one);\linef&{\myletr IFROMBIT}\cr
  1005. X\+int&igroup&(ptr1, ptr2, modval);\linef&{\myletr IFAMILY}\cr
  1006. X\+int&ihash&(ptr, modval, upcase);\linef&{\myletr IHASH}\cr
  1007. X\+int&ihasharg&(ptr, delim);\linef&{\myletr IHASH}\cr
  1008. X\+char*&ihms&(key);\linef&{\myletr IHMS}\cr
  1009. X\+int&iinput&(ptr, message);\linef&{\myletr IINPUT}\cr
  1010. X\+char*&ilast&(ptr, c);\linef&{\myletr IBCMP}\cr
  1011. X\+int&iline&(start, end);\linef&{\myletr ILINE}\cr
  1012. X\+int&ilist&(start, end, delims, ptrlist);\linef&{\myletr ILIST}\cr
  1013. X\+int&ilistn&(start, end, delims, ptrlist);\linef&{\myletr ILIST}\cr
  1014. X\+int&illistn&(start, end, ptrlist);\linef&{\myletr ILIST}\cr
  1015. X\+int&ilongest&(start, end, lcount);\linef&{\myletr IROTATE}\cr
  1016. X\+int&ilower&(start, end);\linef&{\myletr ILOWER}\cr
  1017. X\+char*&imatch&(start, end, str);\linef&{\myletr IMATCH}\cr
  1018. X\+int&imode&(fname, perm);\linef&{\myletr IMODE}\cr
  1019. X\+int&imonth&(ptr);\linef&{\myletr IDATE}\cr
  1020. X\+int&inest&(start, end, ldelim, rdelim, infopair);\linef&{\myletr INEST}\cr
  1021. X\+char*&inl&(start);\linef&{\myletr ICUE}\cr
  1022. X\+char*&inull&(start);\linef&{\myletr ICUE}\cr
  1023. X\+int&inumsearch&(comparee, wordlist, listcount);\linef&{\myletr ISEARCH}\cr
  1024. X\+void&inumsort&(ptr, itemcount);\linef&{\myletr ISORT}\cr
  1025. X\+int&inumstrcmp&(ptr1, ptr2);\linef&{\myletr IFAMILY}\cr
  1026. X\+char*&inextl&(start, end, skiptok);\linef&{\myletr IEXPECT}\cr
  1027. X\+int&ioctal&(ptr);\linef&{\myletr IOCTAL}\cr
  1028. X\+int&iopt&(ptr);\linef&{\myletr IOPT}\cr
  1029. X\+int&iread&(fname, mallocp);\linef&{\myletr IREAD}\cr
  1030. X\+int&irotate&(start, llength, lcount, mallocp, type);\linef&{\myletr IROTATE}\cr
  1031. X\+int&iround&(start, end, maxfrac);\linef&{\myletr IROUND}\cr
  1032. X\+int&isearch&(comparee, wordlist, listcount);\linef&{\myletr ISEARCH}\cr
  1033. X\+void&isort&(ptr, itemcount);\linef&{\myletr ISORT}\cr
  1034. X\+char*&istartl&(start, end, word);\linef&{\myletr IEXPECT}\cr
  1035. X\+int&istripcom&(start, end, lcom, rcom);\linef&{\myletr ISTRIPCOM}\cr
  1036. X\+int&istripdq&(start, end);\linef&{\myletr ISTRIPCOM}\cr
  1037. X\+int&istripsq&(start, end);\linef&{\myletr ISTRIPCOM}\cr
  1038. X\+int&istripstr&(start, end, str);\linef&{\myletr ISTRIPCOM}\cr
  1039. X\+int&iswap&(start, end, from, to);\linef&{\myletr ISWAP}\cr
  1040. X\+int&itexrect&(start, end, mallocp, lcount);\linef&{\myletr IROTATE}\cr
  1041. X\+char*&itobit&(val, bits, zero, one);\linef&{\myletr IFROMBIT}\cr
  1042. X\+int&itoday&();\linef&{\myletr IDATE}\cr
  1043. X\+int&itohour&();\linef&{\myletr IDATE}\cr
  1044. X\+int&itok&(context, start, end, result);\linef&{\myletr ITOK}\cr
  1045. X\+int&itomin&();\linef&{\myletr IDATE}\cr
  1046. X\+int&itomonth&();\linef&{\myletr IDATE}\cr
  1047. X\+int&itosec&();\linef&{\myletr IDATE}\cr
  1048. X\+int&itoyear&();\linef&{\myletr IDATE}\cr
  1049. X\+int&itran&(start, end, fromc, toc);\linef&{\myletr IBLANK}\cr
  1050. X\+int&iuniq&(item);\linef&{\myletr IUNIQ}\cr
  1051. X\+int&iupper&(start, end);\linef&{\myletr ILOWER}\cr
  1052. X\+char*&iwhich&(item, perm);\linef&{\myletr IWHICH}\cr
  1053. X\+int&iwrite&(fname, start, end);\linef&{\myletr IWRITE}\cr
  1054. X\+int&iwritopn&(fname, start, end);\linef&{\myletr IWRITE}\cr
  1055. X\+char*&ixmatch&(start, end, word);\linef&{\myletr IMATCH}\cr
  1056. X\+int&ixsearch&(comparee, wordlist, listcount);\linef&{\myletr ISEARCH}\cr
  1057. X\+int&ixswap&(start, end, from, to);\linef&{\myletr ISWAP}\cr
  1058. X}
  1059. X\eject
  1060. SHAR_EOF
  1061. $TOUCH -am 0531092590 iman/ifunclist.tex &&
  1062. chmod 0644 iman/ifunclist.tex ||
  1063. echo "restore of iman/ifunclist.tex failed"
  1064. set `wc -c iman/ifunclist.tex`;Wc_c=$1
  1065. if test "$Wc_c" != "4588"; then
  1066.     echo original size 4588, current size $Wc_c
  1067. fi
  1068. # ============= iman/ifunlines.tex ==============
  1069. echo "x - extracting iman/ifunlines.tex (Text)"
  1070. sed 's/^X//' << 'SHAR_EOF' > iman/ifunlines.tex &&
  1071. X\def\name{TABLE 1}
  1072. X
  1073. X\S{ILIB's Function List and Summary}
  1074. X\settabs\+{\bb inumstrcmp }&\cr
  1075. X\smallskip
  1076. X\+{\bb ialntok} & copy first alphanumeric token into word buffer\cr
  1077. X\+{\bb ianymatch} & find a specific string in a buffer\cr
  1078. X\+{\bb ianytok} & copy first token of source into word buffer\cr
  1079. X\+{\bb ibcmp} & compare two byte strings\cr
  1080. X\+{\bb ibcopy} & copy bytes from one place to another\cr
  1081. X\+{\bb iblank} & change all bytes to spaces\cr
  1082. X\+{\bb ibreakl} & break long lines into shorter ones\cr
  1083. X\+{\bb icopy} & copy buffer into dynamically allocated memory\cr
  1084. X\+{\bb icount} & count how many times a specific parameter was passed\cr
  1085. X\+{\bb ictok} & copy first C token of source into word buffer\cr
  1086. X\+{\bb icue} & buffer management\cr
  1087. X\+{\bb idate} & print today's date in one of four formats\cr
  1088. X\+{\bb idump} & write a buffer to \stout, show NUL bytes\cr
  1089. X\+{\bb iego} & put path-less, extension-less base name into word buffer\cr
  1090. X\+{\bb ierror} & report an ILIB error or a system error\cr
  1091. X\+{\bb idamage} & return TRUE on possible file damage\cr
  1092. X\+{\bb iexpect} & confirm or deny first token match in line\cr
  1093. X\+{\bb ifamily} & tell whether two alhanumeric strings are related\cr
  1094. X\+{\bb ifilter} & read file or \stin\ into dynamic memory, return size\cr
  1095. X\+{\bb ifonetic} & convert phonetic control strings to ASCII bytes\cr
  1096. X\+{\bb ifrombit} & convert a string of binary bits to {\myit int\/}\cr
  1097. X\+{\bb igroup} & compute places for separators in string lists\cr
  1098. X\+{\bb ihash} & return checksum of string\cr
  1099. X\+{\bb ihasharg} & return checksum of upcased final component of pathname\cr
  1100. X\+{\bb ihms} & convert duration from seconds to hh:mm:ss, time events\cr
  1101. X\+{\bb iinput} & get a string from \stin\ after \sterr\ prompt\cr
  1102. X\+{\bb ilast} & find last occurrence of character in a string\cr
  1103. X\+{\bb iline} & find {\myit newline\/}, null it, return line size\cr
  1104. X\+{\bb ilistn} & create array of pointers to strings in buffer\cr
  1105. X\+{\bb ilist} & create array of pointers to non-null strings in buffer\cr
  1106. X\+{\bb illistn} & create array of pointers to lines in buffer\cr
  1107. X\+{\bb ilongest} & find longest line in buffer\cr
  1108. X\+{\bb ilower} & change alphabetic characters in buffer to lower case\cr
  1109. X\+{\bb imatch} & find a specific token or token head in a buffer\cr
  1110. X\+{\bb imode} & find out if specified file permission bits are set\cr
  1111. X\+{\bb imonth} & convert month name to number 1 through 12\cr
  1112. X\+{\bb inest} & create array of {\myit int\/}s to nest information\cr
  1113. X\+{\bb inextl} & return location of first token in the next line\cr
  1114. X\+{\bb inl} & return pointer to next {\myit newline\/} or NUL byte\cr
  1115. X\+{\bb inull} & return pointer to next NUL byte\cr
  1116. X\+{\bb inumsearch} & binary (numeric) search in list of character pointers\cr
  1117. X\+{\bb inumsort} & sort list of character pointers to alphanumeric order\cr
  1118. X\+{\bb inumstrcmp} & alphanumeric comparison of two strings\cr
  1119. X\+{\bb ioctal} & convert octal digit strings to {\myit int}\cr
  1120. X\+{\bb iopt} & command line option manager\cr
  1121. X\+{\bb iread} & read file into buffer at mallocp, return file size\cr
  1122. X\+{\bb irotate} & rotate passed text in newly allocated buffer,\cr
  1123. X\+{\bb iround} & round to a given digit of a decimal fraction\cr
  1124. X\+{\bb isearch} & binary string search in list of character pointers\cr
  1125. X\+{\bb isort} & sort list of character pointers to alphabetic order\cr
  1126. X\+{\bb istartl} & find nearest line that starts with {\myit word\/}\cr
  1127. X\+{\bb istripcom} & ``white out'' comments in buffer with spaces\cr
  1128. X\+{\bb istripdq} & ``white out'' double quotes in buffer with spaces\cr
  1129. X\+{\bb istripsq} & ``white out'' single quotes in buffer with spaces\cr
  1130. X\+{\bb istripstr} & ``white out'' strings  in buffer with spaces\cr
  1131. X\+{\bb iswap} & change one string to another everywhere in a buffer\cr
  1132. X\+{\bb itexrect} & create rectangular array from lines of varying length\cr
  1133. X\+{\bb itobit} & convert {\myit char, short,\/} or {\myit int\/} into of binary bits\cr
  1134. X\+{\bb itoday} & integer value (1 $\ldots$\ 31) of current day of month\cr
  1135. X\+{\bb itohour} & integer value (0 $\ldots$\ 23) of current hour of day\cr
  1136. X\+{\bb itok} & dynamic tokenizer\cr
  1137. X\+{\bb itomin} & integer value (0 $\ldots$\ 59) of current minute\cr
  1138. X\+{\bb itomonth} & integer value (1 $\ldots$\ 12) of current month\cr
  1139. X\+{\bb itosec} & integer value (0 $\ldots$\ 59) of current second\cr
  1140. X\+{\bb itoyear} & four decimal-digit value of current year\cr
  1141. X\+{\bb itran} & change one character to another everywhere in buffer\cr
  1142. X\+{\bb iuniq} & return TRUE if parameter is passed for the first time\cr
  1143. X\+{\bb iupper} & change alphabetic characters in buffer to upper case\cr
  1144. X\+{\bb iwhich} & locate a file\cr
  1145. X\+{\bb iwrite} & open file, write buffer to file, close file\cr
  1146. X\+{\bb iwritopn} & open file, write buffer to file, leave file open\cr
  1147. X\+{\bb ixmatch} & find a specific token in a buffer\cr
  1148. X\+{\bb ixsearch} & binary token search in list of character pointers\cr
  1149. X\+{\bb ixswap} & change alphanumeric token to another everywhere in a buffer\cr
  1150. X\eject
  1151. SHAR_EOF
  1152. $TOUCH -am 0607122690 iman/ifunlines.tex &&
  1153. chmod 0644 iman/ifunlines.tex ||
  1154. echo "restore of iman/ifunlines.tex failed"
  1155. set `wc -c iman/ifunlines.tex`;Wc_c=$1
  1156. if test "$Wc_c" != "4956"; then
  1157.     echo original size 4956, current size $Wc_c
  1158. fi
  1159. echo "End of part 7, continue with part 8"
  1160. exit 0
  1161. -- 
  1162.         Istvan Mohos
  1163.         ...uunet!pyrdc!pyrnj!hhb!istvan
  1164.         RACAL-REDAC/HHB 1000 Wyckoff Ave. Mahwah NJ 07430 201-848-8000
  1165. ======================================================================
  1166.