diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2005-04-12 14:58:41 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2005-04-12 14:58:41 +0000 |
commit | 4b03ee4a3e530b1453fb0907ac8166baf63bf053 (patch) | |
tree | 0dc798db78780d1cd2e362c04dbcd0e8f3ae7f47 /usr.bin/cvs/cvs.c | |
parent | 77e328103b64f6514f65aa663caf3bee705dae4d (diff) |
introduce our own set of error codes used by the commands to report
what exactly went wrong in case of an error.
ok jfb@
Diffstat (limited to 'usr.bin/cvs/cvs.c')
-rw-r--r-- | usr.bin/cvs/cvs.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c index 87395a29a73..30045990316 100644 --- a/usr.bin/cvs/cvs.c +++ b/usr.bin/cvs/cvs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.c,v 1.50 2005/04/11 18:02:58 joris Exp $ */ +/* $OpenBSD: cvs.c,v 1.51 2005/04/12 14:58:40 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -421,11 +421,30 @@ main(int argc, char **argv) cmd_argv[cmd_argc++] = argv[ret]; ret = cvs_startcmd(cmdp, cmd_argc, cmd_argv); - if (ret == 1) { - fprintf(stderr, "Usage: %s %s %s\n", __progname, cvs_command, - cmdp->cmd_synopsis); + if (ret > 0) + fprintf(stderr, "%s [%s aborted]: ", __progname, cvs_command); + + switch (ret) { + case CVS_EX_USAGE: + fprintf(stderr, "Usage: %s", cmdp->cmd_synopsis); + break; + case CVS_EX_DATA: + fprintf(stderr, "internal data error"); + break; + case CVS_EX_PROTO: + fprintf(stderr, "protocol error"); + break; + case CVS_EX_FILE: + fprintf(stderr, "an operation on a file or directory failed"); + break; + default: + fprintf(stderr, "unknown error"); + break; } + if (ret > 0) + fprintf(stderr, "\n"); + if (cmdp->cmd_info->cmd_cleanup != NULL) cmdp->cmd_info->cmd_cleanup(); if (cvs_files != NULL) |