home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume19 / shape / part08 < prev    next >
Text File  |  1989-05-31  |  51KB  |  1,606 lines

  1. Subject:  v19i021:  A software configuration management system, Part08/33
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Axel Mahler <unido!coma!axel>
  7. Posting-number: Volume 19, Issue 21
  8. Archive-name: shape/part08
  9.  
  10.  
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of archive 8 (of 33)."
  19. # Contents:  man/man1/sbmt.1 man/man1/vfind.1 src/afsit/afsit.1
  20. #   src/vc/sighand.c src/vc/util.c src/vc/vadm_gkeys.c
  21. # Wrapped by rsalz@papaya.bbn.com on Thu Jun  1 19:26:56 1989
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'man/man1/sbmt.1' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'man/man1/sbmt.1'\"
  25. else
  26. echo shar: Extracting \"'man/man1/sbmt.1'\" \(7936 characters\)
  27. sed "s/^X//" >'man/man1/sbmt.1' <<'END_OF_FILE'
  28. X...
  29. X... Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  30. X...  and U. Pralle
  31. X... 
  32. X... This software is published on an as-is basis. There is ABSOLUTELY NO
  33. X... WARRANTY for any part of this software to work correctly or as described
  34. X... in the manuals. We do not accept any liability for any kind of damage
  35. X... caused by use of this software, such as loss of data, time, money, or 
  36. X... effort.
  37. X... 
  38. X... Permission is granted to use, copy, modify, or distribute any part of
  39. X... this software as long as this is done without asking for charge, and
  40. X... provided that this copyright notice is retained as part of the source
  41. X... files. You may charge a distribution fee for the physical act of
  42. X... transferring a copy, and you may at your option offer warranty
  43. X... protection in exchange for a fee.
  44. X... 
  45. X... Direct questions to: Tech. Univ. Berlin
  46. X...              Wilfried Koch
  47. X...              Sekr. FR 5-6 
  48. X...              Franklinstr. 28/29
  49. X...              D-1000 Berlin 10, West Germany
  50. X... 
  51. X...              Tel: +49-30-314-22972
  52. X...              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  53. X... 
  54. X...
  55. X... $Header: save.1[3.1] Thu Feb 23 18:13:51 1989 axel@coma published $
  56. X... 
  57. X... Log for /u/shape/dist-tape/src/vc/save.1[3.0]
  58. X...     Thu Feb 23 18:13:51 1989 axel@coma published $
  59. X...  --- empty log message ---
  60. X...  save.1[3.1] Thu Feb 23 18:13:51 1989 axel@coma published $
  61. X...  --- empty log message ---
  62. X...
  63. X.TH SAVE 1 save \n(dy.\n(mo.\n(yr
  64. X.SH NAME
  65. Xsave \- save revision of a file
  66. X.SH SYNOPSIS
  67. X.IP \fBsave\fR \w'\fBSave++\fR'u
  68. X[\ \fIoptions\fR\ ]\ files \.\|.
  69. X.IP \fBSave\fR
  70. X[\ \fIoptions\fR\ ]\ files \.\|.
  71. X.IP \fBsbmt\fR
  72. X[\ \fIoptions\fR\ ]\ files \.\|.
  73. X.IP \fIOptions:\fR \w'\fIOptions:++\fR'u
  74. X[\ \fB\-fhqu\fR\ ]\ [\ \fB\-a\ \fIafile\fR\ ] [\ \fB\-m\ \fImessage\fR\ ]
  75. X[\ \fB\-n\ \fIname\fR\ ] [\ \fB\-p\ \fIprojectname\fR\ ] 
  76. X.br
  77. X[\ \fB\-setvnum\ \fIversion\fR\ ]
  78. X[\ \fB\-t\ \fItextfile\fR\ ]\ [\ \fB\-unlock\fR\ ]\ [\ \fB\-version\fR\ ]
  79. X.SH DESCRIPTION
  80. X.PP
  81. X\fISave\fR stores the current state of the specified files into 
  82. Xarchive files and
  83. Xassigns a unique \fIversion number\fR to the saved version. Versions
  84. Xin archives are inalterable.
  85. XAn archive will be created
  86. Xin a subdirectory named \fIAFS\fR the first time a file saved.
  87. XThe AFS subdirectory must be present.
  88. XWhen an archive is created, save asks for the purpose
  89. Xof the saved document. If a subsequent version is saved, the user
  90. Xis prompted for a comment concerning the modifications.
  91. XThe \fBsave\fR command requires that the object history corresponding
  92. Xto the file to be saved is either \fIlocked\fR by the user
  93. Xissuing the command or not locked at all.
  94. XBefore a file is saved it will be checked whether it has actually 
  95. Xchanged. If the file hasn't changed, the user will be asked if it
  96. Xshould be saved anyway. The command line option \fB\-f\fR overrides the query.
  97. XA newly created object version in the archive will be assigned the
  98. Xstate \fIsaved\fR. This status marks the lowest level of quality,
  99. Xsuggesting that the version is just saved for possible later retrieval 
  100. Xbut may be inconsistent. Versions that meet higher quality standards
  101. X(or are part of a release) should be marked by appropriate status
  102. X(see \fBvadm\fR \-promote\fR or \fBsbmt\fR).
  103. X.PP
  104. XIf the program is invoked as \fBSave\fR (that is with capital-S) 
  105. Xa \fInew generation\fR of the document history is initiated \-
  106. Xprovided the programmer issuing the command has the permission to do this.
  107. X.PP
  108. XIf the program is invoked as \fBsbmt\fR, a newly created version
  109. Xwill be set to status \fIpublished\fR. If the file to be saved
  110. Xis unchanged with respect to the last saved version, the status
  111. Xof the last saved version will be promoted to \fIpublished\fR.
  112. X.LP
  113. XIn complete detail, \fBsave\fR can be invoked with the following options:
  114. X.IP \fB\-f\fR \w'\fB\-p\ \fIproject++\fR'u
  115. Xforces a revision deposit (i.e. without asking), even if the busy
  116. Xversion hasn't changed since the last time it was saved.
  117. X.IP \fB\-h\fR
  118. Xprint short information about usage of this command.
  119. X.IP \fB\-q\fR
  120. Xquiet operation. No messages are printed on standard output. 
  121. XIf the busy version is unchanged, it will not be saved unless
  122. X\fB\-f\fR is set. The user will not be prompted for a descriptive
  123. Xnote. If no message or note is supplied with the command line 
  124. X(see options \fB\-m\fR and \fB\-t\fR) the log
  125. Xwill remain empty. This option is useful for batch operation.
  126. X.IP \fB\-u\fR
  127. Xunlock object history upon save. This option is identical to 
  128. X\fB\-unlock\fR (see below).
  129. X.IP \fB\-a\ \fIafile\fR
  130. Xassign all the attributes specified in \fIafile\fR to the evolving
  131. Xnew versions. Attributes must be given in the form \fIname=value\fR
  132. Xwith one attribute specification per line and no white-space.
  133. XWhile the attribute value is optional, the \fIequal\fR symbol must
  134. Xbe present. If the \fB\-a\fR option is omitted, \fBsave\fR searches
  135. Xthe environment for a variable \fISVATTRS\fR. If this variable
  136. Xis absent, no user defined attributes will be assigned to the evolving
  137. Xversions.
  138. X.IP \fB\-m\ \fImessage\fR
  139. Xsets \fImessage\fR as descriptive note for all document versions 
  140. Xthat result from the invocation of \fBsave\fR. This option is alternative
  141. Xto \fB\-t\fR which overrides \fB\-m\fR.
  142. X.IP \fB\-n\ \fIname\fR
  143. Xassigns a symbolic name \fIname\fR to the saved version. In more detail,
  144. Xan attribute \fISYMNAME\fR is set to the value specified in \fIname\fR.
  145. XThe specified symbolic name must not be assigned to any other version
  146. Xwithin the same object history.
  147. X.IP \fB\-p\ \fIproject\fR
  148. Xspecifies the name of a project to provide a \fIproject context\fR
  149. Xin which the save operation takes place. This project context may 
  150. Xdetermine a number of addtional parameters that affect the overall
  151. Xbehaviour of the save command. Such parameters might be
  152. Xa set of standard attributes that are to be assigned to evolving versions
  153. Xcertain permissions or some general project policy.
  154. X.br
  155. X\fHUNIMPLEMENTED FEATURE.\fR
  156. X.IP \fB\-setvnum\ \fI<version>\fR
  157. Xsets the version number of the newly created revision to \fIversion\fR.
  158. XThe \fIversion\fR must be given in the format \fI<generation>.<revision>\fR
  159. Xwhere \fIgeneration\fR and \fIrevision\fR are integers. Example:
  160. X.RS
  161. X.DS
  162. X\fCsave -setvnum 4.3 mkattr.c\fR
  163. X.DE
  164. XThe specified \fIversion\fR must be greater than the highest previously
  165. Xassigned version number in a given object history. \fB\-setvnum\fR
  166. Xis useful for keeping consistent version numbering across related, physically
  167. Xdifferent object bases, or for converting archive formats of other
  168. Xrevision control systems to this toolkit (see: \fBrcs2afs\fR).
  169. X.RE
  170. X.IP \fB\-t\ \fIfile\fR
  171. Xsets the text contained in \fIfile\fR as descriptive note for all document
  172. Xversions that result from the invocation of \fBsave\fR. This option is
  173. Xalternative to \fB\-m\fR which is superseded by \fB\-t\fR.
  174. X.IP \fB\-unlock\fR
  175. Xgives up the lock for the object history into which the new revision
  176. Xof a file is saved. Upon unlocking the history, the user is prompted 
  177. Xfor a description of the applied changes with the original \fIchange 
  178. Xintent\fR (see \fBretrv \-lock\fR and \fBvadm -lock\fR) as initial
  179. Xcomment. This comment might be edited appropriately. The change intention
  180. Xis cleared afterwards.
  181. X.IP \fB\-version\fR
  182. Xprints the version of the program itself.
  183. X.SH FILES
  184. XAll revisions of documents are stored in archive files in the subdirectory
  185. XAFS.
  186. X.SH SEE ALSO
  187. Xretrv(1), rsrv(1), sbmt(1), shape(1), vadm(1), vl(1), 
  188. Xaf_intro(3), af_archive(5)
  189. X.SH BUGS
  190. XProject support is unimplemented.
  191. X.PP
  192. XSupport of user-defined attributes is rudimentary. Specification of such
  193. Xattributes must be syntactically correct.
  194. X.PP
  195. X\fBsave\fR neither reads the \fIShapefile\fR nor the \fIMakefile\fR and
  196. Xconsequently sticks with the 'individual document level' rather than to
  197. Xsupport the saving of entire systems or subsystems (higer level targets
  198. Xin \fI{Shape,Make}file\fRs).
  199. X.SH AUTHOR
  200. XAxel Mahler
  201. X.br
  202. XTechnical University Berlin
  203. X.sp
  204. X\fIUUCP:\fR        axel@coma.uucp (unido!coma!axel)
  205. X.br
  206. X\fIBITNET:\fR    axel@db0tui62
  207. END_OF_FILE
  208. if test 7936 -ne `wc -c <'man/man1/sbmt.1'`; then
  209.     echo shar: \"'man/man1/sbmt.1'\" unpacked with wrong size!
  210. fi
  211. # end of 'man/man1/sbmt.1'
  212. fi
  213. if test -f 'man/man1/vfind.1' -a "${1}" != "-c" ; then 
  214.   echo shar: Will not clobber existing file \"'man/man1/vfind.1'\"
  215. else
  216. echo shar: Extracting \"'man/man1/vfind.1'\" \(7070 characters\)
  217. sed "s/^X//" >'man/man1/vfind.1' <<'END_OF_FILE'
  218. X...
  219. X... Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  220. X...  and U. Pralle
  221. X... 
  222. X... This software is published on an as-is basis. There is ABSOLUTELY NO
  223. X... WARRANTY for any part of this software to work correctly or as described
  224. X... in the manuals. We do not accept any liability for any kind of damage
  225. X... caused by use of this software, such as loss of data, time, money, or 
  226. X... effort.
  227. X... 
  228. X... Permission is granted to use, copy, modify, or distribute any part of
  229. X... this software as long as this is done without asking for charge, and
  230. X... provided that this copyright notice is retained as part of the source
  231. X... files. You may charge a distribution fee for the physical act of
  232. X... transferring a copy, and you may at your option offer warranty
  233. X... protection in exchange for a fee.
  234. X... 
  235. X... Direct questions to: Tech. Univ. Berlin
  236. X...              Wilfried Koch
  237. X...              Sekr. FR 5-6 
  238. X...              Franklinstr. 28/29
  239. X...              D-1000 Berlin 10, West Germany
  240. X... 
  241. X...              Tel: +49-30-314-22972
  242. X...              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  243. X... 
  244. X...
  245. X... $Header: vfind.1[1.2] Tue Feb 21 20:23:01 1989 uli@coma published $
  246. X...
  247. X... Log for /u/shape/dist-tape/src/vfind/vfind.1[1.2]
  248. X...    Tue Feb 21 20:23:01 1989 uli@coma published $
  249. X...     * This is the manual page for vfind.
  250. X... 
  251. X... 
  252. X...
  253. X.TH VFIND 1 "vfind1[1.2] published"
  254. X.SH NAME
  255. Xvfind \- find attributed software objects (aso)
  256. X.SH SYNOPSIS
  257. X\fBvfind\fR [\ \fIoptions\fR\ ] \fIpathname-list\ expression\fR
  258. X.PP
  259. X.SH DESCRIPTION
  260. X\fBVfind\fR recursively descends the directory hierarchy for each pathname
  261. Xin the pathname-list seeking asos that match a boolean expression
  262. Xwritten in the primaries given below. In the description, the argument
  263. X\fIn\fR is used as a decimal integer where \fI+n\fR means more than
  264. X\fIn\fR, \fI\-n\fR means less than \fIn\fR and \fIn\fR means exactly
  265. X\fIn\fR.
  266. X.PP
  267. XThe following \fIoptions\fR are recognized:
  268. X.IP "\fB\-version\fR"
  269. Xprint version information about the \fBvfind\fR program itself. No
  270. Xother action given will be performed.
  271. X.IP "\fB\-h\fR"
  272. Xprint brief instructions about using \fBvfind\fR.
  273. X.IP "\fB\-bpool\fR"
  274. Xmatch a boolean expression also for aso residing in the \fIbinary
  275. Xpool\fR.
  276. X.IP "\fB\-prune\fR"
  277. Xcauses \fBvfind\fR not to descend the filesystem hierarchy.
  278. X.IP "\fB\-force\fR"
  279. XfBVfind\fR normally ignores saved asos iff a AFS directory is a
  280. Xsymbolic link. If the \fB\-force\R option is given \fBvfind\fR
  281. Xtakes also symbolic AFS directories into consideration.
  282. X.PP
  283. XThe following \fIprimaries\fR are recognized:
  284. X.IP "\fB\-atime\fR n"
  285. XTrue if the aso has been accessed in \fIn\fR days.
  286. X.IP "\fB\-ctime\fR n"
  287. XTrue if status of the aso has been changed in \fIn\fR days.
  288. X.IP "\fB\-mtime\fR n"
  289. XTrue if the aso has been modified in \fIn\fR days.
  290. X.IP "\fB\-stime\fR n"
  291. XTrue if the aso has been saved in \fIn\fR days.
  292. X.IP "\fB\-ltime\fR n"
  293. XTrue if the aso has been locked in \fIn\fR days.
  294. X.IP "\fB\-exec\fR command"
  295. XTrue if the executed command returns a zero value as exit status. The
  296. Xend of the command must be punctated by an ecscaped semicolon. A
  297. Xcommand argument `{}' is replaced by the system name of the current aso.
  298. X.IP "\fB\-vl\fR"
  299. XAlways true; causes the current aso to be printed together with its
  300. Xassociated statistics. This include protection mode, \fIAFS\fR version
  301. Xstate, user, host, size in bytes, modification time respectively
  302. Xsaving time. The format is identical to that of ``vl -l''.
  303. X.IP "\fB\-name\fR name"
  304. XTrue if the name argument matches the filename component of the
  305. Xcurrent aso. Normal Shell argument syntax may be used if escaped.
  306. X.IP "\fB\-perm\fR onum"
  307. XTrue if the aso permission flags exactly match the octal numer
  308. X\fIonum\fR. If \fIonum\fR is prefixed by a minus sign, more flag bits
  309. X(017777) become significant and the flags are compared:
  310. X\fI(flags&onum)==onum\fR.
  311. X.IP "\fB\-print\fR"
  312. XAlways true; causes the system path of the current aso to be printed.
  313. X.IP "\fB\-symbolic\fR name"
  314. XTrue if the current aso has the symbolic name \fIname\fR. See \fBvadm(1)\fR
  315. Xor \fBsave(1)\fR on how to attach a symbolic name to an aso.
  316. X.IP "\fB\-state\fR state"
  317. XTrue if the state of the current aso matches state
  318. X\fIstate\fR, where \fIstate\fR is \fBbusy\fR, \fBsave\fR, \fBproposed\fR,
  319. X\fBpublished\fR, \fBaccessed\fR, or \fBfrozen\fR.
  320. X.IP "\fB\-type\fR c"
  321. XTrue if the type of the current aso is \fIc\fR, where c is \fBb\fR, \fBc\fR,
  322. X\fBd\fR, \fBf\fR, \fBl\fR, or \fBs\fR for block special file,
  323. Xcharacter special file, directory, plain file, symbolic link, or socket.
  324. X.IP "\fB\-uda\fR uda"
  325. XTrue if the current \fBaso\fR has an user defined attribute matching
  326. Xuda \fIuda\fR, where \fIuda\fR is of the form \fIname[=value]\fR.
  327. X.IP "\fB\-user\fR user"
  328. XTrue if the current aso belongs to user \fIuser\fR, where \fIuser\fR is a
  329. Xlogin name optinally followed by a host name (e.g. uli@coma).
  330. X.IP "\fB\-locked\fR"
  331. XTrue if the current aso is locked.
  332. X.IP "\fB\-locker\fR user"
  333. XTrue if the current aso is locked bye user \fIuser\fR, where
  334. X\fIuser\fR is a login name optionally followed by a host name.
  335. X.IP "\fB\-eq\fR vnum"
  336. XTrue if the version number of the current aso matches version number
  337. X\fIvnum\fR, where \fIvnum\fR is \fIgeneration.revision\fR.
  338. X.IP "\fB\-lt\fR vnum"
  339. XTrue if the version number of the current aso is less than the version number
  340. X\fIvnum\fR.
  341. X.IP "\fB\-le\fR vnum"
  342. XTrue if the version number of the current aso is less equal than the
  343. Xversion number \fIvnum\fR.
  344. X.IP "\fB\-gt\fR vnum"
  345. XTrue if the version number of the current aso is greater than the
  346. Xversion number \fIvnum\fR.
  347. X.IP "\fB\-ge\fR vnum"
  348. XTrue if the version number of the current aso is greater equal than the
  349. Xversion number \fIvnum\fR.
  350. X.PP
  351. XThe primaries may be combined using the operators \fB(\fR, \fB)\fR for
  352. Xgrouping, \fB!\fR for negation, \fB\-a\fR for concatenation (may be
  353. Xomitted) and \fB-o\fR for alternation of primaries. Parentheses and
  354. Xthe exclamation mark are special to the Shell and must be escaped.
  355. X.PP
  356. X\fBvfind\fR does not descent AFS directories, so the AFS
  357. Xarchives are never selected.
  358. X.SH EXAMPLES
  359. X.PP
  360. XTo find all asos whose state is busy and that have the symbolic
  361. Xname "foobar":
  362. X.IP
  363. Xvfind / \-state busy \-symbolic foobar \-print
  364. X.IP
  365. X.SH SEE ALSO
  366. Xsave(1), retrv(1), sbmt(1), vl(1), shape(1), find(1), vadm(1),
  367. Xaf_intro(3), af_archive(5)
  368. X.PP
  369. XRecommended reading: A. Mahler, A. Lampen, \fI\(lqAn Integrated
  370. XToolkit for Engineering Software Configurations\(rq\fR, Proceedings of
  371. Xthe ACM SIGSOFT/SIGPLAN Software Engineering Symposium on Practical
  372. XSoftware Development Environments, November 1988, Boston Mass. (to
  373. Xbe published).
  374. X.SH INCOMPATIBILITIES
  375. XThe following \fBfind(1)\fR primaries are not recognized or implemented:
  376. X-link, -nouser, -group, -nogroup, -size, -inum, -ok, and -xdev.
  377. X.SH BUGS
  378. XCommand line parsing is done with a simple handcoded parser and is not
  379. Xwell tested. Pattern matching is done with \fIre_comp\fR and \fIre_exec\fR.
  380. XPlease report bugs to the author or to shape-bugs@coma.UUCP.
  381. X.SH AUTHOR
  382. XUli Pralle
  383. X.br
  384. XTechnische Universit\*at Berlin
  385. X.sp
  386. X\fIUUCP:\fR        uli@coma.uucp (unido!coma!uli)
  387. X.br
  388. X\fIBITNET:\fR        uli@db0tui62
  389. X
  390. END_OF_FILE
  391. if test 7070 -ne `wc -c <'man/man1/vfind.1'`; then
  392.     echo shar: \"'man/man1/vfind.1'\" unpacked with wrong size!
  393. fi
  394. # end of 'man/man1/vfind.1'
  395. fi
  396. if test -f 'src/afsit/afsit.1' -a "${1}" != "-c" ; then 
  397.   echo shar: Will not clobber existing file \"'src/afsit/afsit.1'\"
  398. else
  399. echo shar: Extracting \"'src/afsit/afsit.1'\" \(7488 characters\)
  400. sed "s/^X//" >'src/afsit/afsit.1' <<'END_OF_FILE'
  401. X...
  402. X... Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  403. X...  and U. Pralle
  404. X... 
  405. X... This software is published on an as-is basis. There is ABSOLUTELY NO
  406. X... WARRANTY for any part of this software to work correctly or as described
  407. X... in the manuals. We do not accept any liability for any kind of damage
  408. X... caused by use of this software, such as loss of data, time, money, or 
  409. X... effort.
  410. X... 
  411. X... Permission is granted to use, copy, modify, or distribute any part of
  412. X... this software as long as this is done without asking for charge, and
  413. X... provided that this copyright notice is retained as part of the source
  414. X... files. You may charge a distribution fee for the physical act of
  415. X... transferring a copy, and you may at your option offer warranty
  416. X... protection in exchange for a fee.
  417. X... 
  418. X... Direct questions to: Tech. Univ. Berlin
  419. X...              Wilfried Koch
  420. X...              Sekr. FR 5-6 
  421. X...              Franklinstr. 28/29
  422. X...              D-1000 Berlin 10, West Germany
  423. X... 
  424. X...              Tel: +49-30-314-22972
  425. X...              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  426. X... 
  427. X...
  428. X... $Header: afsit.1[1.1] Thu Feb 23 19:35:40 1989 axel@coma published $
  429. X... 
  430. X... Log for /u/shape/dist-tape/src/afsit/afsit.1[1.0]
  431. X...     Thu Feb 23 19:35:40 1989 axel@coma published $
  432. X...  This program is derived from a helpful little program written by 
  433. X...  M. Cooper. It is used to prepare files for version control. It
  434. X...  inserts some magic cookies into the files, in order to provide version
  435. X...  identification for them. The original program is called rcsit
  436. X...  and has only be trained to add Header and Log citations in AFS-style
  437. X...  when it is called 'afsit'. There are some other nice features, that
  438. X...  rcsit provides but are not yet adjusted to AFS. This will probably
  439. X...  happen in a later version. This particular program is just intended
  440. X...  as a helpful little utility.
  441. X...  
  442. X...  afsit.1[1.1] Thu Feb 23 19:35:40 1989 axel@coma published $
  443. X...  --- empty log message ---
  444. X...
  445. X...
  446. X... $Header: rcsit.1,v 1.7 85/11/26 16:57:21 mcooper Exp $
  447. X... 
  448. X... $Log:    rcsit.1,v $
  449. X... Revision 1.7  85/11/26  16:57:21  mcooper
  450. X... Added documentation of option -F. See logentry in rcsit.c.
  451. X...
  452. X... Revision 1.7  85/11/26  16:57:21  mcooper
  453. X... Noted changes to the -t option.
  454. X... 
  455. X... Revision 1.6  85/11/11  21:20:17  mcooper
  456. X... Added AUTHOR.
  457. X... 
  458. X... Revision 1.5  85/11/11  20:13:39  mcooper
  459. X... Added description of new Fortran recognition.
  460. X... 
  461. X... Revision 1.4  85/10/27  19:18:15  mcooper
  462. X... Cleaned up table display.
  463. X... 
  464. X... Revision 1.3  85/10/27  14:55:22  mcooper
  465. X... Added description of new template feature.
  466. X... 
  467. X... Revision 1.2  85/09/28  14:22:52  mcooper
  468. X... Documented new features of checkdir (symbolic
  469. X... linking and RCSDIR).
  470. X... 
  471. X... Revision 1.1  85/09/19  15:44:22  mcooper
  472. X... Initial revision
  473. X... 
  474. X...
  475. X.TH AFSIT 1l
  476. X.SH NAME
  477. Xafsit \- A program to prepare files for version control
  478. X.SH SYNOPSIS
  479. Xafsit
  480. X[
  481. X.B \-cFhfsmM
  482. X] [
  483. X.B \-qad
  484. X] [
  485. X\-I\fIflags\fR
  486. X] [
  487. X\-R\fIflags\fR
  488. X] [
  489. X\-t\fIdirectory\fR
  490. X]
  491. X.B file
  492. X[
  493. X.B file1, file2, ...
  494. X]
  495. X.SH DESCRIPTION
  496. X.I Afsit
  497. Xis a semi-intelligent program to prepare files for 
  498. X.I shapetools version control.
  499. XThis
  500. Xinvolves putting the correct type of headings at the top of the file so
  501. Xthat 
  502. X.I retrv
  503. Xwill update a header and log changes in the file.
  504. X.PP 
  505. XBy default, 
  506. X.I afsit
  507. Xwill use default headers ``hard-wired'' into itself for each different file
  508. Xtype that it ``knows'' about.  (See below for list of known file types).
  509. X.PP
  510. XIf the \-t\fIdirectory\fR option is specified, then
  511. X.I afsit
  512. Xwill use ``.template.suffix'' files
  513. X(where ``suffix'' is a suffix that 
  514. X.I afsit
  515. X``knows'' about)
  516. Xfound in 
  517. X.I directory.
  518. XIf a directory name is not specified on the command line, then
  519. Xthe environment variable TEMPLATES is used.
  520. XIf $TEMPLATES is not set, then the environment varialble, HOME is tried.
  521. X.LP
  522. XThe following template files are recognized:
  523. X.sp 2
  524. X.in 10
  525. X.nf
  526. X Template Name               File Type
  527. X -------------------------------------------
  528. X .template.c                 Standard C
  529. X .template.h                 C Include
  530. X .template.f                 Fortran
  531. X .template.sh                Shell Script
  532. X .template.make              Makefile
  533. X .template.man               Manual
  534. X.sp 2
  535. X.in -10
  536. X.fi
  537. X.PP
  538. X.I Afsit
  539. Xis ``semi-intelligent'' in that it can guess the type of headers to put in
  540. Xthe file by the type of file (C program, C include, makefile, shell script,
  541. Xor manual).
  542. XIt determines the file type by looking at the name of the file.
  543. XIf the name of the file is ``Makefile'' or ``makefile'', then the
  544. Xfile type is taken to be for 
  545. X.I make(1).
  546. XThe suffix after the last ``.'' in the file name is then used.
  547. XThe following table shows the suffixes that 
  548. X.I afsit
  549. Xknows about:
  550. X.nf
  551. X.sp 2
  552. X.in 10
  553. XSuffix         File Type
  554. X---------------------------------------------
  555. Xc              C Program
  556. XF           C Program (with compile flags)
  557. Xh              C Include
  558. Xf              Fortran
  559. Xmk             \fIMake(1)\fR file
  560. Xsh             Shell Script
  561. Xcsh            Shell Script
  562. X[1-9]          Manual (digits 1 - 9)
  563. X.fi
  564. X.PP
  565. XIf the environement variable ``RCSDIR'' is present, then 
  566. X.I afsit
  567. Xwill attempt to make a symbolic link from it to ``RCS'' in
  568. Xthe current directory if the \-\fII\fR option is used and
  569. Xthere is no directory called ``RCS'' already, in the current
  570. Xdirectory.  
  571. XIf the \-\fII\fR option is used and ``RCSDIR'' is not specified
  572. Xin the environment, then a normal directory called ``RCS'' will be
  573. Xcreated.
  574. XThis feature can be overrided with the \-\fId\fR option.
  575. X.SH OPTIONS
  576. X.TP 10
  577. X.B "c"
  578. XForce file type to be ``Standard C''.
  579. X.TP 10
  580. X.B "F"
  581. XForce file type to be ``Standard C''. Add a special header-line for
  582. Xrecording of compile-time options in addition to the default header.
  583. XThe inserted line has the form \fCstatic char *ConfFlg = CFFLGS\fR.
  584. XCFFLGS must be a string value. As it is very inconvenient, to define
  585. Xthe proper value of CFFLGS from the command-line, this feature is 
  586. Xmore intended to be used from within Makefiles.
  587. X.TP 10
  588. X.B "h"
  589. XForce file type to be ``C Include''.
  590. X.TP 10
  591. X.B "f"
  592. XForce file type to be ``Fortran''.
  593. X.TP 10
  594. X.B "M"
  595. XForce file type to be ``Manual''.
  596. XNote: If you also specify the ``I\fIflags\fR'' option,
  597. X.I afsit
  598. Xwill run 
  599. X.I rcs(1)
  600. Xto tell rcs what kind of comment string to use for the manual file.
  601. X.TP 10
  602. X.B "s"
  603. XForce file type to be ``Shell Script''.
  604. X.TP 10
  605. X.B "m"
  606. XForce file type to be ``Makefile''.  Note that this does the same thing as
  607. Xthe -s option does.  It just prints a different message.
  608. X.TP 10
  609. X.B "t"
  610. XDo not use any Template files for the headers.
  611. X.TP 10
  612. X.B "q"
  613. XBe quiet.  Don't print out what is going on.  Only error messages are
  614. Xprinted.
  615. X.TP 10
  616. X.B "d"
  617. XDo not attempt to make the directory ``RCS''.
  618. XSee above for more info.
  619. X.TP 10
  620. X.B "a"
  621. XTurn off auto guessing of file type.
  622. X.TP 10
  623. X.B "I\fIflags\fR"
  624. XCheck In file.
  625. XRun RCS's 
  626. X.I ci(1)
  627. Xon the file with ``flags'' being passed onto 
  628. X.I ci(1) 
  629. Xas the command line arguments.
  630. X.TP 10
  631. X.B "R\fIflags\fR"
  632. XRun 
  633. X.I rcs(1)
  634. Xwith ``flags'' as the command line arguments.
  635. X.SH FILES
  636. X/tmp/afsit*    - temporary buffer
  637. X.br
  638. X~/.template.*   - template files to use as the header.
  639. X.br
  640. X.SH AUTHOR
  641. XMichael Cooper (mcooper@usc-oberon.ARPA)
  642. X.br
  643. XModified for use with \fIshapetools\fR by Axel Mahler (axel@coma.uucp)
  644. X.SH SEE ALSO
  645. Xci(1), make(1), rcs(1), save(1), retrv(1), shape(1)
  646. X.SH DIAGNOSTICS
  647. XComplains about the usual stuff.  (i.e. - the specified file doesn't exist,
  648. Xor it can't read it...just things like that.)
  649. X.SH BUGS
  650. XActs oddly in the presence of beautiful women.
  651. END_OF_FILE
  652. if test 7488 -ne `wc -c <'src/afsit/afsit.1'`; then
  653.     echo shar: \"'src/afsit/afsit.1'\" unpacked with wrong size!
  654. fi
  655. # end of 'src/afsit/afsit.1'
  656. fi
  657. if test -f 'src/vc/sighand.c' -a "${1}" != "-c" ; then 
  658.   echo shar: Will not clobber existing file \"'src/vc/sighand.c'\"
  659. else
  660. echo shar: Extracting \"'src/vc/sighand.c'\" \(7865 characters\)
  661. sed "s/^X//" >'src/vc/sighand.c' <<'END_OF_FILE'
  662. X/*
  663. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  664. X *  and U. Pralle
  665. X * 
  666. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  667. X * WARRANTY for any part of this software to work correctly or as described
  668. X * in the manuals. We do not accept any liability for any kind of damage
  669. X * caused by use of this software, such as loss of data, time, money, or 
  670. X * effort.
  671. X * 
  672. X * Permission is granted to use, copy, modify, or distribute any part of
  673. X * this software as long as this is done without asking for charge, and
  674. X * provided that this copyright notice is retained as part of the source
  675. X * files. You may charge a distribution fee for the physical act of
  676. X * transferring a copy, and you may at your option offer warranty
  677. X * protection in exchange for a fee.
  678. X * 
  679. X * Direct questions to: Tech. Univ. Berlin
  680. X *              Wilfried Koch
  681. X *              Sekr. FR 5-6 
  682. X *              Franklinstr. 28/29
  683. X *              D-1000 Berlin 10, West Germany
  684. X * 
  685. X *              Tel: +49-30-314-22972
  686. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  687. X */
  688. X#ifndef lint
  689. Xstatic char *AFSid = "$Header: sighand.c[3.7] Thu Feb 23 18:13:57 1989 axel@coma published $";
  690. X#ifdef CFFLGS
  691. Xstatic char *ConfFlg = CFFLGS;
  692. X    /* should be defined from within Makefile */
  693. X#endif
  694. X#endif
  695. X/*
  696. X * Log for /u/shape/dist-tape/src/vc/sighand.c[3.3]
  697. X *     Thu Feb 23 18:13:57 1989 axel@coma published $
  698. X *  --- empty log message ---
  699. X *  sighand.c[3.4] Thu Feb 23 18:13:57 1989 axel@coma published $
  700. X *  --- empty log message ---
  701. X *  sighand.c[3.5] Thu Feb 23 18:13:57 1989 axel@coma save $
  702. X *  --- empty log message ---
  703. X *  sighand.c[3.6] Thu Feb 23 18:13:57 1989 axel@coma save $
  704. X *  --- empty log message ---
  705. X *  sighand.c[3.7] Thu Feb 23 18:13:57 1989 axel@coma published $
  706. X *  --- empty log message ---
  707. X */
  708. X
  709. X/*LINTLIBRARY*/
  710. X
  711. X#include <signal.h>
  712. X#include <strings.h>
  713. X#include "afs.h"
  714. X#include "afsapp.h"
  715. X
  716. Xextern struct Transaction ThisTransaction;
  717. Xextern int nfnms;
  718. X
  719. XCatchSigs () {
  720. X/*
  721. X * Setup signal handlers for various signals. Previous handlers
  722. X * are saved. On receipt of a signal, the 
  723. X * original handler for this signal will be invoked after specified
  724. X * action has been taken.
  725. X */
  726. X
  727. Xextern Sfunc_t interrupt_action();
  728. X
  729. XSfunc_t    die1(), die2(), die3(), die4(), die5(), die6(), 
  730. X       die7(), die8(), die9(), die10(),
  731. X       die11(), die12(), die13(), die14(), die15();
  732. X
  733. X  (void)signal (SIGINT, die2);
  734. X  (void)signal (SIGBUS, die10);
  735. X  (void)signal (SIGSEGV, die11);
  736. X  (void)signal (SIGFPE, die8);
  737. X  (void)signal (SIGTERM, die15);
  738. X}
  739. X
  740. Xextern jmp_buf here;
  741. X
  742. XCatchCont () {
  743. X  Sfunc_t conthand();
  744. X
  745. X  (void)signal (SIGCONT, conthand);
  746. X}
  747. X
  748. XUnCatchCont () {
  749. X  (void)signal (SIGCONT, SIG_DFL);
  750. X}
  751. X
  752. XSfunc_t conthand () {
  753. X  char messg [80];
  754. X
  755. X  (void)sprintf (messg, "%s:", ThisTransaction.tr_fname);
  756. X  logmsg (messg);
  757. X  longjmp (here, 1);
  758. X}
  759. X    
  760. XSfunc_t die1 () {
  761. X}
  762. X
  763. XSfunc_t die2 () {
  764. X  /* do eventual cleanup and execute previously defined action */
  765. X  Sfunc_t interrupt_action();
  766. X  
  767. X  (void)sigblock (SIGINT);
  768. X  (void)signal (SIGINT, die2);
  769. X  af_cleanup ();
  770. X  kill_tmpfiles ();
  771. X  interrupt_action();
  772. X}
  773. X
  774. XSfunc_t die8 () {
  775. X  /* do eventual cleanup and execute previously defined action */
  776. X  int mask = sigblock (SIGFPE);
  777. X  logerr (" Oh! Oh! .... this was a floating exception -- goodbye."); 
  778. X  af_cleanup ();
  779. X  kill_tmpfiles ();
  780. X  (void)sigsetmask (mask);
  781. X  exit (1);
  782. X}
  783. X
  784. XSfunc_t die10 () {
  785. X  /* do eventual cleanup and execute previously defined action */
  786. X  
  787. X  (void)sigblock (SIGBUS);
  788. X  logerr ("Oh! Oh! .... this was a buserror -- goodbye.");
  789. X  logerr ("Dumping core.");
  790. X  af_cleanup ();
  791. X  kill_tmpfiles ();
  792. X  (void)kill (getpid(), SIGQUIT);
  793. X}
  794. X
  795. XSfunc_t die11 () {
  796. X  /* do eventual cleanup and execute previously defined action */
  797. X
  798. X  (void)sigblock (SIGSEGV);
  799. X  logerr ("Oh! Oh! .... this was a segmentation violation -- goodbye.");
  800. X  logerr ("Dumping core.");
  801. X  af_cleanup ();
  802. X  kill_tmpfiles ();
  803. X  (void)kill (getpid(), SIGQUIT);
  804. X}
  805. X
  806. XSfunc_t die15 () {
  807. X  /* do eventual cleanup and restore previously saved context for */
  808. X  /* next transaction */
  809. X  int mask = sigblock (SIGTERM);
  810. X
  811. X  (void)signal (SIGTERM, die15);
  812. X  kill_tmpfiles ();
  813. X  kill_afsets();
  814. X  kill_afkeys();
  815. X  kill_afattrbufs();
  816. X  ThisTransaction.tr_rc = 1; /* indicating that something went wrong */
  817. X  (void)sigsetmask (mask);
  818. X  longjmp (ThisTransaction.tr_env, 1);
  819. X}
  820. X
  821. X#define sm(i) (1 << (i))
  822. X
  823. Xabort_this (domsg) {
  824. X  if (domsg)
  825. X    logmsg ("...aborting");
  826. X  (void)kill (getpid(), SIGTERM); 
  827. X  /* abort current execution phase and restore */
  828. X  /* a clean context for next phase */
  829. X}
  830. X
  831. X/*
  832. X *  Utilities for housekeeping with various allocated 
  833. X *  system resources.
  834. X */
  835. X
  836. Xchar tmpnames[MAXTMPF][MAXNAMLEN];
  837. XAf_set *afsets[MAXSETS];
  838. XAf_key *afkeys[MAXKEYS];
  839. XAf_attrs *afattrbufs[MAXATTRBUFS];
  840. X
  841. XRegister (data, type) char *data; short type; {
  842. X  register int i, ok;
  843. X
  844. X  if (!data) return; /* NULL pointers not registered */
  845. X
  846. X  switch (type) {
  847. X  case TYPEF: /* temporary filenames */
  848. X    ok = FALSE;
  849. X    for (i=0; i < MAXTMPF; i++) {
  850. X      if (tmpnames[i][0]) continue;
  851. X      else {
  852. X    (void)strcpy (tmpnames[i], data);
  853. X    ok = TRUE;
  854. X    break;                      /* I admit: UGLY! */
  855. X      }
  856. X    }
  857. X    if (!ok) {
  858. X      logerr ("internal error in resource tables");
  859. X    }
  860. X    break;
  861. X  case AFSET:
  862. X    ok = FALSE;
  863. X    for (i = 0; i < MAXSETS; i++) {
  864. X      if (afsets[i]) continue;
  865. X      else {
  866. X    afsets[i] = (Af_set *)data;
  867. X    ok = TRUE;
  868. X    break;
  869. X      }
  870. X    }
  871. X    if (!ok) {
  872. X      logerr ("resource table error -- Af_set table overflow");
  873. X    }
  874. X    break;
  875. X  case AFKEY:
  876. X    ok = FALSE;
  877. X    for (i = 0; i < MAXSETS; i++) {
  878. X      if (afkeys[i]) continue;
  879. X      else {
  880. X    afkeys[i] = (Af_key *)data;
  881. X    ok = TRUE;
  882. X    break;
  883. X      }
  884. X    }
  885. X    if (!ok) {
  886. X      logerr ("resource table error -- Af_key table overflow");
  887. X    }
  888. X    break;
  889. X  case AFATTRS:
  890. X    ok = FALSE;
  891. X    for (i = 0; i < MAXATTRBUFS; i++) {
  892. X      if (afattrbufs[i]) continue;
  893. X      else {
  894. X    afattrbufs[i] = (Af_attrs *)data;
  895. X    ok = TRUE;
  896. X    break;
  897. X      }
  898. X    }
  899. X    if (!ok) {
  900. X      logerr ("resource table error -- Af_attrbuf table overflow");
  901. X    }
  902. X    break;
  903. X  default: /* shouldn't happen */
  904. X    logerr ("internal error in resource tables (types)");
  905. X  }
  906. X}
  907. X
  908. XUnRegister (data, type) char *data; short type; {
  909. X  register int i;
  910. X
  911. X  switch (type) {
  912. X  case TYPEF:
  913. X    for (i=0; i < MAXTMPF; i++) {
  914. X      if (tmpnames[i][0]) {
  915. X    if (!strcmp (tmpnames[i], data)) {
  916. X      if (i < MAXTMPF-1) {
  917. X        bcopy (tmpnames[i+1], tmpnames[i], MAXTMPF-(i+1));
  918. X        if (tmpnames[MAXTMPF-1][0]) tmpnames[MAXTMPF-1][0] = '\0';
  919. X      }
  920. X      else {
  921. X        tmpnames[i][0] = '\0';
  922. X      }
  923. X      break; /* bail out of for-loop */
  924. X    }
  925. X    else {
  926. X      continue;
  927. X    }
  928. X      }
  929. X      else {
  930. X    break; /* no more entries in list */
  931. X      }
  932. X    }
  933. X    break;
  934. X  case AFSET:
  935. X    for (i = 0; i < MAXSETS; i++) {
  936. X      if (afsets[i] == (Af_set *)data) {
  937. X    afsets[i] = (Af_set *)NULL;
  938. X    break;
  939. X      }
  940. X    }
  941. X    break;
  942. X  case AFKEY:      
  943. X    for (i = 0; i < MAXKEYS; i++) {
  944. X      if (afkeys[i] == (Af_key *)data) {
  945. X    afkeys[i] = (Af_key *)NULL;
  946. X    break;
  947. X      }
  948. X    }
  949. X    break;
  950. X  case AFATTRS:
  951. X    for (i = 0; i < MAXATTRBUFS; i++) {
  952. X      if (afattrbufs[i] == (Af_attrs *)data) {
  953. X    afattrbufs[i] = (Af_attrs *)NULL;
  954. X    break;
  955. X      }
  956. X    }
  957. X    break;
  958. X  default: /* shouldn't happen */
  959. X    logerr ("internal error in resource tables (unregister)");
  960. X  }
  961. X}
  962. X
  963. Xkill_tmpfiles () { /* do this before exiting */
  964. X  register int i;
  965. X
  966. X  for (i=0; i < MAXTMPF; i++) {
  967. X    if (tmpnames[i][0])
  968. X      (void)unlink (tmpnames[i]);
  969. X    else break;  /* save two or three nanoseconds */
  970. X  }
  971. X}
  972. X
  973. Xkill_afsets () { 
  974. X  register int i;
  975. X
  976. X  for (i = 0; i < MAXSETS; i++) {
  977. X    if (afsets[i])
  978. X      af_dropset (afsets[i]);
  979. X  }
  980. X}
  981. X
  982. Xkill_afkeys () { 
  983. X  register int i;
  984. X
  985. X  for (i = 0; i < MAXKEYS; i++) {
  986. X    if (afkeys[i])
  987. X      af_dropkey (afkeys[i]);
  988. X  }
  989. X}
  990. X
  991. Xkill_afattrbufs () {
  992. X  register int i;
  993. X
  994. X  for (i = 0; i < MAXATTRBUFS; i++) {
  995. X    if (afattrbufs[i])
  996. X      udafree (afattrbufs[i]);
  997. X  }
  998. X}
  999. END_OF_FILE
  1000. if test 7865 -ne `wc -c <'src/vc/sighand.c'`; then
  1001.     echo shar: \"'src/vc/sighand.c'\" unpacked with wrong size!
  1002. fi
  1003. # end of 'src/vc/sighand.c'
  1004. fi
  1005. if test -f 'src/vc/util.c' -a "${1}" != "-c" ; then 
  1006.   echo shar: Will not clobber existing file \"'src/vc/util.c'\"
  1007. else
  1008. echo shar: Extracting \"'src/vc/util.c'\" \(7817 characters\)
  1009. sed "s/^X//" >'src/vc/util.c' <<'END_OF_FILE'
  1010. X/*
  1011. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  1012. X *  and U. Pralle
  1013. X * 
  1014. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  1015. X * WARRANTY for any part of this software to work correctly or as described
  1016. X * in the manuals. We do not accept any liability for any kind of damage
  1017. X * caused by use of this software, such as loss of data, time, money, or 
  1018. X * effort.
  1019. X * 
  1020. X * Permission is granted to use, copy, modify, or distribute any part of
  1021. X * this software as long as this is done without asking for charge, and
  1022. X * provided that this copyright notice is retained as part of the source
  1023. X * files. You may charge a distribution fee for the physical act of
  1024. X * transferring a copy, and you may at your option offer warranty
  1025. X * protection in exchange for a fee.
  1026. X * 
  1027. X * Direct questions to: Tech. Univ. Berlin
  1028. X *              Wilfried Koch
  1029. X *              Sekr. FR 5-6 
  1030. X *              Franklinstr. 28/29
  1031. X *              D-1000 Berlin 10, West Germany
  1032. X * 
  1033. X *              Tel: +49-30-314-22972
  1034. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  1035. X */
  1036. X#ifndef lint
  1037. Xstatic char *AFSid = "$Header: util.c[3.10] Thu Feb 23 18:14:00 1989 axel@coma published $";
  1038. X#ifdef CFFLGS
  1039. Xstatic char *ConfFlg = CFFLGS;
  1040. X    /* should be defined from within Makefile */
  1041. X#endif
  1042. X#endif
  1043. X/*
  1044. X * Log for /u/shape/dist-tape/src/vc/util.c[3.5]
  1045. X *     Thu Feb 23 18:14:00 1989 axel@coma published $
  1046. X *  --- empty log message ---
  1047. X *  util.c[3.8] Thu Feb 23 18:14:00 1989 axel@coma published $
  1048. X *  --- empty log message ---
  1049. X *  util.c[3.9] Thu Feb 23 18:14:00 1989 axel@coma save $
  1050. X *  --- empty log message ---
  1051. X *  util.c[3.10] Thu Feb 23 18:14:00 1989 axel@coma published $
  1052. X *  --- empty log message ---
  1053. X */
  1054. X
  1055. X/*LINTLIBRARY*/
  1056. X#include <strings.h>
  1057. X#include <stdio.h>
  1058. X#include <pwd.h>
  1059. X#include "afs.h"
  1060. X#include <sys/stat.h>
  1061. X#include <sys/file.h>
  1062. X#include "afsapp.h"
  1063. X#include "project.h"
  1064. X#include "locks.h"
  1065. X
  1066. Xextern unsigned int options;
  1067. X
  1068. Xjmp_buf here;
  1069. X
  1070. Xask_confirm (s, def) char *s, *def; {
  1071. X  /*
  1072. X   *  returns true if the answer is equivalent to 'def' (assumption)
  1073. X   */
  1074. X  char strbuf[256], answer[10], *cp;
  1075. X
  1076. X  if (s == (char *)NULL) return TRUE;
  1077. X  if (!isatty (fileno (stdin))) return TRUE;
  1078. X  (void)setjmp (here);
  1079. X  CatchCont ();
  1080. X  (void)fflush (stdin);
  1081. X  printf ("%s [%s] ", s, def);
  1082. X  strbuf[0] = '\0';
  1083. X  answer[0] = '\0';
  1084. X  (void)gets (strbuf);
  1085. X  UnCatchCont ();
  1086. X  (void)sscanf (strbuf, "%s", answer);
  1087. X  if (answer[0] == '\0') return TRUE; /* assumption acknowledged */
  1088. X  cp = answer;
  1089. X  while (*cp ? (*cp++ |= ' ') : 0); /* make sure answer is lowercase */
  1090. X  return !strncmp (def, answer, min(strlen(def), strlen(answer)));
  1091. X}
  1092. X
  1093. X/*ARGSUSED*/
  1094. Xgetsyspath (path, proj, syspath, opath, name) 
  1095. X     char *path, *syspath, *opath, *name; 
  1096. X     Project *proj;
  1097. X/*
  1098. X * Normally splits path-prefix and filename-part. If the project structure
  1099. X * specifies an explicit syspath (which could be different from the 
  1100. X * actual path-prefix) it will be returned in syspath. The path-prefix
  1101. X * will be returned in opath.
  1102. X */
  1103. X{
  1104. X  char *cpt;
  1105. X
  1106. X  if (cpt = rindex (path, '/')) {
  1107. X    (void)strncpy (opath, path, cpt - path);
  1108. X    opath[cpt-path] = '\0';
  1109. X    (void)strcpy (name, cpt+1);
  1110. X  }
  1111. X  else {
  1112. X    opath[0] = '\0';
  1113. X    (void)strcpy (name, path);
  1114. X  }
  1115. X  (void)strcpy (syspath, opath); /* this is going to be more complex */
  1116. X}
  1117. X
  1118. X#define nxt(s) (s = (*(s+strlen(s)+1) != '\0') ? s+strlen(s)+1 : NULL)
  1119. X
  1120. X/*ARGSUSED*/
  1121. Xchar *getattr (attrfile, proj, type, op) 
  1122. X     char *attrfile, *type ; Project *proj; {
  1123. X       /* 
  1124. X    * in initial state, getattr parses all available attribute
  1125. X    * information, i.e. a user supplied attribute file and the
  1126. X    * common project specific attribute specifications. The information
  1127. X    * is kept in static memory. Subsequent calls to getattr with
  1128. X    * op = NEXT yields the next attribute for the specified document
  1129. X    * type. If op is REWIND, the first attribute for the given type
  1130. X    * is delivered. If no (more) attribute is found, getattr returns
  1131. X    * a NULL pointer.
  1132. X    */
  1133. X       static int isparsed = FALSE;
  1134. X       static char *currattr, *attrbuf;
  1135. X       char messg[80], *malloc();
  1136. X       struct stat statbuf;
  1137. X       register int i;
  1138. X       FILE *atfil;
  1139. X       
  1140. X       if (isparsed) {
  1141. X     if (op == NEXT)
  1142. X       return (currattr) ? nxt(currattr) : currattr;
  1143. X     else if (op == REWIND) {
  1144. X       currattr = attrbuf;
  1145. X       return currattr;
  1146. X     }
  1147. X       }
  1148. X       else { /* we've to read the stuff first */
  1149. X     if ((atfil = fopen (attrfile, "r")) == NULL) {
  1150. X       (void)sprintf (messg, "No attribute file %s.", attrfile);
  1151. X       logerr (messg);
  1152. X       attrbuf = NULL;
  1153. X     }
  1154. X     else {
  1155. X       if (fstat (fileno(atfil), &statbuf) < 0) {
  1156. X         perror ("couldn't stat.");
  1157. X         return (char *)NULL;
  1158. X       }
  1159. X       attrbuf = malloc ((unsigned)statbuf.st_size+1); 
  1160. X       /* leave space for terminating nullbyte */
  1161. X       if (!attrbuf) {
  1162. X         logerr ("Not enough memory for attribute table");
  1163. X       }
  1164. X       else {
  1165. X         (void)fread (attrbuf, sizeof (char), 
  1166. X              (Size_t)statbuf.st_size, atfil);
  1167. X         for (i=0; i < statbuf.st_size; i++)
  1168. X           if (attrbuf[i] == '\n')
  1169. X         attrbuf[i] = '\0';
  1170. X         attrbuf[statbuf.st_size + 1] = '\0';
  1171. X       }
  1172. X     }
  1173. X     currattr = attrbuf;
  1174. X     isparsed = TRUE;
  1175. X     return currattr;
  1176. X       }
  1177. X       return FALSE;
  1178. X     }
  1179. X
  1180. Xmylock (key, proj) Af_key *key; Project *proj; {
  1181. X  Af_user *locker;
  1182. X  Uid_t myuid;
  1183. X  char messg[80], *lockerid();
  1184. X
  1185. X  myuid = (Uid_t)getuid();
  1186. X  if (!locked(locker = vc_testlock_g(key))) {
  1187. X    if (firmlocking (proj)) {
  1188. X      (void)sprintf (messg, 
  1189. X           "You must lock %s before saving (firm locking required).",
  1190. X           af_rname (key));
  1191. X      logmsg (messg);
  1192. X      return FALSE;
  1193. X    }
  1194. X    else { /* no firm locking */
  1195. X      if (lockeruid (vc_lock_g(key, myuid)) != myuid) {
  1196. X    af_perror ("cannot lock archive");
  1197. X    return FALSE;
  1198. X      }
  1199. X      return TRUE;
  1200. X    }
  1201. X  }
  1202. X  else { /* there was some lock set */
  1203. X    if (lockeruid(locker) != myuid) {
  1204. X      (void)sprintf (messg, "%s already locked by %s.", af_rname (key), 
  1205. X           lockerid (locker));
  1206. X      logmsg (messg);
  1207. X      return FALSE;
  1208. X    }
  1209. X    return TRUE;
  1210. X  }
  1211. X}
  1212. X
  1213. Xfirmlocking (proj) Project *proj; {
  1214. X  if (proj) {
  1215. X    return TRUE;
  1216. X  }
  1217. X  else {
  1218. X    return FALSE;
  1219. X  }
  1220. X}
  1221. X
  1222. X#define owner(p) (0100 * p)
  1223. X#define group(p) (010 * p)
  1224. X#define world(p) (p)
  1225. X
  1226. Xafaccess (fkey, perm) Af_key *fkey; {
  1227. X  short itisus;
  1228. X  Af_attrs thisattrs;
  1229. X  char thishost[MAXHOSTNAMELEN];
  1230. X
  1231. X  if (!fkey) return FALSE;
  1232. X
  1233. X  if (fail(af_gattrs (fkey, &thisattrs))) {
  1234. X    af_perror ("af_gattrs (access determination failed).");
  1235. X    return FALSE;
  1236. X  }
  1237. X  (void)gethostname (thishost, MAXHOSTNAMELEN);
  1238. X  if (!strcmp (thishost, thisattrs.af_owner.af_userhost)) {
  1239. X    itisus = !strcmp (getpwuid((int)getuid())->pw_name, 
  1240. X              thisattrs.af_owner.af_username);
  1241. X  if ((thisattrs.af_state != AF_BUSY) && (perm & W_OK)) return FALSE;
  1242. X  if (itisus) {
  1243. X    return TRUE; /* there's no chmod for archived files. always grant acc. */
  1244. X  }
  1245. X  return thisattrs.af_mode & world(perm);
  1246. X  }
  1247. X  else return TRUE;
  1248. X}
  1249. X
  1250. X/*ARGSUSED*/
  1251. Xmyproject (proj) Project *proj; {
  1252. X  /*
  1253. X   * returns TRUE if we are project administrator
  1254. X   */
  1255. X  return TRUE; /* until project support is implemented ... */
  1256. X}
  1257. X
  1258. Xmkvstring (version, key) char *version; Af_key *key; {
  1259. X  int g;
  1260. X  char buf[16], *t, *n;
  1261. X
  1262. X  t = af_rtype (key);
  1263. X  (void)sprintf (version, "%s%s%s[",
  1264. X       n=af_rname (key),
  1265. X       t ? (t[0] ? "." : "") : "", t);
  1266. X  free (n); free (t); 
  1267. X  if ((g=af_rgen (key)) < 0) {
  1268. X    (void)strcat (version, "busy]");
  1269. X  }
  1270. X  else {
  1271. X    (void)sprintf (buf, "%d.%d]", g, af_rrev (key));
  1272. X    (void)strcat (version, buf);
  1273. X  }
  1274. X}
  1275. X
  1276. Xchar *vnum (key) Af_key *key; {
  1277. X  int _gen, _rev;
  1278. X  static char vstr[20];
  1279. X
  1280. X  _gen = af_rgen (key);
  1281. X  _rev = af_rrev (key);
  1282. X  
  1283. X  if (af_rstate (key) == AF_BUSY)
  1284. X    (void)strcpy (vstr, "busy");
  1285. X  else
  1286. X    (void)sprintf (vstr, "%d.%d", _gen, _rev);
  1287. X  return vstr;
  1288. X}
  1289. X
  1290. Xudafree (attrbuf) Af_attrs *attrbuf; {
  1291. X  register int i=0;
  1292. X
  1293. X  while (attrbuf->af_udattrs[i])
  1294. X    free (attrbuf->af_udattrs[i++]);
  1295. X}
  1296. END_OF_FILE
  1297. if test 7817 -ne `wc -c <'src/vc/util.c'`; then
  1298.     echo shar: \"'src/vc/util.c'\" unpacked with wrong size!
  1299. fi
  1300. # end of 'src/vc/util.c'
  1301. fi
  1302. if test -f 'src/vc/vadm_gkeys.c' -a "${1}" != "-c" ; then 
  1303.   echo shar: Will not clobber existing file \"'src/vc/vadm_gkeys.c'\"
  1304. else
  1305. echo shar: Extracting \"'src/vc/vadm_gkeys.c'\" \(7667 characters\)
  1306. sed "s/^X//" >'src/vc/vadm_gkeys.c' <<'END_OF_FILE'
  1307. X/*
  1308. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  1309. X *  and U. Pralle
  1310. X * 
  1311. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  1312. X * WARRANTY for any part of this software to work correctly or as described
  1313. X * in the manuals. We do not accept any liability for any kind of damage
  1314. X * caused by use of this software, such as loss of data, time, money, or 
  1315. X * effort.
  1316. X * 
  1317. X * Permission is granted to use, copy, modify, or distribute any part of
  1318. X * this software as long as this is done without asking for charge, and
  1319. X * provided that this copyright notice is retained as part of the source
  1320. X * files. You may charge a distribution fee for the physical act of
  1321. X * transferring a copy, and you may at your option offer warranty
  1322. X * protection in exchange for a fee.
  1323. X * 
  1324. X * Direct questions to: Tech. Univ. Berlin
  1325. X *              Wilfried Koch
  1326. X *              Sekr. FR 5-6 
  1327. X *              Franklinstr. 28/29
  1328. X *              D-1000 Berlin 10, West Germany
  1329. X * 
  1330. X *              Tel: +49-30-314-22972
  1331. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  1332. X */
  1333. X#ifndef lint
  1334. Xstatic char *AFSid = "$Header: vadm_gkeys.c[3.11] Thu Feb 23 18:14:11 1989 axel@coma published $";
  1335. X#ifdef CFFLGS
  1336. Xstatic char *ConfFlg = CFFLGS;
  1337. X    /* should be defined from within Makefile */
  1338. X#endif
  1339. X#endif
  1340. X/*
  1341. X * Log for /u/shape/dist-tape/src/vc/vadm_gkeys.c[3.6]
  1342. X *     Thu Feb 23 18:14:11 1989 axel@coma published $
  1343. X *  --- empty log message ---
  1344. X *  vadm_gkeys.c[3.9] Thu Feb 23 18:14:11 1989 axel@coma published $
  1345. X *  --- empty log message ---
  1346. X *  vadm_gkeys.c[3.10] Thu Feb 23 18:14:11 1989 axel@coma save $
  1347. X *  --- empty log message ---
  1348. X *  vadm_gkeys.c[3.11] Thu Feb 23 18:14:11 1989 axel@coma published $
  1349. X *  --- empty log message ---
  1350. X */
  1351. X
  1352. X#include <stdio.h>
  1353. X#include <strings.h>
  1354. X#include <afs.h>
  1355. X
  1356. X#include "vadm.h"
  1357. X#include "afsapp.h"
  1358. X
  1359. Xextern char *malloc();
  1360. Xextern unsigned int options;
  1361. X
  1362. Xstatic char *variant = NULL;
  1363. X
  1364. Xint between_versions (this_gen, this_rev, from_gen, from_rev, to_gen, to_rev)
  1365. X     int this_gen, this_rev, from_gen, from_rev, to_gen, to_rev;
  1366. X{
  1367. X  if (this_gen < from_gen)
  1368. X    return 0;
  1369. X  if (this_gen > to_gen)
  1370. X    return 0;
  1371. X  if (this_rev < from_rev)
  1372. X    return 0;
  1373. X  if (this_rev > to_rev)
  1374. X    return 0;
  1375. X
  1376. X  return 1;
  1377. X}
  1378. X
  1379. XGetKeys (file, versions, set)
  1380. X     char *file;
  1381. X     struct vc_vlist *versions;
  1382. X     Af_set *set;
  1383. X{
  1384. X  Af_set tset, btset, stset;
  1385. X  Af_attrs attrbuf;
  1386. X  Af_key key;
  1387. X  
  1388. X  struct vc_vlist *tvs;
  1389. X  char *syspath, *name, *type, cstring[MAXNAMLEN], vstring[16];
  1390. X  int nhits, bnhits, i, vno;
  1391. X  
  1392. X  if (BoundVersion (file, cstring, vstring)) {
  1393. X    vno = mkvno (vstring);
  1394. X    syspath = af_afpath (cstring);
  1395. X    name = af_afname (cstring);
  1396. X    type = af_aftype (cstring);
  1397. X    if (af_getkey (syspath, name, type, gen(vno), rev(vno), AF_NONAME, 
  1398. X           &key) < 0)
  1399. X      return NULL;
  1400. X/*    af_setaddkey (set, AF_LASTPOS, &key); *//* should look like this line */
  1401. X    af_setaddkey (set, 0, &key);
  1402. X    return 1;
  1403. X  }
  1404. X  /* subsequent stuff handles non-explicit queries.... */
  1405. X  syspath = af_afpath (file);
  1406. X  name = af_afname (file);
  1407. X  type = af_aftype (file);
  1408. X
  1409. X  af_initattrs (&attrbuf);
  1410. X  
  1411. X  if (syspath)
  1412. X    (void)strcpy (attrbuf.af_syspath, syspath);
  1413. X  
  1414. X  (void)strcpy (attrbuf.af_name, name);
  1415. X  if (type)
  1416. X    (void)strcpy (attrbuf.af_type, type);
  1417. X  
  1418. X  nhits = af_find (&attrbuf, &stset);
  1419. X  if (IsOptionSet (Vopt_binary)) {
  1420. X    bnhits = af_bpfind (&attrbuf, &btset);
  1421. X  }
  1422. X  else {
  1423. X    af_initset (&btset);
  1424. X  }
  1425. X  if (af_union (&stset, &btset, &tset) < 0) {
  1426. X    af_perror ("af_union");
  1427. X    return NULL;
  1428. X  }
  1429. X  af_dropset (&stset);
  1430. X  af_dropset (&btset);
  1431. X  nhits += bnhits;
  1432. X  if (nhits < 0) {
  1433. X    return NULL;
  1434. X  }
  1435. X  
  1436. X  if (nhits == 0) {
  1437. X    return NULL;
  1438. X  }
  1439. X  
  1440. X  for (i = 0; i < nhits; i++) {
  1441. X    if (versions) {
  1442. X      for (tvs = versions; tvs; tvs = tvs->next) {
  1443. X    if (between_versions (af_rgen (&tset.af_klist[i]),
  1444. X                  af_rrev (&tset.af_klist[i]),        
  1445. X                  tvs->from_generation, tvs->from_revision,
  1446. X                  tvs->to_generation, tvs->to_revision)) {
  1447. X      af_setaddkey (set, 0, &tset.af_klist[i]); 
  1448. X      /*    af_setaddkey (set, AF_LASTPOS, &tset.af_klist[i]); */
  1449. X      break;
  1450. X    }
  1451. X      }
  1452. X    }
  1453. X    else { /* versions == NULL */
  1454. X      af_setaddkey (set, 0, &tset.af_klist[i]); 
  1455. X    }
  1456. X  }
  1457. X  af_dropset (&tset);
  1458. X  return 1;
  1459. X}
  1460. X
  1461. X/**/
  1462. XGetKeysByName (nums, af_files, versions, set, err_files)
  1463. X     int nums;
  1464. X     char **af_files;
  1465. X     struct vc_vlist *versions;
  1466. X     Af_set *set;
  1467. X     char ***err_files;
  1468. X{
  1469. X  Af_key thiskey;
  1470. X  int i, bad, vno;
  1471. X  char **erroneous, cstring[MAXNAMLEN], vstring[16];
  1472. X  struct vc_vlist vdesc;
  1473. X
  1474. X  vdesc.from_version_set = NULL;
  1475. X  vdesc.to_version_set = NULL;
  1476. X  af_initset (set);    /* needed for the first af_union */
  1477. X
  1478. X  if ((erroneous = (char **) 
  1479. X       malloc ((unsigned)(sizeof (char *) * (nums + 1)))) == (char **)NULL)
  1480. X    vctl_abort ("GetKeysByName(): can't malloc");
  1481. X  bad = 0;
  1482. X  for (i = 0; i < nums; i++) {
  1483. X    if (*af_files[i] == '\0') continue; /* skip null names */
  1484. X    if (BoundVersion (af_files[i], cstring, vstring)) {
  1485. X      vno = mkvno (vstring);
  1486. X      vdesc.from_generation = gen(vno);
  1487. X      vdesc.from_revision = rev(vno);
  1488. X      vdesc.to_generation = gen(vno);
  1489. X      vdesc.to_revision = rev(vno);
  1490. X      vdesc.next = NULL;
  1491. X      if (!GetKeys (af_files[i], &vdesc, set))
  1492. X    erroneous[bad++] = af_files[i];
  1493. X    }
  1494. X    else {
  1495. X      if (versions) {
  1496. X    if (!(versions->from_version_set) || !(versions->to_version_set)) {
  1497. X      /* no version range given -- try find busy version */
  1498. X      if (!fail(af_getkey (af_afpath(af_files[i]), af_afname(af_files[i]),
  1499. X                   af_aftype(af_files[i]), AF_BUSYVERS, AF_BUSYVERS,
  1500. X                   AF_NONAME, &thiskey)))
  1501. X        af_setaddkey (set, 0, &thiskey);
  1502. X      else erroneous[bad++] = af_files[i];
  1503. X    }
  1504. X    else
  1505. X      if (!GetKeys (af_files[i], versions, set))
  1506. X        erroneous[bad++] = af_files[i];
  1507. X      }
  1508. X      else
  1509. X    if (!GetKeys (af_files[i], versions, set))
  1510. X      erroneous[bad++] = af_files[i];
  1511. X    }
  1512. X  }
  1513. X  erroneous[bad] = NULL;
  1514. X  *err_files = erroneous;
  1515. X  return bad;
  1516. X}
  1517. X
  1518. X/**/
  1519. Xint GetKeysByGenRev (ac, av, generation, revision, set, err_files)
  1520. X     int ac;
  1521. X     char **av;
  1522. X     int generation, revision;
  1523. X     Af_set *set;
  1524. X     char ***err_files;
  1525. X{
  1526. X  Af_key key;
  1527. X  char **erroneous;        /* busy version' name that has no saved vers */
  1528. X  char cfname[MAXNAMLEN], vstring[16];
  1529. X  int bad, retcode;
  1530. X  int i, vno;
  1531. X  
  1532. X  if ((erroneous = (char **) malloc ((unsigned)(sizeof (char *) * (ac + 1))))
  1533. X      == (char **)NULL) {
  1534. X    perror ("get_by_versnum: can't malloc,2");
  1535. X    exit (1);
  1536. X  }
  1537. X
  1538. X  af_initset (set);
  1539. X  
  1540. X  /* collect all Afs files and record error for later use */
  1541. X  bad = 0;
  1542. X  for (i = 0; av[i]; i++) {
  1543. X    if (BoundVersion (av[i], cfname, vstring)) {
  1544. X      vno = mkvno (vstring);
  1545. X      retcode = af_getkey (af_afpath (cfname), af_afname(cfname),
  1546. X             af_aftype(cfname), gen(vno),
  1547. X             rev(vno), variant, &key);
  1548. X    }
  1549. X    else {
  1550. X      switch (generation) {
  1551. X      case AF_BUSYVERS:
  1552. X    retcode = af_getkey (af_afpath (av[i]), af_afname(av[i]),
  1553. X                 af_aftype(av[i]), generation,
  1554. X                 revision, variant, &key);
  1555. X    if (!fail(retcode)) break;
  1556. X    /* we go to next label if no busyversion is there */
  1557. X      case AF_LASTVERS:
  1558. X    retcode = af_getkey (af_afpath (av[i]), af_afname(av[i]),
  1559. X                 af_aftype(av[i]), AF_LASTVERS,
  1560. X                 AF_LASTVERS, variant, &key);
  1561. X    break;
  1562. X      case AF_FIRSTVERS:
  1563. X      default: 
  1564. X    retcode = af_getkey (af_afpath (av[i]), af_afname(av[i]),
  1565. X                 af_aftype(av[i]), generation,
  1566. X                 revision, variant, &key);
  1567. X    break;
  1568. X      }
  1569. X    }
  1570. X    if (retcode == -1)
  1571. X      erroneous[bad++] = av[i];    /* must we record af_errno ? */
  1572. X    else {
  1573. X      af_setaddkey (set, 0, &key); /* should be AF_LASTPOS */
  1574. X/*      af_setaddkey (set, AF_LASTPOS, &key); */
  1575. X    }
  1576. X  }
  1577. X
  1578. X  erroneous[bad] = NULL;
  1579. X  *err_files = erroneous;
  1580. X  return bad;
  1581. X}
  1582. END_OF_FILE
  1583. if test 7667 -ne `wc -c <'src/vc/vadm_gkeys.c'`; then
  1584.     echo shar: \"'src/vc/vadm_gkeys.c'\" unpacked with wrong size!
  1585. fi
  1586. # end of 'src/vc/vadm_gkeys.c'
  1587. fi
  1588. echo shar: End of archive 8 \(of 33\).
  1589. cp /dev/null ark8isdone
  1590. MISSING=""
  1591. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
  1592.     if test ! -f ark${I}isdone ; then
  1593.     MISSING="${MISSING} ${I}"
  1594.     fi
  1595. done
  1596. if test "${MISSING}" = "" ; then
  1597.     echo You have unpacked all 33 archives.
  1598.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1599. else
  1600.     echo You still need to unpack the following archives:
  1601.     echo "        " ${MISSING}
  1602. fi
  1603. ##  End of shell archive.
  1604. exit 0
  1605.