summaryrefslogtreecommitdiff
path: root/usr.bin/rcs
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2006-04-25 13:36:37 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2006-04-25 13:36:37 +0000
commite24515166bcbeb276f35021163835860a2f8adde (patch)
tree147f918a7c0bf6561542b4652a3bd4ebd742ba90 /usr.bin/rcs
parentd3618a298bb6ba5607916a81de3a4548822aa526 (diff)
fatal() -> err()/errx() as we try to not depend on heavy cvs_log().
OK joriski.
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r--usr.bin/rcs/ci.c44
-rw-r--r--usr.bin/rcs/co.c12
-rw-r--r--usr.bin/rcs/rcsclean.c4
-rw-r--r--usr.bin/rcs/rcsdiff.c6
-rw-r--r--usr.bin/rcs/rcsmerge.c6
-rw-r--r--usr.bin/rcs/rcsprog.c20
-rw-r--r--usr.bin/rcs/rcsutil.c22
-rw-r--r--usr.bin/rcs/rlog.c6
8 files changed, 60 insertions, 60 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c
index bd1035b00a6..d3b064773b7 100644
--- a/usr.bin/rcs/ci.c
+++ b/usr.bin/rcs/ci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ci.c,v 1.159 2006/04/25 07:57:10 xsa Exp $ */
+/* $OpenBSD: ci.c,v 1.160 2006/04/25 13:36:35 xsa Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -121,7 +121,7 @@ checkin_main(int argc, char **argv)
if (rcs_optarg == NULL)
pb.date = DATE_MTIME;
else if ((pb.date = cvs_date_parse(rcs_optarg)) <= 0)
- fatal("invalid date");
+ errx(1, "invalid date");
break;
case 'f':
rcs_setrevstr(&rev_str, rcs_optarg);
@@ -156,7 +156,7 @@ checkin_main(int argc, char **argv)
case 'm':
pb.rcs_msg = rcs_optarg;
if (pb.rcs_msg == NULL)
- fatal("missing message for -m option");
+ errx(1, "missing message for -m option");
pb.flags &= ~INTERACTIVE;
break;
case 'N':
@@ -167,7 +167,7 @@ checkin_main(int argc, char **argv)
xfree(pb.symbol);
pb.symbol = xstrdup(rcs_optarg);
if (rcs_sym_check(pb.symbol) != 1)
- fatal("invalid symbol `%s'", pb.symbol);
+ errx(1, "invalid symbol `%s'", pb.symbol);
break;
case 'q':
pb.flags |= QUIET;
@@ -179,7 +179,7 @@ checkin_main(int argc, char **argv)
case 's':
pb.state = rcs_optarg;
if (rcs_state_check(pb.state) < 0)
- fatal("invalid state `%s'", pb.state);
+ errx(1, "invalid state `%s'", pb.state);
break;
case 'T':
pb.flags |= PRESERVETIME;
@@ -227,14 +227,14 @@ checkin_main(int argc, char **argv)
}
if ((pb.username = getlogin()) == NULL)
- fatal("getlogin failed");
+ err(1, "getlogin");
for (i = 0; i < argc; i++) {
pb.filename = argv[i];
if ((workfile_fd = open(pb.filename, O_RDONLY)) == -1)
- fatal("%s: %s", pb.filename, strerror(errno));
+ err(1, "%s", pb.filename);
/*
* Test for existence of ,v file. If we are expected to
@@ -277,7 +277,7 @@ checkin_main(int argc, char **argv)
pb.file = rcs_open(pb.fpath, pb.openflags, pb.fmode);
if (pb.file == NULL)
- fatal("failed to open rcsfile '%s'", pb.fpath);
+ errx(1, "failed to open rcsfile '%s'", pb.fpath);
if (pb.flags & DESCRIPTION)
rcs_set_description(pb.file, pb.description);
@@ -289,7 +289,7 @@ checkin_main(int argc, char **argv)
if (rev_str != NULL)
if ((pb.newrev = rcs_getrevnum(rev_str, pb.file)) ==
NULL)
- fatal("invalid revision: %s", rev_str);
+ errx(1, "invalid revision: %s", rev_str);
if (!(pb.flags & NEWFILE))
pb.flags |= CI_SKIPDESC;
@@ -492,7 +492,7 @@ checkin_update(struct checkin_params *pb)
t_head = localtime(&head_date);
strftime(dbuf2, sizeof(dbuf2), fmt, t_head);
- fatal("%s: Date %s preceeds %s in revision %s.",
+ errx(1, "%s: Date %s preceeds %s in revision %s.",
pb->file->rf_path, dbuf1, dbuf2,
rcsnum_tostr(pb->frev, numb2, sizeof(numb2)));
}
@@ -528,7 +528,7 @@ checkin_update(struct checkin_params *pb)
/* Current head revision gets the RCS patch as rd_text */
if (rcs_deltatext_set(pb->file, pb->frev, pb->deltatext) == -1)
- fatal("failed to set new rd_text for head rev");
+ errx(1, "failed to set new rd_text for head rev");
/* Now add our new revision */
if (rcs_rev_add(pb->file,
@@ -544,13 +544,13 @@ checkin_update(struct checkin_params *pb)
*/
if (pb->newrev != NULL) {
if (rcs_head_set(pb->file, pb->newrev) < 0)
- fatal("rcs_head_set failed");
+ errx(1, "rcs_head_set failed");
} else
pb->newrev = pb->file->rf_head;
/* New head revision has to contain entire file; */
if (rcs_deltatext_set(pb->file, pb->frev, filec) == -1)
- fatal("failed to set new head revision");
+ errx(1, "failed to set new head revision");
/* Attach a symbolic name to this revision if specified. */
if (pb->symbol != NULL &&
@@ -563,7 +563,7 @@ checkin_update(struct checkin_params *pb)
/* Maintain RCSFILE permissions */
if (fstat(workfile_fd, &st) == -1)
- fatal("%s: %s", pb->filename, strerror(errno));
+ err(1, "%s", pb->filename);
/* Strip all the write bits */
pb->file->rf_mode = st.st_mode &
@@ -674,7 +674,7 @@ skipdesc:
*/
if (pb->newrev != NULL) {
if (rcs_head_set(pb->file, pb->newrev) < 0)
- fatal("rcs_head_set failed");
+ errx(1, "rcs_head_set failed");
} else
pb->newrev = pb->file->rf_head;
@@ -695,7 +695,7 @@ skipdesc:
/* Inherit RCSFILE permissions from file being checked in */
if (fstat(workfile_fd, &st) == -1)
- fatal("%s: %s", pb->filename, strerror(errno));
+ err(1, "%s", pb->filename);
/* Strip all the write bits */
pb->file->rf_mode = st.st_mode &
@@ -821,7 +821,7 @@ checkin_mtimedate(struct checkin_params *pb)
struct stat sb;
if (fstat(workfile_fd, &sb) == -1)
- fatal("%s: %s", pb->filename, strerror(errno));
+ err(1, "%s", pb->filename);
pb->date = (time_t)sb.st_mtimespec.tv_sec;
}
@@ -886,7 +886,7 @@ checkin_keywordscan(char *data, RCSNUM **rev, time_t *date, char **author,
if (*c == '$') {
end = c - start + 2;
if (end >= sizeof(buf))
- fatal("keyword buffer"
+ errx(1, "keyword buffer"
" too small!");
strlcpy(buf, start, end);
checkin_parsekeyword(buf, rev,
@@ -968,7 +968,7 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
/* only parse revision if one is not already set */
if (*rev == NULL) {
if ((*rev = rcsnum_parse(tokens[2])) == NULL)
- fatal("could not parse rcsnum");
+ errx(1, "could not parse rcsnum");
}
*author = xstrdup(tokens[5]);
*state = xstrdup(tokens[6]);
@@ -978,7 +978,7 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
strlcat(datestring, " ", len);
strlcat(datestring, tokens[4], len);
if ((*date = cvs_date_parse(datestring)) <= 0)
- fatal("could not parse date\n");
+ errx(1, "could not parse date");
xfree(datestring);
break;
case KW_TYPE_AUTHOR:
@@ -1003,7 +1003,7 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
strlcat(datestring, " ", len);
strlcat(datestring, tokens[2], len);
if ((*date = cvs_date_parse(datestring)) <= 0)
- fatal("could not parse date\n");
+ errx(1, "could not parse date");
xfree(datestring);
break;
case KW_TYPE_STATE:
@@ -1026,7 +1026,7 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
tokens[i++] = p;
}
if ((*rev = rcsnum_parse(tokens[1])) == NULL)
- fatal("could not parse rcsnum");
+ errx(1, "could not parse rcsnum");
break;
}
}
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index daef3867f3a..b07321ba228 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.83 2006/04/24 08:10:41 xsa Exp $ */
+/* $OpenBSD: co.c,v 1.84 2006/04/25 13:36:35 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -119,7 +119,7 @@ checkout_main(int argc, char **argv)
/* if no argument, assume current user */
if (rcs_optarg == NULL) {
if ((author = getlogin()) == NULL)
- fatal("getlogin failed");
+ err(1, "getlogin");
} else {
author = xstrdup(rcs_optarg);
warg = 1;
@@ -149,7 +149,7 @@ checkout_main(int argc, char **argv)
}
if ((username = getlogin()) == NULL)
- fatal("getlogin failed");
+ err(1, "getlogin");
for (i = 0; i < argc; i++) {
if (rcs_statfile(argv[i], fpath, sizeof(fpath), flags) < 0)
@@ -174,13 +174,13 @@ checkout_main(int argc, char **argv)
if (rev_str != NULL) {
if ((rev = rcs_getrevnum(rev_str, file)) == NULL)
- fatal("invalid revision: %s", rev_str);
+ errx(1, "invalid revision: %s", rev_str);
} else {
/* no revisions in RCS file, generate empty 0.0 */
if (file->rf_ndelta == 0) {
rev = rcsnum_parse("0.0");
if (rev == NULL)
- fatal("failed to generate rev 0.0");
+ errx(1, "failed to generate rev 0.0");
} else {
rev = rcsnum_alloc();
rcsnum_cpy(file->rf_head, rev, 0);
@@ -365,7 +365,7 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
* File inherits permissions from its ,v file
*/
if (stat(file->rf_path, &st) == -1)
- fatal("could not stat rcsfile");
+ err(1, "%s", file->rf_path);
mode = st.st_mode;
diff --git a/usr.bin/rcs/rcsclean.c b/usr.bin/rcs/rcsclean.c
index e7a7e51fdb6..c0a9762c811 100644
--- a/usr.bin/rcs/rcsclean.c
+++ b/usr.bin/rcs/rcsclean.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsclean.c,v 1.42 2006/04/25 03:21:16 ray Exp $ */
+/* $OpenBSD: rcsclean.c,v 1.43 2006/04/25 13:36:35 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -93,7 +93,7 @@ rcsclean_main(int argc, char **argv)
argv += rcs_optind;
if ((locker = getlogin()) == NULL)
- fatal("getlogin failed");
+ err(1, "getlogin");
if (argc == 0) {
if ((dirp = opendir(".")) == NULL) {
diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c
index b28f8c28166..d3cc9d20bb3 100644
--- a/usr.bin/rcs/rcsdiff.c
+++ b/usr.bin/rcs/rcsdiff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsdiff.c,v 1.55 2006/04/24 08:40:01 jmc Exp $ */
+/* $OpenBSD: rcsdiff.c,v 1.56 2006/04/25 13:36:35 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -119,11 +119,11 @@ rcsdiff_main(int argc, char **argv)
if (rev_str1 != NULL) {
if ((rev1 = rcs_getrevnum(rev_str1, file)) == NULL)
- fatal("bad revision number");
+ errx(1, "bad revision number");
}
if (rev_str2 != NULL) {
if ((rev2 = rcs_getrevnum(rev_str2, file)) == NULL)
- fatal("bad revision number");
+ errx(1, "bad revision number");
}
if (!(flags & QUIET)) {
diff --git a/usr.bin/rcs/rcsmerge.c b/usr.bin/rcs/rcsmerge.c
index 0819ca30849..e07347ffe3a 100644
--- a/usr.bin/rcs/rcsmerge.c
+++ b/usr.bin/rcs/rcsmerge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsmerge.c,v 1.34 2006/04/25 03:25:42 ray Exp $ */
+/* $OpenBSD: rcsmerge.c,v 1.35 2006/04/25 13:36:35 xsa Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
@@ -127,11 +127,11 @@ rcsmerge_main(int argc, char **argv)
rev1 = rcsnum_alloc();
rcsnum_cpy(file->rf_head, rev1, 0);
} else if ((rev1 = rcs_getrevnum(rev_str1, file)) == NULL)
- fatal("invalid revision: %s", rev_str1);
+ errx(1, "invalid revision: %s", rev_str1);
if (rev_str2 != NULL && strcmp(rev_str2, "") != 0) {
if ((rev2 = rcs_getrevnum(rev_str2, file)) == NULL)
- fatal("invalid revision: %s", rev_str2);
+ errx(1, "invalid revision: %s", rev_str2);
} else {
rev2 = rcsnum_alloc();
rcsnum_cpy(file->rf_head, rev2, 0);
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c
index a15f77ea50c..2e2ccf1bd4c 100644
--- a/usr.bin/rcs/rcsprog.c
+++ b/usr.bin/rcs/rcsprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsprog.c,v 1.114 2006/04/24 08:10:41 xsa Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.115 2006/04/25 13:36:35 xsa Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -404,7 +404,7 @@ rcs_main(int argc, char **argv)
char rev_str[16];
if ((username = getlogin()) == NULL)
- fatal("could not get username");
+ err(1, "getlogin");
if (lrev == NULL) {
rev = rcsnum_alloc();
rcsnum_cpy(file->rf_head, rev, 0);
@@ -416,8 +416,8 @@ rcs_main(int argc, char **argv)
rcsnum_tostr(rev, rev_str, sizeof(rev_str));
/* Make sure revision exists. */
if (rcs_findrev(file, rev) == NULL)
- fatal("%s: can't lock nonexisting revision %s",
- fpath, rev_str);
+ errx(1, "%s: cannot lock nonexisting "
+ "revision %s", fpath, rev_str);
if (rcs_lock_add(file, username, rev) != -1 &&
!(rcsflags & QUIET))
printf("%s locked\n", rev_str);
@@ -430,7 +430,7 @@ rcs_main(int argc, char **argv)
char rev_str[16];
if ((username = getlogin()) == NULL)
- fatal("could not get username");
+ err(1, "getlogin");
if (urev == NULL) {
rev = rcsnum_alloc();
rcsnum_cpy(file->rf_head, rev, 0);
@@ -442,8 +442,8 @@ rcs_main(int argc, char **argv)
rcsnum_tostr(rev, rev_str, sizeof(rev_str));
/* Make sure revision exists. */
if (rcs_findrev(file, rev) == NULL)
- fatal("%s: can't unlock nonexisting revision %s",
- fpath, rev_str);
+ errx(1, "%s: cannot unlock nonexisting "
+ "revision %s", fpath, rev_str);
if (rcs_lock_remove(file, username, rev) == -1 &&
!(rcsflags & QUIET))
warnx("%s: warning: No locks are set.", fpath);
@@ -508,7 +508,7 @@ rcs_attach_symbol(RCSFILE *file, const char *symname)
if (rev == NULL && rm != 1) {
if ((rev = rcsnum_parse(rnum)) == NULL)
- fatal("bad revision %s", rnum);
+ errx(1, "bad revision %s", rnum);
}
if (rcsflags & RCSPROG_NFLAG)
@@ -518,7 +518,7 @@ rcs_attach_symbol(RCSFILE *file, const char *symname)
if (rcs_sym_remove(file, symname) < 0) {
if (rcs_errno == RCS_ERR_NOENT &&
!(rcsflags & RCSPROG_NFLAG))
- warnx("can't delete nonexisting symbol %s",
+ warnx("cannot delete nonexisting symbol %s",
symname);
} else {
if (rcsflags & RCSPROG_NFLAG)
@@ -531,7 +531,7 @@ rcs_attach_symbol(RCSFILE *file, const char *symname)
rcs_errno == RCS_ERR_DUPENT) {
rcsnum_tostr(rcs_sym_getrev(file, symname),
rbuf, sizeof(rbuf));
- fatal("symbolic name %s already bound to %s",
+ errx(1, "symbolic name %s already bound to %s",
symname, rbuf);
}
}
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c
index 2ee29b38499..1e552527654 100644
--- a/usr.bin/rcs/rcsutil.c
+++ b/usr.bin/rcs/rcsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsutil.c,v 1.2 2006/04/24 04:51:57 ray Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.3 2006/04/25 13:36:36 xsa Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -69,7 +69,7 @@ rcs_set_mtime(const char *filename, time_t mtime)
tv[1].tv_sec = tv[0].tv_sec;
if (utimes(filename, tv) == -1)
- fatal("error setting utimes: %s", strerror(errno));
+ err(1, "utimes");
}
int
@@ -259,7 +259,7 @@ rcs_statfile(char *fname, char *out, size_t len, int flags)
char *rcspath;
if ((rcspath = rcs_choosefile(fname)) == NULL)
- fatal("rcs_statfile: path truncation");
+ errx(1, "rcs_statfile: path truncation");
/* Error out if file not found and we are not creating one. */
if (stat(rcspath, &st) == -1 && !(flags & RCS_CREATE)) {
@@ -271,7 +271,7 @@ rcs_statfile(char *fname, char *out, size_t len, int flags)
}
if (strlcpy(out, rcspath, len) >= len)
- fatal("rcs_statfile: path truncation");
+ errx(1, "rcs_statfile: path truncation");
xfree(rcspath);
@@ -285,7 +285,7 @@ void
rcs_set_rev(const char *str, RCSNUM **rev)
{
if (str == NULL || (*rev = rcsnum_parse(str)) == NULL)
- fatal("bad revision number '%s'", str);
+ errx(1, "bad revision number '%s'", str);
}
/*
@@ -315,7 +315,7 @@ rcs_setrevstr2(char **str1, char **str2, char *new_str)
else if (*str2 == NULL)
*str2 = new_str;
else
- fatal("too many revision numbers");
+ errx(1, "too many revision numbers");
}
/*
@@ -398,13 +398,13 @@ rcs_rev_select(RCSFILE *file, char *range)
revrange = cvs_strsplit(revargv->argv[i], ":");
if (revrange->argv[0] == NULL)
/* should not happen */
- fatal("invalid revision range: %s", revargv->argv[i]);
+ errx(1, "invalid revision range: %s", revargv->argv[i]);
else if (revrange->argv[1] == NULL)
lstr = rstr = revrange->argv[0];
else {
if (revrange->argv[2] != NULL)
- fatal("invalid revision range: %s",
- revargv->argv[i]);
+ errx(1, "invalid revision range: %s",
+ revargv->argv[i]);
lstr = revrange->argv[0];
rstr = revrange->argv[1];
if (strcmp(lstr, "") == 0)
@@ -416,11 +416,11 @@ rcs_rev_select(RCSFILE *file, char *range)
if (lstr == NULL)
lstr = RCS_HEAD_INIT;
if (rcsnum_aton(lstr, &ep, &lnum) == 0 || (*ep != '\0'))
- fatal("invalid revision: %s", lstr);
+ errx(1, "invalid revision: %s", lstr);
if (rstr != NULL) {
if (rcsnum_aton(rstr, &ep, &rnum) == 0 || (*ep != '\0'))
- fatal("invalid revision: %s", rstr);
+ errx(1, "invalid revision: %s", rstr);
} else
rcsnum_cpy(file->rf_head, &rnum, 0);
diff --git a/usr.bin/rcs/rlog.c b/usr.bin/rcs/rlog.c
index a4985bafe5b..bbf299d988e 100644
--- a/usr.bin/rcs/rlog.c
+++ b/usr.bin/rcs/rlog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rlog.c,v 1.49 2006/04/21 17:17:29 xsa Exp $ */
+/* $OpenBSD: rlog.c,v 1.50 2006/04/25 13:36:36 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -179,7 +179,7 @@ rlog_file(const char *fname, RCSFILE *file)
nrev = file->rf_ndelta;
if ((workfile = basename(fname)) == NULL)
- fatal("failed to get basename of '%s'", fname);
+ err(1, "basename");
/*
* In case they specified 'foo,v' as argument.
@@ -305,7 +305,7 @@ rlog_rev_print(struct rcs_delta *rdp)
cvs_argv_destroy(wargv);
} else {
if ((author = getlogin()) == NULL)
- fatal("getlogin failed");
+ err(1, "getlogin");
if (strcmp(rdp->rd_author, author) == 0)
found++;