diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2005-12-20 09:04:18 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2005-12-20 09:04:18 +0000 |
commit | cf410d393a2ab94c802e6bf156631635a7a8a783 (patch) | |
tree | 41a6d0053fcc47e9fe33e29400831c9e0a60fd27 | |
parent | 299dea0fbb4b73be7a5131947708d340065da518 (diff) |
spread the use of fatal();
-rw-r--r-- | usr.bin/rcs/ci.c | 56 | ||||
-rw-r--r-- | usr.bin/rcs/rcsdiff.c | 14 |
2 files changed, 22 insertions, 48 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c index 9187df5ffab..ffd189059d5 100644 --- a/usr.bin/rcs/ci.c +++ b/usr.bin/rcs/ci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ci.c,v 1.86 2005/12/19 18:24:12 xsa Exp $ */ +/* $OpenBSD: ci.c,v 1.87 2005/12/20 09:04:17 xsa Exp $ */ /* * Copyright (c) 2005 Niall O'Higgins <niallo@openbsd.org> * All rights reserved. @@ -114,10 +114,8 @@ checkin_main(int argc, char **argv) case 'd': if (rcs_optarg == NULL) pb.date = DATE_MTIME; - else if ((pb.date = cvs_date_parse(rcs_optarg)) <= 0) { - cvs_log(LP_ERR, "invalide date"); - exit(1); - } + else if ((pb.date = cvs_date_parse(rcs_optarg)) <= 0) + fatal("invalid date"); break; case 'f': rcs_set_rev(rcs_optarg, &pb.newrev); @@ -146,29 +144,20 @@ checkin_main(int argc, char **argv) break; case 'm': pb.rcs_msg = rcs_optarg; - if (pb.rcs_msg == NULL) { - cvs_log(LP_ERR, - "missing message for -m option"); - exit(1); - } + if (pb.rcs_msg == NULL) + fatal("missing message for -m option"); pb.flags &= ~INTERACTIVE; break; case 'N': pb.symbol = xstrdup(rcs_optarg); - if (rcs_sym_check(pb.symbol) != 1) { - cvs_log(LP_ERR, "invalid symbol `%s'", - pb.symbol); - exit(1); - } + if (rcs_sym_check(pb.symbol) != 1) + fatal("invalid symbol `%s'", pb.symbol); pb.flags |= CI_SYMFORCE; break; case 'n': pb.symbol = xstrdup(rcs_optarg); - if (rcs_sym_check(pb.symbol) != 1) { - cvs_log(LP_ERR, "invalid symbol `%s'", - pb.symbol); - exit(1); - } + if (rcs_sym_check(pb.symbol) != 1) + fatal("invalid symbol `%s'", pb.symbol); break; case 'q': verbose = 0; @@ -179,11 +168,8 @@ checkin_main(int argc, char **argv) break; case 's': pb.state = rcs_optarg; - if (rcs_state_check(pb.state) < 0) { - cvs_log(LP_ERR, "invalid state `%s'", - pb.state); - exit(1); - } + if (rcs_state_check(pb.state) < 0) + fatal("invalid state `%s'", pb.state); break; case 'T': pb.flags |= PRESERVETIME; @@ -262,11 +248,8 @@ checkin_main(int argc, char **argv) pb.file = rcs_open(pb.fpath, pb.openflags, pb.fmode); - if (pb.file == NULL) { - cvs_log(LP_ERR, "failed to open rcsfile '%s'", - pb.fpath); - exit(1); - } + if (pb.file == NULL) + fatal("failed to open rcsfile '%s'", pb.fpath); if (verbose == 1) printf("%s <-- %s\n", pb.fpath, pb.filename); @@ -498,11 +481,8 @@ 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) { - cvs_log(LP_ERR, - "failed to set new rd_text for head rev"); - exit (1); - } + if (rcs_deltatext_set(pb->file, pb->frev, pb->deltatext) == -1) + fatal("failed to set new rd_text for head rev"); /* * Set the date of the revision to be the last modification @@ -530,10 +510,8 @@ checkin_update(struct checkin_params *pb) pb->newrev = pb->file->rf_head; /* New head revision has to contain entire file; */ - if (rcs_deltatext_set(pb->file, pb->frev, filec) == -1) { - cvs_log(LP_ERR, "failed to set new head revision"); - exit(1); - } + if (rcs_deltatext_set(pb->file, pb->frev, filec) == -1) + fatal("failed to set new head revision"); /* Attach a symbolic name to this revision if specified. */ if (pb->symbol != NULL diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c index 7af6398d1d0..ad19ddc1a8c 100644 --- a/usr.bin/rcs/rcsdiff.c +++ b/usr.bin/rcs/rcsdiff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsdiff.c,v 1.26 2005/12/10 19:44:36 niallo Exp $ */ +/* $OpenBSD: rcsdiff.c,v 1.27 2005/12/20 09:04:17 xsa Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -84,15 +84,11 @@ rcsdiff_main(int argc, char **argv) break; case 'r': if (rev == RCS_HEAD_REV) { - if ((rev = rcsnum_parse(rcs_optarg)) == NULL) { - cvs_log(LP_ERR, "bad revision number"); - exit(1); - } + if ((rev = rcsnum_parse(rcs_optarg)) == NULL) + fatal("bad revision number"); } else { - if ((rev2 = rcsnum_parse(rcs_optarg)) == NULL) { - cvs_log(LP_ERR, "bad revision number"); - exit(1); - } + if ((rev2 = rcsnum_parse(rcs_optarg)) == NULL) + fatal("bad revision number"); } break; case 'T': |