Add -K option to pass keywordlists to rcs so we can disable and enable

specific keyword expansion on cvs co and cvs patch commands.
This commit is contained in:
Rodney W. Grimes 1994-05-14 10:51:13 +00:00
parent bb30c9992f
commit d4a0daa9e2
4 changed files with 46 additions and 11 deletions

View file

@ -70,6 +70,7 @@ static char *checkout_usage[] =
"\t-r rev\tCheck out revision or tag. (implies -P)\n",
"\t-D date\tCheck out revisions as of date. (implies -P)\n",
"\t-d dir\tCheck out into dir instead of module name.\n",
"\t-K key\tUse RCS key -K option on checkout.\n",
"\t-k kopt\tUse RCS kopt -k option on checkout.\n",
"\t-j rev\tMerge in changes made between current revision and rev.\n",
NULL
@ -100,6 +101,7 @@ static char *date = NULL;
static char *join_rev1 = NULL;
static char *join_rev2 = NULL;
static char *preload_update_dir = NULL;
static char *K_flag = NULL;
int
checkout (argc, argv)
@ -129,7 +131,7 @@ checkout (argc, argv)
}
else
{
valid_options = "ANnk:d:flRpQqcsr:D:j:P";
valid_options = "ANnk:d:flRpQqcsr:D:j:PK:";
valid_usage = checkout_usage;
}
@ -207,6 +209,9 @@ checkout (argc, argv)
else
join_rev1 = optarg;
break;
case 'K':
K_flag = optarg;
break;
case '?':
default:
usage (valid_usage);
@ -597,6 +602,7 @@ checkout_proc (pargc, argv, where, mwhere, mfile, shorten,
force_tag_match, 0 /* !local */ ,
1 /* update -d */ , aflag, checkout_prune_dirs,
pipeout, which, join_rev1, join_rev2,
K_flag,
preload_update_dir);
free (preload_update_dir);
preload_update_dir = oldupdate;
@ -639,7 +645,7 @@ checkout_proc (pargc, argv, where, mwhere, mfile, shorten,
err += do_update (*pargc - 1, argv + 1, options, tag, date,
force_tag_match, local_specified, 1 /* update -d */,
aflag, checkout_prune_dirs, pipeout, which, join_rev1,
join_rev2, preload_update_dir);
join_rev2, K_flag, preload_update_dir);
free (preload_update_dir);
preload_update_dir = oldupdate;
return (err);

View file

