home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume19 / shape / part12 < prev    next >
Encoding:
Internet Message Format  |  1989-05-31  |  52.8 KB

  1. Subject:  v19i025:  A software configuration management system, Part12/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 25
  8. Archive-name: shape/part12
  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 12 (of 33)."
  19. # Contents:  man/man1/shapetools.1 src/afs/afsattrs.c src/vc/mkattr.c
  20. #   src/vc/vadm_symname.c src/vc/vlopt.c
  21. # Wrapped by rsalz@papaya.bbn.com on Thu Jun  1 19:27:01 1989
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'man/man1/shapetools.1' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'man/man1/shapetools.1'\"
  25. else
  26. echo shar: Extracting \"'man/man1/shapetools.1'\" \(9634 characters\)
  27. sed "s/^X//" >'man/man1/shapetools.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... Copyright (C) 1988 Technische Universitaet Berlin
  56. X... 
  57. X... This is a pre-release !
  58. X... 
  59. X... This software is published on an as-is basis. There is ABSOLUTELY NO
  60. X... WARRANTY for any part of this software to work correctly or as described
  61. X... in the manuals. No responsibility or liability for any damage caused
  62. X... by using this software.
  63. X... 
  64. X... No part of this software may be redistributed or used commercially by 
  65. X... any means or in any form.
  66. X... 
  67. X... Direct questions to: Tech. Univ. Berlin
  68. X...              Wilfried Koch
  69. X...              Sekr. FR 5-6 
  70. X...              Franklinstr. 28/29
  71. X...              D-1000 Berlin 10, West Germany
  72. X... 
  73. X...              Tel: +49-30-314-22972
  74. X...              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  75. X...
  76. X.TH SHAPE 1 shapetools \n(dy.\n(mo.\n(yr
  77. X.SH NAME
  78. X\fRshapetools \- user interface for the shape toolkit
  79. X.SH INTRODUCTION
  80. XWe introduce hereby a user interface for the shape toolkit based on
  81. XEMACS running preferably on alphanumeric terminals.
  82. XThe interface supports a more comfortable use of the different commands of the 
  83. Xshape toolkit.
  84. XYou can use the interface on both alphanumeric terminals and
  85. Xgraphical workstations running X. The functionality in both cases is
  86. Xbasically the same.
  87. X.SH GETTING STARTED
  88. XTo start the shapetools interface enter the EMACS command
  89. X.br
  90. X        \fCM-x shapetools.\fR
  91. X.br
  92. XYou are then prompted for a directory name. This directory
  93. Xshould be the directory you want to work in. You get then an
  94. XEMACS buffer containing a list of all files in this directory
  95. Xincluding the versions (if any).
  96. X.br
  97. XThe buffer should look like this:\fC
  98. X.nf
  99. X  drwxr-xr-x b shape@chaos       512 Nov  3 13:24:01 1988 .
  100. X  drwxr-xr-x b shape@chaos      1536 Oct 30 23:01:59 1988 ..
  101. X  drwxr-xr-x b shape@chaos      1536 Nov  5 16:53:53 1988 AFS
  102. X  -rw-r--r-- b shape@chaos      1340 Oct 19 13:32:16 1988 Shapefile
  103. X  -rw-r--r-- s shape@chaos      1243 Oct 31 13:31:20 1988 Shapefile[1.0]
  104. X  -rw-r--r-- s shape@chaos      1200 Oct 31 13:32:04 1988 Shapefile[1.1]
  105. X  -rw-r--r-- s shape@chaos      1101 Oct 31 15:56:46 1988 Shapefile[1.2]
  106. X  -rw-r--r-- b shape@chaos       101 Oct 19 13:16:23 1988 demo1.c
  107. X  -rw-r--r-- b shape@chaos        31 Oct 19 13:16:28 1988 demo1.h
  108. X  -rw-r--r-- b shape@chaos       121 Oct 19 13:16:32 1988 demo2.c
  109. X  -rw-r--r-- b shape@chaos        88 Oct 19 13:16:38 1988 demo3.c
  110. X  -rw-r--r-- s shape@chaos       101 Oct 31 12:18:11 1988 demo3.c[1.0]
  111. X  -rw-r--r-- b shape@chaos        89 Oct 19 13:16:42 1988 demo4.c
  112. X  -rw-r--r-- b shape@chaos       101 Oct 19 13:16:46 1988 demo5.c
  113. X  -rw-r--r-- b shape@chaos       100 Oct 19 13:16:49 1988 demo6.c
  114. X  -rw-r--r-- b shape@chaos        82 Oct 19 13:16:55 1988 demo7.c
  115. X  -rw-r--r-- s shape@chaos        82 Oct 19 13:49:35 1988 demo7.c[1.0]
  116. X  -rw-r--r-- s shape@chaos        75 Oct 31 12:43:06 1988 demo7.c[1.1]
  117. X  -rw-r--r-- s shape@chaos        93 Oct 31 12:46:28 1988 demo7.c[1.2]
  118. X  -rw-r--r-- s shape@chaos        97 Oct 31 13:27:34 1988 demo7.c[1.3]
  119. X  -rw-r--r-- b shape@chaos       101 Oct 19 13:17:00 1988 demo8.c
  120. X  -rw-r--r-- p shape@chaos       131 Oct 19 13:29:00 1988 demo8.c[1.1]
  121. X  -rw-r--r-- p shape@chaos       156 Oct 31 12:09:10 1988 demo8.c[1.3]
  122. X  -rw-r--r-- p shape@chaos       176 Oct 31 13:30:27 1988 demo8.c[1.4]\fR
  123. X.fi
  124. X.br
  125. XEntering \fCC-h m\fR or \fC?\fR gives you a short description of the mode.
  126. X.SH THE INTERFACE FOR ALPHANUMERIC TERMINALS
  127. XOn alphanumeric terminals a special EMACS mode is supplied. Several
  128. Xkeys have a special meaning. The following is a description of
  129. Xthe mode.
  130. X.SH CURSOR MOVEMENT AND FOLDING
  131. X.PP
  132. XOn alphanumeric terminals you can move the cursor using
  133. Xthe standard EMACS commands. Besides it is possible to 
  134. Xmove the cursor down using the space bar. The cursor is
  135. Xpositioned on the filename. Similarly you can
  136. Xmove up using the backspace key.
  137. X.PP
  138. XDirectories with a lot of entries, especially a lot of versions
  139. Xare not comfortable. You can reduce the number of entries
  140. Xtyping a \fCF\fR, (stands for \fCfold\fR). You are then asked, whether
  141. Xyou want to fold the whole directory or not. Folding means,
  142. Xversion entries being compressed to one line, e.g.
  143. Xafter folding demo7.c the
  144. Xentries of demo7.c in the above example would look like\fC
  145. X.bp
  146. X.nf
  147. X  -rw-r--r-- b shape@chaos        82 Oct 19 13:16:55 1988 demo7.c
  148. X  -rw-r--r-- s shape@chaos        82 Oct 19 13:49:35 1988 demo7.c[*]\fR
  149. X.fi
  150. XYou can undo folding by typing the command \fCX\fR both for the
  151. Xwhole directory and a special folded component.
  152. X.SH EDITING AND VIEWING
  153. X.PP
  154. XTo \fIview\fR or to \fIedit\fR a file move the cursor to the file and type
  155. X\fCv\fR or \fCe\fR, respectively. Note that it is not possible
  156. Xto edit a version or a \fIfolded\fR (see below) file.
  157. XEditing e directory or viewing a folded file
  158. Xgives you a list of the files in that
  159. Xdirectory or the folded file similar like the current list.
  160. XWith the command \fCo\fR you can edit a file or a directory in another
  161. Xwindow.
  162. X.SH SAVING AND RETRIEVING
  163. X.PP
  164. XTo save a busy version of a file, move the cursor to this file and
  165. Xtype \fCS\fR. You are then asked if you want to describe this
  166. Xdocument or the changes. If ou answer "yes", you get another
  167. XEMACS buffer to type in your comments. Finish editing this buffer
  168. Xwith \fCC-c C-c.\fR
  169. X.SH DELETING FILES AND VERSIONS
  170. X.PP
  171. XDeletion of files can be performed using the \fCd\fR key for marking
  172. Xone ore more files or versions of files for deletion. The deletion
  173. Xis then executed with the command \fCx\fR (you are asked whether
  174. Xyou really want to delete or not). Note that you can only
  175. Xdelete files with the
  176. Xstate \fIbusy\fR or \fIsaved.\fR Marking for deletion can be undone
  177. Xwith \fCu\fR or with the backspace key.
  178. X.SH COMPARING FILES AND VERSIONS
  179. X.PP
  180. XWithin the Shape mode you can compare two files or versions.
  181. XMove the cursor to the first file and type \fCC\fR, then move the
  182. Xcursor to the second file and type \fCC\fR again. These files are marked
  183. Xwith \fC>\fR and \fC<\fR, respectively. Comparison is done with the
  184. Xdiff command. The output of diff is shown in a separate EMACS buffer.
  185. X.SH COMMANDS FOR ADMINISTRATION
  186. X.PP
  187. XTo promote a saved version, i.e. improve the state of this version,
  188. Xmove the cursor to this version and type \fCP\fR. Unpromoting is
  189. Xdone by typing \fCU\fR.
  190. X.PP
  191. XTo change the mode of a file or a version, enter \fCM\fR. You are
  192. Xthen asked for the mode you want to give to this file or version.
  193. X.SH EXECUTING SHAPE
  194. X.PP
  195. XIf you want to run \fIshape\fR type \fCE\fR. If the cursor
  196. Xis located on a file named \fIShapefile, shapefile, Makefile, or
  197. Xmakefile, \fR respectively, the EMACS compile command is
  198. Xcalled with \fCshape -k -f Shapefile\fR, etc. If the cursor
  199. Xis positioned on a version of such a file, the compile command is
  200. Xcalled with - for example - \fC vcat Shapefile[2.5] | shape -k -f -.\fR
  201. XOtherwise the compile command is called with \fCshape -k.\fR
  202. XYou can change this by editing the minibuffer.
  203. X.SH WISHES/FLAMES/BUGS/PRAISES
  204. X.PP
  205. XIf you suggestions or wishes for enhancements, type faithfully \fCW;\fR
  206. Xfor bug reports \fCB\fR. In both cases the EMACS mail is called and
  207. Xyou get the standard mail buffer with some default values added.
  208. XFor example, the \fCB\fR offers you a buffer like this (for the string
  209. X\fCretrv\fR, the related tool, you are prompted):
  210. X.nf
  211. X       \fCIndex: retrv
  212. X       To: shape-bugs@coma.UUCP
  213. X       Subject: 
  214. X       --text follows this line--
  215. X
  216. X       Description:
  217. X
  218. X       Repeat-By:
  219. X
  220. X       Fix:
  221. X.if\fR
  222. X.SH THE SHAPETOOLS INTERFACE WITH EMACS AND X
  223. XThe shapetools interface with EMACS and X provides basically the
  224. Xsame features as the interface for alphanumeric terminals. In fact
  225. Xthe key bindings described above are identical.
  226. XPositioning of the cursor is now possible by moving the mouse
  227. Xand pressing the left mouse button.
  228. XAdditionally a pop-up menu is supplied to chose the actions.
  229. XYou get the menu by pressing the middle mouse button and hold it down.
  230. XThe menu consist of four sections:
  231. X.IP "About the Shape Toolkit"
  232. XIn this section you can get the description of the Shape mode, that is
  233. Xwhat you get normally typing \fC?\fR, and you can mail wishes or
  234. Xbugs. Furthermore you can view the manuals of the shape tool kit.
  235. X.IP "Extended Commands"
  236. XYou can execute all commands of the shape toolkit by entering the
  237. Xparameters in the minibuffer (in the alphanumeric mode you can
  238. Xuse \fCM-x shell-command\fR).
  239. X.IP "Miscellaneous Commands"
  240. XHere you can fold the directory or the versions of a file and
  241. Xupdate the buffer (i.e. the \fCg\fR command).
  242. X.IP "Version Control"
  243. XThis section deals with versions: you can save or retrieve a version,
  244. Xpromote or unpromote versions, compare versions, flag files or
  245. Xversions for deletions and execute them.
  246. X.RE
  247. X
  248. END_OF_FILE
  249. if test 9634 -ne `wc -c <'man/man1/shapetools.1'`; then
  250.     echo shar: \"'man/man1/shapetools.1'\" unpacked with wrong size!
  251. fi
  252. # end of 'man/man1/shapetools.1'
  253. fi
  254. if test -f 'src/afs/afsattrs.c' -a "${1}" != "-c" ; then 
  255.   echo shar: Will not clobber existing file \"'src/afs/afsattrs.c'\"
  256. else
  257. echo shar: Extracting \"'src/afs/afsattrs.c'\" \(9878 characters\)
  258. sed "s/^X//" >'src/afs/afsattrs.c' <<'END_OF_FILE'
  259. X/*
  260. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  261. X *  and U. Pralle
  262. X * 
  263. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  264. X * WARRANTY for any part of this software to work correctly or as described
  265. X * in the manuals. We do not accept any liability for any kind of damage
  266. X * caused by use of this software, such as loss of data, time, money, or 
  267. X * effort.
  268. X * 
  269. X * Permission is granted to use, copy, modify, or distribute any part of
  270. X * this software as long as this is done without asking for charge, and
  271. X * provided that this copyright notice is retained as part of the source
  272. X * files. You may charge a distribution fee for the physical act of
  273. X * transferring a copy, and you may at your option offer warranty
  274. X * protection in exchange for a fee.
  275. X * 
  276. X * Direct questions to: Tech. Univ. Berlin
  277. X *              Wilfried Koch
  278. X *              Sekr. FR 5-6 
  279. X *              Franklinstr. 28/29
  280. X *              D-1000 Berlin 10, West Germany
  281. X * 
  282. X *              Tel: +49-30-314-22972
  283. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  284. X */
  285. X/*LINTLIBRARY*/
  286. X/*
  287. X *    Shape/AFS
  288. X *
  289. X *    afsattrs.c - reading and writing simple attributes
  290. X *
  291. X *    Author: Andreas Lampen, TU-Berlin (andy@coma.UUCP
  292. X *                       andy@db0tui62.BITNET)
  293. X *
  294. X *    $Header: afsattrs.c[1.5] Wed Feb 22 16:27:54 1989 andy@coma published $
  295. X *
  296. X *    EXPORT:
  297. X *    af_rname -- get name
  298. X *    af_rtype -- get type
  299. X *    af_rsyspath -- get system pathname
  300. X *    af_rgen -- return generation number
  301. X *    af_rrev -- return revision number
  302. X *      af_rowner -- return owner
  303. X *      af_chowner -- change owner
  304. X *      af_rauthor -- return author
  305. X *      af_chauthor -- return author
  306. X *    af_chmod -- change mode
  307. X *    af_gattrs -- get attribute buffer
  308. X *
  309. X *      OBSOLETE:
  310. X *    af_rouid -- return user id of owner
  311. X *    af_rogid -- return group id of owner
  312. X *    af_chown -- change uid and gid of owner
  313. X *    af_rauid -- return user id of author
  314. X *    af_ragid -- return group id of author
  315. X *    af_chaut -- change uid and gid of author
  316. X */
  317. X
  318. X#include <stdio.h>
  319. X#include <string.h>
  320. X#ifdef SUNOS_4_0
  321. X#include <strings.h>
  322. X#endif
  323. X
  324. X#include "typeconv.h"
  325. X#include "afsys.h"
  326. X#include "afs.h"
  327. X
  328. Xchar *malloc();
  329. X
  330. X/*====================================================================
  331. X *    af_rname -- return name
  332. X *
  333. X *====================================================================*/
  334. X
  335. XEXPORT char *af_rname (key)
  336. X     Af_key *key;
  337. X{
  338. X  char *name;
  339. X
  340. X  if (af_keytest (key))
  341. X    SFAIL ("rname", "", AF_EINVKEY, (char *)0);
  342. X
  343. X  if ((name = malloc ((unsigned) (strlen (VATTR(key).af_name) + sizeof (char)))) == (char *)0)
  344. X    FAIL ("rname", "malloc", AF_ESYSERR, (char *)0);
  345. X  (void) strcpy (name, VATTR(key).af_name);
  346. X  return (name);
  347. X}
  348. X
  349. X
  350. X/*====================================================================
  351. X *    af_rtype -- return type
  352. X *
  353. X *====================================================================*/
  354. X
  355. XEXPORT char *af_rtype (key)
  356. X     Af_key *key;
  357. X{
  358. X  char *type;
  359. X
  360. X  if (af_keytest (key))
  361. X    SFAIL ("rtype", "", AF_EINVKEY, (char *)0);
  362. X  if (!VATTR(key).af_type)
  363. X    return ((char *)0);
  364. X
  365. X  if ((type = malloc ((unsigned) (strlen (VATTR(key).af_type) + sizeof (char)))) == (char *)0)
  366. X    FAIL ("rtype", "malloc", AF_ESYSERR, (char *)0);
  367. X  (void) strcpy (type, VATTR(key).af_type);
  368. X  return (type);
  369. X}
  370. X
  371. X
  372. X/*====================================================================
  373. X *    af_rsyspath -- return system pathname
  374. X *
  375. X *====================================================================*/
  376. X
  377. XEXPORT char *af_rsyspath (key)
  378. X     Af_key *key;
  379. X{
  380. X  char   *syspath;
  381. X
  382. X  if (af_keytest (key))
  383. X    SFAIL ("rsyspath", "", AF_EINVKEY, (char *)0);
  384. X
  385. X  if ((syspath = malloc ((unsigned) (strlen (CATTR(key).af_syspath) + sizeof (char)))) == (char *)0)
  386. X    FAIL ("rsyspath", "malloc", AF_ESYSERR, (char *)0);
  387. X  (void) strcpy (syspath, CATTR(key).af_syspath);
  388. X  return (syspath);
  389. X}
  390. X
  391. X
  392. X/*====================================================================
  393. X *    af_rgen -- return generation number
  394. X *
  395. X *====================================================================*/
  396. X
  397. XEXPORT af_rgen (key)
  398. X     Af_key *key;
  399. X{
  400. X  if (af_keytest (key))
  401. X    SFAIL ("rgen", "", AF_EINVKEY, ERROR);
  402. X  return (VATTR(key).af_gen);
  403. X}
  404. X
  405. X
  406. X/*====================================================================
  407. X *    af_rrev -- return revision number
  408. X *
  409. X *====================================================================*/
  410. X
  411. XEXPORT af_rrev (key)
  412. X     Af_key *key;
  413. X{
  414. X  if (af_keytest (key))
  415. X    SFAIL ("rrev", "", AF_EINVKEY, ERROR);
  416. X  return (VATTR(key).af_rev);
  417. X}
  418. X
  419. X/*====================================================================
  420. X *      af_rowner -- return owner
  421. X *
  422. X *====================================================================*/
  423. X
  424. XEXPORT Af_user *af_rowner (key)
  425. X     Af_key *key;
  426. X{
  427. X  static Af_user owner;
  428. X
  429. X  if (af_keytest (key))
  430. X    SFAIL ("rowner", "", AF_EINVKEY, (Af_user *)0);
  431. X
  432. X  (void) strcpy (owner.af_username, CATTR(key).af_ownname);
  433. X  (void) strcpy (owner.af_userhost, CATTR(key).af_ownhost);
  434. X  return (&owner);
  435. X}
  436. X
  437. X/*====================================================================
  438. X *      af_chowner -- change owner
  439. X *
  440. X *====================================================================*/
  441. X
  442. XEXPORT af_chowner (key, owner)
  443. X     /*ARGSUSED*/
  444. X     Af_key  *key;
  445. X     Af_user *owner;
  446. X{
  447. X  /* not yet implemented (chowner) */
  448. X  SFAIL ("chowner", "", AF_EACCES, ERROR);
  449. X}
  450. X
  451. X/*====================================================================
  452. X *      af_rauthor -- return author
  453. X *
  454. X *====================================================================*/
  455. X
  456. XEXPORT Af_user *af_rauthor (key)
  457. X     Af_key *key;
  458. X{
  459. X  static Af_user author;
  460. X
  461. X  if (af_keytest (key))
  462. X    SFAIL ("rauthor", "", AF_EINVKEY, (Af_user *)0);
  463. X
  464. X  (void) strcpy (author.af_username, VATTR(key).af_auname);
  465. X  (void) strcpy (author.af_userhost, VATTR(key).af_auhost);
  466. X  return (&author);
  467. X}
  468. X
  469. X/*====================================================================
  470. X *      af_chauthor -- return author
  471. X *
  472. X *====================================================================*/
  473. X
  474. XEXPORT af_chauthor (key, author)
  475. X     Af_key  *key;
  476. X     Af_user *author;
  477. X{
  478. X  Uid_t uid;
  479. X  Gid_t gid;
  480. X
  481. X  if (af_keytest (key))
  482. X    SFAIL ("chauthor", "", AF_EINVKEY, ERROR);
  483. X  if (af_checkperm (key, AF_OWNER) == ERROR)
  484. X    return (ERROR);
  485. X
  486. X  if (VATTR(key).af_state == AF_BUSY)
  487. X    {
  488. X      if ((uid = af_getuid (author->af_username, author->af_userhost))
  489. X      == (Uid_t) -1)
  490. X    SFAIL ("chauthor", "", AF_EINVUSER, ERROR);
  491. X      if ((gid = af_getgid (author->af_username, author->af_userhost))
  492. X      == (Gid_t) -1)
  493. X    SFAIL ("chauthor", "", AF_EINVUSER, ERROR);
  494. X      if (af_uchown (key->af_ldes->af_busyfilename, (int) uid, (int) gid) == ERROR)
  495. X    FAIL ("chauthor", "chown", AF_ESYSERR, ERROR);
  496. X    }
  497. X  else
  498. X    {
  499. X      VATTR(key).af_auname = af_entersym (author->af_username);
  500. X      VATTR(key).af_auhost = af_enterhost (author->af_userhost);
  501. X    }
  502. X  if (af_updtvers (key, AF_CHANGE) == ERROR)
  503. X    return (ERROR);
  504. X  return (AF_OK);
  505. X}
  506. X
  507. X/*====================================================================
  508. X *    af_chmod -- change mode
  509. X *
  510. X *====================================================================*/
  511. X
  512. XEXPORT af_chmod (key, mode)
  513. X     Af_key *key;
  514. X     int    mode;
  515. X{
  516. X  if (af_keytest (key))
  517. X    SFAIL ("chmod", "", AF_EINVKEY, ERROR);
  518. X
  519. X  if (af_checkperm (key, AF_OWNER | AF_AUTHOR) == ERROR)
  520. X    return (ERROR);
  521. X
  522. X  if (VATTR(key).af_state == AF_BUSY)
  523. X    {
  524. X      if (af_uchmod (key->af_ldes->af_busyfilename, mode) == ERROR)
  525. X    FAIL ("chmod", "chmod", AF_ESYSERR, ERROR);
  526. X    }
  527. X  else
  528. X    VATTR(key).af_mode = mode;
  529. X  if (af_updtvers (key, AF_CHANGE) == ERROR)
  530. X    return (ERROR);
  531. X
  532. X  return (AF_OK);
  533. X}
  534. X
  535. X
  536. X/*====================================================================
  537. X *    af_gattrs -- get attribute buffer
  538. X *
  539. X *====================================================================*/
  540. X
  541. XEXPORT af_gattrs (key, attrbuf)
  542. X     Af_key   *key;
  543. X     Af_attrs *attrbuf;
  544. X{
  545. X  int i=0, size;
  546. X  char *udalist[AF_MAXUDAS], *udattrs, *valptr;
  547. X
  548. X  if (af_keytest (key))
  549. X    SFAIL ("gattrs", "", AF_EINVKEY, ERROR);
  550. X
  551. X  (void) strcpy (attrbuf->af_host, CATTR(key).af_host);
  552. X  (void) strcpy (attrbuf->af_name, VATTR(key).af_name);
  553. X  (void) strcpy (attrbuf->af_type, NOTNIL(VATTR(key).af_type));
  554. X  (void) strcpy (attrbuf->af_syspath, CATTR(key).af_syspath);
  555. X
  556. X  attrbuf->af_gen = VATTR(key).af_gen;
  557. X  attrbuf->af_rev = VATTR(key).af_rev;
  558. X  (void) strcpy (attrbuf->af_variant, NOTNIL(VATTR(key).af_variant));
  559. X  attrbuf->af_state = (int) VATTR(key).af_state;
  560. X  (void) strcpy (attrbuf->af_owner.af_username, CATTR(key).af_ownname);
  561. X  (void) strcpy (attrbuf->af_owner.af_userhost, CATTR(key).af_ownhost);
  562. X  (void) strcpy (attrbuf->af_author.af_username, VATTR(key).af_auname);
  563. X  (void) strcpy (attrbuf->af_author.af_userhost, VATTR(key).af_auhost);
  564. X  attrbuf->af_size = VATTR(key).af_fsize;
  565. X  attrbuf->af_mode = VATTR(key).af_mode;
  566. X  (void) strcpy (attrbuf->af_locker.af_username, NOTNIL(VATTR(key).af_lckname));
  567. X  (void) strcpy (attrbuf->af_locker.af_userhost, NOTNIL(VATTR(key).af_lckhost));
  568. X  attrbuf->af_mtime = VATTR(key).af_mtime;
  569. X  attrbuf->af_atime = VATTR(key).af_atime;
  570. X  attrbuf->af_ctime = VATTR(key).af_ctime;
  571. X  attrbuf->af_stime = VATTR(key).af_stime;
  572. X  attrbuf->af_ltime = VATTR(key).af_ltime;
  573. X
  574. X  /* copy user defined attributes */
  575. X  if (VATTR(key).af_udanum > 0)
  576. X    {
  577. X      size = af_lhashsyms (&(VATTR(key).af_uhtab), udalist);
  578. X      if ((udattrs = malloc ((unsigned) size)) == (char *)0)
  579. X    FAIL ("gattrs", "malloc", AF_ESYSERR, ERROR);
  580. X      while (udalist[i] != (char *)0)
  581. X    {
  582. X      (void) strcpy (udattrs, udalist[i]);
  583. X      /* replace delimiters by '\n' */
  584. X      valptr = index (udattrs, AF_UDANAMDEL);
  585. X      while ((valptr = index (valptr, AF_UDAVALDEL)) != (char *)0)
  586. X        valptr[0] = '\n';
  587. X      attrbuf->af_udattrs[i] = udattrs;
  588. X      udattrs = udattrs + (strlen(udalist[i])+1);
  589. X      i++;
  590. X    }
  591. X      attrbuf->af_udattrs[i] = (char *)0; /* finish list */
  592. X    }
  593. X  else
  594. X    attrbuf->af_udattrs[0] = (char *)0;
  595. X
  596. X  return (AF_OK);
  597. X}
  598. END_OF_FILE
  599. if test 9878 -ne `wc -c <'src/afs/afsattrs.c'`; then
  600.     echo shar: \"'src/afs/afsattrs.c'\" unpacked with wrong size!
  601. fi
  602. # end of 'src/afs/afsattrs.c'
  603. fi
  604. if test -f 'src/vc/mkattr.c' -a "${1}" != "-c" ; then 
  605.   echo shar: Will not clobber existing file \"'src/vc/mkattr.c'\"
  606. else
  607. echo shar: Extracting \"'src/vc/mkattr.c'\" \(9705 characters\)
  608. sed "s/^X//" >'src/vc/mkattr.c' <<'END_OF_FILE'
  609. X/*
  610. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  611. X *  and U. Pralle
  612. X * 
  613. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  614. X * WARRANTY for any part of this software to work correctly or as described
  615. X * in the manuals. We do not accept any liability for any kind of damage
  616. X * caused by use of this software, such as loss of data, time, money, or 
  617. X * effort.
  618. X * 
  619. X * Permission is granted to use, copy, modify, or distribute any part of
  620. X * this software as long as this is done without asking for charge, and
  621. X * provided that this copyright notice is retained as part of the source
  622. X * files. You may charge a distribution fee for the physical act of
  623. X * transferring a copy, and you may at your option offer warranty
  624. X * protection in exchange for a fee.
  625. X * 
  626. X * Direct questions to: Tech. Univ. Berlin
  627. X *              Wilfried Koch
  628. X *              Sekr. FR 5-6 
  629. X *              Franklinstr. 28/29
  630. X *              D-1000 Berlin 10, West Germany
  631. X * 
  632. X *              Tel: +49-30-314-22972
  633. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  634. X */
  635. X#ifndef lint
  636. Xstatic char *AFSid = "$Header: mkattr.c[3.6] Thu Feb 23 18:13:34 1989 axel@coma published $";
  637. X#ifdef CFFLGS
  638. Xstatic char *ConfFlg = CFFLGS;
  639. X    /* should be defined from within Makefile */
  640. X#endif
  641. X#endif
  642. X/*
  643. X * Log for /u/shape/dist-tape/src/vc/mkattr.c[3.2]
  644. X *     Thu Feb 23 18:13:34 1989 axel@coma published $
  645. X *  --- empty log message ---
  646. X *  mkattr.c[3.5] Thu Feb 23 18:13:34 1989 axel@coma published $
  647. X *  --- empty log message ---
  648. X *  mkattr.c[3.6] Thu Feb 23 18:13:34 1989 axel@coma published $
  649. X *  --- empty log message ---
  650. X */
  651. X
  652. X/*LINTLIBRARY*/
  653. X
  654. X#include <strings.h>
  655. X#include "afs.h"
  656. X#include "retrv.h"
  657. X
  658. X#ifdef lint
  659. Xchar *st_table[] = {
  660. X  "This is a fake definition. The real thing is in libutil (see 'misc')."
  661. X  };
  662. X#else
  663. Xextern char *st_table[];
  664. X#endif lint
  665. X
  666. Xmkvno (vstring) char *vstring; {
  667. X  /*
  668. X   *  converts a string of the form 'gen.rev' (e.g. 12.23) into an
  669. X   *  integer value with the generation part stored in the hiword
  670. X   *  and the revision part in the loword. In case 'vstring'
  671. X   *  is a symbolic version name, which is assumed if the 'gen.rev'
  672. X   *  pattern does not match, a value of zero is returned (0.0 = no vers).
  673. X   */
  674. X  char *emsg, *re_comp();
  675. X  int genno, revno, rc;
  676. X
  677. X  if (emsg = re_comp("[0-9][0-9]*\\.[0-9][0-9]*")) { /* quite liberal RE */
  678. X    logerr (emsg);
  679. X    return 0;
  680. X  }
  681. X  if (fail((rc=re_exec (vstring)))) {
  682. X    logerr ("internal error in matching RE (mkvno)");
  683. X  }
  684. X  if (rc) {
  685. X    (void)sscanf (vstring, "%d.%d", &genno, &revno);
  686. X    return (genno << 16) | (0x0000FFFF & revno);
  687. X
  688. X  }
  689. X  else return 0;
  690. X}
  691. X
  692. XBoundVersion (rawname, cookedname, vstring) 
  693. X     char *rawname, *cookedname, *vstring; {
  694. X/*
  695. X *  This function returns nonzero if 'rawname' is of the form
  696. X *  'foo[1.4]'. In this case 'foo' will be written into 'cookedname'
  697. X *  and 'vstring' will become '1.4'. Otherwise, both are left unchanged
  698. X *  and the funtion returns zero.
  699. X */
  700. X       char *b1, *b2;
  701. X       int vno;
  702. X
  703. X       if ((b1=rindex (rawname, '[')) && (b2 = rindex (rawname, ']'))
  704. X       && (b1 < b2)) {
  705. X     *b1 = *b2 = '\0'; /* make 'em separate strings */
  706. X     if (mkvno (b1+1)) {
  707. X       (void)strcpy (cookedname, rawname);
  708. X       (void)strcpy (vstring, b1+1);
  709. X       *b1 = '['; *b2 = ']';
  710. X       return TRUE;
  711. X     }
  712. X     else {
  713. X       if (vno=Symn2Vno (rawname, b1+1)) {
  714. X         (void)sprintf (vstring, "%d.%d", gen(vno), rev(vno));
  715. X         (void)strcpy (cookedname, rawname);
  716. X         *b1 = '['; *b2 = ']';
  717. X         return TRUE;
  718. X       }
  719. X       *b1 = '['; *b2 = ']';
  720. X     }
  721. X       }
  722. X       return FALSE;
  723. X     }
  724. X       
  725. Xmkgenno (gstring) char *gstring; {
  726. X  int genno;
  727. X
  728. X  genno = atoi (gstring);
  729. X  if (genno < 0)
  730. X    return 0;
  731. X  else 
  732. X    return (genno < 1000) ? genno : 0;
  733. X}
  734. X
  735. Xint Symn2Vno (fname, sym) char *fname, *sym; {
  736. X  Af_attrs warrant;
  737. X  Af_set   hits;
  738. X  Af_key   key;
  739. X  char symname[256], messg[80], *p;
  740. X  int rc, vnum;
  741. X
  742. X  af_initattrs (&warrant);
  743. X  (void)sprintf (symname, "%s=%s", SYMNAME, sym);
  744. X  warrant.af_udattrs[0] = symname;
  745. X  warrant.af_udattrs[1] = (char *)NULL;
  746. X  (void)strcpy (warrant.af_syspath, p=af_afpath(fname)); free (p);
  747. X  (void)strcpy (warrant.af_name, p=af_afname(fname)); free (p);
  748. X  (void)strcpy (warrant.af_type, p=af_aftype(fname)); free (p);
  749. X  if ((rc=af_find (&warrant, &hits)) > 1) { 
  750. X    /* this shouldn't happen, as symbolic names are supposed to be */
  751. X    /* within one ASO's history */
  752. X    af_dropset (&hits);
  753. X    (void)sprintf (messg, 
  754. X     "%s's history inconsistent.\nSymbolic name \"%s\" multiply assigned.",
  755. X         fname, sym);
  756. X    logerr (messg);
  757. X    return FALSE;
  758. X  }
  759. X  else if (rc < 0) {
  760. X    af_perror ("af_find (in SymnameInUse)");
  761. X    return FALSE;
  762. X  }
  763. X  else if (rc == 0) {
  764. X    af_dropset (&hits);
  765. X    return FALSE;
  766. X  }
  767. X  else { /* rc must be 1 -- thats just fine */
  768. X    af_setgkey (&hits, 0, &key);
  769. X    af_dropset (&hits);
  770. X    vnum = ((af_rgen (&key) << 16) | (0x0000FFFF & af_rrev (&key)));
  771. X    return vnum;
  772. X  }
  773. X}
  774. X
  775. X  
  776. Xmkstate (sstring) char *sstring; {
  777. X  int i;
  778. X  register char *cp;
  779. X
  780. X  cp = sstring;
  781. X  while (*cp ? (*cp++ |= ' ') : 0); /* convert to lowercase */
  782. X  for (i = AF_BUSY; i <= AF_FROZEN; i++)
  783. X    if (!strcmp (st_table[i], sstring))
  784. X      return i;
  785. X  return -1;
  786. X}
  787. X
  788. X#define BOTIME 70        /* Beginning Of TIME for Unix */
  789. X#define DINYEAR 365      /* No. of days in a non-leapyear */
  790. X#define DINMONTH 31      /* No. of days in a 'canonical' month */
  791. X#define SINDAY 86400     /* No. of seconds in a day (24 * 60 * 60) */
  792. X#define SINHR 3600       /* No. of seconds in an hour */
  793. X#define SINMIN 60        /* ... guess! ... */
  794. X
  795. Xtime_t mktime (tstring) char *tstring; {
  796. X  /*
  797. X   *  converts a YY/MM/DD[/HH:MM] string into a system time representation
  798. X   *  which by convention is the number of seconds since Jan. 1st 1970.
  799. X   */
  800. X  char *emsg, *re_comp();
  801. X  int yr, mo, dy, hr = 0, mint = 0, nfyrs, ndays, nsecs;
  802. X
  803. X  if (emsg = re_comp((strlen (tstring) > 8) ? 
  804. X             "[0-9][0-9]/[01][0-9]/[0-3][0-9]/[0-5][0-9]:[0-5][0-9]" :
  805. X             "[0-9][0-9]/[01][0-9]/[0-3][0-9]")) {
  806. X    logerr (emsg);
  807. X    return 0;
  808. X  }
  809. X  if (re_exec (tstring)) {
  810. X    (void)sscanf (tstring, "%d/%d/%d/%d:%d", &yr, &mo, &dy, &hr, &mint);
  811. X    if ((chkyr (yr)) && (chkmo (yr, mo)) && (chkdy (yr, mo, dy)) && 
  812. X    (chkhr (dy, hr)) && (chkmin (hr, mint))) {
  813. X      nfyrs = yr - BOTIME;
  814. X      ndays = nfyrs * DINYEAR + nlyrs (yr, BOTIME) + 
  815. X    (mo-1)*DINMONTH - cordays (yr, mo-1) + (dy-1);
  816. X      nsecs = ndays * SINDAY + (hr-1) * SINHR + mint * SINMIN;
  817. X      return nsecs;       /* it ^^^^ shouldn't be hr-1 but hr - confused! */
  818. X    }
  819. X    else return 0;
  820. X  }
  821. X  else return 0;
  822. X}
  823. X
  824. Xchkyr (year) {
  825. X  struct tm *now, *localtime();
  826. X  struct timeval t;
  827. X  struct timezone tzone; 
  828. X
  829. X  (void)gettimeofday (&t, &tzone);
  830. X  now = localtime (&t.tv_sec);
  831. X  return ((year >= 70) && (year <= now->tm_year));
  832. X}
  833. X
  834. Xchkmo (year, month) {
  835. X  struct tm *now, *localtime();
  836. X  struct timeval t;
  837. X  struct timezone tzone; 
  838. X
  839. X  (void)gettimeofday (&t, &tzone);
  840. X  now = localtime (&t.tv_sec);
  841. X  if ((month <= 12) && (month >= 1))
  842. X    return (now->tm_year == year) ? (month <= now->tm_mon+1) : TRUE;
  843. X  else
  844. X    return FALSE;
  845. X}
  846. X
  847. Xint itstoday = FALSE;
  848. X    
  849. Xchkdy (year, month, day) {
  850. X  struct tm *now, *localtime();
  851. X  struct timeval t;
  852. X  struct timezone tzone; 
  853. X
  854. X  month--; /* only here: Jan is 0, Dec is 11 -- as is in struct tm */
  855. X  (void)gettimeofday (&t, &tzone);
  856. X  now = localtime (&t.tv_sec);
  857. X  itstoday = ((year == now->tm_year) && (month == now->tm_mon) &&
  858. X          (day == now->tm_mday));
  859. X  if ((day <= 28) && ((year < now->tm_year) || (month < now->tm_mon)))
  860. X    return TRUE;
  861. X  else { /* some day in this month or a day at the end of some month */
  862. X    switch (month) {
  863. X    case 0:
  864. X    case 2:
  865. X    case 4:
  866. X    case 6:
  867. X    case 7:
  868. X    case 9:
  869. X    case 11:
  870. X      return ((day <= 31) && 
  871. X          (((now->tm_year == year) && (now->tm_mon == month)) ?
  872. X           (day <= now->tm_mday) : TRUE));
  873. X    case 3:
  874. X    case 5:
  875. X    case 8:
  876. X    case 10:
  877. X      return ((day <= 30) && 
  878. X          (((now->tm_year == year) && (now->tm_mon == month)) ?
  879. X           (day <= now->tm_mday) : TRUE));
  880. X    case 1:
  881. X      return (((isalyr (year)) ? (day <= 29) : (day <= 28)) && 
  882. X          (((now->tm_year == year) && (now->tm_mon == month)) ?
  883. X           (day <= now->tm_mday) : TRUE));
  884. X    default:
  885. X      logerr ("Heavens ! Our month-check doesn't work. (internal error)");
  886. X      return FALSE;
  887. X    }
  888. X  }
  889. X}
  890. X/*ARGSUSED*/
  891. Xchkhr (day, hour) {
  892. X  struct tm *now, *localtime();
  893. X  struct timeval t;
  894. X  struct timezone tzone; 
  895. X
  896. X  (void)gettimeofday (&t, &tzone);
  897. X  now = localtime (&t.tv_sec);
  898. X  if ((hour >= 0) && (hour <= 23))
  899. X    return (itstoday ? (hour <= now->tm_hour) : TRUE);
  900. X  else
  901. X    return FALSE;
  902. X}
  903. X
  904. Xchkmin (hour, mint) {
  905. X  struct tm *now, *localtime();
  906. X  struct timeval t;
  907. X  struct timezone tzone; 
  908. X
  909. X  (void)gettimeofday (&t, &tzone);
  910. X  now = localtime (&t.tv_sec);
  911. X  if ((mint >= 0) && (mint <= 59))
  912. X    return ((itstoday && (hour == now->tm_hour)) ? 
  913. X        (mint <= now->tm_min) : TRUE);
  914. X  else
  915. X    return FALSE;
  916. X}
  917. X
  918. Xisalyr (year) {
  919. X  /*
  920. X   *  assumes year to be a reasonable value
  921. X   *  checking is done according rules asked from K. Koester
  922. X   */
  923. X  if ((year % 2000) == 0)
  924. X    return FALSE;
  925. X  if ((year % 400) == 0)
  926. X    return TRUE;
  927. X  if ((year % 100) == 0)
  928. X    return FALSE;
  929. X  else
  930. X    return ((year % 4) == 0);
  931. X}
  932. X
  933. Xnlyrs (year, since) {
  934. X  /*
  935. X   *  returns number of leapyears from <since> to Jan. 1st <year>
  936. X   */
  937. X  register int i, lyrs=0;
  938. X
  939. X  for (i = since; i < year; i++)
  940. X    if (isalyr(i)) lyrs++;
  941. X  return lyrs;
  942. X}
  943. X
  944. Xint dcorlist[] = { 0, 0, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7 };
  945. X
  946. Xcordays (year, month) {
  947. X  /*
  948. X   *  returns number of days to substract from the sum of <month>
  949. X   *  31-day months.
  950. X   */
  951. X  
  952. X  if (isalyr (year))
  953. X    return ((dcorlist[month]) ? (dcorlist[month] - 1) : 0);
  954. X  else 
  955. X    return dcorlist[month];
  956. X}
  957. X    
  958. END_OF_FILE
  959. if test 9705 -ne `wc -c <'src/vc/mkattr.c'`; then
  960.     echo shar: \"'src/vc/mkattr.c'\" unpacked with wrong size!
  961. fi
  962. # end of 'src/vc/mkattr.c'
  963. fi
  964. if test -f 'src/vc/vadm_symname.c' -a "${1}" != "-c" ; then 
  965.   echo shar: Will not clobber existing file \"'src/vc/vadm_symname.c'\"
  966. else
  967. echo shar: Extracting \"'src/vc/vadm_symname.c'\" \(10086 characters\)
  968. sed "s/^X//" >'src/vc/vadm_symname.c' <<'END_OF_FILE'
  969. X/*
  970. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  971. X *  and U. Pralle
  972. X * 
  973. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  974. X * WARRANTY for any part of this software to work correctly or as described
  975. X * in the manuals. We do not accept any liability for any kind of damage
  976. X * caused by use of this software, such as loss of data, time, money, or 
  977. X * effort.
  978. X * 
  979. X * Permission is granted to use, copy, modify, or distribute any part of
  980. X * this software as long as this is done without asking for charge, and
  981. X * provided that this copyright notice is retained as part of the source
  982. X * files. You may charge a distribution fee for the physical act of
  983. X * transferring a copy, and you may at your option offer warranty
  984. X * protection in exchange for a fee.
  985. X * 
  986. X * Direct questions to: Tech. Univ. Berlin
  987. X *              Wilfried Koch
  988. X *              Sekr. FR 5-6 
  989. X *              Franklinstr. 28/29
  990. X *              D-1000 Berlin 10, West Germany
  991. X * 
  992. X *              Tel: +49-30-314-22972
  993. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  994. X */
  995. X#ifndef lint
  996. Xstatic char *AFSid = "$Header: vadm_symname.c[3.8] Thu Feb 23 18:14:21 1989 axel@coma published $";
  997. X#ifdef CFFLGS
  998. Xstatic char *ConfFlg = CFFLGS;
  999. X    /* should be defined from within Makefile */
  1000. X#endif
  1001. X#endif
  1002. X/*
  1003. X * Log for /u/shape/dist-tape/src/vc/vadm_symname.c[3.2]
  1004. X *     Thu Feb 23 18:14:22 1989 axel@coma published $
  1005. X *  --- empty log message ---
  1006. X *  vadm_symname.c[3.5] Thu Feb 23 18:14:22 1989 axel@coma published $
  1007. X *  --- empty log message ---
  1008. X *  vadm_symname.c[3.6] Thu Feb 23 18:14:22 1989 axel@coma save $
  1009. X *  --- empty log message ---
  1010. X *  vadm_symname.c[3.7] Thu Feb 23 18:14:22 1989 axel@coma save $
  1011. X *  --- empty log message ---
  1012. X *  vadm_symname.c[3.8] Thu Feb 23 18:14:22 1989 axel@coma published $
  1013. X *  --- empty log message ---
  1014. X */
  1015. X
  1016. X#include <sys/types.h>
  1017. X#include <sys/stat.h>
  1018. X
  1019. X#include <stdio.h>
  1020. X#include <strings.h>
  1021. X#include <afs.h>
  1022. X
  1023. X#include "vadm.h"
  1024. X#include "project.h"
  1025. X#include "afsapp.h"
  1026. X
  1027. Xextern unsigned options;
  1028. Xextern int def_vnum;
  1029. Xextern struct Transaction ThisTransaction;
  1030. X/* locals */
  1031. Xstatic char buf[1024];
  1032. X
  1033. X/**/
  1034. XDoSymname (vlist, ac, av, sym)
  1035. X     struct vc_vlist *vlist;
  1036. X     int ac;
  1037. X     char **av;
  1038. X     char *sym;
  1039. X{
  1040. X  Af_set set;
  1041. X  char **erroneous;
  1042. X  int i, errs;
  1043. X  char version[2048];
  1044. X  char symname[2048];
  1045. X  
  1046. X  if (SymnameInUse (ac, av, sym)) {
  1047. X    (void)sprintf (buf, "symbolic name %s already assigned to some other version.",
  1048. X         sym);
  1049. X    logerr (buf);
  1050. X    return 1;
  1051. X  }
  1052. X  if (IsOptionSet(Vopt_version)) {
  1053. X    errs = GetKeysByGenRev
  1054. X    (ac,av, gen(def_vnum), rev(def_vnum), &set, &erroneous);
  1055. X  }
  1056. X  else {
  1057. X    if (!vlist->from_version_set || !vlist->to_version_set) {
  1058. X      if (IsOptionSet (Vopt_binary))
  1059. X    errs = GetKeysByGenRev 
  1060. X      (ac,av, AF_BUSYVERS, AF_BUSYVERS, &set, &erroneous);
  1061. X      else
  1062. X    errs = GetKeysByGenRev 
  1063. X      (ac,av, AF_LASTVERS, AF_LASTVERS, &set, &erroneous);
  1064. X    }
  1065. X    else
  1066. X      errs = GetKeysByName (ac, av, vlist, &set, &erroneous);
  1067. X  }
  1068. X
  1069. X  if (errs)
  1070. X    print_erroneous (erroneous, errs);
  1071. X
  1072. X  if (!set.af_nkeys) {
  1073. X    logmsg ("Nothing appropriate found.");
  1074. X    return 1;
  1075. X  }
  1076. X
  1077. X  if (errs && !ask_confirm ("Continue ?", "yes"))
  1078. X    return 1;
  1079. X
  1080. X  (void)sprintf (symname, "%s=%s", SYMNAME, sym);
  1081. X  
  1082. X  for (i = 0; i < set.af_nkeys; i++) {
  1083. X    mkvstring (version, &set.af_klist[i]);
  1084. X    if (setjmp (ThisTransaction.tr_env)) continue; 
  1085. X    if (af_sudattr (&set.af_klist[i], AF_ADD, symname) == -1) {
  1086. X      af_perror ("DoSymname: af_sudattr");
  1087. X      return 1;
  1088. X    }
  1089. X    (void)sprintf (buf, "Symbolic name %s attached to %s.", sym, version);
  1090. X    logmsg (buf);
  1091. X  }
  1092. X  return 0;
  1093. X}
  1094. X
  1095. XDoSetCommentSymbol (ac, av, sym)
  1096. X     int ac;
  1097. X     char **av;
  1098. X     char *sym;
  1099. X{
  1100. X  Af_set set;
  1101. X  char **erroneous, c_symbol[CLEADMAXLEN];
  1102. X  int i, errs;
  1103. X  
  1104. X  errs = GetKeysByName (ac, av, (struct vc_vlist *)NULL, &set, 
  1105. X            &erroneous);
  1106. X
  1107. X  if (errs)
  1108. X    print_erroneous (erroneous, errs);
  1109. X
  1110. X  if (!set.af_nkeys) {
  1111. X    logmsg ("Nothing appropriate found.");
  1112. X    return 1;
  1113. X  }
  1114. X
  1115. X  if (errs && !ask_confirm ("Continue ?", "yes"))
  1116. X    return 1;
  1117. X
  1118. X  (void)sprintf (c_symbol, "%s=%s", CLEAD, sym);
  1119. X  
  1120. X  for (i = 0; i < set.af_nkeys; i++) {
  1121. X
  1122. X    if (setjmp (ThisTransaction.tr_env)) continue;
  1123. X    if (af_sudattr (&set.af_klist[i], AF_REPLACE, c_symbol) == -1) {
  1124. X      if (af_sudattr (&set.af_klist[i], AF_ADD, c_symbol) == -1) {
  1125. X    af_perror ("DoSetCommentSymbol: af_suadttr");
  1126. X    return 1;
  1127. X      }
  1128. X    }
  1129. X  }
  1130. X  return 0;
  1131. X}
  1132. X
  1133. XDoSetUda (vlist, ac, av)
  1134. X     struct vc_vlist *vlist;
  1135. X     int ac;
  1136. X     char **av;
  1137. X{
  1138. X  extern char *TakeFromFile, udaname[], udaval[];
  1139. X
  1140. X  Af_set set;
  1141. X  char **erroneous;
  1142. X  int i, errs, udamemlen;
  1143. X  char version[128], *hook, *udamem, *cp, messg[80], *malloc();
  1144. X  FILE *tff;
  1145. X  struct stat sbuf;
  1146. X
  1147. X  if (IsOptionSet(Vopt_version)) {
  1148. X    errs = GetKeysByGenRev
  1149. X    (ac,av, gen(def_vnum), rev(def_vnum), &set, &erroneous);
  1150. X  }
  1151. X  else {
  1152. X    if (!vlist->from_version_set || !vlist->to_version_set)
  1153. X      errs = GetKeysByGenRev 
  1154. X    (ac,av, AF_BUSYVERS, AF_BUSYVERS, &set, &erroneous);
  1155. X    else
  1156. X      errs = GetKeysByName (ac, av, vlist, &set, &erroneous);
  1157. X  }
  1158. X  if (errs)
  1159. X    print_erroneous (erroneous, errs);
  1160. X
  1161. X  if (!set.af_nkeys) {
  1162. X    logmsg ("Nothing appropriate found.");
  1163. X    return 1;
  1164. X  }
  1165. X
  1166. X  if (errs && !ask_confirm ("Continue ?", "yes"))
  1167. X    return 1;
  1168. X
  1169. X  if (TakeFromFile) {
  1170. X    if ((tff = fopen (TakeFromFile, "r")) == NULL) {
  1171. X      (void)sprintf (messg, "can't open attribute value file %s.", TakeFromFile);
  1172. X      logerr (messg);
  1173. X      return 1;
  1174. X    }
  1175. X    if (fstat (fileno (tff), &sbuf) < 0) {
  1176. X      perror ("fstat");
  1177. X      return 1;
  1178. X    }
  1179. X    udamem = 
  1180. X      malloc ((unsigned)(udamemlen=(strlen (udaname) + sbuf.st_size + 2)));
  1181. X    if (udamem == NULL) {
  1182. X      logerr ("Not enough memory to build attribute");
  1183. X      return 1;
  1184. X    }
  1185. X    (void)sprintf (udamem, "%s=", udaname);
  1186. X    cp = udamem + strlen (udamem);
  1187. X    (void)fread (cp, sizeof (char), (Size_t)sbuf.st_size, tff); 
  1188. X    (void)fclose (tff);
  1189. X    udamem[udamemlen-1] = '\0';
  1190. X  }
  1191. X  else { /* udaval not taken from file */
  1192. X    udamem = 
  1193. X      malloc ((unsigned)(udamemlen=(strlen (udaname) + strlen (udaval) + 2)));
  1194. X    if (udamem == NULL) {
  1195. X      logerr ("Not enough memory to build attribute");
  1196. X      return 1;
  1197. X    }
  1198. X    (void)sprintf (udamem, "%s=%s", udaname, udaval);
  1199. X  }  
  1200. X  for (i = 0; i < set.af_nkeys; i++) {
  1201. X    if (setjmp (ThisTransaction.tr_env)) continue;
  1202. X    mkvstring (version, &set.af_klist[i]);
  1203. X
  1204. X    if (hook=af_rudattr (&set.af_klist[i], udaname)) {
  1205. X      free (hook);
  1206. X      if (af_sudattr (&set.af_klist[i], AF_REPLACE, udamem) == -1) {
  1207. X    af_perror ("af_sudattr");
  1208. X    return 1;
  1209. X      }
  1210. X    }
  1211. X    else { /* attribute is newly introduced */
  1212. X      if (af_sudattr (&set.af_klist[i], AF_ADD, udamem) == -1) {
  1213. X    af_perror ("af_suadttr");
  1214. X    return 1;
  1215. X      }
  1216. X    }
  1217. X  }
  1218. X  free (udamem);
  1219. X  return 0;
  1220. X}
  1221. X
  1222. XDoUnsetUda (vlist, ac, av)
  1223. X     struct vc_vlist *vlist;
  1224. X     int ac;
  1225. X     char **av;
  1226. X{
  1227. X  extern char udaname[];
  1228. X
  1229. X  Af_set set;
  1230. X  char **erroneous;
  1231. X  int i, errs;
  1232. X  char version[128], *hook;
  1233. X
  1234. X  if (IsOptionSet(Vopt_version)) {
  1235. X    errs = GetKeysByGenRev
  1236. X    (ac,av, gen(def_vnum), rev(def_vnum), &set, &erroneous);
  1237. X  }
  1238. X  else {
  1239. X    if (!vlist->from_version_set || !vlist->to_version_set)
  1240. X      errs = GetKeysByGenRev 
  1241. X    (ac,av, AF_BUSYVERS, AF_BUSYVERS, &set, &erroneous);
  1242. X    else
  1243. X      errs = GetKeysByName (ac, av, vlist, &set, &erroneous);
  1244. X  }
  1245. X  if (errs)
  1246. X    print_erroneous (erroneous, errs);
  1247. X
  1248. X  if (!set.af_nkeys) {
  1249. X    logmsg ("Nothing appropriate found.");
  1250. X    return 1;
  1251. X  }
  1252. X
  1253. X  if (errs && !ask_confirm ("Continue ?", "yes"))
  1254. X    return 1;
  1255. X
  1256. X  for (i = 0; i < set.af_nkeys; i++) {
  1257. X    mkvstring (version, &set.af_klist[i]);
  1258. X    if (setjmp (ThisTransaction.tr_env)) continue; 
  1259. X    if (hook=af_rudattr (&set.af_klist[i], udaname)) {
  1260. X      free (hook);
  1261. X      if (af_sudattr (&set.af_klist[i], AF_REMOVE, udaname) == -1) {
  1262. X    af_perror ("af_sudattr");
  1263. X    return 1;
  1264. X      }
  1265. X    }
  1266. X  }
  1267. X  return 0;
  1268. X}
  1269. X
  1270. Xint DoSetAttrs (vlist, ac, av)
  1271. X     struct vc_vlist *vlist;
  1272. X     int ac;
  1273. X     char **av;
  1274. X{
  1275. X  extern char Attrfile[];
  1276. X
  1277. X  char *as, **erroneous, *getattr(), version[128];
  1278. X  Af_set set;
  1279. X  register int i;
  1280. X  int errs;
  1281. X
  1282. X  if (IsOptionSet(Vopt_version)) {
  1283. X    errs = GetKeysByGenRev
  1284. X    (ac,av, gen(def_vnum), rev(def_vnum), &set, &erroneous);
  1285. X  }
  1286. X  else {
  1287. X    if (!vlist->from_version_set || !vlist->to_version_set)
  1288. X      errs = GetKeysByGenRev 
  1289. X    (ac,av, AF_BUSYVERS, AF_BUSYVERS, &set, &erroneous);
  1290. X    else
  1291. X      errs = GetKeysByName (ac, av, vlist, &set, &erroneous);
  1292. X  }
  1293. X  if (errs)
  1294. X    print_erroneous (erroneous, errs);
  1295. X
  1296. X  if (!set.af_nkeys) {
  1297. X    logmsg ("Nothing appropriate found.");
  1298. X    return 1;
  1299. X  }
  1300. X
  1301. X  if (errs && !ask_confirm ("Continue ?", "yes"))
  1302. X    return 1;
  1303. X
  1304. X  for (i = 0; i < set.af_nkeys; i++) {
  1305. X    mkvstring (version, &set.af_klist[i]);
  1306. X    if (setjmp (ThisTransaction.tr_env)) continue; 
  1307. X    as = getattr (Attrfile, (Project *)NULL, (char *)NULL, REWIND);
  1308. X    af_sudattr (&set.af_klist[i], AF_ADD, as);
  1309. X    while (as=getattr (Attrfile, (Project *)NULL, (char *)NULL, NEXT)) {
  1310. X      af_sudattr (&set.af_klist[i], AF_ADD, as);
  1311. X    }
  1312. X  }
  1313. X  return FALSE;
  1314. X}
  1315. X
  1316. Xint SymnameInUse (ac, av, sym) int ac; char **av, *sym; {
  1317. X  /*
  1318. X   * Function yields TRUE, if any version of any object named in 'av'
  1319. X   * has the name 'sym' assigned as value of the user-defined attribute
  1320. X   * SYMNAME.
  1321. X   */
  1322. X  
  1323. X  Af_attrs warrant;
  1324. X  Af_set hits;
  1325. X  int i, rc;
  1326. X  char symname[2048], cname[MAXNAMLEN], vstring[80];
  1327. X
  1328. X  (void)sprintf (symname, "%s=%s", SYMNAME, sym);
  1329. X  af_initattrs (&warrant);
  1330. X  warrant.af_udattrs[0] = symname;
  1331. X  warrant.af_udattrs[1] = (char *)NULL;
  1332. X  for (i = 0; i < ac; i++) {
  1333. X    if (BoundVersion (av[i], cname, vstring))
  1334. X      initwarrant (&warrant, cname);
  1335. X    else
  1336. X      initwarrant (&warrant, av[i]);
  1337. X    if ((rc=af_find (&warrant, &hits) > 0)) { 
  1338. X      af_dropset (&hits);
  1339. X      return rc;
  1340. X    }
  1341. X    else if (rc < 0)
  1342. X      af_perror ("af_find (in SymnameInUse)");
  1343. X  }
  1344. X  return FALSE;
  1345. X}
  1346. X
  1347. Xinitwarrant (warrant, fname) Af_attrs *warrant; char *fname; {
  1348. X  (void)strcpy (warrant->af_syspath, af_afpath (fname));
  1349. X  (void)strcpy (warrant->af_name, af_afname (fname));
  1350. X  (void)strcpy (warrant->af_type, af_aftype (fname));
  1351. X}
  1352. X
  1353. END_OF_FILE
  1354. if test 10086 -ne `wc -c <'src/vc/vadm_symname.c'`; then
  1355.     echo shar: \"'src/vc/vadm_symname.c'\" unpacked with wrong size!
  1356. fi
  1357. # end of 'src/vc/vadm_symname.c'
  1358. fi
  1359. if test -f 'src/vc/vlopt.c' -a "${1}" != "-c" ; then 
  1360.   echo shar: Will not clobber existing file \"'src/vc/vlopt.c'\"
  1361. else
  1362. echo shar: Extracting \"'src/vc/vlopt.c'\" \(9708 characters\)
  1363. sed "s/^X//" >'src/vc/vlopt.c' <<'END_OF_FILE'
  1364. X/*
  1365. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  1366. X *  and U. Pralle
  1367. X * 
  1368. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  1369. X * WARRANTY for any part of this software to work correctly or as described
  1370. X * in the manuals. We do not accept any liability for any kind of damage
  1371. X * caused by use of this software, such as loss of data, time, money, or 
  1372. X * effort.
  1373. X * 
  1374. X * Permission is granted to use, copy, modify, or distribute any part of
  1375. X * this software as long as this is done without asking for charge, and
  1376. X * provided that this copyright notice is retained as part of the source
  1377. X * files. You may charge a distribution fee for the physical act of
  1378. X * transferring a copy, and you may at your option offer warranty
  1379. X * protection in exchange for a fee.
  1380. X * 
  1381. X * Direct questions to: Tech. Univ. Berlin
  1382. X *              Wilfried Koch
  1383. X *              Sekr. FR 5-6 
  1384. X *              Franklinstr. 28/29
  1385. X *              D-1000 Berlin 10, West Germany
  1386. X * 
  1387. X *              Tel: +49-30-314-22972
  1388. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  1389. X */
  1390. X#ifndef lint
  1391. Xstatic char *AFSid = "$Header: vlopt.c[3.6] Thu Feb 23 18:14:54 1989 axel@coma published $";
  1392. X#ifdef CFFLGS
  1393. Xstatic char *ConfFlg = CFFLGS;
  1394. X    /* should be defined from within Makefile */
  1395. X#endif
  1396. X#endif
  1397. X/*
  1398. X * Log for /u/shape/dist-tape/src/vc/vlopt.c[3.4]
  1399. X *     Thu Feb 23 18:14:54 1989 axel@coma published $
  1400. X *  --- empty log message ---
  1401. X *  vlopt.c[3.5] Thu Feb 23 18:14:54 1989 axel@coma published $
  1402. X *  --- empty log message ---
  1403. X *  vlopt.c[3.6] Thu Feb 23 18:14:54 1989 axel@coma published $
  1404. X *  --- empty log message ---
  1405. X */
  1406. X
  1407. X#include <stdio.h>
  1408. X#include "ParseArgs.h"
  1409. X#include "vl.h"
  1410. X
  1411. X/*
  1412. X * Global variables
  1413. X */
  1414. Xextern int version_number;
  1415. Xunsigned int options = 0;    /* where the options goes */
  1416. Xint immediate_output = 0;    /* if output should be shipped immediatly */
  1417. Xchar multicol_output_possible = 1; /* multi column output flag */
  1418. X
  1419. Xextern int handle_a_option ();
  1420. Xextern int handle_author_options ();
  1421. X#ifdef DEBUGCOL
  1422. Xextern int handle_dc_option  ();
  1423. X#endif DEBUGCOL
  1424. X
  1425. Xextern int handle_R_option  ();
  1426. Xextern int handle_b_option  ();
  1427. Xextern int handle_g_option  ();
  1428. Xextern int handle_h_option  ();
  1429. Xextern int handle_H_options ();
  1430. Xextern int handle_l_option  ();
  1431. Xextern int handle_L_option  ();
  1432. Xextern int handle_last_option ();
  1433. Xextern int handle_n_option  ();
  1434. Xextern int handle_owner_option  ();
  1435. Xextern int handle_author_options ();
  1436. Xextern int handle_q_option  ();
  1437. Xextern int handle_s_option  ();
  1438. Xextern int handle_S_option  ();
  1439. Xextern int handle_u_option  ();
  1440. Xextern int handle_ux_option ();
  1441. Xextern int handle_V_option  ();
  1442. X
  1443. XOptDesc odesc[] = {
  1444. X  { "version", OPT_IS_SWITCH,    handle_R_option },
  1445. X  { "a", OPT_IS_SWITCH,        handle_a_option },
  1446. X  { "author", OPT_HAS_OPT_ARG,    handle_author_options },
  1447. X#ifdef DEBUGCOL
  1448. X  { "dc", OPT_IS_SWITCH,    handle_dc_option },
  1449. X#endif DEBUGCOL
  1450. X  { "b", OPT_IS_SWITCH,         handle_b_option },
  1451. X  { "g", OPT_IS_SWITCH,        handle_g_option },
  1452. X  { "h", OPT_HAS_OPT_ARG,     handle_h_option },
  1453. X  { "H", OPT_HAS_OPT_ARG,    handle_H_options },
  1454. X  { "l", OPT_IS_SWITCH,     handle_l_option },
  1455. X  { "L", OPT_IS_SWITCH,     handle_L_option },
  1456. X  { "y", OPT_IS_SWITCH,     handle_last_option },
  1457. X  { "n", OPT_HAS_ARG,        handle_n_option}, 
  1458. X  { "owner", OPT_HAS_OPT_ARG,     handle_owner_option },
  1459. X  { "q", OPT_IS_SWITCH,     handle_q_option },
  1460. X  { "s", OPT_HAS_ARG,         handle_s_option },
  1461. X  { "S", OPT_IS_SWITCH,     handle_S_option },
  1462. X  { "ux", OPT_IS_SWITCH,    handle_ux_option }, 
  1463. X  { "u", OPT_HAS_OPT_ARG,     handle_u_option },
  1464. X  { "U", OPT_HAS_OPT_ARG,    handle_u_option },
  1465. X  { "V", OPT_HAS_OPT_ARG,     handle_V_option },
  1466. X  { (char *) NULL, NULL, NULL }
  1467. X};
  1468. X
  1469. X#define USAGE_OPT_STR "ablLhHgoqsuSUV"    /* Optstring for Usage() */
  1470. X
  1471. Xint IsOptionSet (x) unsigned long x; {
  1472. X  return (options & (x));
  1473. X};
  1474. X
  1475. X/*ARGSUSED*/
  1476. Xhandle_a_option (opt, arg) char *opt, *arg;
  1477. X{
  1478. X  options |= VL_O_LISTHIDDEN;
  1479. X  return 0;
  1480. X}
  1481. X
  1482. X/*ARGSUSED*/
  1483. Xhandle_author_options (opt, arg) char *opt, *arg;
  1484. X{
  1485. X  options |= VL_O_AUTHOR;
  1486. X  PutAuthorIdentifications (arg);
  1487. X  return 0;
  1488. X}
  1489. X
  1490. X/*ARGSUSED*/
  1491. Xhandle_b_option (opt, arg) char *opt, *arg;
  1492. X{
  1493. X  options |= VL_O_LISTBINARY;
  1494. X  return 0;
  1495. X}
  1496. X
  1497. X#ifdef DEBUGCOL
  1498. Xchar debugcol = 0;
  1499. Xhandle_dc_option (opt)
  1500. X     char *opt;
  1501. X{
  1502. X  debugcol++;
  1503. X  return 0;
  1504. X}
  1505. X#endif DEBUGCOL
  1506. X
  1507. X/*ARGSUSED*/
  1508. Xhandle_g_option  (opt, arg) char *opt, *arg;
  1509. X{
  1510. X  options |= VL_O_GROUPOUTPUT;
  1511. X  return 0;
  1512. X}
  1513. X
  1514. X/*ARGSUSED*/
  1515. Xint handle_n_option (opt, arg)
  1516. X     char *opt, *arg;
  1517. X{
  1518. X  options |= VL_O_UDAGIVEN;
  1519. X  AddHiddenUda (SYMNAME, arg);
  1520. X  return 0;
  1521. X}
  1522. X
  1523. X/*ARGSUSED*/
  1524. Xhandle_h_option  (opt, arg) char *opt, *arg;
  1525. X{
  1526. X  LongUsage();
  1527. X  exit (1);
  1528. X}
  1529. X
  1530. X/*ARGSUSED*/
  1531. Xhandle_H_options (opt, arg) char *opt, *arg;
  1532. X{
  1533. X  options |= VL_O_HISTLOG;
  1534. X  multicol_output_possible = 0;
  1535. X  immediate_output++;
  1536. X  
  1537. X  if (*arg == '+')
  1538. X    options |= VL_O_HISTLOGPLUS;
  1539. X
  1540. X  return 0;
  1541. X}
  1542. X
  1543. X/*ARGSUSED*/
  1544. Xhandle_l_option  (opt, arg) char *opt, *arg;
  1545. X{
  1546. X  options |= VL_O_LONGOUTPUT;
  1547. X  multicol_output_possible = 0;
  1548. X  return 0;
  1549. X}
  1550. X
  1551. X/*ARGSUSED*/
  1552. Xhandle_L_option  (opt, arg) char *opt, *arg;
  1553. X{
  1554. X  options |= VL_O_LOGMSG;
  1555. X  multicol_output_possible = 0;
  1556. X  immediate_output++;
  1557. X  return 0;
  1558. X}
  1559. X
  1560. X/*ARGSUSED*/
  1561. Xhandle_last_option  (opt, arg) char *opt, *arg;
  1562. X{
  1563. X  options |= VL_O_LASTVERS;
  1564. X  multicol_output_possible = 0;
  1565. X  return 0;
  1566. X}
  1567. X
  1568. X/*ARGSUSED*/
  1569. Xhandle_owner_option  (opt, arg) char *opt, *arg;
  1570. X{
  1571. X  extern void PutOwnerIdentifications();
  1572. X  options |= VL_O_OWNER;
  1573. X  PutOwnerIdentifications (arg);
  1574. X  return 0;
  1575. X}
  1576. X
  1577. X/*ARGSUSED*/
  1578. Xhandle_q_option  (opt, arg) char *opt, *arg;
  1579. X{
  1580. X  options |= VL_O_BEQUIET;
  1581. X  return 0;
  1582. X}
  1583. X
  1584. X/*ARGSUSED*/
  1585. Xhandle_s_option  (opt, arg) char *opt, *arg;
  1586. X{
  1587. X  options |= VL_O_STATEGIVEN;
  1588. X  PutVersionStates (arg);
  1589. X  ScanVersionStates ();
  1590. X  return 0;
  1591. X}
  1592. X
  1593. X/*ARGSUSED*/
  1594. Xhandle_S_option  (opt, arg) char *opt, *arg;
  1595. X{
  1596. X  options |= VL_O_VERSIONSTATE;
  1597. X  return 0;
  1598. X}
  1599. X
  1600. X/*ARGSUSED*/
  1601. Xhandle_ux_option (opt)
  1602. X     char *opt;
  1603. X{
  1604. X  options |= VL_O_LISTHIDDENUDAS;
  1605. X  return 0;
  1606. X}
  1607. X
  1608. Xhandle_u_option  (opt, arg) char *opt, *arg;
  1609. X{
  1610. X  if (!strcmp (opt, "U"))
  1611. X      options |= VL_O_LISTUDALONG;
  1612. X  
  1613. X  options |= VL_O_LISTUDA;
  1614. X  immediate_output++;
  1615. X  
  1616. X  if (*arg) {
  1617. X    options |= VL_O_UDAGIVEN;
  1618. X    /*    PutUdattrs (arg); */
  1619. X    AddUdattrs (arg);
  1620. X  }
  1621. X  multicol_output_possible = 0;
  1622. X
  1623. X  return 0;
  1624. X}
  1625. X
  1626. X/*ARGSUSED*/
  1627. Xhandle_V_option (opt, arg) char *opt, *arg;
  1628. X{
  1629. X  options |= VL_O_VERSIONNUM;
  1630. X  if (version_number = mkvno (arg)) return 0;
  1631. X  fprintf (stderr, "\"%s\" is no appropriate argument to \'-V\' option.\n",
  1632. X       arg);
  1633. X  return 1;
  1634. X}    
  1635. X
  1636. XLongUsage ()
  1637. X
  1638. X     /*
  1639. X      * Called via option -h. Long help.
  1640. X      */
  1641. X{
  1642. X  fprintf (stderr, "vl lists the version informations of the given files.\n");
  1643. X  fprintf (stderr, "When no argument is given, the current directory is checked.\n");
  1644. X  fprintf (stderr, "Options are:\n");
  1645. X  fprintf (stderr, " -A              list all information about Afs file.\n");
  1646. X  fprintf (stderr, " -author authorspec   list Afs files matching author specifications.\n");
  1647. X  fprintf (stderr, " -owner ownerspec    list Afs files matching owner specifications.\n");
  1648. X  fprintf (stderr, "                 Author- and ownerspec can be of the form:\n");
  1649. X  fprintf (stderr, "                   'user.group' || 'user.' || '.group' || '.'\n");
  1650. X  fprintf (stderr, "                 the last form specifies any user and any group.\n");
  1651. X  fprintf (stderr, " -l              list info in long format (as ls(1)).\n");
  1652. X  fprintf (stderr, " -a              list also hidden file.\n");
  1653. X  fprintf (stderr, " -n relspec      list all Afs files that are part of a release.\n");
  1654. X  fprintf (stderr, "                 Relspec is a symbolic name given at save time.\n");
  1655. X  fprintf (stderr, "                 If no relspec is given all Afs files that are\n");
  1656. X  fprintf (stderr, "                 part of any release are printed.\n");
  1657. X  fprintf (stderr, " -g              list also group name (only effective when -l given).\n");
  1658. X  fprintf (stderr, " -s versstate    list version with specified version state set.\n");
  1659. X  fprintf (stderr, " -q              Be quiet. Set only status on exit.\n");
  1660. X  fprintf (stderr, " -S              list version state verbose.\n");
  1661. X  fprintf (stderr, " -u[:udaspec]    list user defined attributes.\n");
  1662. X  fprintf (stderr, " -U[:udaspec]    list user defined attributes and corresponding values.\n");
  1663. X  fprintf (stderr, "                 When 'udaspec' is given all Afs files matching udaspec\n");
  1664. X  fprintf (stderr, "                 are printed.\n");
  1665. X  fprintf (stderr, "                 Udaspec can be of the form:\n");
  1666. X  fprintf (stderr, "                 name[=value[ value [...]]][,value[...]]...\n");
  1667. X  fprintf (stderr, "                 For more infomation see also af_retrieve(3)\n");
  1668. X  fprintf (stderr, " -ux             list also hidden uda, iff -u or -U is given\n");
  1669. X  fprintf (stderr, " -V versspec     list Afs files with version number versspec (e.g. -V1.19).\n");
  1670. X  fprintf (stderr, "                 'Versspec' can be of the form:\n");
  1671. X  fprintf (stderr, "                  'generation.revision' || 'generation.' || '.revision' || '.'\n");
  1672. X  fprintf (stderr, "                 The last form represents all possible version numbers.\n");
  1673. X  fprintf (stderr, " -L              cat log message of Afs files. Afs file name required.\n");
  1674. X  fprintf (stderr, " -H              list history of log messages up to a specified version (-V).\n");
  1675. X  fprintf (stderr, "                 When '-H+' is given the history is listed from the specified.\n");
  1676. X  fprintf (stderr, "                 version upto the last version.\n");
  1677. X}
  1678. X
  1679. X#define STDOUT_FDESC 1
  1680. X
  1681. Xint multicol_output_is_possible ()
  1682. X{
  1683. X  return (multicol_output_possible && isatty (STDOUT_FDESC));
  1684. X}
  1685. X
  1686. XCheckProgramName (progname)
  1687. X     char *progname;
  1688. X{
  1689. X  extern char *rindex();
  1690. X  
  1691. X  if (!strcmp (progname, "vlog")) {
  1692. X    (void)handle_L_option ((char *)NULL, (char *)NULL);
  1693. X  }
  1694. X}
  1695. END_OF_FILE
  1696. if test 9708 -ne `wc -c <'src/vc/vlopt.c'`; then
  1697.     echo shar: \"'src/vc/vlopt.c'\" unpacked with wrong size!
  1698. fi
  1699. # end of 'src/vc/vlopt.c'
  1700. fi
  1701. echo shar: End of archive 12 \(of 33\).
  1702. cp /dev/null ark12isdone
  1703. MISSING=""
  1704. 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
  1705.     if test ! -f ark${I}isdone ; then
  1706.     MISSING="${MISSING} ${I}"
  1707.     fi
  1708. done
  1709. if test "${MISSING}" = "" ; then
  1710.     echo You have unpacked all 33 archives.
  1711.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1712. else
  1713.     echo You still need to unpack the following archives:
  1714.     echo "        " ${MISSING}
  1715. fi
  1716. ##  End of shell archive.
  1717. exit 0
  1718.