home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / magtapetools / part01 next >
Encoding:
Internet Message Format  |  1987-08-02  |  44.0 KB

  1. Path: uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v10i088:  Magtape handling package, Part01/02
  5. Message-ID: <759@uunet.UU.NET>
  6. Date: 3 Aug 87 21:23:55 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 1799
  9. Approved: rs@uunet.UU.NET
  10.  
  11. Submitted-by: Dick Grune <dick@cs.vu.nl>
  12. Posting-number: Volume 10, Issue 88
  13. Archive-name: magtapetools/Part01
  14.  
  15.     David Hayes' posting of his ansitape program reminded me of my
  16. more general (but less specialized) magtape handling package, which has
  17. been in use for quite some years and which I have, in the course of
  18. time, sent out to some number of people.  I also sent it, some years ago,
  19. to net.sources.  It does not show up in your last listing of mod.sources.
  20. Anyway, it has been updated and adjusted, e.g., for machines with funny
  21. byte order.
  22.  
  23.     This letter begins with a very short comparison of his program
  24. to my package, followed by part 1 of 2 of the sources (sharchive).
  25.  
  26.                     Dick Grune
  27.                     Vrije Universiteit
  28.                     de Boelelaan 1081
  29.                     1081 HV  Amsterdam
  30.                     the Netherlands
  31.                     dick@cs.vu.nl
  32.                     ...!mcvax!vu44!dick
  33.  
  34. ----------------------------------------------------------------
  35. A few points of comparison between the program ANSITAPE by
  36.      David S. Hayes, The Merlin of Avalon
  37.     PhoneNet:    (202) 694-6900
  38.     ARPA:        merlin%hqda-ai.uucp@brl-smoke
  39.     UUCP:        ...!seismo!sundc!hqda-ai!merlin
  40. and the MAGTAPE package by
  41.     Dick Grune
  42.     Vrije Universiteit
  43.     Amsterdam, Holland
  44.     dick@cs.vu.nl
  45.     ...!mcvax!vu44!dick
  46.  
  47. ANSITAPE
  48.     uses BSD 4.2 system calls
  49.     writes variable format only
  50.     can extract files using wildcard characters
  51.     can add to tapes
  52.     can write EBCDIC
  53.  
  54. MAGTAPE
  55.     can do many other things besides handling ANSI tapes (see READ_ME)
  56.     runs on BSD 4.1, V7, SYS V and probably others
  57.     supports tape images on disk
  58.     writes fixed format only
  59.  
  60. ----------------------------------------------------------------
  61. : This is a shar archive.  Extract with sh, not csh.
  62. : This archive ends with exit, so do not worry about trailing junk.
  63. : --------------------------- cut here --------------------------
  64. PATH=/bin:/usr/bin
  65. echo Extracting \R\E\A\D\_\M\E
  66. sed 's/^X//' > \R\E\A\D\_\M\E << '+ END-OF-FILE '\R\E\A\D\_\M\E
  67. X#       This file is part of the magtape handling package MAG.
  68. X#       Written by Dick Grune, Vrije Universiteit, Amsterdam.
  69. X#
  70. X
  71. XSALES TALK
  72. X        If you have one or more magtape units and want to do more with
  73. Xthem than just run  `tar', this is for you.
  74. X
  75. X        On the shell level this package offers programs for
  76. X  - getting a quick look at a tape,
  77. X  - making exact copies of tapes even if you've got only one magtape unit,
  78. X  - extracting arbitrary portions from tapes and
  79. X  - the reading and writing of ANSI standard labelled tapes.
  80. XAll these programs work equally well on real tapes and on tape images
  81. Xon disk.
  82. X
  83. X        On the C-level it supplies routines for handling real tapes and
  84. Xtape images on disk as a unified concept (`generalized magtape').
  85. X
  86. X
  87. XINSTALLATION
  88. X-       Take a look at the file  `tploc.h'  which requires you to define:
  89. X
  90. X        SYSCODE                         the name of your installation
  91. X        DEV_LOW, DEV_NORMAL, DEV_HIGH   the name(s) of the magtape unit(s)
  92. X
  93. X        You may also #define one of the following flags to describe
  94. X        the reading and writing of the tape:
  95. X        NORMAL (default)                anything goes (VAX, etc)
  96. X        EVEN                            only even blocksize allowed (PDP11)
  97. X        SWAB                            bytes must be swapped (M68000)
  98. X
  99. X        If you are not on a UNIX(like) system, you may look at `sys.c',
  100. X        which contains the (non-magtape) interface to the OS.
  101. X
  102. X-       Call  `make all'  and the shell commands as described in mag(1)
  103. X        will appear.
  104. X
  105. X-       To install the shell commands, change the macro USR (and possibly
  106. X        BIN, LIB, and INC) in the  `makefile'  and do  `make install'. To
  107. X        install the C-routine library  `libt.a', do  `make libt'.
  108. X
  109. X-       Now do
  110. X
  111. X                ansir -fp test.image
  112. X
  113. X        to get a feel for what it does. (Then do it a second time!).
  114. X
  115. XCYBER
  116. X        If you happen to have a Control Data Cyber around, running
  117. XSCOPE or NOS/BE, call  `make NOS'  to get  `NOSsplit', a program for
  118. Xreading Cyber SI-format tapes, and  `NOStr'  which converts from various
  119. XCyber character codes.
  120. X
  121. X                                        Dick Grune
  122. X                                        Vrije Universiteit
  123. X                                        de Boelelaan 1081
  124. X                                        1081 HV  Amsterdam
  125. X                                        the Netherlands
  126. X
  127. X                                        dick@cs.vu.nl
  128. X                                        ..!mcvax!vu44!dick
  129. X
  130. + END-OF-FILE READ_ME
  131. chmod 'u=rw,g=r,o=r' \R\E\A\D\_\M\E
  132. set `sum \R\E\A\D\_\M\E`
  133. sum=$1
  134. case $sum in
  135. 55393)    :;;
  136. *)    echo 'Bad sum in '\R\E\A\D\_\M\E >&2
  137. esac
  138. echo Extracting \M\a\k\e\f\i\l\e
  139. sed 's/^X//' > \M\a\k\e\f\i\l\e << '+ END-OF-FILE '\M\a\k\e\f\i\l\e
  140. X#    This file is part of the magtape handling package MAG.
  141. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  142. X#
  143. X
  144. X#    A system for handling magtapes, real or in tape image form.
  145. X#
  146. X#    make all:    make all the shell commands and run a superficial test
  147. X#    make install:    install all the shell commands
  148. X#    make libt:    install C-routine library
  149. X#    make NOS:    install NOSsplit et al. for reading Cyber tapes
  150. X#    make man:    install the manuals
  151. X#    make lint:    `lint' everything
  152. X#    make clean:    clean up the generated files
  153. X#
  154. X
  155. X#    P A R A M E T E R S
  156. XUSR =        /user1/dick
  157. X
  158. XBIN =        $(USR)/bin#        # where to store the binaries
  159. XLIB =        $(USR)/lib#        # where to store libt.a
  160. XINC =        $(USR)/src#        # where to store tp.h for public use
  161. XMAN1 =        $(USR)/man#        # where to store manual pages(1)
  162. XMAN3 =        $(USR)/man#        # where to store manual pages(3)
  163. X
  164. XCC =        cc#            # the C compiler to be used
  165. XCFLAGS =    -O -s#            # its flags
  166. XLINT =        lint#            # lint to be used, including flags
  167. X
  168. X#    P U B L I C   E N T R I E S
  169. XPRG =        survey rawtp cptp ansir ansiw
  170. XNOS =        NOSsplit NOStr
  171. X
  172. Xall:        $(PRG) $(NOS) test.image
  173. X    ./ansir -f test.image
  174. X    cmp READ_ME READ_ME.TEST
  175. X    rm READ_ME.TEST
  176. X
  177. Xinstall:    $(PRG)
  178. X    for F in $(PRG); do cp $$F $(BIN)/$$F; done
  179. X
  180. Xlibt:        tp.h libt.a
  181. X    cp tp.h $(INC)/tp.h
  182. X    cp libt.a $(LIB)/libt.a
  183. X
  184. XNOS:        $(NOS)
  185. X    for F in $(NOS); do cp $$F $(BIN)/$$F; done
  186. X
  187. X#    M A N U A L S
  188. XMAN1_SRC =    ansir.1 ansiw.1 cptp.1 rawtp.1 survey.1 mag.1 \
  189. X        NOSsplit.1 NOStr.1
  190. XMAN3_SRC =    mag.3
  191. XMAN_SRC =    $(MAN1_SRC) $(MAN3_SRC)
  192. X
  193. Xman:
  194. X    for F in $(MAN1_SRC); do cp $$F $(MAN1)/$$F; done
  195. X    for F in $(MAN3_SRC); do cp $$F $(MAN3)/$$F; done
  196. X
  197. X#    L I B R A R Y
  198. XLIB_OBJ =    tpread.o tpwrite.o tpopen.o tpclose.o tpname.o tperr.o \
  199. X        tploc.o tprdloc.o tpwloc.o tpwtmloc.o sys.o
  200. XLIB_SRC =    tpread.c tpwrite.c tpopen.c tpclose.c tpname.c tperr.c \
  201. X        tploc.c tprdloc.c tpwloc.c tpwtmloc.c sys.c
  202. XLIB_HDR =    aux.h tp.h tploc.h tpsys.h sys.h
  203. XLIB_AUX =    tpdummy.c llib-lmag.c
  204. X
  205. Xlibt.a:        $(LIB_OBJ)
  206. X    ar cr libt.a $(LIB_OBJ)
  207. X    if /bin/test -f /usr/bin/ranlib ; then ranlib libt.a ; fi
  208. X
  209. X
  210. X#    P R O G R A M S
  211. XPRG_SRC =    ansi.c etoa.c ansir.c ansiw.c cptp.c rawtp.c survey.c \
  212. X        NOSsplit.c NOStr.c
  213. XPRG_HDR =    ansi.h etoa.h options.h
  214. X
  215. Xansir:        ansir.o ansi.o etoa.o libt.a
  216. X    $(CC) $(CFLAGS) ansir.o ansi.o etoa.o libt.a -o ansir
  217. X
  218. Xansiw:        ansiw.o ansi.o libt.a
  219. X    $(CC) $(CFLAGS) ansiw.o ansi.o libt.a -o ansiw
  220. X
  221. Xcptp:        cptp.o libt.a
  222. X    $(CC) $(CFLAGS) cptp.o libt.a -o cptp
  223. X
  224. Xrawtp:        rawtp.o libt.a
  225. X    $(CC) $(CFLAGS) rawtp.o libt.a -o rawtp
  226. X
  227. Xsurvey:        survey.o etoa.o libt.a
  228. X    $(CC) $(CFLAGS) survey.o etoa.o libt.a -o survey
  229. X
  230. XNOSsplit:    NOSsplit.o libt.a
  231. X    $(CC) $(CFLAGS) NOSsplit.o libt.a -o NOSsplit
  232. X
  233. XNOStr:        NOStr.o
  234. X    $(CC) $(CFLAGS) NOStr.o -o NOStr
  235. X
  236. X#    S E R V I C E   E N T R I E S
  237. Xlint:
  238. X    $(LINT) $(LIB_SRC) tpdummy.c
  239. X    $(LINT) tpdummy.c llib-lmag.c
  240. X    $(LINT) rawtp.c llib-lmag.c
  241. X    $(LINT) cptp.c llib-lmag.c
  242. X    $(LINT) ansir.c ansi.c llib-lmag.c
  243. X    $(LINT) ansiw.c ansi.c llib-lmag.c
  244. X    $(LINT) NOSsplit.c llib-lmag.c
  245. X    $(LINT) NOStr.c
  246. X
  247. XFiles:        Makefile
  248. X    ls Makefile READ_ME $(MAN_SRC) $(LIB_HDR) $(LIB_SRC) $(LIB_AUX) \
  249. X        $(PRG_HDR) $(PRG_SRC) >Files
  250. X
  251. Xshar:        shar1 shar2
  252. XSHAR1 =        READ_ME Makefile $(MAN_SRC) $(LIB_HDR) $(LIB_SRC) $(LIB_AUX)
  253. XSHAR2 =        $(PRG_HDR) $(PRG_SRC)
  254. X
  255. Xshar1:        Makefile $(SHAR1)
  256. X    shar $(SHAR1) >shar1
  257. X
  258. Xshar2:        Makefile $(SHAR2)
  259. X    shar $(SHAR2) >shar2
  260. X
  261. Xtags:        $(LIB_SRC) $(PRG_SRC)
  262. X    ctags $(LIB_SRC) $(PRG_SRC) >tags
  263. X
  264. Xtest.image:    ansiw READ_ME
  265. X    cp READ_ME READ_ME.TEST
  266. X    ./ansiw -f test.image READ_ME.TEST
  267. X    rm READ_ME.TEST
  268. X
  269. Xclean:
  270. X    rm -f *.o libt.a $(PRG) $(NOS) \
  271. X        test.image shar1 shar2 tags
  272. X
  273. X
  274. X#----------------------------------------------------------------
  275. XNOSsplit.o: aux.h options.h tp.h
  276. XNOStr.o: aux.h
  277. Xansi.o: ansi.h aux.h tp.h
  278. Xansir.o: ansi.h aux.h etoa.h options.h tp.h
  279. Xansiw.o: ansi.h aux.h options.h sys.h tp.h tploc.h
  280. Xcptp.o: aux.h options.h tp.h
  281. Xrawtp.o: aux.h options.h tp.h
  282. Xsurvey.o: aux.h etoa.h options.h tp.h
  283. Xsys.o: aux.h
  284. Xtpclose.o: aux.h tp.h tpsys.h
  285. Xtpdummy.o: options.h sys.h tp.h
  286. Xtperr.o: aux.h tp.h tpsys.h
  287. Xtploc.o: tploc.h
  288. Xtpname.o: aux.h tp.h tpsys.h
  289. Xtpopen.o: tp.h tpsys.h
  290. Xtprdloc.o: tp.h tploc.h tpsys.h
  291. Xtpread.o: tp.h tpsys.h
  292. Xtpwloc.o: tp.h tploc.h tpsys.h
  293. Xtpwrite.o: tp.h tpsys.h
  294. Xtpwtmloc.o: aux.h tp.h tpsys.h
  295. + END-OF-FILE Makefile
  296. chmod 'u=rw,g=r,o=r' \M\a\k\e\f\i\l\e
  297. set `sum \M\a\k\e\f\i\l\e`
  298. sum=$1
  299. case $sum in
  300. 27318)    :;;
  301. *)    echo 'Bad sum in '\M\a\k\e\f\i\l\e >&2
  302. esac
  303. echo Extracting \a\n\s\i\r\.\1
  304. sed 's/^X//' > \a\n\s\i\r\.\1 << '+ END-OF-FILE '\a\n\s\i\r\.\1
  305. X.\"    This file is part of the magtape handling package MAG.
  306. X.\"    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  307. X.\"
  308. X.TH ANSIR 1 82/04/16
  309. X.SH NAME
  310. Xansir \- read ANSI standard labelled tape
  311. X.SH SYNOPSIS
  312. X.B ansir
  313. X[
  314. X.B \-ijnpg
  315. X] [ name ... ]
  316. X.SH DESCRIPTION
  317. X.I Ansir
  318. Xreads a single volume multi-file ANSI Standard
  319. XLabelled Tape or anything that looks remotely like it.
  320. XIt can handle F, U, D, S and V formats (V is for IBM tapes).
  321. XLabels can be in ASCII or in EBCDIC;
  322. X.I ansir
  323. Xassumes the files to be in the same character code as the labels, except
  324. Xfor U format files which are supposed to be in BINARY (i.e. untranslated).
  325. XThe record separator for ASCII or EBCDIC is the newline; the record
  326. Xseparator for BINARY is determined interactively. All these rules can
  327. Xbe overridden through the
  328. X.B \-i
  329. Xand
  330. X.B \-j
  331. Xparameters.
  332. X.PP
  333. XBad characters, i.e., those not in the ASCII95 set, are reported and
  334. Xshow up in the format \e[777]. This may necessitate some postprocessing
  335. Xbut too much light is better than being left in the dark.
  336. X.PP
  337. X.I Ansir
  338. Xmay consult the user on missing information; when a question is answered
  339. Xwith a single question mark,
  340. X.I ansir
  341. Xsupplies more information.
  342. X.PP
  343. XThe program accepts the usual
  344. X.B \-cfhlm
  345. Xparameters to describe the tape (see
  346. X.IR mag (I)).
  347. X.PP
  348. XThere are a number of additional options:
  349. X.TP
  350. X.B \-i
  351. Xthe UNIX file name and character code are determined interactively. A
  352. Xminus
  353. X.B \-
  354. Xfor a file name will result in skipping the corresponding tape file.
  355. X.TP
  356. X.B \-j
  357. Xas \fBi\fP-option, but including record format, block length,
  358. Xrecord length and buffer offset.
  359. X.TP
  360. X.B \-n
  361. Xno execution: the files will not be extracted.
  362. X.TP
  363. X.B \-p
  364. Xinformation from the labels is printed.
  365. X.TP
  366. X.B \-g
  367. Xif a
  368. X.B \-p
  369. Xis given, the information about generation number and
  370. Xversion number is also printed.
  371. X.PP
  372. XIf
  373. X.I name
  374. Xparameters are
  375. Xgiven, only the named files are treated.
  376. X.SH SEE ALSO
  377. Xmag(I)
  378. X.SH BUGS
  379. XThe S format has never been tried.
  380. X.PP
  381. XThe
  382. X.B \-p
  383. Xoption causes too much output.
  384. X.SH AUTHOR
  385. XDick Grune.
  386. + END-OF-FILE ansir.1
  387. chmod 'u=rw,g=r,o=r' \a\n\s\i\r\.\1
  388. set `sum \a\n\s\i\r\.\1`
  389. sum=$1
  390. case $sum in
  391. 12139)    :;;
  392. *)    echo 'Bad sum in '\a\n\s\i\r\.\1 >&2
  393. esac
  394. echo Extracting \a\n\s\i\w\.\1
  395. sed 's/^X//' > \a\n\s\i\w\.\1 << '+ END-OF-FILE '\a\n\s\i\w\.\1
  396. X.\"    This file is part of the magtape handling package MAG.
  397. X.\"    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  398. X.\"
  399. X.TH ANSIW 1 82/04/13
  400. X.SH NAME
  401. Xansiw \- write ANSI standard labelled tape
  402. X.SH SYNOPSIS
  403. X.B ansiw
  404. X[
  405. X.B \-ignpv
  406. X] [ file ... ]
  407. X.SH DESCRIPTION
  408. X.I Ansiw
  409. Xwrites a single volume multi-file ANSI Standard Labelled Tape
  410. Xin F- or U-format.
  411. X.PP
  412. XIf no option is given the tape has the following properties:
  413. X.br
  414. X    the volume serial number is 222222,
  415. X.br
  416. X    the owner is the user id,
  417. X.br
  418. X    the file identifier is the UNIX filename,
  419. X.br
  420. X    the expiration date is the current date,
  421. X.br
  422. X    the accessibility symbol is a space character.
  423. X.PP
  424. XThe preferred record format is F with block length 1920 and record length 80.
  425. XEach
  426. X.I file
  427. Xis scanned before it is written to tape. If it is found to be incompatible
  428. Xwith the preferred record format,
  429. X.I ansiw
  430. Xtries to find a better one. If it fails the user is consulted.
  431. X.PP
  432. XThe program accepts the usual
  433. X.B \-cfhlm
  434. Xparameters to describe the tape (see
  435. X.IR mag (I)).
  436. X.PP
  437. XThere are a number of additional options.
  438. X.TP
  439. X.B \-i
  440. Xthe user is consulted about the tape properties.
  441. X.TP
  442. X.B \-g
  443. Xif a
  444. X.B \-i
  445. Xis given the user is also consulted about the generation number
  446. Xand the version number.
  447. X.TP
  448. X.B \-n
  449. Xno execution: the tape-file is not created.
  450. X.TP
  451. X.B \-p
  452. Xa short report is printed for each file.
  453. X.TP
  454. X.B \-v
  455. Xthe user is only consulted about the Volume Label.
  456. X.PP
  457. XThe D and S formats are not implemented since their portability
  458. Xvalue is considered low.
  459. X.SH SEE ALSO
  460. Xmag(I)
  461. X.SH AUTHOR
  462. XDick Grune.
  463. + END-OF-FILE ansiw.1
  464. chmod 'u=rw,g=r,o=r' \a\n\s\i\w\.\1
  465. set `sum \a\n\s\i\w\.\1`
  466. sum=$1
  467. case $sum in
  468. 01038)    :;;
  469. *)    echo 'Bad sum in '\a\n\s\i\w\.\1 >&2
  470. esac
  471. echo Extracting \c\p\t\p\.\1
  472. sed 's/^X//' > \c\p\t\p\.\1 << '+ END-OF-FILE '\c\p\t\p\.\1
  473. X.\"    This file is part of the magtape handling package MAG.
  474. X.\"    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  475. X.\"
  476. X.TH CPTP 1 82/04/16
  477. X.SH NAME
  478. Xcptp \- copy from tape to tape
  479. X.SH SYNOPSIS
  480. X.B cptp
  481. X[
  482. X.B \-x
  483. X] [
  484. X.BR of= file
  485. X|
  486. X.BR if= file
  487. X]
  488. X.SH DESCRIPTION
  489. X.I Cptp
  490. Xconverts between real tapes and tape images on disk.
  491. XThe
  492. X.B of=
  493. Xparameter causes
  494. X.I cptp
  495. Xto read the real magtape and produce a tape image on the indicated file.
  496. XA call with an
  497. X.B if=
  498. Xparameter will write back the tape image from the indicated file to the
  499. Xreal magtape.
  500. X.PP
  501. XThe program accepts the usual
  502. X.B \-cfhlm
  503. Xparameters to describe the tape (see
  504. X.IR mag (I)).
  505. XIf the
  506. X.BI \-x -option
  507. Xis given,
  508. Xcopying will continue regardless of read-errors or consecutive tape marks
  509. X(default is stopping after 4 consecutive TMs).
  510. X.SH "SEE ALSO"
  511. Xmag(I),
  512. Xrawtp(I),
  513. Xsurvey(I)
  514. X.SH AUTHOR
  515. XDick Grune.
  516. + END-OF-FILE cptp.1
  517. chmod 'u=rw,g=r,o=r' \c\p\t\p\.\1
  518. set `sum \c\p\t\p\.\1`
  519. sum=$1
  520. case $sum in
  521. 50689)    :;;
  522. *)    echo 'Bad sum in '\c\p\t\p\.\1 >&2
  523. esac
  524. echo Extracting \r\a\w\t\p\.\1
  525. sed 's/^X//' > \r\a\w\t\p\.\1 << '+ END-OF-FILE '\r\a\w\t\p\.\1
  526. X.\"    This file is part of the magtape handling package MAG.
  527. X.\"    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  528. X.\"
  529. X.TH RAWTP 1 82/04/16
  530. X.SH NAME
  531. Xrawtp \- read raw tape
  532. X.SH SYNOPSIS
  533. X.B rawtp
  534. Xname [
  535. X.B \-x
  536. X] [ param ... ]
  537. X.SH DESCRIPTION
  538. X.I Rawtp
  539. Xextracts arbitrary portions from a magtape.
  540. X.PP
  541. XThe program accepts the usual
  542. X.B \-cfhlm
  543. Xparameters to describe the tape (see
  544. X.IR mag (I)).
  545. XThe additional
  546. X.BR \-x -option
  547. Xwill cause
  548. X.I rawtp
  549. Xto continue reading regardless of read-errors or consecutive tape marks
  550. X(normally
  551. X.I rawtp
  552. Xstops after 4 consecutive tape marks).
  553. X.PP
  554. XThe tape is considered as a series of files, each terminated by a
  555. Xtape mark (TM); a file is considered as a series of blocks, each
  556. Xterminated by an InterRecord Gap (IRG); a block consists of characters.
  557. X.PP
  558. XAn instruction
  559. X.I +t.i.c
  560. Xor
  561. X.I \-t.i.c
  562. Xmoves the tape over
  563. X.I t
  564. XTM's,
  565. X.I i
  566. XIRG's (but not over a TM) and
  567. X.I c
  568. Xcharacters (but not over an IRG). If the instruction begins with a
  569. X.I +
  570. Xthe contents are copied to a file, a
  571. X.I \-
  572. Xjust skips the contents.
  573. X.PP
  574. XInstructions may be concatenated into an instruction series. If an
  575. Xinstruction sequence is followed by
  576. X.BI x n
  577. Xthe effect is repeated
  578. X.I n
  579. Xtimes. If
  580. X.I n
  581. Xis absent or 0, the instruction series is repeated until it becomes
  582. Xineffective. E.g.,
  583. X.I +.1\-1x
  584. Xwill give you the first block of each file on tape.
  585. XDefault parameter is
  586. X.I +1x
  587. Xwhich splits the tape into its separate files.
  588. X.PP
  589. XThe produced files are named
  590. X.I namepprrrii
  591. Xwhere
  592. X.I name
  593. Xis the first argument,
  594. X.I pp
  595. Xis the two-digit parameter number,
  596. X.I rrr
  597. Xis a three-letter counter counting the number of repetitions of the
  598. Xparameter, and
  599. X.I ii
  600. Xis the two-digit instruction number within the parameter.
  601. X.PP
  602. XExample:
  603. X
  604. X.br
  605. X    rawtp  tp  \-10  +..80\-3x
  606. X
  607. Xwill skip 10 files, and then give the first 80 characters of the first
  608. Xblock of every third file on the files
  609. X.IR tp02aaa01 ,
  610. X.IR tp02aab01 ,
  611. Xetc, (if present.)
  612. X.SH "SEE ALSO"
  613. Xmag(I),
  614. Xcptp(I),
  615. Xsurvey(I)
  616. X.SH AUTHOR
  617. XDick Grune.
  618. + END-OF-FILE rawtp.1
  619. chmod 'u=rw,g=r,o=r' \r\a\w\t\p\.\1
  620. set `sum \r\a\w\t\p\.\1`
  621. sum=$1
  622. case $sum in
  623. 08829)    :;;
  624. *)    echo 'Bad sum in '\r\a\w\t\p\.\1 >&2
  625. esac
  626. echo Extracting \s\u\r\v\e\y\.\1
  627. sed 's/^X//' > \s\u\r\v\e\y\.\1 << '+ END-OF-FILE '\s\u\r\v\e\y\.\1
  628. X.\"    This file is part of the magtape handling package MAG.
  629. X.\"    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  630. X.\"
  631. X.TH SURVEY 1 82/04/16
  632. X.SH NAME
  633. Xsurvey \- survey contents of a magtape
  634. X.SH SYNOPSIS
  635. X.B survey
  636. X[
  637. X.B \-px
  638. X]
  639. X.SH DESCRIPTION
  640. X.I Survey
  641. Xlists the lengths of the blocks on a magtape. If the
  642. X.B \-p
  643. Xoption is given, the first characters of each block are displayed
  644. Xin ASCII, EBCDIC and hexadecimal.
  645. X.PP
  646. XThe program accepts the usual
  647. X.B \-cfhlm
  648. Xparameters to describe the tape (see
  649. X.IR mag (I)).
  650. XThe additional
  651. X.BR \-x -option
  652. Xwill cause
  653. X.I rawtp
  654. Xto continue reading regardless of read-errors or consecutive tape marks
  655. X(normally
  656. X.I rawtp
  657. Xstops after 4 consecutive tape marks).
  658. X.SH SEE ALSO
  659. Xmag(I)
  660. X.SH AUTHOR
  661. XDick Grune.
  662. + END-OF-FILE survey.1
  663. chmod 'u=rw,g=r,o=r' \s\u\r\v\e\y\.\1
  664. set `sum \s\u\r\v\e\y\.\1`
  665. sum=$1
  666. case $sum in
  667. 38018)    :;;
  668. *)    echo 'Bad sum in '\s\u\r\v\e\y\.\1 >&2
  669. esac
  670. echo Extracting \m\a\g\.\1
  671. sed 's/^X//' > \m\a\g\.\1 << '+ END-OF-FILE '\m\a\g\.\1
  672. X.\"    This file is part of the magtape handling package MAG.
  673. X.\"    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  674. X.\"
  675. X.TH MAG 1 83/06/23
  676. X.SH NAME
  677. Xmag \- generalized magnetic tape
  678. X.SH SYNOPSIS
  679. X.PP
  680. X.B cptp
  681. X[
  682. X.B -x
  683. X] [
  684. X.BR of= file
  685. X|
  686. X.BR if= file
  687. X]
  688. X.PP
  689. X.B rawtp
  690. Xname [
  691. X.B \-x
  692. X] [ param ... ]
  693. X.PP
  694. X.B survey
  695. X[
  696. X.B \-px
  697. X]
  698. X.PP
  699. X.B ansir
  700. X[
  701. X.B \-ijnpg
  702. X] [ name ... ]
  703. X.PP
  704. X.B ansiw
  705. X[
  706. X.B \-ignpv
  707. X] [ file ... ]
  708. X.PP
  709. X.B NOSsplit
  710. X[
  711. X.B \-s
  712. XN ] [ name ]
  713. X.SH DESCRIPTION
  714. XThese programs have in common that they use a 'generalized magtape'.
  715. XSuch a generalized magtape may correspond to a real magtape or to a tape image
  716. Xi.e., a normal
  717. Xfile with a specific structure which contains all information present on
  718. Xa tape, including block sizes and tape marks. Conversion between real tapes
  719. Xand tape images is done by
  720. X.IR cptp (I).
  721. X.PP
  722. XThe generalized magtape is described by the following parameters which
  723. Xapply to all of the above programs.
  724. X.TP
  725. X.BI \-m " N"
  726. Xthe magtape is real and on unit
  727. X.IR N .
  728. X.TP
  729. X.B \-h
  730. Xthe magtape is real and in high density.
  731. X.TP
  732. X.B \-l
  733. Xthe magtape is real and in low density.
  734. X.TP
  735. X.BI \-f " name"
  736. Xthe magtape is a tape image on file
  737. X.IR name .
  738. X.TP
  739. X.BI \-c " name"
  740. Xthe magtape is the character-device
  741. X.IR name .
  742. X.PP
  743. XThe options may appear separately or in groups.
  744. X.SH AUTHOR
  745. XDick Grune.
  746. X.SH BUGS
  747. XConflicts between options are not detected.
  748. + END-OF-FILE mag.1
  749. chmod 'u=rw,g=r,o=r' \m\a\g\.\1
  750. set `sum \m\a\g\.\1`
  751. sum=$1
  752. case $sum in
  753. 54257)    :;;
  754. *)    echo 'Bad sum in '\m\a\g\.\1 >&2
  755. esac
  756. echo Extracting \N\O\S\s\p\l\i\t\.\1
  757. sed 's/^X//' > \N\O\S\s\p\l\i\t\.\1 << '+ END-OF-FILE '\N\O\S\s\p\l\i\t\.\1
  758. X.\"    This file is part of the magtape handling package MAG.
  759. X.\"    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  760. X.\"
  761. X.TH NOSSPLIT 1 83/02/08
  762. X.SH NAME
  763. XNOSsplit \- split Cyber system tape
  764. X.SH SYNOPSIS
  765. X.B NOSsplit
  766. X[
  767. X.B \-s
  768. XN ] [ name ]
  769. X.SH DESCRIPTION
  770. X.I NOSsplit
  771. Xreads a Control Data Cyber system tape (SI-format) as written under NOS/BE or
  772. XSCOPE by COPY, COPYBF or COPYBR. Each Cyber record is written to a separate
  773. Xfile. The EOR-levels appear on standard output.
  774. X.PP
  775. XA Cyber record consists of an integral number of Cyber words of 60 bits each,
  776. Xwhereas a UNIX file consists of an integral number of bytes of 8 bits each;
  777. Xso, if the Cyber record has an odd number of words, a bit-to-bit mapping
  778. Xwon't work. Therefore, a mapping is used in which
  779. Xeach Cyber machine-word (60 bits) maps onto 10 characters, each containing
  780. X6 bits (again 60 bits).
  781. XSuch a 6-bit file can be processed by
  782. X.RI NOStr (I),
  783. Xwhich can do translation from DISPLAY code and Z-type record recognition.
  784. X.PP
  785. XThe file names are
  786. X.IR name 00000,
  787. X.IR name 00001,
  788. Xetc. The default
  789. X.I name
  790. Xis
  791. X.BR x .
  792. X.PP
  793. XThe program accepts the usual
  794. X.B \-cfhlm
  795. Xparameters to describe the tape (see
  796. X.IR mag (I)).
  797. X.PP
  798. XWhen the
  799. X.B \-s
  800. Xoption is given, the first
  801. X.I N
  802. Xrecords are skipped.
  803. X.SH SEE ALSO
  804. Xmag(I),
  805. XNOStr(I)
  806. X.SH BUGS
  807. XThere is no
  808. X.I NOScombine
  809. Xto put Humpty Dumpty together again.
  810. X.SH AUTHOR
  811. XDick Grune.
  812. + END-OF-FILE NOSsplit.1
  813. chmod 'u=rw,g=r,o=r' \N\O\S\s\p\l\i\t\.\1
  814. set `sum \N\O\S\s\p\l\i\t\.\1`
  815. sum=$1
  816. case $sum in
  817. 45288)    :;;
  818. *)    echo 'Bad sum in '\N\O\S\s\p\l\i\t\.\1 >&2
  819. esac
  820. echo Extracting \N\O\S\t\r\.\1
  821. sed 's/^X//' > \N\O\S\t\r\.\1 << '+ END-OF-FILE '\N\O\S\t\r\.\1
  822. X.\"    This file is part of the magtape handling package MAG.
  823. X.\"    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  824. X.\"
  825. X.TH NOSTR 1 82/04/16
  826. X.SH NAME
  827. XNOStr \- translate Cyber 6-bits files
  828. X.SH SYNOPSIS
  829. X.BR "NOStr -" C
  830. X[ file ]
  831. X.SH DESCRIPTION
  832. X.I NOStr
  833. Xaccepts as input a 6-bits Cyber file, as created, e.g., by
  834. X.IR NOSsplit (I).
  835. XSuch a file contains a mapping of an integral number of 60-bits Cyber words;
  836. Xeach Cyber word is mapped onto 10 UNIX characters, each containing 6 bits in
  837. Xthe right-most 6 positions. Depending on the interpretation that should be
  838. Xgiven to the original Cyber words
  839. X.I NOStr
  840. Xperforms the appropriate conversion indicated by
  841. X.IR C .
  842. X.PP
  843. XThree conversions have been implemented:
  844. X.TP
  845. X.B d
  846. Xthe input is interpreted as originating from Z-type
  847. Xrecords in DISPLAY code (6 bits to a character, EOR marked by two or more 00
  848. Xcharacters in the lower end of a word)
  849. X.TP
  850. X.B a
  851. XZ-type records in ASCII95 (8-bit characters right aligned in
  852. X12 bits, EOR marked by one or more NULL characters in the lower end)
  853. X.TP
  854. X.B b
  855. X`binary', i.e., ASCII256 (8-bit characters right aligned in
  856. X12 bits, no further processing); since this code is not well standardized,
  857. Xparity checking, CR-removal and further preening are left to the user.
  858. X.SH SEE ALSO
  859. XNOSsplit (I)
  860. X.SH BUGS
  861. XAs with
  862. X.I NOSsplit
  863. Xthe inverse does not exist.
  864. X.SH AUTHOR
  865. XDick Grune.
  866. + END-OF-FILE NOStr.1
  867. chmod 'u=rw,g=r,o=r' \N\O\S\t\r\.\1
  868. set `sum \N\O\S\t\r\.\1`
  869. sum=$1
  870. case $sum in
  871. 56699)    :;;
  872. *)    echo 'Bad sum in '\N\O\S\t\r\.\1 >&2
  873. esac
  874. echo Extracting \m\a\g\.\3
  875. sed 's/^X//' > \m\a\g\.\3 << '+ END-OF-FILE '\m\a\g\.\3
  876. X.\"    This file is part of the magtape handling package MAG.
  877. X.\"    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  878. X.\"
  879. X.TH MAG 3 83/06/23
  880. X.SH NAME
  881. Xmag \- implement generalized magtape
  882. X.SH SYNOPSIS
  883. X.PP
  884. X.B "#include <tp.h>"
  885. X.PP
  886. X.B "TPFILE *tpopen(unit, nmdns, rwx) char *nmdns, *rwx;"
  887. X.PP
  888. X.B "tpclose(tf) TPFILE *tf;"
  889. X.PP
  890. X.B "int tpread(tf, buf, size) TPFILE *tf; char *buf;"
  891. X.PP
  892. X.B "tpwrite(tf, buf, size) TPFILE *tf; char *buf;"
  893. X.PP
  894. X.B "tperrout(stream) FILE *stream;"
  895. X.SH DESCRIPTION
  896. XThese routines implement the generalized magtape described in
  897. X.IR mag (I).
  898. XSuch a generalized magtape is viewed as a sequence of blocks each of which
  899. Xis written and read in one piece. A tape mark is represented as a block of
  900. Xlength 0. The blocks correspond to physical blocks on tape (as separated
  901. Xby Interrecord Gaps). On a tape image each block is preceded by its length
  902. Xin format "%08d".
  903. X.PP
  904. XA generalized magtape is handled by these routines as a pointer to a
  905. XTPFILE. Such a pointer is obtained from
  906. X.IR tpopen .
  907. XThe
  908. X.I unit
  909. Xand the
  910. X.I nmdns
  911. Xdescribe the generalized magtape; these are the possibilities:
  912. X.PP
  913. Xa real magtape:
  914. X.I unit
  915. Xis a small non-negative integer (the unit number);
  916. X.I nmdns
  917. Xis TP_DENL, TP_DENN or TP_DENH (for low, normal or high density).
  918. X.PP
  919. Xa tape image:
  920. X.I unit
  921. Xis TP_IMAG;
  922. X.I nmdns
  923. Xis the file name.
  924. X.PP
  925. Xa character device:
  926. X.I unit
  927. Xis TP_CDEV;
  928. X.I nmdns
  929. Xis the device name.
  930. X.PP
  931. XThe third parameter
  932. X.I rwx
  933. Xis either "r" or "rx" for reading or "w" for writing; "rx" suppresses
  934. Xthe recognition of end-of-file in real magtapes (see
  935. X.IR tpread ).
  936. X.PP
  937. X.I Tpclose
  938. Xcloses a generalized magtape; this causes a rewind and makes room for
  939. Xother such files, since only a limited number (specified in _TP_MOPEN)
  940. Xcan be open at the same time.
  941. X.PP
  942. X.I Tpread
  943. Xreads one block into
  944. X.I buf
  945. Xto a maximum of
  946. X.I size
  947. Xcharacters. The rest of the block, if present, is skipped.
  948. XIt returns the number of
  949. Xcharacters read, or 0 for a tape mark, or -1 for an end-of-file.
  950. XOn a tape image file the end-of-file coincides with the actual end-of-file.
  951. XOn a real magtape or on a character device three conditions can cause
  952. Xan end-of-file:
  953. X.IP
  954. X4 consecutive tape marks,
  955. X.br
  956. X2 consecutive read errors, or
  957. X.br
  958. X1 read error preceded by a tape mark,
  959. X.PP
  960. Xunless "rx" was specified in the call of
  961. X.IR tpopen ,
  962. Xin which case only 100 consecutive read errors will cause an end-of-file
  963. X(to prevent the program from looping on end-of-reel).
  964. X.PP
  965. X.I Tpwrite
  966. Xwrites one block from
  967. X.I buf
  968. Xif
  969. X.I size
  970. X> 0, or a tape mark if
  971. X.I size
  972. X= 0.
  973. X.SH DIAGNOSTICS
  974. XIf an error condition (other than end-of-file) is found, a message is
  975. Xprinted on
  976. X.I stderr
  977. Xand the program exits. This default can be changed by calling
  978. X.I tperrout.
  979. X.SH AUTHOR
  980. XDick Grune.
  981. + END-OF-FILE mag.3
  982. chmod 'u=rw,g=r,o=r' \m\a\g\.\3
  983. set `sum \m\a\g\.\3`
  984. sum=$1
  985. case $sum in
  986. 40145)    :;;
  987. *)    echo 'Bad sum in '\m\a\g\.\3 >&2
  988. esac
  989. echo Extracting \a\u\x\.\h
  990. sed 's/^X//' > \a\u\x\.\h << '+ END-OF-FILE '\a\u\x\.\h
  991. X/*    This file is part of the magtape handling package MAG.
  992. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  993. X*/
  994. X
  995. X#define    char2int(c)    ((c)&0377)
  996. X#define    is_ascii95(c)    (040 <= (c) && (c) <= 0176)
  997. X#define    is_digit(c)    ('0' <= (c) && (c) <= '9')
  998. X#define    n_items(a)    (sizeof (a)/sizeof (a)[0])
  999. X
  1000. X/* a define that generates 2 parameters */
  1001. X#define    english(i)    (i), (i) == 1 ? "" : "s"    /* word with plural */
  1002. X
  1003. X#ifdef    lint
  1004. X/* this #define has the same syntactic properties as the original */
  1005. X#define    VOID(x)    if ((int)(x)) printf("")
  1006. X#else    lint
  1007. X#define    VOID(x)    (x)
  1008. X#endif    lint
  1009. + END-OF-FILE aux.h
  1010. chmod 'u=rw,g=r,o=r' \a\u\x\.\h
  1011. set `sum \a\u\x\.\h`
  1012. sum=$1
  1013. case $sum in
  1014. 47132)    :;;
  1015. *)    echo 'Bad sum in '\a\u\x\.\h >&2
  1016. esac
  1017. echo Extracting \t\p\.\h
  1018. sed 's/^X//' > \t\p\.\h << '+ END-OF-FILE '\t\p\.\h
  1019. X/*    This file is part of the magtape handling package MAG.
  1020. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1021. X*/
  1022. X
  1023. X#define    TP_MAXB    32766    /* largest size parameter to `read' & `write' */
  1024. X
  1025. X#define    TP_CDEV    (-1)
  1026. X#define    TP_IMAG    (-2)
  1027. X
  1028. X#define    TP_DENL    _tp_dnl
  1029. X#define    TP_DENN    _tp_dnn
  1030. X#define    TP_DENH    _tp_dnh
  1031. X
  1032. Xextern char _tp_dnl[], _tp_dnn[], _tp_dnh[];
  1033. X
  1034. Xstruct tpdes    {
  1035. X    int _tp_unit;        /* unit number or TP_IMAG  or TP_CDEV  */
  1036. X    char *_tp_nmdns;    /* density     or filename or filename */
  1037. X    char _tp_rw;        /* 'r' for reading, 'w' for writing */
  1038. X    char _tp_x;        /* 'x' for persistent, ' ' for normal */
  1039. X    char _tp_fildes;    /* file descriptor after `open' */
  1040. X
  1041. X    long _tp_blkc;        /* block counter */
  1042. X    int _tp_mkc;        /* accumulative TM counter */
  1043. X    int _tp_mc;        /* consecutive TM counter */
  1044. X    char _tp_eof;        /* EOF-flag */
  1045. X};
  1046. X#define    TPFILE    struct tpdes
  1047. X
  1048. Xextern TPFILE *tpopen();
  1049. X
  1050. + END-OF-FILE tp.h
  1051. chmod 'u=rw,g=r,o=r' \t\p\.\h
  1052. set `sum \t\p\.\h`
  1053. sum=$1
  1054. case $sum in
  1055. 45874)    :;;
  1056. *)    echo 'Bad sum in '\t\p\.\h >&2
  1057. esac
  1058. echo Extracting \t\p\l\o\c\.\h
  1059. sed 's/^X//' > \t\p\l\o\c\.\h << '+ END-OF-FILE '\t\p\l\o\c\.\h
  1060. X/*    This file is part of the magtape handling package MAG.
  1061. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1062. X*/
  1063. X
  1064. X/*    #define's which may require local modification */
  1065. X
  1066. X
  1067. X/*    1.    System code */
  1068. X/*    This string of at most 13 characters will be written in the
  1069. X    HDR1-label, to identify the system (organization) of origin.
  1070. X    DO USE YOURS!
  1071. X*/
  1072. X/* Ruler for length:    "1234567890123"    */
  1073. X#define    SYSCODE        "VU, Amsterdam"
  1074. X
  1075. X
  1076. X/*    2.    Names of tape devices */
  1077. X/*    The macros DEV_* define the names of the low-density,
  1078. X    normal-density and high-density tape devices, as double-strings.
  1079. X    The first string indicates the read name, the second the write
  1080. X    name; the unit number will be inserted at %d (using sprintf).
  1081. X*/
  1082. X#define    DEV_LOW        "/dev/rmt%d\0/dev/nrmt%d"
  1083. X#define    DEV_NORMAL    "/dev/rmt8\0/dev/nrmt8"
  1084. X#define    DEV_HIGH    "/dev/rmt%d\0/dev/nrmt%d"
  1085. X
  1086. X
  1087. X/*    3.    Special reading and writing */
  1088. X/*    The intricacies of reading and writing a block on tape are
  1089. X    somewhat system-dependent.  #define exactly one of the following.
  1090. X    
  1091. X    If your system is not described by this (which will be rare),
  1092. X    see  tprdloc.c, tpwloc.c and tpwtmloc.c  to see how to roll your own.
  1093. X*/
  1094. X#define    NORMAL    1        /* anything goes: VAX */
  1095. X#undef    EVEN    1        /* only even blocksize allowed: PDP11 */
  1096. X#undef    SWAB    1        /* bytes must be swapped: M 68000 */
  1097. X
  1098. + END-OF-FILE tploc.h
  1099. chmod 'u=rw,g=r,o=r' \t\p\l\o\c\.\h
  1100. set `sum \t\p\l\o\c\.\h`
  1101. sum=$1
  1102. case $sum in
  1103. 58969)    :;;
  1104. *)    echo 'Bad sum in '\t\p\l\o\c\.\h >&2
  1105. esac
  1106. echo Extracting \t\p\s\y\s\.\h
  1107. sed 's/^X//' > \t\p\s\y\s\.\h << '+ END-OF-FILE '\t\p\s\y\s\.\h
  1108. X/*    This file is part of the magtape handling package MAG.
  1109. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1110. X*/
  1111. X
  1112. X#define    _TP_PREF    8    /* size of length prefix in disk images */
  1113. X#define    _TP_MOPEN    2    /* max # of simultaneously open tape-files */
  1114. X
  1115. Xextern char *_tpname();
  1116. + END-OF-FILE tpsys.h
  1117. chmod 'u=rw,g=r,o=r' \t\p\s\y\s\.\h
  1118. set `sum \t\p\s\y\s\.\h`
  1119. sum=$1
  1120. case $sum in
  1121. 47628)    :;;
  1122. *)    echo 'Bad sum in '\t\p\s\y\s\.\h >&2
  1123. esac
  1124. echo Extracting \s\y\s\.\h
  1125. sed 's/^X//' > \s\y\s\.\h << '+ END-OF-FILE '\s\y\s\.\h
  1126. X/*    This file is part of the magtape handling package MAG.
  1127. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1128. X*/
  1129. X
  1130. Xextern char *sysdate();            /* today's date as YYDDD */
  1131. Xextern char *username();        /* a name for the user */
  1132. X
  1133. + END-OF-FILE sys.h
  1134. chmod 'u=rw,g=r,o=r' \s\y\s\.\h
  1135. set `sum \s\y\s\.\h`
  1136. sum=$1
  1137. case $sum in
  1138. 59579)    :;;
  1139. *)    echo 'Bad sum in '\s\y\s\.\h >&2
  1140. esac
  1141. echo Extracting \t\p\r\e\a\d\.\c
  1142. sed 's/^X//' > \t\p\r\e\a\d\.\c << '+ END-OF-FILE '\t\p\r\e\a\d\.\c
  1143. X/*    This file is part of the magtape handling package MAG.
  1144. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1145. X*/
  1146. X
  1147. X#include    "tp.h"
  1148. X#include    "tpsys.h"
  1149. X
  1150. Xint
  1151. Xtpread(tf, buf, size)
  1152. X    TPFILE *tf;
  1153. X    char *buf;
  1154. X{
  1155. X    int res;
  1156. X
  1157. X    if (tf->_tp_eof)
  1158. X        return -1;
  1159. X
  1160. X    if (tf->_tp_unit != TP_IMAG && tf->_tp_x == ' ' && tf->_tp_mc >= 4)
  1161. X        res = -1;
  1162. X    else
  1163. X        res = _tp_rd(tf, buf, size);
  1164. X
  1165. X    if (res > 0)    {
  1166. X        tf->_tp_blkc++;
  1167. X        tf->_tp_mc = 0;
  1168. X    }
  1169. X    else
  1170. X    if (res == 0)    {
  1171. X        tf->_tp_mkc++;
  1172. X        tf->_tp_mc++;
  1173. X        tf->_tp_blkc = 0;
  1174. X    }
  1175. X    else
  1176. X    if (res < 0)    {
  1177. X        tf->_tp_mc = 0;
  1178. X    }
  1179. X
  1180. X    return size < res ? size : res;
  1181. X}
  1182. X
  1183. Xint
  1184. X_tp_rd(tf, buf, size)
  1185. X    TPFILE *tf;
  1186. X    char *buf;
  1187. X{
  1188. X    int sz;
  1189. X
  1190. X    if (size <= 0)    {
  1191. X        static char ch;        /* substitute buffer */
  1192. X
  1193. X        buf = &ch;
  1194. X        size = 1;
  1195. X    }
  1196. X
  1197. X    if (tf->_tp_unit == TP_IMAG)    {
  1198. X        char pref[_TP_PREF];
  1199. X        int n;
  1200. X        char ch;
  1201. X
  1202. X        n = read(tf->_tp_fildes, pref, _TP_PREF);
  1203. X        if (n == 0)
  1204. X            return -1;
  1205. X        if (n != _TP_PREF)
  1206. X            goto Lformerr;
  1207. X        sz = 0;
  1208. X        for (n = 0; n < _TP_PREF; n++)    {
  1209. X            int dig = pref[n] - '0';
  1210. X            if (dig < 0 || dig > 9)
  1211. X                goto Lformerr;
  1212. X            sz = sz*10 + dig;
  1213. X        }
  1214. X        n = sz < size ? sz : size;
  1215. X        if (n > 0)
  1216. X            if (read(tf->_tp_fildes, buf, n) != n)
  1217. X                goto Lformerr;
  1218. X        while (sz-- > size)
  1219. X            if (read(tf->_tp_fildes, &ch, 1) != 1)
  1220. X                goto Lformerr;
  1221. X        return n;
  1222. X
  1223. X    Lformerr:
  1224. X        _tprwerr("tape image error", tf);
  1225. X        exit(1);
  1226. X    }
  1227. X    else    {
  1228. X        int erc = 0;
  1229. X
  1230. X        while ((sz = _tprdloc(tf, buf, size)) < 0)    {
  1231. X            _tprwerr("garbage", tf);
  1232. X            erc++;
  1233. X            if (tf->_tp_x == ' ' && (tf->_tp_mc > 0 || erc >= 2))
  1234. X                return -1;
  1235. X            if (tf->_tp_x == 'x' && (erc >= 100))
  1236. X                return -1;
  1237. X        }
  1238. X        return sz;
  1239. X    }
  1240. X    /*NOTREACHED*/
  1241. X}
  1242. + END-OF-FILE tpread.c
  1243. chmod 'u=rw,g=r,o=r' \t\p\r\e\a\d\.\c
  1244. set `sum \t\p\r\e\a\d\.\c`
  1245. sum=$1
  1246. case $sum in
  1247. 55300)    :;;
  1248. *)    echo 'Bad sum in '\t\p\r\e\a\d\.\c >&2
  1249. esac
  1250. echo Extracting \t\p\w\r\i\t\e\.\c
  1251. sed 's/^X//' > \t\p\w\r\i\t\e\.\c << '+ END-OF-FILE '\t\p\w\r\i\t\e\.\c
  1252. X/*    This file is part of the magtape handling package MAG.
  1253. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1254. X*/
  1255. X
  1256. X#include    "tp.h"
  1257. X#include    "tpsys.h"
  1258. X
  1259. Xtpwrite(tf, buf, size)
  1260. X    TPFILE *tf;
  1261. X    char *buf;
  1262. X{
  1263. X    if (tf->_tp_unit == TP_IMAG)    {
  1264. X        int i, n = size;
  1265. X        char pref[_TP_PREF];
  1266. X        for (i = _TP_PREF; i--; )    {
  1267. X            pref[i] = n % 10 + '0';
  1268. X            n = n / 10;
  1269. X        }
  1270. X        if (write(tf->_tp_fildes, pref, _TP_PREF) != _TP_PREF)
  1271. X            goto Lerr;
  1272. X        if (size > 0)
  1273. X            if (write(tf->_tp_fildes, buf, size) != size)
  1274. X                goto Lerr;
  1275. X    }
  1276. X    else    {
  1277. X        if (size == 0)
  1278. X            _tpwtmloc(tf);
  1279. X        else
  1280. X        if (_tpwloc(tf, buf, size) != size)
  1281. X            goto Lerr;
  1282. X    }
  1283. X
  1284. X    if (size == 0)    {
  1285. X        tf->_tp_mkc++;
  1286. X        tf->_tp_blkc = 0;
  1287. X    }
  1288. X    else    {
  1289. X        tf->_tp_blkc++;
  1290. X    }
  1291. X
  1292. X    return;
  1293. X
  1294. XLerr:
  1295. X    _tprwerr("write error", tf);
  1296. X    exit(1);
  1297. X}
  1298. + END-OF-FILE tpwrite.c
  1299. chmod 'u=rw,g=r,o=r' \t\p\w\r\i\t\e\.\c
  1300. set `sum \t\p\w\r\i\t\e\.\c`
  1301. sum=$1
  1302. case $sum in
  1303. 16659)    :;;
  1304. *)    echo 'Bad sum in '\t\p\w\r\i\t\e\.\c >&2
  1305. esac
  1306. echo Extracting \t\p\o\p\e\n\.\c
  1307. sed 's/^X//' > \t\p\o\p\e\n\.\c << '+ END-OF-FILE '\t\p\o\p\e\n\.\c
  1308. X/*    This file is part of the magtape handling package MAG.
  1309. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1310. X*/
  1311. X
  1312. X#include    "tp.h"
  1313. X#include    "tpsys.h"
  1314. X
  1315. XTPFILE *
  1316. Xtpopen(unit, nmdns, rwx)
  1317. X    char *nmdns, *rwx;
  1318. X{
  1319. X    char *name = (char *)0;
  1320. X    static TPFILE tflist[_TP_MOPEN];
  1321. X    TPFILE *tf;
  1322. X
  1323. X    for (tf = &tflist[0]; tf->_tp_fildes != 0; tf++)
  1324. X        if (tf == &tflist[_TP_MOPEN-1])    {
  1325. X            _tpopenerr(name, "too many tapes");
  1326. X        }
  1327. X
  1328. X    tf->_tp_unit = unit;
  1329. X    tf->_tp_nmdns = nmdns;
  1330. X    tf->_tp_rw = 'r';
  1331. X    tf->_tp_x = ' ';
  1332. X    while (*rwx)
  1333. X    switch (*rwx++)    {
  1334. X    case 'r':
  1335. X        tf->_tp_rw = 'r';
  1336. X        break;
  1337. X    case 'w':
  1338. X        tf->_tp_rw = 'w';
  1339. X        break;
  1340. X    case 'x':
  1341. X        tf->_tp_x = 'x';
  1342. X        break;
  1343. X    default:
  1344. X        _tpopenerr(name, "Bad option in tpopen");
  1345. X        break;
  1346. X    }
  1347. X    tf->_tp_blkc = tf->_tp_mkc = tf->_tp_mc = tf->_tp_eof = 0;
  1348. X
  1349. X    name = _tpname(tf);
  1350. X
  1351. X    if (tf->_tp_rw == 'w')    {
  1352. X        if ((tf->_tp_fildes = creat(name, 0666)) < 0)    {
  1353. X            _tpopenerr(name, "cannot create");
  1354. X        }
  1355. X    }
  1356. X           else    {
  1357. X               if ((tf->_tp_fildes = open(name, 0)) < 0)    {
  1358. X                   _tpopenerr(name, "cannot open");
  1359. X        }
  1360. X    }
  1361. X
  1362. X    return tf;
  1363. X}
  1364. + END-OF-FILE tpopen.c
  1365. chmod 'u=rw,g=r,o=r' \t\p\o\p\e\n\.\c
  1366. set `sum \t\p\o\p\e\n\.\c`
  1367. sum=$1
  1368. case $sum in
  1369. 33170)    :;;
  1370. *)    echo 'Bad sum in '\t\p\o\p\e\n\.\c >&2
  1371. esac
  1372. echo Extracting \t\p\c\l\o\s\e\.\c
  1373. sed 's/^X//' > \t\p\c\l\o\s\e\.\c << '+ END-OF-FILE '\t\p\c\l\o\s\e\.\c
  1374. X/*    This file is part of the magtape handling package MAG.
  1375. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1376. X*/
  1377. X
  1378. X#include    "aux.h"
  1379. X#include    "tp.h"
  1380. X#include    "tpsys.h"
  1381. X
  1382. Xtpclose(tf)
  1383. X    TPFILE *tf;
  1384. X{
  1385. X    VOID(close(tf->_tp_fildes));
  1386. X    if (tf->_tp_rw == 'w')    {
  1387. X        tf->_tp_rw = 'r';
  1388. X        VOID(close(open(_tpname(tf), 0)));
  1389. X    }
  1390. X    tf->_tp_fildes = 0;
  1391. X}
  1392. + END-OF-FILE tpclose.c
  1393. chmod 'u=rw,g=r,o=r' \t\p\c\l\o\s\e\.\c
  1394. set `sum \t\p\c\l\o\s\e\.\c`
  1395. sum=$1
  1396. case $sum in
  1397. 11552)    :;;
  1398. *)    echo 'Bad sum in '\t\p\c\l\o\s\e\.\c >&2
  1399. esac
  1400. echo Extracting \t\p\n\a\m\e\.\c
  1401. sed 's/^X//' > \t\p\n\a\m\e\.\c << '+ END-OF-FILE '\t\p\n\a\m\e\.\c
  1402. X/*    This file is part of the magtape handling package MAG.
  1403. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1404. X*/
  1405. X
  1406. X#include    "aux.h"
  1407. X#include    "tp.h"
  1408. X#include    "tpsys.h"
  1409. X
  1410. Xextern char *sprintf();
  1411. X
  1412. Xchar * /* transient */
  1413. X_tpname(tf)
  1414. X    TPFILE *tf;
  1415. X{
  1416. X    static char name[20];
  1417. X    int unit = tf->_tp_unit;
  1418. X    char *nmdns = tf->_tp_nmdns;
  1419. X
  1420. X    if (unit == TP_IMAG || unit == TP_CDEV)
  1421. X        return nmdns;
  1422. X    
  1423. X    /* a real magtape */
  1424. X    if (tf->_tp_rw == 'w')    {
  1425. X        /* find the second name */
  1426. X        while (*nmdns++)    {
  1427. X        }
  1428. X    }
  1429. X    VOID(sprintf(name, nmdns, unit));
  1430. X
  1431. X    return name;
  1432. X}
  1433. + END-OF-FILE tpname.c
  1434. chmod 'u=rw,g=r,o=r' \t\p\n\a\m\e\.\c
  1435. set `sum \t\p\n\a\m\e\.\c`
  1436. sum=$1
  1437. case $sum in
  1438. 04109)    :;;
  1439. *)    echo 'Bad sum in '\t\p\n\a\m\e\.\c >&2
  1440. esac
  1441. echo Extracting \t\p\e\r\r\.\c
  1442. sed 's/^X//' > \t\p\e\r\r\.\c << '+ END-OF-FILE '\t\p\e\r\r\.\c
  1443. X/*    This file is part of the magtape handling package MAG.
  1444. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1445. X*/
  1446. X
  1447. X#include    <stdio.h>
  1448. X#include    "aux.h"
  1449. X#include    "tp.h"
  1450. X#include    "tpsys.h"
  1451. X
  1452. XFILE *tperr = stderr;
  1453. X
  1454. Xtperrout(stream)
  1455. X    FILE *stream;
  1456. X{
  1457. X    tperr = stream;
  1458. X    setbuf(tperr, (char *)NULL);
  1459. X}
  1460. X
  1461. X_tpopenerr(name, msg)
  1462. X    char *name, *msg;
  1463. X{
  1464. X    if (name != NULL)
  1465. X        fprintf(tperr, "%s: ", name);
  1466. X    fprintf(tperr, "%s\n", msg);
  1467. X    exit(1);
  1468. X}
  1469. X
  1470. X_tprwerr(msg, tf)
  1471. X    char *msg;
  1472. X    TPFILE *tf;
  1473. X{
  1474. X    fprintf(tperr,
  1475. X        "After %d tape mark%s, after %ld block%s: %s on %s\n",
  1476. X        english(tf->_tp_mkc), english(tf->_tp_blkc), msg, _tpname(tf));
  1477. X}
  1478. + END-OF-FILE tperr.c
  1479. chmod 'u=rw,g=r,o=r' \t\p\e\r\r\.\c
  1480. set `sum \t\p\e\r\r\.\c`
  1481. sum=$1
  1482. case $sum in
  1483. 24399)    :;;
  1484. *)    echo 'Bad sum in '\t\p\e\r\r\.\c >&2
  1485. esac
  1486. echo Extracting \t\p\l\o\c\.\c
  1487. sed 's/^X//' > \t\p\l\o\c\.\c << '+ END-OF-FILE '\t\p\l\o\c\.\c
  1488. X/*    This file is part of the magtape handling package MAG.
  1489. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1490. X*/
  1491. X
  1492. X#include    "tploc.h"
  1493. X
  1494. X/* The tape device names */
  1495. Xchar _tp_dnl[] = DEV_LOW;
  1496. Xchar _tp_dnn[] = DEV_NORMAL;
  1497. Xchar _tp_dnh[] = DEV_HIGH;
  1498. + END-OF-FILE tploc.c
  1499. chmod 'u=rw,g=r,o=r' \t\p\l\o\c\.\c
  1500. set `sum \t\p\l\o\c\.\c`
  1501. sum=$1
  1502. case $sum in
  1503. 02816)    :;;
  1504. *)    echo 'Bad sum in '\t\p\l\o\c\.\c >&2
  1505. esac
  1506. echo Extracting \t\p\r\d\l\o\c\.\c
  1507. sed 's/^X//' > \t\p\r\d\l\o\c\.\c << '+ END-OF-FILE '\t\p\r\d\l\o\c\.\c
  1508. X/*    This file is part of the magtape handling package MAG.
  1509. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1510. X*/
  1511. X
  1512. X#include    "tp.h"
  1513. X#include    "tploc.h"
  1514. X#include    "tpsys.h"
  1515. X
  1516. X/*
  1517. X * _tprdloc reads one block from a character device.
  1518. X * It must take care of local restrictions.
  1519. X */
  1520. X
  1521. Xint
  1522. X_tprdloc(tf, buf, size)
  1523. X    TPFILE *tf;
  1524. X    char *buf;
  1525. X{
  1526. X    int sz;
  1527. X    
  1528. X#ifdef    NORMAL
  1529. X    /* This is the VAX version, anything goes. */
  1530. X    sz = read(tf->_tp_fildes, buf, size);
  1531. X#endif    NORMAL
  1532. X
  1533. X#ifdef    EVEN
  1534. X    /* This is the PDP version, even block size required. */
  1535. X    {
  1536. X        /* if odd, read one char more */
  1537. X        char ch = buf[size];        /* save the original */
  1538. X        sz = read(tf->_tp_fildes, buf, size % 2 ? size + 1 : size);
  1539. X        sz = (sz > size ? size : sz);
  1540. X        buf[size] = ch;            /* restore the original */
  1541. X    }
  1542. X#endif    EVEN
  1543. X
  1544. X#ifdef    SWAB
  1545. X    /* Modified 12/30/84 gertjan */
  1546. X    /* This is the Motorola version (bytes are swabbed). */
  1547. X    {
  1548. X        static char swab_buf[TP_MAXB];    /* too big for the stack */
  1549. X        sz = read(tf->_tp_fildes, swab_buf, size);
  1550. X        swab(swab_buf, buf, size);
  1551. X    }
  1552. X#endif    SWAB
  1553. X
  1554. X    return sz;
  1555. X}
  1556. + END-OF-FILE tprdloc.c
  1557. chmod 'u=rw,g=r,o=r' \t\p\r\d\l\o\c\.\c
  1558. set `sum \t\p\r\d\l\o\c\.\c`
  1559. sum=$1
  1560. case $sum in
  1561. 11454)    :;;
  1562. *)    echo 'Bad sum in '\t\p\r\d\l\o\c\.\c >&2
  1563. esac
  1564. echo Extracting \t\p\w\l\o\c\.\c
  1565. sed 's/^X//' > \t\p\w\l\o\c\.\c << '+ END-OF-FILE '\t\p\w\l\o\c\.\c
  1566. X/*    This file is part of the magtape handling package MAG.
  1567. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1568. X*/
  1569. X
  1570. X#include    "tp.h"
  1571. X#include    "tploc.h"
  1572. X#include    "tpsys.h"
  1573. X
  1574. X/*
  1575. X * _tpwloc writes one block of non-zero length to a character device.
  1576. X * It must take care of local restrictions.
  1577. X */
  1578. X
  1579. Xint
  1580. X_tpwloc(tf, buf, size)
  1581. X    TPFILE *tf;
  1582. X    char *buf;
  1583. X{
  1584. X    register int sz;
  1585. X    
  1586. X#ifdef    NORMAL
  1587. X    /* This is the VAX version (anything goes). */
  1588. X    sz = write(tf->_tp_fildes, buf, size);
  1589. X#endif    NORMAL
  1590. X
  1591. X#ifdef    EVEN
  1592. X    /* This is the PDP11/45 version (even block size). */
  1593. X    /* if odd, write one char more */
  1594. X    sz = write(tf->_tp_fildes, buf, size % 2 ? size + 1 : size);
  1595. X    sz = (sz > size ? size : sz);
  1596. X#endif    EVEN
  1597. X
  1598. X#ifdef    SWAB
  1599. X    /* Modified 12/30/84 gertjan */
  1600. X    /* This is the Motorola version (bytes are swabbed). */
  1601. X    {
  1602. X        static char swab_buf[TP_MAXB];    /* too big for the stack */
  1603. X        swab(buf, swab_buf, size);
  1604. X        sz = write(tf->_tp_fildes, swab_buf, size);
  1605. X    }
  1606. X#endif    SWAB
  1607. X    
  1608. X    return sz;
  1609. X}
  1610. + END-OF-FILE tpwloc.c
  1611. chmod 'u=rw,g=r,o=r' \t\p\w\l\o\c\.\c
  1612. set `sum \t\p\w\l\o\c\.\c`
  1613. sum=$1
  1614. case $sum in
  1615. 63369)    :;;
  1616. *)    echo 'Bad sum in '\t\p\w\l\o\c\.\c >&2
  1617. esac
  1618. echo Extracting \t\p\w\t\m\l\o\c\.\c
  1619. sed 's/^X//' > \t\p\w\t\m\l\o\c\.\c << '+ END-OF-FILE '\t\p\w\t\m\l\o\c\.\c
  1620. X/*    This file is part of the magtape handling package MAG.
  1621. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1622. X*/
  1623. X
  1624. X#include    "aux.h"
  1625. X#include    "tp.h"
  1626. X#include    "tpsys.h"
  1627. X
  1628. X/*
  1629. X * _tpwtmloc writes a tape mark to a character device.
  1630. X * It must take care of the local restrictions.
  1631. X */
  1632. X
  1633. X_tpwtmloc(tf)
  1634. X    TPFILE *tf;
  1635. X{
  1636. X    VOID(close(tf->_tp_fildes));
  1637. X    tf->_tp_fildes = open(_tpname(tf), 1);
  1638. X}
  1639. + END-OF-FILE tpwtmloc.c
  1640. chmod 'u=rw,g=r,o=r' \t\p\w\t\m\l\o\c\.\c
  1641. set `sum \t\p\w\t\m\l\o\c\.\c`
  1642. sum=$1
  1643. case $sum in
  1644. 18915)    :;;
  1645. *)    echo 'Bad sum in '\t\p\w\t\m\l\o\c\.\c >&2
  1646. esac
  1647. echo Extracting \s\y\s\.\c
  1648. sed 's/^X//' > \s\y\s\.\c << '+ END-OF-FILE '\s\y\s\.\c
  1649. X/*    This file is part of the magtape handling package MAG.
  1650. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1651. X*/
  1652. X
  1653. X/*    This file declares the routines that interface to the operating
  1654. X    system beside those that do tape I/O.
  1655. X    
  1656. X    sysdate()    returns a transient pointer to today's date in the
  1657. X            format YYDDD, e.g. 86365 for the last day of 1986.
  1658. X    username()    returns a transient pointer to a readable form of
  1659. X            the name of the user/owner. At most 14 chars will
  1660. X            be used.
  1661. X*/
  1662. X
  1663. X#include    "aux.h"
  1664. X
  1665. X#include    <sys/types.h>
  1666. X#include    <pwd.h>
  1667. X#include    <time.h>
  1668. X
  1669. Xextern time_t time();
  1670. Xextern struct tm *localtime();
  1671. Xextern struct passwd *getpwuid();
  1672. Xextern char *sprintf();
  1673. X
  1674. Xchar * /* transient */
  1675. Xsysdate()    {            /* today's date as YYDDD */
  1676. X    time_t tnow = time((time_t*)0);
  1677. X    struct tm *timeptr = localtime(&tnow);
  1678. X    static char today[6];
  1679. X    
  1680. X    VOID(sprintf(today, "%02d%03d",
  1681. X                timeptr->tm_year, timeptr->tm_yday+1));
  1682. X    return today;
  1683. X}
  1684. X
  1685. Xchar * /* transient */
  1686. Xusername()    {        /* user name, if available, else NULL */
  1687. X    struct passwd *pwd = getpwuid(getuid()); /* is transient already */
  1688. X    
  1689. X    return pwd == ((struct passwd *)0) ? ((char *)0) : pwd->pw_name;
  1690. X}
  1691. X
  1692. + END-OF-FILE sys.c
  1693. chmod 'u=rw,g=r,o=r' \s\y\s\.\c
  1694. set `sum \s\y\s\.\c`
  1695. sum=$1
  1696. case $sum in
  1697. 16535)    :;;
  1698. *)    echo 'Bad sum in '\s\y\s\.\c >&2
  1699. esac
  1700. echo Extracting \t\p\d\u\m\m\y\.\c
  1701. sed 's/^X//' > \t\p\d\u\m\m\y\.\c << '+ END-OF-FILE '\t\p\d\u\m\m\y\.\c
  1702. X/*    This file is part of the magtape handling package MAG.
  1703. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1704. X*/
  1705. X
  1706. X#include    <stdio.h>
  1707. X#include    "aux.h"
  1708. X#include    "tp.h"
  1709. X#include    "sys.h"
  1710. X
  1711. Xint unit = 0;
  1712. Xchar *nmdns = TP_DENN;
  1713. Xchar *rx = "r";
  1714. XTPFILE *from, *to;
  1715. Xchar *filename;
  1716. Xint size;
  1717. Xchar buff[TP_MAXB];
  1718. X
  1719. Xmain(argc, argv)
  1720. X    char *argv[];
  1721. X{
  1722. X    argc--, argv++;
  1723. X    while (argc > 0 && argv[0][0] == '-')    {
  1724. X        char *pp = argv[0];
  1725. X        
  1726. X        while (*++pp)    {
  1727. X            switch (*pp)    {
  1728. X            /* insert cases to handle the standard options */
  1729. X#include    "options.h"
  1730. X            /* special options */
  1731. X            }
  1732. X        }
  1733. X        argc--, argv++;
  1734. X    }
  1735. X    
  1736. X    printf("%s, %s\n", sysdate(), username());
  1737. X    tperrout(stdout);
  1738. X    from = tpopen(unit, nmdns, rx);
  1739. X    to = tpopen(TP_IMAG, filename, "w");
  1740. X
  1741. X    while ((size = tpread(from, buff, TP_MAXB)) >= 0)    {
  1742. X        tpwrite(to, buff, size);
  1743. X    }
  1744. X    tpclose(from);
  1745. X    tpclose(to);
  1746. X    exit(0);
  1747. X
  1748. XLbad:
  1749. X    exit(1);
  1750. X}
  1751. + END-OF-FILE tpdummy.c
  1752. chmod 'u=rw,g=r,o=r' \t\p\d\u\m\m\y\.\c
  1753. set `sum \t\p\d\u\m\m\y\.\c`
  1754. sum=$1
  1755. case $sum in
  1756. 38785)    :;;
  1757. *)    echo 'Bad sum in '\t\p\d\u\m\m\y\.\c >&2
  1758. esac
  1759. echo Extracting \l\l\i\b\-\l\m\a\g\.\c
  1760. sed 's/^X//' > \l\l\i\b\-\l\m\a\g\.\c << '+ END-OF-FILE '\l\l\i\b\-\l\m\a\g\.\c
  1761. X/*    This file is part of the magtape handling package MAG.
  1762. X    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1763. X*/
  1764. X
  1765. X/*LINTLIBRARY*/
  1766. X#include    <stdio.h>
  1767. X#include    "tp.h"
  1768. X
  1769. XTPFILE *tpopen(unit, nmdns, rwx) char *nmdns, *rwx;
  1770. X{return tpopen(unit, nmdns, rwx);}
  1771. X
  1772. Xtpclose(tf) TPFILE *tf;
  1773. X{tpclose(tf); return;}
  1774. X
  1775. Xint tpread(tf, buf, size) TPFILE *tf; char *buf;
  1776. X{return tpread(tf, buf, size);}
  1777. X
  1778. Xtpwrite(tf, buf, size) TPFILE *tf; char *buf;
  1779. X{tpwrite(tf, buf, size); return;}
  1780. X
  1781. Xtperrout(stream) FILE *stream;
  1782. X{tperrout(stream); return;}
  1783. X
  1784. Xchar *sysdate()
  1785. X{return sysdate();}
  1786. X
  1787. Xchar *username()
  1788. X{return username();}
  1789. X
  1790. Xchar TP_DENL[];
  1791. Xchar TP_DENN[];
  1792. Xchar TP_DENH[];
  1793. X
  1794. Xchar _etoa[];
  1795. + END-OF-FILE llib-lmag.c
  1796. chmod 'u=rw,g=r,o=r' \l\l\i\b\-\l\m\a\g\.\c
  1797. set `sum \l\l\i\b\-\l\m\a\g\.\c`
  1798. sum=$1
  1799. case $sum in
  1800. 13145)    :;;
  1801. *)    echo 'Bad sum in '\l\l\i\b\-\l\m\a\g\.\c >&2
  1802. esac
  1803. exit 0
  1804.  
  1805. -- 
  1806.  
  1807. Rich $alz            "Anger is an energy"
  1808. Cronus Project, BBN Labs    rsalz@bbn.com
  1809. Moderator, comp.sources.unix    sources@uunet.uu.net
  1810.