diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2001-11-19 01:52:38 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2001-11-19 01:52:38 -0500 |
commit | 90d33dc9d0323ee3faf8477fcbddb376a6fcdb9a (patch) | |
tree | aa9874302b6efa2cb7f75f9b8cd4891fb11d032b /src | |
parent | 6cb04c09f063188e7dae5d1e5e5c69eb64703626 (diff) | |
download | lynx-snapshots-90d33dc9d0323ee3faf8477fcbddb376a6fcdb9a.tar.gz |
snapshot of project "lynx", label v2-8-5dev_5
Diffstat (limited to 'src')
-rw-r--r-- | src/HTFWriter.c | 13 | ||||
-rw-r--r-- | src/LYCharSets.h | 2 | ||||
-rw-r--r-- | src/LYCurses.c | 10 | ||||
-rw-r--r-- | src/LYCurses.h | 2 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 27 | ||||
-rw-r--r-- | src/LYLocal.c | 494 | ||||
-rw-r--r-- | src/LYMain.c | 8 | ||||
-rw-r--r-- | src/LYOptions.c | 112 | ||||
-rw-r--r-- | src/LYReadCFG.c | 393 | ||||
-rw-r--r-- | src/LYStrings.c | 16 | ||||
-rw-r--r-- | src/LYUtils.c | 16 | ||||
-rw-r--r-- | src/LYrcFile.c | 158 | ||||
-rw-r--r-- | src/LYrcFile.h | 204 | ||||
-rw-r--r-- | src/UCAuto.c | 2 |
14 files changed, 921 insertions, 536 deletions
diff --git a/src/HTFWriter.c b/src/HTFWriter.c index 629857e5..052a34c6 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -1048,6 +1048,7 @@ PUBLIC HTStream* HTCompressed ARGS3( * We have a presentation mapping for it. - FM */ can_present = TRUE; +#ifdef GZIP_PATH if (!strcasecomp(anchor->content_encoding, "x-gzip") || !strcasecomp(anchor->content_encoding, "gzip")) { /* @@ -1056,14 +1057,20 @@ PUBLIC HTStream* HTCompressed ARGS3( StrAllocCopy(uncompress_mask, GZIP_PATH); StrAllocCat(uncompress_mask, " -d --no-name %s"); compress_suffix = "gz"; + break; + } +#endif /* GZIP_PATH */ #ifdef BZIP2_PATH - } else if (!strcasecomp(anchor->content_encoding, "x-bzip2") || + if (!strcasecomp(anchor->content_encoding, "x-bzip2") || !strcasecomp(anchor->content_encoding, "bzip2")) { StrAllocCopy(uncompress_mask, BZIP2_PATH); StrAllocCat(uncompress_mask, " -d %s"); compress_suffix = "bz2"; + break; + } #endif /* BZIP2_PATH */ - } else if (!strcasecomp(anchor->content_encoding, "x-compress") || +#ifdef UNCOMPRESS_PATH + if (!strcasecomp(anchor->content_encoding, "x-compress") || !strcasecomp(anchor->content_encoding, "compress")) { /* * It's compressed the old fashioned Unix way. - FM @@ -1071,7 +1078,9 @@ PUBLIC HTStream* HTCompressed ARGS3( StrAllocCopy(uncompress_mask, UNCOMPRESS_PATH); StrAllocCat(uncompress_mask, " %s"); compress_suffix = "Z"; + break; } +#endif /* UNCOMPRESS_PATH */ break; } } diff --git a/src/LYCharSets.h b/src/LYCharSets.h index 709c0160..e1c03d7f 100644 --- a/src/LYCharSets.h +++ b/src/LYCharSets.h @@ -110,7 +110,7 @@ extern int auto_display_charset; enum switch_display_charset_t { SWITCH_DISPLAY_CHARSET_MAYBE, SWITCH_DISPLAY_CHARSET_REALLY, - SWITCH_DISPLAY_CHARSET_SIZECHANGE + SWITCH_DISPLAY_CHARSET_RESIZE }; extern int Switch_Display_Charset PARAMS((int ord, enum switch_display_charset_t really)); extern int Find_Best_Display_Charset PARAMS((int ord)); diff --git a/src/LYCurses.c b/src/LYCurses.c index 24d249d1..9e040ee0 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -1511,11 +1511,15 @@ PUBLIC void LYpaddstr ARGS3( CONST char *, the_string) { int y, x; + int actual = strlen(the_string); + getyx(the_window, y, x); if (width + x >= LYcols) width = LYcols - x - 1; - LYwaddnstr(the_window, the_string, width); - width -= strlen(the_string); + if (actual > width) + actual = width; + LYwaddnstr(the_window, the_string, actual); + width -= actual; while (width-- > 0) waddstr(the_window, " "); } @@ -1685,7 +1689,7 @@ PUBLIC void LYwaddnstr ARGS3( * have problems with combining-characters in this version of ncurses * (successive calls are not merged), so I'm using them for testing -TD */ -#ifdef WIDEC_CURSES +#if defined(WIDEC_CURSES) && defined(HAVE_MBSTATE_T) #if 1 /* array of wchar_t's */ { static wchar_t *temp = 0; diff --git a/src/LYCurses.h b/src/LYCurses.h index 9ac77ed7..3ec42649 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -174,6 +174,7 @@ typedef struct { # ifdef HAVE_NCURSESW_NCURSES_H # undef GCC_PRINTFLIKE /* <libutf8.h> may define 'printf' */ # include <ncursesw/ncurses.h> +# undef printf /* but we don't want that... */ # else # ifdef HAVE_NCURSES_NCURSES_H # include <ncurses/ncurses.h> @@ -285,6 +286,7 @@ extern WINDOW *LYstartPopup PARAMS((int top_y, int left_x, int height, int width #if defined(PDCURSES) #define HAVE_GETBKGD 1 /* can use fallback definition */ +#define HAVE_NAPMS 1 /* can use millisecond-delays */ #endif /* Both slang and curses: */ diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index 764b6033..fc9468d4 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -62,19 +62,38 @@ extern char *LYCSwingPath; #endif /* VMS */ #ifdef DIRED_SUPPORT + +typedef enum { + DIRS_FIRST = 0 + , FILES_FIRST + , MIXED_STYLE +} enumDirListStyle; + +typedef enum { + ORDER_BY_NAME + , ORDER_BY_SIZE + , ORDER_BY_DATE + , ORDER_BY_MODE + , ORDER_BY_TYPE + , ORDER_BY_USER + , ORDER_BY_GROUP +} enumDirListOrder; + extern BOOLEAN lynx_edit_mode; extern BOOLEAN no_dired_support; -extern int dir_list_style; extern HTList *tagged; -#define FILES_FIRST 1 -#define MIXED_STYLE 2 +extern int LYAutoUncacheDirLists; +extern int dir_list_style; /* enumDirListStyle */ +extern int dir_list_order; /* enumDirListOrder */ + #ifdef OK_OVERRIDE extern BOOLEAN prev_lynx_edit_mode; #endif /* OK_OVERRIDE */ + #ifdef OK_PERMIT extern BOOLEAN no_change_exec_perms; #endif /* OK_PERMIT */ -extern int LYAutoUncacheDirLists; + #endif /* DIRED_SUPPORT */ extern int HTCacheSize; /* the number of documents cached in memory */ diff --git a/src/LYLocal.c b/src/LYLocal.c index 4ef06fa2..42b96763 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -331,25 +331,8 @@ PRIVATE int LYExecv ARGS3( char *, msg) { int rc = 0; -#if defined(VMS) - CTRACE((tfp, "LYExecv: Called inappropriately!\n")); -#else -#if defined(_WINDOWS) - if (!strcmp(path, TOUCH_PATH)) { -#if defined(__BORLANDC__) || defined(__MINGW32__) - int fd = _creat(argv[1], S_IREAD | S_IWRITE); -#else /* Visual C++ */ - int fd = _creat(argv[1], _S_IREAD | _S_IWRITE); -#endif - if (fd >= 0) { - close(fd); - return(1); - } - } else if (!strcmp(path, RM_PATH)) { - rc = remove(argv[2]); - } else { - CTRACE((tfp, "LYExecv: Called inappropriately! (path=%s)\n", path)); - } +#if defined(VMS) || defined(_WINDOWS) + CTRACE((tfp, "LYExecv: Called inappropriately! (path=%s)\n", path)); #else int n; char *tmpbuf = 0; @@ -433,20 +416,78 @@ PRIVATE int LYExecv ARGS3( FREE(tmpbuf); } -#endif /* _WINDOWS */ -#endif /* VMS */ +#endif /* VMS || _WINDOWS */ return(rc); } -PRIVATE int move_file ARGS2(char *, source, char *, target) + +PRIVATE int make_directory ARGS1(char *, path) { int code; -#ifdef WIN_EX /* 1999/01/02 (Sat) 23:24:20 */ - if ((code = rename(source, target)) != 0) - if ((code = LYCopyFile(source, target)) >= 0) - code = remove(source); - if (code == 0) - code = 1; +#ifdef MKDIR_PATH + char *args[5]; + char *msg = 0; + + HTSprintf0(&msg,"make directory %s", path); + args[0] = "mkdir"; + args[1] = path; + args[2] = (char *) 0; + code = (LYExecv(MKDIR_PATH, args, msg) <= 0) ? -1 : 1; + FREE(msg); #else + code = mkdir(path, 0777) ? -1 : 1; +#endif + return (code); +} + +PRIVATE int remove_file ARGS1(char *, path) +{ + int code; +#ifdef RM_PATH + char *args[5]; + char *tmpbuf = NULL; + + args[0] = "rm"; + args[1] = "-rf"; + args[2] = path; + args[3] = (char *) 0; + HTSprintf0(&tmpbuf, gettext("remove %s"), path); + code = LYExecv(RM_PATH, args, tmpbuf); + FREE(tmpbuf); +#else + code = remove(path) ? -1 : 1; +#endif + return (code); +} + +PRIVATE int touch_file ARGS1(char *, path) +{ + int code; +#ifdef TOUCH_PATH + char *args[5]; + char *msg = NULL; + + HTSprintf0(&msg, gettext("touch %s"), path); + args[0] = "touch"; + args[1] = path; + args[2] = (char *) 0; + code = (LYExecv(TOUCH_PATH, args, msg) <= 0) ? -1 : 1; + FREE(msg); +#else + FILE *fp; + if ((fp = fopen(path, "w")) != 0) { + fclose(fp); + code = 1; + } else { + code = -1; + } +#endif + return (code); +} + +PRIVATE int move_file ARGS2(char *, source, char *, target) +{ + int code; +#ifdef MV_PATH char *msg = 0; char *args[5]; @@ -457,6 +498,24 @@ PRIVATE int move_file ARGS2(char *, source, char *, target) args[3] = (char *) 0; code = (LYExecv(MV_PATH, args, msg) <= 0) ? -1 : 1; FREE(msg); +#else + struct stat sb; + char *actual = 0; + /* the caller sets up a target directory; we need a file path */ + if (stat(target, &sb) == 0 + && S_ISDIR(sb.st_mode)) { + HTSprintf0(&actual, "%s/%s", target, LYPathLeaf(source)); + CTRACE((tfp, "move_file source=%s, target=%s\n", source, target)); + target = actual; + } + if ((code = rename(source, target)) != 0) + if ((code = LYCopyFile(source, target)) >= 0) + code = remove(source); + if (code == 0) + code = 1; + if (actual != target) { + FREE(actual); + } #endif return code; } @@ -508,7 +567,6 @@ PRIVATE int remove_tagged NOARGS struct stat dir_info; int count; HTList *tag; - char *args[5]; if (HTList_isEmpty(tagged)) /* should never happen */ return 0; @@ -530,12 +588,7 @@ PRIVATE int remove_tagged NOARGS will_clear = FALSE; break; } else { - args[0] = "rm"; - args[1] = "-rf"; - args[2] = testpath; - args[3] = (char *) 0; - HTSprintf0(&tmpbuf, gettext("remove %s"), testpath); - if (LYExecv(RM_PATH, args, tmpbuf) <= 0) { + if (remove_file(testpath) <= 0) { if (count == 0) count = -1; will_clear = FALSE; break; @@ -684,7 +737,7 @@ PRIVATE int modify_tagged ARGS1( /* * Make sure the target location is a directory which is owned - * by the same uid as the owner of the current location. + * by the same uid as the owner of the current location. */ if (dir_has_same_owner(&dir_info, owner)) { count = 0; @@ -741,6 +794,7 @@ PRIVATE int modify_name ARGS1( } else { return ok_file_or_dir(&dir_info); } + LYstrncpy(tmpbuf, LYPathLeaf(testpath), sizeof(tmpbuf)-1); if (get_filename(cp, tmpbuf, sizeof(tmpbuf)) == NULL) return 0; @@ -788,7 +842,6 @@ PRIVATE int modify_location ARGS1( * Determine the status of the selected item. */ testpath = strip_trailing_slash(testpath); - if (!ok_stat(testpath, &dir_info)) { return 0; } @@ -797,12 +850,19 @@ PRIVATE int modify_location ARGS1( * Change the location of the file or directory. */ if (S_ISDIR(dir_info.st_mode)) { +#ifndef MV_PATH + HTAlert(COULD_NOT_ACCESS_DIR); + return 0; +#else cp = gettext("Enter new location for directory: "); +#endif } else if (S_ISREG(dir_info.st_mode)) { cp = gettext("Enter new location for file: "); } else { return ok_file_or_dir(&dir_info); } + LYstrncpy(tmpbuf, testpath, sizeof(tmpbuf)-1); + *LYPathLeaf(tmpbuf) = '\0'; if (get_filename(cp, tmpbuf, sizeof(tmpbuf)) == NULL) return 0; if (strlen(tmpbuf)) { @@ -839,14 +899,16 @@ PRIVATE int modify_location ARGS1( if (!ok_stat(newpath, &dir_info)) { code = 0; } - +#ifdef UNIX /* * Make sure the source and target are not the same location. */ else if (dev == dir_info.st_dev && inode == dir_info.st_ino) { HTAlert(gettext("Source and destination are the same location! Request ignored!")); code = 0; - } else if (dir_has_same_owner(&dir_info, owner)) { + } +#endif + else if (dir_has_same_owner(&dir_info, owner)) { code = move_file(savepath,newpath); } FREE(newpath); @@ -937,9 +999,9 @@ PRIVATE int create_file ARGS1( int code = FALSE; char tmpbuf[DIRED_MAXBUF]; char *testpath = NULL; - char *args[5]; char *bad_chars = ".~/"; + tmpbuf[0] = '\0'; if (get_filename(gettext("Enter name of file to create: "), tmpbuf, sizeof(tmpbuf)) != NULL) { @@ -962,13 +1024,7 @@ PRIVATE int create_file ARGS1( * Make sure the target does not already exist */ if (not_already_exists(testpath)) { - char *msg = 0; - HTSprintf0(&msg,gettext("create %s"),testpath); - args[0] = "touch"; - args[1] = testpath; - args[2] = (char *) 0; - code = (LYExecv(TOUCH_PATH, args, msg) <= 0) ? -1 : 1; - FREE(msg); + code = touch_file(testpath); } FREE(testpath); } @@ -985,9 +1041,9 @@ PRIVATE int create_directory ARGS1( int code = FALSE; char tmpbuf[DIRED_MAXBUF]; char *testpath = NULL; - char *args[5]; char *bad_chars = ".~/"; + tmpbuf[0] = '\0'; if (get_filename(gettext("Enter name for new directory: "), tmpbuf, sizeof(tmpbuf)) != NULL) { @@ -1007,13 +1063,7 @@ PRIVATE int create_directory ARGS1( * Make sure the target does not already exist. */ if (not_already_exists(testpath)) { - char *msg = 0; - HTSprintf0(&msg,"make directory %s",testpath); - args[0] = "mkdir"; - args[1] = testpath; - args[2] = (char *) 0; - code = (LYExecv(MKDIR_PATH, args, msg) <= 0) ? -1 : 1; - FREE(msg); + code = make_directory(testpath); } FREE(testpath); } @@ -1061,7 +1111,6 @@ PRIVATE int remove_single ARGS1( char *cp; char *tmpbuf = 0; struct stat dir_info; - char *args[5]; if (!ok_lstat(testpath, &dir_info)) { return 0; @@ -1106,12 +1155,7 @@ PRIVATE int remove_single ARGS1( } if (HTConfirm(tmpbuf) == YES) { - HTSprintf0(&tmpbuf,"remove %s",testpath); - args[0] = "rm"; - args[1] = "-rf"; - args[2] = testpath; - args[3] = (char *) 0; - code = (LYExecv(RM_PATH, args, tmpbuf) <= 0) ? -1 : 1; + code = remove_file(testpath); } FREE(tmpbuf); return code; @@ -1192,7 +1236,6 @@ PRIVATE int permit_location ARGS3( #else static char tempfile[LY_MAXPATH] = "\0"; char *cp; - char *tmpbuf = NULL; char tmpdst[LY_MAXPATH]; struct stat dir_info; @@ -1306,8 +1349,6 @@ PRIVATE int permit_location ARGS3( } else { /* The form being activated. */ mode_t new_mode = 0; - char *args[5]; - char amode[10]; /* * Make sure we have a valid set-permission @@ -1404,21 +1445,30 @@ PRIVATE int permit_location ARGS3( cp = cr; } -#ifdef UNIX +#ifdef CHMOD_PATH /* * Call chmod(). */ - HTSprintf0(&tmpbuf, "chmod %.4o %s", (unsigned int)new_mode, destpath); - sprintf(amode, "%.4o", (unsigned int)new_mode); - args[0] = "chmod"; - args[1] = amode; - args[2] = destpath; - args[3] = (char *) 0; - if (LYExecv(CHMOD_PATH, args, tmpbuf) <= 0) { + { + char *args[5]; + char amode[10]; + char *tmpbuf = NULL; + + HTSprintf0(&tmpbuf, "chmod %.4o %s", (unsigned int)new_mode, destpath); + sprintf(amode, "%.4o", (unsigned int)new_mode); + args[0] = "chmod"; + args[1] = amode; + args[2] = destpath; + args[3] = (char *) 0; + if (LYExecv(CHMOD_PATH, args, tmpbuf) <= 0) { + FREE(tmpbuf); + return (-1); + } FREE(tmpbuf); - return (-1); } - FREE(tmpbuf); +#else + if (chmod(destpath, new_mode) < 0) + return (-1); #endif /* UNIX */ LYforce_no_cache = TRUE; /* Force update of dired listing. */ return 1; @@ -1548,6 +1598,173 @@ PRIVATE char * match_op ARGS2( } /* + * Construct the appropriate system command taking care to + * escape all path references to avoid spoofing the shell. + */ +PRIVATE char *build_command ARGS3( + char *, line, + char *, dirname, + char *, arg) +{ + char *buffer = NULL; + +#ifdef UNCOMPRESS_PATH + if ((arg = match_op("DECOMPRESS", line)) != 0) { +#define FMT_UNCOMPRESS "%s %s" + HTAddParam(&buffer, FMT_UNCOMPRESS, 1, UNCOMPRESS_PATH); + HTAddParam(&buffer, FMT_UNCOMPRESS, 2, arg); + HTEndParam(&buffer, FMT_UNCOMPRESS, 2); + return buffer; + } +#endif /* UNCOMPRESS_PATH */ + +#if defined(OK_UUDECODE) && !defined(ARCHIVE_ONLY) + if ((arg = match_op("UUDECODE", line)) != 0) { +#define FMT_UUDECODE "%s %s" + HTAddParam(&buffer, FMT_UUDECODE, 1, UUDECODE_PATH); + HTAddParam(&buffer, FMT_UUDECODE, 2, arg); + HTEndParam(&buffer, FMT_UUDECODE, 2); + HTAlert(gettext("Warning! UUDecoded file will exist in the directory you started Lynx.")); + return buffer; + } +#endif /* OK_UUDECODE && !ARCHIVE_ONLY */ + +#ifdef OK_TAR +# ifndef ARCHIVE_ONLY +# ifdef OK_GZIP + if ((arg = match_op("UNTAR_GZ", line)) != 0) { +#define FMT_UNTAR_GZ "cd %s; %s -qdc %s | %s -xf -" + dirname = DirectoryOf(arg); + HTAddParam(&buffer, FMT_UNTAR_GZ, 1, dirname); + HTAddParam(&buffer, FMT_UNTAR_GZ, 2, GZIP_PATH); + HTAddParam(&buffer, FMT_UNTAR_GZ, 3, arg); + HTAddParam(&buffer, FMT_UNTAR_GZ, 4, TAR_PATH); + HTEndParam(&buffer, FMT_UNTAR_GZ, 4); + return buffer; + } +# endif /* OK_GZIP */ +# ifdef ZCAT_PATH + if ((arg = match_op("UNTAR_Z", line)) != 0) { +#define FMT_UNTAR_Z "cd %s; %s %s | %s -xf -" + dirname = DirectoryOf(arg); + HTAddParam(&buffer, FMT_UNTAR_Z, 1, dirname); + HTAddParam(&buffer, FMT_UNTAR_Z, 2, ZCAT_PATH); + HTAddParam(&buffer, FMT_UNTAR_Z, 3, arg); + HTAddParam(&buffer, FMT_UNTAR_Z, 4, TAR_PATH); + HTEndParam(&buffer, FMT_UNTAR_Z, 4); + return buffer; + } +# endif /* ZCAT_PATH */ + if ((arg = match_op("UNTAR", line)) != 0) { +#define FMT_UNTAR "cd %s; %s -xf %s" + dirname = DirectoryOf(arg); + HTAddParam(&buffer, FMT_UNTAR, 1, dirname); + HTAddParam(&buffer, FMT_UNTAR, 2, TAR_PATH); + HTAddParam(&buffer, FMT_UNTAR, 3, arg); + HTEndParam(&buffer, FMT_UNTAR, 3); + return buffer; + } +# endif /* !ARCHIVE_ONLY */ + +# ifdef OK_GZIP + if ((arg = match_op("TAR_GZ", line)) != 0) { +#define FMT_TAR_GZ "cd %s; %s -cf - %s | %s -qc >%s%s" + dirname = DirectoryOf(arg); + HTAddParam(&buffer, FMT_TAR_GZ, 1, dirname); + HTAddParam(&buffer, FMT_TAR_GZ, 2, TAR_PATH); + HTAddParam(&buffer, FMT_TAR_GZ, 3, LYPathLeaf(arg)); + HTAddParam(&buffer, FMT_TAR_GZ, 4, GZIP_PATH); + HTAddParam(&buffer, FMT_TAR_GZ, 5, LYonedot(LYPathLeaf(arg))); + HTAddParam(&buffer, FMT_TAR_GZ, 6, EXT_TAR_GZ); + HTEndParam(&buffer, FMT_TAR_GZ, 6); + return buffer; + } +# endif /* OK_GZIP */ + +# ifdef COMPRESS_PATH + if ((arg = match_op("TAR_Z", line)) != 0) { +#define FMT_TAR_Z "cd %s; %s -cf - %s | %s >%s%s" + dirname = DirectoryOf(arg); + HTAddParam(&buffer, FMT_TAR_Z, 1, dirname); + HTAddParam(&buffer, FMT_TAR_Z, 2, TAR_PATH); + HTAddParam(&buffer, FMT_TAR_Z, 3, LYPathLeaf(arg)); + HTAddParam(&buffer, FMT_TAR_Z, 4, COMPRESS_PATH); + HTAddParam(&buffer, FMT_TAR_Z, 5, LYonedot(LYPathLeaf(arg))); + HTAddParam(&buffer, FMT_TAR_Z, 6, EXT_TAR_Z); + HTEndParam(&buffer, FMT_TAR_Z, 6); + return buffer; + } +# endif /* COMPRESS_PATH */ + + if ((arg = match_op("TAR", line)) != 0) { +#define FMT_TAR "cd %s; %s -cf %s.tar %s" + dirname = DirectoryOf(arg); + HTAddParam(&buffer, FMT_TAR, 1, dirname); + HTAddParam(&buffer, FMT_TAR, 2, TAR_PATH); + HTAddParam(&buffer, FMT_TAR, 3, LYonedot(LYPathLeaf(arg))); + HTAddParam(&buffer, FMT_TAR, 4, LYPathLeaf(arg)); + HTEndParam(&buffer, FMT_TAR, 4); + return buffer; + } +#endif /* OK_TAR */ + +#ifdef OK_GZIP + if ((arg = match_op("GZIP", line)) != 0) { +#define FMT_GZIP "%s -q %s" + HTAddParam(&buffer, FMT_GZIP, 1, GZIP_PATH); + HTAddParam(&buffer, FMT_GZIP, 2, arg); + HTEndParam(&buffer, FMT_GZIP, 2); + return buffer; + } +#ifndef ARCHIVE_ONLY + if ((arg = match_op("UNGZIP", line)) != 0) { +#define FMT_UNGZIP "%s -d %s" + HTAddParam(&buffer, FMT_UNGZIP, 1, GZIP_PATH); + HTAddParam(&buffer, FMT_UNGZIP, 2, arg); + HTEndParam(&buffer, FMT_UNGZIP, 2); + return buffer; + } +#endif /* !ARCHIVE_ONLY */ +#endif /* OK_GZIP */ + +#ifdef OK_ZIP + if ((arg = match_op("ZIP", line)) != 0) { +#define FMT_ZIP "cd %s; %s -rq %s.zip %s" + dirname = DirectoryOf(arg); + HTAddParam(&buffer, FMT_ZIP, 1, dirname); + HTAddParam(&buffer, FMT_ZIP, 2, ZIP_PATH); + HTAddParam(&buffer, FMT_ZIP, 3, LYonedot(LYPathLeaf(arg))); + HTAddParam(&buffer, FMT_ZIP, 4, LYPathLeaf(arg)); + HTEndParam(&buffer, FMT_ZIP, 4); + return buffer; + } +#if !defined(ARCHIVE_ONLY) && defined(UNZIP_PATH) + if ((arg = match_op("UNZIP", line)) != 0) { +#define FMT_UNZIP "cd %s; %s -q %s" + dirname = DirectoryOf(arg); + HTAddParam(&buffer, FMT_UNZIP, 1, dirname); + HTAddParam(&buffer, FMT_UNZIP, 2, UNZIP_PATH); + HTAddParam(&buffer, FMT_UNZIP, 3, arg); + HTEndParam(&buffer, FMT_UNZIP, 3); + return buffer; + } +# endif /* !ARCHIVE_ONLY */ +#endif /* OK_ZIP */ + +#ifdef COMPRESS_PATH + if ((arg = match_op("COMPRESS", line)) != 0) { +#define FMT_COMPRESS "%s %s" + HTAddParam(&buffer, FMT_COMPRESS, 1, COMPRESS_PATH); + HTAddParam(&buffer, FMT_COMPRESS, 2, arg); + HTEndParam(&buffer, FMT_COMPRESS, 2); + return buffer; + } +#endif /* COMPRESS_PATH */ + + return NULL; +} + +/* * Perform file management operations for LYNXDIRED URL's. * Attempt to be consistent. These are (pseudo) URLs - i.e., they should * be in URL syntax: some bytes will be URL-escaped with '%'. This is @@ -1651,131 +1868,7 @@ PUBLIC int local_dired ARGS1( return 0; } - /* - * Construct the appropriate system command taking care to - * escape all path references to avoid spoofing the shell. - */ - if ((arg = match_op("DECOMPRESS", line)) != 0) { -#define FMT_UNCOMPRESS "%s %s" - HTAddParam(&buffer, FMT_UNCOMPRESS, 1, UNCOMPRESS_PATH); - HTAddParam(&buffer, FMT_UNCOMPRESS, 2, arg); - HTEndParam(&buffer, FMT_UNCOMPRESS, 2); - -#if defined(OK_UUDECODE) && !defined(ARCHIVE_ONLY) - } else if ((arg = match_op("UUDECODE", line)) != 0) { -#define FMT_UUDECODE "%s %s" - HTAddParam(&buffer, FMT_UUDECODE, 1, UUDECODE_PATH); - HTAddParam(&buffer, FMT_UUDECODE, 2, arg); - HTEndParam(&buffer, FMT_UUDECODE, 2); - HTAlert(gettext("Warning! UUDecoded file will exist in the directory you started Lynx.")); -#endif /* OK_UUDECODE && !ARCHIVE_ONLY */ - -#ifdef OK_TAR -# ifndef ARCHIVE_ONLY -# ifdef OK_GZIP - } else if ((arg = match_op("UNTAR_GZ", line)) != 0) { -#define FMT_UNTAR_GZ "cd %s; %s -qdc %s | %s -xf -" - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_UNTAR_GZ, 1, dirname); - HTAddParam(&buffer, FMT_UNTAR_GZ, 2, GZIP_PATH); - HTAddParam(&buffer, FMT_UNTAR_GZ, 3, arg); - HTAddParam(&buffer, FMT_UNTAR_GZ, 4, TAR_PATH); - HTEndParam(&buffer, FMT_UNTAR_GZ, 4); -# endif /* OK_GZIP */ - - } else if ((arg = match_op("UNTAR_Z", line)) != 0) { -#define FMT_UNTAR_Z "cd %s; %s %s | %s -xf -" - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_UNTAR_Z, 1, dirname); - HTAddParam(&buffer, FMT_UNTAR_Z, 2, ZCAT_PATH); - HTAddParam(&buffer, FMT_UNTAR_Z, 3, arg); - HTAddParam(&buffer, FMT_UNTAR_Z, 4, TAR_PATH); - HTEndParam(&buffer, FMT_UNTAR_Z, 4); - - } else if ((arg = match_op("UNTAR", line)) != 0) { -#define FMT_UNTAR "cd %s; %s -xf %s" - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_UNTAR, 1, dirname); - HTAddParam(&buffer, FMT_UNTAR, 2, TAR_PATH); - HTAddParam(&buffer, FMT_UNTAR, 3, arg); - HTEndParam(&buffer, FMT_UNTAR, 3); -# endif /* !ARCHIVE_ONLY */ - -# ifdef OK_GZIP - } else if ((arg = match_op("TAR_GZ", line)) != 0) { -#define FMT_TAR_GZ "cd %s; %s -cf - %s | %s -qc >%s%s" - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_TAR_GZ, 1, dirname); - HTAddParam(&buffer, FMT_TAR_GZ, 2, TAR_PATH); - HTAddParam(&buffer, FMT_TAR_GZ, 3, LYPathLeaf(arg)); - HTAddParam(&buffer, FMT_TAR_GZ, 4, GZIP_PATH); - HTAddParam(&buffer, FMT_TAR_GZ, 5, LYonedot(LYPathLeaf(arg))); - HTAddParam(&buffer, FMT_TAR_GZ, 6, EXT_TAR_GZ); - HTEndParam(&buffer, FMT_TAR_GZ, 6); -# endif /* OK_GZIP */ - - } else if ((arg = match_op("TAR_Z", line)) != 0) { -#define FMT_TAR_Z "cd %s; %s -cf - %s | %s >%s%s" - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_TAR_Z, 1, dirname); - HTAddParam(&buffer, FMT_TAR_Z, 2, TAR_PATH); - HTAddParam(&buffer, FMT_TAR_Z, 3, LYPathLeaf(arg)); - HTAddParam(&buffer, FMT_TAR_Z, 4, COMPRESS_PATH); - HTAddParam(&buffer, FMT_TAR_Z, 5, LYonedot(LYPathLeaf(arg))); - HTAddParam(&buffer, FMT_TAR_Z, 6, EXT_TAR_Z); - HTEndParam(&buffer, FMT_TAR_Z, 6); - - } else if ((arg = match_op("TAR", line)) != 0) { -#define FMT_TAR "cd %s; %s -cf %s.tar %s" - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_TAR, 1, dirname); - HTAddParam(&buffer, FMT_TAR, 2, TAR_PATH); - HTAddParam(&buffer, FMT_TAR, 3, LYonedot(LYPathLeaf(arg))); - HTAddParam(&buffer, FMT_TAR, 4, LYPathLeaf(arg)); - HTEndParam(&buffer, FMT_TAR, 4); -#endif /* OK_TAR */ - -#ifdef OK_GZIP - } else if ((arg = match_op("GZIP", line)) != 0) { -#define FMT_GZIP "%s -q %s" - HTAddParam(&buffer, FMT_GZIP, 1, GZIP_PATH); - HTAddParam(&buffer, FMT_GZIP, 2, arg); - HTEndParam(&buffer, FMT_GZIP, 2); -#ifndef ARCHIVE_ONLY - } else if ((arg = match_op("UNGZIP", line)) != 0) { -#define FMT_UNGZIP "%s -d %s" - HTAddParam(&buffer, FMT_UNGZIP, 1, GZIP_PATH); - HTAddParam(&buffer, FMT_UNGZIP, 2, arg); - HTEndParam(&buffer, FMT_UNGZIP, 2); -#endif /* !ARCHIVE_ONLY */ -#endif /* OK_GZIP */ - -#ifdef OK_ZIP - } else if ((arg = match_op("ZIP", line)) != 0) { -#define FMT_ZIP "cd %s; %s -rq %s.zip %s" - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_ZIP, 1, dirname); - HTAddParam(&buffer, FMT_ZIP, 2, ZIP_PATH); - HTAddParam(&buffer, FMT_ZIP, 3, LYonedot(LYPathLeaf(arg))); - HTAddParam(&buffer, FMT_ZIP, 4, LYPathLeaf(arg)); - HTEndParam(&buffer, FMT_ZIP, 4); -#ifndef ARCHIVE_ONLY - } else if ((arg = match_op("UNZIP", line)) != 0) { -#define FMT_UNZIP "cd %s; %s -q %s" - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_UNZIP, 1, dirname); - HTAddParam(&buffer, FMT_UNZIP, 2, UNZIP_PATH); - HTAddParam(&buffer, FMT_UNZIP, 3, arg); - HTEndParam(&buffer, FMT_UNZIP, 3); -# endif /* !ARCHIVE_ONLY */ -#endif /* OK_ZIP */ - - } else if ((arg = match_op("COMPRESS", line)) != 0) { -#define FMT_COMPRESS "%s %s" - HTAddParam(&buffer, FMT_COMPRESS, 1, COMPRESS_PATH); - HTAddParam(&buffer, FMT_COMPRESS, 2, arg); - HTEndParam(&buffer, FMT_COMPRESS, 2); - } + buffer = build_command(line, dirname, arg); if (buffer != 0) { if ((int) strlen(buffer) < LYcols - 15) { @@ -1977,7 +2070,6 @@ PRIVATE char *get_filename ARGS3( _statusline(prompt); - *buf = '\0'; LYgetstr(buf, VISIBLE, bufsize, NORECALL); if (strstr(buf, "../") != NULL) { HTAlert(gettext("Illegal filename; request ignored.")); diff --git a/src/LYMain.c b/src/LYMain.c index 71ae0780..6524f09a 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -100,11 +100,15 @@ PUBLIC char *LYCSwingPath = NULL; #ifdef DIRED_SUPPORT PUBLIC BOOLEAN lynx_edit_mode = FALSE; PUBLIC BOOLEAN no_dired_support = FALSE; -PUBLIC int dir_list_style = MIXED_STYLE; PUBLIC HTList *tagged = NULL; +PUBLIC int LYAutoUncacheDirLists = 2; /* default dired uncaching behavior */ +PUBLIC int dir_list_order = ORDER_BY_NAME; +PUBLIC int dir_list_style = MIXED_STYLE; + #ifdef OK_OVERRIDE PUBLIC BOOLEAN prev_lynx_edit_mode = FALSE; #endif /* OK_OVERRIDE */ + #ifdef OK_PERMIT #ifdef NO_CHANGE_EXECUTE_PERMS PUBLIC BOOLEAN no_change_exec_perms = TRUE; @@ -112,7 +116,7 @@ PUBLIC BOOLEAN no_change_exec_perms = TRUE; PUBLIC BOOLEAN no_change_exec_perms = FALSE; #endif /* NO_CHANGE_EXECUTE_PERMS */ #endif /* OK_PERMIT */ -PUBLIC int LYAutoUncacheDirLists = 2; /* default dired uncaching behavior */ + #endif /* DIRED_SUPPORT */ /* Number of docs cached in memory */ diff --git a/src/LYOptions.c b/src/LYOptions.c index 69c48fac..9f01ff6b 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -21,6 +21,7 @@ #include <LYGetFile.h> #include <LYReadCFG.h> #include <LYPrettySrc.h> +#include <HTFile.h> #include <LYLeaks.h> @@ -2116,13 +2117,13 @@ static char * save_options_string = "save_options"; /* * Personal Preferences */ -static char * cookies_string = "set_cookies"; +static char * cookies_string = RC_SET_COOKIES; static char * cookies_ignore_all_string = "ignore"; static char * cookies_up_to_user_string = "ask user"; static char * cookies_accept_all_string = "accept all"; -static char * x_display_string = "display"; -static char * editor_string = "file_editor"; -static char * emacs_keys_string = "emacs_keys"; +static char * x_display_string = RC_DISPLAY; +static char * editor_string = RC_FILE_EDITOR; +static char * emacs_keys_string = RC_EMACS_KEYS; #if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS)) #define EXEC_ALWAYS 2 @@ -2139,9 +2140,9 @@ static OptValues exec_links_values[] = { #endif /* ENABLE_OPTS_CHANGE_EXEC */ #ifdef EXP_KEYBOARD_LAYOUT -static char * kblayout_string = "kblayout"; +static char * kblayout_string = RC_KBLAYOUT; #endif -static char * keypad_mode_string = "keypad_mode"; +static char * keypad_mode_string = RC_KEYPAD_MODE; static OptValues keypad_mode_values[] = { { NUMBERS_AS_ARROWS, "Numbers act as arrows", "number_arrows" }, { LINKS_ARE_NUMBERED, "Links are numbered", "links_numbered" }, @@ -2152,16 +2153,16 @@ static OptValues keypad_mode_values[] = { "Form fields are numbered", "forms_numbered" }, { 0, 0, 0 }}; -static char * lineedit_mode_string = "lineedit_mode"; -static char * mail_address_string = "personal_mail_address"; -static char * search_type_string = "case_sensitive_searching"; +static char * lineedit_mode_string = RC_LINEEDIT_MODE; +static char * mail_address_string = RC_PERSONAL_MAIL_ADDRESS; +static char * search_type_string = RC_CASE_SENSITIVE_SEARCHING; static OptValues search_type_values[] = { { FALSE, "Case insensitive", "case_insensitive" }, { TRUE, "Case sensitive", "case_sensitive" }, { 0, 0, 0 }}; #if defined(USE_SLANG) || defined(COLOR_CURSES) -static char * show_color_string = "show_color"; +static char * show_color_string = RC_SHOW_COLOR; static OptValues show_color_values[] = { { SHOW_COLOR_NEVER, never_string, never_string }, { SHOW_COLOR_OFF, off_string, off_string }, @@ -2170,22 +2171,22 @@ static OptValues show_color_values[] = { { 0, 0, 0 }}; #endif -static char * show_cursor_string = "show_cursor"; +static char * show_cursor_string = RC_SHOW_CURSOR; #ifdef USE_SCROLLBAR -static char * show_scrollbar_string = "show_scrollbar"; +static char * show_scrollbar_string = RC_SCROLLBAR; #endif -static char * user_mode_string = "user_mode"; +static char * user_mode_string = RC_USER_MODE; static OptValues user_mode_values[] = { { NOVICE_MODE, "Novice", "Novice" }, { INTERMEDIATE_MODE, "Intermediate", "Intermediate" }, { ADVANCED_MODE, "Advanced", "Advanced" }, { 0, 0, 0 }}; -static char * vi_keys_string = "vi_keys"; +static char * vi_keys_string = RC_VI_KEYS; -static char * visited_links_string = "visited_links"; +static char * visited_links_string = RC_VISITED_LINKS; static OptValues visited_links_values[] = { { VISITED_LINKS_AS_FIRST_V, "By First Visit", "first_visited" }, { VISITED_LINKS_AS_FIRST_V | VISITED_LINKS_REVERSE, @@ -2200,7 +2201,7 @@ static OptValues visited_links_values[] = { * Document Layout */ #ifndef SH_EX /* 1999/01/19 (Tue) */ -static char * DTD_recovery_string = "DTD_recovery"; +static char * DTD_recovery_string = RC_TAGSOUP; static OptValues DTD_type_values[] = { /* Old_DTD variable */ { TRUE, "relaxed (TagSoup mode)", "tagsoup" }, @@ -2208,12 +2209,12 @@ static OptValues DTD_type_values[] = { { 0, 0, 0 }}; #endif -static char * select_popups_string = "select_popups"; +static char * select_popups_string = RC_SELECT_POPUPS; static char * images_string = "images"; -static char * images_ignore_all_string = "ignore"; -static char * images_use_label_string = "as labels"; -static char * images_use_links_string = "as links"; -static char * verbose_images_string = "verbose_images"; +static char * images_ignore_all_string = "ignore"; +static char * images_use_label_string = "as labels"; +static char * images_use_links_string = "as links"; +static char * verbose_images_string = RC_VERBOSE_IMAGES; static OptValues verbose_images_type_values[] = { /* verbose_img variable */ { FALSE, "OFF", "OFF" }, @@ -2223,7 +2224,7 @@ static OptValues verbose_images_type_values[] = { /* * Bookmark Options */ -static char * mbm_string = "multi_bookmark"; +static char * mbm_string = RC_MULTI_BOOKMARK; static OptValues mbm_values[] = { { MBM_OFF, "OFF", "OFF" }, { MBM_STANDARD, "STANDARD", "STANDARD" }, @@ -2235,25 +2236,39 @@ static char * single_bookmark_string = "single_bookmark_name"; /* * Character Set Options */ -static char * assume_char_set_string = "assume_char_set"; -static char * display_char_set_string = "character_set"; -static char * raw_mode_string = "raw_mode"; +static char * assume_char_set_string = RC_ASSUME_CHARSET; +static char * display_char_set_string = RC_CHARACTER_SET; +static char * raw_mode_string = RC_RAW_MODE; /* * File Management Options */ -static char * show_dotfiles_string = "show_dotfiles"; +static char * show_dotfiles_string = RC_SHOW_DOTFILES; #ifdef DIRED_SUPPORT -static char * dired_sort_string = "dir_list_style"; -static OptValues dired_values[] = { - { 0, "Directories first", "dired_dir" }, +static char * dired_list_string = RC_DIR_LIST_STYLE; +static OptValues dired_list_values[] = { + { DIRS_FIRST, "Directories first", "dired_dir" }, { FILES_FIRST, "Files first", "dired_files" }, { MIXED_STYLE, "Mixed style", "dired_mixed" }, { 0, 0, 0 }}; +#ifdef LONG_LIST +static char * dired_sort_string = RC_DIR_LIST_ORDER; +static OptValues dired_sort_values[] = { + { ORDER_BY_NAME, "By name", "dired_by_name" }, + { ORDER_BY_TYPE, "By type", "dired_by_type" }, + { ORDER_BY_SIZE, "By size", "dired_by_size" }, + { ORDER_BY_DATE, "By date", "dired_by_date" }, + { ORDER_BY_MODE, "By mode", "dired_by_mode" }, +#ifndef NO_GROUPS + { ORDER_BY_USER, "By user", "dired_by_user" }, + { ORDER_BY_GROUP, "By group", "dired_by_group" }, +#endif + { 0, 0, 0 }}; +#endif /* LONG_LIST */ #endif /* DIRED_SUPPORT */ -static char * ftp_sort_string = "file_sorting_method"; +static char * ftp_sort_string = RC_FILE_SORTING_METHOD; static OptValues ftp_sort_values[] = { { FILE_BY_NAME, "By Name", "ftp_by_name" }, { FILE_BY_TYPE, "By Type", "ftp_by_type" }, @@ -2261,7 +2276,7 @@ static OptValues ftp_sort_values[] = { { FILE_BY_DATE, "By Date", "ftp_by_date" }, { 0, 0, 0 }}; -static char * show_rate_string = "show_rate"; +static char * show_rate_string = RC_SHOW_KB_RATE; static OptValues rate_values[] = { { rateOFF, "Do not show rate", "rate_off" }, { rateBYTES, "Show Bytes/sec rate", "rate_bytes" }, @@ -2275,9 +2290,9 @@ static OptValues rate_values[] = { /* * Headers transferred to remote server */ -static char * preferred_doc_char_string = "preferred_charset"; -static char * preferred_doc_lang_string = "preferred_language"; -static char * user_agent_string = "user_agent"; +static char * preferred_doc_char_string = RC_PREFERRED_CHARSET; +static char * preferred_doc_lang_string = RC_PREFERRED_LANGUAGE; +static char * user_agent_string = RC_USERAGENT; #define PutTextInput(fp, Name, Value, Size, disable) \ fprintf(fp,\ @@ -2805,10 +2820,16 @@ PUBLIC int postoptions ARGS1( } #ifdef DIRED_SUPPORT - /* Local Directory Sort: SELECT */ + /* Local Directory Style: SELECT */ + if (!strcmp(data[i].tag, dired_list_string)) { + GetOptValues(dired_list_values, data[i].value, &dir_list_style); + } +#ifdef LONG_LIST + /* Local Directory Order: SELECT */ if (!strcmp(data[i].tag, dired_sort_string)) { - GetOptValues(dired_values, data[i].value, &dir_list_style); + GetOptValues(dired_sort_values, data[i].value, &dir_list_order); } +#endif /* LONG_LIST */ #endif /* DIRED_SUPPORT */ /* Show dot files: ON/OFF */ @@ -3103,8 +3124,8 @@ PRIVATE char *check_if_write_lynxrc ARGS1(char **, table) PRIVATE char *will_save_cookies NOARGS { static char *table[] = { - "set_cookies", /* LYSetCookies */ - "accept_all_cookies", /* LYAcceptAllCookies */ + RC_SET_COOKIES, /* LYSetCookies */ + RC_ACCEPT_ALL_COOKIES, /* LYAcceptAllCookies */ NULL }; return check_if_write_lynxrc(table); @@ -3118,8 +3139,8 @@ PRIVATE char *will_save_cookies NOARGS PRIVATE char *will_save_images NOARGS { static char *table[] = { - "make_pseudo_alts_for_inlines", /* pseudo_inline_alts */ - "make_links_for_all_images", /* clickable_images */ + RC_MAKE_PSEUDO_ALTS_FOR_INLINES, /* pseudo_inline_alts */ + RC_MAKE_LINKS_FOR_ALL_IMAGES, /* clickable_images */ NULL }; return check_if_write_lynxrc(table); @@ -3496,10 +3517,17 @@ PRIVATE int gen_options ARGS1( #ifdef DIRED_SUPPORT /* Local Directory Sort: SELECT */ - PutLabel(fp0, gettext("Local directory sort criteria"), dired_sort_string); + PutLabel(fp0, gettext("Local directory sort criteria"), dired_list_string); + BeginSelect(fp0, dired_list_string); + PutOptValues(fp0, dir_list_style, dired_list_values); + EndSelect(fp0); +#ifdef LONG_LIST + /* Local Directory Order: SELECT */ + PutLabel(fp0, gettext("Local directory sort order"), dired_sort_string); BeginSelect(fp0, dired_sort_string); - PutOptValues(fp0, dir_list_style, dired_values); + PutOptValues(fp0, dir_list_order, dired_sort_values); EndSelect(fp0); +#endif /* LONG_LIST */ #endif /* DIRED_SUPPORT */ /* Show dot files: ON/OFF */ diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 6c956bdb..ee3b3ba9 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -447,31 +447,6 @@ typedef struct } Config_Type; -PRIVATE BOOLEAN LYgetEnum ARGS3( - Config_Enum *, table, - CONST char *, name, - int *, result) -{ - Config_Enum *found = 0; - unsigned len = strlen(name); - - if (len != 0) { - while (table->name != 0) { - if (!strncasecomp(table->name, name, len)) { - if (found != 0) - return FALSE; /* ambiguous, don't use this */ - found = table; - } - table++; - } - if (found != 0) { - *result = found->value; - return TRUE; - } - } - return FALSE; /* no match */ -} - PRIVATE int assume_charset_fun ARGS1( char *, value) { @@ -1233,266 +1208,266 @@ PRIVATE int read_htmlsrc_tagname_xform ARGS1( char*,str) /* This table is searched ignoring case */ PRIVATE Config_Type Config_Table [] = { - PARSE_SET("accept_all_cookies", LYAcceptAllCookies), - PARSE_TIM("alertsecs", AlertSecs), - PARSE_SET("always_resubmit_posts", LYresubmit_posts), + PARSE_SET(RC_ACCEPT_ALL_COOKIES, LYAcceptAllCookies), + PARSE_TIM(RC_ALERTSECS, AlertSecs), + PARSE_SET(RC_ALWAYS_RESUBMIT_POSTS, LYresubmit_posts), #ifdef EXEC_LINKS - PARSE_DEF("always_trusted_exec", ALWAYS_EXEC_PATH), + PARSE_DEF(RC_ALWAYS_TRUSTED_EXEC, ALWAYS_EXEC_PATH), #endif - PARSE_FUN("assume_charset", assume_charset_fun), - PARSE_FUN("assume_local_charset", assume_local_charset_fun), - PARSE_FUN("assume_unrec_charset", assume_unrec_charset_fun), + PARSE_FUN(RC_ASSUME_CHARSET, assume_charset_fun), + PARSE_FUN(RC_ASSUME_LOCAL_CHARSET, assume_local_charset_fun), + PARSE_FUN(RC_ASSUME_UNREC_CHARSET, assume_unrec_charset_fun), #ifdef EXP_ASSUMED_COLOR - PARSE_FUN("assumed_color", assumed_color_fun), + PARSE_FUN(RC_ASSUMED_COLOR, assumed_color_fun), #endif #ifdef EXP_CHARSET_CHOICE - PARSE_FUN("assumed_doc_charset_choice", parse_assumed_doc_charset_choice), + PARSE_FUN(RC_ASSUMED_DOC_CHARSET_CHOICE, parse_assumed_doc_charset_choice), #endif #ifdef DIRED_SUPPORT - PARSE_INT("auto_uncache_dirlists", LYAutoUncacheDirLists), + PARSE_INT(RC_AUTO_UNCACHE_DIRLISTS, LYAutoUncacheDirLists), #endif #ifndef DISABLE_BIBP - PARSE_STR("bibp_bibhost", BibP_bibhost), - PARSE_STR("bibp_globalserver", BibP_globalserver), -#endif - PARSE_SET("block_multi_bookmarks", LYMBMBlocked), - PARSE_SET("bold_h1", bold_H1), - PARSE_SET("bold_headers", bold_headers), - PARSE_SET("bold_name_anchors", bold_name_anchors), - PARSE_SET("case_sensitive_always_on", case_sensitive), - PARSE_FUN("character_set", character_set_fun), + PARSE_STR(RC_BIBP_BIBHOST, BibP_bibhost), + PARSE_STR(RC_BIBP_GLOBALSERVER, BibP_globalserver), +#endif + PARSE_SET(RC_BLOCK_MULTI_BOOKMARKS, LYMBMBlocked), + PARSE_SET(RC_BOLD_H1, bold_H1), + PARSE_SET(RC_BOLD_HEADERS, bold_headers), + PARSE_SET(RC_BOLD_NAME_ANCHORS, bold_name_anchors), + PARSE_SET(RC_CASE_SENSITIVE_ALWAYS_ON, case_sensitive), + PARSE_FUN(RC_CHARACTER_SET, character_set_fun), #ifdef CAN_SWITCH_DISPLAY_CHARSET - PARSE_STR("charset_switch_rules", charset_switch_rules), - PARSE_STR("charsets_directory", charsets_directory), + PARSE_STR(RC_CHARSET_SWITCH_RULES, charset_switch_rules), + PARSE_STR(RC_CHARSETS_DIRECTORY, charsets_directory), #endif - PARSE_SET("checkmail", check_mail), - PARSE_SET("collapse_br_tags", LYCollapseBRs), + PARSE_SET(RC_CHECKMAIL, check_mail), + PARSE_SET(RC_COLLAPSE_BR_TAGS, LYCollapseBRs), #ifdef USE_COLOR_TABLE - PARSE_FUN("color", color_fun), + PARSE_FUN(RC_COLOR, color_fun), #endif #ifndef __DJGPP__ - PARSE_INT("connect_timeout", connect_timeout), + PARSE_INT(RC_CONNECT_TIMEOUT, connect_timeout), #endif - PARSE_STR("cookie_accept_domains", LYCookieSAcceptDomains), + PARSE_STR(RC_COOKIE_ACCEPT_DOMAINS, LYCookieSAcceptDomains), #ifdef EXP_PERSISTENT_COOKIES - PARSE_STR("cookie_file", LYCookieFile), + PARSE_STR(RC_COOKIE_FILE, LYCookieFile), #endif /* EXP_PERSISTENT_COOKIES */ - PARSE_STR("cookie_loose_invalid_domains", LYCookieSLooseCheckDomains), - PARSE_STR("cookie_query_invalid_domains", LYCookieSQueryCheckDomains), - PARSE_STR("cookie_reject_domains", LYCookieSRejectDomains), + PARSE_STR(RC_COOKIE_LOOSE_INVALID_DOMAINS, LYCookieSLooseCheckDomains), + PARSE_STR(RC_COOKIE_QUERY_INVALID_DOMAINS, LYCookieSQueryCheckDomains), + PARSE_STR(RC_COOKIE_REJECT_DOMAINS, LYCookieSRejectDomains), #ifdef EXP_PERSISTENT_COOKIES - PARSE_STR("cookie_save_file", LYCookieSaveFile), + PARSE_STR(RC_COOKIE_SAVE_FILE, LYCookieSaveFile), #endif /* EXP_PERSISTENT_COOKIES */ - PARSE_STR("cookie_strict_invalid_domains", LYCookieSStrictCheckDomains), - PARSE_Env("cso_proxy", 0 ), + PARSE_STR(RC_COOKIE_STRICT_INVALID_DOMAIN, LYCookieSStrictCheckDomains), + PARSE_Env(RC_CSO_PROXY, 0 ), #ifdef VMS - PARSE_STR("cswing_path", LYCSwingPath), -#endif - PARSE_FUN("default_bookmark_file", default_bookmark_file_fun), - PARSE_FUN("default_cache_size", default_cache_size_fun), - PARSE_FUN("default_editor", default_editor_fun), - PARSE_STR("default_index_file", indexfile), - PARSE_ENU("default_keypad_mode", keypad_mode, tbl_keypad_mode), - PARSE_FUN("default_keypad_mode_is_numbers_as_arrows", numbers_as_arrows_fun), - PARSE_ENU("default_user_mode", user_mode, tbl_user_mode), + PARSE_STR(RC_CSWING_PATH, LYCSwingPath), +#endif + PARSE_FUN(RC_DEFAULT_BOOKMARK_FILE, default_bookmark_file_fun), + PARSE_FUN(RC_DEFAULT_CACHE_SIZE, default_cache_size_fun), + PARSE_FUN(RC_DEFAULT_EDITOR, default_editor_fun), + PARSE_STR(RC_DEFAULT_INDEX_FILE, indexfile), + PARSE_ENU(RC_DEFAULT_KEYPAD_MODE, keypad_mode, tbl_keypad_mode), + PARSE_FUN(RC_DEFAULT_KEYPAD_MODE_NUMARO, numbers_as_arrows_fun), + PARSE_ENU(RC_DEFAULT_USER_MODE, user_mode, tbl_user_mode), #if defined(VMS) && defined(VAXC) && !defined(__DECC) - PARSE_INT("default_virtual_memory_size", HTVirtualMemorySize), + PARSE_INT(RC_DEFAULT_VIRTUAL_MEMORY_SIZE, HTVirtualMemorySize), #endif #ifdef DIRED_SUPPORT - PARSE_FUN("dired_menu", dired_menu_fun), + PARSE_FUN(RC_DIRED_MENU, dired_menu_fun), #endif #ifdef EXP_CHARSET_CHOICE - PARSE_FUN("display_charset_choice", parse_display_charset_choice), + PARSE_FUN(RC_DISPLAY_CHARSET_CHOICE, parse_display_charset_choice), #endif - PARSE_ADD("downloader", downloaders), - PARSE_SET("emacs_keys_always_on", emacs_keys), - PARSE_FUN("enable_lynxrc", enable_lynxrc), - PARSE_SET("enable_scrollback", enable_scrollback), + PARSE_ADD(RC_DOWNLOADER, downloaders), + PARSE_SET(RC_EMACS_KEYS_ALWAYS_ON, emacs_keys), + PARSE_FUN(RC_ENABLE_LYNXRC, enable_lynxrc), + PARSE_SET(RC_ENABLE_SCROLLBACK, enable_scrollback), #ifdef USE_EXTERNALS - PARSE_ADD("external", externals), + PARSE_ADD(RC_EXTERNAL, externals), #endif - PARSE_Env("finger_proxy", 0 ), + PARSE_Env(RC_FINGER_PROXY, 0 ), #if defined(_WINDOWS) /* 1998/10/05 (Mon) 17:34:15 */ - PARSE_SET("focus_window", focus_window), + PARSE_SET(RC_FOCUS_WINDOW, focus_window), #endif - PARSE_SET("force_8bit_toupper", UCForce8bitTOUPPER), - PARSE_SET("force_empty_hrefless_a", force_empty_hrefless_a), - PARSE_SET("force_ssl_cookies_secure", LYForceSSLCookiesSecure), + PARSE_SET(RC_FORCE_8BIT_TOUPPER, UCForce8bitTOUPPER), + PARSE_SET(RC_FORCE_EMPTY_HREFLESS_A, force_empty_hrefless_a), + PARSE_SET(RC_FORCE_SSL_COOKIES_SECURE, LYForceSSLCookiesSecure), #if !defined(NO_OPTION_FORMS) && !defined(NO_OPTION_MENU) - PARSE_SET("forms_options", LYUseFormsOptions), -#endif - PARSE_SET("ftp_passive", ftp_passive), - PARSE_Env("ftp_proxy", 0 ), - PARSE_STR("global_extension_map", global_extension_map), - PARSE_STR("global_mailcap", global_type_map), - PARSE_Env("gopher_proxy", 0 ), - PARSE_SET("gotobuffer", goto_buffer), - PARSE_STR("helpfile", helpfile), + PARSE_SET(RC_FORMS_OPTIONS, LYUseFormsOptions), +#endif + PARSE_SET(RC_FTP_PASSIVE, ftp_passive), + PARSE_Env(RC_FTP_PROXY, 0 ), + PARSE_STR(RC_GLOBAL_EXTENSION_MAP, global_extension_map), + PARSE_STR(RC_GLOBAL_MAILCAP, global_type_map), + PARSE_Env(RC_GOPHER_PROXY, 0 ), + PARSE_SET(RC_GOTOBUFFER, goto_buffer), + PARSE_STR(RC_HELPFILE, helpfile), #ifdef MARK_HIDDEN_LINKS - PARSE_STR("hidden_link_marker", hidden_link_marker), + PARSE_STR(RC_HIDDEN_LINK_MARKER, hidden_link_marker), #endif - PARSE_SET("historical_comments", historical_comments), + PARSE_SET(RC_HISTORICAL_COMMENTS, historical_comments), #ifdef USE_PRETTYSRC - PARSE_FUN("htmlsrc_attrname_xform", read_htmlsrc_attrname_xform), - PARSE_FUN("htmlsrc_tagname_xform", read_htmlsrc_tagname_xform), -#endif - PARSE_Env("http_proxy", 0 ), - PARSE_Env("https_proxy", 0 ), - PARSE_REQ("include", 0), - PARSE_TIM("infosecs", InfoSecs), - PARSE_STR("jump_prompt", jumpprompt), - PARSE_SET("jumpbuffer", jump_buffer), - PARSE_FUN("jumpfile", jumpfile_fun), + PARSE_FUN(RC_HTMLSRC_ATTRNAME_XFORM, read_htmlsrc_attrname_xform), + PARSE_FUN(RC_HTMLSRC_TAGNAME_XFORM, read_htmlsrc_tagname_xform), +#endif + PARSE_Env(RC_HTTP_PROXY, 0 ), + PARSE_Env(RC_HTTPS_PROXY, 0 ), + PARSE_REQ(RC_INCLUDE, 0), + PARSE_TIM(RC_INFOSECS, InfoSecs), + PARSE_STR(RC_JUMP_PROMPT, jumpprompt), + PARSE_SET(RC_JUMPBUFFER, jump_buffer), + PARSE_FUN(RC_JUMPFILE, jumpfile_fun), #ifdef EXP_JUSTIFY_ELTS - PARSE_SET("justify", ok_justify), - PARSE_INT("justify_max_void_percent", justify_max_void_percent), + PARSE_SET(RC_JUSTIFY, ok_justify), + PARSE_INT(RC_JUSTIFY_MAX_VOID_PERCENT, justify_max_void_percent), #endif #ifdef EXP_KEYBOARD_LAYOUT - PARSE_FUN("keyboard_layout", keyboard_layout_fun), + PARSE_FUN(RC_KEYBOARD_LAYOUT, keyboard_layout_fun), #endif - PARSE_FUN("keymap", keymap_fun), - PARSE_SET("leftarrow_in_textfield_prompt", textfield_prompt_at_left_edge), + PARSE_FUN(RC_KEYMAP, keymap_fun), + PARSE_SET(RC_LEFTARROW_IN_TEXTFLD_PROMPT, textfield_prompt_at_left_edge), #ifndef VMS - PARSE_STR("list_format", list_format), + PARSE_STR(RC_LIST_FORMAT, list_format), #endif #ifndef DISABLE_NEWS - PARSE_SET("list_news_dates", LYListNewsDates), - PARSE_SET("list_news_numbers", LYListNewsNumbers), + PARSE_SET(RC_LIST_NEWS_DATES, LYListNewsDates), + PARSE_SET(RC_LIST_NEWS_NUMBERS, LYListNewsNumbers), #endif - PARSE_STR("local_domain", LYLocalDomain), + PARSE_STR(RC_LOCAL_DOMAIN, LYLocalDomain), #if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) - PARSE_SET("local_execution_links_always_on", local_exec), - PARSE_SET("local_execution_links_on_but_not_remote", local_exec_on_local_files), + PARSE_SET(RC_LOCAL_EXECUTION_LINKS_ALWAYS, local_exec), + PARSE_SET(RC_LOCAL_EXECUTION_LINKS_LOCAL, local_exec_on_local_files), #endif - PARSE_FUN("localhost_alias", localhost_alias_fun), - PARSE_STR("lynx_host_name", LYHostName), - PARSE_FUN("lynx_sig_file", lynx_sig_file_fun), + PARSE_FUN(RC_LOCALHOST_ALIAS, localhost_alias_fun), + PARSE_STR(RC_LYNX_HOST_NAME, LYHostName), + PARSE_FUN(RC_LYNX_SIG_FILE, lynx_sig_file_fun), #ifdef LYNXCGI_LINKS #ifndef VMS - PARSE_STR("lynxcgi_document_root", LYCgiDocumentRoot), + PARSE_STR(RC_LYNXCGI_DOCUMENT_ROOT, LYCgiDocumentRoot), #endif - PARSE_FUN("lynxcgi_environment", lynxcgi_environment_fun), + PARSE_FUN(RC_LYNXCGI_ENVIRONMENT, lynxcgi_environment_fun), #endif #if USE_VMS_MAILER - PARSE_STR("mail_adrs", mail_adrs), -#endif - PARSE_SET("mail_system_error_logging", error_logging), - PARSE_SET("make_links_for_all_images", clickable_images), - PARSE_SET("make_pseudo_alts_for_inlines", pseudo_inline_alts), - PARSE_TIM("messagesecs", MessageSecs), - PARSE_SET("minimal_comments", minimal_comments), - PARSE_ENU("multi_bookmark_support", LYMultiBookmarks, tbl_multi_bookmarks), - PARSE_SET("ncr_in_bookmarks", UCSaveBookmarksInUnicode), + PARSE_STR(RC_MAIL_ADRS, mail_adrs), +#endif + PARSE_SET(RC_MAIL_SYSTEM_ERROR_LOGGING, error_logging), + PARSE_SET(RC_MAKE_LINKS_FOR_ALL_IMAGES, clickable_images), + PARSE_SET(RC_MAKE_PSEUDO_ALTS_FOR_INLINES, pseudo_inline_alts), + PARSE_TIM(RC_MESSAGESECS, MessageSecs), + PARSE_SET(RC_MINIMAL_COMMENTS, minimal_comments), + PARSE_ENU(RC_MULTI_BOOKMARK_SUPPORT, LYMultiBookmarks, tbl_multi_bookmarks), + PARSE_SET(RC_NCR_IN_BOOKMARKS, UCSaveBookmarksInUnicode), #ifndef DISABLE_NEWS - PARSE_FUN("news_chunk_size", news_chunk_size_fun), - PARSE_FUN("news_max_chunk", news_max_chunk_fun), - PARSE_FUN("news_posting", news_posting_fun), - PARSE_Env("news_proxy", 0), - PARSE_Env("newspost_proxy", 0), - PARSE_Env("newsreply_proxy", 0), - PARSE_Env("nntp_proxy", 0), - PARSE_ENV("nntpserver", 0), /* actually NNTPSERVER */ -#endif - PARSE_SET("number_fields_on_left",number_fields_on_left), - PARSE_SET("number_links_on_left", number_links_on_left), - PARSE_SET("no_dot_files", no_dotfiles), - PARSE_SET("no_file_referer", no_filereferer), + PARSE_FUN(RC_NEWS_CHUNK_SIZE, news_chunk_size_fun), + PARSE_FUN(RC_NEWS_MAX_CHUNK, news_max_chunk_fun), + PARSE_FUN(RC_NEWS_POSTING, news_posting_fun), + PARSE_Env(RC_NEWS_PROXY, 0), + PARSE_Env(RC_NEWSPOST_PROXY, 0), + PARSE_Env(RC_NEWSREPLY_PROXY, 0), + PARSE_Env(RC_NNTP_PROXY, 0), + PARSE_ENV(RC_NNTPSERVER, 0), /* actually NNTPSERVER */ +#endif + PARSE_SET(RC_NUMBER_FIELDS_ON_LEFT,number_fields_on_left), + PARSE_SET(RC_NUMBER_LINKS_ON_LEFT, number_links_on_left), + PARSE_SET(RC_NO_DOT_FILES, no_dotfiles), + PARSE_SET(RC_NO_FILE_REFERER, no_filereferer), #ifndef VMS - PARSE_SET("no_forced_core_dump", LYNoCore), + PARSE_SET(RC_NO_FORCED_CORE_DUMP, LYNoCore), #endif - PARSE_SET("no_from_header", LYNoFromHeader), - PARSE_SET("no_ismap_if_usemap", LYNoISMAPifUSEMAP), - PARSE_Env("no_proxy", 0 ), - PARSE_SET("no_referer_header", LYNoRefererHeader), + PARSE_SET(RC_NO_FROM_HEADER, LYNoFromHeader), + PARSE_SET(RC_NO_ISMAP_IF_USEMAP, LYNoISMAPifUSEMAP), + PARSE_Env(RC_NO_PROXY, 0 ), + PARSE_SET(RC_NO_REFERER_HEADER, LYNoRefererHeader), #ifdef SH_EX - PARSE_SET("no_table_center", no_table_center), + PARSE_SET(RC_NO_TABLE_CENTER, no_table_center), #endif - PARSE_FUN("nonrestarting_sigwinch", nonrest_sigwinch_fun), - PARSE_FUN("outgoing_mail_charset", outgoing_mail_charset_fun), + PARSE_FUN(RC_NONRESTARTING_SIGWINCH, nonrest_sigwinch_fun), + PARSE_FUN(RC_OUTGOING_MAIL_CHARSET, outgoing_mail_charset_fun), #ifdef DISP_PARTIAL - PARSE_SET("partial", display_partial_flag), - PARSE_INT("partial_thres", partial_threshold), + PARSE_SET(RC_PARTIAL, display_partial_flag), + PARSE_INT(RC_PARTIAL_THRES, partial_threshold), #endif #ifdef EXP_PERSISTENT_COOKIES - PARSE_SET("persistent_cookies", persistent_cookies), + PARSE_SET(RC_PERSISTENT_COOKIES, persistent_cookies), #endif /* EXP_PERSISTENT_COOKIES */ - PARSE_STR("personal_extension_map", personal_extension_map), - PARSE_STR("personal_mailcap", personal_type_map), - PARSE_STR("preferred_charset", pref_charset), - PARSE_STR("preferred_language", language), - PARSE_SET("prepend_base_to_source", LYPrependBaseToSource), - PARSE_SET("prepend_charset_to_source", LYPrependCharsetToSource), + PARSE_STR(RC_PERSONAL_EXTENSION_MAP, personal_extension_map), + PARSE_STR(RC_PERSONAL_MAILCAP, personal_type_map), + PARSE_STR(RC_PREFERRED_CHARSET, pref_charset), + PARSE_STR(RC_PREFERRED_LANGUAGE, language), + PARSE_SET(RC_PREPEND_BASE_TO_SOURCE, LYPrependBaseToSource), + PARSE_SET(RC_PREPEND_CHARSET_TO_SOURCE, LYPrependCharsetToSource), #ifdef USE_PRETTYSRC - PARSE_SET("prettysrc", LYpsrc), - PARSE_FUN("prettysrc_spec", psrcspec_fun), - PARSE_SET("prettysrc_view_no_anchor_numbering", psrcview_no_anchor_numbering), -#endif - PARSE_FUN("printer", printer_fun), - PARSE_SET("quit_default_yes", LYQuitDefaultYes), - PARSE_FUN("referer_with_query", referer_with_query_fun), - PARSE_SET("reuse_tempfiles", LYReuseTempfiles), + PARSE_SET(RC_PRETTYSRC, LYpsrc), + PARSE_FUN(RC_PRETTYSRC_SPEC, psrcspec_fun), + PARSE_SET(RC_PRETTYSRC_VIEW_NO_ANCHOR_NUM, psrcview_no_anchor_numbering), +#endif + PARSE_FUN(RC_PRINTER, printer_fun), + PARSE_SET(RC_QUIT_DEFAULT_YES, LYQuitDefaultYes), + PARSE_FUN(RC_REFERER_WITH_QUERY, referer_with_query_fun), + PARSE_SET(RC_REUSE_TEMPFILES, LYReuseTempfiles), #ifndef NO_RULES - PARSE_FUN("rule", HTSetConfiguration), - PARSE_FUN("rulesfile", cern_rulesfile_fun), + PARSE_FUN(RC_RULE, HTSetConfiguration), + PARSE_FUN(RC_RULESFILE, cern_rulesfile_fun), #endif /* NO_RULES */ - PARSE_STR("save_space", lynx_save_space), - PARSE_SET("scan_for_buried_news_refs", scan_for_buried_news_references), + PARSE_STR(RC_SAVE_SPACE, lynx_save_space), + PARSE_SET(RC_SCAN_FOR_BURIED_NEWS_REFS, scan_for_buried_news_references), #ifdef USE_SCROLLBAR - PARSE_SET("scrollbar", LYShowScrollbar), - PARSE_SET("scrollbar_arrow", LYsb_arrow), -#endif - PARSE_SET("seek_frag_area_in_cur", LYSeekFragAREAinCur), - PARSE_SET("seek_frag_map_in_cur", LYSeekFragMAPinCur), - PARSE_SET("set_cookies", LYSetCookies), - PARSE_SET("show_cursor", LYShowCursor), - PARSE_ENU("show_kb_rate", LYTransferRate, tbl_transfer_rate), - PARSE_Env("snews_proxy", 0 ), - PARSE_Env("snewspost_proxy", 0 ), - PARSE_Env("snewsreply_proxy", 0 ), - PARSE_SET("soft_dquotes", soft_dquotes), + PARSE_SET(RC_SCROLLBAR, LYShowScrollbar), + PARSE_SET(RC_SCROLLBAR_ARROW, LYsb_arrow), +#endif + PARSE_SET(RC_SEEK_FRAG_AREA_IN_CUR, LYSeekFragAREAinCur), + PARSE_SET(RC_SEEK_FRAG_MAP_IN_CUR, LYSeekFragMAPinCur), + PARSE_SET(RC_SET_COOKIES, LYSetCookies), + PARSE_SET(RC_SHOW_CURSOR, LYShowCursor), + PARSE_ENU(RC_SHOW_KB_RATE, LYTransferRate, tbl_transfer_rate), + PARSE_Env(RC_SNEWS_PROXY, 0 ), + PARSE_Env(RC_SNEWSPOST_PROXY, 0 ), + PARSE_Env(RC_SNEWSREPLY_PROXY, 0 ), + PARSE_SET(RC_SOFT_DQUOTES, soft_dquotes), #ifdef SOURCE_CACHE - PARSE_ENU("source_cache", LYCacheSource, tbl_source_cache), - PARSE_ENU("source_cache_for_aborted", LYCacheSourceForAborted, tbl_abort_source_cache), -#endif - PARSE_STR("startfile", startfile), - PARSE_SET("strip_dotdot_urls", LYStripDotDotURLs), - PARSE_SET("substitute_underscores", use_underscore), - PARSE_FUN("suffix", suffix_fun), - PARSE_FUN("suffix_order", suffix_order_fun), - PARSE_FUN("system_editor", system_editor_fun), - PARSE_STR("system_mail", system_mail), - PARSE_STR("system_mail_flags", system_mail_flags), - PARSE_ENU("tagsoup", Old_DTD, tbl_DTD_recovery), + PARSE_ENU(RC_SOURCE_CACHE, LYCacheSource, tbl_source_cache), + PARSE_ENU(RC_SOURCE_CACHE_FOR_ABORTED, LYCacheSourceForAborted, tbl_abort_source_cache), +#endif + PARSE_STR(RC_STARTFILE, startfile), + PARSE_SET(RC_STRIP_DOTDOT_URLS, LYStripDotDotURLs), + PARSE_SET(RC_SUBSTITUTE_UNDERSCORES, use_underscore), + PARSE_FUN(RC_SUFFIX, suffix_fun), + PARSE_FUN(RC_SUFFIX_ORDER, suffix_order_fun), + PARSE_FUN(RC_SYSTEM_EDITOR, system_editor_fun), + PARSE_STR(RC_SYSTEM_MAIL, system_mail), + PARSE_STR(RC_SYSTEM_MAIL_FLAGS, system_mail_flags), + PARSE_FUN(RC_TAGSOUP, get_tagsoup), #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION - PARSE_SET("textfields_need_activation", textfields_activation_option), + PARSE_SET(RC_TEXTFIELDS_NEED_ACTIVATION, textfields_activation_option), #endif #if defined(_WINDOWS) - PARSE_INT("timeout", lynx_timeout), + PARSE_INT(RC_TIMEOUT, lynx_timeout), #endif - PARSE_SET("trim_input_fields", LYtrimInputFields), + PARSE_SET(RC_TRIM_INPUT_FIELDS, LYtrimInputFields), #ifdef EXEC_LINKS - PARSE_DEF("trusted_exec", EXEC_PATH), + PARSE_DEF(RC_TRUSTED_EXEC, EXEC_PATH), #endif #ifdef LYNXCGI_LINKS - PARSE_DEF("trusted_lynxcgi", CGI_PATH), + PARSE_DEF(RC_TRUSTED_LYNXCGI, CGI_PATH), #endif #ifdef DIRED_SUPPORT - PARSE_ADD("uploader", uploaders), + PARSE_ADD(RC_UPLOADER, uploaders), #endif - PARSE_STR("url_domain_prefixes", URLDomainPrefixes), - PARSE_STR("url_domain_suffixes", URLDomainSuffixes), + PARSE_STR(RC_URL_DOMAIN_PREFIXES, URLDomainPrefixes), + PARSE_STR(RC_URL_DOMAIN_SUFFIXES, URLDomainSuffixes), #ifdef VMS - PARSE_SET("use_fixed_records", UseFixedRecords), + PARSE_SET(RC_USE_FIXED_RECORDS, UseFixedRecords), #endif #if defined(USE_MOUSE) - PARSE_SET("use_mouse", LYUseMouse), -#endif - PARSE_SET("use_select_popups", LYSelectPopups), - PARSE_SET("verbose_images", verbose_img), - PARSE_SET("vi_keys_always_on", vi_keys), - PARSE_FUN("viewer", viewer_fun), - PARSE_Env("wais_proxy", 0 ), - PARSE_STR("xloadimage_command", XLoadImageCommand), + PARSE_SET(RC_USE_MOUSE, LYUseMouse), +#endif + PARSE_SET(RC_USE_SELECT_POPUPS, LYSelectPopups), + PARSE_SET(RC_VERBOSE_IMAGES, verbose_img), + PARSE_SET(RC_VI_KEYS_ALWAYS_ON, vi_keys), + PARSE_FUN(RC_VIEWER, viewer_fun), + PARSE_Env(RC_WAIS_PROXY, 0 ), + PARSE_STR(RC_XLOADIMAGE_COMMAND, XLoadImageCommand), PARSE_NIL }; diff --git a/src/LYStrings.c b/src/LYStrings.c index 483f7b02..dc9862d4 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -1676,17 +1676,17 @@ re_read: switch (a) { case 'A': c = UPARROW; break; - case 'x': c = UPARROW; break; /* keypad up on pc ncsa telnet */ case 'B': c = DNARROW; break; - case 'r': c = DNARROW; break; /* keypad down on pc ncsa telnet */ case 'C': c = RTARROW; break; - case 'v': c = RTARROW; break; /* keypad right on pc ncsa telnet */ case 'D': c = LTARROW; break; - case 't': c = LTARROW; break; /* keypad left on pc ncsa telnet */ - case 'y': c = PGUP; break; /* keypad on pc ncsa telnet */ - case 's': c = PGDOWN; break; /* keypad on pc ncsa telnet */ - case 'w': c = HOME; break; /* keypad on pc ncsa telnet */ - case 'q': c = END_KEY; break; /* keypad on pc ncsa telnet */ + case 'q': c = END_KEY; break; /* vt100 application keypad 1 */ + case 'r': c = DNARROW; break; /* vt100 application keypad 2 */ + case 's': c = PGDOWN; break; /* vt100 application keypad 3 */ + case 't': c = LTARROW; break; /* vt100 application keypad 4 */ + case 'v': c = RTARROW; break; /* vt100 application keypad 6 */ + case 'w': c = HOME; break; /* vt100 application keypad 7 */ + case 'x': c = UPARROW; break; /* vt100 application keypad 8 */ + case 'y': c = PGUP; break; /* vt100 application keypad 9 */ case 'M': #if defined(USE_SLANG) && defined(USE_MOUSE) if (found_CSI(c,b)) diff --git a/src/LYUtils.c b/src/LYUtils.c index d5aa910f..3f94afad 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -3301,7 +3301,7 @@ PUBLIC void size_change ARGS1( #if defined(CAN_SWITCH_DISPLAY_CHARSET) && defined(CAN_AUTODETECT_DISPLAY_CHARSET) /* May need to reload the font due to different char-box size */ if (current_char_set != auto_display_charset) - Switch_Display_Charset(current_char_set, SWITCH_DISPLAY_CHARSET_SIZECHANGE); + Switch_Display_Charset(current_char_set, SWITCH_DISPLAY_CHARSET_RESIZE); #endif } #ifdef SIGWINCH @@ -3418,12 +3418,12 @@ PUBLIC void change_sug_filename ARGS1( FREE(temp); if (fname[strlen(fname) - 1] == '/') - /* - * Hmm... we have a directory name. - * It is annoying to see a scheme+host+path name as a suggested one, - * let's remove the last_slash and go ahead like we have a file name. - LP - */ - fname[strlen(fname) - 1] = '\0'; + /* + * Hmm... we have a directory name. + * It is annoying to see a scheme+host+path name as a suggested one, + * let's remove the last_slash and go ahead like we have a file name. - LP + */ + fname[strlen(fname) - 1] = '\0'; /* * Remove everything up the the last_slash if there is one. @@ -7305,7 +7305,7 @@ PUBLIC int LYCopyFile ARGS2( { int code; -#if defined(DOSPATH) || defined(__CYGWIN__) /* thanks to Hiroyuki Senshu */ +#if !defined(COPY_PATH) #define BUF_SIZE 1024 diff --git a/src/LYrcFile.c b/src/LYrcFile.c index fba32428..790b4aa8 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -8,6 +8,7 @@ #include <LYBookmark.h> #include <LYCookie.h> #include <LYKeymap.h> +#include <HTMLDTD.h> #include <LYLeaks.h> @@ -22,6 +23,8 @@ #define putBool(value) ((value) ? "on" : "off") PUBLIC Config_Enum tbl_DTD_recovery[] = { + { "true", TRUE }, + { "false", FALSE }, { "on", TRUE }, { "off", FALSE }, { "sortasgml", TRUE }, @@ -32,11 +35,25 @@ PUBLIC Config_Enum tbl_DTD_recovery[] = { #ifdef DIRED_SUPPORT PRIVATE Config_Enum tbl_dir_list_style[] = { { "FILES_FIRST", FILES_FIRST }, - { "DIRECTORIES_FIRST", 0 }, + { "DIRECTORIES_FIRST", DIRS_FIRST }, { "MIXED_STYLE", MIXED_STYLE }, { NULL, MIXED_STYLE }, }; +#ifdef LONG_LIST +PRIVATE Config_Enum tbl_dir_list_order[] = { + { "ORDER_BY_NAME", ORDER_BY_NAME }, + { "ORDER_BY_TYPE", ORDER_BY_TYPE }, + { "ORDER_BY_SIZE", ORDER_BY_SIZE }, + { "ORDER_BY_DATE", ORDER_BY_DATE }, + { "ORDER_BY_MODE", ORDER_BY_MODE }, +#ifndef NO_GROUPS + { "ORDER_BY_USER", ORDER_BY_USER }, + { "ORDER_BY_GROUP", ORDER_BY_GROUP }, #endif + { NULL, ORDER_BY_NAME }, +}; +#endif /* LONG_LIST */ +#endif /* DIRED_SUPPORT */ PRIVATE Config_Enum tbl_file_sort[] = { { "BY_FILENAME", FILE_BY_NAME }, @@ -110,7 +127,7 @@ PRIVATE BOOL getBool ARGS1(char *, src) return (BOOL) (!strncasecomp(src, "on", 2) || !strncasecomp(src, "true", 4)); } -PRIVATE CONST char *LYputEnum ARGS2( +PUBLIC CONST char *LYputEnum ARGS2( Config_Enum *, table, int, value) { @@ -123,21 +140,29 @@ PRIVATE CONST char *LYputEnum ARGS2( return "?"; } -PRIVATE BOOL LYgetEnum ARGS3( +PUBLIC BOOL LYgetEnum ARGS3( Config_Enum *, table, - char *, src, - int *, value) + char *, name, + int *, result) { - while (table->name != 0) { - if (!strncasecomp(table->name, src, strlen(table->name))) { - *value = table->value; + Config_Enum *found = 0; + unsigned len = strlen(name); + + if (len != 0) { + while (table->name != 0) { + if (!strncasecomp(table->name, name, len)) { + if (found != 0) + return FALSE; /* ambiguous, don't use this */ + found = table; + } + table++; + } + if (found != 0) { + *result = found->value; return TRUE; } - table++; } - if (table->value >= 0) /* is there a default? */ - *value = table->value; - return FALSE; + return FALSE; /* no match */ } /* these are for data that are normally not read/written from .lynxrc */ @@ -237,34 +262,51 @@ PRIVATE void put_editor ARGS2(FILE *, fp, struct config_type *, tbl) fprintf(fp, "%s=%s\n\n", tbl->name, NonNull(editor)); } +PUBLIC int get_tagsoup ARGS1(char *, value) +{ + int found = Old_DTD; + + if (LYgetEnum(tbl_DTD_recovery, value, &found) + && Old_DTD != found) { + Old_DTD = found; + HTSwitchDTD(!Old_DTD); + } + return 0; +} + +PRIVATE void put_tagsoup ARGS2(FILE *, fp, struct config_type *, tbl) +{ + fprintf(fp, "%s=%s\n\n", tbl->name, LYputEnum(tbl_DTD_recovery, Old_DTD)); +} + /* This table is searched ignoring case */ static Config_Type Config_Table [] = { - PARSE_SET("accept_all_cookies", LYAcceptAllCookies, N_("\ + PARSE_SET(RC_ACCEPT_ALL_COOKIES, LYAcceptAllCookies, N_("\ accept_all_cookies allows the user to tell Lynx to automatically\n\ accept all cookies if desired. The default is \"FALSE\" which will\n\ prompt for each cookie. Set accept_all_cookies to \"TRUE\" to accept\n\ all cookies.\n\ ")), - MAYBE_FUN("assume_char_set", get_assume_charset, put_assume_charset, MSG_ENABLE_LYNXRC), - PARSE_STR("bookmark_file", bookmark_page, N_("\ + MAYBE_FUN(RC_ASSUME_CHARSET, get_assume_charset, put_assume_charset, MSG_ENABLE_LYNXRC), + PARSE_STR(RC_BOOKMARK_FILE, bookmark_page, N_("\ bookmark_file specifies the name and location of the default bookmark\n\ file into which the user can paste links for easy access at a later\n\ date.\n\ ")), - PARSE_SET("case_sensitive_searching", case_sensitive, N_("\ + PARSE_SET(RC_CASE_SENSITIVE_SEARCHING, case_sensitive, N_("\ If case_sensitive_searching is \"on\" then when the user invokes a search\n\ using the 's' or '/' keys, the search performed will be case sensitive\n\ instead of case INsensitive. The default is usually \"off\".\n\ ")), - PARSE_FUN("character_set", get_display_charset, put_display_charset, N_("\ + PARSE_FUN(RC_CHARACTER_SET, get_display_charset, put_display_charset, N_("\ The character_set definition controls the representation of 8 bit\n\ characters for your terminal. If 8 bit characters do not show up\n\ correctly on your screen you may try changing to a different 8 bit\n\ set or using the 7 bit character approximations.\n\ Current valid characters sets are:\n\ ")), - PARSE_LIS("cookie_accept_domains", LYCookieAcceptDomains, N_("\ + PARSE_LIS(RC_COOKIE_ACCEPT_DOMAINS, LYCookieAcceptDomains, N_("\ cookie_accept_domains and cookie_reject_domains are comma-delimited\n\ lists of domains from which Lynx should automatically accept or reject\n\ all cookies. If a domain is specified in both options, rejection will\n\ @@ -272,12 +314,12 @@ take precedence. The accept_all_cookies parameter will override any\n\ settings made here.\n\ ")), #ifdef EXP_PERSISTENT_COOKIES - PARSE_STR("cookie_file", LYCookieFile, N_("\ + PARSE_STR(RC_COOKIE_FILE, LYCookieFile, N_("\ cookie_file specifies the file from which to read persistent cookies.\n\ The default is ~/.lynx_cookies.\n\ ")), #endif - PARSE_STR("cookie_loose_invalid_domains", LYCookieLooseCheckDomains, N_("\ + PARSE_STR(RC_COOKIE_LOOSE_INVALID_DOMAINS, LYCookieLooseCheckDomains, N_("\ cookie_loose_invalid_domains, cookie_strict_invalid_domains, and\n\ cookie_query_invalid_domains are comma-delimited lists of which domains\n\ should be subjected to varying degrees of validity checking. If a\n\ @@ -286,31 +328,37 @@ be applied. A domain with loose checking will be allowed to set cookies\n\ with an invalid path or domain attribute. All domains will default to\n\ querying the user for an invalid path or domain.\n\ ")), - PARSE_STR("cookie_query_invalid_domains", LYCookieQueryCheckDomains, NULL), - PARSE_LIS("cookie_reject_domains", LYCookieRejectDomains, NULL), - PARSE_STR("cookie_strict_invalid_domains", LYCookieStrictCheckDomains, NULL), + PARSE_STR(RC_COOKIE_QUERY_INVALID_DOMAINS, LYCookieQueryCheckDomains, NULL), + PARSE_LIS(RC_COOKIE_REJECT_DOMAINS, LYCookieRejectDomains, NULL), + PARSE_STR(RC_COOKIE_STRICT_INVALID_DOMAIN, LYCookieStrictCheckDomains, NULL), #ifdef DIRED_SUPPORT - PARSE_ENU("dir_list_style", dir_list_style, tbl_dir_list_style, N_("\ +#ifdef LONG_LIST + PARSE_ENU(RC_DIR_LIST_ORDER, dir_list_order, tbl_dir_list_order, N_("\ +dir_list_order specifies the directory list order under DIRED_SUPPORT\n\ +(if implemented). The default is \"ORDER_BY_NAME\"\n\ +")), +#endif + PARSE_ENU(RC_DIR_LIST_STYLE, dir_list_style, tbl_dir_list_style, N_("\ dir_list_styles specifies the directory list style under DIRED_SUPPORT\n\ (if implemented). The default is \"MIXED_STYLE\", which sorts both\n\ files and directories together. \"FILES_FIRST\" lists files first and\n\ \"DIRECTORIES_FIRST\" lists directories first.\n\ ")), #endif - MAYBE_STR("display", x_display, MSG_ENABLE_LYNXRC), - PARSE_SET("emacs_keys", emacs_keys, N_("\ + MAYBE_STR(RC_DISPLAY, x_display, MSG_ENABLE_LYNXRC), + PARSE_SET(RC_EMACS_KEYS, emacs_keys, N_("\ If emacs_keys is to \"on\" then the normal EMACS movement keys:\n\ ^N = down ^P = up\n\ ^B = left ^F = right\n\ will be enabled.\n\ ")), - PARSE_FUN("file_editor", get_editor, put_editor, N_("\ + PARSE_FUN(RC_FILE_EDITOR, get_editor, put_editor, N_("\ file_editor specifies the editor to be invoked when editing local files\n\ or sending mail. If no editor is specified, then file editing is disabled\n\ unless it is activated from the command line, and the built-in line editor\n\ will be used for sending mail.\n\ ")), - PARSE_ENU("file_sorting_method", HTfileSortMethod, tbl_file_sort, N_("\ + PARSE_ENU(RC_FILE_SORTING_METHOD, HTfileSortMethod, tbl_file_sort, N_("\ The file_sorting_method specifies which value to sort on when viewing\n\ file lists such as FTP directories. The options are:\n\ BY_FILENAME -- sorts on the name of the file\n\ @@ -319,10 +367,10 @@ file lists such as FTP directories. The options are:\n\ BY_DATE -- sorts on the date of the file\n\ ")), #ifdef EXP_KEYBOARD_LAYOUT - PARSE_ARY("kblayout", current_layout, LYKbLayoutNames, NULL), + PARSE_ARY(RC_KBLAYOUT, current_layout, LYKbLayoutNames, NULL), #endif - PARSE_ENU("keypad_mode", keypad_mode, tbl_keypad_mode, NULL), - PARSE_ARY("lineedit_mode", current_lineedit, LYLineeditNames, N_("\ + PARSE_ENU(RC_KEYPAD_MODE, keypad_mode, tbl_keypad_mode, NULL), + PARSE_ARY(RC_LINEEDIT_MODE, current_lineedit, LYLineeditNames, N_("\ lineedit_mode specifies the key binding used for inputting strings in\n\ prompts and forms. If lineedit_mode is set to \"Default Binding\" then\n\ the following control characters are used for moving and deleting:\n\ @@ -335,15 +383,15 @@ the following control characters are used for moving and deleting:\n\ \n\ Current lineedit modes are:\n\ ")), - MAYBE_SET("make_pseudo_alts_for_inlines", pseudo_inline_alts, MSG_ENABLE_LYNXRC), - MAYBE_SET("make_links_for_all_images", clickable_images, MSG_ENABLE_LYNXRC), - PARSE_MBM("multi_bookmark", N_("\ + MAYBE_SET(RC_MAKE_PSEUDO_ALTS_FOR_INLINES, pseudo_inline_alts, MSG_ENABLE_LYNXRC), + MAYBE_SET(RC_MAKE_LINKS_FOR_ALL_IMAGES, clickable_images, MSG_ENABLE_LYNXRC), + PARSE_MBM(RC_MULTI_BOOKMARK, N_("\ The following allow you to define sub-bookmark files and descriptions.\n\ The format is multi_bookmark<capital_letter>=<filename>,<description>\n\ Up to 26 bookmark files (for the English capital letters) are allowed.\n\ We start with \"multi_bookmarkB\" since 'A' is the default (see above).\n\ ")), - PARSE_STR("personal_mail_address", personal_mail_address, N_("\ + PARSE_STR(RC_PERSONAL_MAIL_ADDRESS, personal_mail_address, N_("\ personal_mail_address specifies your personal mail address. The\n\ address will be sent during HTTP file transfers for authorization and\n\ logging purposes, and for mailed comments.\n\ @@ -352,7 +400,7 @@ to TRUE in lynx.cfg, or use the -nofrom command line switch. You also\n\ could leave this field blank, but then you won't have it included in\n\ your mailed comments.\n\ ")), - PARSE_STR("preferred_charset", pref_charset, N_("\ + PARSE_STR(RC_PREFERRED_CHARSET, pref_charset, N_("\ preferred_charset specifies the character set in MIME notation (e.g.,\n\ ISO-8859-2, ISO-8859-5) which Lynx will indicate you prefer in requests\n\ to http servers using an Accept-Charset header. The value should NOT\n\ @@ -366,16 +414,16 @@ according to the Accept-Charset header, then the server SHOULD send\n\ an error response, though the sending of an unacceptable response\n\ is also allowed.\n\ ")), - PARSE_STR("preferred_language", language, N_("\ + PARSE_STR(RC_PREFERRED_LANGUAGE, language, N_("\ preferred_language specifies the language in MIME notation (e.g., en,\n\ fr, may be a comma-separated list in decreasing preference)\n\ which Lynx will indicate you prefer in requests to http servers.\n\ If a file in that language is available, the server will send it.\n\ Otherwise, the server will send the file in it's default language.\n\ ")), - MAYBE_SET("raw_mode", LYRawMode, MSG_ENABLE_LYNXRC), + MAYBE_SET(RC_RAW_MODE, LYRawMode, MSG_ENABLE_LYNXRC), #if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS)) - PARSE_SET("run_all_execution_links", local_exec, N_("\ + PARSE_SET(RC_RUN_ALL_EXECUTION_LINKS, local_exec, N_("\ If run_all_execution_links is set \"on\" then all local execution links\n\ will be executed when they are selected.\n\ \n\ @@ -386,7 +434,7 @@ WARNING - This is potentially VERY dangerous. Since you may view\n\ or compromise security. This should only be set to \"on\" if\n\ you are viewing trusted source information.\n\ ")), - PARSE_SET("run_execution_links_on_local_files", local_exec_on_local_files, N_("\ + PARSE_SET(RC_RUN_EXECUTION_LINKS_LOCAL, local_exec_on_local_files, N_("\ If run_execution_links_on_local_files is set \"on\" then all local\n\ execution links that are found in LOCAL files will be executed when they\n\ are selected. This is different from run_all_execution_links in that\n\ @@ -402,9 +450,9 @@ WARNING - This is potentially dangerous. Since you may view\n\ ")), #endif #ifdef USE_SCROLLBAR - MAYBE_SET("scrollbar", LYShowScrollbar, MSG_ENABLE_LYNXRC), + MAYBE_SET(RC_SCROLLBAR, LYShowScrollbar, MSG_ENABLE_LYNXRC), #endif - PARSE_SET("select_popups", LYSelectPopups, N_("\ + PARSE_SET(RC_SELECT_POPUPS, LYSelectPopups, N_("\ select_popups specifies whether the OPTIONs in a SELECT block which\n\ lacks a MULTIPLE attribute are presented as a vertical list of radio\n\ buttons or via a popup menu. Note that if the MULTIPLE attribute is\n\ @@ -413,8 +461,8 @@ of checkboxes for the OPTIONs. A value of \"on\" will set popup menus\n\ as the default while a value of \"off\" will set use of radio boxes.\n\ The default can be overridden via the -popup command line toggle.\n\ ")), - MAYBE_SET("set_cookies", LYSetCookies, MSG_ENABLE_LYNXRC), - PARSE_ENU("show_color", LYrcShowColor, tbl_show_colors, N_("\ + MAYBE_SET(RC_SET_COOKIES, LYSetCookies, MSG_ENABLE_LYNXRC), + PARSE_ENU(RC_SHOW_COLOR, LYrcShowColor, tbl_show_colors, N_("\ show_color specifies how to set the color mode at startup. A value of\n\ \"never\" will force color mode off (treat the terminal as monochrome)\n\ at startup even if the terminal appears to be color capable. A value of\n\ @@ -431,7 +479,7 @@ The mode set at startup can be changed via the \"show color\" option in\n\ the 'o'ptions menu. If the option settings are saved, the \"on\" and\n\ \"off\" \"show color\" settings will be treated as \"default\".\n\ ")), - PARSE_SET("show_cursor", LYShowCursor, N_("\ + PARSE_SET(RC_SHOW_CURSOR, LYShowCursor, N_("\ show_cursor specifies whether to 'hide' the cursor to the right (and\n\ bottom, if possible) of the screen, or to place it to the left of the\n\ current link in documents, or current option in select popup windows.\n\ @@ -442,7 +490,7 @@ or color. A value of \"on\" will set positioning to the left as the\n\ default while a value of \"off\" will set 'hiding' of the cursor.\n\ The default can be overridden via the -show_cursor command line toggle.\n\ ")), - PARSE_SET("show_dotfiles", show_dotfiles, N_("\ + PARSE_SET(RC_SHOW_DOTFILES, show_dotfiles, N_("\ show_dotfiles specifies that the directory listing should include\n\ \"hidden\" (dot) files/directories. If set \"on\", this will be\n\ honored only if enabled via userdefs.h and/or lynx.cfg, and not\n\ @@ -450,10 +498,10 @@ restricted via a command line switch. If display of hidden files\n\ is disabled, creation of such files via Lynx also is disabled.\n\ ")), #ifdef EXP_READPROGRESS - MAYBE_ENU("show_kb_rate", LYTransferRate, tbl_transfer_rate, + MAYBE_ENU(RC_SHOW_KB_RATE, LYTransferRate, tbl_transfer_rate, MSG_ENABLE_LYNXRC), #endif - PARSE_ENU("sub_bookmarks", LYMultiBookmarks, tbl_multi_bookmarks, N_("\ + PARSE_ENU(RC_SUB_BOOKMARKS, LYMultiBookmarks, tbl_multi_bookmarks, N_("\ If sub_bookmarks is not turned \"off\", and multiple bookmarks have\n\ been defined (see below), then all bookmark operations will first\n\ prompt the user to select an active sub-bookmark file. If the default\n\ @@ -464,9 +512,9 @@ statusline prompt instead of the menu seen in novice and intermediate\n\ user modes. When this option is set to \"standard\", the menu will be\n\ presented regardless of user mode.\n\ ")), - MAYBE_ENU("tagsoup", Old_DTD, tbl_DTD_recovery, + MAYBE_FUN(RC_TAGSOUP, get_tagsoup, put_tagsoup, MSG_ENABLE_LYNXRC), - PARSE_ENU("user_mode", user_mode, tbl_user_mode, N_("\ + PARSE_ENU(RC_USER_MODE, user_mode, tbl_user_mode, N_("\ user_mode specifies the users level of knowledge with Lynx. The\n\ default is \"NOVICE\" which displays two extra lines of help at the\n\ bottom of the screen to aid the user in learning the basic Lynx\n\ @@ -474,13 +522,13 @@ commands. Set user_mode to \"INTERMEDIATE\" to turn off the extra info.\n\ Use \"ADVANCED\" to see the URL of the currently selected link at the\n\ bottom of the screen.\n\ ")), - MAYBE_STR("useragent", LYUserAgent, MSG_ENABLE_LYNXRC), - PARSE_SET("verbose_images", verbose_img, N_("\ + MAYBE_STR(RC_USERAGENT, LYUserAgent, MSG_ENABLE_LYNXRC), + PARSE_SET(RC_VERBOSE_IMAGES, verbose_img, N_("\ If verbose_images is \"on\", lynx will print the name of the image\n\ source file in place of [INLINE], [LINK] or [IMAGE]\n\ See also VERBOSE_IMAGES in lynx.cfg\n\ ")), - PARSE_SET("vi_keys", vi_keys, N_("\ + PARSE_SET(RC_VI_KEYS, vi_keys, N_("\ If vi_keys is set to \"on\", then the normal VI movement keys:\n\ j = down k = up\n\ h = left l = right\n\ @@ -488,7 +536,7 @@ will be enabled. These keys are only lower case.\n\ Capital 'H', 'J' and 'K will still activate help, jump shortcuts,\n\ and the keymap display, respectively.\n\ ")), - PARSE_ENU("visited_links", Visited_Links_As, tbl_visited_links, N_("\ + PARSE_ENU(RC_VISITED_LINKS, Visited_Links_As, tbl_visited_links, N_("\ The visited_links setting controls how Lynx organizes the information\n\ in the Visited Links Page.\n\ ")), @@ -571,7 +619,7 @@ PUBLIC void read_rc ARGS1(FILE *, fp) tbl = lookup_config(name); if (tbl->name == 0) { - char *special = "multi_bookmark"; + char *special = RC_MULTI_BOOKMARK; if (!strncasecomp(name, special, strlen(special))) { tbl = lookup_config(special); } diff --git a/src/LYrcFile.h b/src/LYrcFile.h index 63e88d07..155fd152 100644 --- a/src/LYrcFile.h +++ b/src/LYrcFile.h @@ -5,14 +5,218 @@ #include <LYStructs.h> #endif /* LYSTRUCTS_H */ +/* configuration-variable names to share with LYReadCFG.c and LYOptions.c */ +#define RC_ACCEPT_ALL_COOKIES "accept_all_cookies" +#define RC_ALERTSECS "alertsecs" +#define RC_ALWAYS_RESUBMIT_POSTS "always_resubmit_posts" +#define RC_ALWAYS_TRUSTED_EXEC "always_trusted_exec" +#define RC_ASSUMED_COLOR "assumed_color" +#define RC_ASSUMED_DOC_CHARSET_CHOICE "assumed_doc_charset_choice" +#define RC_ASSUME_CHARSET "assume_charset" +#define RC_ASSUME_LOCAL_CHARSET "assume_local_charset" +#define RC_ASSUME_UNREC_CHARSET "assume_unrec_charset" +#define RC_AUTO_UNCACHE_DIRLISTS "auto_uncache_dirlists" +#define RC_BIBP_BIBHOST "bibp_bibhost" +#define RC_BIBP_GLOBALSERVER "bibp_globalserver" +#define RC_BLOCK_MULTI_BOOKMARKS "block_multi_bookmarks" +#define RC_BOLD_H1 "bold_h1" +#define RC_BOLD_HEADERS "bold_headers" +#define RC_BOLD_NAME_ANCHORS "bold_name_anchors" +#define RC_BOOKMARK_FILE "bookmark_file" +#define RC_CASE_SENSITIVE_ALWAYS_ON "case_sensitive_always_on" +#define RC_CASE_SENSITIVE_SEARCHING "case_sensitive_searching" +#define RC_CHARACTER_SET "character_set" +#define RC_CHARSETS_DIRECTORY "charsets_directory" +#define RC_CHARSET_SWITCH_RULES "charset_switch_rules" +#define RC_CHECKMAIL "checkmail" +#define RC_COLLAPSE_BR_TAGS "collapse_br_tags" +#define RC_COLOR "color" +#define RC_CONNECT_TIMEOUT "connect_timeout" +#define RC_COOKIE_ACCEPT_DOMAINS "cookie_accept_domains" +#define RC_COOKIE_FILE "cookie_file" +#define RC_COOKIE_LOOSE_INVALID_DOMAINS "cookie_loose_invalid_domains" +#define RC_COOKIE_QUERY_INVALID_DOMAINS "cookie_query_invalid_domains" +#define RC_COOKIE_REJECT_DOMAINS "cookie_reject_domains" +#define RC_COOKIE_SAVE_FILE "cookie_save_file" +#define RC_COOKIE_STRICT_INVALID_DOMAIN "cookie_strict_invalid_domains" +#define RC_CSO_PROXY "cso_proxy" +#define RC_CSWING_PATH "cswing_path" +#define RC_DEFAULT_BOOKMARK_FILE "default_bookmark_file" +#define RC_DEFAULT_CACHE_SIZE "default_cache_size" +#define RC_DEFAULT_EDITOR "default_editor" +#define RC_DEFAULT_INDEX_FILE "default_index_file" +#define RC_DEFAULT_KEYPAD_MODE "default_keypad_mode" +#define RC_DEFAULT_KEYPAD_MODE_NUMARO "default_keypad_mode_is_numbers_as_arrows" +#define RC_DEFAULT_USER_MODE "default_user_mode" +#define RC_DEFAULT_VIRTUAL_MEMORY_SIZE "default_virtual_memory_size" +#define RC_DEFINE RC_XLOADIMAGE_COMMAND "XLOADIMAGE_COMMAND" +#define RC_DIRED_MENU "dired_menu" +#define RC_DIR_LIST_ORDER "dir_list_order" +#define RC_DIR_LIST_STYLE "dir_list_style" +#define RC_DISPLAY "display" +#define RC_DISPLAY_CHARSET_CHOICE "display_charset_choice" +#define RC_DOWNLOADER "downloader" +#define RC_EMACS_KEYS "emacs_keys" +#define RC_EMACS_KEYS_ALWAYS_ON "emacs_keys_always_on" +#define RC_ENABLE_LYNXRC "enable_lynxrc" +#define RC_ENABLE_SCROLLBACK "enable_scrollback" +#define RC_EXTERNAL "external" +#define RC_FILE_EDITOR "file_editor" +#define RC_FILE_SORTING_METHOD "file_sorting_method" +#define RC_FINGER_PROXY "finger_proxy" +#define RC_FOCUS_WINDOW "focus_window" +#define RC_FORCE_8BIT_TOUPPER "force_8bit_toupper" +#define RC_FORCE_EMPTY_HREFLESS_A "force_empty_hrefless_a" +#define RC_FORCE_SSL_COOKIES_SECURE "force_ssl_cookies_secure" +#define RC_FORMS_OPTIONS "forms_options" +#define RC_FTP_PASSIVE "ftp_passive" +#define RC_FTP_PROXY "ftp_proxy" +#define RC_GLOBAL_EXTENSION_MAP "global_extension_map" +#define RC_GLOBAL_MAILCAP "global_mailcap" +#define RC_GOPHER_PROXY "gopher_proxy" +#define RC_GOTOBUFFER "gotobuffer" +#define RC_HELPFILE "helpfile" +#define RC_HIDDEN_LINK_MARKER "hidden_link_marker" +#define RC_HISTORICAL_COMMENTS "historical_comments" +#define RC_HTMLSRC_ATTRNAME_XFORM "htmlsrc_attrname_xform" +#define RC_HTMLSRC_TAGNAME_XFORM "htmlsrc_tagname_xform" +#define RC_HTTPS_PROXY "https_proxy" +#define RC_HTTP_PROXY "http_proxy" +#define RC_INCLUDE "include" +#define RC_INFOSECS "infosecs" +#define RC_JUMPBUFFER "jumpbuffer" +#define RC_JUMPFILE "jumpfile" +#define RC_JUMP_PROMPT "jump_prompt" +#define RC_JUSTIFY "justify" +#define RC_JUSTIFY_MAX_VOID_PERCENT "justify_max_void_percent" +#define RC_KBLAYOUT "kblayout" +#define RC_KEYBOARD_LAYOUT "keyboard_layout" +#define RC_KEYMAP "keymap" +#define RC_KEYPAD_MODE "keypad_mode" +#define RC_LEFTARROW_IN_TEXTFLD_PROMPT "leftarrow_in_textfield_prompt" +#define RC_LINEEDIT_MODE "lineedit_mode" +#define RC_LIST_FORMAT "list_format" +#define RC_LIST_NEWS_DATES "list_news_dates" +#define RC_LIST_NEWS_NUMBERS "list_news_numbers" +#define RC_LOCALHOST_ALIAS "localhost_alias" +#define RC_LOCAL_DOMAIN "local_domain" +#define RC_LOCAL_EXECUTION_LINKS_ALWAYS "local_execution_links_always_on" +#define RC_LOCAL_EXECUTION_LINKS_LOCAL "local_execution_links_on_but_not_remote" +#define RC_LYNXCGI_DOCUMENT_ROOT "lynxcgi_document_root" +#define RC_LYNXCGI_ENVIRONMENT "lynxcgi_environment" +#define RC_LYNX_HOST_NAME "lynx_host_name" +#define RC_LYNX_SIG_FILE "lynx_sig_file" +#define RC_MAIL_ADRS "mail_adrs" +#define RC_MAIL_SYSTEM_ERROR_LOGGING "mail_system_error_logging" +#define RC_MAKE_LINKS_FOR_ALL_IMAGES "make_links_for_all_images" +#define RC_MAKE_PSEUDO_ALTS_FOR_INLINES "make_pseudo_alts_for_inlines" +#define RC_MESSAGESECS "messagesecs" +#define RC_MINIMAL_COMMENTS "minimal_comments" +#define RC_MULTI_BOOKMARK "multi_bookmark" +#define RC_MULTI_BOOKMARK_SUPPORT "multi_bookmark_support" +#define RC_NCR_IN_BOOKMARKS "ncr_in_bookmarks" +#define RC_NEWSPOST_PROXY "newspost_proxy" +#define RC_NEWSREPLY_PROXY "newsreply_proxy" +#define RC_NEWS_CHUNK_SIZE "news_chunk_size" +#define RC_NEWS_MAX_CHUNK "news_max_chunk" +#define RC_NEWS_POSTING "news_posting" +#define RC_NEWS_PROXY "news_proxy" +#define RC_NNTPSERVER "nntpserver" +#define RC_NNTP_PROXY "nntp_proxy" +#define RC_NONRESTARTING_SIGWINCH "nonrestarting_sigwinch" +#define RC_NO_DOT_FILES "no_dot_files" +#define RC_NO_FILE_REFERER "no_file_referer" +#define RC_NO_FORCED_CORE_DUMP "no_forced_core_dump" +#define RC_NO_FROM_HEADER "no_from_header" +#define RC_NO_ISMAP_IF_USEMAP "no_ismap_if_usemap" +#define RC_NO_PROXY "no_proxy" +#define RC_NO_REFERER_HEADER "no_referer_header" +#define RC_NO_TABLE_CENTER "no_table_center" +#define RC_NUMBER_FIELDS_ON_LEFT "number_fields_on_left" +#define RC_NUMBER_LINKS_ON_LEFT "number_links_on_left" +#define RC_OUTGOING_MAIL_CHARSET "outgoing_mail_charset" +#define RC_PARTIAL "partial" +#define RC_PARTIAL_THRES "partial_thres" +#define RC_PERSISTENT_COOKIES "persistent_cookies" +#define RC_PERSONAL_EXTENSION_MAP "personal_extension_map" +#define RC_PERSONAL_MAILCAP "personal_mailcap" +#define RC_PERSONAL_MAIL_ADDRESS "personal_mail_address" +#define RC_PREFERRED_CHARSET "preferred_charset" +#define RC_PREFERRED_LANGUAGE "preferred_language" +#define RC_PREPEND_BASE_TO_SOURCE "prepend_base_to_source" +#define RC_PREPEND_CHARSET_TO_SOURCE "prepend_charset_to_source" +#define RC_PRETTYSRC "prettysrc" +#define RC_PRETTYSRC_SPEC "prettysrc_spec" +#define RC_PRETTYSRC_VIEW_NO_ANCHOR_NUM "prettysrc_view_no_anchor_numbering" +#define RC_PRINTER "printer" +#define RC_QUIT_DEFAULT_YES "quit_default_yes" +#define RC_RAW_MODE "raw_mode" +#define RC_REFERER_WITH_QUERY "referer_with_query" +#define RC_REUSE_TEMPFILES "reuse_tempfiles" +#define RC_RULE "rule" +#define RC_RULESFILE "rulesfile" +#define RC_RUN_ALL_EXECUTION_LINKS "run_all_execution_links" +#define RC_RUN_EXECUTION_LINKS_LOCAL "run_execution_links_on_local_files" +#define RC_SAVE_SPACE "save_space" +#define RC_SCAN_FOR_BURIED_NEWS_REFS "scan_for_buried_news_refs" +#define RC_SCROLLBAR "scrollbar" +#define RC_SCROLLBAR_ARROW "scrollbar_arrow" +#define RC_SEEK_FRAG_AREA_IN_CUR "seek_frag_area_in_cur" +#define RC_SEEK_FRAG_MAP_IN_CUR "seek_frag_map_in_cur" +#define RC_SELECT_POPUPS "select_popups" +#define RC_SET_COOKIES "set_cookies" +#define RC_SHOW_COLOR "show_color" +#define RC_SHOW_CURSOR "show_cursor" +#define RC_SHOW_DOTFILES "show_dotfiles" +#define RC_SHOW_KB_RATE "show_kb_rate" +#define RC_SNEWSPOST_PROXY "snewspost_proxy" +#define RC_SNEWSREPLY_PROXY "snewsreply_proxy" +#define RC_SNEWS_PROXY "snews_proxy" +#define RC_SOFT_DQUOTES "soft_dquotes" +#define RC_SOURCE_CACHE "source_cache" +#define RC_SOURCE_CACHE_FOR_ABORTED "source_cache_for_aborted" +#define RC_STARTFILE "startfile" +#define RC_STRIP_DOTDOT_URLS "strip_dotdot_urls" +#define RC_SUBSTITUTE_UNDERSCORES "substitute_underscores" +#define RC_SUB_BOOKMARKS "sub_bookmarks" +#define RC_SUFFIX "suffix" +#define RC_SUFFIX_ORDER "suffix_order" +#define RC_SYSTEM_EDITOR "system_editor" +#define RC_SYSTEM_MAIL "system_mail" +#define RC_SYSTEM_MAIL_FLAGS "system_mail_flags" +#define RC_TAGSOUP "tagsoup" +#define RC_TEXTFIELDS_NEED_ACTIVATION "textfields_need_activation" +#define RC_TIMEOUT "timeout" +#define RC_TRIM_INPUT_FIELDS "trim_input_fields" +#define RC_TRUSTED_EXEC "trusted_exec" +#define RC_TRUSTED_LYNXCGI "trusted_lynxcgi" +#define RC_UPLOADER "uploader" +#define RC_URL_DOMAIN_PREFIXES "url_domain_prefixes" +#define RC_URL_DOMAIN_SUFFIXES "url_domain_suffixes" +#define RC_USERAGENT "useragent" +#define RC_USER_MODE "user_mode" +#define RC_USE_FIXED_RECORDS "use_fixed_records" +#define RC_USE_MOUSE "use_mouse" +#define RC_USE_SELECT_POPUPS "use_select_popups" +#define RC_VERBOSE_IMAGES "verbose_images" +#define RC_VIEWER "viewer" +#define RC_VISITED_LINKS "visited_links" +#define RC_VI_KEYS "vi_keys" +#define RC_VI_KEYS_ALWAYS_ON "vi_keys_always_on" +#define RC_WAIS_PROXY "wais_proxy" +#define RC_XLOADIMAGE_COMMAND "xloadimage_command" + extern Config_Enum tbl_DTD_recovery[]; extern Config_Enum tbl_keypad_mode[]; extern Config_Enum tbl_multi_bookmarks[]; extern Config_Enum tbl_transfer_rate[]; extern Config_Enum tbl_user_mode[]; +extern BOOL LYgetEnum PARAMS((Config_Enum * table, char * name, int * result)); extern BOOL will_save_rc PARAMS((char * name)); +extern CONST char *LYputEnum PARAMS((Config_Enum * table, int value)); extern int enable_lynxrc PARAMS((char * value)); +extern int get_tagsoup PARAMS((char * value)); extern int save_rc PARAMS((FILE *)); extern void read_rc PARAMS((FILE *)); diff --git a/src/UCAuto.c b/src/UCAuto.c index 6a531adf..f4438fde 100644 --- a/src/UCAuto.c +++ b/src/UCAuto.c @@ -548,7 +548,7 @@ PRIVATE int _Switch_Display_Charset ARGS2 (int, ord, enum switch_display_charset ord = Find_Best_Display_Charset(ord); /* Ignore sizechange unless the font is loaded */ - if (ord != font_loaded_for && really == SWITCH_DISPLAY_CHARSET_SIZECHANGE) + if (ord != font_loaded_for && really == SWITCH_DISPLAY_CHARSET_RESIZE) return ord; if (ord == real_charsets[0] || ord == real_charsets[1]) { |