2 * Copyright (c) 1992, Brian Berliner and Jeff Polk
3 * Copyright (c) 1989-1992, Brian Berliner
5 * You may distribute under the terms of the GNU General Public License as
6 * specified in the README file that comes with the CVS 1.4 kit.
10 * For now, this is basically a front end for rcs. All options are passed
15 #ifdef CVS_ADMIN_GROUP
19 static Dtype admin_dirproc PROTO((char *dir, char *repos, char *update_dir));
20 static int admin_fileproc PROTO((struct file_info *finfo));
22 static const char *const admin_usage[] =
24 "Usage: %s %s rcs-options files...\n",
37 #ifdef CVS_ADMIN_GROUP
43 #ifdef CVS_ADMIN_GROUP
44 grp = getgrnam(CVS_ADMIN_GROUP);
45 /* skip usage right check if group CVS_ADMIN_GROUP does not exist */
48 char *me = getcaller();
49 char **grnam = grp->gr_mem;
54 if (strcmp(*grnam, me) == 0)
63 error (1, 0, "usage is restricted to members of the group %s",
70 /* skip all optional arguments to see if we have any file names */
71 for (ac = 1; ac < argc; ac++)
72 if (argv[ac][0] != '-')
78 if (ac == 0 || argc == 0)
86 /* We're the client side. Fire up the remote server. */
91 for (i = 0; i <= ac; ++i) /* XXX send -ko too with i = 0 */
94 send_file_names (argc, argv, SEND_EXPAND_WILD);
95 /* FIXME: We shouldn't have to send current files, but I'm not sure
96 whether it works. So send the files --
97 it's slower but it works. */
98 send_files (argc, argv, 0, 0);
99 send_to_server ("admin\012", 0);
100 return get_responses_and_close ();
102 #endif /* CLIENT_SUPPORT */
104 /* start the recursion processor */
105 err = start_recursion (admin_fileproc, (FILESDONEPROC) NULL, admin_dirproc,
106 (DIRLEAVEPROC) NULL, argc, argv, 0,
107 W_LOCAL, 0, 1, (char *) NULL, 1, 0);
112 * Called to run "rcs" on a particular file.
116 admin_fileproc (finfo)
117 struct file_info *finfo;
126 vers = Version_TS (finfo->repository, (char *) NULL, (char *) NULL, (char *) NULL,
127 finfo->file, 0, 0, finfo->entries, finfo->rcs);
129 version = vers->vn_user;
132 else if (strcmp (version, "0") == 0)
134 error (0, 0, "cannot admin newly added file `%s'", finfo->file);
138 run_setup ("%s%s -x,v/", Rcsbin, RCS);
139 for (argc = ac, argv = av; argc; argc--, argv++)
141 run_arg (vers->srcfile->path);
142 if ((retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL)) != 0)
145 error (0, retcode == -1 ? errno : 0,
146 "%s failed for `%s'", RCS, finfo->file);
156 * Print a warm fuzzy message
160 admin_dirproc (dir, repos, update_dir)
166 error (0, 0, "Administrating %s", update_dir);