summaryrefslogtreecommitdiff
path: root/usr.bin/rcs
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r--usr.bin/rcs/co.c32
-rw-r--r--usr.bin/rcs/rcsprog.c26
-rw-r--r--usr.bin/rcs/rcsutil.c6
-rw-r--r--usr.bin/rcs/rcsutil.h6
4 files changed, 26 insertions, 44 deletions
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index 5052024e0da..dd88f6adbcc 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.93 2006/05/27 08:12:29 ray Exp $ */
+/* $OpenBSD: co.c,v 1.94 2006/05/28 23:16:31 ray Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -36,25 +36,24 @@ static void checkout_err_nobranch(RCSFILE *, const char *, const char *,
int
checkout_main(int argc, char **argv)
{
- int fd, i, ch, flags, kflag, status, warg;
+ int fd, i, ch, flags, kflag, status;
RCSNUM *rev;
RCSFILE *file;
+ const char *author, *date, *state;
char fpath[MAXPATHLEN];
- char *author, *date, *rev_str, *username, *state;
+ char *rev_str, *username;
time_t rcs_mtime = -1;
- warg = flags = status = 0;
+ flags = status = 0;
kflag = RCS_KWEXP_ERR;
rev = RCS_HEAD_REV;
rev_str = NULL;
- state = NULL;
- author = NULL;
- date = NULL;
+ author = date = state = NULL;
while ((ch = rcs_getopt(argc, argv, CO_OPTSTRING)) != -1) {
switch (ch) {
case 'd':
- date = xstrdup(rcs_optarg);
+ date = rcs_optarg;
break;
case 'f':
rcs_setrevstr(&rev_str, rcs_optarg);
@@ -97,7 +96,7 @@ checkout_main(int argc, char **argv)
rcs_setrevstr(&rev_str, rcs_optarg);
break;
case 's':
- state = xstrdup(rcs_optarg);
+ state = rcs_optarg;
flags |= CO_STATE;
break;
case 'T':
@@ -119,10 +118,8 @@ checkout_main(int argc, char **argv)
if (rcs_optarg == NULL) {
if ((author = getlogin()) == NULL)
err(1, "getlogin");
- } else {
- author = xstrdup(rcs_optarg);
- warg = 1;
- }
+ } else
+ author = rcs_optarg;
flags |= CO_AUTHOR;
break;
case 'x':
@@ -209,15 +206,6 @@ checkout_main(int argc, char **argv)
rcs_close(file);
}
- if (author != NULL && warg)
- xfree(author);
-
- if (date != NULL)
- xfree(date);
-
- if (state != NULL)
- xfree(state);
-
return (status);
}
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c
index 2e2df92499c..1d7bb00c2d7 100644
--- a/usr.bin/rcs/rcsprog.c
+++ b/usr.bin/rcs/rcsprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsprog.c,v 1.129 2006/05/28 18:55:55 ray Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.130 2006/05/28 23:16:31 ray Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -177,10 +177,10 @@ rcs_main(int argc, char **argv)
{
int fd;
int i, j, ch, flags, kflag, lkmode;
- const char *oldfilename;
+ const char *nflag, *oldfilename, *orange;
char fpath[MAXPATHLEN];
- char *logstr, *logmsg, *nflag, *descfile;
- char *alist, *comment, *elist, *lrev, *urev, *orange;
+ char *logstr, *logmsg, *descfile;
+ char *alist, *comment, *elist, *lrev, *urev;
mode_t fmode;
RCSFILE *file;
RCSNUM *logrev;
@@ -191,9 +191,9 @@ rcs_main(int argc, char **argv)
lkmode = -1;
fmode = S_IRUSR|S_IRGRP|S_IROTH;
flags = RCS_RDWR|RCS_PARSE_FULLY;
- lrev = urev = descfile = nflag = NULL;
- logstr = alist = comment = elist = orange = NULL;
- oldfilename = NULL;
+ lrev = urev = descfile = NULL;
+ logstr = alist = comment = elist = NULL;
+ nflag = oldfilename = orange = NULL;
/* match GNU */
if (1 < argc && argv[1][0] != '-')
@@ -244,14 +244,14 @@ rcs_main(int argc, char **argv)
/* ignore for the moment */
break;
case 'n':
- nflag = xstrdup(rcs_optarg);
+ nflag = rcs_optarg;
break;
case 'N':
- nflag = xstrdup(rcs_optarg);
+ nflag = rcs_optarg;
rcsflags |= RCSPROG_NFLAG;
break;
case 'o':
- orange = xstrdup(rcs_optarg);
+ orange = rcs_optarg;
break;
case 'q':
rcsflags |= QUIET;
@@ -506,12 +506,6 @@ rcs_main(int argc, char **argv)
if (logstr != NULL)
xfree(logstr);
- if (nflag != NULL)
- xfree(nflag);
-
- if (orange != NULL)
- xfree(orange);
-
return (0);
}
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c
index cb97e08f3d4..f98bdbb0f4c 100644
--- a/usr.bin/rcs/rcsutil.c
+++ b/usr.bin/rcs/rcsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsutil.c,v 1.13 2006/05/27 08:12:29 ray Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.14 2006/05/28 23:16:31 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -358,7 +358,7 @@ rcs_prompt(const char *prompt)
}
u_int
-rcs_rev_select(RCSFILE *file, char *range)
+rcs_rev_select(RCSFILE *file, const char *range)
{
int i;
u_int nrev;
@@ -582,7 +582,7 @@ rcs_yesno(void)
* an argument vector for the values found.
*/
struct rcs_argvector *
-rcs_strsplit(char *str, const char *sep)
+rcs_strsplit(const char *str, const char *sep)
{
struct rcs_argvector *av;
size_t i = 0;
diff --git a/usr.bin/rcs/rcsutil.h b/usr.bin/rcs/rcsutil.h
index b7d2e703458..9a7d7904ebd 100644
--- a/usr.bin/rcs/rcsutil.h
+++ b/usr.bin/rcs/rcsutil.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsutil.h,v 1.5 2006/05/27 05:49:14 ray Exp $ */
+/* $OpenBSD: rcsutil.h,v 1.6 2006/05/28 23:16:31 ray Exp $ */
/*
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
@@ -55,7 +55,7 @@ int rcs_choosefile(const char *, char *, size_t);
time_t rcs_get_mtime(RCSFILE *);
RCSNUM *rcs_getrevnum(const char *, RCSFILE *);
char *rcs_prompt(const char *);
-u_int rcs_rev_select(RCSFILE *, char *);
+u_int rcs_rev_select(RCSFILE *, const char *);
void rcs_set_description(RCSFILE *, const char *);
void rcs_set_rev(const char *, RCSNUM **);
void rcs_setrevstr(char **, char *);
@@ -65,7 +65,7 @@ BUF *rcs_patchfile(const char *, const char *,
struct rcs_lines *rcs_splitlines(const char *);
void rcs_freelines(struct rcs_lines *);
int rcs_yesno(void);
-struct rcs_argvector *rcs_strsplit(char *, const char *);
+struct rcs_argvector *rcs_strsplit(const char *, const char *);
void rcs_argv_destroy(struct rcs_argvector *);
#endif /* RCSUTIL_H */