home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / rcs / sources / create_a.c < prev    next >
C/C++ Source or Header  |  1992-01-19  |  1KB  |  48 lines

  1. #ifndef lint
  2. static char rcsid[] = "$Id: create_admin.c,v 1.7 89/11/19 23:19:55 berliner Exp $";
  3. #endif 
  4.  
  5. /*
  6.  *    Copyright (c) 1989, Brian Berliner
  7.  *
  8.  *    You may distribute under the terms of the GNU General Public License
  9.  *    as specified in the README file that comes with the CVS 1.0 kit.
  10.  *
  11.  * Create Administration.
  12.  *
  13.  *    Creates a CVS administration directory based on the argument
  14.  *    repository; the "Entries" file is prefilled from the "initrecord"
  15.  *    argument.
  16.  */
  17.  
  18. #include "cvs.h"
  19.  
  20. Create_Admin(repository, initrecord)
  21.     register char *repository;
  22.     register char *initrecord;
  23. {
  24.     register FILE *fout;
  25.     char *cp;
  26.  
  27.     if (!isdir(repository))
  28.     error(0, "there is no repository %s", repository);
  29.     if (!isfile(initrecord))
  30.     error(0, "there is no file %s", initrecord);
  31.     if (isfile(CVSADM))
  32.     error(0, "there is a version here already");
  33.     make_directory(CVSADM);
  34.     fout = open_file(CVSADM_REP, "w+");
  35.     cp = repository;
  36.     if (CVSroot != NULL) {
  37.     char path[MAXPATHLEN];
  38.  
  39.     (void) sprintf(path, "%s%c", CVSroot, DIRSEP);
  40.     if (strncmp(repository, path, strlen(path)) == 0)
  41.         cp = repository + strlen(path);
  42.     }
  43.     if (fprintf(fout, "%s\n", cp) == EOF)
  44.     error(1, "write to %s failed", CVSADM_REP);
  45.     (void) fclose(fout);
  46.     copy_file(initrecord, CVSADM_ENT);
  47. }
  48.