diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-11-10 10:15:54 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-11-10 10:15:54 +0100 |
commit | aac8728afe3b5580c44689c28bd439131dd48453 (patch) | |
tree | 47c8421f475c160ccc51cd511e27877e1af82abd /src/libopts/makeshell.c | |
parent | b723eb193fa30dc337cfb12f579e802a13ffee60 (diff) | |
download | gnutls-aac8728afe3b5580c44689c28bd439131dd48453.tar.gz |
updated libopts
Diffstat (limited to 'src/libopts/makeshell.c')
-rw-r--r-- | src/libopts/makeshell.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/libopts/makeshell.c b/src/libopts/makeshell.c index f22e9f0b84..d65a8b372e 100644 --- a/src/libopts/makeshell.c +++ b/src/libopts/makeshell.c @@ -30,13 +30,6 @@ * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ -tOptions * optionParseShellOptions = NULL; - -static char const * shell_prog = NULL; -static char * script_leader = NULL; -static char * script_trailer = NULL; -static char * script_text = NULL; - /* = = = START-STATIC-FORWARD = = = */ static void emit_var_text(char const * prog, char const * var, int fdin); @@ -76,6 +69,21 @@ open_out(char const * fname, char const * pname); /* = = = END-STATIC-FORWARD = = = */ LOCAL void +option_exits(int exit_code) +{ + if (print_exit) + printf("\nexit %d\n", exit_code); + exit(exit_code); +} + +LOCAL void +ao_bug(char const * msg) +{ + fprintf(stderr, zao_bug_msg, msg); + option_exits(EX_SOFTWARE); +} + +LOCAL void fserr_warn(char const * prog, char const * op, char const * fname) { fprintf(stderr, zfserr_fmt, prog, errno, strerror(errno), @@ -86,7 +94,7 @@ LOCAL void fserr_exit(char const * prog, char const * op, char const * fname) { fserr_warn(prog, op, fname); - exit(EXIT_FAILURE); + option_exits(EXIT_FAILURE); } /*=export_func optionParseShell @@ -325,7 +333,7 @@ text_to_var(tOptions * opts, teTextTo which, tOptDesc * od) /* NOTREACHED */ default: - exit(EXIT_FAILURE); + option_exits(EXIT_FAILURE); /* NOTREACHED */ } /* NOTREACHED */ @@ -862,7 +870,7 @@ genshelloptUsage(tOptions * opts, int exit_cd) fflush(stderr); fflush(stdout); if (ferror(stdout) || ferror(stderr)) - exit(EXIT_FAILURE); + option_exits(EXIT_FAILURE); option_usage_fp = stdout; @@ -929,7 +937,7 @@ genshelloptUsage(tOptions * opts, int exit_cd) if (ferror(stdout)) fserr_exit(opts->pzProgName, zwriting, zstdout_name); - exit(EXIT_SUCCESS); + option_exits(EXIT_SUCCESS); #endif } |