Skip to content
Snippets Groups Projects
Commit 377f5aa3 authored by woods's avatar woods
Browse files

* client.c (start_rsh_server): get rid of the magic strings for

rsh and cvs -- use new constants RSH_DFLT and CVS_DFLT for their
default values and CVS_RSH_ENV and CVS_SERVER_ENV for the
environment variable names.
(update_entries): use Patchbin instead of PATCH_PROGRAM.

* main.c: rename GREPBIN_ENV to GREP_ENV.
rename DIFFBIN_ENV to DIFF_ENV.
(Patchbin): new global variable, set to PATCH_DFLT.
(main): set default Patchbin from getenv(PATCH_ENV).
(main): new local variable patchbin_update_env.
(main): new option -p to set Patchbin.
(main): putenv(PATCH_ENV) if patchbin_update_env.

* cvs.h: don't include "options.h" any more.
remove mention of things that were mentioned as in options.h.
(GREP_ENV): renamed from GREPBIN_ENV, reset to GREP.
(DIFF_ENV): renamed from DIFFBIN_ENV, reset to DIFF.
(PATCH_ENV): new define, set to PATCH.
(Patchbin): declare new global variable.

* Makefile.in: remove all trace of options.h.

* options.h.in: removed (contents moved to ../acconfig.h).
parent 5148103e
No related branches found
No related tags found
No related merge requests found
...@@ -49,8 +49,9 @@ char *CurDir; ...@@ -49,8 +49,9 @@ char *CurDir;
* Defaults, for the environment variables that are not set * Defaults, for the environment variables that are not set
*/ */
char *Rcsbin = RCSBIN_DFLT; char *Rcsbin = RCSBIN_DFLT;
char *Diffbin = DIFFBIN_DFLT; char *Diffbin = DIFF_DFLT;
char *Grepbin = GREPBIN_DFLT; char *Grepbin = GREP_DFLT;
char *Patchbin = PATCH_DFLT;
char *Tmpdir = TMPDIR_DFLT; char *Tmpdir = TMPDIR_DFLT;
char *Editor = EDITOR_DFLT; char *Editor = EDITOR_DFLT;
/* /*
...@@ -312,7 +313,7 @@ main (argc, argv) ...@@ -312,7 +313,7 @@ main (argc, argv)
const struct cmd *cm; const struct cmd *cm;
int c, err = 0; int c, err = 0;
int rcsbin_update_env, diffbin_update_env, grepbin_update_env, int rcsbin_update_env, diffbin_update_env, grepbin_update_env,
tmpdir_update_env, cvs_update_env; patchbin_update_env, tmpdir_update_env, cvs_update_env;
int help = 0; /* Has the user asked for help? This int help = 0; /* Has the user asked for help? This
lets us support the `cvs -H cmd' lets us support the `cvs -H cmd'
convention to give help for cmd. */ convention to give help for cmd. */
...@@ -361,17 +362,23 @@ main (argc, argv) ...@@ -361,17 +362,23 @@ main (argc, argv)
rcsbin_update_env = 0; /* it's already there */ rcsbin_update_env = 0; /* it's already there */
} }
diffbin_update_env = *Diffbin; /* DIFF must be set */ diffbin_update_env = *Diffbin; /* DIFF must be set */
if ((cp = getenv (DIFFBIN_ENV)) != NULL) if ((cp = getenv (DIFF_ENV)) != NULL)
{ {
Diffbin = cp; Diffbin = cp;
diffbin_update_env = 0; /* it's already there */ diffbin_update_env = 0; /* it's already there */
} }
grepbin_update_env = *Grepbin; /* GREP must be set */ grepbin_update_env = *Grepbin; /* GREP must be set */
if ((cp = getenv (GREPBIN_ENV)) != NULL) if ((cp = getenv (GREP_ENV)) != NULL)
{ {
Grepbin = cp; Grepbin = cp;
grepbin_update_env = 0; /* it's already there */ grepbin_update_env = 0; /* it's already there */
} }
patchbin_update_env = *Patchbin; /* PATCH must be set */
if ((cp = getenv (PATCH_ENV)) != NULL)
{
Patchbin = cp;
patchbin_update_env = 0; /* it's already there */
}
tmpdir_update_env = *Tmpdir; /* TMPDIR_DFLT must be set */ tmpdir_update_env = *Tmpdir; /* TMPDIR_DFLT must be set */
if ((cp = getenv (TMPDIR_ENV)) != NULL) if ((cp = getenv (TMPDIR_ENV)) != NULL)
{ {
...@@ -424,7 +431,7 @@ main (argc, argv) ...@@ -424,7 +431,7 @@ main (argc, argv)
opterr = 1; opterr = 1;
while ((c = getopt_long while ((c = getopt_long
(argc, argv, "Qqrwtnlvb:D:g:T:e:d:Hfz:s:x", long_options, &option_index)) (argc, argv, "Qqrwtnlvb:D:g:p:T:e:d:Hfz:s:x", long_options, &option_index))
!= EOF) != EOF)
{ {
switch (c) switch (c)
...@@ -482,6 +489,10 @@ main (argc, argv) ...@@ -482,6 +489,10 @@ main (argc, argv)
Grepbin = optarg; Grepbin = optarg;
grepbin_update_env = 1; /* need to update environment */ grepbin_update_env = 1; /* need to update environment */
break; break;
case 'p':
Patchbin = optarg;
patchbin_update_env = 1; /* need to update environment */
break;
case 'T': case 'T':
Tmpdir = optarg; Tmpdir = optarg;
tmpdir_update_env = 1; /* need to update environment */ tmpdir_update_env = 1; /* need to update environment */
...@@ -788,16 +799,24 @@ main (argc, argv) ...@@ -788,16 +799,24 @@ main (argc, argv)
if (diffbin_update_env) if (diffbin_update_env)
{ {
char *env; char *env;
env = xmalloc (strlen (DIFFBIN_ENV) + strlen (Diffbin) + 1 + 1); env = xmalloc (strlen (DIFF_ENV) + strlen (Diffbin) + 1 + 1);
(void) sprintf (env, "%s=%s", DIFFBIN_ENV, Diffbin); (void) sprintf (env, "%s=%s", DIFF_ENV, Diffbin);
(void) putenv (env); (void) putenv (env);
/* do not free env, as putenv has control of it */ /* do not free env, as putenv has control of it */
} }
if (grepbin_update_env) if (grepbin_update_env)
{ {
char *env; char *env;
env = xmalloc (strlen (GREPBIN_ENV) + strlen (Grepbin) + 1 + 1); env = xmalloc (strlen (GREP_ENV) + strlen (Grepbin) + 1 + 1);
(void) sprintf (env, "%s=%s", GREPBIN_ENV, Grepbin); (void) sprintf (env, "%s=%s", GREP_ENV, Grepbin);
(void) putenv (env);
/* do not free env, as putenv has control of it */
}
if (patchbin_update_env)
{
char *env;
env = xmalloc (strlen (PATCH_ENV) + strlen (Patchbin) + 1 + 1);
(void) sprintf (env, "%s=%s", PATCH_ENV, Grepbin);
(void) putenv (env); (void) putenv (env);
/* do not free env, as putenv has control of it */ /* do not free env, as putenv has control of it */
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment