diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1997-09-16 10:13:30 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1997-09-16 10:13:30 -0400 |
commit | dc9e683bddf52e0720f5e74e3349533c9ee9f97a (patch) | |
tree | ba548b81f3f18d9aa1d2afa22ef2e1f3f145656e /src | |
parent | 2f5222ea2a4d549b4f269c11d34016fc7dc58dde (diff) | |
download | lynx-snapshots-dc9e683bddf52e0720f5e74e3349533c9ee9f97a.tar.gz |
snapshot of project "lynx", label v2-7-1ac_0-67
Diffstat (limited to 'src')
-rw-r--r-- | src/LYLocal.c | 11 | ||||
-rw-r--r-- | src/LYStrings.c | 17 | ||||
-rw-r--r-- | src/LYUtils.c | 97 |
3 files changed, 99 insertions, 26 deletions
diff --git a/src/LYLocal.c b/src/LYLocal.c index 2865603a..98f29ce4 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -2228,7 +2228,16 @@ PUBLIC int LYExecv ARGS3( while (wait(&wstatus) != pid) ; /* do nothing */ #else - waitpid(pid, &wstatus, 0); /* wait for child */ + while (-1 == waitpid (pid, &wstatus, 0)) /* wait for child */ + { +#ifdef EINTR + if (errno == EINTR) continue; +#endif +#ifdef ERESTARTSYS + if (errno == ERESTARTSYS) continue; +#endif + break; + } #endif if (WEXITSTATUS(wstatus) != 0 || WTERMSIG(wstatus) > 0) { /* error return */ diff --git a/src/LYStrings.c b/src/LYStrings.c index 03bef9af..aac67203 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -207,15 +207,19 @@ PUBLIC int LYmbcsstrlen ARGS2( #define GetChar() wgetch(stdscr) #endif -#if !defined(GetChar) -#ifdef VMS +#if !defined(GetChar) && defined(VMS) #define GetChar() ttgetc() +#endif + +#if !defined(GetChar) +#ifdef HAVE_KEYPAD +#define GetChar getch #else #ifndef USE_GETCHAR #define USE_GETCHAR #endif /* !USE_GETCHAR */ #define GetChar() getchar() /* used to be "getc(stdin)" and "getch()" */ -#endif /* VMS */ +#endif /* HAVE_KEYPAD */ #endif /* !defined(GetChar) */ #if defined(NCURSES) @@ -281,7 +285,7 @@ PUBLIC int LYgetch NOARGS { int a, b, c, d = -1; -#if defined(IGNORE_CTRL_C) || defined(USE_GETCHAR) +#if defined(IGNORE_CTRL_C) || defined(USE_GETCHAR) || !defined(NCURSES) re_read: #endif /* IGNORE_CTRL_C || USE_GETCHAR */ #ifndef USE_SLANG @@ -346,6 +350,11 @@ re_read: goto re_read; } #endif /* IGNORE_CTRL_C */ +#if !defined(USE_GETCHAR) && !defined(VMS) && !defined(NCURSES) + if (c == ERR && errno == EINTR) /* may have been handled signal - kw */ + goto re_read; +#endif /* USE_GETCHAR */ + cleanup(); #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_DFL); diff --git a/src/LYUtils.c b/src/LYUtils.c index d95a0635..388d6adb 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -3895,6 +3895,7 @@ have_VMS_URL: * Create a full path to the current default directory. */ char curdir[DIRNAMESIZE]; + char *temp2 = NULL; BOOL is_local = FALSE; #if HAVE_GETCWD getcwd (curdir, DIRNAMESIZE); @@ -3910,13 +3911,16 @@ have_VMS_URL: StrAllocCat(temp, "/"); StrAllocCat(temp, old_string); #else - if (old_string[1] != ':' && old_string[1] != '|') - { - StrAllocCopy(temp, HTDOS_wwwName(curdir)); - if(curdir[strlen(curdir)-1] != '/') - StrAllocCat(temp, "/"); - StrAllocCat(temp, old_string); - } else StrAllocCopy(temp, old_string); + if (old_string[1] != ':' && old_string[1] != '|') { + StrAllocCopy(temp, HTDOS_wwwName(curdir)); + if(curdir[strlen(curdir)-1] != '/') + StrAllocCat(temp, "/"); + LYstrncpy(curdir, temp, (DIRNAMESIZE - 1)); + StrAllocCat(temp, old_string); + } else { + curdir[0] = '\0'; + StrAllocCopy(temp, old_string); + } #endif /* DOSPATH */ LYTrimRelFromAbsPath(temp); if (TRACE) { @@ -3936,33 +3940,82 @@ have_VMS_URL: } is_local = TRUE; } else { - if ((fragment = strchr(temp, '#')) != NULL) - *fragment = '\0'; - StrAllocCopy(cp, temp); - HTUnEscape(cp); - if ((stat(cp, &st) > -1) || - (fptemp = fopen(cp, "r")) != NULL) { + char *cp2 = NULL; + StrAllocCopy(temp2, curdir); + if (curdir[0] != '\0' && curdir[strlen(curdir)-1] != '/') + StrAllocCat(temp2, "/"); + StrAllocCopy(cp, old_string); + if ((fragment = strchr(cp, '#')) != NULL) + *fragment = '\0'; /* keep as pointer into cp string */ + HTUnEscape(cp); /* unescape given path without fragment */ + StrAllocCat(temp2, cp); /* append to current dir */ + StrAllocCopy(cp2, temp2); /* keep a copy in cp2 */ + LYTrimRelFromAbsPath(temp2); + + if (strcmp(temp2, temp) != 0 && + ((stat(temp2, &st) > -1) || + (fptemp = fopen(temp2, "r")) != NULL)) { /* * It is a subdirectory or file on the local system * with escaped characters and/or a fragment to be * appended to the URL. - FM */ - if (fragment != NULL) { - *fragment = '#'; - fragment = NULL; + + FREE(temp); + if (strcmp(cp2, temp2) == 0) { + /* + * LYTrimRelFromAbsPath did nothing, use + * old_string as given. - kw + */ + temp = HTEscape(curdir, URL_PATH); + if (curdir[0] != '\0' && curdir[strlen(curdir)-1] != '/') + StrAllocCat(temp, "/"); + StrAllocCat(temp, old_string); + } else { + temp = HTEscape(temp2, URL_PATH); + if (fragment != NULL) { + *fragment = '#'; + StrAllocCat(temp, fragment); + } } + StrAllocCat(*AllocatedString, temp); if (TRACE) { fprintf(stderr, "Converted '%s' to '%s'\n", old_string, *AllocatedString); } is_local = TRUE; + + } else if (strchr(curdir, '#') != NULL || + strchr(curdir, '%') != NULL) { + /* + * If PWD has some unusual characters, construct a + * filename in temp where those are escaped. This + * is mostly to prevent this function from returning + * with some weird URL if the LYExpandHostForURL tests + * further down fail. - kw + */ + FREE(temp); + if (strcmp(cp2, temp2) == 0) { + /* + * LYTrimRelFromAbsPath did nothing, use + * old_string as given. - kw + */ + temp = HTEscape(curdir, URL_PATH); + if (curdir[0] != '\0' && curdir[strlen(curdir)-1] != '/') + StrAllocCat(temp, "/"); + StrAllocCat(temp, old_string); + } else { + temp = HTEscape(temp2, URL_PATH); + if (fragment != NULL) { + *fragment = '#'; + StrAllocCat(temp, fragment); + } + } } + FREE(cp); - if (fragment != NULL) { - *fragment = '#'; - fragment = NULL; - } + FREE(cp2); } if (is_local == FALSE) { /* @@ -3971,7 +4024,8 @@ have_VMS_URL: * the scheme with "http://" as the default. */ if (TRACE) { - fprintf(stderr, "Can't stat() or fopen() '%s'\n", temp); + fprintf(stderr, "Can't stat() or fopen() '%s'\n", + temp2 ? temp2 : temp); } if (LYExpandHostForURL((char **)&old_string, URLDomainPrefixes, @@ -3990,6 +4044,7 @@ have_VMS_URL: } } FREE(temp); + FREE(temp2); if (fptemp) { fclose(fptemp); fptemp = NULL; |