w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 934b7f5a0c06ca8c21e076bd18c65b269915836d
parent 58318b130011f073d20ef94558c6ad75dfea85e2
Author: htrb <htrb>
Date:   Fri, 20 Aug 2010 09:34:47 +0000

exit code is 1 when an error is occured

Diffstat:
MChangeLog | 8++++++++
Mterms.c | 32++++++++++++++++++++++----------
2 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,11 @@ +2010-08-20 Ito Hiroyuki <ZXB01226@nifty.com> + + * [w3m-dev 04402] Re: "normal" bugs from bugs.debian.org + * terms.c (reset_exit_with_value, reset_error_exit): added + (reset_exit): use reset_exit_with_value() + (ttymode_set, ttymode_reset, set_cc, getTCstr) + (sleep_till_anykey): use reset_error_exit() instead of reset_exit() + 2010-08-14 "Adam C. Emerson" <azure@azureprime.com> * [w3m-dev 04390] diff --git a/terms.c b/terms.c @@ -256,7 +256,7 @@ check_cygwin_console(void) #endif /* __CYGWIN__ */ char *getenv(const char *); -MySignalHandler reset_exit(SIGNAL_ARG), error_dump(SIGNAL_ARG); +MySignalHandler reset_exit(SIGNAL_ARG), reset_error_exit(SIGNAL_ARG), error_dump(SIGNAL_ARG); void setlinescols(void); void flush_tty(); @@ -564,7 +564,7 @@ ttymode_set(int mode, int imode) if (errno == EINTR || errno == EAGAIN) continue; printf("Error occured while set %x: errno=%d\n", mode, errno); - reset_exit(SIGNAL_ARGLIST); + reset_error_exit(SIGNAL_ARGLIST); } #endif } @@ -585,7 +585,7 @@ ttymode_reset(int mode, int imode) if (errno == EINTR || errno == EAGAIN) continue; printf("Error occured while reset %x: errno=%d\n", mode, errno); - reset_exit(SIGNAL_ARGLIST); + reset_error_exit(SIGNAL_ARGLIST); } #endif /* __MINGW32_VERSION */ } @@ -602,7 +602,7 @@ set_cc(int spec, int val) if (errno == EINTR || errno == EAGAIN) continue; printf("Error occured: errno=%d\n", errno); - reset_exit(SIGNAL_ARGLIST); + reset_error_exit(SIGNAL_ARGLIST); } } #endif /* not HAVE_SGTTY_H */ @@ -637,19 +637,31 @@ reset_tty(void) close_tty(); } -MySignalHandler -reset_exit(SIGNAL_ARG) +static MySignalHandler +reset_exit_with_value(SIGNAL_ARG, int rval) { #ifdef USE_MOUSE if (mouseActive) mouse_end(); #endif /* USE_MOUSE */ reset_tty(); - w3m_exit(0); + w3m_exit(rval); SIGNAL_RETURN; } MySignalHandler +reset_error_exit(SIGNAL_ARG) +{ + reset_exit_with_value(SIGNAL_ARGLIST, 1); +} + +MySignalHandler +reset_exit(SIGNAL_ARG) +{ + reset_exit_with_value(SIGNAL_ARGLIST, 0); +} + +MySignalHandler error_dump(SIGNAL_ARG) { mySignal(SIGIOT, SIG_DFL); @@ -708,14 +720,14 @@ getTCstr(void) ent = getenv("TERM") ? getenv("TERM") : DEFAULT_TERM; if (ent == NULL) { fprintf(stderr, "TERM is not set\n"); - reset_exit(SIGNAL_ARGLIST); + reset_error_exit(SIGNAL_ARGLIST); } r = tgetent(bp, ent); if (r != 1) { /* Can't find termcap entry */ fprintf(stderr, "Can't find termcap entry %s\n", ent); - reset_exit(SIGNAL_ARGLIST); + reset_error_exit(SIGNAL_ARGLIST); } GETSTR(T_ce, "ce"); /* clear to the end of line */ @@ -2008,7 +2020,7 @@ sleep_till_anykey(int sec, int purge) er = TerminalSet(tty, &ioval); if (er == -1) { printf("Error occured: errno=%d\n", errno); - reset_exit(SIGNAL_ARGLIST); + reset_error_exit(SIGNAL_ARGLIST); } return ret; }