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

  1. Subject:  v19i020:  A software configuration management system, Part07/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 20
  8. Archive-name: shape/part07
  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 7 (of 33)."
  19. # Contents:  bin/rcs2afs man/man3/afversions.3 src/afs/Shapefile
  20. #   src/misc/hash.c src/vc/save.c src/vc/vc_call.c src/vfind/at_misc.c
  21. # Wrapped by rsalz@papaya.bbn.com on Thu Jun  1 19:26:55 1989
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'bin/rcs2afs' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'bin/rcs2afs'\"
  25. else
  26. echo shar: Extracting \"'bin/rcs2afs'\" \(6853 characters\)
  27. sed "s/^X//" >'bin/rcs2afs' <<'END_OF_FILE'
  28. X#! /bin/csh -f
  29. X#
  30. X# Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  31. X#  and U. Pralle
  32. X# 
  33. X# This software is published on an as-is basis. There is ABSOLUTELY NO
  34. X# WARRANTY for any part of this software to work correctly or as described
  35. X# in the manuals. We do not accept any liability for any kind of damage
  36. X# caused by use of this software, such as loss of data, time, money, or 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# LAST EDIT: Thu Feb 23 18:53:42 1989 by Uli Pralle (coma!uli) 
  55. X# LAST EDIT: Wed Oct 26 23:58:29 1988 by Uli Pralle (coma!uli) 
  56. X# LAST EDIT: Tue Oct 25 23:59:52 1988 by Uli Pralle (coma!uli) 
  57. X#
  58. X# rcs2afs  -- convert a RCS file to AFS
  59. X#                        Uli Pralle (uli@coma.UUCP)
  60. Xset AFSid = '$Header: rcs2afs[1.0] Thu Feb 23 19:03:47 1989 uli@coma published $'
  61. X
  62. X#
  63. X# Log for /u/shape/dist-tape/bin/rcs2afs[1.0]
  64. X#     Thu Feb 23 19:03:47 1989 uli@coma published $
  65. X#  --- empty log message ---  
  66. X#
  67. X
  68. Xset progname = $0
  69. Xset progname = $progname:t  # weiss der henker warum $0:t nicht geht... 
  70. X                                  # und kommt mit bloss keiner mit rtfm...
  71. X
  72. Xif ($#argv == 0) goto usage
  73. X
  74. Xset files = ""
  75. Xset _verbose = 1
  76. Xset incremental = 0
  77. Xset preserve = 0
  78. Xset mode = 644
  79. X
  80. X# test for options
  81. Xset i = 0
  82. Xwhile ($i < $#argv)
  83. X  @ i++
  84. X  switch ($argv[$i])
  85. X  case "-incremental":
  86. X    echo "Option -incremental not yet implemented."
  87. X    goto usage
  88. X    set incremantal = 1
  89. X    continue;
  90. X  case "-preserve":
  91. X    set preserve = 1
  92. X    continue;
  93. X  case "-mode":
  94. X    @ i++;
  95. X    set mode = $argv[$i]
  96. X    continue;
  97. X  case "-q":
  98. X    set _verbose = 0
  99. X    continue;
  100. X  case "-h":
  101. X  case "-help":
  102. X    goto usage            # never returns
  103. X    continue;
  104. X  case "-version":
  105. X    set noglob
  106. X    set vers = ($AFSid)
  107. X    set last = $#vers
  108. X    @ last--
  109. X    echo "This is $vers[2]:t $vers[3-$last]"
  110. X    unset noglob
  111. X    exit (0)
  112. X  default:
  113. X    set files = ($files "$argv[$i]")
  114. X    continue;
  115. X  endswitch
  116. Xend
  117. X
  118. Xif ($#files == 0) goto usage
  119. X
  120. Xonintr signal            # catch signals
  121. X
  122. Xset busysaved = 0        # 1 if busy version existst
  123. X
  124. X# generate awk script
  125. X
  126. Xcat << AWKEOF > /tmp/$$.awk
  127. X#! /bin/awk -f
  128. XBEGIN {
  129. X  revs = 0;
  130. X  branches = 0;
  131. X  nsym = 0;
  132. X}
  133. X
  134. X/head/ || /next/ {
  135. X  if (\$2 != ";") {
  136. X    rev[revs] = substr(\$2,1,length(\$2)-1);
  137. X    revs++;
  138. X  }
  139. X}
  140. X
  141. X/symbols/ {
  142. X  symbolics = substr(\$0,index(\$0,\$2));
  143. X  symbolics = substr(symbolics, 1, length(symbolics) -1 );
  144. X}
  145. X   
  146. X/comment/ {
  147. X  clead = substr(\$0, index(\$0,\$2));
  148. X  clead = substr(clead,2,length(clead)-3);
  149. X  if (clead == "@@") {
  150. X    clead = "@";
  151. X  }
  152. X}
  153. X
  154. X/branches/ {
  155. X  if (\$2 != ";") {
  156. X    branches++;
  157. X  }
  158. X}
  159. X
  160. X/desc/ { exit; }
  161. X
  162. XEND {
  163. X  printf ("set revisions = (");
  164. X  for (revs--; revs >= 0; revs-- )
  165. X    printf ("%s ", rev[revs]);
  166. X  printf (")\n");
  167. X  printf ("set clead = \"%s\"\n", clead);
  168. X  printf ("set branches = \"%s\"\n", branches);
  169. X  printf ("set symbolics = (");
  170. X  nsym = split(symbolics, symbolics);
  171. X  for (i = 1; i <= nsym; i++) {
  172. X    split (symbolics[i], foo, ":");
  173. X    printf ("%s %s ", foo[2], foo[1]);
  174. X  }
  175. X  printf (")\n");
  176. X}
  177. XAWKEOF
  178. X
  179. Xif (! -d AFS) then
  180. X  if ($_verbose) echo "Creating AFS directory."
  181. X  mkdir AFS
  182. Xendif
  183. X
  184. X# process each RCS file
  185. Xforeach i ($files)
  186. X  set i = "`basename $i ',v'`,v"
  187. X
  188. X  set dir = ""
  189. X  if (! -e $i) then
  190. X    if ( -e RCS/$i) then
  191. X      set dir = "RCS/"
  192. X    else
  193. X     echo "RCS archive <$i> not found. --- Skipped." > /dev/tty
  194. X     continue;
  195. X    endif
  196. X  endif
  197. X
  198. X  set noglob  
  199. X  eval `awk -f /tmp/$$.awk $dir$i`
  200. X  unset noglob
  201. X  
  202. X  set i = $i:t
  203. X
  204. X  if ($#revisions == 0) then
  205. X    echo "$i is not an RCS archive. --- Skipped." > /dev/tty
  206. X    continue
  207. X  endif
  208. X
  209. X  if ($branches > 0) then
  210. X    echo "Warning: $i contains non convertible branches. Ignored."
  211. X  endif
  212. X
  213. X  set busyvers = `basename $i ",v"`
  214. X
  215. X  if ($incremental) then
  216. X    set vlrevisions = (`vl $busyvers | sed -e 's/.*\[//' -e 's/\]//'`)
  217. X  endif
  218. X
  219. X  if (-e $busyvers) then
  220. X    if ($_verbose) echo "Temporary saving busy version $busyvers as $$save..."
  221. X    mv $busyvers $$save
  222. X    set busysaved = 1
  223. X  endif
  224. X  
  225. X  if (! $preserve) set curgen = `echo $revisions[1] | sed -e 's/\.[0-9]*//'`
  226. X  
  227. X  if ($_verbose) echo -n $i":"
  228. X
  229. X  if (! $incremental) then 
  230. X    (rm -f AFS/*$busyvers*) >& /dev/null
  231. X
  232. X  foreach j ($revisions)
  233. X    if ($_verbose) echo -n " $j"
  234. X    co -r$j $busyvers >& /dev/null
  235. X    chmod $mode $busyvers
  236. X    
  237. X    if ($status != 0) then
  238. X      echo $progname":" "co fails. Do You wish to continue ? [y/n]" > /dev/tty
  239. X      set answer = $<
  240. X      switch ($answer)
  241. X          case "N":
  242. X          case "n":
  243. X            goto cleanup
  244. X          case "y":
  245. X          case "Y":
  246. X          default:
  247. X          continue;
  248. X      endswitch
  249. X    endif
  250. X
  251. X    if (! $preserve) then
  252. X      set thisgen = `echo $j | sed -e 's/\.[0-9]*//'`
  253. X    
  254. X      if ($thisgen > $curgen) then # change in generation
  255. X        Save -fq $busyvers
  256. X        set curgen = $thisgen
  257. X      else
  258. X        save -fq $busyvers
  259. X      endif
  260. X    else
  261. X      save -fq -setvnum $j $busyvers
  262. X    endif
  263. X    rm -f $busyvers
  264. X  end
  265. X  
  266. X# set comment leader, iff necessary
  267. X  set noglob
  268. X  if ("$clead" != "") then
  269. X      vadm -q -setc $clead $busyvers
  270. X  endif
  271. X  unset noglob
  272. X
  273. X  if ($_verbose) echo ""
  274. X
  275. X# preserve symbolic names
  276. X    set k = 1;
  277. X    while ($k <= $#symbolics) 
  278. X      set thisrev = $symbolics[$k]
  279. X      @ k++;
  280. X      set thissymbolic = $symbolics[$k]
  281. X      vadm -q -V $thisrev -symbolic $thissymbolic $busyvers 
  282. X      @ k++;
  283. X    end
  284. X
  285. X  if ($busysaved == 1) then
  286. X    if ($_verbose) echo "$busyvers restored..."
  287. X    mv $$save $busyvers
  288. X    set busysaved = 0
  289. X  endif
  290. Xend
  291. X
  292. Xif ($_verbose) echo "done."
  293. Xrm -f /tmp/$$.awk
  294. Xexit (0)
  295. X
  296. Xsignal:
  297. X  if ($_verbose) then
  298. X    echo ""
  299. X    echo $progname": Caught signal, cleaning up..."
  300. X  endif
  301. Xcleanup:
  302. X  if ($busysaved == 1) then
  303. X    if ($_verbose) echo "$busyvers restored..."
  304. X      mv $$save $busyvers
  305. X      set busysaved = 0
  306. X  endif
  307. X  rm -f /tmp/$$.awk
  308. X  if ($_verbose) echo "terminated."
  309. X  exit (1)
  310. X
  311. Xusage:
  312. X  echo $progname":" "[-h -q -incremental -preserve] file ..."
  313. X  echo " -h  -- this help"
  314. X  echo " -q  -- be quiet"
  315. X  echo " -incremental -- convert into an existing AFS file (not yet implemented)"
  316. X  echo " -preserve -- preserve RCS version numbering"
  317. X  exit (1)
  318. X
  319. X# Local Variables:
  320. X# tab-stop-list:(2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72)
  321. X# eval:(local-set-key "    " 'tab-to-tab-stop)
  322. X# End:
  323. X
  324. X
  325. END_OF_FILE
  326. if test 6853 -ne `wc -c <'bin/rcs2afs'`; then
  327.     echo shar: \"'bin/rcs2afs'\" unpacked with wrong size!
  328. fi
  329. chmod +x 'bin/rcs2afs'
  330. # end of 'bin/rcs2afs'
  331. fi
  332. if test -f 'man/man3/afversions.3' -a "${1}" != "-c" ; then 
  333.   echo shar: Will not clobber existing file \"'man/man3/afversions.3'\"
  334. else
  335. echo shar: Extracting \"'man/man3/afversions.3'\" \(6476 characters\)
  336. sed "s/^X//" >'man/man3/afversions.3' <<'END_OF_FILE'
  337. X...
  338. X... Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  339. X...  and U. Pralle
  340. X... 
  341. X... This software is published on an as-is basis. There is ABSOLUTELY NO
  342. X... WARRANTY for any part of this software to work correctly or as described
  343. X... in the manuals. We do not accept any liability for any kind of damage
  344. X... caused by use of this software, such as loss of data, time, money, or 
  345. X... effort.
  346. X... 
  347. X... Permission is granted to use, copy, modify, or distribute any part of
  348. X... this software as long as this is done without asking for charge, and
  349. X... provided that this copyright notice is retained as part of the source
  350. X... files. You may charge a distribution fee for the physical act of
  351. X... transferring a copy, and you may at your option offer warranty
  352. X... protection in exchange for a fee.
  353. X... 
  354. X... Direct questions to: Tech. Univ. Berlin
  355. X...              Wilfried Koch
  356. X...              Sekr. FR 5-6 
  357. X...              Franklinstr. 28/29
  358. X...              D-1000 Berlin 10, West Germany
  359. X... 
  360. X...              Tel: +49-30-314-22972
  361. X...              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  362. X... 
  363. X.TH AF_VERSIONS 3 "" \n(dy.\n(mo.\n(yr
  364. X.SH NAME
  365. Xaf_version \(em interface to the version control system in the Attribute
  366. XFilesystem
  367. X.SH SYNOPSIS
  368. X\fB#include <afs.h>
  369. X.sp
  370. Xaf_newgen (key, newkey)
  371. X.br
  372. XAf_key    *key, *newkey;
  373. X.sp
  374. Xaf_setbusy (busykey, newkey)
  375. X.br
  376. XAf_key    *busykey, *newkey;
  377. X.sp
  378. Xaf_saverev (busykey, savekey)
  379. X.br
  380. XAf_key    *busykey, *savekey;
  381. X.sp
  382. Xaf_savebinary (busykey, savekey)
  383. X.br
  384. XAf_key    *busykey, *savekey;
  385. X.sp
  386. Xaf_rstate (key)
  387. X.br
  388. XAf_key    *key;
  389. X.sp
  390. Xaf_sstate (key, state)
  391. X.br
  392. XAf_key    *key;
  393. X.br
  394. Xint    state;
  395. X.sp
  396. Xaf_svnum (key, gen, rev)
  397. X.br
  398. Xint    gen, rev;
  399. X.SH DESCRIPTION
  400. X\fIAf_newgen\fR opens a new generation in a line of development.
  401. XThe last saved version will be duplicated. This creates a new ASO,
  402. Xthat is numbered by a new generation number (increased by 1)
  403. Xand the initial revision number (0).
  404. XAll other attributes remain unchanged.
  405. X\fIaf_newgen\fR requires a lock (see af_lock(3)) set on the ASO specified
  406. Xby \fIkey\fR.
  407. X.PP
  408. XWith \fIaf_setbusy\fR you can declare a saved version as new busy version.
  409. X\fBNote:\fR Only the corresponding attributes are updated.
  410. X\fIAf_setbusy\fR does not copy any data! You have to use \fIaf_open(3)\fR
  411. Xand \fIfread/fwrite(3)\fR to produce a new busy version
  412. X\fIAf_setbusy\fR requires a lock (see af_lock(3)) set on the ASO specified
  413. Xby \fIbusykey\fR.
  414. X.PP
  415. X\fIAf_saverev\fR makes a copy of the ASO identified by \fIbusykey\fR.
  416. XThis new ASO gets the status \fIsaved\fR and a version number
  417. Xaccording to the AFS version-numbering scheme:
  418. X.RS
  419. XThe initial revision is numbered by generation number 1 and revision number 0.
  420. XAll other saved versions get version numbers built from
  421. Xthese of their predecessors by preserving the generation number and
  422. Xincreasing the revision number by 1.
  423. X.RE
  424. XAll remaining attributes (including user defined attributes) are inherited
  425. Xfrom the busy version.
  426. XThe key of the generated ASO is returned in \fIsavekey\fR. 
  427. XUse \fIaf_dropkey\fR to free the allocated memory associated with
  428. X\fIsavekey\fR.
  429. X.br
  430. XBefore you can save an ASO you must reserve the update permission
  431. Xfor the corresponding line of development by locking the busy
  432. Xobject (\fIaf_lock\fR).
  433. XThe execution of \fIaf_saverev\fR does not affect the lock
  434. X(it remains active).
  435. X.PP
  436. X\fIAf_savebinary\fR saves an ASO to a derived object pool.
  437. XDerived object pools are intended to hold derived objects that can be
  438. Xreproduced at any time.
  439. XThis is important, because ASOs residing in derived object pools
  440. Xthat have not been accessed for a longer time may be deleted
  441. Xautomatically due to storage limitations for derived object pools.
  442. XThe maximum number of objects stored in a binary pool
  443. Xcan be given by setting the environment variable AFSBPSIZ to the
  444. Xappropriate value (default is 64).
  445. XSee \fIaf_intro (3)\fR for further details on derived object pools.
  446. X.br
  447. XASOs that are saved in derived object pools do not get a version number.
  448. XBy means of \fIaf_svnum\fR you can attach any version number to an
  449. XASO stored in a derived object pool.
  450. X.br
  451. XBy saving an object to a derived object pool, the given busy object
  452. X(identified by \fIbusykey\fR) is destroyed.
  453. XDuring the execution of \fIaf_savebinary\fR \fIbusykey\fR is
  454. Xautomatically dropped and cannot be used any longer.
  455. X.PP
  456. X\fIAf_rstate\fR returns the version state of the ASO
  457. Xidentified by \fIkey\fR.
  458. XPossible states are:
  459. X.IP \fBbusy\fR 0.8i 
  460. XThe version is under development and its contents may
  461. Xbe changed.
  462. X.IP \fBsaved\fR 
  463. XThe version is saved and may be used for later backup.
  464. X.IP \fBproposed\fR
  465. XThe version has been submitted for publication by the developer
  466. Xbut still needs formal approval by a quality assurance board
  467. Xto become publically visible and accessible in the official
  468. Xdatabase.
  469. X.IP \fBpublished\fR
  470. XThe version has passed the formal approval and is now accessible to
  471. Xevery member of the project. It is not yet accessed and may therefore
  472. Xbe withdrawn if necessary.
  473. X.IP \fBaccessed\fR 
  474. XThe version has been published, and is now 
  475. Xaccessed by some members of the project.
  476. X.IP \fBfrozen\fR
  477. XThe version may be part of a system configuration
  478. Xthat has been released to the outside world. This means it must, under
  479. Xno circumstances, be destroyed.
  480. X.RE
  481. X.PP
  482. XThe function
  483. X\fIaf_sstate\fR sets the state of the identified ASO.
  484. XOnly state transitions from one state to the next or previous state
  485. X(according to the list above) are allowed.
  486. X.PP
  487. X\fIAf_svnum\fR sets the version number of the identified ASO to the
  488. Xgiven generation (\fIgen\fR) and revision (\fIrev\fR) number.
  489. XThe version number of source objects can only be \(bqincreased\(rq \-
  490. Xthe version number of derived objects can be set to any value.
  491. X\fIAf_svnum\fR requires a lock (see af_lock(3)) set on the ASO specified
  492. Xby \fIkey\fR.
  493. X.SH SEE ALSO
  494. Xaf_intro (3), af_lock(3)
  495. X.SH DIAGNOSTICS
  496. XUpon error, \-1 is returned and \fIaf_errno\fR is set to the corresponding
  497. Xerror number
  498. X.SH BUGS
  499. X\fIAf_setbusy\fR interrupts the delta chain if no busy version is present.
  500. XFor the user of AFS, this is only a performance loss \- not a malfunction.
  501. X.PP
  502. XDue to limitations in the \s-1UNIX\s+1 filesystem, only the creator
  503. X(author) of a derived object may save it to a derived object pool.
  504. X.PP
  505. XEmpty files cannot be inserted in a derived object pool.
  506. X.PP
  507. XShrinking of binary pools (setting AFSBPSIZ to a value that is smaller
  508. Xthan the actual number of files inthe binary pool) causes
  509. Xuncontrolled removing of supernumerary files. They are \fInot\fR
  510. Xcleared out on a last accessed basis.
  511. END_OF_FILE
  512. if test 6476 -ne `wc -c <'man/man3/afversions.3'`; then
  513.     echo shar: \"'man/man3/afversions.3'\" unpacked with wrong size!
  514. fi
  515. # end of 'man/man3/afversions.3'
  516. fi
  517. if test -f 'src/afs/Shapefile' -a "${1}" != "-c" ; then 
  518.   echo shar: Will not clobber existing file \"'src/afs/Shapefile'\"
  519. else
  520. echo shar: Extracting \"'src/afs/Shapefile'\" \(6254 characters\)
  521. sed "s/^X//" >'src/afs/Shapefile' <<'END_OF_FILE'
  522. X#
  523. X# Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  524. X#  and U. Pralle
  525. X# 
  526. X# This software is published on an as-is basis. There is ABSOLUTELY NO
  527. X# WARRANTY for any part of this software to work correctly or as described
  528. X# in the manuals. We do not accept any liability for any kind of damage
  529. X# caused by use of this software, such as loss of data, time, money, or effort.
  530. X# 
  531. X# Permission is granted to use, copy, modify, or distribute any part of
  532. X# this software as long as this is done without asking for charge, and
  533. X# provided that this copyright notice is retained as part of the source
  534. X# files. You may charge a distribution fee for the physical act of
  535. X# transferring a copy, and you may at your option offer warranty
  536. X# protection in exchange for a fee.
  537. X# 
  538. X# Direct questions to: Tech. Univ. Berlin
  539. X#              Wilfried Koch
  540. X#              Sekr. FR 5-6 
  541. X#              Franklinstr. 28/29
  542. X#              D-1000 Berlin 10, West Germany
  543. X# 
  544. X#              Tel: +49-30-314-22972
  545. X#              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  546. X# 
  547. X#
  548. X# Shapefile for AFS
  549. X#
  550. X# $Header: Shapefile[1.0] Wed Feb 22 16:28:28 1989 andy@coma published $
  551. X#
  552. X
  553. XUSERID  = `/usr/ucb/whoami`\@`hostname`
  554. X
  555. X#
  556. X#  Tool definition & location part
  557. X#  (these macros might be site and/or system-dependent)
  558. X#
  559. X
  560. XSYSTEM = bsd_4_3 
  561. XQUALITY = test_profiling
  562. Xvpath = /u/shape/src/delta
  563. X
  564. X# ---> define locations of sources and executables
  565. XSRCDIR = /u/andy/shape/afs
  566. XINSTALDIR = /u/shape
  567. XAFSINC = /u/shape/src/inc
  568. XDELTAPATH = /u/shape/src/delta
  569. XINSTALOWNER = shape
  570. XINSTALGROUP = unib
  571. X
  572. X#% VARIANT-SECTION
  573. X
  574. Xvclass system ::= (bsd_4_3, sunos_3_4, sunos_4_0, ultrix_2_0)
  575. Xvclass quality ::= (test, test_profiling, trace, final)
  576. X
  577. Xbsd_4_3:
  578. X    vflags = -DBSD_4_3 -DSYSLOG
  579. Xsunos_3_4:
  580. X    vflags = -DSUNOS_3_4 -DOLDDBM
  581. X    CLIBS = -ldbm
  582. Xsunos_4_0:
  583. X    vflags = -DSUNOS_4_0 -DSYSLOG
  584. Xultrix_2_0:
  585. X    vflags = -DULTRIX_2_0 -DOLDDBM
  586. X    CLIBS = -ldbm
  587. X
  588. Xtest:
  589. X    CFLAGS = -g
  590. X    LDFLAGS = -g
  591. Xtest_profiling:
  592. X    CFLAGS = -pg -g
  593. X    LDLAGS = -pg -g
  594. Xtrace:
  595. X    CFLAGS = -g -DMEMDEBUG  -DTMPDEBUG  -DHASHDEBUG
  596. Xfinal:
  597. X    CFLAGS = -g
  598. X    LDFLAGS = -g
  599. X
  600. X#% END-VARIANT-SECTION
  601. X
  602. X#% RULE-SECTION
  603. X
  604. Xtestrule:
  605. X    af_version.c, attrge (state, saved), attrmax (version);
  606. X    *, attr (state, busy);
  607. X    *, attrge (state, saved), attrmax (version), \
  608. X        msg (used archived version of $+.).
  609. X
  610. Xrelrule:
  611. X    bsfd.c, attr (state, busy);
  612. X    lcs*.c, attr (state, busy);
  613. X    *, attr (state, published), attrmax (version).
  614. X
  615. X#% END-RULE-SECTION
  616. X
  617. XPRODUCT = afs
  618. XPROGS = libafs.a afsrepair
  619. X
  620. XSOURCE = \
  621. X    afarchive.c afenviron.c aflib.c afvers.c afdelta.c afkeys.c\
  622. X    afstates.c afsattrs.c afretr.c afsysc.c affiles.c afcattrs.c\
  623. X    afsets.c afhash.c afcompar.c afbpool.c afsymtab.c afstore.c\
  624. X    aflock.c afsrepair.c
  625. X
  626. X
  627. XDELTASOURCE = \
  628. X    bsfd.c lcs.main.c lcs.cdlt.c lcs.gedc.c edcmd.h suffix.h predef.h
  629. X
  630. XINCLUDE = afs.h afsys.h afarchive.h
  631. X
  632. XCOMPONENTS = $(SOURCE) $(INCLUDE) afsrepair.h
  633. X
  634. X.BPOOL: $(AFSOBJS) $(DELTALIB) $(AFSDB)
  635. X
  636. XVERSION = af_version
  637. X
  638. XAFSOBJS = \
  639. X    afarchive.o afenviron.o aflib.o afvers.o afdelta.o afkeys.o\
  640. X    afstates.o afsattrs.o afretr.o afsysc.o affiles.o afcattrs.o\
  641. X    afsets.o afhash.o afcompar.o afbpool.o afsymtab.o afstore.o\
  642. X    aflock.o
  643. X
  644. XDELTALIB = bsfd.o lcs.cdlt.o lcs.gedc.o lcs.main.o
  645. X#DELTALIB = deltalib.o
  646. X
  647. XTESTSOURCE = \
  648. X    testmain.c testcall.c testfdes.c testkey.c testabuf.c testset.c\
  649. X    testvar.c testshow.c test.h
  650. X
  651. XAFSDB = testmain.o testcall.o testshow.o testvar.o testkey.o testset.o\
  652. X    testabuf.o testfdes.o
  653. X
  654. X#
  655. X#  Top level targets (containing selection rules)
  656. X#
  657. X
  658. Xall: testrule +$(SYSTEM) +$(QUALITY) libafs.a afsrepair afsdb
  659. X# "afsdb" only on coma
  660. X
  661. Xlib: testrule +$(SYSTEM) +$(QUALITY) libafs.a
  662. X
  663. Xrepair: testrule +$(SYSTEM) +$(QUALITY) afsrepair
  664. X
  665. Xtest: testrule +$(SYSTEM) +$(QUALITY) afsdb
  666. X
  667. Xinstallall: install installtest
  668. X
  669. Xinstall: relrule +$(SYSTEM) +final installafs
  670. X
  671. X# installtest: relrule +$(SYSTEM) +final prepare_testrel installafsdb
  672. Xinstalltest: relrule +$(SYSTEM) +test prepare_testrel installafsdb
  673. X
  674. Xobjects : testrule +$(SYSTEM) +$(QUALITY) $(AFSOBJS) afsrepair.o
  675. X
  676. X#
  677. X# building the library
  678. X#
  679. X
  680. Xlibafs.a: $(AFSOBJS) $(DELTALIB) $(VERSION).o
  681. X    @ar ruv libafs.a $(AFSOBJS) $(DELTALIB) $(VERSION).o
  682. X
  683. X#
  684. X# preparing releases
  685. X#
  686. X
  687. Xsave:
  688. X    save $(COMPONENTS) $(TESTSOURCE)
  689. X
  690. Xrelease:
  691. X    @rm -f $(VERSION).c; \
  692. X    echo 'char *$Shapefile () {' >> $(VERSION).c ; \
  693. X    echo '  static char ConfID[] =  "$1.0 ($Wed Feb 22 16:25:33 1989 by $andy@coma$)";' >> $(VERSION).c ; \
  694. X    echo '  return ConfID;' >> $(VERSION).c ; \
  695. X    echo '}' >> $(VERSION).c; \
  696. X    sbmt -fq $(VERSION).c; \
  697. X    __rel__=`vl -y $(VERSION).c | sed -e 's/^.*\[//;s/\]$$//'`; \
  698. X    echo Generating Release $$__rel__; \
  699. X    sbmt -q -n rel-$$__rel__ $(COMPONENTS) $(TESTSOURCE) Shapefile Makefile; \
  700. X    echo ;\
  701. X    echo don\'t forget to execute \'shape install\'
  702. X
  703. Xgeneration:
  704. X
  705. X#
  706. X# installing
  707. X#
  708. X
  709. Xinstallafs: libafs.a afsrepair $(AFSINC)/afs.h $(AFSINC)/afsys.h
  710. X    mv $(INSTALDIR)/lib/libafs.a $(INSTALDIR)/lib/libafs.backup
  711. X    install -c -m 644 -o $(INSTALOWNER) -g $(INSTALGROUP) libafs.a $(INSTALDIR)/lib
  712. X    ranlib $(INSTALDIR)/lib/libafs.a
  713. X    install -c -m 755 -o $(INSTALOWNER) -g $(INSTALGROUP) afsrepair $(INSTALDIR)/bin
  714. X
  715. X$(AFSINC)/afs.h: afs.h
  716. X    install -c -m 644 -o $(INSTALOWNER) -g $(INSTALGROUP) afs.h $(AFSINC)
  717. X
  718. X$(AFSINC)/afsys.h: afsys.h
  719. X    install -c -m 644 -o $(INSTALOWNER) -g $(INSTALGROUP) afsys.h $(AFSINC)
  720. X    touch $(AFSINC)/afs.h
  721. X
  722. X#
  723. X# archive repair tool
  724. X#
  725. X
  726. X$(AFSOBJS) $(AFSDB) afsrepair.o: $(INCLUDE)
  727. X
  728. Xafsrepair.o: afsrepair.h
  729. X
  730. Xafsrepair: afsrepair.o afsysc.o afsymtab.o afenviron.o afhash.o\
  731. X        aflib.o af_version.o
  732. X    $(CC) -o afsrepair $(LDFLAGS) afsrepair.o afsysc.o afsymtab.o\
  733. X        afenviron.o afhash.o aflib.o af_version.o
  734. X
  735. X#
  736. X# Test-environment for libafs.a (only on coma)
  737. X#
  738. X
  739. Xinstallafsdb: $(AFSDB) afsdb
  740. X    install -c -m 755 -o $(INSTALOWNER) -g $(INSTALGROUP) afsdb $(INSTALDIR)/bin
  741. X    rm -f $(INSTALDIR)/bin/afstest
  742. X    ln $(INSTALDIR)/bin/afsdb $(INSTALDIR)/bin/afstest
  743. X
  744. Xafsdb: $(AFSDB) $(AFSOBJS) $(DELTALIB) $(VERSION).o
  745. X    $(CC) -o afsdb $(LDFLAGS) $(AFSDB) $(AFSOBJS) $(VERSION).o\
  746. X        $(DELTALIB) $(CLIBS)
  747. X
  748. X$(AFSDB): test.h
  749. X
  750. X#
  751. X# Miscellaneous stuff
  752. X#
  753. X
  754. Xlint:
  755. X    lint $(DELTASOURCE) $(SOURCE)
  756. X
  757. Xtags: $(SOURCE)
  758. X    /usr/local/etags $(SOURCE)
  759. X
  760. Xxref: $(SOURCE)
  761. X    /usr/ucb/ctags -w -x $(SOURCE) > xref
  762. X
  763. Xclean :
  764. X    rm $(AFSOBJS)
  765. X
  766. Xtar:
  767. X    tar cvf /tmp/afs.tar $(COMPONENTS) $(TESTSOURCE) Makefile; \
  768. X    cd $(DELTAPATH); \
  769. X    tar uvf /tmp/afs.tar $(DELTASOURCE)
  770. END_OF_FILE
  771. if test 6254 -ne `wc -c <'src/afs/Shapefile'`; then
  772.     echo shar: \"'src/afs/Shapefile'\" unpacked with wrong size!
  773. fi
  774. # end of 'src/afs/Shapefile'
  775. fi
  776. if test -f 'src/misc/hash.c' -a "${1}" != "-c" ; then 
  777.   echo shar: Will not clobber existing file \"'src/misc/hash.c'\"
  778. else
  779. echo shar: Extracting \"'src/misc/hash.c'\" \(6107 characters\)
  780. sed "s/^X//" >'src/misc/hash.c' <<'END_OF_FILE'
  781. X/*
  782. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  783. X *  and U. Pralle
  784. X * 
  785. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  786. X * WARRANTY for any part of this software to work correctly or as described
  787. X * in the manuals. We do not accept any liability for any kind of damage
  788. X * caused by use of this software, such as loss of data, time, money, or 
  789. X * effort.
  790. X * 
  791. X * Permission is granted to use, copy, modify, or distribute any part of
  792. X * this software as long as this is done without asking for charge, and
  793. X * provided that this copyright notice is retained as part of the source
  794. X * files. You may charge a distribution fee for the physical act of
  795. X * transferring a copy, and you may at your option offer warranty
  796. X * protection in exchange for a fee.
  797. X * 
  798. X * Direct questions to: Tech. Univ. Berlin
  799. X *              Wilfried Koch
  800. X *              Sekr. FR 5-6 
  801. X *              Franklinstr. 28/29
  802. X *              D-1000 Berlin 10, West Germany
  803. X * 
  804. X *              Tel: +49-30-314-22972
  805. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  806. X */
  807. Xstatic char *AFSid = "$Header: hash.c[2.1] Thu Feb 23 21:24:20 1989 axel@coma published $";
  808. X
  809. X/*
  810. X * Log for /u/shape/dist-tape/src/misc/hash.c[1.1]
  811. X *     Thu Feb 23 21:24:20 1989 axel@coma save $
  812. X *  --- empty log message ---
  813. X *  hash.c[2.0] Thu Feb 23 21:24:20 1989 axel@coma published $
  814. X *  --- empty log message ---
  815. X *  hash.c[2.1] Thu Feb 23 21:24:20 1989 axel@coma published $
  816. X *  --- empty log message ---
  817. X */
  818. X/*
  819. X * $Log:    hash.c,v $
  820. X * Revision 2.0  88/06/29  16:14:43  axel
  821. X * New System Generation
  822. X * 
  823. X * Revision 1.1  88/06/07  17:10:05  axel
  824. X * This version is part of a release
  825. X * 
  826. X */
  827. X
  828. X#include <stdio.h>
  829. X#include <sys/types.h>
  830. X#include <sys/stat.h>
  831. X#include <strings.h>
  832. X#include "hash.h"
  833. X
  834. Xhashinit (htab, hsize, sizeratio, fhash) Hash *htab; int hsize, sizeratio,
  835. X       (*fhash)(); {
  836. X  char *chash, *malloc();
  837. X  int ltimes, ctimes;
  838. X  register int i;
  839. X  register int lnull = 0L;
  840. X  long *lhash;
  841. X
  842. X/*
  843. X * Determination of reasonable size and initialization of hashtable.
  844. X */
  845. X
  846. X  /* initialize Hash - structure */
  847. X  htab->hsize = hsize/sizeratio;
  848. X  if ((htab->hashtb = 
  849. X       (Hashent *)malloc (htab->hsize*sizeof (Hashent))) == NULL) {
  850. X    perror ("malloc hashtable");
  851. X    exit (1);
  852. X  }
  853. X  htab->fhash = fhash;
  854. X#ifdef CCOL
  855. X  htab->collcnt = 0;
  856. X#endif
  857. X  htab->symcount = 0;
  858. X
  859. X  /* set hashlist all zeros, take care of alignment */
  860. X  lhash = (long *)htab->hashtb;
  861. X  ltimes = (htab->hsize*sizeof (Hashent))/sizeof (long);
  862. X  ctimes = (htab->hsize*sizeof (Hashent))%sizeof (long);
  863. X  for (i=0; i < ltimes; i++)
  864. X    *lhash++ = lnull;
  865. X  chash = (char *)lhash;
  866. X  for (i=0; i < ctimes; i++)
  867. X    *chash++ = '\0';
  868. X/*
  869. X * End of hashtable initialization.
  870. X */
  871. X}
  872. X
  873. Xchar *hashsym (htab, symbol, symval) Hash *htab; char *symbol, *symval; {
  874. X/*
  875. X * put entry into hashtable. Only called, if symbol hasn't been found in 
  876. X * hashtable. Function returns pointer to the symbol-string and sets
  877. X * external variable cur_symval to corresponding symval.
  878. X */
  879. X  int symindex;
  880. X  Hashent *new, *curptr;
  881. X
  882. X  htab->symcount++;
  883. X  symindex = htab->fhash (htab, symbol);
  884. X  if (!htab->hashtb[symindex].symbol[0]) { /* found entry is not used yet */
  885. X    strcpy (htab->hashtb[symindex].symbol, symbol);
  886. X    strcpy (htab->hashtb[symindex].symval, symval);
  887. X    htab->hashtb[symindex].next = NULL;
  888. X    htab->cur_symval = htab->hashtb[symindex].symval;
  889. X    return htab->hashtb[symindex].symbol;
  890. X  }
  891. X  else {    /* oh boy - a collision! */
  892. X#ifdef CCOLL
  893. X    htab->collcnt++;
  894. X    fprintf (stderr, "%d'th hash-collision.\n", htab->collcnt);
  895. X#endif
  896. X    new = (Hashent*)malloc (sizeof (Hashent));
  897. X    strcpy (new->symbol, symbol);
  898. X    strcpy (new->symval, symval);
  899. X    new->next = NULL;
  900. X    curptr = &htab->hashtb[symindex];
  901. X    while (curptr->next) curptr = curptr->next;
  902. X    curptr->next = new;
  903. X    htab->cur_symval = new->symval;
  904. X    return new->symbol;
  905. X  } /* endif */
  906. X} /* end symhash */
  907. X
  908. Xint fhash (htab, hstr) Hash *htab; char *hstr; {
  909. X  register int lhstr, hval = 0, i;
  910. X
  911. X  lhstr = strlen (hstr);
  912. X  for (i = 0; i < lhstr; i++)
  913. X    hval = hval + i*hstr[i];
  914. X  return hval%htab->hsize;
  915. X}
  916. X
  917. Xchar *symlookup (htab, symbol) Hash *htab; char *symbol; {
  918. X/* 
  919. X * Function searches htab for an entry with the given name symbol.
  920. X * If such an entry exists, a pointer to the symbol string is returned
  921. X * and the external variable cur_symval is set to the corresponding
  922. X * symbolvalue
  923. X */
  924. X  int where;
  925. X  Hashent *targ;
  926. X
  927. X  where = htab->fhash (htab, symbol);
  928. X  if (htab->hashtb[where].symbol[0]) { /* well, we found at least something */
  929. X    if (!strcmp (symbol, htab->hashtb[where].symbol)) {  /* found it ? */
  930. X      htab->cur_symval = htab->hashtb[where].symval;
  931. X      return htab->hashtb[where].symbol;
  932. X    }
  933. X    else {  /* maybe it is somewhere down the gully */
  934. X      targ = &htab->hashtb[where];
  935. X      while (targ->next) {
  936. X    targ = targ->next;
  937. X    if (!strcmp (targ->symbol, symbol)) {
  938. X      htab->cur_symval = targ->symval;
  939. X      return targ->symbol;
  940. X    }
  941. X      }
  942. X    }
  943. X  }
  944. X  /* when we come to this point, the symbol hasn't been known */
  945. X  htab->cur_symval = NULL;
  946. X  return NULL;
  947. X}
  948. X
  949. Xchar *cur_symval (htab) Hash *htab; {
  950. X  return htab->cur_symval;
  951. X}
  952. X
  953. Xdestroy_htab (htab) Hash *htab; {
  954. X  free (htab->hashtb);
  955. X}
  956. X
  957. Xdumphtb (htab) Hash *htab; {
  958. X  extern FILE *yyout;
  959. X  register int i;
  960. X  register Hashent *h;
  961. X
  962. X#ifdef CCOLL
  963. X  fprintf (yyout, "Hash-collision statistics:\n");
  964. X  fprintf (yyout, "Table-size: %d\tNo. of symbols: %d\tCollisions: %d\n",
  965. X       htab->hsize, htab->symcount, htab->collcnt);
  966. X#endif
  967. X
  968. X  for (i = 0; i < htab->hsize; i++) {
  969. X    if (htab->hashtb[i].symbol[0]) {
  970. X      h = &htab->hashtb[i];
  971. X      while (h) {
  972. X    fprintf (yyout, "symbol: %s", h->symbol);
  973. X    if (h->symval[0])
  974. X      fprintf (yyout, ", value: %s.\n", h->symval);
  975. X    else
  976. X      fprintf (yyout, " -- no value.\n");
  977. X    h = h->next;
  978. X      }
  979. X    }
  980. X    else fprintf (yyout, "empty hastable-entry.\n");
  981. X  }
  982. X}
  983. X
  984. Xgetfsize (fil) FILE *fil; {
  985. X  struct stat buf;
  986. X
  987. X  if (fil == stdin) {
  988. X    return DEFHSIZE;
  989. X  }
  990. X  else {
  991. X    if (fstat (fileno (fil), &buf) == -1) {
  992. X      perror ("file should be accessible");
  993. X      exit (1);
  994. X    }
  995. X    return (int)buf.st_size;
  996. X  }
  997. X}
  998. END_OF_FILE
  999. if test 6107 -ne `wc -c <'src/misc/hash.c'`; then
  1000.     echo shar: \"'src/misc/hash.c'\" unpacked with wrong size!
  1001. fi
  1002. # end of 'src/misc/hash.c'
  1003. fi
  1004. if test -f 'src/vc/save.c' -a "${1}" != "-c" ; then 
  1005.   echo shar: Will not clobber existing file \"'src/vc/save.c'\"
  1006. else
  1007. echo shar: Extracting \"'src/vc/save.c'\" \(6983 characters\)
  1008. sed "s/^X//" >'src/vc/save.c' <<'END_OF_FILE'
  1009. X/*
  1010. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  1011. X *  and U. Pralle
  1012. X * 
  1013. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  1014. X * WARRANTY for any part of this software to work correctly or as described
  1015. X * in the manuals. We do not accept any liability for any kind of damage
  1016. X * caused by use of this software, such as loss of data, time, money, or 
  1017. X * effort.
  1018. X * 
  1019. X * Permission is granted to use, copy, modify, or distribute any part of
  1020. X * this software as long as this is done without asking for charge, and
  1021. X * provided that this copyright notice is retained as part of the source
  1022. X * files. You may charge a distribution fee for the physical act of
  1023. X * transferring a copy, and you may at your option offer warranty
  1024. X * protection in exchange for a fee.
  1025. X * 
  1026. X * Direct questions to: Tech. Univ. Berlin
  1027. X *              Wilfried Koch
  1028. X *              Sekr. FR 5-6 
  1029. X *              Franklinstr. 28/29
  1030. X *              D-1000 Berlin 10, West Germany
  1031. X * 
  1032. X *              Tel: +49-30-314-22972
  1033. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  1034. X */
  1035. X#ifndef lint
  1036. Xstatic char *AFSid = "$Header: save.c[3.15] Thu Feb 23 18:13:53 1989 axel@coma published $";
  1037. X#ifdef CFFLGS
  1038. Xstatic char *ConfFlg = CFFLGS;
  1039. X    /* should be defined from within Makefile */
  1040. X#endif
  1041. X#endif
  1042. X/*
  1043. X * Log for /u/shape/dist-tape/src/vc/save.c[3.8]
  1044. X *     Thu Feb 23 18:13:53 1989 axel@coma published $
  1045. X *  --- empty log message ---
  1046. X *  save.c[3.11] Thu Feb 23 18:13:53 1989 axel@coma published $
  1047. X *  --- empty log message ---
  1048. X *  save.c[3.12] Thu Feb 23 18:13:53 1989 axel@coma save $
  1049. X *  --- empty log message ---
  1050. X *  save.c[3.13] Thu Feb 23 18:13:53 1989 axel@coma save $
  1051. X *  --- empty log message ---
  1052. X *  save.c[3.14] Thu Feb 23 18:13:53 1989 axel@coma save $
  1053. X *  --- empty log message ---
  1054. X *  save.c[3.15] Thu Feb 23 18:13:53 1989 axel@coma published $
  1055. X *  --- empty log message ---
  1056. X */
  1057. X
  1058. X#include <signal.h>
  1059. X#include <stdio.h>
  1060. X#include <ctype.h>
  1061. X#include <strings.h>
  1062. X#include "ParseArgs.h"
  1063. X#include "save.h"
  1064. X#include "project.h"
  1065. X
  1066. Xchar *progname, vcomment[1024], tfname[MAXNAMLEN], atr_fname[MAXNAMLEN],
  1067. X  symname[MAXNAMLEN], projname[80];
  1068. Xint newvnum;
  1069. X
  1070. X/* forward decls for option handlers */
  1071. Xextern handle_R_switch ();
  1072. Xextern handle_f_switch ();
  1073. Xextern handle_q_switch ();
  1074. Xextern handle_u_switch ();
  1075. Xextern handle_a_opt ();
  1076. Xextern handle_m_opt ();
  1077. Xextern handle_n_opt ();
  1078. Xextern handle_p_opt ();
  1079. Xextern handle_svnum_opt ();
  1080. Xextern handle_t_opt ();
  1081. Xextern usage ();
  1082. X
  1083. Xunsigned int options;
  1084. X
  1085. XOptDesc argdesc[] = {
  1086. X  { "version", OPT_IS_SWITCH, handle_R_switch },
  1087. X  { "f", OPT_IS_SWITCH, handle_f_switch },
  1088. X  { "q", OPT_IS_SWITCH, handle_q_switch },
  1089. X  { "u", OPT_IS_SWITCH, handle_u_switch },
  1090. X  { "unlock", OPT_IS_SWITCH, handle_u_switch },
  1091. X  { "a", OPT_HAS_ARG, handle_a_opt }, 
  1092. X  { "m", OPT_HAS_ARG, handle_m_opt }, 
  1093. X  { "n", OPT_HAS_ARG, handle_n_opt }, 
  1094. X  { "p", OPT_HAS_ARG, handle_p_opt }, 
  1095. X  { "setvnum", OPT_HAS_ARG, handle_svnum_opt },
  1096. X  { "t", OPT_HAS_ARG, handle_t_opt },
  1097. X  { "h", OPT_IS_SWITCH, usage },
  1098. X  { "?", OPT_HAS_ARG, usage },
  1099. X  { (char *)  NULL, NULL, NULL }
  1100. X};
  1101. X
  1102. Xstruct Transaction ThisTransaction;
  1103. Xint nfnms;
  1104. X
  1105. Xmain (ac, av) char **av; {
  1106. X  register int i;
  1107. X  int nac, rc = 0;
  1108. X  char projname[80], **nav, messg[80], *es, *getenv(), *version();
  1109. X  Project pdesc;
  1110. X
  1111. X  if (!rindex (av[0], '/')) progname = av[0];
  1112. X  else progname = rindex (av[0], '/') + 1;
  1113. X  /* make prog-name available to entire program */
  1114. X
  1115. X  if (ac < 2) {
  1116. X    usage ();
  1117. X    exit (1);
  1118. X  }
  1119. X
  1120. X  if (isupper(progname[0])) options |= NEWGEN;
  1121. X  if (strcmp (progname+1, SAVE)) /* check from 2nd char onwards */
  1122. X    options |= SUBMIT;
  1123. X  if (ParseArgs (ac, av, &nac, &nav, argdesc)) {
  1124. X    usage ();
  1125. X  }
  1126. X    
  1127. X  if (!(options & ATTRDEF)) {
  1128. X    es = getenv (SVATTR);
  1129. X    if ((es) && (es[0] != '\0')) {
  1130. X      options |= ATTRDEF;
  1131. X      (void)strcpy (atr_fname, es);
  1132. X    }
  1133. X  }
  1134. X
  1135. X  if (GetProject (projname, &pdesc) < 0) {
  1136. X    (void)sprintf (messg, "%s %s", EINVALPROJ, projname);
  1137. X    logmsg (messg);
  1138. X    exit (1);
  1139. X  }
  1140. X
  1141. X  CatchSigs ();
  1142. X  nfnms = nac;
  1143. X  ThisTransaction.tr_rc = 0;
  1144. X  for (i = 0; i < nfnms; i++) {
  1145. X    if (!setjmp (ThisTransaction.tr_env)) {
  1146. X      ThisTransaction.tr_seqno = i;
  1147. X      (void)strcpy (ThisTransaction.tr_fname, nav[i]);
  1148. X      ThisTransaction.tr_done = FALSE;
  1149. X      SaveAFile (nav[i], &pdesc);
  1150. X    }
  1151. X    else { /* ThisTransaction was aborted */
  1152. X      rc += ThisTransaction.tr_rc;
  1153. X    }
  1154. X  }
  1155. X  logmsg ("done.");
  1156. X  return (rc);
  1157. X}
  1158. X
  1159. XSfunc_t interrupt_action () { /* is executed by appropriate signal handler */
  1160. X  char messg[80];
  1161. X  int mask = sigblock (SIGINT);
  1162. X  
  1163. X  if ((nfnms - ThisTransaction.tr_seqno) > 1) { 
  1164. X    (void)sprintf (messg, "\ncompletely stop saving (%d files unsaved) ?", 
  1165. X         nfnms - ThisTransaction.tr_seqno);
  1166. X    if (ask_confirm (messg, "no")) {
  1167. X      if (ThisTransaction.tr_done) {
  1168. X    (void)sprintf (messg, "\ntoo late, %s already saved", 
  1169. X         ThisTransaction.tr_fname);
  1170. X    logmsg (messg);
  1171. X    return; /* continue where we've been interrupted */
  1172. X      }
  1173. X      (void)sprintf (messg, "%s not saved", ThisTransaction.tr_fname);
  1174. X      logmsg (messg);
  1175. X      (void)sigsetmask (mask);
  1176. X      longjmp (ThisTransaction.tr_env, 1);
  1177. X    }
  1178. X    else {
  1179. X      (void)sprintf (messg, "%s not saved", ThisTransaction.tr_fname);
  1180. X      logmsg (messg);
  1181. X      exit (1);
  1182. X    }
  1183. X  }
  1184. X  else {
  1185. X    (void)sprintf (messg, "\n%s not saved", ThisTransaction.tr_fname);
  1186. X    logmsg (messg);
  1187. X    exit (1);
  1188. X  }
  1189. X}
  1190. X
  1191. Xlogmsg (msg) char *msg; {
  1192. X  if (!(options & QUIETPLEASE)) {
  1193. X    fprintf (stdout, "%s\n", msg);
  1194. X  }
  1195. X}
  1196. X
  1197. Xlogerr (msg) char *msg; {
  1198. X  fprintf (stderr, "%s: %s\n", progname, msg);
  1199. X}
  1200. X
  1201. X/*ARGSUSED*/
  1202. Xhandle_R_switch (o, a) char *o, *a; {
  1203. X  printf ("This is %s version %s.\n", progname, version());
  1204. X  printf ("AFS version %s.\n", af_version());
  1205. X  exit (0);
  1206. X}
  1207. X
  1208. X/*ARGSUSED*/
  1209. Xhandle_a_opt (o, a) char *o, *a; {
  1210. X  options |= ATTRDEF;
  1211. X  (void)strcpy (atr_fname, a);
  1212. X  return 0;
  1213. X}
  1214. X
  1215. X/*ARGSUSED*/
  1216. Xhandle_f_switch (o, a) char *o, *a; {
  1217. X  options |= FORCE;
  1218. X  return 0;
  1219. X}
  1220. X
  1221. X/*ARGSUSED*/
  1222. Xhandle_m_opt (o, a) char *o, *a; {
  1223. X  if (!(options & TXTFSET)) {
  1224. X    options |= MSGSET;
  1225. X    (void)strcpy (vcomment, a);
  1226. X    return 0;
  1227. X  }
  1228. X  return 0;
  1229. X}
  1230. X
  1231. X/*ARGSUSED*/
  1232. Xhandle_n_opt (o, a) char *o, *a; {
  1233. X  if (a && a[0]) {
  1234. X    options |= SYMNSET;
  1235. X    (void)strcpy (symname, a);
  1236. X  }
  1237. X  return 0;
  1238. X}
  1239. X
  1240. X/*ARGSUSED*/
  1241. Xhandle_q_switch (o, a) char *o, *a; {
  1242. X  options |= QUIETPLEASE;
  1243. X  return 0;
  1244. X}
  1245. X
  1246. X/*ARGSUSED*/
  1247. Xhandle_p_opt (o, a) char *o, *a; {
  1248. X  options |= OTHERPROJ;
  1249. X  (void)strcpy (projname, a);
  1250. X  return 0;
  1251. X}
  1252. X
  1253. X/*ARGSUSED*/
  1254. Xhandle_svnum_opt (o, a) char *o, *a; {
  1255. X  char messg[80];
  1256. X  if (!(newvnum = mkvno (a))) {
  1257. X    (void)sprintf (messg, "bad version number \"%s\"", a);
  1258. X    logerr (messg);
  1259. X    return 1;
  1260. X  }
  1261. X  options |= SETVNUM;
  1262. X  return 0;
  1263. X}
  1264. X
  1265. X/*ARGSUSED*/
  1266. Xhandle_t_opt (o, a) char *o, *a; {
  1267. X  if (options & MSGSET) {
  1268. X    options &= ~MSGSET;
  1269. X  }
  1270. X  options |= TXTFSET;
  1271. X  (void)strcpy (tfname, a);
  1272. X  return 0;
  1273. X}
  1274. X
  1275. X/*ARGSUSED*/
  1276. Xhandle_u_switch (o, a) char *o, *a; {
  1277. X  options |= LCKGIVEUP;
  1278. X  return 0;
  1279. X}
  1280. X
  1281. Xusage () {
  1282. X  pa_ShortUsage (progname, argdesc, "files ...");
  1283. X  exit (1);
  1284. X}
  1285. X
  1286. END_OF_FILE
  1287. if test 6983 -ne `wc -c <'src/vc/save.c'`; then
  1288.     echo shar: \"'src/vc/save.c'\" unpacked with wrong size!
  1289. fi
  1290. # end of 'src/vc/save.c'
  1291. fi
  1292. if test -f 'src/vc/vc_call.c' -a "${1}" != "-c" ; then 
  1293.   echo shar: Will not clobber existing file \"'src/vc/vc_call.c'\"
  1294. else
  1295. echo shar: Extracting \"'src/vc/vc_call.c'\" \(5928 characters\)
  1296. sed "s/^X//" >'src/vc/vc_call.c' <<'END_OF_FILE'
  1297. X/*
  1298. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  1299. X *  and U. Pralle
  1300. X * 
  1301. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  1302. X * WARRANTY for any part of this software to work correctly or as described
  1303. X * in the manuals. We do not accept any liability for any kind of damage
  1304. X * caused by use of this software, such as loss of data, time, money, or 
  1305. X * effort.
  1306. X * 
  1307. X * Permission is granted to use, copy, modify, or distribute any part of
  1308. X * this software as long as this is done without asking for charge, and
  1309. X * provided that this copyright notice is retained as part of the source
  1310. X * files. You may charge a distribution fee for the physical act of
  1311. X * transferring a copy, and you may at your option offer warranty
  1312. X * protection in exchange for a fee.
  1313. X * 
  1314. X * Direct questions to: Tech. Univ. Berlin
  1315. X *              Wilfried Koch
  1316. X *              Sekr. FR 5-6 
  1317. X *              Franklinstr. 28/29
  1318. X *              D-1000 Berlin 10, West Germany
  1319. X * 
  1320. X *              Tel: +49-30-314-22972
  1321. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  1322. X */
  1323. X#ifndef lint
  1324. Xstatic char *AFSid = "$Header: vc_call.c[1.10] Thu Feb 23 18:14:28 1989 axel@coma published $";
  1325. X#ifdef CFFLGS
  1326. Xstatic char *ConfFlg = CFFLGS;
  1327. X    /* should be defined from within Makefile */
  1328. X#endif
  1329. X#endif
  1330. X/*
  1331. X * Log for /u/shape/dist-tape/src/vc/vc_call.c[1.3]
  1332. X *     Thu Feb 23 18:14:28 1989 axel@coma published $
  1333. X *  --- empty log message ---
  1334. X *  vc_call.c[1.6] Thu Feb 23 18:14:28 1989 axel@coma published $
  1335. X *  --- empty log message ---
  1336. X *  vc_call.c[1.7] Thu Feb 23 18:14:28 1989 axel@coma save $
  1337. X *  --- empty log message ---
  1338. X *  vc_call.c[1.8] Thu Feb 23 18:14:28 1989 axel@coma save $
  1339. X *  --- empty log message ---
  1340. X *  vc_call.c[1.9] Thu Feb 23 18:14:28 1989 axel@coma save $
  1341. X *  --- empty log message ---
  1342. X *  vc_call.c[1.10] Thu Feb 23 18:14:28 1989 axel@coma published $
  1343. X *  --- empty log message ---
  1344. X */
  1345. X
  1346. X#include <stdio.h>
  1347. X#include <strings.h>
  1348. X#include <signal.h>
  1349. X#include <sys/types.h>
  1350. X#include <sys/stat.h>
  1351. X#include <sys/wait.h>
  1352. X#ifndef MAXNAMLEN
  1353. X#include <sys/dir.h>
  1354. X#endif MAXNAMLEN
  1355. X#include "afsapp.h"
  1356. X#include <sys/resource.h>
  1357. X
  1358. Xextern char *malloc();
  1359. Xextern char *FindProgram();
  1360. X
  1361. X/**/
  1362. Xint call (status, this_program, argvec)
  1363. X     union wait *status;
  1364. X     char *this_program;
  1365. X     char **argvec;
  1366. X{
  1367. X  int pid, offered_pid;
  1368. X  extern char **environ;
  1369. X
  1370. X  if (!rindex (this_program, '/')) {
  1371. X    if ((this_program = FindProgram (this_program)) == NULL)
  1372. X      return 0;
  1373. X  }
  1374. X  
  1375. X  if (!FileExecutable (this_program))
  1376. X    return 0;
  1377. X  
  1378. X  pid = vfork ();
  1379. X
  1380. X  if (pid == -1) {
  1381. X    logerr ("Can't fork");
  1382. X    return 0;
  1383. X  }
  1384. X
  1385. X  if (!pid) {
  1386. X    /* child */
  1387. X    /* close open files ? */
  1388. X    execve (this_program, argvec, environ);
  1389. X    logerr ("Can't exec");
  1390. X    _exit (1);
  1391. X    return 1;            /* to make lint happy */
  1392. X  }
  1393. X  else {
  1394. X    /* parent */
  1395. X    /* here we must redefine actual interrupt handler. */
  1396. X    while ( ((offered_pid = wait (status)) != pid) && (offered_pid != -1))
  1397. X      ;                /* nothing to do */
  1398. X
  1399. X    
  1400. X    if (offered_pid == -1) {
  1401. X      return 0;
  1402. X    }
  1403. X    /* here we must reconstruct old sighandl */
  1404. X    if (status->w_status)
  1405. X      return 0;
  1406. X    else
  1407. X      return 1;
  1408. X  }
  1409. X/*NOTREACHED*/
  1410. X  return 1;
  1411. X}
  1412. X
  1413. X/**/
  1414. Xint call_editor (editor, file, contents, newcontents)
  1415. X     char *editor, *file, *contents;
  1416. X/*     unsigned long *newcontents; */
  1417. X     char **newcontents;
  1418. X{
  1419. X  /*
  1420. X   * Calls editor "editor" with file "file" and returns its
  1421. X   * contents after the editor session in "newcontents".
  1422. X   * Return value is the length of the new text.
  1423. X   *
  1424. X   * On failure, 0 is returned to indicate the error. newcontents
  1425. X   * is *not* updated and points to nowhere. On error the file
  1426. X   * will be removed.
  1427. X   *
  1428. X   * If "contents" points to a valid text, this text is put (not appended)
  1429. X   * into the temporary file before editor starts. Text must be
  1430. X   * NULL terminated, otherwise strange things will happen...
  1431. X   */
  1432. X  
  1433. X  FILE *fid;
  1434. X  char *new;
  1435. X  char cmd[MAXNAMLEN];
  1436. X  int length;
  1437. X  union wait status;
  1438. X  struct stat sbuf;
  1439. X  char buf[100];
  1440. X  char *argvec[10];
  1441. X
  1442. X  *newcontents = NULL;        /* don't get confused on error. */
  1443. X
  1444. X  Register (file, TYPEF);
  1445. X  if ((fid = fopen (file, "w")) == NULL) { /* create a file */
  1446. X    (void)sprintf (buf,"Can't open temporary file %s.", file);
  1447. X    UnRegister (file, TYPEF);
  1448. X    logerr (buf);
  1449. X    return -1;
  1450. X  }
  1451. X
  1452. X  if (contents && *contents) {
  1453. X    length = strlen (contents);
  1454. X    
  1455. X    if (fwrite (contents, sizeof (char), length, fid) != length) {
  1456. X      (void)sprintf (buf, "lost bytes while writing to %s.", file);
  1457. X      logerr (buf);
  1458. X      (void)fclose (fid);
  1459. X      RemoveFile (file);
  1460. X      UnRegister (file, TYPEF);
  1461. X      return -1;
  1462. X    }
  1463. X  }
  1464. X  
  1465. X  (void)fclose (fid);
  1466. X  
  1467. X  (void)sprintf (cmd, "%s %s", editor, file);
  1468. X  (void)sprintf (buf, "starting up %s...", cmd);
  1469. X  logmsg (buf);
  1470. X
  1471. X  argvec[0] = editor;
  1472. X  argvec[1] = file;
  1473. X  argvec[2] = (char *) NULL;
  1474. X
  1475. X  /*  if (retcode = system (cmd)) { */
  1476. X  /*VARARGS2*/
  1477. X  if (! call (&status, editor, argvec)) {
  1478. X    (void)sprintf (buf, "Editor %s exited abnormally.", editor);
  1479. X    logerr (buf);
  1480. X    RemoveFile (file);
  1481. X    UnRegister (file, TYPEF);
  1482. X    return -1;
  1483. X  }
  1484. X
  1485. X  if (stat (file, &sbuf) == -1) {
  1486. X    (void)sprintf (buf,"Can't stat temporary file %s.", file);
  1487. X    logerr (buf);
  1488. X    return -1;
  1489. X  }
  1490. X    
  1491. X  if ((fid = fopen (file, "r")) == NULL) {
  1492. X    (void)sprintf (buf,"Can't reopen temporary file %s.", file);
  1493. X    logerr (buf);
  1494. X    RemoveFile (file);
  1495. X    UnRegister (file, TYPEF);
  1496. X    return -1;
  1497. X  }
  1498. X  RemoveFile (file);
  1499. X  UnRegister (file, TYPEF);
  1500. X  length = sbuf.st_size;
  1501. X  if ((new = malloc ((unsigned)(sizeof (char) * (length + 1)))) == NULL) {
  1502. X    logerr ("Can't malloc for new");
  1503. X    (void)fclose (fid);
  1504. X    return -1;
  1505. X  }
  1506. X  
  1507. X  if (!fread (new, sizeof (char), length, fid)) {
  1508. X    (void)sprintf (buf, "lost bytes while reading from %s.", file);
  1509. X    logerr (buf);
  1510. X    (void)fclose (fid);
  1511. X    return -1;
  1512. X  }
  1513. X  new[length] = NULL;
  1514. X
  1515. X  (void)fclose (fid);
  1516. X  *newcontents = new;
  1517. X  return length;
  1518. X}
  1519. END_OF_FILE
  1520. if test 5928 -ne `wc -c <'src/vc/vc_call.c'`; then
  1521.     echo shar: \"'src/vc/vc_call.c'\" unpacked with wrong size!
  1522. fi
  1523. # end of 'src/vc/vc_call.c'
  1524. fi
  1525. if test -f 'src/vfind/at_misc.c' -a "${1}" != "-c" ; then 
  1526.   echo shar: Will not clobber existing file \"'src/vfind/at_misc.c'\"
  1527. else
  1528. echo shar: Extracting \"'src/vfind/at_misc.c'\" \(6781 characters\)
  1529. sed "s/^X//" >'src/vfind/at_misc.c' <<'END_OF_FILE'
  1530. X/*
  1531. X * Copyright (C) 1989, 1990 W. Koch, A. Lampen, A. Mahler, W. Obst,
  1532. X *  and U. Pralle
  1533. X * 
  1534. X * This software is published on an as-is basis. There is ABSOLUTELY NO
  1535. X * WARRANTY for any part of this software to work correctly or as described
  1536. X * in the manuals. We do not accept any liability for any kind of damage
  1537. X * caused by use of this software, such as loss of data, time, money, or 
  1538. X * effort.
  1539. X * 
  1540. X * Permission is granted to use, copy, modify, or distribute any part of
  1541. X * this software as long as this is done without asking for charge, and
  1542. X * provided that this copyright notice is retained as part of the source
  1543. X * files. You may charge a distribution fee for the physical act of
  1544. X * transferring a copy, and you may at your option offer warranty
  1545. X * protection in exchange for a fee.
  1546. X * 
  1547. X * Direct questions to: Tech. Univ. Berlin
  1548. X *              Wilfried Koch
  1549. X *              Sekr. FR 5-6 
  1550. X *              Franklinstr. 28/29
  1551. X *              D-1000 Berlin 10, West Germany
  1552. X * 
  1553. X *              Tel: +49-30-314-22972
  1554. X *              E-mail: shape@coma.uucp or shape@db0tui62.bitnet
  1555. X */
  1556. X/*  LAST EDIT: Mon Feb 20 15:43:04 1989 by Uli Pralle (coma!uli)  */
  1557. X/*
  1558. X * at_misc.c
  1559. X */
  1560. X#ifndef lint
  1561. Xstatic char *AFSid = "$Header: at_misc.c[1.2] Tue Feb 21 20:22:58 1989 uli@coma published $";
  1562. Xstatic char *Objfile = "at_misc.c[1.2] published";
  1563. X#ifdef CFFLGS
  1564. X  static char *Cflags = CFFLGS;
  1565. X#endif
  1566. X#endif
  1567. X/*
  1568. X * Log for /u/shape/dist-tape/src/vfind/at_misc.c[1.2]
  1569. X *     Tue Feb 21 20:22:58 1989 uli@coma published $
  1570. X *      * This file contains many AFS utilities that makes life easier.
  1571. X *        This comes with atk.h.
  1572. X *  
  1573. X *  
  1574. X */
  1575. X
  1576. X#include <sys/types.h>
  1577. X#include <sys/stat.h>
  1578. X#include <sys/param.h>
  1579. X#include <time.h>
  1580. X#include <strings.h>
  1581. X
  1582. X#include <afs.h>
  1583. X
  1584. Xextern char *malloc();
  1585. Xstatic char at_filemode[12];
  1586. X
  1587. Xchar *at_getmode (attr)
  1588. X     Af_attrs *attr;
  1589. X{
  1590. X  /* This function should return a capital 'L' in the file-class field */
  1591. X  /* to indicate a *locked* version. Maybe optional. Instead of Ownername */
  1592. X  /* the name of the locker is to be printed. */
  1593. X  ushort mode;
  1594. X
  1595. X  mode = attr->af_mode;
  1596. X  (void) sprintf (at_filemode, " %c%c%c%c%c%c%c%c%c",
  1597. X          (mode & S_IREAD) ? 'r' : '-',
  1598. X          (mode & S_IWRITE) ? 'w' : '-',
  1599. X          (mode & S_IEXEC) ? 'x' : '-',
  1600. X          (mode & (S_IREAD >> 3)) ? 'r' : '-',
  1601. X          (mode & (S_IWRITE >> 3)) ? 'w' : '-',
  1602. X          (mode & (S_IEXEC >> 3)) ? 'x' : '-',
  1603. X          (mode & (S_IREAD >> 6)) ? 'r' : '-',
  1604. X          (mode & (S_IWRITE >> 6)) ? 'w' : '-',
  1605. X          (mode & (S_IEXEC >> 6)) ? 'x' : '-'
  1606. X          );
  1607. X
  1608. X  switch (mode & S_IFMT) {
  1609. X  case S_IFDIR:
  1610. X    at_filemode[0] =  'd';
  1611. X    break;
  1612. X  case S_IFCHR:
  1613. X    at_filemode[0] = 'c';
  1614. X    break;
  1615. X  case S_IFBLK:
  1616. X    at_filemode[0] = 'b';
  1617. X    break;
  1618. X  case S_IFREG:
  1619. X    at_filemode[0] = '-';
  1620. X    break;
  1621. X  case S_IFLNK:
  1622. X    at_filemode[0] = 'l';
  1623. X    break;
  1624. X  case S_IFSOCK:
  1625. X    at_filemode[0] = 's';
  1626. X    break;
  1627. X  }
  1628. X  
  1629. X  if (mode & S_ISUID)
  1630. X    at_filemode[1] = 's';
  1631. X  if (mode & S_ISGID)
  1632. X    at_filemode[6] = 's';
  1633. X  if (mode & S_ISVTX)
  1634. X    at_filemode[9] = 't';
  1635. X
  1636. X  return at_filemode;
  1637. X}
  1638. X
  1639. Xchar *
  1640. X#ifdef __STDC__
  1641. X  at_symbfiletype (u_short mode, int afstate)
  1642. X#else
  1643. Xsymbfiletype (mode, afstate) u_short mode; int afstate;
  1644. X#endif
  1645. X{
  1646. X  if (afstate == AF_NOSTATE) return "$"; /* derived object */
  1647. X  switch (mode & S_IFMT) {
  1648. X  case S_IFDIR:
  1649. X    return "/";
  1650. X  case S_IFLNK:
  1651. X    return "@";
  1652. X  case S_IFSOCK:
  1653. X    return "=";
  1654. X  default:
  1655. X    if ((mode & S_IEXEC) || (mode & (S_IEXEC >> 3)) || (mode & (S_IEXEC >> 6)))
  1656. X      return "*";
  1657. X    else
  1658. X      return "";
  1659. X  }
  1660. X}
  1661. X
  1662. Xint at_string2state (string)
  1663. X     char *string;
  1664. X{
  1665. X  if (!strcmp(string,"busy"))
  1666. X    return AF_BUSY;
  1667. X  else if (!strcmp(string,"save"))
  1668. X    return AF_SAVED;
  1669. X  else if (!strcmp(string,"proposed"))
  1670. X    return AF_PROPOSED;
  1671. X  else if (!strcmp(string,"published"))
  1672. X    return AF_PUBLISHED;
  1673. X  else if (!strcmp(string,"accessed"))
  1674. X    return AF_ACCESSED;
  1675. X  else if (!strcmp(string,"frozen"))
  1676. X    return AF_FROZEN;
  1677. X  else return AF_NOSTATE;
  1678. X}
  1679. X
  1680. Xchar *at_getversstate (attr, verbose) Af_attrs *attr; int verbose;
  1681. X{
  1682. X  int state;
  1683. X
  1684. X  state = attr->af_state;
  1685. X  
  1686. X  switch (state) {
  1687. X  case AF_BUSY:
  1688. X    return verbose ? "[busy]" : "b";
  1689. X  case AF_SAVED:
  1690. X    return verbose ? "[save]" : "s";
  1691. X  case AF_PROPOSED:
  1692. X    return verbose ? "[prop]" : "p";
  1693. X  case AF_PUBLISHED:
  1694. X    return verbose ? "[publ]" : "P";
  1695. X  case AF_ACCESSED:
  1696. X    return verbose ? "[acce]" : "a";
  1697. X  case AF_FROZEN:
  1698. X    return verbose ? "[froz]" : "f";
  1699. X  default:
  1700. X    return verbose ? "[drvd]" : "$"; /* binary pool ? */
  1701. X  }
  1702. X}
  1703. X
  1704. Xstatic char boundversion[2*MAXNAMLEN];
  1705. X
  1706. Xchar *at_getbndvers (attr)
  1707. X     Af_attrs *attr;     
  1708. X{
  1709. X  char *path, *name, *type;
  1710. X  int gen, rev;
  1711. X  
  1712. X  path = attr->af_syspath;
  1713. X  name = attr->af_name;
  1714. X  type = attr->af_type;
  1715. X  gen = attr->af_gen;
  1716. X  rev = attr->af_rev;
  1717. X  
  1718. X  if (gen == AF_BUSYVERS && rev == AF_BUSYVERS) {
  1719. X    (void) sprintf (boundversion, "%s%s%s%s%s",
  1720. X            (path[0]) ? path : "",
  1721. X            (path[0]) ? "/" : "",
  1722. X            name,
  1723. X            (type[0]) ? "." : "",
  1724. X            (type[0]) ? type : "");
  1725. X  }
  1726. X  else {
  1727. X    (void) sprintf (boundversion, "%s%s%s%s%s[%d.%d]",
  1728. X            (path[0]) ? path : "",
  1729. X            (path[0]) ? "/" : "",
  1730. X            name,
  1731. X            (type[0]) ? "." : "",
  1732. X            (type[0]) ? type : "",
  1733. X            gen, rev);
  1734. X  }
  1735. X
  1736. X  return boundversion;
  1737. X}
  1738. X
  1739. Xstatic char at_filename[MAXNAMLEN+1];
  1740. X
  1741. Xchar *at_getfilename (attr)
  1742. X     Af_attrs *attr;     
  1743. X{
  1744. X  (void) sprintf (at_filename, "%s%s%s", attr->af_name,
  1745. X          attr->af_type[0] ? "." : "",
  1746. X          attr->af_type[0] ? attr->af_type : "" );
  1747. X  
  1748. X  return at_filename;
  1749. X}
  1750. X    
  1751. Xchar *at_getdate (attr)
  1752. X     Af_attrs *attr;
  1753. X{
  1754. X  time_t date;
  1755. X  char *tmp_time;
  1756. X  extern char *ctime();
  1757. X
  1758. X  date = (attr->af_state == AF_BUSY ? attr->af_mtime : attr->af_stime);
  1759. X  tmp_time = ctime(&date);
  1760. X
  1761. X  /* Format is "Sun Sep 16 01:03:52 1973\n\0" */
  1762. X  tmp_time = tmp_time + 4;
  1763. X  tmp_time[20] = '\0';
  1764. X  return tmp_time;
  1765. X}
  1766. X
  1767. Xstatic char at_userandhost[20];
  1768. X
  1769. Xchar *at_getuser(user) 
  1770. X     Af_user *user;
  1771. X{
  1772. X  char tmp[20];
  1773. X  
  1774. X  tmp[0] = '\0';
  1775. X  (void) strncat (tmp, user->af_username, 8);
  1776. X  (void) strcat (tmp, "@");
  1777. X  (void) strncat (tmp, user->af_userhost, 8);
  1778. X  (void) sprintf (at_userandhost, "%-16s", tmp);
  1779. X  return at_userandhost;
  1780. X}
  1781. X
  1782. Xint at_matchuda (attrbuf, uda)
  1783. X     Af_attrs *attrbuf;
  1784. X     char *uda;
  1785. X{
  1786. X  /* Returns 1 if attrbuf has an uda uda, otherwise 0. */
  1787. X
  1788. X  char *v, *cp;
  1789. X  char **udattrs = attrbuf->af_udattrs;
  1790. X  int ul, vl = 0;
  1791. X
  1792. X  if (!uda) return 0;
  1793. X
  1794. X  if (v = index(uda, '='))
  1795. X    vl = strlen(++v);
  1796. X    
  1797. X  ul = strlen(uda) - vl - 1;
  1798. X
  1799. X  while (udattrs && *udattrs)
  1800. X    if (!strncmp(uda, *udattrs, ul)) {
  1801. X      cp = (*udattrs)+ul;
  1802. X      if (*cp == '\0' && !v) return 1;
  1803. X      if (*cp == '=' && !v)
  1804. X    return 1;
  1805. X      else cp++;
  1806. X      
  1807. X      while (cp) {
  1808. X    if (*cp == '\n')
  1809. X      cp++;
  1810. X    if (!strncmp(cp, v, vl))
  1811. X      return 1;
  1812. X    else
  1813. X      if (cp = index(cp , '\n'))
  1814. X        cp++;
  1815. X      else
  1816. X        return 0;
  1817. X      }
  1818. X    }
  1819. X    else
  1820. X      udattrs++;
  1821. X
  1822. X  return 0;
  1823. X}
  1824. END_OF_FILE
  1825. if test 6781 -ne `wc -c <'src/vfind/at_misc.c'`; then
  1826.     echo shar: \"'src/vfind/at_misc.c'\" unpacked with wrong size!
  1827. fi
  1828. # end of 'src/vfind/at_misc.c'
  1829. fi
  1830. echo shar: End of archive 7 \(of 33\).
  1831. cp /dev/null ark7isdone
  1832. MISSING=""
  1833. 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
  1834.     if test ! -f ark${I}isdone ; then
  1835.     MISSING="${MISSING} ${I}"
  1836.     fi
  1837. done
  1838. if test "${MISSING}" = "" ; then
  1839.     echo You have unpacked all 33 archives.
  1840.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1841. else
  1842.     echo You still need to unpack the following archives:
  1843.     echo "        " ${MISSING}
  1844. fi
  1845. ##  End of shell archive.
  1846. exit 0
  1847.