diff options
Diffstat (limited to 'contrib/cvs/src/logmsg.c')
-rw-r--r-- | contrib/cvs/src/logmsg.c | 76 |
1 files changed, 41 insertions, 35 deletions
diff --git a/contrib/cvs/src/logmsg.c b/contrib/cvs/src/logmsg.c index 5296e24564444..52a025a23345a 100644 --- a/contrib/cvs/src/logmsg.c +++ b/contrib/cvs/src/logmsg.c @@ -13,14 +13,16 @@ static int find_type PROTO((Node * p, void *closure)); static int fmt_proc PROTO((Node * p, void *closure)); -static int logfile_write PROTO((char *repository, char *filter, - char *message, FILE * logfp, List * changes)); -static int rcsinfo_proc PROTO((char *repository, char *template)); +static int logfile_write PROTO((const char *repository, const char *filter, + const char *message, FILE * logfp, + List * changes)); +static int rcsinfo_proc PROTO((const char *repository, const char *template)); static int title_proc PROTO((Node * p, void *closure)); -static int update_logfile_proc PROTO((char *repository, char *filter)); +static int update_logfile_proc PROTO((const char *repository, + const char *filter)); static void setup_tmpfile PROTO((FILE * xfp, char *xprefix, List * changes)); -static int editinfo_proc PROTO((char *repository, char *template)); -static int verifymsg_proc PROTO((char *repository, char *script)); +static int editinfo_proc PROTO((const char *repository, const char *template)); +static int verifymsg_proc PROTO((const char *repository, const char *script)); static FILE *fp; static char *str_list; @@ -104,9 +106,8 @@ find_type (p, closure) Node *p; void *closure; { - struct logfile_info *li; + struct logfile_info *li = p->data; - li = (struct logfile_info *) p->data; if (li->type == type) return (1); else @@ -125,7 +126,7 @@ fmt_proc (p, closure) { struct logfile_info *li; - li = (struct logfile_info *) p->data; + li = p->data; if (li->type == type) { if (li->tag == NULL @@ -182,9 +183,9 @@ fmt_proc (p, closure) */ void do_editor (dir, messagep, repository, changes) - char *dir; + const char *dir; char **messagep; - char *repository; + const char *repository; List *changes; { static int reuse_log_message = 0; @@ -413,7 +414,7 @@ do_editor (dir, messagep, repository, changes) void do_verify (messagep, repository) char **messagep; - char *repository; + const char *repository; { FILE *fp; char *fname; @@ -429,14 +430,14 @@ do_verify (messagep, repository) /* FIXME? Do we really want to skip this on noexec? What do we do for the other administrative files? */ - if (noexec) + if (noexec || repository == NULL) return; /* Get the name of the verification script to run */ - if (repository != NULL) - (void) Parse_Info (CVSROOTADM_VERIFYMSG, repository, - verifymsg_proc, 0); + if (Parse_Info (CVSROOTADM_VERIFYMSG, repository, verifymsg_proc, 0) > 0) + error (1, 0, "Message verification failed"); + if (!verifymsg_script) return; @@ -550,6 +551,8 @@ do_verify (messagep, repository) if (unlink_file (fname) < 0) error (0, errno, "cannot remove %s", fname); free (fname); + free( verifymsg_script ); + verifymsg_script = NULL; } /* @@ -560,8 +563,8 @@ do_verify (messagep, repository) /* ARGSUSED */ static int rcsinfo_proc (repository, template) - char *repository; - char *template; + const char *repository; + const char *template; { static char *last_template; FILE *tfp; @@ -602,13 +605,13 @@ rcsinfo_proc (repository, template) * specified program as standard input. */ static FILE *logfp; -static char *message; +static const char *message; static List *changes; void Update_Logfile (repository, xmessage, xlogfp, xchanges) - char *repository; - char *xmessage; + const char *repository; + const char *xmessage; FILE *xlogfp; List *xchanges; { @@ -625,17 +628,21 @@ Update_Logfile (repository, xmessage, xlogfp, xchanges) (void) Parse_Info (CVSROOTADM_LOGINFO, repository, update_logfile_proc, 1); } + + /* * callback proc to actually do the logfile write from Update_Logfile */ static int update_logfile_proc (repository, filter) - char *repository; - char *filter; + const char *repository; + const char *filter; { - return (logfile_write (repository, filter, message, logfp, changes)); + return logfile_write (repository, filter, message, logfp, changes); } + + /* * concatenate each filename/version onto str_list */ @@ -644,10 +651,9 @@ title_proc (p, closure) Node *p; void *closure; { - struct logfile_info *li; char *c; + struct logfile_info *li = p->data; - li = (struct logfile_info *) p->data; if (li->type == type) { /* Until we decide on the correct logging solution when we add @@ -727,9 +733,9 @@ title_proc (p, closure) */ static int logfile_write (repository, filter, message, logfp, changes) - char *repository; - char *filter; - char *message; + const char *repository; + const char *filter; + const char *message; FILE *logfp; List *changes; { @@ -796,7 +802,7 @@ logfile_write (repository, filter, message, logfp, changes) if (fmt_percent) { int len; - char *srepos; + const char *srepos; char *fmt_begin, *fmt_end; /* beginning and end of the format string specified in filter. */ @@ -927,7 +933,7 @@ logfile_write (repository, filter, message, logfp, changes) } setup_tmpfile (pipefp, "", changes); - (void) fprintf (pipefp, "Log Message:\n%s\n", message); + (void) fprintf (pipefp, "Log Message:\n%s\n", (message) ? message : ""); if (logfp != (FILE *) 0) { (void) fprintf (pipefp, "Status:\n"); @@ -951,8 +957,8 @@ logfile_write (repository, filter, message, logfp, changes) /* ARGSUSED */ static int editinfo_proc(repository, editor) - char *repository; - char *editor; + const char *repository; + const char *editor; { /* nothing to do if the last match is the same as this one */ if (editinfo_editor && strcmp (editinfo_editor, editor) == 0) @@ -969,8 +975,8 @@ editinfo_proc(repository, editor) */ static int verifymsg_proc (repository, script) - char *repository; - char *script; + const char *repository; + const char *script; { if (verifymsg_script && strcmp (verifymsg_script, script) == 0) return (0); |