home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume28 / bcs-2.0 / part01 < prev    next >
Encoding:
Text File  |  1994-03-29  |  49.8 KB  |  1,657 lines

  1. Newsgroups: comp.sources.unix
  2. From: ejb@ERA.COM (Jay Berkenbilt)
  3. Subject: v28i002: bcs-2.0 - A Baseline Configuration System, Part01/25
  4. References: <1.764985670.1461@gw.home.vix.com>
  5. Sender: unix-sources-moderator@gw.home.vix.com
  6. Approved: vixie@gw.home.vix.com
  7.  
  8. Submitted-By: ejb@ERA.COM (Jay Berkenbilt)
  9. Posting-Number: Volume 28, Issue 2
  10. Archive-Name: bcs-2.0/part01
  11.  
  12. #!/bin/sh
  13. # This is bcs-2.0, a shell archive (produced by shar 3.49)
  14. # To extract the files from this archive, save it to a file, remove
  15. # everything above the "!/bin/sh" line above, and type "sh file_name".
  16. #
  17. # made 03/20/1994 04:51 UTC by ejb@ERA.COM
  18. # Source directory /usr/tmp
  19. #
  20. # existing files will NOT be overwritten unless -c is specified
  21. #
  22. # This is part 1 of a multipart archive                                    
  23. # do not concatenate these parts, unpack them in order with /bin/sh        
  24. #
  25. # This shar contains:
  26. # length  mode       name
  27. # ------ ---------- ------------------------------------------
  28. #   2034 -rw-rw-r-- bcs-2.0/include/config.h.in
  29. #   4556 -r--r--r-- bcs-2.0/include/bcs.h
  30. #   3311 -r--r--r-- bcs-2.0/include/cm.h
  31. #   3068 -r--r--r-- bcs-2.0/include/common.h
  32. #   1588 -r--r--r-- bcs-2.0/include/flexlist.h
  33. #    555 -r--r--r-- bcs-2.0/include/patchlevel.h
  34. #    521 -r--r--r-- bcs-2.0/include/version.h
  35. #   1507 -r--r--r-- bcs-2.0/lib/Makefile
  36. #   5574 -r--r--r-- bcs-2.0/lib/bcs_p.h
  37. #  11029 -r--r--r-- bcs-2.0/lib/cm.c
  38. #  30386 -r--r--r-- bcs-2.0/lib/file_info.c
  39. #   2509 -r--r--r-- bcs-2.0/lib/file_info.h
  40. #    445 -r--r--r-- bcs-2.0/lib/find_cmd
  41. #   2676 -r--r--r-- bcs-2.0/lib/flexlist.c
  42. #  21921 -r--r--r-- bcs-2.0/lib/init.c
  43. #    930 -r--r--r-- bcs-2.0/lib/make_rcs_h
  44. #    691 -r--r--r-- bcs-2.0/lib/make_sccs_h
  45. #  19680 -r--r--r-- bcs-2.0/lib/path.c
  46. #   1309 -r--r--r-- bcs-2.0/lib/path.h
  47. #   7475 -r--r--r-- bcs-2.0/lib/rcs_cm.c
  48. #    969 -r--r--r-- bcs-2.0/lib/rcs_cm.h
  49. #   7789 -r--r--r-- bcs-2.0/lib/sccs_cm.c
  50. #    958 -r--r--r-- bcs-2.0/lib/sccs_cm.h
  51. #  26143 -r--r--r-- bcs-2.0/lib/staging.c
  52. #  13691 -r--r--r-- bcs-2.0/lib/util.c
  53. #    428 -r--r--r-- bcs-2.0/make/config.mk.in
  54. #    297 -r--r--r-- bcs-2.0/make/params.mk
  55. #    550 -r--r--r-- bcs-2.0/make/rules.mk
  56. #   1068 -r--r--r-- bcs-2.0/man/Makefile
  57. #   4001 -r--r--r-- bcs-2.0/man/bcs.man
  58. #   2873 -r--r--r-- bcs-2.0/progs/Makefile
  59. #   2413 -r--r--r-- bcs-2.0/progs/bcs.c
  60. #   7093 -r--r--r-- bcs-2.0/progs/classify_files.c
  61. #   2372 -r--r--r-- bcs-2.0/progs/in_baseline.c
  62. #   1546 -r--r--r-- bcs-2.0/progs/register_file.c
  63. #   1573 -r--r--r-- bcs-2.0/progs/stage.c
  64. #   2881 -r--r--r-- bcs-2.0/progs/sync_staging.c
  65. #   2718 -r--r--r-- bcs-2.0/progs/unstage.c
  66. #   1651 -r--r--r-- bcs-2.0/progs/update_baseline.c
  67. #   1431 -r--r--r-- bcs-2.0/tests/in_baseline.test
  68. #   3066 -r--r--r-- bcs-2.0/tests/init.test
  69. #   9354 -r--r--r-- bcs-2.0/tests/rcs.test
  70. #   7023 -r--r--r-- bcs-2.0/tests/sccs.test
  71. #   3940 -r--r--r-- bcs-2.0/tests/setup.pl
  72. #  14929 -r--r--r-- bcs-2.0/tests/stage.test
  73. #    502 -r--r--r-- bcs-2.0/tests/template
  74. #   4470 -r--r--r-- bcs-2.0/tests/test_routines.pl
  75. #    604 -r--r--r-- bcs-2.0/tests/version.test
  76. # 131253 -r--r--r-- bcs-2.0/doc/texinfo.tex
  77. #   1256 -r--r--r-- bcs-2.0/doc/Makefile
  78. #    968 -r--r--r-- bcs-2.0/doc/baseline.fig
  79. #    781 -r--r--r-- bcs-2.0/doc/baseline.txt
  80. # 111860 -r--r--r-- bcs-2.0/doc/bcs.texinfo
  81. #   1735 -r--r--r-- bcs-2.0/doc/stagea.fig
  82. #    769 -r--r--r-- bcs-2.0/doc/stagea.txt
  83. #   2227 -r--r--r-- bcs-2.0/doc/stageb.fig
  84. #   1067 -r--r--r-- bcs-2.0/doc/stageb.txt
  85. #   2308 -r--r--r-- bcs-2.0/doc/stagec.fig
  86. #   1067 -r--r--r-- bcs-2.0/doc/stagec.txt
  87. #   1845 -rwxrwxr-x bcs-2.0/doc/tex3patch
  88. #   2682 -rw-rw-r-- bcs-2.0/doc/baseline.EPS
  89. #   3822 -rw-rw-r-- bcs-2.0/doc/stagea.EPS
  90. #   4485 -rw-rw-r-- bcs-2.0/doc/stageb.EPS
  91. #   4616 -rw-rw-r-- bcs-2.0/doc/stagec.EPS
  92. # 315784 -rw-rw-r-- bcs-2.0/doc/bcs.PS
  93. #   3108 -rw-rw-r-- bcs-2.0/doc/bcs.info
  94. #  50024 -rw-rw-r-- bcs-2.0/doc/bcs.info-1
  95. #  45968 -rw-rw-r-- bcs-2.0/doc/bcs.info-2
  96. #  19389 -rw-rw-r-- bcs-2.0/doc/bcs.info-3
  97. #   5182 -rw-r--r-- bcs-2.0/Artistic
  98. #   8493 -r--r--r-- bcs-2.0/ChangeLog
  99. #   2072 -r--r--r-- bcs-2.0/Makefile.in
  100. #   4414 -r--r--r-- bcs-2.0/README
  101. #    277 -r--r--r-- bcs-2.0/acconfig.h
  102. #   2393 -r--r--r-- bcs-2.0/bcs_test
  103. #   1217 -r--r--r-- bcs-2.0/configure.in
  104. #      8 -r--r--r-- bcs-2.0/unsupported/sample-baseline/.baseline_conf
  105. #      8 -r--r--r-- bcs-2.0/unsupported/sample-baseline/.unimportant
  106. #     68 -r--r--r-- bcs-2.0/unsupported/sample-baseline/Makefile
  107. #    194 -r--r--r-- bcs-2.0/unsupported/sample-baseline/RCS/.baseline_conf,v
  108. #    194 -r--r--r-- bcs-2.0/unsupported/sample-baseline/RCS/.unimportant,v
  109. #    242 -r--r--r-- bcs-2.0/unsupported/sample-baseline/RCS/Makefile,v
  110. #   2381 -r--r--r-- bcs-2.0/unsupported/sample-baseline/RCS/README,v
  111. #    762 -r--r--r-- bcs-2.0/unsupported/sample-baseline/RCS/setup,v
  112. #   1851 -r--r--r-- bcs-2.0/unsupported/sample-baseline/README
  113. #     84 -r--r--r-- bcs-2.0/unsupported/sample-baseline/library/Makefile
  114. #    258 -r--r--r-- bcs-2.0/unsupported/sample-baseline/library/RCS/Makefile,v
  115. #    349 -r--r--r-- bcs-2.0/unsupported/sample-baseline/library/RCS/util.c,v
  116. #    257 -r--r--r-- bcs-2.0/unsupported/sample-baseline/library/RCS/util.h,v
  117. #    174 -r--r--r-- bcs-2.0/unsupported/sample-baseline/library/util.c
  118. #     82 -r--r--r-- bcs-2.0/unsupported/sample-baseline/library/util.h
  119. #    516 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/IRIX.mki
  120. #    520 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/Linux.mki
  121. #    692 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/IRIX.mki,v
  122. #    660 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/Linux.mki,v
  123. #    677 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/ccprog.mk,v
  124. #    670 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/cprog.mk,v
  125. #   1689 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/global.mki,v
  126. #   1318 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/library.mk,v
  127. #    730 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/local.mki,v
  128. #    979 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/lucid.mki,v
  129. #   9549 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/make.doc,v
  130. #   1356 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/prog.mki,v
  131. #   2099 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/recursive.mk,v
  132. #   6395 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/rules.mki,v
  133. #    635 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/sparc.mki,v
  134. #    520 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/sun_cc.mki,v
  135. #    493 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/toplevel.mk,v
  136. #    707 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/RCS/HP-UX.mki,v
  137. #    535 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/ccprog.mk
  138. #    528 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/cprog.mk
  139. #   1548 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/global.mki
  140. #   1175 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/library.mk
  141. #    590 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/local.mki
  142. #    837 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/lucid.mki
  143. #   9407 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/make.doc
  144. #   1215 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/prog.mki
  145. #   1942 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/recursive.mk
  146. #   5131 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/rules.mki
  147. #    495 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/sparc.mki
  148. #    378 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/sun_cc.mki
  149. #    351 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/toplevel.mk
  150. #    535 -r--r--r-- bcs-2.0/unsupported/sample-baseline/make/HP-UX.mki
  151. #     67 -r--r--r-- bcs-2.0/unsupported/sample-baseline/prog/Makefile
  152. #    241 -r--r--r-- bcs-2.0/unsupported/sample-baseline/prog/RCS/Makefile,v
  153. #    620 -r--r--r-- bcs-2.0/unsupported/sample-baseline/prog/RCS/main.c,v
  154. #    445 -r--r--r-- bcs-2.0/unsupported/sample-baseline/prog/main.c
  155. #    328 -r--r--r-- bcs-2.0/unsupported/sample-baseline/setup
  156. #    548 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/RCS/archtype,v
  157. #   1326 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/RCS/gen_deps,v
  158. #   3702 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/RCS/installsw,v
  159. #   1257 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/RCS/islink,v
  160. #   1296 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/RCS/recursive_make,v
  161. #   1831 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/RCS/unstage_unit,v
  162. #    374 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/archtype
  163. #   1182 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/gen_deps
  164. #   3159 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/installsw
  165. #    669 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/islink
  166. #    818 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/recursive_make
  167. #   1677 -r-xr-xr-x bcs-2.0/unsupported/sample-baseline/tools/unstage_unit
  168. #  17982 -rw-rw-r-- bcs-2.0/COPYING
  169. #   5341 -rw-rw-r-- bcs-2.0/INSTALL
  170. #    619 -rwxrwxr-x bcs-2.0/mkinstalldirs
  171. #  28388 -rwxrwxr-x bcs-2.0/configure
  172. #
  173. if test -r _shar_seq_.tmp; then
  174.     echo 'Must unpack archives in sequence!'
  175.     echo Please unpack part `cat _shar_seq_.tmp` next
  176.     exit 1
  177. fi
  178. # ============= bcs-2.0/include/config.h.in ==============
  179. if test ! -d 'bcs-2.0'; then
  180.     echo 'x - creating directory bcs-2.0'
  181.     mkdir 'bcs-2.0'
  182. fi
  183. if test ! -d 'bcs-2.0/include'; then
  184.     echo 'x - creating directory bcs-2.0/include'
  185.     mkdir 'bcs-2.0/include'
  186. fi
  187. if test -f 'bcs-2.0/include/config.h.in' -a X"$1" != X"-c"; then
  188.     echo 'x - skipping bcs-2.0/include/config.h.in (File already exists)'
  189.     rm -f _shar_wnt_.tmp
  190. else
  191. > _shar_wnt_.tmp
  192. echo 'x - extracting bcs-2.0/include/config.h.in (Text)'
  193. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/include/config.h.in' &&
  194. /* include/config.h.in.  Generated automatically from configure.in by autoheader.  */
  195. X
  196. /* Define to empty if the keyword does not work.  */
  197. #undef const
  198. X
  199. /* Define if you have dirent.h.  */
  200. #undef DIRENT
  201. X
  202. /* Define if you don't have vprintf but do have _doprnt.  */
  203. #undef HAVE_DOPRNT
  204. X
  205. /* Define if you have the vprintf function.  */
  206. #undef HAVE_VPRINTF
  207. X
  208. /* Define if on MINIX.  */
  209. #undef _MINIX
  210. X
  211. /* Define if you don't have dirent.h, but have ndir.h.  */
  212. #undef NDIR
  213. X
  214. /* Define if the system does not provide POSIX.1 features except
  215. X   with this defined.  */
  216. #undef _POSIX_1_SOURCE
  217. X
  218. /* Define if you need to in order for stat and other things to work.  */
  219. #undef _POSIX_SOURCE
  220. X
  221. /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly.  */
  222. #undef STAT_MACROS_BROKEN
  223. X
  224. /* Define if you have the ANSI C header files.  */
  225. #undef STDC_HEADERS
  226. X
  227. /* Define if you don't have dirent.h, but have sys/dir.h.  */
  228. #undef SYSDIR
  229. X
  230. /* Define if you don't have dirent.h, but have sys/ndir.h.  */
  231. #undef SYSNDIR
  232. X
  233. /* Define if the closedir function returns void instead of int.  */
  234. #undef VOID_CLOSEDIR
  235. X
  236. /* Define if `sys_errlist' is declared in <errno.h>.  */
  237. #undef SYS_ERRLIST_DECLARED
  238. X
  239. /* Define if `errno' is declared in <errno.h>.  */
  240. #undef ERRNO_DECLARED
  241. X
  242. /* Define if `free' is declared in <stdlib.h>.  */
  243. #undef FREE_DECLARED
  244. X
  245. /* Define if you have _sys_errlist.  */
  246. #undef HAVE__SYS_ERRLIST
  247. X
  248. /* Define if you have getcwd.  */
  249. #undef HAVE_GETCWD
  250. X
  251. /* Define if you have strerror.  */
  252. #undef HAVE_STRERROR
  253. X
  254. /* Define if you have sys_errlist.  */
  255. #undef HAVE_SYS_ERRLIST
  256. X
  257. /* Define if you have the <memory.h> header file.  */
  258. #undef HAVE_MEMORY_H
  259. X
  260. /* Define if you have the <stdarg.h> header file.  */
  261. #undef HAVE_STDARG_H
  262. X
  263. /* Define if you have the <stdlib.h> header file.  */
  264. #undef HAVE_STDLIB_H
  265. X
  266. /* Define if you have the <string.h> header file.  */
  267. #undef HAVE_STRING_H
  268. X
  269. /* Define if you have the <sys/param.h> header file.  */
  270. #undef HAVE_SYS_PARAM_H
  271. X
  272. /* Define if you have the <unistd.h> header file.  */
  273. #undef HAVE_UNISTD_H
  274. SHAR_EOF
  275. chmod 0664 bcs-2.0/include/config.h.in ||
  276. echo 'restore of bcs-2.0/include/config.h.in failed'
  277. Wc_c="`wc -c < 'bcs-2.0/include/config.h.in'`"
  278. test 2034 -eq "$Wc_c" ||
  279.     echo 'bcs-2.0/include/config.h.in: original size 2034, current size' "$Wc_c"
  280. rm -f _shar_wnt_.tmp
  281. fi
  282. # ============= bcs-2.0/include/bcs.h ==============
  283. if test -f 'bcs-2.0/include/bcs.h' -a X"$1" != X"-c"; then
  284.     echo 'x - skipping bcs-2.0/include/bcs.h (File already exists)'
  285.     rm -f _shar_wnt_.tmp
  286. else
  287. > _shar_wnt_.tmp
  288. echo 'x - extracting bcs-2.0/include/bcs.h (Text)'
  289. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/include/bcs.h' &&
  290. /* 
  291. X * $Id: bcs.h,v 1.34 1994/03/07 21:47:41 qjb Exp $
  292. X * $Source: /local/tmp/bcs-2.0/include/RCS/bcs.h,v $
  293. X * $Author: qjb $
  294. X *
  295. X * Copyright (C) 1994  E. Jay Berkenbilt
  296. X * 
  297. X * This file is part of BCS.  BCS may be distributed according to the terms
  298. X * of the General Public License and/or the Artistic License.  See the
  299. X * `COPYING' and `Artistic' files with the source distribution for details.
  300. X * This notice must be kept intact when this file is distributed.
  301. X *
  302. X * This is the header file for BCS.  It contains information shared by
  303. X * all source files.
  304. X */
  305. X
  306. #ifndef __BCS_H__
  307. #define __BCS_H__
  308. X
  309. #if !defined(lint) && !defined(CODECENTER) || defined(RCS_HDRS)
  310. /* Define a static function and call it.  No warnings this way. */
  311. static void rcsid_bcs_h(char *s)
  312. {rcsid_bcs_h("@(#)$Id: bcs.h,v 1.34 1994/03/07 21:47:41 qjb Exp $");}
  313. #endif /* !lint && !CODECENTER || RCS_HDRS */
  314. X
  315. /* This must be first */
  316. #include "common.h"
  317. X
  318. #include "flexlist.h"
  319. X
  320. /* Filename path separator */
  321. #define PATH_SEP_CHAR '/'
  322. #define PATH_SEP_STR "/"
  323. X
  324. /* Return statuses */
  325. #define BCS_SUCCESS      0    /* must be defined as zero */
  326. #define BCS_ERR_USAGE      1
  327. #define BCS_ERR_USER      2
  328. #define BCS_ERR_MEMORY       3
  329. #define BCS_ERR_SYSTEM      4
  330. #define BCS_ERR_INTERNAL  5
  331. #define BCS_ERR_PARTIAL      6
  332. X
  333. /* Debugging support */ 
  334. #define DEBUG_ENV        "DEBUG_BCS"
  335. #define BCS_DEBUG_LOGIC     (1 << 1)
  336. #define BCS_DEBUG_TRACE     (1 << 2)
  337. #define BCS_DEBUG_VERBOSE    (1 << 3)
  338. #define BCS_DEBUG_PATH        (1 << 4)
  339. X
  340. FL_DEFINE(bcs_stringlist_rec, bcs_stringlist, char *);
  341. X
  342. typedef enum { which_uninitialized, in_none,
  343. X           in_baseline, in_staging } bcs_which;
  344. X
  345. typedef struct {
  346. X    char *user_path;
  347. X    char *can_path;
  348. X    int ino;
  349. X    int dev;
  350. } bcs_path_info;
  351. X
  352. typedef struct bcs_baseline_info_rec {
  353. X    bcs_path_info path;
  354. X    char *cm_name;
  355. X    int secure;
  356. X    bcs_stringlist unimp_warn_suffixes;
  357. } *bcs_baseline_info;
  358. X    
  359. typedef struct bcs_staging_info_rec {
  360. X    bcs_path_info path;
  361. X    char *bl_path;
  362. } *bcs_staging_info;
  363. X
  364. X
  365. FL_DEFINE(bcs_baseline_rec, bcs_baseline, bcs_baseline_info);
  366. FL_DEFINE(bcs_staging_rec, bcs_staging, bcs_staging_info);
  367. X
  368. /* State */
  369. typedef struct bcs_obj_rec {
  370. X    char *whoami;        /* how this program was invoked */
  371. #ifdef DEBUG
  372. X    int debug_flags;        /* what type of debugging we are using */
  373. #endif
  374. X    bcs_baseline baseline;    /* paths to baseline */
  375. X    bcs_staging staging;    /* paths to staging area */
  376. X    struct bcs_cm_info_rec *cm;    /* info for current CM package */
  377. X    int silent;            /* don't print diagnostic messages */
  378. X    int recursive;        /* whether directory operations are recursive */
  379. X    int no_action;        /* true if we are not taking any action */
  380. } *bcs_obj_type;
  381. X
  382. typedef void (*usage_type)(char *);
  383. X  
  384. /*
  385. X * File information structures
  386. X */
  387. X  
  388. /* Opaque type */
  389. typedef struct bcs_file_info_rec *bcs_file_info;
  390. X
  391. FL_DEFINE(bcs_file_info_list_rec, bcs_file_info_list, bcs_file_info);
  392. X
  393. typedef enum { us_negative, us_ask, us_affirmative } unstage_param_type;
  394. X
  395. /* Callback for bcs_examine_dir */
  396. typedef void (*bcs_ed_callback)(bcs_obj_type, bcs_file_info, void *);
  397. X
  398. /* Must be after above definitions */
  399. #include "cm.h"
  400. X
  401. /* Function prototypes */
  402. X
  403. /* file_info.c */
  404. int bcs_examine_dir(bcs_obj_type, char *, int, bcs_ed_callback, void *);
  405. bcs_file_info bcs_get_file_info(bcs_obj_type, char *);
  406. void bcs_print_file_info(bcs_obj_type, bcs_file_info);
  407. char *fi_user_path(bcs_obj_type, bcs_file_info);
  408. int fi_important(bcs_obj_type, bcs_file_info);
  409. int fi_is_staged(bcs_obj_type, bcs_file_info);
  410. int fi_isdir(bcs_obj_type, bcs_file_info);
  411. X
  412. /* init.c */
  413. /* args: &bcs_obj, &argc, argv */
  414. void bcs_print_standard_opts(void);
  415. void bcs_start(bcs_obj_type *, int *, char *[], usage_type);
  416. X
  417. /* path.c */
  418. int bcs_isbldir(bcs_obj_type, char *, struct stat *, int *, bcs_which *);
  419. int bcs_isdir(bcs_obj_type, char *);
  420. int bcs_islink(bcs_obj_type, char *);
  421. void bcs_get_bl_index(bcs_obj_type, char *, int *, bcs_which *);
  422. X
  423. /* staging.c */
  424. int bcs_sync_staging(bcs_obj_type, char *, int, int);
  425. int bcs_stage(bcs_obj_type, char *, int);
  426. int bcs_unstage(bcs_obj_type, char *, unstage_param_type);
  427. int bcs_update_bl(bcs_obj_type, char *);
  428. X
  429. /* util.c */
  430. void bcs_message(bcs_obj_type, FILE *, const char *, ...)
  431. #ifdef __GNUC__
  432. __attribute__ ((format (printf, 3, 4)));
  433. #else
  434. ;
  435. #endif /* __GNUC__ */
  436. X
  437. #ifdef DEBUG
  438. #define DPRINT(x) bcs_dprint x
  439. void bcs_dprint(bcs_obj_type, int, const char *, ...)
  440. #ifdef __GNUC__
  441. __attribute__ ((format (printf, 3, 4)));
  442. #else
  443. ;
  444. #endif /* __GNUC__ */
  445. #else
  446. #define DPRINT(x)
  447. #endif /* DEBUG */
  448. X
  449. void bcs_strip_dir_path(char *);
  450. X
  451. #endif /* __BCS_H__ */
  452. SHAR_EOF
  453. chmod 0444 bcs-2.0/include/bcs.h ||
  454. echo 'restore of bcs-2.0/include/bcs.h failed'
  455. Wc_c="`wc -c < 'bcs-2.0/include/bcs.h'`"
  456. test 4556 -eq "$Wc_c" ||
  457.     echo 'bcs-2.0/include/bcs.h: original size 4556, current size' "$Wc_c"
  458. rm -f _shar_wnt_.tmp
  459. fi
  460. # ============= bcs-2.0/include/cm.h ==============
  461. if test -f 'bcs-2.0/include/cm.h' -a X"$1" != X"-c"; then
  462.     echo 'x - skipping bcs-2.0/include/cm.h (File already exists)'
  463.     rm -f _shar_wnt_.tmp
  464. else
  465. > _shar_wnt_.tmp
  466. echo 'x - extracting bcs-2.0/include/cm.h (Text)'
  467. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/include/cm.h' &&
  468. /* 
  469. X * $Id: cm.h,v 1.13 1994/03/07 21:47:41 qjb Exp $
  470. X * $Source: /local/tmp/bcs-2.0/include/RCS/cm.h,v $
  471. X * $Author: qjb $
  472. X *
  473. X * Copyright (C) 1994  E. Jay Berkenbilt
  474. X * 
  475. X * This file is part of BCS.  BCS may be distributed according to the terms
  476. X * of the General Public License and/or the Artistic License.  See the
  477. X * `COPYING' and `Artistic' files with the source distribution for details.
  478. X * This notice must be kept intact when this file is distributed.
  479. X *
  480. X * Header file for cm implementations
  481. X */
  482. X
  483. #ifndef __BCS_CM_H__
  484. #define __BCS_CM_H__
  485. X
  486. #if !defined(lint) && !defined(CODECENTER) || defined(RCS_HDRS)
  487. /* Define a static function and call it.  No warnings this way. */
  488. static void rcsid_bcs_cm_h(char *s)
  489. {rcsid_bcs_cm_h("@(#)$Id: cm.h,v 1.13 1994/03/07 21:47:41 qjb Exp $");}
  490. #endif /* !lint && !CODECENTER || RCS_HDRS */
  491. X
  492. /* Args: bcs object, argv for command.  Returns a list of file names
  493. X * from the arguments */
  494. typedef bcs_stringlist (*cm_fileargtype)(bcs_obj_type, char *[]);
  495. X
  496. /* Args: bcs object, filename.  Returns TRUE or FALSE */
  497. typedef int (*cm_haslog_type)(bcs_obj_type, char *);
  498. X
  499. /* Args: bcs object, filename.  Returns TRUE or FALSE */
  500. typedef int (*cm_locked_type)(bcs_obj_type, char *);
  501. X
  502. /* Args: bcs object, filename.  Returns TRUE or FALSE */
  503. typedef int (*cm_uptodate_type)(bcs_obj_type, char *);
  504. X
  505. /* Args: bcs object, fileame.  Returns TRUE if successful or FALSE otherwise */
  506. typedef int (*cm_update_bl_type)(bcs_obj_type, bcs_file_info);
  507. X
  508. /* Args: bcs object, bl filename, st filename.  Returns TRUE or FALSE */
  509. typedef int (*cm_register_type)(bcs_obj_type, char *, char *);
  510. X
  511. typedef enum { cm_checkout, cm_checkin } cm_command_type;
  512. X
  513. typedef struct {
  514. X    char *name;            /* name of command for bcs */
  515. X    char *fullcmd;        /* full path of command */
  516. X    cm_command_type cmd_type;    /* what kind of command this is */
  517. X    cm_fileargtype get_file_args; /* fn to get filename args */
  518. } cm_command;
  519. X
  520. typedef enum { cm_none, cm_file, cm_dir } cm_file_type;
  521. X
  522. typedef struct {
  523. X    char *path;
  524. X    cm_file_type file_type;
  525. } cm_precious;
  526. X
  527. typedef struct bcs_cm_info_rec {
  528. X    char *name;            /* name of package */
  529. X    cm_command *cmds;        /* list of supported commands */
  530. X    cm_precious *precious_files; /* files needed for shared CM logs */
  531. X    cm_haslog_type haslog;    /* tells whether a file has a log */
  532. X    cm_locked_type locked;    /* tells whether a file is locked */
  533. X    cm_uptodate_type uptodate;    /* tells whether a file is up-to-date */
  534. X    cm_update_bl_type update_bl; /* update the baseline */
  535. X    cm_register_type register_file; /* create a new file */
  536. } bcs_cm_info;
  537. X
  538. /* Function Prototypes */
  539. /* cm.c */
  540. void cm_register(bcs_obj_type, bcs_cm_info *);
  541. void cm_print_cm_packages(bcs_obj_type);
  542. void cm_use(bcs_obj_type, char *);
  543. int cm_is_precious(bcs_obj_type, char *);
  544. int cm_haslog(bcs_obj_type, char *);
  545. int cm_locked(bcs_obj_type, char *);
  546. int cm_uptodate(bcs_obj_type, char *);
  547. int cm_update_bl(bcs_obj_type, bcs_file_info);
  548. int cm_register_file(bcs_obj_type, char *);
  549. int cm_eligible(bcs_obj_type, cm_command_type, bcs_stringlist);
  550. int cm_run_command(bcs_obj_type, cm_command *, char *[]);
  551. cm_command *cm_lookup_command(bcs_obj_type, char *);
  552. X
  553. /* rcs_cm.c */
  554. void cm_register_rcs(bcs_obj_type);
  555. X
  556. /* sccs_cm.c */
  557. void cm_register_sccs(bcs_obj_type);
  558. X
  559. #endif /* __BCS_CM_H__ */
  560. SHAR_EOF
  561. chmod 0444 bcs-2.0/include/cm.h ||
  562. echo 'restore of bcs-2.0/include/cm.h failed'
  563. Wc_c="`wc -c < 'bcs-2.0/include/cm.h'`"
  564. test 3311 -eq "$Wc_c" ||
  565.     echo 'bcs-2.0/include/cm.h: original size 3311, current size' "$Wc_c"
  566. rm -f _shar_wnt_.tmp
  567. fi
  568. # ============= bcs-2.0/include/common.h ==============
  569. if test -f 'bcs-2.0/include/common.h' -a X"$1" != X"-c"; then
  570.     echo 'x - skipping bcs-2.0/include/common.h (File already exists)'
  571.     rm -f _shar_wnt_.tmp
  572. else
  573. > _shar_wnt_.tmp
  574. echo 'x - extracting bcs-2.0/include/common.h (Text)'
  575. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/include/common.h' &&
  576. /* 
  577. X * $Id: common.h,v 1.4 1994/03/07 21:47:41 qjb Exp $
  578. X * $Source: /local/tmp/bcs-2.0/include/RCS/common.h,v $
  579. X * $Author: qjb $
  580. X *
  581. X * Copyright (C) 1994  E. Jay Berkenbilt
  582. X * 
  583. X * This file is part of BCS.  BCS may be distributed according to the terms
  584. X * of the General Public License and/or the Artistic License.  See the
  585. X * `COPYING' and `Artistic' files with the source distribution for details.
  586. X * This notice must be kept intact when this file is distributed.
  587. X *
  588. X * This header file includes header files and defines macros
  589. X * common to all of BCS.  It uses the information generated
  590. X * by autoconf.
  591. X */
  592. X
  593. #ifndef __COMMON_H__
  594. #define __COMMON_H__
  595. X
  596. #if !defined(lint) && !defined(CODECENTER) || defined(RCS_HDRS)
  597. /* Define a static function and call it.  No warnings this way. */
  598. static void rcsid_common_h(char *s)
  599. {rcsid_common_h("@(#)$Id: common.h,v 1.4 1994/03/07 21:47:41 qjb Exp $");}
  600. #endif /* !lint && !CODECENTER || RCS_HDRS */
  601. X
  602. /* This must be first */
  603. #include "config.h"
  604. X
  605. /*
  606. X * Set things up here so that other files don't have to be cluttered with
  607. X * checking for autoconf definitions.
  608. X */
  609. X
  610. #include <stdio.h>
  611. #include <sys/types.h>
  612. #include <ctype.h>
  613. X
  614. #if STDC_HEADERS || HAVE_STDLIB_H
  615. # include <stdlib.h>
  616. #endif
  617. X
  618. #if STDC_HEADERS || HAVE_STDARG_H
  619. # include <stdarg.h>
  620. # define USE_VARARGS 0
  621. #else
  622. # include <varargs.h>
  623. # define USE_VARARGS 1
  624. #endif
  625. X
  626. #if HAVE_STRING_H
  627. # include <string.h>
  628. #else
  629. # include <strings.h>
  630. # define strrchr rindex
  631. # define strchr index
  632. #endif
  633. X
  634. #if (! STDC_HEADERS) && HAVE_MEMORY_H
  635. # include <memory.h>
  636. #endif
  637. X
  638. #if HAVE_MEMORY_H || STDC_HEADERS
  639. # define mem_zero(s, l) memset(s, 0, l)
  640. #else
  641. # define mem_zero(s, l) bzero(s, l)
  642. #endif
  643. X
  644. #if HAVE_UNISTD_H
  645. # include <unistd.h>
  646. #endif
  647. X
  648. #if HAVE_SYS_PARAM_H
  649. # include <sys/param.h>
  650. #else
  651. # ifndef MAXPATHNEN
  652. #  define MAXPATHLEN 1024
  653. # endif
  654. #endif
  655. X
  656. /* unistd.h defines _POSIX_VERSION on POSIX.1 systems.  */
  657. #if defined(DIRENT) || defined(_POSIX_VERSION)
  658. # include <dirent.h>
  659. #else /* not (DIRENT or _POSIX_VERSION) */
  660. # define dirent direct
  661. # ifdef SYSNDIR
  662. #  include <sys/ndir.h>
  663. # endif /* SYSNDIR */
  664. # ifdef SYSDIR
  665. #  include <sys/dir.h>
  666. # endif /* SYSDIR */
  667. # ifdef NDIR
  668. #  include <ndir.h>
  669. # endif /* NDIR */
  670. #endif /* not (DIRENT or _POSIX_VERSION) */
  671. X
  672. #if ! HAVE_GETCWD
  673. # define getcwd(s, l) getwd(s)
  674. #endif
  675. X
  676. #include <sys/stat.h>
  677. #ifdef STAT_MACROS_BROKEN
  678. # ifdef S_ISDIR
  679. #  undef S_ISDIR
  680. # endif
  681. # ifdef S_ISLNK
  682. #  undef S_ISLNK
  683. # endif
  684. # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  685. # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
  686. #endif
  687. X
  688. #include <errno.h>
  689. #if HAVE_STRERROR
  690. # define error_string(e) strerror(e)
  691. #else
  692. # if HAVE_SYS_ERRLIST || HAVE__SYS_ERRLIST
  693. #  ifndef SYS_ERRLIST_DECLARED
  694. X    extern char *sys_errlist[];
  695. #  endif
  696. #  define error_string(e) sys_errlist[e]
  697. # else
  698. #  error "Sorry, don't know how to define error_string."
  699. # endif
  700. #endif
  701. X
  702. #ifndef ERRNO_DECLARED
  703. extern int errno;
  704. #endif
  705. X
  706. #ifndef FREE_DECLARED
  707. extern void free(void *);
  708. #endif
  709. X
  710. #ifndef TRUE
  711. #define TRUE 1
  712. #endif
  713. X
  714. #ifndef FALSE
  715. #define FALSE 0
  716. #endif
  717. X
  718. #endif /* __COMMON_H__ */
  719. SHAR_EOF
  720. chmod 0444 bcs-2.0/include/common.h ||
  721. echo 'restore of bcs-2.0/include/common.h failed'
  722. Wc_c="`wc -c < 'bcs-2.0/include/common.h'`"
  723. test 3068 -eq "$Wc_c" ||
  724.     echo 'bcs-2.0/include/common.h: original size 3068, current size' "$Wc_c"
  725. rm -f _shar_wnt_.tmp
  726. fi
  727. # ============= bcs-2.0/include/flexlist.h ==============
  728. if test -f 'bcs-2.0/include/flexlist.h' -a X"$1" != X"-c"; then
  729.     echo 'x - skipping bcs-2.0/include/flexlist.h (File already exists)'
  730.     rm -f _shar_wnt_.tmp
  731. else
  732. > _shar_wnt_.tmp
  733. echo 'x - extracting bcs-2.0/include/flexlist.h (Text)'
  734. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/include/flexlist.h' &&
  735. /* 
  736. X * $Id: flexlist.h,v 1.5 1994/03/07 21:47:41 qjb Exp $
  737. X * $Source: /local/tmp/bcs-2.0/include/RCS/flexlist.h,v $
  738. X * $Author: qjb $
  739. X *
  740. X * Copyright (C) 1994  E. Jay Berkenbilt
  741. X * 
  742. X * This file is part of BCS.  BCS may be distributed according to the terms
  743. X * of the General Public License and/or the Artistic License.  See the
  744. X * `COPYING' and `Artistic' files with the source distribution for details.
  745. X * This notice must be kept intact when this file is distributed.
  746. X *
  747. X * Header file for flexlist implementation
  748. X */
  749. X
  750. #ifndef __FLEXLIST_H__
  751. #define __FLEXLIST_H__
  752. X
  753. #if !defined(lint) && !defined(CODECENTER) || defined(RCS_HDRS)
  754. /* Define a static function and call it.  No warnings this way. */
  755. static void rcsid_flexlist_h(char *s)
  756. {rcsid_flexlist_h("@(#)$Id: flexlist.h,v 1.5 1994/03/07 21:47:41 qjb Exp $");}
  757. #endif /* !lint && !CODECENTER || RCS_HDRS */
  758. X
  759. #ifndef TRUE
  760. #define TRUE 1
  761. #endif
  762. X
  763. #ifndef FALSE
  764. #define FALSE 0
  765. #endif
  766. X
  767. #define FLEX_MAX_INIT 4
  768. X
  769. typedef void *fl_pointer;
  770. X
  771. /*
  772. X * This is our half-hearted attempt at handling type parameterization
  773. X * for the flexlist structure.
  774. X */
  775. X
  776. #define FL_DEFINE(rn, tn, t) \
  777. X    typedef struct rn {    \
  778. X    int max;    \
  779. X    int n;        \
  780. X    t *data;    \
  781. X    } *tn
  782. X
  783. FL_DEFINE(flex_list_rec, flex_list, fl_pointer);
  784. X
  785. typedef void (*fl_free_fn_type)(void *);
  786. X
  787. flex_list fl_new_flex_list(char *);
  788. void fl_delete_flex_list(flex_list *, fl_free_fn_type);
  789. void fl_add_to_tail(char *, flex_list, fl_pointer);
  790. void fl_delete_range(char *, flex_list, int, int, fl_free_fn_type);
  791. void fl_insert(char *, flex_list, int, fl_pointer);
  792. X
  793. #endif /* __FLEXLIST_H__ */
  794. SHAR_EOF
  795. chmod 0444 bcs-2.0/include/flexlist.h ||
  796. echo 'restore of bcs-2.0/include/flexlist.h failed'
  797. Wc_c="`wc -c < 'bcs-2.0/include/flexlist.h'`"
  798. test 1588 -eq "$Wc_c" ||
  799.     echo 'bcs-2.0/include/flexlist.h: original size 1588, current size' "$Wc_c"
  800. rm -f _shar_wnt_.tmp
  801. fi
  802. # ============= bcs-2.0/include/patchlevel.h ==============
  803. if test -f 'bcs-2.0/include/patchlevel.h' -a X"$1" != X"-c"; then
  804.     echo 'x - skipping bcs-2.0/include/patchlevel.h (File already exists)'
  805.     rm -f _shar_wnt_.tmp
  806. else
  807. > _shar_wnt_.tmp
  808. echo 'x - extracting bcs-2.0/include/patchlevel.h (Text)'
  809. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/include/patchlevel.h' &&
  810. /* 
  811. X * $Id: patchlevel.h,v 1.20 1994/03/07 21:41:51 qjb Exp $
  812. X * $Source: /local/tmp/bcs-2.0/include/RCS/patchlevel.h,v $
  813. X * $Author: qjb $
  814. X *
  815. X */
  816. X
  817. #ifndef __BCS_PATCHLEVEL_H__
  818. #define __BCS_PATCHLEVEL_H__
  819. X
  820. #if !defined(lint) && !defined(CODECENTER) || defined(RCS_HDRS)
  821. char *rcsid_bcs_patchlevel_h = "@(#)$Id: patchlevel.h,v 1.20 1994/03/07 21:41:51 qjb Exp $";
  822. #endif /* !lint && !CODECENTER || RCS_HDRS */
  823. X
  824. #define PATCHLEVEL 0
  825. X
  826. /* define this to 1 for a real release or 0 when between releases */
  827. #define RELEASE 1
  828. X
  829. #endif /* __BCS_PATCHLEVEL_H__ */
  830. SHAR_EOF
  831. chmod 0444 bcs-2.0/include/patchlevel.h ||
  832. echo 'restore of bcs-2.0/include/patchlevel.h failed'
  833. Wc_c="`wc -c < 'bcs-2.0/include/patchlevel.h'`"
  834. test 555 -eq "$Wc_c" ||
  835.     echo 'bcs-2.0/include/patchlevel.h: original size 555, current size' "$Wc_c"
  836. rm -f _shar_wnt_.tmp
  837. fi
  838. # ============= bcs-2.0/include/version.h ==============
  839. if test -f 'bcs-2.0/include/version.h' -a X"$1" != X"-c"; then
  840.     echo 'x - skipping bcs-2.0/include/version.h (File already exists)'
  841.     rm -f _shar_wnt_.tmp
  842. else
  843. > _shar_wnt_.tmp
  844. echo 'x - extracting bcs-2.0/include/version.h (Text)'
  845. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/include/version.h' &&
  846. /* 
  847. X * $Id: version.h,v 1.4 1994/03/07 21:42:19 qjb Exp $
  848. X * $Source: /local/tmp/bcs-2.0/include/RCS/version.h,v $
  849. X * $Author: qjb $
  850. X *
  851. X */
  852. X
  853. #ifndef __BCS_VERSION_H__
  854. #define __BCS_VERSION_H__
  855. X
  856. #if !defined(lint) && !defined(CODECENTER) || defined(RCS_HDRS)
  857. char *rcsid_bcs_version_h = "@(#)$Id: version.h,v 1.4 1994/03/07 21:42:19 qjb Exp $";
  858. #endif /* !lint && !CODECENTER || RCS_HDRS */
  859. X
  860. #include "patchlevel.h"
  861. X
  862. #define MAJOR_VERSION 2
  863. #define MINOR_VERSION 0
  864. #define EXTRA_VERSION ""
  865. X
  866. #endif /* __BCS_VERSION_H__ */
  867. SHAR_EOF
  868. chmod 0444 bcs-2.0/include/version.h ||
  869. echo 'restore of bcs-2.0/include/version.h failed'
  870. Wc_c="`wc -c < 'bcs-2.0/include/version.h'`"
  871. test 521 -eq "$Wc_c" ||
  872.     echo 'bcs-2.0/include/version.h: original size 521, current size' "$Wc_c"
  873. rm -f _shar_wnt_.tmp
  874. fi
  875. # ============= bcs-2.0/lib/Makefile ==============
  876. if test ! -d 'bcs-2.0/lib'; then
  877.     echo 'x - creating directory bcs-2.0/lib'
  878.     mkdir 'bcs-2.0/lib'
  879. fi
  880. if test -f 'bcs-2.0/lib/Makefile' -a X"$1" != X"-c"; then
  881.     echo 'x - skipping bcs-2.0/lib/Makefile (File already exists)'
  882.     rm -f _shar_wnt_.tmp
  883. else
  884. > _shar_wnt_.tmp
  885. echo 'x - extracting bcs-2.0/lib/Makefile (Text)'
  886. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/lib/Makefile' &&
  887. #
  888. # $Id: Makefile,v 1.16 1994/02/12 01:08:22 qjb Exp $
  889. # $Source: /local/tmp/bcs-2.0/lib/RCS/Makefile,v $
  890. # $Author: qjb $
  891. #
  892. X
  893. SHELL = /bin/sh
  894. X
  895. LIBSRCS = \
  896. X    cm.c \
  897. X    file_info.c \
  898. X    flexlist.c \
  899. X    init.c \
  900. X    path.c \
  901. X    rcs_cm.c \
  902. X    sccs_cm.c \
  903. X    staging.c \
  904. X    util.c
  905. X
  906. SRCS = $(LIBSRCS) 
  907. X
  908. # For some people, this type of pattern matching line is the only thing that
  909. # prevents the native make from working.  Instead, repeat the list of
  910. # sources.
  911. # OBJS = $(SRCS:%.c=%.o)
  912. OBJS =     cm.o \
  913. X    file_info.o \
  914. X    flexlist.o \
  915. X    init.o \
  916. X    path.o \
  917. X    rcs_cm.o \
  918. X    sccs_cm.o \
  919. X    staging.o \
  920. X    util.o
  921. X
  922. LIB = libbcs.a
  923. LIBS = -lbcs
  924. X
  925. all: $(LIB) 
  926. X
  927. rcs_cm.o rcs_cm.d: rcs_paths.h
  928. X
  929. sccs_cm.o sccs_cm.d: sccs_paths.h
  930. X
  931. rcs_paths.h: make_rcs_h
  932. X    $(RM) rcs_paths.h
  933. X    sh make_rcs_h
  934. X
  935. sccs_paths.h: make_sccs_h
  936. X    $(RM) sccs_paths.h
  937. X    sh make_sccs_h
  938. X
  939. builddate.h:
  940. X    $(RM) builddate.h
  941. X    echo \#define BUILDDATE \"`date`\" > builddate.h
  942. X
  943. libbcs.a: $(OBJS)
  944. X    $(RM) $@
  945. X    $(AR) $(AR_ARGS) $@ $(OBJS) 
  946. X    $(RANLIB) $@
  947. X
  948. clean::
  949. X    $(RM) $(LIB) rcs_paths.h sccs_paths.h builddate.h
  950. X
  951. include ../make/rules.mk
  952. X
  953. LIB_HDRS = bcs_p.h 
  954. X
  955. LIB_DEPS = $(COMMON_HDRS) $(LIB_HDRS)
  956. X
  957. cm.o: cm.c $(LIB_DEPS)
  958. file_info.o: file_info.c $(LIB_DEPS) file_info.h 
  959. flexlist.o: flexlist.c $(LIB_DEPS)
  960. init.o: init.c $(LIB_DEPS) \
  961. X    ../include/version.h ../include/patchlevel.h builddate.h
  962. path.o: path.c $(LIB_DEPS) path.h 
  963. rcs_cm.o: rcs_cm.c $(LIB_DEPS) rcs_cm.h rcs_paths.h 
  964. sccs_cm.o: sccs_cm.c $(LIB_DEPS) sccs_cm.h sccs_paths.h 
  965. staging.o: staging.c $(LIB_DEPS)
  966. util.o: util.c $(LIB_DEPS)
  967. SHAR_EOF
  968. chmod 0444 bcs-2.0/lib/Makefile ||
  969. echo 'restore of bcs-2.0/lib/Makefile failed'
  970. Wc_c="`wc -c < 'bcs-2.0/lib/Makefile'`"
  971. test 1507 -eq "$Wc_c" ||
  972.     echo 'bcs-2.0/lib/Makefile: original size 1507, current size' "$Wc_c"
  973. rm -f _shar_wnt_.tmp
  974. fi
  975. # ============= bcs-2.0/lib/bcs_p.h ==============
  976. if test -f 'bcs-2.0/lib/bcs_p.h' -a X"$1" != X"-c"; then
  977.     echo 'x - skipping bcs-2.0/lib/bcs_p.h (File already exists)'
  978.     rm -f _shar_wnt_.tmp
  979. else
  980. > _shar_wnt_.tmp
  981. echo 'x - extracting bcs-2.0/lib/bcs_p.h (Text)'
  982. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/lib/bcs_p.h' &&
  983. /* 
  984. X * $Id: bcs_p.h,v 1.8 1994/03/07 21:47:41 qjb Exp $
  985. X * $Source: /local/tmp/bcs-2.0/lib/RCS/bcs_p.h,v $
  986. X * $Author: qjb $
  987. X *
  988. X * Copyright (C) 1994  E. Jay Berkenbilt
  989. X * 
  990. X * This file is part of BCS.  BCS may be distributed according to the terms
  991. X * of the General Public License and/or the Artistic License.  See the
  992. X * `COPYING' and `Artistic' files with the source distribution for details.
  993. X * This notice must be kept intact when this file is distributed.
  994. X *
  995. X * This is the private header file for BCS.  It contains information
  996. X * shared by all source files in the library.  Public routines (those
  997. X * intended to be called outside the library) are defined in bcs.h.
  998. X */
  999. X
  1000. #ifndef __BCS_P_H__
  1001. #define __BCS_P_H__
  1002. X
  1003. #if !defined(lint) && !defined(CODECENTER) || defined(RCS_HDRS)
  1004. /* Define a static function and call it.  No warnings this way. */
  1005. static void rcsid_bcs_p_h(char *s)
  1006. {rcsid_bcs_p_h("@(#)$Id: bcs_p.h,v 1.8 1994/03/07 21:47:41 qjb Exp $");}
  1007. #endif /* !lint && !CODECENTER || RCS_HDRS */
  1008. X
  1009. #include "bcs.h"
  1010. X
  1011. /* Environment Variables */
  1012. #define STAGING_ENV    "STAGING"
  1013. #define BASELINE_ENV    "BASELINE"
  1014. X
  1015. /*
  1016. X * Files used internally by BCS.
  1017. X *
  1018. X **********************************************************************
  1019. X *
  1020. X * NOTE: If a file is added here, make sure its importance is handled
  1021. X * as a special case in file_info.c if that is desired.
  1022. X *
  1023. X **********************************************************************
  1024. X *
  1025. X * These files should have names <= 14 characters for the benefit of
  1026. X * those file systems or versions of UNIX that don't have long
  1027. X * filenames... 
  1028. X */
  1029. #define BL_PATH        ".baseline_path"
  1030. #define BL_CONF        ".baseline_conf"
  1031. #define IMPFILE        ".important"
  1032. #define UNIMPFILE    ".unimportant"
  1033. #define AUTOSTAGE    ".auto_stage"
  1034. #define NOSTAGE        ".no_stage"
  1035. #define NOWARN        ".unimp_nowarn"
  1036. X
  1037. /*
  1038. X * File information structures
  1039. X */
  1040. X  
  1041. typedef enum {
  1042. X    stage_param_type_uninitialized,
  1043. X    fi_normal,            /* no special constraints */
  1044. X    fi_auto_stage,        /* file is automatically staged with parent */
  1045. X    fi_no_stage,        /* file can never be staged */
  1046. X    fi_no_mirror        /* file cannot appear in the staging area */
  1047. } stage_param_type;
  1048. X
  1049. typedef enum {
  1050. X    link_type_uninitialized,
  1051. X    fi_not_link,
  1052. X    fi_dangling,        /* link to nowhere */
  1053. X    fi_to_baseline,        /* link from staging to baseline counterpart */
  1054. X    fi_internal,        /* link dest within same "which" as link */
  1055. X    fi_external            /* link dest has different "which" as link */
  1056. } bcs_link_type;
  1057. X
  1058. /* Path caching information */
  1059. /* Opaque type */
  1060. typedef struct path_cache_rec *path_cache;
  1061. X
  1062. /* Function prototypes */
  1063. X
  1064. /* file_info.c */
  1065. void bcsi_delete_file_info(bcs_file_info);
  1066. char *bcsi_calc_bl_path(bcs_obj_type, int, char *);
  1067. void bcsi_remove_file_info(bcs_obj_type, char *);
  1068. char *fi_clean_path(bcs_obj_type, bcs_file_info);
  1069. char *fi_rel_path(bcs_obj_type, bcs_file_info);
  1070. char *fi_cont_path(bcs_obj_type, bcs_file_info);
  1071. char *fi_can_path(bcs_obj_type, bcs_file_info);
  1072. int fi_index(bcs_obj_type, bcs_file_info);
  1073. bcs_which fi_which(bcs_obj_type, bcs_file_info);
  1074. bcs_link_type fi_link_type(bcs_obj_type, bcs_file_info);
  1075. char *fi_linkpath(bcs_obj_type, bcs_file_info);
  1076. char *fi_ult_linkpath(bcs_obj_type, bcs_file_info);
  1077. bcs_file_info fi_ult_link_info(bcs_obj_type, bcs_file_info);
  1078. int fi_unimp_warn(bcs_obj_type, bcs_file_info);
  1079. stage_param_type fi_stage_params(bcs_obj_type, bcs_file_info);
  1080. bcs_stringlist *fi_lists(bcs_obj_type, bcs_file_info);
  1081. int fi_has_baseline_counterpart(bcs_obj_type, bcs_file_info);
  1082. char *fi_bl_path(bcs_obj_type, bcs_file_info);
  1083. bcs_file_info fi_bl_info(bcs_obj_type, bcs_file_info);
  1084. int fi_writable(bcs_obj_type, bcs_file_info);
  1085. X
  1086. /* path.c */
  1087. int bcsi_exists(bcs_obj_type, char *);
  1088. int bcsi_readable(bcs_obj_type, char *);
  1089. int bcsi_paths_eq(bcs_obj_type, char *, char *);
  1090. path_cache bcsi_path_info_from_parent(bcs_obj_type, char *, path_cache);
  1091. path_cache bcsi_get_path_info(bcs_obj_type, char *);
  1092. int bcsi_lstat(bcs_obj_type, char *, struct stat *);
  1093. char *pc_can_path(bcs_obj_type, path_cache);
  1094. bcs_file_info pc_file_info(bcs_obj_type, path_cache);
  1095. struct stat *pc_statbuf(bcs_obj_type, path_cache);
  1096. void pc_get_bl_index(bcs_obj_type, path_cache, int *, bcs_which *);
  1097. char *pc_linkpath(bcs_obj_type, path_cache);
  1098. char *pc_lastcomp(bcs_obj_type, path_cache);
  1099. int pc_isdir(bcs_obj_type, path_cache);
  1100. int pc_islink(bcs_obj_type, path_cache);
  1101. path_cache pc_parent(bcs_obj_type, path_cache);
  1102. void pc_insert_file_info(bcs_obj_type, path_cache, bcs_file_info);
  1103. void pc_remove_file_info(bcs_obj_type, path_cache);
  1104. void pc_remove_path_info(bcs_obj_type, path_cache);
  1105. path_cache pc_ult_link_info(bcs_obj_type, path_cache);
  1106. X
  1107. /* staging.c */
  1108. int bcsi_sync_file(bcs_obj_type, bcs_file_info, int);
  1109. int bcsi_stageable(bcs_obj_type, char *, bcs_stringlist *);
  1110. X
  1111. /* util.c */
  1112. void *bcsi_safe_malloc(char *, int);
  1113. char *bcsi_safe_strdup(char *, char *);
  1114. int bcsi_safe_strcat(char *, char *, int);
  1115. void bcsi_concat_paths(char *, char *, char *);
  1116. void bcsi_append_last_component(char *, char *);
  1117. void bcsi_resolve_readlink(char *, char *, char *);
  1118. int bcsi_in_stringlist(char *, bcs_stringlist);
  1119. bcs_stringlist bcsi_file_to_stringlist(bcs_obj_type, char *);
  1120. int bcsi_yn(char *);
  1121. int bcsi_read_directory_entries(bcs_obj_type, char *, bcs_stringlist *);
  1122. void bcsi_split_string(bcs_obj_type, bcs_stringlist, char *);
  1123. int bcsi_create_empty_file(bcs_obj_type, char *, int);
  1124. int bcsi_remove_file(bcs_obj_type bcs_obj, char *path);
  1125. int bcsi_make_link(bcs_obj_type, char *, char *);
  1126. int bcsi_make_directory(bcs_obj_type, char *);
  1127. int bcsi_copy_file(bcs_obj_type, char *, char *);
  1128. X
  1129. #endif /* __BCS_P_H__ */
  1130. SHAR_EOF
  1131. chmod 0444 bcs-2.0/lib/bcs_p.h ||
  1132. echo 'restore of bcs-2.0/lib/bcs_p.h failed'
  1133. Wc_c="`wc -c < 'bcs-2.0/lib/bcs_p.h'`"
  1134. test 5574 -eq "$Wc_c" ||
  1135.     echo 'bcs-2.0/lib/bcs_p.h: original size 5574, current size' "$Wc_c"
  1136. rm -f _shar_wnt_.tmp
  1137. fi
  1138. # ============= bcs-2.0/lib/cm.c ==============
  1139. if test -f 'bcs-2.0/lib/cm.c' -a X"$1" != X"-c"; then
  1140.     echo 'x - skipping bcs-2.0/lib/cm.c (File already exists)'
  1141.     rm -f _shar_wnt_.tmp
  1142. else
  1143. > _shar_wnt_.tmp
  1144. echo 'x - extracting bcs-2.0/lib/cm.c (Text)'
  1145. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/lib/cm.c' &&
  1146. /* 
  1147. X * $Id: cm.c,v 1.20 1994/03/07 21:47:41 qjb Exp $
  1148. X * $Source: /local/tmp/bcs-2.0/lib/RCS/cm.c,v $
  1149. X * $Author: qjb $
  1150. X *
  1151. X * Copyright (C) 1994  E. Jay Berkenbilt
  1152. X * 
  1153. X * This file is part of BCS.  BCS may be distributed according to the terms
  1154. X * of the General Public License and/or the Artistic License.  See the
  1155. X * `COPYING' and `Artistic' files with the source distribution for details.
  1156. X * This notice must be kept intact when this file is distributed.
  1157. X *
  1158. X * This file implements the basic functionality of supporting
  1159. X * different configuration management systems.
  1160. X */
  1161. X
  1162. #if !defined(lint) && !defined(CODECENTER) || defined(RCS_HDRS)
  1163. /* Define a static function and call it.  No warnings this way. */
  1164. static void rcsid(char *s)
  1165. {rcsid("@(#)$Id: cm.c,v 1.20 1994/03/07 21:47:41 qjb Exp $");}
  1166. #endif /* !lint && !CODECENTER || RCS_HDRS */
  1167. X
  1168. #include "bcs_p.h"
  1169. X
  1170. FL_DEFINE(cm_info_list_rec, cm_info_list, bcs_cm_info *);
  1171. X
  1172. static cm_info_list registered_cm;
  1173. static int cm_inited = FALSE;
  1174. X
  1175. X
  1176. /*
  1177. X * PRIVATE FUNCTIONS
  1178. X */
  1179. void cm_init(bcs_obj_type bcs_obj)
  1180. {
  1181. X    registered_cm = (cm_info_list) fl_new_flex_list(bcs_obj->whoami);
  1182. X    bcs_obj->cm = NULL;
  1183. X    cm_inited = TRUE;
  1184. }
  1185. X
  1186. X
  1187. /*
  1188. X * PUBLIC FUNCTIONS
  1189. X */
  1190. X
  1191. /*
  1192. X * Register a given CM package.
  1193. X */
  1194. void cm_register(bcs_obj_type bcs_obj, bcs_cm_info *cm_info)
  1195. {
  1196. X    int i;
  1197. X
  1198. X    if (! cm_inited)
  1199. X    cm_init(bcs_obj);
  1200. X
  1201. X    /*
  1202. X     * Make sure that we don't already have a CM package by this name
  1203. X     * registered
  1204. X     */
  1205. X    for (i = 0; i < registered_cm->n; i++)
  1206. X    {
  1207. X    if (strcmp(registered_cm->data[i]->name, cm_info->name) == 0)
  1208. X    {
  1209. X        bcs_message(bcs_obj, stderr,
  1210. X            "can't register two CM packages named %s; exiting",
  1211. X            cm_info->name);
  1212. X        exit(BCS_ERR_USAGE);
  1213. X    }
  1214. X    }
  1215. X
  1216. X    /* Add this CM package to the list of known packages */
  1217. X    DPRINT((bcs_obj, BCS_DEBUG_VERBOSE, "registering CM package %s",
  1218. X        cm_info->name));
  1219. X    fl_add_to_tail(bcs_obj->whoami, (flex_list) registered_cm, cm_info);
  1220. }
  1221. X
  1222. void cm_print_cm_packages(bcs_obj_type bcs_obj)
  1223. {
  1224. X    int i;
  1225. X
  1226. X    if (! cm_inited)
  1227. X    cm_init(bcs_obj);
  1228. X
  1229. X    if (registered_cm->n > 0)
  1230. X    {
  1231. X    printf("Supported configuration management packages: ");
  1232. X    for (i = 0; i < registered_cm->n; i++)
  1233. X    {
  1234. X        printf("%s%s", registered_cm->data[i]->name,
  1235. X           (i == (registered_cm->n - 1)) ? "\n" : ", ");
  1236. X    }
  1237. X    }
  1238. X    else
  1239. X    {
  1240. X    printf("No supported configuration management packages.\n");
  1241. X    }
  1242. }
  1243. X
  1244. /*
  1245. X * Set the current CM package
  1246. X */
  1247. void cm_use(bcs_obj_type bcs_obj, char *name)
  1248. {
  1249. X    int i;
  1250. X    int found = FALSE;
  1251. X
  1252. X    if (! cm_inited)
  1253. X    cm_init(bcs_obj);
  1254. X
  1255. X    /*
  1256. X     * Look up the named package and install.
  1257. X     */
  1258. X    for (i = 0; (i < registered_cm->n) && (! found); i++)
  1259. X    {
  1260. X    if (strcmp(registered_cm->data[i]->name, name) == 0)
  1261. X    {
  1262. X        found = TRUE;
  1263. X        bcs_obj->cm = registered_cm->data[i];
  1264. X    }
  1265. X    }
  1266. X
  1267. X    if (! found)
  1268. X    {
  1269. X    bcs_message(bcs_obj, stderr,
  1270. X            "no CM package named %s is registered; exiting", name);
  1271. X    exit(BCS_ERR_USAGE);
  1272. X    }
  1273. }
  1274. X
  1275. /*
  1276. X * CM ENTRY POINTS.  These can't be called before initialization
  1277. X */
  1278. X
  1279. cm_command *cm_lookup_command(bcs_obj_type bcs_obj, char *cmd_str)
  1280. {
  1281. X    cm_command *cmd;
  1282. X
  1283. X    for (cmd = bcs_obj->cm->cmds; cmd->name; cmd++)
  1284. X    {
  1285. X    if (strcmp(cmd->name, cmd_str) == 0)
  1286. X        return cmd;
  1287. X    }
  1288. X
  1289. X    return NULL;
  1290. }
  1291. X
  1292. int cm_is_precious(bcs_obj_type bcs_obj, char *filename)
  1293. {
  1294. X    cm_precious *precious;
  1295. X    char *lastcomp;
  1296. X
  1297. X    if ((lastcomp = strrchr(filename, PATH_SEP_CHAR)) == NULL)
  1298. X    lastcomp = filename;
  1299. X    else
  1300. X    lastcomp++;
  1301. X
  1302. X    for (precious = bcs_obj->cm->precious_files;
  1303. X     precious->path; precious++)
  1304. X    {
  1305. X    if (strcmp(lastcomp, precious->path) == 0)
  1306. X        return TRUE;
  1307. X    }
  1308. X
  1309. X    return FALSE;
  1310. }
  1311. X
  1312. int cm_haslog(bcs_obj_type bcs_obj, char *filename)
  1313. {
  1314. X    return (*(bcs_obj->cm->haslog))(bcs_obj, filename);
  1315. }
  1316. X
  1317. int cm_locked(bcs_obj_type bcs_obj, char *filename)
  1318. {
  1319. X    return (*(bcs_obj->cm->locked))(bcs_obj, filename);
  1320. }
  1321. X
  1322. int cm_uptodate(bcs_obj_type bcs_obj, char *filename)
  1323. {
  1324. X    return (*(bcs_obj->cm->uptodate))(bcs_obj, filename);
  1325. }
  1326. X
  1327. int cm_update_bl(bcs_obj_type bcs_obj, bcs_file_info file_info)
  1328. {
  1329. X    return (*(bcs_obj->cm->update_bl))(bcs_obj, file_info);
  1330. }
  1331. X
  1332. int cm_register_file(bcs_obj_type bcs_obj, char *filename)
  1333. {
  1334. X    char workpath[MAXPATHLEN];
  1335. X    char bl_path[MAXPATHLEN];
  1336. X    bcs_file_info file_info;
  1337. X    char *p1 = NULL, *p2 = NULL;
  1338. X    int status = BCS_SUCCESS;
  1339. X
  1340. X    if (filename[0] == PATH_SEP_CHAR)
  1341. X    strcpy(workpath, filename);
  1342. X    else
  1343. X    bcsi_concat_paths(workpath, ".", filename);
  1344. X
  1345. X    /* Make sure this path would be under a staging area. */
  1346. X    p2 = NULL;
  1347. X    do
  1348. X    {
  1349. X    file_info = bcs_get_file_info(bcs_obj, workpath);
  1350. X    if (file_info == NULL)
  1351. X    {
  1352. X        p1 = strrchr(workpath, PATH_SEP_CHAR);
  1353. X        if (p1)
  1354. X        {
  1355. X        *p1 = '\0';
  1356. X        if (p2)
  1357. X            *p2 = PATH_SEP_CHAR;
  1358. X        p2 = p1;
  1359. X        }
  1360. X    }
  1361. X    else
  1362. X    {
  1363. X        if (p2)
  1364. X        {
  1365. X        *p2 = PATH_SEP_CHAR;
  1366. X        p2++;
  1367. X        }
  1368. X    }
  1369. X    } while ((! file_info) && p1);
  1370. X
  1371. X    if (! (file_info && (fi_which(bcs_obj, file_info) == in_staging)))
  1372. X    {
  1373. X    bcs_message(bcs_obj, stderr,
  1374. X            "can't register %s since it would not be in "
  1375. X            "the staging area.", filename);
  1376. X    return BCS_ERR_USER;
  1377. X    }
  1378. X
  1379. X    /*
  1380. X     * Figure out what the baseline path to the corresponding file
  1381. X     * would be.  p2 points to the part of workpath that is after
  1382. X     * the file we found to exist.
  1383. X     */
  1384. X    strcpy(bl_path, bcs_obj->baseline->data
  1385. X       [fi_index(bcs_obj, file_info)]->path.user_path);
  1386. X    if (strlen(fi_rel_path(bcs_obj, file_info)))
  1387. X    {
  1388. X    strcat(bl_path, PATH_SEP_STR);
  1389. X    strcat(bl_path, fi_rel_path(bcs_obj, file_info));
  1390. X    }
  1391. X    if (p2 && strlen(p2))
  1392. X    {
  1393. X    strcat(bl_path, PATH_SEP_STR);
  1394. X    strcat(bl_path, p2);
  1395. X    }
  1396. X
  1397. X    if (bcsi_exists(bcs_obj, bl_path))
  1398. X    {
  1399. X    bcs_message(bcs_obj, stderr,
  1400. X            "can't register %s since %s already exists.",
  1401. X            filename, bl_path);
  1402. X    return BCS_ERR_USER;
  1403. X    }
  1404. X
  1405. X    if (cm_haslog(bcs_obj, bl_path))
  1406. X    {
  1407. X    bcs_message(bcs_obj, stderr,
  1408. X            "can't register %s since %s already has a log.",
  1409. X            filename, bl_path);
  1410. X    return BCS_ERR_USER;
  1411. X    }
  1412. X
  1413. X    /*
  1414. X     * Make the directory that will contain bl_path and the directory
  1415. X     * that will contain the staging area file.  It's okay if they
  1416. X     * already exist.
  1417. X     */
  1418. X
  1419. X    /*
  1420. X     * both workpath bl_path necessarily contain PATH_SEP_CHAR because
  1421. X     * bl_path was based upon a baseline directory and workpath
  1422. X     * was handled specially above.
  1423. X     */
  1424. X    if ((p1 = strrchr(bl_path, PATH_SEP_CHAR)) == NULL)
  1425. X    {
  1426. X    bcs_message(bcs_obj, stderr,
  1427. X            "INTERNAL ERROR in register_file: bl_path (%s) "
  1428. X            "has no %c", bl_path, PATH_SEP_CHAR);
  1429. X    abort();
  1430. X    }
  1431. X    *p1 = '\0';
  1432. X    status = bcsi_make_directory(bcs_obj, bl_path);
  1433. X    *p1 = PATH_SEP_CHAR;
  1434. X    if (status)
  1435. X    return status;
  1436. X
  1437. X    if ((p1 = strrchr(workpath, PATH_SEP_CHAR)) == NULL)
  1438. X    {
  1439. X    bcs_message(bcs_obj, stderr,
  1440. X            "INTERNAL ERROR in register_file: workpath (%s) "
  1441. X            "has no %c", workpath, PATH_SEP_CHAR);
  1442. X    abort();
  1443. X    }
  1444. X    *p1 = '\0';
  1445. X    status = bcsi_make_directory(bcs_obj, workpath);
  1446. X    *p1 = PATH_SEP_CHAR;
  1447. X    if (status)
  1448. X    return status;
  1449. X
  1450. X    if (bcsi_exists(bcs_obj, filename))
  1451. X    {
  1452. X    /* Copy the file into the baseline before registering */
  1453. X    bcsi_copy_file(bcs_obj, filename, bl_path);
  1454. X    }
  1455. X
  1456. X    status = (*bcs_obj->cm->register_file)(bcs_obj, bl_path, filename);
  1457. X    if (status)
  1458. X    return status;
  1459. X
  1460. X    /*
  1461. X     * If the does not exist, create it; otherwise, remove its file_info
  1462. X     * which would now be out of date (since the importance of the file
  1463. X     * has changed as well as whether it is staged, etc.).
  1464. X     */
  1465. X    if (bcsi_exists(bcs_obj, filename))
  1466. X    {
  1467. X    bcsi_remove_file_info(bcs_obj, filename);
  1468. X    }
  1469. X    else
  1470. X    {
  1471. X    if ((status = bcsi_create_empty_file(bcs_obj, filename, 0644)))
  1472. X        return status;
  1473. X    }
  1474. X
  1475. X    return status;
  1476. }
  1477. X
  1478. int cm_eligible(bcs_obj_type bcs_obj, cm_command_type cmd_type,
  1479. X        bcs_stringlist files)
  1480. {
  1481. X    int i;
  1482. X    int result = TRUE;
  1483. X    bcs_file_info file_info;
  1484. X    char *filename;
  1485. X    bcs_stringlist staged_files; /* to keep track of what we staged */
  1486. X
  1487. X    staged_files = (bcs_stringlist) fl_new_flex_list(bcs_obj->whoami);
  1488. X
  1489. X    for (i = 0; i < files->n; i++)
  1490. X    {
  1491. X    /*
  1492. X     * A file is eligible to be checked in or out if it is in the staging
  1493. X     * area, is staged, and has a CM log.
  1494. X     */
  1495. X
  1496. X    filename = files->data[i];
  1497. X    file_info = bcs_get_file_info(bcs_obj, filename);
  1498. X    if (file_info == NULL)
  1499. X    {
  1500. X        bcs_message(bcs_obj, stderr,
  1501. X            "can't check %s in or out since it cannot be found.",
  1502. X            filename);
  1503. X        result = FALSE;
  1504. X    }
  1505. X
  1506. X    if (result)
  1507. X    {
  1508. X        if (! fi_important(bcs_obj, file_info))
  1509. X        {
  1510. X        bcs_message(bcs_obj, stderr,
  1511. X                "can't check %s in or out since it is "
  1512. X                "not important.", filename);
  1513. X        result = FALSE;
  1514. X        }
  1515. X    }
  1516. X
  1517. X    if (result)
  1518. X    {
  1519. X        if ((! fi_is_staged(bcs_obj, file_info)) &&
  1520. X        (cmd_type == cm_checkout))
  1521. X        {
  1522. X        /* Try staging this file */
  1523. X        if (bcs_stage(bcs_obj, filename, FALSE) == BCS_SUCCESS)
  1524. X        {
  1525. X            fl_add_to_tail(bcs_obj->whoami, (flex_list) staged_files,
  1526. X                   filename);
  1527. X            /* Reobtain the file info since it just changed */
  1528. X            file_info = bcs_get_file_info(bcs_obj, filename);
  1529. X        }
  1530. X        else
  1531. X        {
  1532. X            bcs_message(bcs_obj, stderr,
  1533. X                "can't check %s out since it can't be staged.",
  1534. X                filename);
  1535. X            result = FALSE;
  1536. X        }
  1537. X        }
  1538. X    }
  1539. X
  1540. X    /*
  1541. X     * Must check this AFTER trying to stage since it could fail
  1542. X     * if the file is indirectly stageable.
  1543. X     */
  1544. X    if (result)
  1545. X    {
  1546. X        if (fi_which(bcs_obj, file_info) != in_staging)
  1547. X        {
  1548. X        bcs_message(bcs_obj, stderr,
  1549. X                "can't check %s in or out since it is "
  1550. X                "not in the staging area.",
  1551. X                filename);
  1552. X        result = FALSE;
  1553. X        }
  1554. X    }
  1555. X
  1556. X    if (result)
  1557. X    {
  1558. X        if (! fi_is_staged(bcs_obj, file_info))
  1559. X        {
  1560. X        bcs_message(bcs_obj, stderr,
  1561. X                "can't check %s in or out since it is not staged.",
  1562. X                filename);
  1563. X        result = FALSE;
  1564. X        }
  1565. X    }
  1566. X
  1567. X    if (result)
  1568. X    {
  1569. X        if (! cm_haslog(bcs_obj, filename))
  1570. X        {
  1571. X        bcs_message(bcs_obj, stderr,
  1572. X                "can't check %s in or out since it does "
  1573. X                "not have a CM log.",
  1574. X                filename);
  1575. X        result = FALSE;
  1576. X        }
  1577. X    }
  1578. X    }
  1579. X
  1580. X    if (result == FALSE)
  1581. X    {
  1582. X    int i;
  1583. X
  1584. X    /* Unstage files we staged */
  1585. X    for (i = 0; i < staged_files->n; i++)
  1586. X    {
  1587. X        bcs_unstage(bcs_obj, staged_files->data[i], us_negative);
  1588. X    }
  1589. X    }
  1590. X
  1591. X    fl_delete_flex_list((flex_list *)&staged_files, NULL);
  1592. X
  1593. X    return result;
  1594. }
  1595. X
  1596. /*
  1597. X * This function expects as argv a complete cm command.  It then
  1598. X * runs the command (using an absolute path as obtained from the
  1599. X * cm_command structure) and returns a standard BCS error code.
  1600. X */
  1601. int cm_run_command(bcs_obj_type bcs_obj_type, cm_command *cmd, char *argv[])
  1602. {
  1603. X    char command[2 * MAXPATHLEN];
  1604. X    char **arg;
  1605. X
  1606. X    /*
  1607. X     * Use system() here to avoid hassles of writing wait() code
  1608. X     * portably.  This should probably be fixed sometime but isn't
  1609. X     * so important since we are using an absolute path...
  1610. X     * In addition, realize that fullcmd here may be more than
  1611. X     * one word.
  1612. X     */
  1613. X
  1614. X    strcpy(command, cmd->fullcmd);
  1615. X
  1616. X    for (arg = &argv[1]; *arg; arg++)
  1617. X    {
  1618. X    strcat(command, " ");
  1619. X    strcat(command, *arg);
  1620. X    }
  1621. X
  1622. X    return (system(command) == 0) ? BCS_SUCCESS : BCS_ERR_USER;
  1623. }
  1624. SHAR_EOF
  1625. chmod 0444 bcs-2.0/lib/cm.c ||
  1626. echo 'restore of bcs-2.0/lib/cm.c failed'
  1627. Wc_c="`wc -c < 'bcs-2.0/lib/cm.c'`"
  1628. test 11029 -eq "$Wc_c" ||
  1629.     echo 'bcs-2.0/lib/cm.c: original size 11029, current size' "$Wc_c"
  1630. rm -f _shar_wnt_.tmp
  1631. fi
  1632. # ============= bcs-2.0/lib/file_info.c ==============
  1633. if test -f 'bcs-2.0/lib/file_info.c' -a X"$1" != X"-c"; then
  1634.     echo 'x - skipping bcs-2.0/lib/file_info.c (File already exists)'
  1635.     rm -f _shar_wnt_.tmp
  1636. else
  1637. > _shar_wnt_.tmp
  1638. echo 'x - extracting bcs-2.0/lib/file_info.c (Text)'
  1639. sed 's/^X//' << 'SHAR_EOF' > 'bcs-2.0/lib/file_info.c' &&
  1640. /* 
  1641. X * $Id: file_info.c,v 1.45 1994/03/14 16:53:44 ejb Exp $
  1642. X * $Source: /local/tmp/bcs-2.0/lib/RCS/file_info.c,v $
  1643. X * $Author: ejb $
  1644. X *
  1645. X * Copyright (C) 1994  E. Jay Berkenbilt
  1646. X * 
  1647. X * This file is part of BCS.  BCS may be distributed according to the terms
  1648. X * of the General Public License and/or the Artistic License.  See the
  1649. X * `COPYING' and `Artistic' files with the source distribution for details.
  1650. SHAR_EOF
  1651. true || echo 'restore of bcs-2.0/lib/file_info.c failed'
  1652. fi
  1653. echo 'End of bcs-2.0 part 1'
  1654. echo 'File bcs-2.0/lib/file_info.c is continued in part 2'
  1655. echo 2 > _shar_seq_.tmp
  1656. exit 0
  1657.