@ -348,7 +348,8 @@ int do_recursion (int (*xfileproc) (), int (*xfilesdoneproc) (),
int do_update (int argc, char *argv[], char *xoptions, char *xtag,
char *xdate, int xforce, int local, int xbuild,
int xaflag, int xprune, int xpipeout, int which,
char *xjoin_rev1, char *xjoin_rev2, char *preload_update_dir);
char *xjoin_rev1, char *xjoin_rev2,
char *xK_flag, char *preload_update_dir);
void history_write (int type, char *update_dir, char *revs, char *name,
char *repository);
int start_recursion (int (*fileproc) (), int (*filesdoneproc) (),

View file

@ -43,6 +43,8 @@ static char *rev1 = NULL;
static char *rev2 = NULL;
static char *date1 = NULL;
static char *date2 = NULL;
static char *K_flag1 = NULL;
static char *K_flag2 = NULL;
static char tmpfile1[L_tmpnam+1], tmpfile2[L_tmpnam+1], tmpfile3[L_tmpnam+1];
static int unidiff = 0;
@ -60,6 +62,7 @@ static char *patch_usage[] =
"\t-D date\tDate.\n",
"\t-r rev\tRevision - symbolic or numeric.\n",
"\t-V vers\tUse RCS Version \"vers\" for keyword expansion.\n",
"\t-K key\tUse RCS key -K option on checkout.\n",
NULL
};
@ -77,7 +80,7 @@ patch (argc, argv)
usage (patch_usage);
optind = 1;
while ((c = gnu_getopt (argc, argv, "V:k:cuftsQqlRD:r:")) != -1)
while ((c = gnu_getopt (argc, argv, "V:k:cuftsQqlRD:r:K:")) != -1)
{
switch (c)
{
@ -139,6 +142,14 @@ patch (argc, argv)
case 'c': /* Context diff */
unidiff = 0;
break;
case 'K':
if (K_flag2 != NULL)
error (1, 0, "no more than two -K flags can be specified");
if (K_flag1 != NULL)
K_flag2 = optarg;
else
K_flag1 = optarg;
break;
case '?':
default:
usage (patch_usage);
@ -149,6 +160,11 @@ patch (argc, argv)
argv += optind;
/* Sanity checks */
/* Check for dummy -K flags */
if (K_flag1 && K_flag1[0] != 'e' && K_flag1[0] != 'i')
error (1, 0, "-K flag does not start e or i");
if (K_flag2 && K_flag2[0] != 'e' && K_flag2[0] != 'i')
error (1, 0, "-K flag does not start e or i");
if (argc < 1)
usage (patch_usage);
@ -364,7 +380,8 @@ patch_fileproc (file, update_dir, repository, entries, srcfiles)
}
if (vers_tag != NULL)
{
run_setup ("%s%s %s -p -q -r%s", Rcsbin, RCS_CO, options, vers_tag);
run_setup ("%s%s %s -p -q -r%s %s%s", Rcsbin, RCS_CO, options,
vers_tag, K_flag1 ? "-K" : "", K_flag1 ? K_flag1 : "");
run_arg (rcsfile->path);
if ((retcode = run_exec (RUN_TTY, tmpfile1, RUN_TTY, RUN_NORMAL)) != 0)
{
@ -382,7 +399,8 @@ patch_fileproc (file, update_dir, repository, entries, srcfiles)
}
if (vers_head != NULL)
{
run_setup ("%s%s %s -p -q -r%s", Rcsbin, RCS_CO, options, vers_head);
run_setup ("%s%s %s -p -q -r%s %s%s", Rcsbin, RCS_CO, options,
vers_head, K_flag2 ? "-K" : "", K_flag2 ? K_flag2 : "");
run_arg (rcsfile->path);
if ((retcode = run_exec (RUN_TTY, tmpfile2, RUN_TTY, RUN_NORMAL)) != 0)
{

View file

@ -75,6 +75,7 @@ static char *tag = NULL;
static char *date = NULL;
static char *join_rev1, *date_rev1;
static char *join_rev2, *date_rev2;
static char *K_flag;
static int aflag = 0;
static int force_tag_match = 1;
static int update_build_dirs = 0;
@ -99,6 +100,7 @@ static char *update_usage[] =
"\t-D date\tSet date to update from.\n",
"\t-j rev\tMerge in changes made between current revision and rev.\n",
"\t-I ign\tMore files to ignore (! to reset).\n",
"\t-K key\tUse RCS key -K option on checkout.\n",
NULL
};
@ -121,7 +123,7 @@ update (argc, argv)
/* parse the args */
optind = 1;
while ((c = gnu_getopt (argc, argv, "ApPflRQqdk:r:D:j:I:")) != -1)
while ((c = gnu_getopt (argc, argv, "ApPflRQqdk:r:D:j:I:K:")) != -1)
{
switch (c)
{
@ -175,6 +177,9 @@ update (argc, argv)
else
join_rev1 = optarg;
break;
case 'K':
K_flag = optarg;
break;
case '?':
default:
usage (update_usage);
@ -209,7 +214,8 @@ update (argc, argv)
/* call the command line interface */
err = do_update (argc, argv, options, tag, date, force_tag_match,
local, update_build_dirs, aflag, update_prune_dirs,
pipeout, which, join_rev1, join_rev2, (char *) NULL);
pipeout, which, join_rev1, join_rev2,
K_flag, (char *) NULL);
/* free the space Make_Date allocated if necessary */
if (date != NULL)
@ -223,7 +229,8 @@ update (argc, argv)
*/
int
do_update (argc, argv, xoptions, xtag, xdate, xforce, local, xbuild, xaflag,
xprune, xpipeout, which, xjoin_rev1, xjoin_rev2, preload_update_dir)
xprune, xpipeout, which, xjoin_rev1, xjoin_rev2,
xK_flag, preload_update_dir)
int argc;
char *argv[];
char *xoptions;
@ -238,6 +245,7 @@ do_update (argc, argv, xoptions, xtag, xdate, xforce, local, xbuild, xaflag,
int which;
char *xjoin_rev1;
char *xjoin_rev2;
char *xK_flag;
char *preload_update_dir;
{
int err = 0;
@ -253,6 +261,8 @@ do_update (argc, argv, xoptions, xtag, xdate, xforce, local, xbuild, xaflag,
update_prune_dirs = xprune;
pipeout = xpipeout;
K_flag = xK_flag;
/* setup the join support */
join_rev1 = xjoin_rev1;
join_rev2 = xjoin_rev2;
@ -650,8 +660,8 @@ checkout_file (file, repository, entries, srcfiles, vers_ts, update_dir)
(void) unlink_file (backup);
}
run_setup ("%s%s -q -r%s %s", Rcsbin, RCS_CO, vers_ts->vn_rcs,
vers_ts->options);
run_setup ("%s%s -q -r%s %s %s%s", Rcsbin, RCS_CO, vers_ts->vn_rcs,
vers_ts->options, K_flag ? "-K" : "", K_flag ? K_flag : "");
/*
* if we are checking out to stdout, print a nice message to stderr, and