Subject: v22i018: Brian Berliner's concurrent RCS system, Part04/07 Newsgroups: comp.sources.unix Approved: rsalz@uunet.UU.NET X-Checksum-Snefru: b9094a89 916eaf42 948504b7 fab0efa5 Submitted-by: Brian Berliner Posting-number: Volume 22, Issue 18 Archive-name: cvs-berliner/part04 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'COPYING' <<'END_OF_FILE' X X GNU GENERAL PUBLIC LICENSE X Version 1, February 1989 X X Copyright (C) 1989 Free Software Foundation, Inc. X 675 Mass Ave, Cambridge, MA 02139, USA X Everyone is permitted to copy and distribute verbatim copies X of this license document, but changing it is not allowed. X X Preamble X X The license agreements of most software companies try to keep users Xat the mercy of those companies. By contrast, our General Public XLicense is intended to guarantee your freedom to share and change free Xsoftware--to make sure the software is free for all its users. The XGeneral Public License applies to the Free Software Foundation's Xsoftware and to any other program whose authors commit to using it. XYou can use it for your programs, too. X X When we speak of free software, we are referring to freedom, not Xprice. Specifically, the General Public License is designed to make Xsure that you have the freedom to give away or sell copies of free Xsoftware, that you receive source code or can get it if you want it, Xthat you can change the software or use pieces of it in new free Xprograms; and that you know you can do these things. X X To protect your rights, we need to make restrictions that forbid Xanyone to deny you these rights or to ask you to surrender the rights. XThese restrictions translate to certain responsibilities for you if you Xdistribute copies of the software, or if you modify it. X X For example, if you distribute copies of a such a program, whether Xgratis or for a fee, you must give the recipients all the rights that Xyou have. You must make sure that they, too, receive or can get the Xsource code. And you must tell them their rights. X X We protect your rights with two steps: (1) copyright the software, and X(2) offer you this license which gives you legal permission to copy, Xdistribute and/or modify the software. X X Also, for each author's protection and ours, we want to make certain Xthat everyone understands that there is no warranty for this free Xsoftware. If the software is modified by someone else and passed on, we Xwant its recipients to know that what they have is not the original, so Xthat any problems introduced by others will not reflect on the original Xauthors' reputations. X X The precise terms and conditions for copying, distribution and Xmodification follow. X X GNU GENERAL PUBLIC LICENSE X TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION X X 0. This License Agreement applies to any program or other work which Xcontains a notice placed by the copyright holder saying it may be Xdistributed under the terms of this General Public License. The X"Program", below, refers to any such program or work, and a "work based Xon the Program" means either the Program or any work containing the XProgram or a portion of it, either verbatim or with modifications. Each Xlicensee is addressed as "you". X X 1. You may copy and distribute verbatim copies of the Program's source Xcode as you receive it, in any medium, provided that you conspicuously and Xappropriately publish on each copy an appropriate copyright notice and Xdisclaimer of warranty; keep intact all the notices that refer to this XGeneral Public License and to the absence of any warranty; and give any Xother recipients of the Program a copy of this General Public License Xalong with the Program. You may charge a fee for the physical act of Xtransferring a copy. X X 2. You may modify your copy or copies of the Program or any portion of Xit, and copy and distribute such modifications under the terms of Paragraph X1 above, provided that you also do the following: X X a) cause the modified files to carry prominent notices stating that X you changed the files and the date of any change; and X X b) cause the whole of any work that you distribute or publish, that X in whole or in part contains the Program or any part thereof, either X with or without modifications, to be licensed at no charge to all X third parties under the terms of this General Public License (except X that you may choose to grant warranty protection to some or all X third parties, at your option). X X c) If the modified program normally reads commands interactively when X run, you must cause it, when started running for such interactive use X in the simplest and most usual way, to print or display an X announcement including an appropriate copyright notice and a notice X that there is no warranty (or else, saying that you provide a X warranty) and that users may redistribute the program under these X conditions, and telling the user how to view a copy of this General X Public License. X X d) You may charge a fee for the physical act of transferring a X copy, and you may at your option offer warranty protection in X exchange for a fee. X XMere aggregation of another independent work with the Program (or its Xderivative) on a volume of a storage or distribution medium does not bring Xthe other work under the scope of these terms. X X 3. You may copy and distribute the Program (or a portion or derivative of Xit, under Paragraph 2) in object code or executable form under the terms of XParagraphs 1 and 2 above provided that you also do one of the following: X X a) accompany it with the complete corresponding machine-readable X source code, which must be distributed under the terms of X Paragraphs 1 and 2 above; or, X X b) accompany it with a written offer, valid for at least three X years, to give any third party free (except for a nominal charge X for the cost of distribution) a complete machine-readable copy of the X corresponding source code, to be distributed under the terms of X Paragraphs 1 and 2 above; or, X X c) accompany it with the information you received as to where the X corresponding source code may be obtained. (This alternative is X allowed only for noncommercial distribution and only if you X received the program in object code or executable form alone.) X XSource code for a work means the preferred form of the work for making Xmodifications to it. For an executable file, complete source code means Xall the source code for all modules it contains; but, as a special Xexception, it need not include source code for modules which are standard Xlibraries that accompany the operating system on which the executable Xfile runs, or for standard header files or definitions files that Xaccompany that operating system. X X 4. You may not copy, modify, sublicense, distribute or transfer the XProgram except as expressly provided under this General Public License. XAny attempt otherwise to copy, modify, sublicense, distribute or transfer Xthe Program is void, and will automatically terminate your rights to use Xthe Program under this License. However, parties who have received Xcopies, or rights to use copies, from you under this General Public XLicense will not have their licenses terminated so long as such parties Xremain in full compliance. X X 5. By copying, distributing or modifying the Program (or any work based Xon the Program) you indicate your acceptance of this license to do so, Xand all its terms and conditions. X X 6. Each time you redistribute the Program (or any work based on the XProgram), the recipient automatically receives a license from the original Xlicensor to copy, distribute or modify the Program subject to these Xterms and conditions. You may not impose any further restrictions on the Xrecipients' exercise of the rights granted herein. X X 7. The Free Software Foundation may publish revised and/or new versions Xof the General Public License from time to time. Such new versions will Xbe similar in spirit to the present version, but may differ in detail to Xaddress new problems or concerns. X XEach version is given a distinguishing version number. If the Program Xspecifies a version number of the license which applies to it and "any Xlater version", you have the option of following the terms and conditions Xeither of that version or of any later version published by the Free XSoftware Foundation. If the Program does not specify a version number of Xthe license, you may choose any version ever published by the Free Software XFoundation. X X 8. If you wish to incorporate parts of the Program into other free Xprograms whose distribution conditions are different, write to the author Xto ask for permission. For software which is copyrighted by the Free XSoftware Foundation, write to the Free Software Foundation; we sometimes Xmake exceptions for this. Our decision will be guided by the two goals Xof preserving the free status of all derivatives of our free software and Xof promoting the sharing and reuse of software generally. X X NO WARRANTY X X 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN XOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES XPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED XOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF XMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS XTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, XREPAIR OR CORRECTION. X X 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING XWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR XREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, XINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING XOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED XTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY XYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER XPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE XPOSSIBILITY OF SUCH DAMAGES. X X END OF TERMS AND CONDITIONS X X Appendix: How to Apply These Terms to Your New Programs X X If you develop a new program, and you want it to be of the greatest Xpossible use to humanity, the best way to achieve this is to make it Xfree software which everyone can redistribute and change under these Xterms. X X To do so, attach the following notices to the program. It is safest to Xattach them to the start of each source file to most effectively convey Xthe exclusion of warranty; and each file should have at least the X"copyright" line and a pointer to where the full notice is found. X X X Copyright (C) 19yy X X This program is free software; you can redistribute it and/or modify X it under the terms of the GNU General Public License as published by X the Free Software Foundation; either version 1, or (at your option) X any later version. X X This program is distributed in the hope that it will be useful, X but WITHOUT ANY WARRANTY; without even the implied warranty of X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X GNU General Public License for more details. X X You should have received a copy of the GNU General Public License X along with this program; if not, write to the Free Software X Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X XAlso add information on how to contact you by electronic and paper mail. X XIf the program is interactive, make it output a short notice like this Xwhen it starts in an interactive mode: X X Gnomovision version 69, Copyright (C) 19xx name of author X Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. X This is free software, and you are welcome to redistribute it X under certain conditions; type `show c' for details. X XThe hypothetical commands `show w' and `show c' should show the Xappropriate parts of the General Public License. Of course, the Xcommands you use may be called something other than `show w' and `show Xc'; they could even be mouse-clicks or menu items--whatever suits your Xprogram. X XYou should also get your employer (if you work as a programmer) or your Xschool, if any, to sign a "copyright disclaimer" for the program, if Xnecessary. Here a sample; alter the names: X X Yoyodyne, Inc., hereby disclaims all copyright interest in the X program `Gnomovision' (a program to direct compilers to make passes X at assemblers) written by James Hacker. X X , 1 April 1989 X Ty Coon, President of Vice X XThat's all there is to it! END_OF_FILE if test 12488 -ne `wc -c <'COPYING'`; then echo shar: \"'COPYING'\" unpacked with wrong size! fi # end of 'COPYING' fi if test -f 'src/Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/Makefile'\" else echo shar: Extracting \"'src/Makefile'\" \(11285 characters\) sed "s/^X//" >'src/Makefile' <<'END_OF_FILE' X# X# $Id: Makefile,v 1.20 89/11/20 00:06:32 berliner Exp $ X# X# Makefile for CVS X# XCOMMONSRCS= subr.c XCOMMONOBJS= ${COMMONSRCS:.c=.o} X XCVS= cvs XCVSSRCS= add.c build_entry.c checkin.c checkout.c collect_sets.c\ X commit.c create_admin.c diff.c entries_file.c\ X find_names.c join.c locate_rcs.c log.c main.c\ X maketime.c modules.c name_repository.c no_difference.c\ X options.c partime.c patch.c register.c remove.c\ X scratch_entry.c set_lock.c status.c tag.c update.c\ X version_number.c version_ts.c XCVSOBJS= ${CVSSRCS:.c=.o} ${COMMONOBJS} X XMOD= mkmodules XMODSRCS= mkmodules.c XMODOBJS= ${MODSRCS:.c=.o} ${COMMONOBJS} X XCSHEXT= .csh XCSHELLS= checkin${CSHEXT} X XHEADERS= cvs.h patchlevel.h rcstime.h XDESTDIR= /usr/local/bin X XALLSRCS= ${COMMONSRCS} ${CVSSRCS} ${MODSRCS} XFILES= Makefile ${HEADERS} ${ALLSRCS} ${CSHELLS} X XPROGS= ${CVS} ${MOD} XCFLAGS= -O # -g XLDFLAGS= # -Bstatic X XETAGS= /usr/local/bin/etags XCTAGS= ctags X Xall: ${PROGS} X X${CVS}: ${CVSOBJS} X ${CC} -o ${CVS} ${CFLAGS} ${CVSOBJS} ${LDFLAGS} X X${MOD}: ${MODOBJS} X ${CC} -o ${MOD} ${CFLAGS} ${MODOBJS} ${LDFLAGS} X Xinstall: ${PROGS} X install -m 755 ${PROGS} ${DESTDIR} X for i in ${CSHELLS}; do\ X install -m 755 $$i ${DESTDIR}/`basename $$i ${CSHEXT}`;\ X done X Xclean: X rm -f ${PROGS} *.o core Makefile.bak X Xlint: X lint ${CVSSRCS} ${COMMONSRCS} X lint -u ${MODSRCS} ${COMMONSRCS} X XTAGS: ${ALLSRCS} X ${ETAGS} ${ALLSRCS} X Xtags: ${ALLSRCS} X ${CTAGS} ${ALLSRCS} X Xlist: X @for i in ${FILES}; do\ X echo $$i;\ X done X Xdepend: X /bin/rm -f makedep X for i in ${ALLSRCS}; do \ X ${CC} -M ${INCPATH} $$i | \ X awk ' { if ($$1 != prev) \ X { if (rec != "") print rec; rec = $$0; prev = $$1; } \ X else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \ X else rec = rec " " $$2 } } \ X END { print rec } ' >> makedep; done X echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep X echo '$$r makedep' >>eddep X echo 'w' >>eddep X cp Makefile Makefile.bak X ed - Makefile < eddep X /bin/rm eddep makedep X echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile X echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile X echo '# see make depend above' >> Makefile X X# DO NOT DELETE THIS LINE X Xsubr.o: subr.c /usr/include/sys/types.h /usr/include/sys/sysmacros.h Xsubr.o: /usr/include/sys/stat.h /usr/include/sys/file.h Xsubr.o: /usr/include/sys/fcntlcom.h /usr/include/varargs.h ./cvs.h Xsubr.o: /usr/include/strings.h /usr/include/string.h /usr/include/stdio.h Xadd.o: add.c /usr/include/sys/param.h /usr/include/machine/param.h Xadd.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xadd.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h ./cvs.h Xadd.o: /usr/include/strings.h /usr/include/string.h /usr/include/stdio.h Xbuild_entry.o: build_entry.c /usr/include/sys/param.h Xbuild_entry.o: /usr/include/machine/param.h /usr/include/sys/signal.h Xbuild_entry.o: /usr/include/vm/faultcode.h /usr/include/sys/types.h Xbuild_entry.o: /usr/include/sys/sysmacros.h ./cvs.h /usr/include/strings.h Xbuild_entry.o: /usr/include/string.h /usr/include/stdio.h Xcheckin.o: checkin.c /usr/include/sys/param.h /usr/include/machine/param.h Xcheckin.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xcheckin.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h Xcheckin.o: /usr/include/ctype.h ./cvs.h /usr/include/strings.h Xcheckin.o: /usr/include/string.h /usr/include/stdio.h Xcheckout.o: checkout.c /usr/include/sys/param.h /usr/include/machine/param.h Xcheckout.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xcheckout.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h Xcheckout.o: /usr/include/ndbm.h ./cvs.h /usr/include/strings.h Xcheckout.o: /usr/include/string.h /usr/include/stdio.h Xcollect_sets.o: collect_sets.c /usr/include/sys/param.h Xcollect_sets.o: /usr/include/machine/param.h /usr/include/sys/signal.h Xcollect_sets.o: /usr/include/vm/faultcode.h /usr/include/sys/types.h Xcollect_sets.o: /usr/include/sys/sysmacros.h ./cvs.h /usr/include/strings.h Xcollect_sets.o: /usr/include/string.h /usr/include/stdio.h Xcommit.o: commit.c /usr/include/sys/param.h /usr/include/machine/param.h Xcommit.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xcommit.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h Xcommit.o: /usr/include/sys/types.h /usr/include/sys/stat.h /usr/include/ctype.h Xcommit.o: ./cvs.h /usr/include/strings.h /usr/include/string.h Xcommit.o: /usr/include/stdio.h Xcreate_admin.o: create_admin.c /usr/include/sys/param.h Xcreate_admin.o: /usr/include/machine/param.h /usr/include/sys/signal.h Xcreate_admin.o: /usr/include/vm/faultcode.h /usr/include/sys/types.h Xcreate_admin.o: /usr/include/sys/sysmacros.h ./cvs.h /usr/include/strings.h Xcreate_admin.o: /usr/include/string.h /usr/include/stdio.h Xdiff.o: diff.c /usr/include/sys/param.h /usr/include/machine/param.h Xdiff.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xdiff.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h ./cvs.h Xdiff.o: /usr/include/strings.h /usr/include/string.h /usr/include/stdio.h Xentries_file.o: entries_file.c ./cvs.h /usr/include/strings.h Xentries_file.o: /usr/include/string.h /usr/include/stdio.h Xfind_names.o: find_names.c /usr/include/sys/param.h Xfind_names.o: /usr/include/machine/param.h /usr/include/sys/signal.h Xfind_names.o: /usr/include/vm/faultcode.h /usr/include/sys/types.h Xfind_names.o: /usr/include/sys/sysmacros.h /usr/include/sys/types.h Xfind_names.o: /usr/include/dirent.h /usr/include/sys/dirent.h ./cvs.h Xfind_names.o: /usr/include/strings.h /usr/include/string.h /usr/include/stdio.h Xjoin.o: join.c ./cvs.h /usr/include/strings.h /usr/include/string.h Xjoin.o: /usr/include/stdio.h Xlocate_rcs.o: locate_rcs.c /usr/include/sys/param.h Xlocate_rcs.o: /usr/include/machine/param.h /usr/include/sys/signal.h Xlocate_rcs.o: /usr/include/vm/faultcode.h /usr/include/sys/types.h Xlocate_rcs.o: /usr/include/sys/sysmacros.h ./cvs.h /usr/include/strings.h Xlocate_rcs.o: /usr/include/string.h /usr/include/stdio.h Xlog.o: log.c ./cvs.h /usr/include/strings.h /usr/include/string.h Xlog.o: /usr/include/stdio.h Xmain.o: main.c /usr/include/sys/param.h /usr/include/machine/param.h Xmain.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xmain.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h ./cvs.h Xmain.o: /usr/include/strings.h /usr/include/string.h /usr/include/stdio.h Xmain.o: ./patchlevel.h Xmaketime.o: maketime.c ./cvs.h /usr/include/strings.h /usr/include/string.h Xmaketime.o: /usr/include/stdio.h ./rcstime.h /usr/include/sys/types.h Xmaketime.o: /usr/include/sys/sysmacros.h /usr/include/sys/timeb.h Xmodules.o: modules.c /usr/include/sys/param.h /usr/include/machine/param.h Xmodules.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xmodules.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h Xmodules.o: /usr/include/sys/file.h /usr/include/sys/fcntlcom.h Xmodules.o: /usr/include/ndbm.h ./cvs.h /usr/include/strings.h Xmodules.o: /usr/include/string.h /usr/include/stdio.h Xname_repository.o: name_repository.c /usr/include/sys/param.h Xname_repository.o: /usr/include/machine/param.h /usr/include/sys/signal.h Xname_repository.o: /usr/include/vm/faultcode.h /usr/include/sys/types.h Xname_repository.o: /usr/include/sys/sysmacros.h ./cvs.h /usr/include/strings.h Xname_repository.o: /usr/include/string.h /usr/include/stdio.h Xno_difference.o: no_difference.c /usr/include/sys/param.h Xno_difference.o: /usr/include/machine/param.h /usr/include/sys/signal.h Xno_difference.o: /usr/include/vm/faultcode.h /usr/include/sys/types.h Xno_difference.o: /usr/include/sys/sysmacros.h ./cvs.h /usr/include/strings.h Xno_difference.o: /usr/include/string.h /usr/include/stdio.h Xoptions.o: options.c ./cvs.h /usr/include/strings.h /usr/include/string.h Xoptions.o: /usr/include/stdio.h Xpartime.o: partime.c /usr/include/stdio.h /usr/include/ctype.h ./rcstime.h Xpatch.o: patch.c /usr/include/sys/param.h /usr/include/machine/param.h Xpatch.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xpatch.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h Xpatch.o: /usr/include/time.h /usr/include/ndbm.h /usr/include/dirent.h Xpatch.o: /usr/include/sys/dirent.h /usr/include/ctype.h ./cvs.h Xpatch.o: /usr/include/strings.h /usr/include/string.h /usr/include/stdio.h Xregister.o: register.c ./cvs.h /usr/include/strings.h /usr/include/string.h Xregister.o: /usr/include/stdio.h Xremove.o: remove.c /usr/include/sys/param.h /usr/include/machine/param.h Xremove.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xremove.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h ./cvs.h Xremove.o: /usr/include/strings.h /usr/include/string.h /usr/include/stdio.h Xscratch_entry.o: scratch_entry.c /usr/include/sys/param.h Xscratch_entry.o: /usr/include/machine/param.h /usr/include/sys/signal.h Xscratch_entry.o: /usr/include/vm/faultcode.h /usr/include/sys/types.h Xscratch_entry.o: /usr/include/sys/sysmacros.h ./cvs.h /usr/include/strings.h Xscratch_entry.o: /usr/include/string.h /usr/include/stdio.h Xset_lock.o: set_lock.c /usr/include/sys/param.h /usr/include/machine/param.h Xset_lock.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xset_lock.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h Xset_lock.o: /usr/include/sys/types.h /usr/include/sys/stat.h Xset_lock.o: /usr/include/signal.h /usr/include/dirent.h Xset_lock.o: /usr/include/sys/dirent.h ./cvs.h /usr/include/strings.h Xset_lock.o: /usr/include/string.h /usr/include/stdio.h Xstatus.o: status.c ./cvs.h /usr/include/strings.h /usr/include/string.h Xstatus.o: /usr/include/stdio.h Xtag.o: tag.c /usr/include/sys/param.h /usr/include/machine/param.h Xtag.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xtag.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h Xtag.o: /usr/include/ndbm.h /usr/include/dirent.h /usr/include/sys/dirent.h Xtag.o: /usr/include/ctype.h ./cvs.h /usr/include/strings.h Xtag.o: /usr/include/string.h /usr/include/stdio.h Xupdate.o: update.c /usr/include/sys/param.h /usr/include/machine/param.h Xupdate.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xupdate.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h Xupdate.o: /usr/include/sys/types.h /usr/include/sys/stat.h Xupdate.o: /usr/include/dirent.h /usr/include/sys/dirent.h ./cvs.h Xupdate.o: /usr/include/strings.h /usr/include/string.h /usr/include/stdio.h Xversion_number.o: version_number.c /usr/include/ctype.h ./cvs.h Xversion_number.o: /usr/include/strings.h /usr/include/string.h Xversion_number.o: /usr/include/stdio.h Xversion_ts.o: version_ts.c /usr/include/sys/types.h Xversion_ts.o: /usr/include/sys/sysmacros.h /usr/include/sys/timeb.h Xversion_ts.o: /usr/include/sys/stat.h /usr/include/ctype.h /usr/include/grp.h Xversion_ts.o: /usr/include/pwd.h /usr/include/utmp.h ./cvs.h Xversion_ts.o: /usr/include/strings.h /usr/include/string.h /usr/include/stdio.h Xmkmodules.o: mkmodules.c /usr/include/sys/param.h /usr/include/machine/param.h Xmkmodules.o: /usr/include/sys/signal.h /usr/include/vm/faultcode.h Xmkmodules.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h Xmkmodules.o: /usr/include/fcntl.h /usr/include/sys/fcntlcom.h Xmkmodules.o: /usr/include/signal.h /usr/include/ndbm.h /usr/include/ctype.h Xmkmodules.o: ./cvs.h /usr/include/strings.h /usr/include/string.h Xmkmodules.o: /usr/include/stdio.h X# DEPENDENCIES MUST END AT END OF FILE X# IF YOU PUT STUFF HERE IT WILL GO AWAY X# see make depend above END_OF_FILE if test 11285 -ne `wc -c <'src/Makefile'`; then echo shar: \"'src/Makefile'\" unpacked with wrong size! fi # end of 'src/Makefile' fi if test -f 'src/patch.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/patch.c'\" else echo shar: Extracting \"'src/patch.c'\" \(10708 characters\) sed "s/^X//" >'src/patch.c' <<'END_OF_FILE' X#ifndef lint Xstatic char rcsid[] = "$Id: patch.c,v 1.5 89/11/19 23:40:41 berliner Exp $"; X#endif !lint X X/* X * Copyright (c) 1989, Brian Berliner X * X * You may distribute under the terms of the GNU General Public License X * as specified in the README file that comes with the CVS 1.0 kit. X * X * Patch X * X * Create a Larry Wall format "patch" file between a previous release X * and the current head of a module, or between two releases. Can X * specify the release as either a date or a revision number. X */ X X#include X#include X#include X#include X#include X#include "cvs.h" X Xextern time_t timelocal(); X Xextern char update_dir[]; Xextern DBM *open_module(); Xextern int force_tag_match; X Xstatic int patch_recursive = 1; Xstatic int patch_short = 0; Xstatic int toptwo_diffs = 0; Xstatic char rev1[50], rev2[50], date1[50], date2[50]; Xstatic char tmpfile1[50], tmpfile2[50], tmpfile3[50]; X Xvoid patch_cleanup(); X Xpatch(argc, argv) X int argc; X char *argv[]; X{ X register int i; X int c, err = 0; X DBM *db; X X if (argc == -1) X patch_usage(); X rev1[0] = rev2[0] = date1[0] = date2[0] = '\0'; X optind = 1; X while ((c = getopt(argc, argv, "ftsQqlD:r:")) != -1) { X switch (c) { X case 'Q': X really_quiet = 1; X /* FALL THROUGH */ X case 'q': X quiet = 1; X break; X case 'f': X force_tag_match = 1; X break; X case 'l': X patch_recursive = 0; X break; X case 't': X toptwo_diffs = 1; X break; X case 's': X patch_short = 1; X break; X case 'D': X if (rev2[0] != '\0' || date2[0] != '\0') X error(0, "no more than two revisions/dates can be specified"); X if (rev1[0] != '\0' || date1[0] != '\0') X Make_Date(optarg, date2); X else X Make_Date(optarg, date1); X break; X case 'r': X if (rev2[0] != '\0' || date2[0] != '\0') X error(0, "no more than two revisions/dates can be specified"); X if (rev1[0] != '\0' || date1[0] != '\0') X (void) strcpy(rev2, optarg); X else X (void) strcpy(rev1, optarg); X break; X case '?': X default: X patch_usage(); X break; X } X } X argc -= optind; X argv += optind; X if (argc < 1) X patch_usage(); X if (toptwo_diffs && patch_short) X error(0, "-t and -s options are mutually exclusive"); X if (toptwo_diffs && (date1[0] != '\0' || date2[0] != '\0' || X rev1[0] != '\0' || rev2[0] != '\0')) { X error(0, "must not specify revisions/dates with -t option!"); X } X if (!toptwo_diffs && X (date1[0] == '\0' && date2[0] == '\0' && X rev1[0] == '\0' && rev2[0] == '\0')) { X error(0, "must specify at least one revision/date!"); X } X if (date1[0] != '\0' && date2[0] != '\0') { X if (strcmp(date1, date2) >= 0) X error(0, "second date must come after first date!"); X } X (void) signal(SIGHUP, patch_cleanup); X (void) signal(SIGINT, patch_cleanup); X (void) signal(SIGQUIT, patch_cleanup); X (void) signal(SIGTERM, patch_cleanup); X db = open_module(); X for (i = 0; i < argc; i++) X err += do_module(db, argv[i], PATCH, "Examining"); X close_module(db); X patch_cleanup(0); X exit(err); X} X X/* X * This is the recursive function that looks to see if an RCS file X * has been modified since the revision specified in rev1 or date1, X * using the revision specified in rev2 or date2 or the head if X * neither are specified. X * X * If the "rcs" argument is NULL, descend the current X * directory, examining all the files as appropriate; otherwise, just X * examine the argument rcs file X */ Xpatched(rcs) X char *rcs; X{ X DIR *dirp; X struct dirent *dp; X char line[10]; X char *cp; X int err = 0; X X if (rcs == NULL) { X if ((dirp = opendir(".")) == NULL) { X err++; X } else { X (void) sprintf(line, ".*%s$", RCSEXT); X if ((cp = re_comp(line)) != NULL) { X warn(0, "%s", cp); X err++; X } else while ((dp = readdir(dirp)) != NULL) { X if (strcmp(dp->d_name, ".") == 0 || X strcmp(dp->d_name, "..") == 0 || X strcmp(dp->d_name, CVSATTIC) == 0 || X strcmp(dp->d_name, CVSLCK) == 0) X continue; X if (isdir(dp->d_name) && patch_recursive) { X char cwd[MAXPATHLEN]; X X if (getwd(cwd) == NULL) { X warn(0, "cannot get working directory: %s", cwd); X err++; X continue; X } X if (update_dir[0] == '\0') { X (void) strcpy(update_dir, dp->d_name); X } else { X (void) strcat(update_dir, "/"); X (void) strcat(update_dir, dp->d_name); X } X if (!quiet) { X printf("%s %s: Examining %s\n", X progname, command, update_dir); X } X if (chdir(dp->d_name) < 0) { X warn(1, "chdir failed; %s ignored", update_dir); X err++; X continue; X } X err += patched((char *)0); X if ((cp = rindex(update_dir, '/')) != NULL) X *cp = '\0'; X else X update_dir[0] = '\0'; X if (chdir(cwd) < 0) X error(1, "cannot chdir back to %s", cwd); X continue; X } X if (re_exec(dp->d_name)) X err += patch_file(dp->d_name); X } X } X if (dirp) X (void) closedir(dirp); X } else { X return (patch_file(rcs)); X } X return (err); X} X X/* X * Called to examine a particular RCS file, as appropriate with the options X * that were set above. X */ Xstatic Xpatch_file(rcs) X char *rcs; X{ X char vers_tag[50], vers_head[50]; X int fd1, fd2, fd3, ret = 0; X X Version_Number(rcs, rev2, date2, vers_head); X if (vers_head[0] == '\0') { X if (!really_quiet) X warn(0, "cannot find head revision for %s", rcs); X return (1); X } X if (toptwo_diffs && get_rcsdate(rcs, vers_head, date1) != 0) { X if (!really_quiet) X warn(0, "cannot find date in rcs file %s revision %s", X rcs, vers_head); X return (1); X } X Version_Number(rcs, rev1, date1, vers_tag); X if (strcmp(vers_head, vers_tag) == 0) X return (0); /* not changed between releases */ X if (patch_short) { X printf("File "); X if (update_dir[0] != '\0') X printf("%s/", update_dir); X if (vers_tag[0] == '\0') X printf("%s is new; current revision %s\n", rcs, vers_head); X else X printf("%s changed from revision %s to %s\n", X rcs, vers_tag, vers_head); X return (0); X } X (void) strcpy(tmpfile1, "/tmp/cvspatch.XXXXXX"); X (void) strcpy(tmpfile2, "/tmp/cvspatch.XXXXXX"); X (void) strcpy(tmpfile3, "/tmp/cvspatch.XXXXXX"); X fd1 = mkstemp(tmpfile1); (void) close(fd1); X fd2 = mkstemp(tmpfile2); (void) close(fd2); X fd3 = mkstemp(tmpfile3); (void) close(fd3); X if (fd1 < 0 || fd2 < 0 || fd3 < 0) { X warn(0, "cannot create temporary files"); X ret = 1; X goto out; X } X if (vers_tag[0] != '\0') { X (void) sprintf(prog, "%s/%s -p -q -r%s %s > %s", Rcsbin, RCS_CO, X vers_tag, rcs, tmpfile1); X if (system(prog) != 0) { X if (!really_quiet) X warn(0, "co of revision %s for %s failed", VN_Rcs, rcs); X ret = 1; X goto out; X } X } else if (toptwo_diffs) { X ret = 1; X goto out; X } X (void) sprintf(prog, "%s/%s -p -q -r%s %s > %s", Rcsbin, RCS_CO, X vers_head, rcs, tmpfile2); X if (system(prog) != 0) { X if (!really_quiet) X warn(0, "co of revision %s for %s failed", VN_Rcs, rcs); X return (1); X } X (void) sprintf(prog, "%s -c %s %s > %s", DIFF, tmpfile1, X tmpfile2, tmpfile3); X if (system(prog) != 0) { X char file1[MAXPATHLEN], file2[MAXPATHLEN], strippath[MAXPATHLEN]; X char line1[MAXLINELEN], line2[MAXLINELEN]; X char *cp1, *cp2; X FILE *fp; X X /* X * The two revisions are really different, so read the first X * two lines of the diff output file, and munge them to include X * more reasonable file names that "patch" will understand. X */ X fp = open_file(tmpfile3, "r"); X if (fgets(line1, sizeof(line1), fp) == NULL || X fgets(line2, sizeof(line2), fp) == NULL) { X warn(1, "failed to read diff file header %s for %s", X tmpfile3, rcs); X ret = 1; X (void) fclose(fp); X goto out; X } X if (strncmp(line1,"*** ",4) != 0 || strncmp(line2,"--- ",4) != 0 || X (cp1 = index(line1, '\t')) == NULL || X (cp2 = index(line2, '\t')) == NULL) { X warn(0, "invalid diff header for %s", rcs); X ret = 1; X (void) fclose(fp); X goto out; X } X if (CVSroot != NULL) X (void) sprintf(strippath, "%s/", CVSroot); X else X (void) strcpy(strippath, REPOS_STRIP); X if (strncmp(rcs, strippath, strlen(strippath)) == 0) X rcs += strlen(strippath); X *rindex(rcs, ',') = '\0'; X if (vers_tag[0] != '\0') { X (void) sprintf(file1, "%s%s%s:%s", update_dir, X update_dir[0] ? "/" : "", rcs, vers_tag); X } else { X (void) strcpy(file1, DEVNULL); X } X (void) sprintf(file2, "%s%s%s:%s", update_dir, X update_dir[0] ? "/" : "", rcs, vers_head); X printf("diff -c %s %s\n", file1, file2); X printf("*** %s%s--- ", file1, cp1); X if (update_dir[0] != '\0') X printf("%s/", update_dir); X printf("%s%s", rcs, cp2); X while (fgets(line1, sizeof(line1), fp) != NULL) X printf("%s", line1); X (void) fclose(fp); X } Xout: X (void) unlink(tmpfile1); X (void) unlink(tmpfile2); X (void) unlink(tmpfile3); X return (ret); X} X Xvoid Xpatch_cleanup(sig) X int sig; X{ X if (tmpfile1[0] != '\0') X (void) unlink(tmpfile1); X if (tmpfile2[0] != '\0') X (void) unlink(tmpfile2); X if (tmpfile3[0] != '\0') X (void) unlink(tmpfile3); X if (sig != 0) X exit(1); X} X X/* X * Lookup the specified revision in the ,v file and return, in the date X * argument, the date specified for the revision *minus one second*, X * so that the logically previous revision will be foun by Version_Number() X * later. X * X * Returns zero on success, non-zero on failure. X */ Xstatic Xget_rcsdate(rcs, rev, date) X char *rcs; X char *rev; X char *date; X{ X char line[MAXLINELEN]; X struct tm tm, *ftm; X char *cp, *semi; X time_t revdate; X FILE *fp; X int ret = 1; X X if ((fp = fopen(rcs, "r")) == NULL) X return (1); X while (fgets(line, sizeof(line), fp) != NULL) { X if (!isdigit(line[0])) X continue; X if ((cp = rindex(line, '\n')) != NULL) X *cp = '\0'; X if (strcmp(line, rev) == 0) { X if (fgets(line, sizeof(line), fp) == NULL) X break; X for (cp = line; *cp && !isspace(*cp); cp++) X ; X while (*cp && isspace(*cp)) X cp++; X if (*cp && (semi = index(cp, ';')) != NULL) { X ret = 0; X *semi = '\0'; X ftm = &tm; X bzero((char *)ftm, sizeof(*ftm)); X (void) sscanf(cp, DATEFORM, &ftm->tm_year, &ftm->tm_mon, X &ftm->tm_mday, &ftm->tm_hour, &ftm->tm_min, X &ftm->tm_sec); X ftm->tm_mon--; X revdate = timelocal(ftm) - 1; X ftm = localtime(&revdate); X (void) sprintf(date, DATEFORM, ftm->tm_year, ftm->tm_mon+1, X ftm->tm_mday, ftm->tm_hour, ftm->tm_min, X ftm->tm_sec); X } X break; X } X } X (void) fclose(fp); X return (ret); X} X Xstatic Xpatch_usage() X{ X (void) fprintf(stderr, X "%s %s [-Qqlf] [-s|-t] [-r tag|-D date [-r tag|-D date]] modules...\n", X progname, command); X exit(1); X} END_OF_FILE if test 10708 -ne `wc -c <'src/patch.c'`; then echo shar: \"'src/patch.c'\" unpacked with wrong size! fi # end of 'src/patch.c' fi if test -f 'src/update.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/update.c'\" else echo shar: Extracting \"'src/update.c'\" \(13114 characters\) sed "s/^X//" >'src/update.c' <<'END_OF_FILE' X#ifndef lint Xstatic char rcsid[] = "$Id: update.c,v 1.27 89/11/19 23:40:48 berliner Exp $"; X#endif !lint X X/* X * Copyright (c) 1989, Brian Berliner X * X * You may distribute under the terms of the GNU General Public License X * as specified in the README file that comes with the CVS 1.0 kit. X * X * "update" updates the version in the present directory with respect to X * the RCS repository. The present version must have been created by X * "checkout". The user can keep up-to-date by calling "update" whenever X * he feels like it. X * X * The present version can be committed by "commit", but this keeps the X * version in tact. X * X * "update" accepts the following options: X * -p Prunes empty directories X * -l Local; does not do a recursive update X * -q Quiet; does not print a message when X * recursively updating X * -Q Really quiet X * -d Directory; causes update to create new directories X * as they are added to the RCS repository X * -f Forces a match for the -r revision X * -r tag Revision; only extract from revision "tag" X * -D date Updates to the revision specified by "date" X * X * Arguments following the options are taken to be file names X * to be updated, rather than updating the entire directory. X * X * Modified or non-existent RCS files are checked out and reported X * as U X * X * Modified user files are reported as M . If both the X * RCS file and the user file have been modified, the user file X * is replaced by the result of rcsmerge, and a backup file is X * written for the user in .#file.version. If this throws up X * irreconcilable differences, the file is reported as C , X * and as M otherwise. X * X * Files added but not yet committed are reported as A . X * Files removed but not yet decommitted are reported as R . X * X * If the current directory contains subdirectories that hold X * concurrent versions, these are updated too. If the -d option X * was specified, new directories added to the repository are X * automatically created and updated as well. X */ X X#include X#include X#include X#include X#include "cvs.h" X Xchar update_dir[MAXPATHLEN]; Xint update_recursive = 1; Xint update_build_dirs = 0; Xint update_prune_dirs = 0; X Xstatic int really_recursive = 1; X Xupdate(argc, argv) X int argc; X char *argv[]; X{ X FILE *fp; X int c, err = 0; X X if (argc == -1) X update_usage(); X optind = 1; X while ((c = getopt(argc, argv, "pflQqdr:D:")) != -1) { X switch (c) { X case 'l': X really_recursive = 0; X update_recursive = 0; X break; X case 'Q': X really_quiet = 1; X /* FALL THROUGH */ X case 'q': X quiet = 1; X break; X case 'd': X update_build_dirs = 1; X break; X case 'f': X force_tag_match = 1; X break; X case 'r': X (void) strcpy(Tag, optarg); X break; X case 'D': X Make_Date(optarg, Date); X break; X case 'p': X update_prune_dirs = 1; X break; X case '?': X default: X update_usage(); X break; X } X } X argc -= optind; X argv += optind; X if (!isdir(CVSADM)) { X if (!quiet) X warn(0, "warning: no %s directory found", CVSADM); X err += update_descend(update_recursive); X return (err); X } X Name_Repository(); X Reader_Lock(); X if (argc <= 0) { X /* X * When updating the entire directory, and recursively building X * directories, must make sure that the "static" file in the X * administration is removed before calling Find_Names(). X */ X if (update_build_dirs) X (void) unlink(CVSADM_ENTSTAT); X if (force_tag_match && (Tag[0] != '\0' || Date[0] != '\0')) X Find_Names(&fileargc, fileargv, ALLPLUSATTIC); X else X Find_Names(&fileargc, fileargv, ALL); X fp = open_file(CVSADM_MOD, "w+"); /* create a NULL Mod file */ X (void) fclose(fp); X argc = fileargc; X argv = fileargv; X } else { X /* X * Not recursive if files were specified on the command line X */ X update_recursive = 0; X } X if (Collect_Sets(argc, argv) != 0) X error(0, "failed; correct the above errors first"); X free_names(&fileargc, fileargv); X err += update_process_lists(); X /* X * XXX - Might be nice to sort the Mod file here, removing unique X * entries as we go, but it's currently not necessary, as "diff" X * is the only one that uses it, and he does the sort "as needed". X */ X Lock_Cleanup(0); X /* X * Make directories, and descend them if requested to. X */ X err += update_make_dirs(update_build_dirs && update_recursive); X err += update_descend(update_recursive); X Lock_Cleanup(0); X return (err); X} X X/* X * Process the lists created by Collect_Sets(). X */ Xstatic Xupdate_process_lists() X{ X char backup[MAXPATHLEN], dlist[MAXLISTLEN]; X FILE *fp; X char *cp; X int update_Files = 0, err = 0; X X /* X * Wlist is the "remove entry" list. X */ X for (cp = strtok(Wlist, " \t"); cp; cp = strtok((char *)NULL, " \t")) { X update_Files = 1; X (void) strcpy(User, cp); X Scratch_Entry(User); X } X /* X * Olist is the "needs checking out" list. X */ X for (cp = strtok(Olist, " \t"); cp; cp = strtok((char *)NULL, " \t")) { X update_Files = 1; X (void) strcpy(User, cp); X Locate_RCS(); X (void) sprintf(backup, "%s/%s%s", CVSADM, CVSPREFIX, User); X if (isreadable(User)) X rename_file(User, backup); X else X (void) unlink(backup); X if (Tag[0] != '\0' || Date[0] != '\0') { X Version_Number(Rcs, Tag, Date, VN_Rcs); X (void) sprintf(prog, "%s/%s -q -r%s %s %s", Rcsbin, RCS_CO, X VN_Rcs, Rcs, User); X } else { X (void) sprintf(prog, "%s/%s -q %s %s", Rcsbin, RCS_CO, Rcs, User); X } X if (system(prog) == 0) { X if (cvswrite == TRUE) X xchmod(User, 1); X Version_TS(Rcs, Tag, User); X Register(User, VN_Rcs, TS_User); X if (!really_quiet) { X if (update_dir[0]) X printf("U %s/%s\n", update_dir, User); X else X printf("U %s\n", User); X } X } else { X if (isreadable(backup)) X rename_file(backup, User); X warn(0, "could not check out %s", User); X err++; X } X (void) unlink(backup); X } X /* X * Mlist is the "modified, needs checking in" list. X */ X for (cp = strtok(Mlist, " \t"); cp; cp = strtok((char *)NULL, " \t")) { X update_Files = 1; X (void) strcpy(User, cp); X if (!really_quiet) { X if (update_dir[0]) X printf("M %s/%s\n", update_dir, User); X else X printf("M %s\n", User); X } X fp = open_file(CVSADM_MOD, "a"); X if (fprintf(fp, "%s\n", User) == EOF) X error(1, "cannot write %s", CVSADM_MOD); X (void) fclose(fp); X } X /* X * Alist is the "to be added" list. X */ X for (cp = strtok(Alist, " \t"); cp; cp = strtok((char *)NULL, " \t")) { X update_Files = 1; X (void) strcpy(User, cp); X if (!really_quiet) { X if (update_dir[0]) X printf("A %s/%s\n", update_dir, User); X else X printf("A %s\n", User); X } X } X /* X * Rlist is the "to be removed" list. X */ X for (cp = strtok(Rlist, " \t"); cp; cp = strtok((char *)NULL, " \t")) { X update_Files = 1; X (void) strcpy(User, cp); X if (!really_quiet) { X if (update_dir[0]) X printf("R %s/%s\n", update_dir, User); X else X printf("R %s\n", User); X } X } X /* X * Glist is the "modified, needs merging" list. X * X * The users currently modified file is moved to a backup file X * name ".#filename.version", so that it will stay around for about X * three days before being automatically removed by some cron X * daemon. The "version" is the version of the file that the X * user was most up-to-date with before the merge. X */ X for (cp = strtok(Glist, " \t"); cp; cp = strtok((char *)NULL, " \t")) { X update_Files = 1; X (void) strcpy(User, cp); X Locate_RCS(); X Version_TS(Rcs, Tag, User); X (void) sprintf(backup, "%s%s.%s", BAKPREFIX, User, VN_User); X (void) unlink(backup); X copy_file(User, backup); X xchmod(User, 1); X (void) sprintf(prog, "%s/%s -r%s %s", Rcsbin, RCS_MERGE, X VN_User, Rcs); X if (system(prog) != 0) { X warn(0, "could not merge revision %s of %s", X VN_User, User); X warn(0, "backup file for %s is in %s", User, backup); X err++; X continue; X } X Register(User, VN_Rcs, TS_Rcs); X (void) sprintf(prog, "%s -s '%s' %s", GREP, RCS_MERGE_PAT, User); X if (system(prog) == 0) { X warn(0, "conflicts found in %s", User); X if (!really_quiet) { X if (update_dir[0]) X printf("C %s/%s\n", update_dir, User); X else X printf("C %s\n", User); X } X } else { X if (!really_quiet) { X if (update_dir[0]) X printf("M %s/%s\n", update_dir, User); X else X printf("M %s\n", User); X } X } X fp = open_file(CVSADM_MOD, "a"); X if (fprintf(fp, "%s\n", User) == EOF) X error(1, "cannot write %s", CVSADM_MOD); X (void) fclose(fp); X } X if (Dlist[0]) { X int save_recursive = update_recursive; X X update_recursive = really_recursive; X Lock_Cleanup(0); /* cleanup locks before descending */ X (void) strcpy(dlist, Dlist); /* to get it on the stack... */ X for (cp = strtok(dlist, " \t"); cp; cp = strtok((char *)NULL, " \t")) { X err += update_descend_dir(cp); X } X update_recursive = save_recursive; X } X if (update_Files != 0) X Entries2Files(); X return (err); X} X X/* X * When automatically creating directories from the repository in the X * local work directory, we scan for directories that don't exist locally X * and create them with a NULL administration directory for now, which X * is filled by update later. X */ Xstatic Xupdate_make_dirs(doit) X int doit; X{ X char fname[MAXPATHLEN], tmp[MAXPATHLEN]; X DIR *dirp; X struct dirent *dp; X int err = 0; X X if (doit) { X if ((dirp = opendir(Repository)) == NULL) { X warn(0, "cannot open directory %s", Repository); X err++; X } else while ((dp = readdir(dirp)) != NULL) { X if (strcmp(dp->d_name, ".") == 0 || X strcmp(dp->d_name, "..") == 0 || X strcmp(dp->d_name, CVSATTIC) == 0 || X strcmp(dp->d_name, CVSLCK) == 0) X continue; X (void) sprintf(fname, "%s/%s", Repository, dp->d_name); X if (!isdir(fname)) X continue; X if (isdir(dp->d_name)) X continue; X if (isfile(dp->d_name)) { X warn(0, "file %s should be a directory; please move it", dp->d_name); X err++; X } else { X make_directory(dp->d_name); X if (chdir(dp->d_name) < 0) { X warn(0, "cannot chdir to %s", dp->d_name); X err++; X } else { X (void) strcpy(tmp, Repository); X (void) strcpy(Repository, fname); X Create_Admin(Repository, DFLT_RECORD); X (void) chdir(".."); X (void) strcpy(Repository, tmp); X } X } X } X if (dirp) X (void) closedir(dirp); X } X return (err); X} X X/* X * If doalldirs is set, does a recursive update by calling update_descend_dir() X * for each file in the current directory. X */ Xstatic Xupdate_descend(doalldirs) X int doalldirs; X{ X DIR *dirp; X struct dirent *dp; X int err = 0; X X if (doalldirs) { X if ((dirp = opendir(".")) == NULL) { X err++; X } else { X while ((dp = readdir(dirp)) != NULL) { X if (strcmp(dp->d_name, ".") == 0 || X strcmp(dp->d_name, "..") == 0) X continue; X err += update_descend_dir(dp->d_name); X } X (void) closedir(dirp); X } X } X return (err); X} X X/* X * This is the recursive function that walks the argument directory looking X * for sub-directories that have CVS administration files in them X * and updates them recursively. X * X * Note that we do not follow symbolic links here, which is a feature! X */ Xstatic Xupdate_descend_dir(dir) X char *dir; X{ X char cwd[MAXPATHLEN], fname[MAXPATHLEN]; X char *cp; X int err; X X (void) sprintf(fname, "%s/%s", dir, CVSADM); X if (!isdir(dir) || islink(dir) || !isdir(fname)) X return (0); X if (getwd(cwd) == NULL) { X warn(0, "cannot get working directory: %s", cwd); X return (1); X } X if (update_dir[0] == '\0') X (void) strcpy(update_dir, dir); X else { X (void) strcat(update_dir, "/"); X (void) strcat(update_dir, dir); X } X if (!quiet) X printf("%s %s: Updating %s\n", progname, command, update_dir); X if (chdir(dir) < 0) { X warn(1, "cannot chdir to %s", update_dir); X err = 1; X goto out; X } X err = update(0, (char **)0); X if ((cp = rindex(update_dir, '/')) != NULL) X *cp = '\0'; X else X update_dir[0] = '\0'; Xout: X if (chdir(cwd) < 0) X error(1, "cannot chdir to %s", cwd); X if (update_prune_dirs && isemptydir(dir)) { X (void) sprintf(prog, "%s -fr %s", RM, dir); X (void) system(prog); X } X return (err); X} X X/* X * Returns 1 if the argument directory is completely empty, other than X * the existence of the CVS.adm directory entry. Zero otherwise. X */ Xisemptydir(dir) X char *dir; X{ X DIR *dirp; X struct dirent *dp; X X if ((dirp = opendir(dir)) == NULL) { X warn(0, "cannot open directory %s for empty check", dir); X return (0); X } X while ((dp = readdir(dirp)) != NULL) { X if (strcmp(dp->d_name, ".") != 0 && strcmp(dp->d_name, "..") != 0 && X strcmp(dp->d_name, CVSADM) != 0) { X (void) closedir(dirp); X return (0); X } X } X (void) closedir(dirp); X return (1); X} X Xstatic Xupdate_usage() X{ X (void) fprintf(stderr, X "Usage: %s %s [-Qqlfp] [-d] [-r tag|-D date] [files...]\n", X progname, command); X exit(1); X} END_OF_FILE if test 13114 -ne `wc -c <'src/update.c'`; then echo shar: \"'src/update.c'\" unpacked with wrong size! fi # end of 'src/update.c' fi echo shar: End of archive 4 \(of 7\). cp /dev/null ark4isdone MISSING="" for I in 1 2 3 4 5 6 7 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 7 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 exit 0 # Just in case...