diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-04-12 22:54:24 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-04-12 22:54:24 +0000 |
commit | d3a8754b7435212fe476701cb5846734ab6d7e8d (patch) | |
tree | ef01ff8e3e9a1b8c36ee8c5b12120818cf779a3b /usr.bin/rcs/rcsprog.c | |
parent | 5eb04e5d931bdd4946ed2f1dc1f68dfdbb69d323 (diff) |
Better match GNU behavior for rcs -l and rcs -u.
Save 2 bytes of newlines.
OK joris@
Diffstat (limited to 'usr.bin/rcs/rcsprog.c')
-rw-r--r-- | usr.bin/rcs/rcsprog.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c index 33045e38742..42cb17d6614 100644 --- a/usr.bin/rcs/rcsprog.c +++ b/usr.bin/rcs/rcsprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsprog.c,v 1.97 2006/04/12 08:23:30 ray Exp $ */ +/* $OpenBSD: rcsprog.c,v 1.98 2006/04/12 22:54:23 ray Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -682,6 +682,7 @@ rcs_main(int argc, char **argv) if (rcsflags & RCSPROG_LFLAG) { RCSNUM *rev; const char *username; + char rev_str[16]; if ((username = getlogin()) == NULL) fatal("could not get username"); @@ -693,17 +694,21 @@ rcs_main(int argc, char **argv) rcs_close(file); continue; } + rcsnum_tostr(rev, rev_str, sizeof(rev_str)); /* Make sure revision exists. */ if (rcs_findrev(file, rev) == NULL) - fatal("revision does not exist"); - if (rcs_lock_add(file, username, rev) == -1) - fatal("unable to lock file"); + fatal("%s: can't lock nonexisting revision %s", + fpath, rev_str); + if (rcs_lock_add(file, username, rev) != -1 && + verbose == 1) + printf("%s locked\n", rev_str); rcsnum_free(rev); } if (rcsflags & RCSPROG_UFLAG) { RCSNUM *rev; const char *username; + char rev_str[16]; if ((username = getlogin()) == NULL) fatal("could not get username"); @@ -715,11 +720,15 @@ rcs_main(int argc, char **argv) rcs_close(file); continue; } + rcsnum_tostr(rev, rev_str, sizeof(rev_str)); /* Make sure revision exists. */ if (rcs_findrev(file, rev) == NULL) - fatal("revision does not exist"); - if (rcs_lock_remove(file, username, rev) == -1) - fatal("unable to unlock file"); + fatal("%s: can't unlock nonexisting revision %s", + fpath, rev_str); + if (rcs_lock_remove(file, username, rev) == -1 && + verbose == 1) + cvs_log(LP_ERR, + "%s: warning: No locks are set.", fpath); rcsnum_free(rev); } |