diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2007-04-29 20:52:12 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2007-04-29 20:52:12 -0400 |
commit | 89168f60aa971ea8290d91e05557c7a21cdb22f1 (patch) | |
tree | e9c0b951a9c833d8949c542f7574f0f534ac1355 /src | |
parent | 8759afbc0bd7e698baeab1cfb8e8bf3f3df96653 (diff) | |
download | lynx-snapshots-89168f60aa971ea8290d91e05557c7a21cdb22f1.tar.gz |
snapshot of project "lynx", label v2-8-7dev_4b
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 16 | ||||
-rw-r--r-- | src/HTAlert.c | 12 | ||||
-rw-r--r-- | src/HTAlert.h | 1 | ||||
-rw-r--r-- | src/HTFWriter.c | 4 | ||||
-rw-r--r-- | src/HTML.c | 4 | ||||
-rw-r--r-- | src/LYEdit.c | 24 | ||||
-rw-r--r-- | src/LYMain.c | 41 | ||||
-rw-r--r-- | src/LYUtils.c | 40 | ||||
-rw-r--r-- | src/UCAuto.c | 8 | ||||
-rw-r--r-- | src/UCdomap.c | 4 |
10 files changed, 109 insertions, 45 deletions
diff --git a/src/GridText.c b/src/GridText.c index c99011f5..fb455a71 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -8392,19 +8392,15 @@ void www_user_search(int start_line, void user_message(const char *message, const char *argument) { - char *temp = NULL; - if (message == NULL) { mustshow = FALSE; - return; - } - - HTSprintf0(&temp, message, NonNull(argument)); - - statusline(temp); + } else { + char *temp = NULL; - FREE(temp); - return; + HTSprintf0(&temp, message, NonNull(argument)); + statusline(temp); + FREE(temp); + } } /* diff --git a/src/HTAlert.c b/src/HTAlert.c index 2c59b206..ca29076e 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -98,6 +98,18 @@ void HTInfoMsg(const char *Msg) } } +void HTInfoMsg2(const char *Msg2, const char *Arg) +{ + _user_message(Msg2, Arg); + if (non_empty(Msg2)) { + CTRACE((tfp, "Info message: ")); + CTRACE((tfp, Msg2, Arg)); + CTRACE((tfp, "\n")); + LYstore_message2(Msg2, Arg); + LYSleepInfo(); + } +} + /* Issue an important message. HTUserMsg() * -------------------------------- */ diff --git a/src/HTAlert.h b/src/HTAlert.h index 89f60e26..f3134530 100644 --- a/src/HTAlert.h +++ b/src/HTAlert.h @@ -31,6 +31,7 @@ extern "C" { extern void HTAlert(const char *Msg); extern void HTAlwaysAlert(const char *extra_prefix, const char *Msg); extern void HTInfoMsg(const char *Msg); + extern void HTInfoMsg2(const char *Msg, const char *Arg); extern void HTUserMsg(const char *Msg); extern void HTUserMsg2(const char *Msg, const char *Arg); diff --git a/src/HTFWriter.c b/src/HTFWriter.c index 21c3374e..755425b2 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -315,7 +315,7 @@ static void HTFWriter_free(HTStream *me) /* * Tell user what's happening. - FM */ - HTUserMsg2(WWW_USING_MESSAGE, addr); + HTInfoMsg2(WWW_USING_MESSAGE, addr); } if (skip_loadfile) { @@ -873,7 +873,7 @@ HTStream *HTSaveToFile(HTPresentation *pres, * to help sort that out later. Unix folks don't need to know this, but * we'll show it to them, too. - FM */ - HTUserMsg2(CONTENT_TYPE_MSG, pres->rep->name); + HTInfoMsg2(CONTENT_TYPE_MSG, pres->rep->name); StrAllocCopy(WWW_Download_File, fnam); diff --git a/src/HTML.c b/src/HTML.c index f70bc147..80112b9d 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -2194,7 +2194,7 @@ static int HTML_start_element(HTStructured * me, int element_number, } break; - case HTML_ABBREV: /* Miscellaneous character containers */ + case HTML_ABBR: /* Miscellaneous character containers */ case HTML_ACRONYM: case HTML_AU: case HTML_AUTHOR: @@ -6104,7 +6104,7 @@ static int HTML_end_element(HTStructured * me, int element_number, } break; - case HTML_ABBREV: /* Miscellaneous character containers */ + case HTML_ABBR: /* Miscellaneous character containers */ case HTML_ACRONYM: case HTML_AU: case HTML_AUTHOR: diff --git a/src/LYEdit.c b/src/LYEdit.c index 12a01d35..3b09bd1e 100644 --- a/src/LYEdit.c +++ b/src/LYEdit.c @@ -10,6 +10,7 @@ #endif /* VMS */ #include <LYLeaks.h> +#include <www_wait.h> BOOLEAN editor_can_position(void) { @@ -242,18 +243,25 @@ void edit_temporary_file(char *filename, */ { #ifdef UNIX - int rvhi = (rv >> 8); + int save_err = errno; CTRACE((tfp, "ExtEditForm: system() returned %d (0x%x), %s\n", - rv, rv, errno ? LYStrerror(errno) : "reason unknown")); + rv, rv, + (save_err + ? LYStrerror(save_err) + : "reason unknown"))); LYFixCursesOn("show error warning:"); - if (rv != -1 && (rv && 0xff) && !rvhi) { + if (rv == -1) { + HTUserMsg2(gettext("Error starting editor, %s"), + LYStrerror(save_err)); + } else if (WIFSIGNALED(rv)) { HTAlwaysAlert(NULL, gettext("Editor killed by signal")); - } else if (!(rv == -1 || (rvhi == 127 && errno))) { - HTUserMsg2(gettext("Editor returned with error status, %s"), - (errno - ? LYStrerror(errno) - : gettext("reason unknown."))); + } else if (WIFEXITED(rv) && WEXITSTATUS(rv) != 127) { + char exitcode[80]; + + sprintf(exitcode, "%d", WEXITSTATUS(rv)); + HTUserMsg2(gettext("Editor returned with error status %s"), + exitcode); } else #endif HTAlwaysAlert(NULL, ERROR_SPAWNING_EDITOR); diff --git a/src/LYMain.c b/src/LYMain.c index ff13d362..878b64ab 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -1605,6 +1605,33 @@ int main(int argc, } LYStdinArgs_free(); } +#ifdef HAVE_TTYNAME + /* + * If the input is not a tty, we are either running in cron, or are + * getting input via a pipe: + * + * a) in cron, none of stdin/stdout/stderr are tty's. + * b) from a pipe, we should have either "-" or "-stdin" options. + */ + if (!LYGetStdinArgs + && !startfile_stdin + && !isatty(fileno(stdin)) + && (isatty(fileno(stdout) || isatty(fileno(stderr))))) { + int ignored = 0; + int ch; + + while ((ch = fgetc(stdin)) != EOF) { + ++ignored; + } + if (ignored) { + fprintf(stderr, + gettext("Ignored %d characters from standard input.\n"), ignored); + fprintf(stderr, + gettext("Use \"-stdin\" or \"-\" to tell how to handle piped input.\n")); + } + } +#endif /* HAVE_TTYNAME */ + #ifdef CAN_SWITCH_DISPLAY_CHARSET if (current_char_set == auto_display_charset) /* Better: explicit option */ switch_display_charsets = 1; @@ -2276,20 +2303,6 @@ void reload_read_cfg(void) init_charset_subsets(); #endif - /* We are not interested in startfile here */ - /* but other things may be lost: */ - - /* - * Process any command line arguments not already handled. - */ - /* Not implemented yet here */ - - /* - * Process any stdin-derived arguments for a lone "-" which we've - * loaded into LYStdinArgs. - */ - /* Not implemented yet here */ - /* * Initialize other things based on the configuration read. */ diff --git a/src/LYUtils.c b/src/LYUtils.c index 07802c20..8d5cca02 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -5866,6 +5866,34 @@ int remove(char *name) #endif #if defined(MULTI_USER_UNIX) + +#if defined(HAVE_LSTAT) && defined(S_IFLNK) +/* + * If IsOurFile() is checking a symbolic link, ensure that the target + * points to the user's file as well. + */ +static BOOL IsOurSymlink(const char *name) +{ + BOOL result = FALSE; + int size = LY_MAXPATH; + char *buffer = malloc(size); + + if (buffer != 0) { + while (readlink(name, buffer, size) == -1) { + buffer = realloc(buffer, size *= 2); + if (buffer == 0) + break; + } + } + if (buffer != 0) { + CTRACE2(TRACE_CFG, (tfp, "IsOurSymlink(%s -> %s)\n", name, buffer)); + result = IsOurFile(buffer); + FREE(buffer); + } + return result; +} +#endif + /* * Verify if this is really a file, not accessed by a link, except for the * special case of its directory being pointed to by a link from a directory @@ -5878,10 +5906,14 @@ BOOL IsOurFile(const char *name) if (!LYIsTilde(name[0]) && lstat(name, &data) == 0 - && S_ISREG(data.st_mode) - && (data.st_mode & (S_IWOTH | S_IWGRP)) == 0 - && data.st_nlink == 1 - && data.st_uid == getuid()) { + && ((S_ISREG(data.st_mode) + && (data.st_mode & (S_IWOTH | S_IWGRP)) == 0 + && data.st_nlink == 1 + && data.st_uid == getuid()) +#if defined(HAVE_LSTAT) && defined(S_IFLNK) + || (S_ISLNK(data.st_mode) && IsOurSymlink(name)) +#endif + )) { int linked = FALSE; /* diff --git a/src/UCAuto.c b/src/UCAuto.c index 5898c212..26d6bda8 100644 --- a/src/UCAuto.c +++ b/src/UCAuto.c @@ -172,9 +172,11 @@ static int call_setfont(const char *font, if (rv) { CTRACE((tfp, "call_setfont: system returned %d (0x%x)!\n", rv, rv)); - if ((rv == (EX_DATAERR << 8) || - rv == (EX_NOINPUT << 8)) && - non_empty(umap)) { + if (rv == -1 || WIFSIGNALED(rv) || !WIFEXITED(rv)) { + return -1; + } else if ((WEXITSTATUS(rv) == EX_DATAERR || + WEXITSTATUS(rv) == EX_NOINPUT) && + non_empty(umap)) { /* * Check if the font was loaded ok but something was wrong with * the umap file. diff --git a/src/UCdomap.c b/src/UCdomap.c index 6f9c8538..bb2204e5 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -951,8 +951,8 @@ int UCTransUniCharStr(char *outbuf, pout = outbuf, outleft = buflen; HTSprintf0(&tocode, "%s//TRANSLIT", LYCharSet_UC[charset_out].MIMEname); cd = iconv_open(tocode, "UTF-16BE"); - FREE(tocode) - rc = iconv(cd, &pin, &inleft, &pout, &outleft); + FREE(tocode); + rc = iconv(cd, &pin, &inleft, &pout, &outleft); iconv_close(cd); if ((pout - outbuf) == 3) { CTRACE((tfp, |