From: "Derek R. Price" <[EMAIL PROTECTED]>
Subject: Minor client/server bug
Date: Wed, 9 Aug 2000 14:29:34 +0900 (JST)
| When commands are run that instruct you to rerun cvs, the name of the
| executable on the server side is printed rather than the name on the
| client side:
|
| [dprice@empress dbstoretag]$ cvs add dbstoretag.pl
| tcvs server: scheduling file `dbstoretag.pl' for addition
| tcvs server: use 'tcvs commit' to add this file permanently
|
| Derek
I have made a patch.
Summary:
* client.c: (start_server) send "set-program-name".
* main.c: (get_client_program_name) New function.
* server.c: (client_program_name) New variable that is program_name at client.
(set_program_name) Set to client_program_name.
(request requests) Add "set-program-name".
* Replace some `program_name' with `get_client_program_name ()'.
Index: add.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/add.c,v
retrieving revision 1.75
diff -p -u -b -B -r1.75 add.c
--- add.c 2000/06/28 04:15:47 1.75
+++ add.c 2000/08/09 15:26:39
@@ -643,7 +643,7 @@ cannot resurrect %s; RCS file removed by
}
if (added_files)
error (0, 0, "use '%s commit' to add %s permanently",
- program_name,
+ get_client_program_name (),
(added_files == 1) ? "this file" : "these files");
if (message)
Index: admin.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/admin.c,v
retrieving revision 1.66
diff -p -u -b -B -r1.66 admin.c
--- admin.c 2000/07/26 19:09:01 1.66
+++ admin.c 2000/08/09 15:26:41
@@ -365,7 +365,7 @@ admin (argc, argv)
usage_error:
/* Don't use command_name; it might be "server". */
error (1, 0, "specify %s -H admin for usage information",
- program_name);
+ get_client_program_name ());
}
}
argc -= optind;
Index: classify.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/classify.c,v
retrieving revision 1.21
diff -p -u -b -B -r1.21 classify.c
--- classify.c 1998/04/27 20:07:59 1.21
+++ classify.c 2000/08/09 15:26:42
@@ -68,7 +68,7 @@ Classify_File (finfo, tag, date, options
if (!force_tag_match || !(vers->tag || vers->date))
if (!really_quiet)
error (0, 0, "use `%s add' to create an entry for %s",
- program_name, finfo->fullname);
+ get_client_program_name (), finfo->fullname);
ret = T_UNKNOWN;
}
}
@@ -79,7 +79,7 @@ Classify_File (finfo, tag, date, options
else
{
error (0, 0, "use `%s add' to create an entry for %s",
- program_name, finfo->fullname);
+ get_client_program_name (), finfo->fullname);
ret = T_UNKNOWN;
}
}
Index: client.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/client.c,v
retrieving revision 1.285
diff -p -u -b -B -r1.285 client.c
--- client.c 2000/07/06 16:20:41 1.285
+++ client.c 2000/08/09 15:26:56
@@ -3218,7 +3218,7 @@ handle_mt (args, len)
cvs_output ("Use the following command to help the merge:\n\n",
0);
cvs_output ("\t", 1);
- cvs_output (program_name, 0);
+ cvs_output (get_client_program_name (), 0);
if (CVSroot_cmdline != NULL)
{
cvs_output (" -d ", 0);
@@ -4659,6 +4659,13 @@ the :server: access method is not suppor
set user variables in their .cvsrc without trouble. */
if (supported_request ("Set"))
walklist (variable_list, send_variable_proc, NULL);
+
+ if (supported_request ("set-program-name"))
+ {
+ send_to_server ("set-program-name ", 0);
+ send_to_server (program_name, 0);
+ send_to_server ("\012", 1);
+ }
}
#ifndef NO_EXT_METHOD
Index: commit.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/commit.c,v
retrieving revision 1.163
diff -p -u -b -B -r1.163 commit.c
--- commit.c 2000/07/26 19:29:01 1.163
+++ commit.c 2000/08/09 15:27:01
@@ -262,7 +262,7 @@ find_fileproc (callerdat, finfo)
error (0, 0, "nothing known about `%s'", finfo->fullname);
else
error (0, 0, "use `%s add' to create an entry for %s",
- program_name, finfo->fullname);
+ get_client_program_name (), finfo->fullname);
freevers_ts (&vers);
return 1;
}
@@ -601,6 +601,7 @@ commit (argc, argv)
if (fclose (fp) < 0)
error (0, errno, "cannot close temporary file %s", fname);
error (0, 0, "saving log message in %s", fname);
+ free (fname);
}
return err;
}
Index: cvs.h
===================================================================
RCS file: /home2/cvsroot/ccvs/src/cvs.h,v
retrieving revision 1.204
diff -p -u -b -B -r1.204 cvs.h
--- cvs.h 2000/07/08 19:57:21 1.204
+++ cvs.h 2000/08/09 15:27:04
@@ -356,6 +356,9 @@ typedef enum direnter_type Dtype;
#endif
extern char *program_name, *program_path, *command_name;
+#ifdef SERVER_SUPPORT
+extern char *client_program_name;
+#endif
extern char *Tmpdir, *Editor;
extern int cvsadmin_root;
extern char *CurDir;
@@ -566,6 +569,7 @@ extern int fopen_case PROTO ((char *, ch
void strip_trailing_slashes PROTO((char *path));
void update_delproc PROTO((Node * p));
void usage PROTO((const char *const *cpp));
+const char *get_client_program_name PROTO((void));
void xchmod PROTO((char *fname, int writable));
char *xgetwd PROTO((void));
List *Find_Names PROTO((char *repository, int which, int aflag,
Index: import.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/import.c,v
retrieving revision 1.119
diff -p -u -b -B -r1.119 import.c
--- import.c 2000/07/11 20:32:02 1.119
+++ import.c 2000/08/09 15:27:08
@@ -175,7 +175,7 @@ import (argc, argv)
{
error (0, 0, "missing CVSROOT environment variable\n");
error (1, 0, "Set it or specify the '-d' option to %s.",
- program_name);
+ get_client_program_name ());
}
repository = xmalloc (strlen (CVSroot_directory) + strlen (argv[0])
+ 10);
@@ -324,7 +324,7 @@ import (argc, argv)
cvs_output_tagged ("newline", NULL);
cvs_output_tagged ("newline", NULL);
cvs_output_tagged ("text", "\t");
- cvs_output_tagged ("text", program_name);
+ cvs_output_tagged ("text", get_client_program_name ());
if (CVSroot_cmdline != NULL)
{
cvs_output_tagged ("text", " -d ");
@@ -353,7 +353,7 @@ import (argc, argv)
conflicts);
(void) fprintf (logfp,
"Use the following command to help the merge:\n\n");
- (void) fprintf (logfp, "\t%s checkout ", program_name);
+ (void) fprintf (logfp, "\t%s checkout ", get_client_program_name ());
(void) fprintf (logfp, "-j%s:yesterday -j%s %s\n\n",
argv[1], argv[1], argv[0]);
}
Index: main.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/main.c,v
retrieving revision 1.152
diff -p -u -b -B -r1.152 main.c
--- main.c 2000/07/10 19:34:21 1.152
+++ main.c 2000/08/09 15:27:13
@@ -1154,3 +1154,13 @@ usage (cpp)
(void) fprintf (stderr, *cpp);
error_exit ();
}
+
+const char *
+get_client_program_name (void)
+{
+#ifdef SERVER_SUPPORT
+ if (client_program_name)
+ return client_program_name;
+#endif
+ return program_name;
+}
Index: recurse.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/recurse.c,v
retrieving revision 1.72
diff -p -u -b -B -r1.72 recurse.c
--- recurse.c 2000/06/21 22:28:37 1.72
+++ recurse.c 2000/08/09 15:27:16
@@ -201,7 +201,7 @@ start_recursion (fileproc, filesdoneproc
error (0, 0, "in directory %s:", update_dir);
error (1, 0,
"there is no version here; run '%s checkout' first",
- program_name);
+ get_client_program_name ());
}
#ifdef CLIENT_SUPPORT
else if (client_active && server_started)
Index: remove.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/remove.c,v
retrieving revision 1.46
diff -p -u -b -B -r1.46 remove.c
--- remove.c 2000/06/21 22:28:37 1.46
+++ remove.c 2000/08/09 15:27:17
@@ -116,7 +116,7 @@ cvsremove (argc, argv)
local, W_LOCAL, 0, 1, (char *) NULL, 1);
if (removed_files)
- error (0, 0, "use '%s commit' to remove %s permanently", program_name,
+ error (0, 0, "use '%s commit' to remove %s permanently",
+get_client_program_name (),
(removed_files == 1) ? "this file" : "these files");
if (existing_files)
Index: repos.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/repos.c,v
retrieving revision 1.22
diff -p -u -b -B -r1.22 repos.c
--- repos.c 1997/09/27 03:52:47 1.22
+++ repos.c 2000/08/09 15:27:18
@@ -120,7 +120,7 @@ Name_Repository (dir, update_dir)
{
error (0, 0, "in directory %s:", xupdate_dir);
error (0, 0, "must set the CVSROOT environment variable\n");
- error (0, 0, "or specify the '-d' option to %s.", program_name);
+ error (0, 0, "or specify the '-d' option to %s.", get_client_program_name
+());
error (1, 0, "illegal repository setting");
}
newrepos = xmalloc (strlen (CVSroot_directory) + strlen (repos) + 10);
Index: server.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/server.c,v
retrieving revision 1.242
diff -p -u -b -B -r1.242 server.c
--- server.c 2000/07/28 20:18:40 1.242
+++ server.c 2000/08/09 15:27:33
@@ -18,6 +18,8 @@
#ifdef SERVER_SUPPORT
+char *client_program_name;
+
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
@@ -3733,6 +3735,16 @@ serve_version (arg)
do_cvs_command ("version", version);
}
+static void set_program_name PROTO ((char *));
+
+static void
+set_program_name (arg)
+ char *arg;
+{
+ free (client_program_name);
+ client_program_name = xstrdup (arg);
+}
+
static void serve_init PROTO ((char *));
static void
@@ -4714,6 +4726,7 @@ struct request requests[] =
REQ_LINE("annotate", serve_annotate, 0),
REQ_LINE("noop", serve_noop, RQ_ROOTLESS),
REQ_LINE("version", serve_version, RQ_ROOTLESS),
+ REQ_LINE("set-program-name", set_program_name, RQ_ROOTLESS),
REQ_LINE(NULL, NULL, 0)
#undef REQ_LINE
--
KOIE Hidetaka <[EMAIL PROTECTED]>