diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2009-05-25 01:12:45 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2009-05-25 01:12:45 -0400 |
commit | 187fb5330e6223a7c4945ab1f522e254d04b8f57 (patch) | |
tree | 230381c86a3cef009255e678ba87b70e440415c0 /src | |
parent | 097b356f6a8fa667d38dd10bb3bca016a7cc4f03 (diff) | |
download | lynx-snapshots-187fb5330e6223a7c4945ab1f522e254d04b8f57.tar.gz |
snapshot of project "lynx", label v2-8-7pre_2c
Diffstat (limited to 'src')
-rw-r--r-- | src/LYPrint.c | 16 | ||||
-rw-r--r-- | src/LYUtils.c | 121 |
2 files changed, 75 insertions, 62 deletions
diff --git a/src/LYPrint.c b/src/LYPrint.c index bd881f79..f6dd409d 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -1,4 +1,6 @@ -/* $LynxId: LYPrint.c,v 1.84 2007/07/01 23:39:36 Andrew.Belov Exp $ */ +/* + * $LynxId: LYPrint.c,v 1.85 2009/05/24 22:28:27 tom Exp $ + */ #include <HTUtils.h> #include <HTAccess.h> #include <HTList.h> @@ -288,7 +290,8 @@ static BOOLEAN confirm_by_pages(const char *prompt, return TRUE; } -static void send_file_to_file(DocInfo *newdoc, char *content_base, +static void send_file_to_file(DocInfo *newdoc, + char *content_base, char *sug_filename) { BOOLEAN FirstRecall = TRUE; @@ -458,7 +461,8 @@ static void send_file_to_file(DocInfo *newdoc, char *content_base, return; } -static void send_file_to_mail(DocInfo *newdoc, char *content_base, +static void send_file_to_mail(DocInfo *newdoc, + char *content_base, char *content_location) { static BOOLEAN first_mail_preparsed = TRUE; @@ -783,7 +787,8 @@ static void send_file_to_mail(DocInfo *newdoc, char *content_base, return; } -static void send_file_to_printer(DocInfo *newdoc, char *content_base, +static void send_file_to_printer(DocInfo *newdoc, + char *content_base, char *sug_filename, int printer_number) { @@ -945,7 +950,8 @@ static void send_file_to_printer(DocInfo *newdoc, char *content_base, return; } -static void send_file_to_screen(DocInfo *newdoc, char *content_base, +static void send_file_to_screen(DocInfo *newdoc, + char *content_base, BOOLEAN Lpansi) { FILE *outfile_fp; diff --git a/src/LYUtils.c b/src/LYUtils.c index c9688d90..171c61ca 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYUtils.c,v 1.184 2009/04/09 20:33:31 tom Exp $ + * $LynxId: LYUtils.c,v 1.185 2009/05/24 22:17:03 tom Exp $ */ #include <HTUtils.h> #include <HTTCP.h> @@ -6602,8 +6602,9 @@ const char *wwwName(const char *pathname) BOOLEAN LYValidateFilename(char *result, char *given) { - char *cp; - const char *cp2; + BOOLEAN code = TRUE; + char *cp = NULL; + const char *cp2 = NULL; /* * Cancel if the user entered "/dev/null" on Unix, or an "nl:" path on VMS. @@ -6611,78 +6612,84 @@ BOOLEAN LYValidateFilename(char *result, */ if (LYIsNullDevice(given)) { /* just ignore it */ - return FALSE; - } + code = FALSE; #ifdef HAVE_POPEN - if (LYIsPipeCommand(given)) { + } else if (LYIsPipeCommand(given)) { if (no_shell) { HTUserMsg(SPAWNING_DISABLED); - return FALSE; + code = FALSE; + } else { + LYstrncpy(result, given, LY_MAXPATH); } - LYstrncpy(result, given, LY_MAXPATH); - return TRUE; - } #endif - if ((cp = FindLeadingTilde(given, TRUE)) != given - && (cp2 = wwwName(Home_Dir())) != 0 - && strlen(cp2) + strlen(given) < LY_MAXPATH) { - *(cp++) = '\0'; - strcpy(result, given); - LYTrimPathSep(result); - strcat(result, cp2); - strcat(result, cp); - strcpy(given, result); - } -#ifdef VMS - if (strchr(given, '/') != NULL) { - strcpy(result, HTVMS_name("", given)); - strcpy(given, result); - } - if (given[0] != '/' - && strchr(given, ':') == NULL - && strlen(given) < LY_MAXPATH - 13) { - strcpy(result, "sys$disk:"); - if (strchr(given, ']') == NULL) - strcat(result, "[]"); - strcat(result, given); } else { - strcpy(result, given); - } + if ((cp = FindLeadingTilde(given, TRUE)) != 0 + && (cp2 = wwwName(Home_Dir())) != 0 + && strlen(cp2) + strlen(given) < LY_MAXPATH) { + *(cp++) = '\0'; + strcpy(result, given); + LYTrimPathSep(result); + strcat(result, cp2); + strcat(result, cp); + strcpy(given, result); + } +#ifdef VMS + if (strchr(given, '/') != NULL) { + strcpy(result, HTVMS_name("", given)); + strcpy(given, result); + } + if (given[0] != '/' + && strchr(given, ':') == NULL + && strlen(given) < LY_MAXPATH - 13) { + strcpy(result, "sys$disk:"); + if (strchr(given, ']') == NULL) + strcat(result, "[]"); + strcat(result, given); + } else { + strcpy(result, given); + } #else #ifndef __EMX__ - if (!LYisAbsPath(given)) { + if (!LYisAbsPath(given)) { #if defined(__DJGPP__) || defined(_WINDOWS) - if (strchr(result, ':') != NULL) - cp = NULL; - else + if (strchr(result, ':') != NULL) + cp = NULL; + else #endif /* __DJGPP__ || _WINDOWS */ - { + { #ifdef SUPPORT_CHDIR - static char buf[LY_MAXPATH]; + static char buf[LY_MAXPATH]; - cp = Current_Dir(buf); + cp = Current_Dir(buf); #else - cp = original_dir; + cp = original_dir; #endif - } - } else + } + } else #endif /* __EMX__ */ - cp = NULL; + cp = NULL; - *result = 0; - if (cp) { - LYTrimPathSep(cp); - if (strlen(cp) >= LY_MAXPATH - 2) - return FALSE; - sprintf(result, "%s/", cp); - } - cp = HTSYS_name(given); - if (strlen(result) + strlen(cp) >= LY_MAXPATH - 1) - return FALSE; - strcat(result, cp); + *result = 0; + if (cp) { + LYTrimPathSep(cp); + if (strlen(cp) >= LY_MAXPATH - 2) { + code = FALSE; + } else { + sprintf(result, "%s/", cp); + } + } + if (code) { + cp = HTSYS_name(given); + if (strlen(result) + strlen(cp) >= LY_MAXPATH - 1) { + code = FALSE; + } else { + strcat(result, cp); + } + } #endif /* VMS */ - return TRUE; + } + return code; } /* |