diff options
| author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-11-06 16:18:09 -0500 |
|---|---|---|
| committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-11-06 16:18:09 -0500 |
| commit | 18024037b515bfff83e0230b35151babe6005e18 (patch) | |
| tree | b8c80055282a00883284722a3dd6bb25234e07f0 | |
| parent | 3d8ecbe48af249fa0d77ce4d273e32ce4b7e6e18 (diff) | |
| download | lynx-snapshots-18024037b515bfff83e0230b35151babe6005e18.tar.gz | |
snapshot of project "lynx", label v2-8-1dev_4
258 files changed, 16074 insertions, 19924 deletions
@@ -1,944 +1,7 @@ Changes since Lynx 2.8 release ================================================================================ -1998-10-27 (2.8.1rel.2) -* tidy up version numbers - TD -* modify HTDOS.h to permit compile with K&R compiler - TD -1998-10-24 (2.8.1rel.1) -* reorganize lynx_help_main.html - PW -* minor change to WWW/.../tcp.h to eliminate redefinition warning by DEC C - TD -* move checking for command-line "-head" and related options before curses - initialization so that program exits with correct terminal settings - (report by LV, fix by BL). -* correct uninitialized index into id_append in makeuctb, which causes problems - with def7_uni.tbl (analysis by LP) -* add TAGSOUP flag to lynx.cfg to set initial state of Tag Soup vs SortaSGML - (request by LP) - TD -* add PERSISTENT_COOKIES flag to lynx.cfg to allow disabling the persistent - cookies feature in a Lynx executable (request by BJP) - TD -* modify read_cfg so that it does not display included-file information when - NO_CONFIG_INFO is defined (reported by LP) - TD -* minor/cosmetic fixes for comments and documentation - LP -* revised patch for nsl-fork, which does not rely on WNOWAIT definition - BL -* include termio.h in LYCurses.c only #ifdef TERMIO_AND_CURSES (Philippe - De Muyter <phdm@macqel.be>) -* modify cfg_defs.sh to work when the 'set' command emits double-quotes - (pg@sweng.stortek.com) -* update obsolete copy of HTFWriter.c to add content-encoding for HTFileSuffix - (reported by David Helder <dhelder@umich.edu) - TD -1998-10-17 (2.8.1pre.11) -* add dependency on cfg_defs.h to src/makefile.in for LYShowInfo.o - (pg@sweng.stortek.com) -* modify add_item_to_list() so that if the restriction flag is omitted from - a download/upload/extern line in lynx.cfg, it is assumed true. Also check - for null command string in LYExtern.c (bug report by HN) - TD -* modify logic in forms-options menu so that assume_char_set now works - correctly for any LYRawMode value by synchronizing gen_options() and - postoptions() via rawmode memory - LP -* correct ifdef'ing in LYShowInfo.c for non-Unix platforms - LP -* modify nsl_fork logic to handle a case where child exits successfully - right after parent's select timed out (reported by Serge Munhoven) - BL -* small updates to lynx_help files and other documentation (BJP, PW, LV). -* add #define's for later work to simplify configuring the maximum number - of cookies (suggested by BJP) - TD -* flush output in makeuctb, as possible fix for build problems on systems that - do not implement POSIX 'exit()' call (reported by Serge Munhoven - <munhoven@mema.ucl.ac.be> and Jan Hlavacek <lahvak@math.ohio-state.edu>) - TD -* put GOTOBUFFER, JUMPBUFFER and QUIT_DEFAULT_YES back the way they used to be - (majority decision) - TD -1998-10-14 (2.8.1pre.10) -* add/use HTSYS_purge and HTSYS_remove functions (based on report by Tony - Bolton and patch by BJP dealing with removing older versions of cookie files) - - TD -* add --disable-config-info option - TD -* change configure script --enable-forms-options to --disable-forms-options, - add --disable-menu-options - TD -* comment-out FM's code to fold cookie headers and force cookies to be presented - in the same order that they were received - BJP -* use full "Implementation" directory name in include path in WWW djgpp - makefile - DK -* use HTDOS_name() to force DOS temporary-directory into consistent form - DK -* include HTVMSUtils.h and HTDOS.h from LYUtils.h, consolidate some ifdef's - using macro HTSYS_name - TD -* another fix for HTTCP.c, for lookups with Lynx/32 - WB -* add fallback to $TMPDIR for Lynx temporary directory on Unix - TD -* remove verbose_links variable due to popular demand - TD -1998-10-10 (2.8.1pre.9) -* add verbose_links variable to lynx.cfg and userdefs.h to control whether Lynx - should show "(LINK)" before links (request/patch by Moshe Zadka - <moshez@math.huji.ac.il>) - TD -* change defaults in lynx.cfg and userdefs.h, add comments - PW - (a) defaults are stated for `verbose' & `KB'; - (b) GOTOBUFFER & JUMPBUFFER defaults to TRUE; - (c) QUIT_DEFAULT_YES defaults to FALSE -* restore suggested file name in download menu: it is really useful for other - download methods which should be available in menu when `save to disk' is - disabled. Remove local_path/ prefix (LYNX_SAVE_SPACE if any) from visible - suggested file name string near the top instead - LP -* restore newline position when toggling comments parsing (at least we could - return to previous screen to try comments toggling twice) - LP -* add a link from keystrokes help for edit_help.html (input line keys) - LP -* corrected to make -nostatus command-line option override HTReadProgress - TD -* updates to lynx-dev.html (Al Gilman). -* modify NSL-fork support in HTTCP.c to use waitpid call to reap child processes - which may otherwise become orphaned. The new variable "dns_patience" - represents how many seconds we're willing to wait for DNS to respond (should - later make it configurable) - BL -* modify PutTextInput and PutDefs macros in LYOptions.c and LYShowInfo.c to - avoid pre-ANSI compilers attempting to substitute macro parameters in - coincidental matches within quoted strings - BL - gcc -Wtraditional reports the first, but not the second, which is "n" - substituted into "\n" - TD -* add an error-check for fg/bg values to lynx_chg_color function in case lynx.cfg - specifies color names not in Lynx's table - BL -* modify IsOurFile function to accommodate links-to-links, so that users whose - home directory is reached by that type of path can save .lynxrc file - (reported by PW) - TD -1998-10-04 (2.8.1pre.8) -* modify HTTCP.c to copy soc_in from phost in HTParseInet, making Lynx/32 do - lookups again - WB -* modify LYCurses.c to compile mouse-code with Borland C and PDCURSES 2.3 - WB -* correct backward logic in CF_TERMIOS_AND_CURSES (reported by LE) - TD -1998-10-04 (2.8.1pre.7) -* add special-case CF_TERMIOS_AND_CURSES configure macro (fixes problem reported - by Philippe De Muyter) - TD -* update/reorganize option_help.html - PW -* restore newline position when return from the Print menu or follow a link - from History page (was broken for partial display mode only): LYPop() and - LYPop_num now reinitialize Newline_partial if it happens on getfile stage. - Also remove changes from 1998-06-11 (case LYK_DOWNLOAD) since this is now - protected by HText_new() which never starts. - LP -* tweak suggested filename for download menu: now it we have URL - terminated with "/" (e.g. a directory or possibly root) do one more try - - remove terminating "/" - LP -* download menu: do not show "Suggested file name" when "save to disk disabled" - (requested by HN) - LP -* more tweaks on LYshow_kb_rate - LP -* move fallback definitions for POSIX S_ISLNK, etc., to allow build with - VAX C (reported by Tony Bolton) - TD -* add parentheses to eval-expression in CF_MAKE_INCLUDE configure test to - accommodate bash2 (Tadayoshi Okuma <tad@pht.co.jp>) -1998-10-01 (2.8.1pre.6) -* add EMX to special cases for SetOutputMode, to force stdout to O_BINARY mode - so that downloading binary files will not corrupt them (reported by Ilya - Zakharevich <ilya@math.ohio-state.edu>) - TD -* correct missing "\n\" in change to LYrcFile.c for pre.4 (reported by David - Eaton) - TD -* reorder HTCheckForInterrupt() so that partial displace mode will work for - VMS (reported by LP) - TD -* fix LYK_DOWNLOAD to restrict downloading remote links for local_host_only, - like it was done for mailto: links recently, see comments where in. - LP -* replace few statusline messages with ones from LYMessages.en.h -1998-09-30 (2.8.1pre.5) -* force compile on VMS to use stdarg.h; it was ifdef'd for __STDC__ which - VAX C does not define, though it does support stdarg.h (reported by Tony - Bolton). Test-compile HTVMS_WaisUI.c on Linux to check... - TD -* update url for tcplib in INSTALLATION - DK -* fix HTDOS_name trace massage - LP -* expand "~" in include-statements in lynx.cfg (reported by LP) - TD -* remove some obsolete stuff from INSTALLATION - HN -* DOSPATH fix: user input URL like c:/path/file.ext (begins with drive letter) - now resolved as local path and will not be passed to DNS search in any case - (was running URL guessing process for host "c:" if file.ext not found...) - fix LYFillLocalFileURL() - LP -* fix HTUserMsg2 trace massage - LP -* add user's guide documentation for COOKIE_ACCEPT_DOMAINS and - COOKIE_REJECT_DOMAINS - BJP -* change default Unix cookie-file name to "~/.lynx_cookies" - BJP -* customize incremental rendering: - - add -partial_thres[=NUMBER] option to set the number of lines - - add PARTIAL_THRES config variable in lynx.cfg to set the number of lines - - add partial_thres variable in .lynxrc to set the number of lines. - Selecting save to disk and hitting Accept Changes in options menu will save - this variable to the current value. Haven't looked into making a form - entry for this yet. With -partial_thres command line option, probably not - necessary (patch by Eric <erbrun@bellatlantic.net>). -* fix some text in lynx.man and Lynx_user_guide.html. The man change includes - changes to "h" and "k" so they work whether or not vi keys are on - DK -* workaround for inconsistency between slang ports to DOS and other platforms - by suppressing test of SLtt_Use_Ansi_Colors. This fixes a problem where - colors change in the slang DOS port when the forms_based option menu is - accepted - DK -1998-09-28 (2.8.1pre.4) -* tentative fix for HPUX sed problems (reported by jones.peter@uqam.ca) - TD -* update lynx.man and lynx.hlp to reflect new command-line options - TD -* minor documentation fix - LP -* miscellaneous fixes for build on VMS (reported by Tony Bolton) - TD -* tweak 'const' assignment for VMS (in LYReadCFG.c and LYPrint.c) - LP -* clarify discussion of download in Lynx user's guide (Al Gilman). -* trim trailing newline from lines read from cookie file so that Lynx does - not send embedded newlines in the cookie list - BJP -1998-09-27 (2.8.1pre.3) -* fix a place in cookie_add{accept,reject}list() where cookies would be deleted - from memory if a persistent cookie had the same domain as an entry in - COOKIE_{ACCEPT,REJECT}_DOMAINS - BJP -* move Lynx's writing of persistent cookies to COOKIE_FILE from happening when - you enter the Cookie Jar page to quit time, before cleaning up temporary - files - BJP -* Lynx_user_guide.html: add text about lynx.cfg - LP -* forms-options: options names moved 2 columns to the right (is it good?) - LP -* fix reading .lynxrc "character_set" (trim trailing spaces in fullname) - LP -* fix ReadProgress message for LYshow_kb_rate (while <1024 bytes received - we showed byte-transfer rate even in KB mode), extra dot removed - LP -* DOS text files: opening text mode switch now incorporated in LYNewTxtFile/ - LYAppendToTxtFile and hope for the best - LP -1998-09-25 (2.8.1pre.2) -* fixed forms submission charset: was broken by me in dev26 (HText_SubmitForm() - in GridText.c) - LP -* documentation updates for verbose images - LP -* minor fix for trace message in TrimHightext() -LP -* add compatibility with 2.8/2.7.2 lynx.cfg and (especially) .lynxrc - old - "character_set" parameter now acceptable - LP -* add OUTGOING_MAIL_CHARSET symbol to lynx.cfg to make mail more recognizable - by remote recipient, it may be "US-ASCII" for 7 bit approximation as the - safest case or any other value. If blank, use display character set - (default, compatibility). Currently implemented only for "subject" in - "print-to-email" - LP -* fix SGML.c so invalid characters are not dispalayed in hex UHHHH but just - omitted as already done for plain/text mode - LP -* fix download' suggested file name (8bit) - LP -* correct logic error in "Change Location" command, and allow "~" there in - addition to the existing "~/" prefix (reported by Ismael Cordeiro) - TD -* ifdef'd out "don't replace '\n' with ' ' if Chinese or Japanese" from dev.23, - with symbol EXP_JAPANESE_SPACES, FIX_JAPANESE_SPACES based on discussion with - HN, LP - TD -* correct missing '\' in generated sed-script for "make install-help" rule, - which changed a couple of "/html" substrings to ".html" (reported by BL) - TD -* modify cfg_defs.sh script to handle empty token in config.cache, e.g., a line - such as "foo=${foo=}" (reported by Philip Chong <pchong@boopsie.ml.org>) - TD -* modify so that lynx_cfg_infopage() and lynx_compile_opts() pages are not - invoked when Lynx is running -anonymous - TD -1998-09-22 (2.8.1pre.1) -* correct logic error in parse_restrictions() which caused infinite loop, - probably from changes in dev.8 (reported by HN) - TD -* add SHOW_KB_RATE symbol to lynx.cfg to allow user to control whether - HTReadProgress should show KB/sec or bytes/sec - TD -* modify HTReadProgress to allow user to display KB/sec or bytes/sec - BL -* add/use new function LYstyles(), to force initialization of styles[] array - when it is used outside HTML.c; fixes a problem with Lynx not using styles - for files listed on the command line - TD -* correct keymap strings for F1 and DO_KEY - TD -* add keymap table entries for F1, to accommodate slang which appears to ignore - terminal description when keymaps are defined - TD -1998-09-20 (2.8.1dev.29) -* add checks/warnings for user agent string in forms-options menu - TD -* change render_item to force a '/' before substituted path or directory strings - if (as in OS/2 EMX) absolute filenames do not normally begin with a '/' -TD -* modify HTnameOfFile_WWW() to interpret an empty acc_method as a local file, - allowing its use in permit_location(), making OS/2 EMX dired-mode change - permissions work - TD -* make download and print menus a little more compact in intermediate/advanced - user modes - TD -* correct filename shown in download menu - LP -* change behavior of configure --enable-forms-options switch. By default, both - old and new options menu are available via a command-line toggle - "-forms_options" or lynx.cfg statement "FORMS_OPTIONS:TRUE/FALSE". Configure - --enable-forms-options now _disables_ old-style code, which is - ifdef'ed with "#ifndef EXP_FORMS_OPTIONS" - LP -* add more pointer-checks in GridText.c so that "lynx LYNXDOWNLOAD://" does - not crash (reported by Wilson Cheung) - TD -* add special case to handle NNTPSERVER environment variable, which had been - lowercased as part of LYReadCFG.c cleanup (reported by Wilson Cheung - <wcheung@netcom.com>) - TD -* modify info-page to add link to new internal page showing the noncomment - lines from lynx.cfg - LP, TD -* use function wwwName to reduce clutter - LP -* create "lynx.cfg Information" page, comments skipped, "include" OK. - The link is available from '='InfoPage and 'O'ptions menu. - Since DJGPP/Win32 binary have no built-in absolute path for distributions - lynx.cfg those ports will look for a copy of lynx.cfg in lynx_help/ - for most advanced info/comments (if you made http:// depository for lynx help - please care of it) - LP -* tweak helpfilepath URL (for DOSPATH only) - LP -* some cleanup of cp852, cp850, cp775 - LP -1998-09-17 (2.8.1dev.28) -* minor fix to make PRCS ProjectDate print in "dd mmm yyyy" form - TD -1998-09-17 (2.8.1dev.27) -* minor fixes for recent (dev24 and dev25) chartrans changes - LP -* add LYNX_DATE definitions in userdefs.h; Info Page now shows the date of your - lynx along with version number and a link to the latest sources. - LP -* use ECHO_CC symbol in install-help rule to control whether the sed commands - are echoed - TD -* corrected install-help rule to avoid getting compress-suffix repeated in - the generated/updated files - TD -* documentation nit for COLLAPSE_BR_TAGS (Michael Warner) -* use getsockname_s rather than getsockname for djgpp (from patch by Gisle - Vanem) - DK -* add .bz2 suffix to lynx.cfg and HTInit.c, for bzip2 utility - DK -* modify store_cookie to suppress warning message for invalid domain if Lynx is - setup to accept all cookies - LV -* modify/expand LYLocalFileToURL() function, getting rid of most places where - inline concatenation is used for "file://localhost/<filename>", as well - as eliminating a number of static buffers - TD -* move fallback definitions for POSIX S_ISLNK, etc., out of NeXT ifdef's, to - make this compile on Apollo (reported by David Eaton) - TD -* restructured pathname-tests in LYLocal.c, using common utility functions - ok_stat, ok_lstat, ok_file_or_dir to simplify freeing pointer allocated - by HTfullURL_toFile - TD -* modify HTLocalName, making it a macro around a more flexible function - HTnameOfFile_WWW, to reuse logic for stripping off "file://localhost" and - "file:" prefixes, fixing some places where a spurious '/' would be left in - EMX local filenames (other macros: HTfullURL_toFile, HTpartURL_toFile) - TD -* modify configure script macro CF_PATH_PROGS for OS/2 EMX, so that compiled-in - utility pathnames work - TD -* use HTDOS.c module for OS/2 EMX, since it has similar device syntax - TD -* correct logic for wrapping long lines, to not use the rightmost column of the - screen, fixes a problem with duplicated character (reported by LP) - TD -* correct logic for dumping screen to file, so that blank lines are retained, - not counted in the logic for pruning soft-newlines which supports wrapped - lines - TD -* add info and user messages to traces - TD -1998-09-12 (2.8.1dev.26) -* change behavior of NSL_FORK and related I/O (patch by BL) - - Make URL guessing (www.huh.com? www.huh.org? www.huh.net?) interruptible. - - Make URL guessing from the command line interruptible. - - Use select() instead of FIONREAD. This makes it work on OSes where - previously it only *looked* like it was working. - - select() on stdin as well as the child pipe, when using [n]curses (not - SLANG). This allows interrupt to be processed instantly, without - up-to-1-second delay. - - While looping, 1 second at a time, bail out after "too many" (currently 50) - loops: just in case something weird happens, like select() returning some - unexpected error that we ignore. - - Make sure child processes are always killed and reaped. - - Close pipe ends as soon as possible. - - Now write the length down the pipe (using a known-to-the-program length of - sizeof(int)) first -- this both helps workaround old CMU TCP bugs and the - fact that select() doesn't let us get number of bytes ready, like FIONREAD - does. -* change default for NO_ANONYMOUS_EMAIL to TRUE (patch by HN) -* use url for "W3C HTML Validation Service" rather than "A Kinder, Gentler HTML - Validator" -* update url for HTML Quick Reference Guide (report by LE) - TE -* modify verbose images to show ISMAPs and USEMAPs (patch by LE). -* fix typos in AttrList.h, LYStrings.h (reported by LV & HN) - TD -* Chartrans recovery and cleanup: by introducing an invariant - "current_char_set and UCLYhndl_for_unspec always valid charsets" we solve - possible problems with invalid/undeclared charsets. Use - 'safeUCGetLYhndl_byMIME()' for reading charset information from - lynx.cfg/userdefs.h/command line switches to recover possible typos by - fallback to ISO-8859-1; If UCLYhndl_for_unrec or UCLYhndl_HTFile_for_unspec - not set explicitely - now fallback to UCLYhndl_for_unspec (was before, but - not clear in certain places). Add comments to UCMap.h, add comments on - chartrans initialization in LYMain.c. UCAssume_localMIMEcharset and - UCAssume_unrecMIMEcharset now removed (UCLYhandl_* do all the stuff). - LP -* LYCharSets.c: LYRawMode code simplified and comments added. It was realized - that UCAssume_MIMEcharset may differ from its handler as LYRawMode history. - Also: HTMLSetRawModeDefault() moved into HTMLUseCharacterSet() to reduce - clutter, declare HTMLSetCJKCharacterSet() as PRIVATE. - LP -* more "big5" bugs fixed (in HTMIME.c and HTFile.c); function Set_HTCJK() added - to LYCharSets.c - LP -* LYCharUtils.c: META charset code corrected against 2.7.2, obsolete code - removed - LP -* partial mode now repaint the screen in one stage with a complete display - ('display_lines' received, fix in HTPartialDisplay()). Incremental rendering - of the first page may be annoying on slow connection (reported by Nelson - Henry Eric <nelsonhe@nara.kindai.ac.jp>) - LP -* temp fix for HText_trimHightext side effect from partial mode by introducing - a flag in HText_beginInput(), so this side effect still only happens for long - documents with forms input mixed with normal href= link. - LP -* print menu: fixed document URL near the top (was temp file name) - LP -* forms-options menu: fixed screen size in Novice mode - LP -* limit length of strings copied via tok_values[] in LYCookies.c - TD -* clean up a few memory leaks in cookie_add_acceptlist() and - cookie_add_rejectlist() in LYCookie.c. These were leaking 4 bytes for each - entry in COOKIE_ACCEPT_DOMAINS - BJP -* fix to LYLoadCookies() which was causing duplicate invalid cookies to be - loaded - BJP -* split out install-doc rule in top-level makefile to install extra documentation - files in $(libdir)/lynx_doc (request by HN) - TD -* improved algorithm to set 'secure_value', used in forms-options to circumvent - spoofing (based on comments from Mike Castle) - TD -* integrate WB's mouse changes (see 1997-04-24) for page-up/down into the Unix - flavors of mouse support (e.g., ncurses and slang) - TD -* use ncurses define_key to implement lynx-keymaps (see dev.10) - TD -* modify slang keymap code to work with slang 0.99-38 - TD -* replace several ifdef'd pathname constructions to use LYAddPathToHome() - TD -* make keymaps file consistently named on Unix and VMS - TD -* remove redundant "Lynx" from internal-page titles (suggested by LP) - TD -* remove install-log makefile target, generate cfg_defs.h file directly from - lynx_cfg.h and config.cache, to compile-in the configuration-definitions - rather than rely on external file lynx_site.txt - TD -1998-09-06 (2.8.1dev.25) -* corrected compiled-in path for lynx_site.txt - TD -* implement logic for exec-links in forms-options page - TD -* add configure options --enable-exec-links and --enable-exec-scripts - TD -* correct logic for show-color in forms-options page (reported by DK) - TD. -* implement logic to set $DISPLAY in forms-options page - TD -* add/use functions LYsetXDisplay() and LYgetXDisplay() to reduce clutter - TD -* retain help-link on internal pages only for those where the pages would be - pushed onto the history stack, and only in novice mode - TD -* absorb LYSystem.h into LYUtils.h, adding LYSystem() and LYSysShell functions - to LYUtils.c to hide djgpp clutter - TD -* limit strings passed to mailer in LYMail.c to 7-bit ASCII, converting other - characters to '?'. This guards against trash on the end of the mailing - address in a mailto link (from Duncan Simpson <dps@io.stargate.co.uk>). -* add fallback definitions for <sys/stat.h> S_xxx macros to tcp.h (from report - by Francisco A Tomei Torres <fatomei@sandburg.unm.edu> that OpenStep 4.0 - lacks definition for S_IWOTH) - TD -* modify quote_pathname() so that for DJGPP it does not put single-quotes - around the result - DK -* correct a missing assignment to turn bold off in split_line (GridText.c) - LE -* Fixed: forms input in display_partial mode! Previously hightext was printed - at wrong positions while loading was in process (try -debug_partial to see - the bug). Fix made in HText_pageDisplay: we call HText_trimHightext() which - was the main part of HText_endAppend() before. Seems no more problems - reported from incremental rendering mode! - LP -* set PARTIAL mode ON by default, unless it disabled in lynx.cfg or by - configure --disable-partial option - LP -* restore temporary -debug_partial switch, broken in dev.23. - LP -* made trace in HText_appendCharacter() a little more readable - for lynx special characters - LP -* chartrans: human-readable character set names in Options Menu now changed - according to Netscape 4.x style - "language (MIMEname)", it looks more useful - and reduce chaos in people's heads. Documentation corrected - (option_help.html/Lynx_User_guide.html). Minor tip: "Central and Eastern - European" was truncated to "Eastern European" because of space limitation in - popup menu. (Changes in chrtrans/*.tbl, LYCharSets.c, also docs including - userdefs.h/lynx.cfg). Since names were changed, users on display other than - iso-8859-1 should go to options menu and resave .lynxrc (and probably correct - lynx.cfg - character_set now uses MIME notation in sync with other charset - settings, although complete name string is still acceptable for this field). - - LP -* an attempt made to tweak the code replacing lynx internal 'main' charset '0' - (iso-8859-1 in fact) with its MIME name. - LP -* rename ifdef EXP_8BIT_TOUPPER in favor of lynx.cfg switch FORCE_8BIT_TOUPPER - - LP -* remove a lot of "(char **)" casts from HTML.c which obscured some type - mismatches - TD -* add/use functions LYIsHtmlSep, LYAddHtmlSep, LYTrimHtmlSep, LYIsPathSep, - LYAddPathSep, LYTrimPathSep to reduce clutter - TD -* fix a bug, present at least since dev.17, where lynx can't download files if - it is started from one of the root directories of a disk drive, since it is - trying to write to "c:\\file.ext", rather than "c:\file.ext" - DK -* correct a comment in userdefs.h; commercial Japanese sites are named with - co.jp, not com.jp (LV). -* correct some debug messages in LYCookie.c - BJP -* fix a missing </h1> in ShowInfo.c - SKY -* modified '+'->' ' conversion to allow Unix commands to have '+' beginning - options - TD -* sorted all option items (i.e., static variables, postoptions(), gen_options()) - according to the sections they are in - SKY -* added '+'->' ' conversion for forms-options values - SKY -* centered 'save to disk' and put a dash between 'accept' and 'reset' for - clarity - SKY -* add "-cookie_file=" commandline option to specify cookie file - BJP -* add "cookie_file=" option to .lynxrc - BJP -* add "cookie_file:" option to lynx.cfg - BJP -* change default cookie file to "Home_Dir()/cookies" (or sys$login:cookies - for VMS, which may or may not work, DOS also needs to be checked) - BJP -* add cookies switch to options menu - LP -* Security considerations and form-based options: items restricted in - gen_options() should be ALSO restricted under the same conditions in - postoptions() to prevent a limited access user to edit option's HTML code - manually and submit a restricted items. This may be not a good idea to have - two functions in sync but those functions are synchronized anyway. Please - read comments inside the functions if change something! - LP -* add new functions BeginInternalPage and EndInternalPage to reduce clutter in - code that sets up internal pages (email from LP). -* change version in makefile.in to 2-8-1 (reported by DK). -* the code in GridText that adds control characters to the current line - does not test for buffer overflow. Normally Lynx gets away with this because - it will wrap the current line as soon as the line exceeds the display width, - but if you have a file with nothing but control characters with no - displayable text in-between (a few thousand hidden links will do), then Lynx - bombs. Modified to silently ignore excess control characters as well as add - a few extra bytes when allocating the line buffer to allow for a bunch of - control characters followed by a kanji or utf-8 sequence. (patch by Dick - Wesseling <ftu@fi.uu.nl>) -* remove WWW/Library/Implementation/HTInit.c, which is not used, since - src/HTInit.c has this functionality - TD -* change ID="<number>" in Lynx_users_guide.html to ID="<name>" to appease - weblint; tested with IE&NS - TD. -* Al's convention of '#<number>' into '#<id name>' in Lynx_users_guide.html is - included - SKY -1998-08-31 (2.8.1dev.24) -* re-correct DH's patch for COLLAPSE_BR_TAGS (reported by LV) - TD -1998-08-29 (2.8.1dev.23) -* make interim fix for gzip'd html files until we can resolve portability - issues raised by SKY's renaming - TD -* implement LY_SOFT_NEWLINE, to mark places where wrapping is done in - HText_appendCharacter, to allow printing to join lines back together - (reported by LP) - TD -* correct missing assignment in change to HText_appendCharacter, fix a core - dump - TD -* removed SKY's change that attempted to skip help-links, since it causes a core - dump, e.g., when viewing source - TD -* use LYCloseTempFP in forms-options code and LYPrint.c where file was opened - with LYOpenTemp, to fix a core dump - TD -* All XYZ_TITLE defines of UIPs (User Interface Page) are collected in - LYMessages_en.h for multi language support - SKY -* Head and H1 of each UIP is standardized; reduced to 1 line. In this line a - context sensitive Help anchor introduced which is skipped by default; i.e., - 'd' will directly goto 'Save to Disk' not to the help anchor - SKY -* Download and Print UIPs are divided into 'Standard' and 'Local additions'. - Current and Suggested Filenames are printed on the page which was hidden on - the status line or accessed only by '=' - SKY -* Information page now has links to either development or lynx home pages - depending on LYNX_RELEASE define. Besides compile options can also be - accessed on this page: $helpdir/lynx_site.txt. A file derived from - 'config.cache'. Its corresponding makefile macro is 'install-log' - SKY -* New Form-based options page is re-organized; logical sections are introduced - and sorted alphabetically (except for 'User Mode' - SKY -* All links in the help files are marked, i.e., each - 'href="../_filename.html_#section"' is converted to - 'href="../@FILENAME@#section"'. This is useful if a help filename or - link has to be changed through out whole package. -* 'lynx_help/help_files.txt' is introduced which contains - FILENAME=_filename.html_ definitions. Format and details are given in the - file - SKY -* All help files are renamed from '.html' -> '.html_' - SKY -* For context sensitive help links in UIPs 'src/LYHelp.h' is created with all - the filenames marked like the help files. It will be included from - LYGlobal.h. In 'src/makefile.in' necessary changes are done to load the - filenames from 'lynx_help/help_files.txt' - SKY -* To be able to compress help files '--enable-gzip-help' option is added in - configure script. In 'makefile' 'install-help:' is updated. - If COMPRESS_PROG and COMPRESS_EXT are *both* left empty (default) no - compression will be carried. For the moment compression is restricted only - to 'gzip'. Necessary updates are done in configure.in - SKY -* documentation fixes for nsl-fork, print screen - PW -* don't replace '\n' with ' ' if Chinese or Japanese - HN -* use title information rather than suggested filename as a subject line when - printing a page to email - LP -* add verbose_images to old-style options menu, and the .lynxrc - LE -* add verbose_images and useragent to forms-based options menu - LP -* disable download of "mailto:" links (reported by SKY (Sinan Kaan Yerli) - <sky@star.cpes.susx.ac.uk> ) - LP -* Change HTUserMsg to HTInfoMsg for "ALREADY_AT_BEGIN" and "ALREADY_AT_END" - messages to make it less annoying - LP -* reduce clutter in mainloop by inserting LYpop() in postoptions() - LP -* makefile.dos: split long lines - LP -* Fix bug with TAIPEI big5 charset in src/LYCharUtils.c - (this typo also found in lynx2.7.2: "big-5" instead of "big5"), - patch by Shou-Chuan Lai <chuan@cs.nthu.edu.tw> - LP -* Add -debug_partial command line switch so we got MessageSecs dely - between incremental rendering stages if partial display mode is ON. - (MessageSecs available from lynx.cfg and set to 2 sec by default). - The problem in incremental rendering of forms input was reported by SKY - (Sinan Kaan Yerli) <sky@star.cpes.susx.ac.uk> ), still not fixed - but now we may enter form-based options menu in -debug_partial mode - and rerender the page with Cntrl-R to see what is happening in fact. - LP -* Serious bug fixed for DISP_PARTIAL: two asynchronous processes synchronized. - HTDisplayPartial() synchronized by flag against HText_new() which create - the new HTMainText object. Otherwise HTDisplayPartial() sometimes was - matching old HTMainText (with its own line counter) and repaint previous doc, - not a new one. TRACE log now got a message from HText_pageDisplay - LP -* fixed last chartrans changes, lines such as - #0x99 #NOTDEFINED - should not be commented with leading comment symbol because they are ignored - by makeuctbl in fact - LP -* modify DH's patch for COLLAPSE_BR_TAGS to only modify the nonstandard case, - thereby making that more restrictive, and restoring standard behavior - (reported by HN) - TD -1998-08-21 (2.8.1dev.22) -* correct test for -std1 compiler option on Digital Unix (reported by Michael - Warner) - TD -* modify treatment of COLLAPSE_BR_TAGS, so that if it is set TRUE, two or more - concurrent BRs will be collapsed into a single blank line. Note that the - valid way to insert extra blank lines in HTML is via a PRE block with only - newlines in the block (David Henderson <davidh@psiphi.org>) -* clarification in userdefs.h - HN -* MS Windows codepages updated for EURO SIGN (0x20AC), from ftp.unicode.org - LP -* minor fix for DISP_PARTIAL, disable scrolling when HTTP request already sent - but the new document not displayed on the screen yet - LP -* ifdef DOS/WINDOWS to open lynx.trace in text mode - LP -* rearrange text in lynx.cfg concerning character_set - LP -* correct miscellaneous typos - LP -* Fixed: Verbose images now work with [IMAGE]-Submit. Also, fixed the core - dump when clickable_images is on. The problem was an oversight in - MakeNewTitle() - LE -* reviewed the INSTALLATION file as it relates to DOS and updated it for the - newly released version of PDCurses 2.3. Added the HAVE_GETBKGD define to - makefile.dos, fixes some of the unusual background color handling that was - present in the PDCurses DOS port - DK -* correct ifdef: LYOptions.c fails to build with -DEXP_FORMS_OPTIONS but - _without_ -DDIRED_SUPPORT (e.g. djgpp) - LP -* redesigned cookie_add_{accept,reject}list in LYCookie.c -- they work now - BJP -* added COOKIE_{ACCEPT,REJECT}_DOMAINS in .lynxrc handling to LYrcFile.c - BJP -* slight spacing fix in lynx.cfg - BJP -* added blurb in lynx.cfg about COOKIE_{ACCEPT,REJECT}_DOMAINS - BJP -* -accept_all_cookies on the commandline works as a toggle now (against - lynx.cfg value -- NOT against .lynxrc value) - BJP -* change HTAlert for bad partial reference to an HTUserMsg to make it less - annoying (request by Philip Webb, Jason McBrayer) -1998-08-15 (2.8.1dev.21) -* correct pathname for help file in forms-options screen - TD -* reduce clutter in LYOptions.c with SELECTED, DISABLED, NOTEMPTY macros, - PutOptValues, GetOptValues functions - TD -* modified LYOptions to include MBM support from form-based options, - by making a link href="LYNXOPTIONS://MBM_MENU" like it was in LYPrint.c and - calling edit_bookmarks() from postoptions() - LP -* add/use HTUserMsg to encapsulate most of the important messages - TD -* add/use HTInfoMsg to encapsulate most of the informational messages - TD -* make most of the alert messages use HTAlert, for consistency - TD -* exclude forms-options pages from Visited Links page - LP -* The current keymapping for the DOS Slang ports maps the keys directly to lynx - actions via keymap.c. There are several places in the code that test for - arrow keys, page up or down, home and end for special handling that depend on - the lynx definition of the keys. Hence, the keys in the DOS Slang ports were - failing the tests and not working as expected. The following patch now maps - these special keys. They can no longer be mapped individually via the KEYMAP - mechanism in lynx.cfg. Arrows should now work in GOTO fields. Tested the - patch against the binaries maade by makefile.dos, makefile.dsl, and - makefile.wsl - DK -* The wsl port seems to be working well with DISP_PARTIAL, make this the - default - DK -* correct spelling in lynx.cfg - DK -* modify HText_appendCharacter to wrap long lines when displaying HTML document - source - TD -* add configure option --enable-cgi-links - TD -* clarify discussion of no_proxy in lynx.cfg (Al Gilman). -* Multilingual bookmarks: now we store characters >127 in bookmark titles with - a more consistent and independent way, by keeping in unicode as &#UUUU - (NCR=numeric character reference). The idea belongs to Klaus Weide & Andrey - Chernov (long ago). It may be useful if we need switching display charset - frequently. This is the case when you use lynx on different platforms, e.g. - on UNIX and from remote PC, but want to keep common bookmarks file valid. - Compatibility: NCR as part of I18N and HTML4.0 specifications supported - starting with Lynx 2.7.2, Netscape 4.0 and MSIE 4.0. New option to lynx.cfg - added: NCR_IN_BOOKMARKS which is FALSE by default. - LP -* Tweak "print options menu" to exclude choises which are not available under - the certain conditions (print to the screen and lpansi on DOS/WINDOWS, print - to e-mail for local_host_only). - LP -* Forms options menu: add a link on option_help.html; synchronize - option_help.html against Lynx_User_guide.html and lynx.cfg. Rename label - "raw 8-bit or CJK Mode" with "CJK Mode" for CJK people and "raw 8-bit" for - others. Cleanup postoptions() by introducing flags. - LP -* Force HTuncache_current_document if gen_options() invoked. This is a - dirty fix until we uncache previous document only when necessary. - LP -* Add time/date in addition to X-URL and BASE (PrependBaseToSource), (request - by Hans-Joachim Gurt <gurt@nacamar.net>) - LP -* Turn partial_display off if we are not interactive (reported by Ari Moisio - <armoi@sci.fi>) - LP -* more fixes/refinements for auto-configuring socks5 on AIX (report by Brian - Hauber) - TD -1998-08-06 (2.8.1dev.20) -* rename eat_all_cookies to accept_all_cookies everywhere - BJP -* added ACCEPT_ALL_COOKIES lines to the dist lynx.cfg with the appropriate - description - BJP -* added COOKIE_ACCEPT_DOMAINS and COOKIE_REJECT_DOMAINS to lynx.cfg. These are - comma delimited lists of the domains to handle - BJP -* added cookie_add_acceptlist and cookie_add_rejectlist to LYCookie.c, which - are passed the list of domains from lynx.cfg and add them to the global - cookie list. These may be subject to change, as I might not be handling the - LYstrsep() right -- it works with dev19's LYstrsep(), but hasn't been tested - with Bela's... - BJP -* added a big ugly ifdef'd out section to LYrcFile.c with what I have so far on - the .lynxrc handling of COOKIE_{ACCEPT,REJECT}_DOMAINS. Don't use it. Makes - nasty segfaults - BJP (Brian J Pardy) -* fix a bug where the DJGPP_KEYHANDLER version doesn't allow movement by arrow - keys within a text area. Undo previous patch to LYGetFile.c, with LYgetch - now changed where it is defined in LYStrings.c, rather than at each place - where it is used. The patch in LYStrings.c regarding Windows should fix the - problem with keymapping that occurred when we got rid of RAWDOSKEYHACK - DK -* turn on DISP_PARTIAL in makefile.dos - DK -* correct typo in LYOptions.c - BL -* corrected logic of LYstrsep - BL -* Few minor typos and forgotten notes in man/hlp/cfg files; also quote Bela's - note on lynx.cfg INCLUDE facility - LP -* correct typos in makefile.wsl, makefile.dsl - LP -* correct typos, fix character set problems in recent changes of LYOptions.c - - LP -* move include for socks.h past tcp.h, to allow for redefinition of some - symbols on AIX (report by Brian Hauber) - TD -* adjust headers so that each can be compiled separately, eliminating order - dependencies - TD -* include tcp.h always from within HTUtils.h, to enforce ordering of headers - needed for socks5 definitions - TD -* use S_ISREG, S_ISDIR macros to reduce clutter - TD -* make test for OpenHiddenFile to overwrite user's file more stringent by - ensuring that the given pathname is not a link from a world-writable - directory (reported by BL, with suggested patch) - TD -* add/use LYPathLeaf() function to reduce clutter of pathname-leaf parsing - TD -* eliminate redundant definition of 'FREE() - TD -* ifdef'd LYOptions.c to reduce unneeded code wrt --enable-forms-options - TD -* check in OpenHiddenFile to ensure that we overwrite only regular files, - since we also force the file's permissions to 0600 - TD -1998-07-31 (2.8.1dev.19) -* modify OpenHiddenFile so that it can overwrite files owned by the real - user if the O_EXCL open fails because the file already exists - TD -* add experimental forms-based options screen (patch by Mike Castle), ifdef'd - with EXP_FORMS_OPTIONS and configured with --enable-forms-options. -* add option -eat_all_cookies and corresponding config variable - EAT_ALL_COOKIES (Brian J Pardy <posterkid@psnw.com>). -* correct spurious 'Content' string versus newline after X-URL in LYMail.c - (Bela Lubkin and LV). -* updated versions of config.guess and config.sub based on automake 1.3 - TD -* updated experimental persistent-cookie support based on RP's patch: Replaced - the call to strsep with a home-rolled one for those people who don't have it. - (Reported by Bela Lubkin, Mon, 27 Jul 1998 16:51:14 -0700 on the mailing - list.) Bela's modification to make some character arrays static is also - included. -* nits/spelling in LYPrint.c, LYUtils.c (reported by Mike Castle). -* changed LYGetFile.c to build lynx2.8.1dev.18 with SLANG and the - DJGPP_KEYHANDLER for DOS - DK -* fix a couple of places where the return-value of calloc was not checked - (reported by Mike Castle <dalgoda@ix.netcom.com>) - TD -* correct typo in command-line parsing of -lss option (reported by Chris - Kottaridis <chrisk@BSDI.COM>) -* define _AIX if needed for socks5 (request by Brian Hauber) - TD -* improved configure test for getgroups array type - TD -1998-07-24 (2.8.1dev.18) -* improved test for socks5, to account for special cases on AIX (reported by - Brian Hauber) - TD -* several changes to reduce the number of gcc cast-qual warnings, by adding - CONST, removing casts - TD -* add configure option --enable-syslog to enable system logging of requested - URL's - TD -* add RP's experimental persistent-cookie support, and configure option - --enable-persistent-cookies, ifdef'd with EXP_PERSISTENT_COOKIES - TD -* removed references to DOSRAWKEYHACK, which is no longer used. Modified the - dos makefile for libwww and makefile.dsl to default to using display_partial. - Modified INSTALLATION to reflect the successful use of slang with the dos - port and the now confusing alternatives when compiling the dos port, along - with some other updates - DK -* modify lynx_enable_mouse() for pdcurses configuration so that mouse support - is disabled unless -use_mouse is specified. This is ifdef'd with - __BORLANDC__ for the time being (WB). -* resync build-slang.com, against build.com - TD -* add $(MMSQUALIFIERS) to top-level descrip.mms, e.g., to use options such as - /FROM, /IGNORE, /NOACTION, etc., and $(INCLUDES) definitions to lower-level - descrip.mms files. Improve error-recovery in build.com (patches by Liam - Davis <ld@stian.demon.co.uk>) -* use memset to clear soc_in fields before doing a connect, needed for BSD/OS - (patch by Jeffrey C Honig <jch@bsdi.com>). -* remove spurious sprintf params when using FIXED_RECORD_COMMAND_MASK which has - only one parameter, change VMSsignal from void* to void (report by Mike Xun - Ma <mike@mira.concordia.ca> ) - TD -* use open(O_CREAT|O_EXCL) to open new hidden files - TD -* eliminate_*putenv_cmd variables used by LYReadCFG.c as placeholders for - putenv calls - TD -* disable include of <sys/filio.h> for VMS, from report by Chris Doran) - TD -* fixes for VMS: mismatched curly brace, etc., from CTRACE and buffer-overflow - changes (reported by chris.doran@gblis.mail.abb.com) - TD -* correct a loop in HTML_start_element that strips 7 leading characters from - an href, fixes a core-dump in traversing ".." to "/" - TD -* use new macro SetOutputMode to reduce some clutter - TD -* modify interface of LYCachedTemp so fileCache member is reset to null, fixes - bug in my recent cleanup of temp-files, which caused a core-dump - TD -* add kb/sec rate to HTReadProgress message - TD -* modify computation in HTReadProgress to interpolate rate - LP -* One more fix for DISP_PARTIAL: to avoid blinking while reloading document - with Newline_partial > 1 (say, we press '*' and noproxy) we repaint the page - only when Newline_partial <= HText_getNumOfLines(). - LP -* add "-verbose" command-line switch. - LP -* DOS fix: open stdout in TEXT mode for -help and startup error message. - LP -* correct use of $mapname variable in CF_ALT_CHAR_SET (Tomas Vanhala) -1998-06-25 (2.8.1dev.17) -* add configure option --with-socks5 (request by Brian Hauber - <bhauber@frenzy.com>) - TD -* define symbols HAVE_CURSESX_H, HAVE_JCURSES_H (report by Georg Schwarz - <schwarz@physik.tu-berlin.de>) - TD -* modify logic that reports progress of download to update screen no more than - once per second, fix an overrun problem (reported by Jacob Poon - <a324poon@cdf.toronto.edu>) - TD -1998-06-11 (2.8.1dev.16) -* modify configure script to check for special compiler options which are - assumed for particular platforms (suggested by BL) - TD -* modify display_page in GridText.c so that TRACE does not cause a repaint, - since that causes colors to be incorrectly rendered when tracing - TD -* fix a few of the signed/unsigned mismatch warnings in GridText.c - TD -* correct pathname in LYOpenScratch call for bookmarks (reported by DK) - TD -* DISP_PARTIAL: fix initialization of newdoc.line (case LYK_DOWNLOAD, - mainloop) to correct display while 'd'ownloading files (it was initialized - _after_ the download completed and was good enough without display_partial - mode). - LP -* correct some ifdef's for DISP_PARTIAL - LP -1998-06-04 (2.8.1dev.14) -* minor formatting fixes and documentation for upload screen - LP -* remove config.cache at beginning of configure script - TD -* eliminate cast for GetChar in LYStrings.c (from bug report by Michael Warner, - analysis by BL) - TD -* shorten logs from WWW/* by disabling echo of compiler options as in src/* - TD -* add configure test for types pid_t and uid_t - TD -* add configure test for array type used in getgroups call, to distinguish - between BSD and POSIX variations which use different sizes - TD -* modify configure script to compile DISP_PARTIAL code by default - TD -* fix compiler warnings dealing with unreached statements - TD -* change 'keymap[] array to unsigned char, move logic that relies on its size - into LYKeymap.c - TD -* make LYOpenScratch() work properly for 8.3 names (reported by DK) - TD -* DISP_PARTIAL: introduce separate variables Newline_partial and - NumOfLines_partial, initialize them in mainloop and synchronize with Newline - later when the reload completes (case NORMAL). To reduce the CPU usage while - downloading, call HText_pageDisplay only if NumOfLines_partial is in the - current display page or any Scroll key pressed by the user. We disable - partial_display if requested URL have #fragment, otherwise user will see the - top page first (yes, s/he will be moved to #fragment when the download - completed, but only if no scroll keys were pressed before!). Processing of - "END" key changed from MAXINT to real number of lines in the document - (important for display_partial mode) - LP. -* correct problem that caused DGJPP version built with slang 1.2.2 to lose its - socket whenever the rendering of a http URL is interrupted with "z". This is - in HTCheckForInterrupt in LYUtils.c (reported by John Lewis) - DK -* add files pdcurses.key, slang.key, djgpp.key to document the keybindings - used for DJGPP version - DK -* allow mapping of ALT and Function keys with the DOS port for both the - PDCurses version and the SLANG version with the DJGPP keyhandler. The - extended keys to be mapped have to be specified numerically according to the - definitions in curses.h (for PDCurses) or in keys.h (for SLANG with DJGPP - keyhandler). DJGPP maps keys up to 0x293, while PDCurses maps keys up to - 0x1c0 - DK -* don't try to use -std1 option for gcc on Digital Unix (reported by Michael - Warner <warner@wsu.edu>) - TD -1998-05-23 (2.8.1dev.13) -* use new function LYLocalFileToUrl to cleanup some pathname references - TD -* eliminate 'tempname()' function, using LYNewTxtFile, etc., with new functions - LYOpenTemp, LYCloseTemp, etc., so that temporary files are opened with - appropriate permissions - TD -* correct use of cache variable in CF_ALT_CHAR_SET (reported by BL) - TD -* spell out the logic in HTPlain.c against 2.7.2: there was a certain problem - with chartrans in text/plain mode (LYRawMode was wrongly interferring, - problem reported by Jacob Poon & FM). - LP -* modify logic for zero-width spaces in conv_uni_to_pc to exclude 0x200a - LP -* supply missing "break", which was forcing raw utf-8 output in URLs (NOT hex - escaped) - LP -1998-05-14 (2.8.1dev.12) -* remove unneeded definition used in testing dev.11 from config.hin) - TD -1998-05-14 (2.8.1dev.11) -* fixes for function-keys with slang configuration on DOS (patch by DK). -* correct missing '&' in command-line options entry for syslog (reported by - HN) - TD -* correct initial value for NoColorvideo with PDCurses, from my error in - 1998-05-10 integration (reported by DK) - TD -1998-05-10 (2.8.1dev.10) -* eliminate assignment to stderr for trace-file by making tfp a function. - TD -* added John Davis' keymaps/keysym patch (it really should be integrated with - the normal lynx.cfg file). -* tweak chartrans, "Convert the octet to Unicode": incoming symbols >127 but < - LYlowest_eightbit[IN-charset] now ignored, previously displayed as UFFFD. - (SGML.c, HTPlain.c, LYCharUtils.c) - LP -* removed conflicting/unused declaration of 'bzero()' from tcp.h (from report - by Ashraf Zorkani <zorkani@aucegypt.edu>) - TD -* modify the set/unset/toggle options to allow "on" and "off" values also - TD -* apply the "partial display" patch, modified from: - http://www.flora.org/lynx-dev/html/month0398/msg00993.html - The behavior is controlled by a compile-time option (DISP_PARTIAL), by a - command-line argument (-partial), and by a lynx.cfg option (PARTIAL). - BL -* extend command-line option processing of set/unset/toggle options - -toggle- (set that toggle to FALSE) - -toggle+ (set that toggle to TRUE) - e.g., - lynx -show_cursor+ -case- - or with explicit 1/0 values, e.g., - -toggle=0 (set that toggle to FALSE) - -toggle=1 (set that toggle to TRUE) - NOTE: this allows you to change a few flags that would previously have been - controlled by lynx.cfg, and are security-related, such as -locexec or - -telnet. I believe there is no issue, because if the user can control the - command line to Lynx, he could have run `lynx -cfg my_cfg_file` and - circumvented those settings anyway. - BL -* fix for buffer-overrun in LYMail.c when processing a mailto:very-log-address - URL - BL -* correct, for OS/2 EMX, a place in LYConvertToURL() which must not use - HTDOS_wwwName() (patch by Jason F. McBrayer <jmcbray@mailhost.tcs.tulane.edu>) -* similar changes to LYCurses.c, LYMain.c, LYStrings.c, add src/makefile.wsl, for building - DOS version with slang - Bill Schiavo -* modify LYCurses.c, LYMain.c, LYStrings.c, add src/makefile.dsl, for building - DOS version with slang - DK -* fix to improve reloading if user changed assume_charset in options menu - using ^A, which sometimes did not work - LP -* add several chartrans-related files to test/ directory: spaces.html, - c1.html, raw8bit.html - LP -* fixes to compile on SunOS with K&R compiler. - TD -1998-05-03 (2.8.1dev.9) -* correct missing counter increment in tempname(), from cleanup. - TD -1998-05-02 (2.8.1dev.8) -* Fix for CGI-related URLs processing (syntax: ?x=1&yz=2). To avoid interfere - with SGML we restrict '=' as terminator for a named entity, this only applied - for HREF= attribute translation (LYCharUtils.c). (reported by Alex Matulich - alex@unicorn.us.com & FM). - LP -* restore information in the INSTALLATION file for the DOS port on patching - tcplib. Also, clarifies the location of nullpkt. It also clarifies - that the PDCurses beta has incorporated some of the patches we made for - the lynx DOS port. - DK -* modify logic that updates bookmark file after removing a link to use copy - rather than rename, to solve file-ownership problems (patch by Paul - Gilmartin, though I kept the permissions check). - TD -* reduce a little of the clutter in tempname() with fmt_tempname, and - bad_tempname functions. Though this doesn't address the security problems it - does fix the problem with signed getpid values. - TD -* simplify LYUtils.c with compare_type() function - TD -* add/use string functions LYLowerCase, LYUpperCase, LYRemoveBlanks (replaces - collapse_spaces), LYTrimLeading, LYTrimTrailing (incidentally fixes core-dump - in LYCookie.c) - TD -* rewrite read_cfg function to make it more table-driven (reworked from a - patch by John Davis) - TD -* rewrite parse_arg function to make it more table-driven (reworked from a - patch by John Davis) - TD -* omit -Olimit compiler option on Digital UNIX 4.0 (patch by Tomas Vanhala). -* modify configure test for acs_map[] array to work on Digital UNIX 4.0 - (reported by Jim Spath and Tomas Vanhala <vanhala@ling.helsinki.fi>). - TD -1998-04-23 (2.8.1dev.7) -* fix core-dump when pressing '.' on a page with no links (patch by - Jan Hlav\'{a}\v{c}ek <lahvak@math.ohio-state.edu>). -* initial changes to use macros CTRACE and tfp to replace explicit use of - stderr for the trace log. Remaining work is required for some complex - expressions, switching file pointers and for perror-substitute. - TD -* ifdef's for OS/2 EMX, mostly pathname tweaks (patch by Jason F. McBrayer - <jmcbray@mailhost.tcs.tulane.edu>). -1998-04-18 (2.8.1dev.6) -* correct misplaced ifdef in LYMail.c, which caused Cc to not work (patch - by LE). -* convert \x escapes to octal form (reported by Claude Soma). - TD -* modify configure script to check for cursesX before curses library, for - ultrix 4.3 (reported by Claude Soma <soma_c@decus.fr>). - TD -* incorporate lpansi into LYPrint.c (patch by HN). -* modify top-level makefile to use INSTALL_PROGRAM and INSTALL_DATA - consistently, rather than installbin and installdoc (reported by - <karl@deas.harvard.edu>). - TD -* modify treatment of -auth and -pauth options to allow setting a blank - password, e.g., -pauth=user: specifies a blank password, and -pauth=user - leaves the password unspecified (patch by Frederick P Herrmann - <fph@tiac.net>). -* Change documentation to indicate "Lynx.trace" file rather than "lynx.trace". -* Change default for USE_TRACE_LOG in userdefs.h to TRUE, to make behavior - consistent with 2.7.2 - TD -* Rename no_color_video symbol in LYCurses.c to NoColorVideo, to avoid conflict - with term.h, which is included by curses.h on some systems (reported by Paul - Gilmartin). - TD -* modify include-path in djgpp makefile to avoid conflicting tcp.h - DK -* Add -tagsoup option, for initializing parser directly to TagSoup. - TD -* Modify HTML.c, ifdef'ing some of the logic involved in unstacking tags. It - appears to be not completely necessary: makes Lynx a little faster, at the - cost of making the tagsoup parser do the wrong thing. Some entries in the - tagsoup DTD table versus the sortasgml table have SGML_EMPTY versus - SGML_MIXED. This information is used to control unstacking (in the - color-style configuration as well). There is still a problem evidenced - when toggling between the two parsers in the Lynx main help page, but that - appears to be missing logic in 2.8's version of the tagsoup parser. - TD -* Modify HTTCP.c to check the length returned from gethostbyname(), which - returns 0 on error on a SunOS 4 system (reported by Paul Gilmartin). - TD -1998-03-29 (2.8.1dev.5) -* Fixed my typo for FNAMES_8_3 define. WB -* Added SYSTEM_MAIL and SYSTEM_MAIL_FLAGS defines for DOSPATH target. WB -* Better kluge to set terminal type for DOSPATH. WB -* Restored DOSPATH kludge to get to root of directory. WB -* Added a bit of missing _WINDOWS_NSL ifdef'ing. WB -* Minor DOS dirent mod to work with Tom's rearrangements. WB -* Changed #if XYZ to #ifdef XYZ in tcp.h for dumb (?) compilers. WB -1998-03-25 (2.8.1dev.4) -* restore original string in LYUtils.c when user enters a badly formed or - nonexistent URL when prompted for Goto/history list (patch by Randall - <hezekiah@may98.rahul.net>). Otherwise Lynx would always attempt to load a - local file if the original string omits scheme:// prefix but guessing fails. -* tweak formatting of .message in HTFTP.c so it has leading/trailing blank - lines (patch by Ismael Cordeiro <ismael@CAM.ORG>) -* retested 'make depend' rule (for LV (Larry Virden)) - TD -* eliminate (except for absolute pathnames, as in VMS) quoted includes - TD -* remove WWW/Library/Implementation/HTAlert.[ch], since they conflict with - src/HTAlert.[ch], and are not used - TD -* replace the [LINK], [INLINE] and [IMAGE] comments (for images without ALT) - with filenames of these images. This feature can be enabled or disabled by - setting VERBOSE_IMAGES in lynx.cfg and/or userdefs.h (patches by - helen@voland.cc.huji.ac.il and wschiavo@concentric.net>) -* consistently use ${cf_cv_ncurses_header-curses.h} rather than - $cf_cv_ncurses_header in configure script, as noted by JS - TD -* tweak include of HTML.h in HTFile.h to fix compile problem on VMS (we really - should not use quote-style includes) - TD -* fixes to LYStyle.c to make color-style code work on Digital Unix 4.0 - TD -1998-03-20 (2.8.1dev.3) +1998-03-20 * Added death for Win/DOS clients that don't have a TMP space defined. - WB * Added _WINDOWS_NSL to provide interruptable lookups in Win32 per a patch from afn06760@afn.org. (modified hopefully for borland AND cygwin and diff --git a/INSTALLATION b/INSTALLATION index 7a10328e..86b39aad 100644 --- a/INSTALLATION +++ b/INSTALLATION @@ -100,12 +100,12 @@ II. Compile instructions -- UNIX NOTE: The 'configure' script generates auxiliary files "config.status" "config.cache" and "config.log". Normally you will not notice these; they are created automatically and removed by a "make distclean". - + + If you wish to rebuild Lynx with a new host, or change ANY of the parameters which are stored in config.cache, you MUST first remove the config.cache file before running configure; its options do NOT override the settings in that file. - + + The config.status file is a script which creates (or regenerates) the files created by the configure script. @@ -134,22 +134,13 @@ II. Compile instructions -- UNIX IRIX 5.2 and 6.2 (cc & gcc w/ curses, ncurses & slang) Linux 2.0.0 (gcc 2.7.2 w/ curses, ncurses & slang) MkLinux 2.1.5 (gcc 2.7.2.1) NetBSD - OS/2 EMX 0.9b (ncurses) SCO (cc w/ curses) + OS/2 EMX 0.9b SCO (cc w/ curses) Solaris 2.5 & 2.6 (cc & gcc w/ curses, ncurses & slang) SunOS 4.1 (cc w/ curses, gcc w/ ncurses & slang) - NOTES: - - + SunOS and HP-UX come with a bundled K&R compiler, which is only useful - for compiling with the bundled curses. Both ncurses and slang require - a compiler that recognizes prototypes. - - + ncurses 4.2 builds/works on OS/2; however you should get at least the - post-4.2 patches from October 1998, since that supports mouse and - screen sizes other than 25x80. - - http://www.clark.net/pub/dickey/ncurses/ncurses.faq.html - ftp://ftp.clark.net/pub/dickey/ncurses/ + NOTE: SunOS and HP-UX come with a bundled K&R compiler, which is only + useful for compiling with the bundled curses. Both ncurses and slang + require a compiler that recognizes prototypes. 1c. Options To get a list of the configure script's options, type "./configure --help". @@ -157,12 +148,7 @@ II. Compile instructions -- UNIX order shown by the -help option is different. See "docs/README.defines" for information on defines for which there are no option switches. - --disable-config-info (define NO_CONFIG_INFO) - Use this option to disable the browsable configuration information - (screens that show the result of the configuration script, as well - as a pointer to the lynx.cfg file). - - --disable-dired (define DIRED_SUPPORT) + --disable-dired (defines DIRED_SUPPORT) Use this option to disable the optional directory-editor. Lynx supports directory editing (DirEd) for local directories. @@ -222,13 +208,6 @@ II. Compile instructions -- UNIX disable extended HTML DTD logic. This should revert to old-style (2.7.1/2.7.2) behavior, but is not well-tested. - --disable-forms-options (define NO_OPTION_FORMS) - Disable the forms-based options screen. (See --disable-menu-options). - Please note that a few users with broken curses may have problems with - popup forms fields. The default behaviour is to compile both forms and - menu options code with FORMS_OPTIONS switch in lynx.cfg, or - -forms_options command-line switch. - --disable-full-paths Use this option to control whether full utility pathnames are used. By default, configure substitutes full pathnames. @@ -236,23 +215,13 @@ II. Compile instructions -- UNIX --disable-long-list (prevent defining LONG_LIST) Use this option to disable long "ls -l" directory listings. - --disable-menu-options (define NO_OPTION_MENU) - Disable the menu-style options screen. (See --disable-forms-options). - Please note that a few users with broken curses may have problems with - popup forms fields. The default behaviour is to compile both styles - options menu code with FORMS_OPTIONS switch in lynx.cfg, or - -forms_options command-line switch. - --disable-parent-dir-refs (define NO_PARENT_DIR_REFERENCE) Use this option to disable "Up-to" parent-links in directory listings. - --disable-partial (define DISP_PARTIAL) - Turn off code that lets Lynx display parts of a long page while loading - it. - - --enable-cgi-links (define LYNXCGI_LINKS) - Allows lynx to access a cgi script directly without the need for - a http daemon. + --enable-8bit-toupper (define EXP_8BIT_TOUPPER) + Use experimental 8-bit case-conversion, e.g., for case-insensitive + searches in non-ASCII display character set, this overrides locale + settings. --enable-color-style (define USE_COLOR_STYLE) Use this option to enable optional and *experimental* color style. @@ -266,12 +235,6 @@ II. Compile instructions -- UNIX configuration supports the use of 'default' for colors even without this option. - --enable-exec-links (define EXEC_LINKS) - Allows lynx to execute programs by accessing a link. - - --enable-exec-scripts (define EXEC_SCRIPTS) - Allows lynx to execute programs inferred from a link. - --enable-externs (define USE_EXTERNALS) Use this option to enable external application support. (See lynx.cfg.) @@ -289,21 +252,10 @@ II. Compile instructions -- UNIX forcing inappropriate resubmission of form content. --enable-nsl-fork (define NSL_FORK) - Disabled by default, this allows interruption of NSL requests, - so that `z' will stop the `look-up' phase of a connection. - - --enable-persistent-cookies (define EXP_PERSISTENT_COOKIES) - Use this option to compile-in support for saving cookies to a file, - for subsequent reuse. This creates the file specified by the - 'COOKIE_FILE' option, or defaults to ".lynx_cookies" in the home - directory. (Currently there is no protection against conflict - if several lynx copies active from the same account). - - --enable-syslog (define SYSLOG_REQUESTED_URLS) - Use this option to log NSL requests via syslog(). + Use this option to allow NSL requests to be aborted at will. --enable-underlines (define UNDERLINE_LINKS) - Use this option to underline links rather than using boldface. + Use this option underline links rather than using boldface. --enable-warnings Use this option to turn on GCC compiler warnings. @@ -325,23 +277,7 @@ II. Compile instructions -- UNIX --with-screen=ncurses (define NCURSES) --with-screen=slang (define USE_SLANG) - --with-socks (define SOCKS) - Use this option to configure with the socks library. - - --with-socks5 (define USE_SOCKS5, SOCKS) - Use this option to configure with the socks5 library. - - If you make a SOCKSified lynx, note that you may have problems - accessing FTP servers. Also, instead of SOCKSifying lynx for use - behind a firewall, you are better off if you make it normally, and set - it up to use a proxy server. You can SOCKSify the proxy server, and it - will handle all clients, not just Lynx (see the INSTALLATION file in - this distribution). If your SOCKS server was compiled to use the short - version of Rbind, also include -DSHORTENED_RBIND in your SITE_LYDEFS - and SITE_DEFS. If you do SOCKSify lynx, you can turn off SOCKS proxy - usage via a -nosocks command line switch. - - --with-zlib (define USE_ZLIB) + --with-zlib (define USE_ZLIB) Use zlib for decompression of some gzip files. 1d. Environment variables @@ -389,7 +325,8 @@ II. Compile instructions -- UNIX setenv RESOLVLIB -lbind #!/bin/csh -f - setenv CPPFLAGS "-I$HOME/slang -I$HOME/.usr/include" + setenv CPPFLAGS "-SYSLOG_REQUESTED_URLS -I$HOME/slang \ + -I$HOME/.usr/include" setenv LIBS "-L$HOME/.slang/lib -L$HOME/.usr/lib" ./configure --exec-prefix=$HOME --bindir=$HOME/.lynx \ --mandir=$HOME/.usr/man --libdir=$HOME/.usr/lib \ @@ -399,14 +336,16 @@ II. Compile instructions -- UNIX use the libbind.a resolver library, not libresolv.a. Setting RESOLVLIB to -lbind defines this environment variable for `make', and thus must be set in the same shell that `make' will be run. CPPFLAGS in this example - defines the full path to the slang and zlib header files, which are not - kept in standard directories. Likewise, LIBS defines the nonstandard - locations of libslang.a and libz.a. Setting the option --bindir tells - the configure script where I want to install the lynx binary; setting - --mandir tells it where to put the lynx.1 man page, and setting --libdir - tells it (while at the same time defining LYNX_CFG_FILE) where to put the - configuration file "lynx.cfg", when I type "make install". The - --with-screen=slang and --with-zlib options are explained above. + predefines SYSLOG_REQUESTED_URLS for the configure script, since it is not + defined by default, and has no option switch (see "docs/README.defines"). + CPPFLAGS also defines the full path to the slang and zlib header files, + which are not kept in standard directories. Likewise, LIBS defines the + nonstandard locations of libslang.a and libz.a. Setting the option + --bindir tells the configure script where I want to install the lynx + binary; setting --mandir tells it where to put the lynx.1 man page, and + setting --libdir tells it (while at the same time defining LYNX_CFG_FILE) + where to put the configuration file "lynx.cfg", when I type "make install". + The --with-screen=slang and --with-zlib options are explained above. 2. Manual compile If auto-configure does not work for you, or you prefer to compile @@ -552,14 +491,11 @@ IV. Compile instructions -- Win32 (Windows95/NT) V. Compile instructions -- 386 DOS Compiling for DOS with DJGPP is a multistep procedure. First install - the c compiler and its libraries. Update the distribution with the - patched lib.c, to take care of bug fixes. It is available at: - "http://www.cartsys.com/eldredge/djgpp-patches.html". - DJGPP, as distributed from the usual DJGPP archives, will - not successfully compile lynx. You need to "stubedit" your - "cc1.exe" file. The following parameters have worked successfully: - minstack=800k, bufsize=64k. To accomplish this, move to the - djgpp\bin directory and type the command: + the c compiler and its libraries. DJGPP, as distributed from the + usual DJGPP archives, will not successfully compile lynx. You need to + "stubedit" your "cc1.exe" file. The following parameters have worked + successfully: minstack=800k, bufsize=64k. To accomplish this, move to + the djgpp\bin directory and type the command: "stubedit cc1.exe bufsize=64k minstack=800k". Or do it interactively with the command: "stubedit cc1.exe". (see "http://www.flora.org/lynx-dev/html/month0897/msg00145.html"). @@ -582,66 +518,33 @@ V. Compile instructions -- 386 DOS In addition to the files in the Lynx distribution, you will need a curses package and a TCP package. You can use PDCurses (available at "http://www.lightlink.com/hessling/") and the DJGPP port of WATTCP - (available in two different versions at "ftp://neonatal.sm.med.ic.ac.uk/" - and in "http://www.fdisk.com/doslynx/wlynx/source/djgpp.zip"). You - can also use slang ("ftp://space.mit.edu/pub/davis/slang") as your - curses library. You need to compile these before you go any further. - If you wish to use PDCurses 2.3, you need to first apply the - following patch: - -*** curses.h Thu Jul 9 19:38:28 1998 ---- curses.h.new Sat Aug 15 11:02:08 1998 -*************** -*** 1802,1807 **** ---- 1802,1808 ---- - #define getbegx(w) (w)->_begx - #define getbegy(w) (w)->_begy - #define getbegyx(w,y,x) ( y = (w)->_begy, x = (w)->_begx ) -+ #define getbkgd(w) ((w)->_bkgd) - #define getch() wgetch(stdscr) - #define getmaxx(w) (w)->_maxx - #define getmaxy(w) (w)->_maxy - - If you have trouble applying the patch, we recommend - that you use the "patch" program, - ("http://www.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/pat25b.zip"). The - WATTCP TCPLIB sources also need to be patched prior to compilation. See - "http://www.flora.org/lynx-dev/html/month1197/msg00403.html". - - To read the Unix man style documentation, use, for example, "less" + (available in two different versions at "ftp://neonatal.sm.ic.ac.uk/" + and in "http://www.fdisk.com/doslynx/wlynx/source/djgpp.zip"). + You can also use slang ("ftp://space.mit.edu/pub/davis/slang") as your + curses library. It has not been fully ported to DOS yet, however. + See "http://www.flora.org/lynx-dev/html/month1097/msg00390.html". You + need to compile these before you go any further. If you wish to use the + beta version of PDCurses 2.3, you need to first apply a patch (available at + "http://www.flora.org/lynx-dev/html/month0997/msg00441.html"). If you have + trouble applying the patch, we recommend that you use the "patch" program, + ("http://www.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/pat25b.zip"). To + read the Unix man style documentation, use, for example, "less" ("http://www.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/lss332b.zip"). Compile or place your compiled PDCurses library in lynx2-*/curses, and compile or place your compiled WATTCP library in lynx2-*/djgpp/tcplib. - If using the SLANG library, put libslang.a in your DJGPP/lib - directory and put slang.h and slcurses.h in your DJGPP/include - directory, or in the appropriate directories specified by LIBRARY_PATH - and INCLUDE_PATH in your DJGPP.ENV file. - Move to the "lynx2-*/WWW/Library/djgpp" directory and do "make". This - should compile libwww.a. Next move to the "lynx2-*/src/chrtrans" + Move to the "lynx2-*/WWW/Library/djgpp" directory and do "make". This + should compile libwww.a. Next move to the "lynx2-*/src/chrtrans" directory and do "make -f makefile.dos" to compile the character tables. - Then move to the "lynx2-*/src" directory. There are three choices for - compiling at this point. You can do "make -f makefile.dos" to compile - with PDCurses, "make -f makefile.wsl" to compile with SLANG, or - "make -f makefile.dsl" to compile with SLANG and the DJGPP keyhandler. - At the time of this writing, it is not clear what the advantages and - disadvantages of each version are. The PDCurses version has the most - experience and allows remapping of ALT and Function keys. The SLANG - version seems to have better screen handling. It allows mapping of - function keys, but not ALT keys. The SLANG with DJGPP keyhandler allows - mapping of ALT and Function keys, but has the risk of incompatibilities - from mixing different programs. - + Then move to the "lynx2-*/src" directory and do "make -f makefile.dos". If all goes well, you will have a lynx.exe file. If you have trouble, check to be sure djgpp.env is the way it came in the original package. - To compile lynx with DJGPP you may need about 20Mb of free disk space - for virtual memory. To test Lynx_386 you must have a packet driver installed. The simplest method is to use a null packet driver that just allows Lynx to start up, but doesn't do anything else. One such executable driver has been posted, - uuencoded, to the lynx-dev mailing list: - "http://www.flora.org/lynx-dev/html/month0198/msg00057.html". + uuencoded, to the lynx-dev mailing list: "msg00031.html", "msg00057.html", + and "msg00066.html" under "http://www.flora.org/lynx-dev/html/month0198/". Start the dummy packet driver with "nullpkt 0x60", and take it out of memory with "nullpkt -u". You can also use slip8250.com. See the CRYNWR package "http://www.simtel.net/pub/simtelnet/msdos/pktdrvr/pktd11.zip". @@ -652,21 +555,8 @@ V. Compile instructions -- 386 DOS "ftp://jazz.trumpet.com.au/slipper". To remove it from memory use termin.com (usage "termin 0x60"), available in the CRYNWR package. To connect over a dialup PPP connection you need dosppp or klos' pppshare. - (Find at: - "http://mvmpc9.ciw.uni-karlsruhe.de/c:/user/toni/dosppp/dosppp06.zip", - "http://personal.redestb.es/tonilop/dosppp/dosppp06.zip", or - "ftp://ftp.agate.net/users/01935/internet/dosppp06.zip"; - "ftp://ftp.klos.com/demo/pppshare.exe".) - - - File access looks like this: - - file:///c:/ - file:///c:/dos - file:///c:/dos/command.com - file://localhost/c:/ - file://localhost/c:/dos - file://localhost/c:/dos/command.com + (Find at "http://www.simtel.net/pub/simtelnet/msdos/pktdrvr/dosppp05.zip" + and "ftp://ftp.klos.com/demo/pppshare.exe".) See "http://www.fdisk.com/doslynx/lynxport.htm" for more hints and some precompiled libraries. One problem you can run into is when editing @@ -716,7 +606,8 @@ VI. General installation instructions need to do is type "make install-help." If you are installing manually, copy the files "COPYHEADER" and "COPYING" into the lynx_help directory BEFORE moving the lynx_help tree to its final location. These files are - referenced hypertextually from help documents. + referenced hypertextually from help documents. Find tips for installing + the help files at "http://www.irm.nara.kindai.ac.jp/lynxdev/README.help". If you have old, pre-existing bookmark files from earlier versions of Lynx, those files may have to be updated. Conversion may just consist @@ -861,47 +752,26 @@ VII. Setting environment variables before running Lynx (optional) The proxy and no_proxy variables also can be set at run time via lynx.cfg. -2. Win32 (95/NT) and 386 DOS (adapted from "readme.txt" by Wayne Buttles and - "readme.dos" by Doug Kaufman) - - Here are some environment variables that should be set, usually in a - batch file that runs the lynx executable. Make sure that you have enough - room left in your environment. You may need to change your "SHELL=" - setting in config.sys. In addition, lynx looks for a "SHELL" environment - variable when shelling to DOS. If you wish to preserve the environment - space when shelling, put a line like this in your AUTOEXEC.BAT file also - "SET SHELL=C:\COMMAND.COM /E:2048". It should match CONFIG.SYS. +2. Win32 (95/NT) and 386 DOS (adapted from "readme.txt" by Wayne Buttles) HOME Where to keep the bookmark file and personal config files. + LYNX_CFG The full path and filename for lynx.cfg TEMP or TMP Bookmarks are kept here with no HOME. Temp files here. - USER Set to your login name - LYNX_CFG Set to the full path and filename for lynx.cfg + TERM Set TERM=vt100 to stop that annoying terminal type message. + USER Tells Lynx you are real instead of an anonymous user(?) 386 version only: - WATTCP.CFG Set to the full path for the WATTCP.CFG directory + WATTCP.CFG Where to find the wattcp.cfg file. (Depending on how you compiled libtcp.a, you may have to use WATCONF.) Define these in your batch file for running Lynx. For example, if your - application line is "D:\win32\lynx.bat", lynx.bat for Win32 may look like: + application line is "D:\win32\lynx.bat", lynx.bat may look like: @ECHO OFF set home=d:\win32 set temp=d:\tmp set lynx_cfg=d:\win32\lynx.cfg d:\win32\lynx.exe %1 %2 %3 %4 %5 - In lynx_386, a typical batch file might look like: - - @echo off - set HOME=f:/lynx2-8 - set USER=your_login_name - set LYNX_CFG=%HOME%/lynx.cfg - set WATTCP.CFG=%HOME% - f:\lynx2-8\lynx %1 %2 %3 %4 %5 %6 %7 %8 %9 - - You will also need to make sure that the WATTCP.CFG file has the - correct information for IP number, Gateway, Netmask, and Domain Name - Server. This can also be automated in the batch file. - VIII. Acknowledgment diff --git a/LYMessages_en.h b/LYMessages_en.h index bdefbc80..0ceb1273 100644 --- a/LYMessages_en.h +++ b/LYMessages_en.h @@ -8,7 +8,7 @@ #define LYMESSAGES_EN_H /******************************************************************* - * The following definitions are for status line prompts, messages, + * The following definitions are for statusline prompts, messages, * or warnings issued by Lynx during program execution. You can * modify them to make them more appropriate for you site, and/or * to use other languages. Links to collections of alternate @@ -22,9 +22,11 @@ * one of those with a different name. */ #define REALLY_QUIT_Y "Are you sure you want to quit? [Y] " -#define REALLY_QUIT_N "Are you sure you want to quit? [N] " #ifdef VMS #define REALLY_EXIT_Y "Really exit from Lynx? [Y] " +#endif /* VMS */ +#define REALLY_QUIT_N "Are you sure you want to quit? [N] " +#ifdef VMS #define REALLY_EXIT_N "Really exit from Lynx? [N] " #endif /* VMS */ #define CANCELLED "Cancelled!!!" @@ -39,8 +41,6 @@ #define MOREHELP \ "-- press space for more, use arrow keys to move, '?' for help, 'q' to quit." #define MORE "-- press space for next page --" - -/* Forms messages */ #define FORM_LINK_TEXT_MESSAGE \ "(Text entry field) Enter text. Use UP or DOWN arrows or tab to move off." #define FORM_LINK_TEXT_UNM_MSG \ @@ -89,12 +89,6 @@ "UNMODIFIABLE option list. Use return or arrow keys to review or leave." #define CHOICE_LIST_UNM_MSG \ "UNMODIFIABLE choice list. Use return or arrow keys to review or leave." -#define SUBMITTING_FORM "Submitting form..." -#define RESETTING_FORM "Resetting form..." -#define RELOADING_FORM \ - "Reloading document. Any form entries will be lost!" -#define CANNOT_TRANSCODE_FORM "Warning: Cannot transcode form data to charset %s!" - #define NORMAL_LINK_MESSAGE \ "(NORMAL LINK) Use right-arrow or <return> to activate." #define LINK_NOT_FOUND "The resource requested is not available at this time." @@ -126,10 +120,12 @@ " Enter text into the field by typing on the keyboard " #define FORM_NOVICELINE_TWO \ " Ctrl-U to delete all text in field, [Backspace] to delete a character " - -/* mailto */ +#define SUBMITTING_FORM "Submitting form..." +#define RESETTING_FORM "Resetting form..." +#define RELOADING_FORM \ + "Reloading document. Any form entries will be lost!" +#define CANNOT_TRANSCODE_FORM "Warning: Cannot transcode form data to charset %s!" #define BAD_FORM_MAILTO "Malformed mailto form submission! Cancelled!" -#define MAILTO_SQUASH_CTL "Warning! Control codes in mail address replaced by ?" #define FORM_MAILTO_DISALLOWED "Mail disallowed! Cannot submit." #define FORM_MAILTO_FAILED "Mailto form submission failed!" #define FORM_MAILTO_CANCELLED "Mailto form submission Cancelled!!!" @@ -149,7 +145,6 @@ #define SEND_COMMENT_PROMPT "Send this comment? (y/n) " #define SEND_MESSAGE_PROMPT "Send this message? (y/n) " #define SENDING_YOUR_MSG "Sending your message..." - #define FILE_ACTIONS_DISALLOWED "file: ACTIONs are disallowed!" #define FILE_SERVED_LINKS_DISALLOWED \ "file: URLs via served links are disallowed!" @@ -171,9 +166,8 @@ #endif /* VMS */ #define SPAWNING_DISABLED "Spawning is currently disabled." #define DOWNLOAD_DISABLED "The 'd'ownload command is currently disabled." -#define NO_DOWNLOAD_INPUT "You cannot download an input field." +#define NO_DOWNLOAD_INPUT "You cannot download a input field." #define NO_DOWNLOAD_MAILTO_ACTION "Form has a mailto action! Cannot download." -#define NO_DOWNLOAD_MAILTO_LINK "You cannot download a mailto: link." #define NO_DOWNLOAD_COOKIES "You cannot download cookies." #define NO_DOWNLOAD_PRINT_OP "You cannot download a printing option." #define NO_DOWNLOAD_UPLOAD_OP "You cannot download an upload option." @@ -220,14 +214,14 @@ #define BOOKMARK_OPEN_FAILED "ERROR - unable to open bookmark file." #define BOOKMARK_OPEN_FAILED_FOR_DEL \ "Unable to open bookmark file for deletion of link." +#ifdef VMS #define BOOKSCRA_OPEN_FAILED_FOR_DEL \ "Unable to open scratch file for deletion of link." -#ifdef VMS #define ERROR_RENAMING_SCRA "Error renaming scratch file." #else +#define BOOKTEMP_OPEN_FAILED_FOR_DEL \ + "Unable to open temporary file for deletion of link." #define ERROR_RENAMING_TEMP "Error renaming temporary file." -#define BOOKTEMP_COPY_FAIL \ - "Unable to copy temporary file for deletion of link." #define BOOKTEMP_REOPEN_FAIL_FOR_DEL \ "Unable to reopen temporary file for deletion of link." #endif /* VMS */ @@ -466,8 +460,6 @@ #define PRESS_RETURN_TO_FINISH "Press <return> to finish: " #define CONFIRM_LONG_PAGE_PRINT \ "File is %d pages long. Are you sure you want to print? [y]" -#define CHECK_PRINTER \ - "Be sure your printer is on-line. Press <return> to start printing:" #define FILE_ALLOC_FAILED "ERROR - Unable to allocate file space!!!" #define UNABLE_TO_OPEN_TEMPFILE "Unable to open tempfile" #define UNABLE_TO_OPEN_PRINTOP_FILE "Unable to open print options file" @@ -478,14 +470,12 @@ #define MAP_NOT_ACCESSIBLE "Client-side image MAP is not accessible!" #define MAPS_NOT_AVAILABLE "No client-side image MAPs are available!" #define MAP_NOT_AVAILABLE "Client-side image MAP is not available!" -#ifndef NO_OPTION_MENU #define OPTION_SCREEN_NEEDS_24 \ "Screen height must be at least 24 lines for the Options menu!" #define OPTION_SCREEN_NEEDS_23 \ "Screen height must be at least 23 lines for the Options menu!" #define OPTION_SCREEN_NEEDS_22 \ "Screen height must be at least 22 lines for the Options menu!" -#endif /* !NO_OPTION_MENU */ #define NEED_ADVANCED_USER_MODE "That key requires Advanced User mode." #define COMMAND_PROMPT "Command: " #define SELECT_SEGMENT "Select " @@ -572,7 +562,7 @@ "Maximum links per page exceeded! Use half-page or two-line scrolling." #define MAXHIST_REACHED \ "History List maximum reached! Document not pushed." -#define VISITED_LINKS_EMPTY "No previously visited links available!" +#define VISITED_LINKS_EMPTY "No previously visited links available!" #define MEMORY_EXHAUSTED_ABORT "Memory exhausted! Program aborted!" #define DFM_NOT_AVAILABLE "Directory/File Manager not available" #define BASE_NOT_ABSOLUTE "HREF in BASE tag is not an absolute URL." @@ -603,8 +593,6 @@ "\n When you are done, press enter and put a single period (.)" #define ENTER_PERIOD_WHEN_DONE_B \ "\n on a line and press enter again." - -/* Cookies messages */ #define ADVANCED_COOKIE_CONFIRMATION \ "%s cookie: %.*s=%.*s Allow? (Y/N/Always/neVer)" #define INVALID_COOKIE_DOMAIN_CONFIRMATION \ @@ -612,13 +600,14 @@ #define ALLOWING_COOKIE "Allowing this cookie." #define REJECTING_COOKIE "Rejecting this cookie." #define COOKIE_JAR_IS_EMPTY "The Cookie Jar is empty." +#define COOKIE_JAR_TITLE "Lynx Cookie Jar" +#define REACHED_COOKIE_JAR_PAGE "You have reached the Lynx Cookie Jar Page" #define ACTIVATE_TO_GOBBLE \ "Activate links to gobble up cookies or entire domains," #define OR_CHANGE_ALLOW "or to change a domain's 'allow' setting." #define COOKIES_NEVER_ALLOWED "(Cookies never allowed.)" #define COOKIES_ALWAYS_ALLOWED "(Cookies always allowed.)" #define COOKIES_ALLOWED_VIA_PROMPT "(Cookies allowed via prompt.)" -#define COOKIES_READ_FROM_FILE "(Persistent Cookies.)" #define NO_NAME "(No name.)" #define NO_VALUE "(No value.)" #define END_OF_SESSION "(End of session.)" @@ -633,10 +622,9 @@ #define DOMAIN_COOKIES_EATEN "All cookies in the domain have been eaten!" #define ALWAYS_ALLOWING_COOKIES "'A'lways allowing from domain '%s'." #define NEVER_ALLOWING_COOKIES "ne'V'er allowing from domain '%s'." -#define PROMPTING_TO_ALLOW_COOKIES "'P'rompting to allow from domain '%s'." +#define PROMTING_TO_ALLOW_COOKIES "'P'rompting to allow from domain '%s'." #define DELETE_ALL_COOKIES_IN_DOMAIN "Delete all cookies in this domain?" #define ALL_COOKIES_EATEN "All of the cookies in the jar have been eaten!" - #define PORT_NINETEEN_INVALID "Port 19 not permitted in URLs." #define PORT_TWENTYFIVE_INVALID "Port 25 not permitted in URLs." #define PORT_INVALID "Port %lu not permitted in URLs." @@ -653,33 +641,6 @@ #define FORM_TAIL_COMBINED_WITH_HEAD \ "Modified tail combined with head of form field value." -/* Lynx internal page titles */ -#define CONFIG_DEF_TITLE "Configuration Definitions" -#define COOKIE_JAR_TITLE "Cookie Jar" -#define CURRENT_KEYMAP_TITLE "Current Key Map" -#define DIRED_MENU_TITLE "File Management Options" -#define DOWNLOAD_OPTIONS_TITLE "Download Options" -#define HISTORY_PAGE_TITLE "History Page" -#define LIST_PAGE_TITLE "List Page" -#define LYNXCFG_TITLE "Lynx.cfg Information" -#define OPTIONS_TITLE "Options Menu" -#define PERMIT_OPTIONS_TITLE "File Permission Options" -#define PRINT_OPTIONS_TITLE "Printing Options" -#define SHOWINFO_TITLE "Information about the current document" -#define UPLOAD_OPTIONS_TITLE "Upload Options" -#define VISITED_LINKS_TITLE "Visited Links Page" -#define BOOKMARK_TITLE "Bookmark file" -#define MOSAIC_BOOKMARK_TITLE "Converted Mosaic Hotlist" - -/* CONFIG_DEF_TITLE subtitles */ -#define AUTOCONF_CONFIG_CACHE \ - "The following data were derived during the automatic configuration/build\n\ -process of this copy of Lynx. When reporting a bug, please include a copy\n\ -of this page." -#define AUTOCONF_LYNXCFG_H \ - "The following data were used as automatically-configured compile-time\n\ -definitions when this copy of Lynx was built." - #ifdef DIRED_SUPPORT #define DIRED_NOVICELINE \ " C)reate D)ownload E)dit F)ull menu M)odify R)emove T)ag U)pload \n" @@ -1,11 +1,11 @@ Lynx README file -Lynx Version 2.8.1 is the latest "official" release. This release is based on -the lynx2.8pre.11 development code set, and includes bug fixes through October -24, 1998. See the CHANGES file for a complete record of all changes and -bug fixes in this release. New releases are announced on the lynx-dev mailing -list (see below). +Lynx Version 2.8.1 is the latest release. This release is based on the +lynx2.8pre.11 development code set, and includes bug fixes through October 24, +1998. See the CHANGES file for a complete record of all changes and bug fixes +in this release. New releases are announced on the lynx-dev mailing list (see +below). WHAT IS LYNX? diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c index f4a00dca..4082d96a 100644 --- a/WWW/Library/Implementation/HTAABrow.c +++ b/WWW/Library/Implementation/HTAABrow.c @@ -51,6 +51,7 @@ */ #include <HTUtils.h> +#include <string.h> /* strchr() */ #include <HTString.h> #include <HTParse.h> /* URL parsing function */ #include <HTList.h> /* HTList object */ @@ -340,29 +341,32 @@ PRIVATE HTAASetup *HTAASetup_lookup ARGS4( HTList *cur = server->setups; - CTRACE(tfp, "%s %s (%s:%d:%s)\n", - "HTAASetup_lookup: resolving setup for", - (IsProxy ? "proxy" : "server"), - hostname, portnumber, docname); + if (TRACE) + fprintf(stderr, "%s %s (%s:%d:%s)\n", + "HTAASetup_lookup: resolving setup for", + (IsProxy ? "proxy" : "server"), + hostname, portnumber, docname); while (NULL != (setup = (HTAASetup*)HTList_nextObject(cur))) { if (HTAA_templateMatch(setup->template, docname)) { - CTRACE(tfp, "%s `%s' %s `%s'\n", - "HTAASetup_lookup:", docname, - "matched template", setup->template); + if (TRACE) + fprintf(stderr, "%s `%s' %s `%s'\n", + "HTAASetup_lookup:", docname, + "matched template", setup->template); return setup; - } else { - CTRACE(tfp, "%s `%s' %s `%s'\n", - "HTAASetup_lookup:", docname, - "did NOT match template", setup->template); } + else if (TRACE) + fprintf(stderr, "%s `%s' %s `%s'\n", + "HTAASetup_lookup:", docname, + "did NOT match template", setup->template); } /* while setups remain */ } /* if valid parameters and server found */ - CTRACE(tfp, "%s `%s' %s\n", - "HTAASetup_lookup: No template matched", - (docname ? docname : "(null)"), - "(so probably not protected)"); + if (TRACE) + fprintf(stderr, "%s `%s' %s\n", + "HTAASetup_lookup: No template matched", + (docname ? docname : "(null)"), + "(so probably not protected)"); return NULL; /* NULL in parameters, or not found */ } @@ -599,11 +603,12 @@ PRIVATE char *compose_auth_string ARGS3( realm = HTAARealm_lookup(setup->server->realms, realmname); if (!(realm && realm->username && *realm->username && - realm->password) || setup->retry) { + realm->password && *realm->password) || setup->retry) { if (!realm) { - CTRACE(tfp, "%s `%s' %s\n", - "compose_auth_string: realm:", realmname, - "not found -- creating"); + if (TRACE) + fprintf(stderr, "%s `%s' %s\n", + "compose_auth_string: realm:", realmname, + "not found -- creating"); realm = HTAARealm_new(setup->server->realms, realmname, NULL, NULL); } @@ -670,7 +675,7 @@ PRIVATE char *compose_auth_string ARGS3( * Signals to retry. - FM */ return NULL; - } else if (*realm->username == '\0') { + } else if (*realm->username == '\0' || *realm->password == '\0') { /* * Signals to abort. - FM */ @@ -855,8 +860,9 @@ PUBLIC char *HTAA_composeAuth ARGS4( ** on server-side. Life is hard.) */ if (HTAAForwardAuth) { - CTRACE(tfp, "HTAA_composeAuth: %s\n", - "Forwarding received authorization"); + if (TRACE) + fprintf(stderr, "HTAA_composeAuth: %s\n", + "Forwarding received authorization"); StrAllocCopy(HTAA_composeAuthResult, HTAAForwardAuth); HTAAForwardAuth_reset(); /* Just a precaution */ return HTAA_composeAuthResult; @@ -869,7 +875,9 @@ PUBLIC char *HTAA_composeAuth ARGS4( ** Proxy Authorization required. - AJL */ - CTRACE(tfp, "Composing Proxy Authorization for %s:%d/%s\n", + if (TRACE) + fprintf(stderr, + "Composing Proxy Authorization for %s:%d/%s\n", hostname, portnumber, docname); if (proxy_portnumber != portnumber || @@ -944,7 +952,9 @@ PUBLIC char *HTAA_composeAuth ARGS4( /* ** Normal WWW authorization. */ - CTRACE(tfp, "Composing Authorization for %s:%d/%s\n", + if (TRACE) + fprintf(stderr, + "Composing Authorization for %s:%d/%s\n", hostname, portnumber, docname); if (current_portnumber != portnumber || @@ -1051,9 +1061,10 @@ PUBLIC char *HTAA_composeAuth ARGS4( ** field (in function HTAA_composeAuth()). ** NO, otherwise. */ -PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4( +PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS5( char *, start_of_headers, int, length, + void *, handle, int, soc, BOOL, IsProxy) { @@ -1076,11 +1087,13 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4( /* ** Read server reply header lines */ - CTRACE(tfp, "Server reply header lines:\n"); + if (TRACE) + fprintf(stderr, "Server reply header lines:\n"); - HTAA_setupReader(start_of_headers, length, soc); + HTAA_setupReader(start_of_headers, length, handle, soc); while (NULL != (line = HTAA_getUnfoldedLine()) && *line != '\0') { - CTRACE(tfp, "%s\n", line); + if (TRACE) + fprintf(stderr, "%s\n", line); if (strchr(line, ':')) { /* Valid header line */ @@ -1120,8 +1133,9 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4( } scheme_specifics[scheme] = HTAA_parseArgList(args); num_schemes++; - } else { - CTRACE(tfp, "Unknown scheme `%s' %s\n", + } + else if (TRACE) { + fprintf(stderr, "Unknown scheme `%s' %s\n", (arg1 ? arg1 : "(null)"), (IsProxy ? "in Proxy-Authenticate: field" : @@ -1131,13 +1145,14 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4( else if (!IsProxy && 0==strcasecomp(fieldname, "WWW-Protection-Template:")) { - CTRACE(tfp, "Protection template set to `%s'\n", arg1); + if (TRACE) + fprintf(stderr, "Protection template set to `%s'\n", arg1); StrAllocCopy(template, arg1); } } /* if a valid header line */ - else { - CTRACE(tfp, "Invalid header line `%s' ignored\n", line); + else if (TRACE) { + fprintf(stderr, "Invalid header line `%s' ignored\n", line); } /* else invalid header line */ FREE(line); diff --git a/WWW/Library/Implementation/HTAABrow.h b/WWW/Library/Implementation/HTAABrow.h index 49351cd2..9512603a 100644 --- a/WWW/Library/Implementation/HTAABrow.h +++ b/WWW/Library/Implementation/HTAABrow.h @@ -31,8 +31,12 @@ #ifndef HTAABROW_H #define HTAABROW_H +#ifndef HTUTILS_H +#include <HTUtils.h> /* BOOL, PARAMS, ARGS */ +#endif /* HTUTILS_H */ #include <HTAAUtil.h> /* Common parts of AA */ + #ifdef SHORT_NAMES #define HTAAcoAu HTAA_composeAuth #define HTAAsRWA HTAA_shouldRetryWithAuth @@ -111,6 +115,7 @@ extern char *HTAA_composeAuth PARAMS(( extern BOOL HTAA_shouldRetryWithAuth PARAMS(( char * start_of_headers, int length, + void * handle, int soc, BOOL IsProxy)); diff --git a/WWW/Library/Implementation/HTAAFile.c b/WWW/Library/Implementation/HTAAFile.c index 82da7af9..96b07faa 100644 --- a/WWW/Library/Implementation/HTAAFile.c +++ b/WWW/Library/Implementation/HTAAFile.c @@ -1,3 +1,4 @@ + /* MODULE HTAAFile.c ** FILE ROUTINES FOR AUTHENTICATION ** (PASSWD AND GROUP FILES) AND @@ -13,8 +14,14 @@ ** */ + +#ifndef HTUTILS_H #include <HTUtils.h> +#endif /* HTUTILS_H */ +#include <tcp.h> /* Macro FROMASCII() */ +/*#include <stdio.h> included by HTUtils.h -- FM *//* FILE */ +#include <string.h> #include <HTAAUtil.h> /* Common utilities used in AA */ #include <HTAAFile.h> /* Implemented here */ diff --git a/WWW/Library/Implementation/HTAAFile.h b/WWW/Library/Implementation/HTAAFile.h index 8986b593..e20735c7 100644 --- a/WWW/Library/Implementation/HTAAFile.h +++ b/WWW/Library/Implementation/HTAAFile.h @@ -15,6 +15,10 @@ #ifndef HTAAFILE_H #define HTAAFILE_H +#ifndef HTUTILS_H +#include <HTUtils.h> /* BOOL, PARAMS, ARGS */ +#endif /* HTUTILS_H */ +/*#include <stdio.h> included by HTUtils.h -- FM *//* FILE */ #include <HTList.h> /* HTList */ #ifdef SHORT_NAMES diff --git a/WWW/Library/Implementation/HTAAProt.c b/WWW/Library/Implementation/HTAAProt.c index 773474a9..6bf8ab3f 100644 --- a/WWW/Library/Implementation/HTAAProt.c +++ b/WWW/Library/Implementation/HTAAProt.c @@ -19,6 +19,7 @@ #include <HTUtils.h> +#include <string.h> #ifndef VMS #ifndef NOUSERS #include <pwd.h> /* Unix password file routine: getpwnam() */ @@ -124,21 +125,22 @@ PUBLIC int HTAA_getUid NOARGS if (current_prot && current_prot->uid_name) { if (isNumber(current_prot->uid_name)) { if (NULL != (pw = getpwuid(atoi(current_prot->uid_name)))) { - CTRACE(tfp, "%s(%s) returned (%s:%s:%d:%d:...)\n", - "HTAA_getUid: getpwuid", - current_prot->uid_name, - pw->pw_name, pw->pw_passwd, - (int) pw->pw_uid, (int) pw->pw_gid); + if (TRACE) fprintf(stderr, + "%s(%s) returned (%s:%s:%d:%d:...)\n", + "HTAA_getUid: getpwuid", + current_prot->uid_name, + pw->pw_name, pw->pw_passwd, + pw->pw_uid, pw->pw_gid); return pw->pw_uid; } } else { /* User name (not a number) */ if (NULL != (pw = getpwnam(current_prot->uid_name))) { - CTRACE(tfp, "%s(\"%s\") %s (%s:%s:%d:%d:...)\n", - "HTAA_getUid: getpwnam", - current_prot->uid_name, "returned", - pw->pw_name, pw->pw_passwd, - (int) pw->pw_uid, (int) pw->pw_gid); + if (TRACE) fprintf(stderr, "%s(\"%s\") %s (%s:%s:%d:%d:...)\n", + "HTAA_getUid: getpwnam", + current_prot->uid_name, "returned", + pw->pw_name, pw->pw_passwd, + pw->pw_uid, pw->pw_gid); return pw->pw_uid; } } @@ -147,8 +149,8 @@ PUBLIC int HTAA_getUid NOARGS ** Ok, then let's get uid for nobody. */ if (NULL != (pw = getpwnam("nobody"))) { - CTRACE(tfp, "HTAA_getUid: Uid for `nobody' is %d\n", - (int) pw->pw_uid); + if (TRACE) fprintf(stderr, "HTAA_getUid: Uid for `nobody' is %d\n", + pw->pw_uid); return pw->pw_uid; } /* @@ -175,10 +177,11 @@ PUBLIC int HTAA_getGid NOARGS if (isNumber(current_prot->gid_name)) { if (NULL != (gr = getgrgid(atoi(current_prot->gid_name)))) { #ifndef __EMX__ /* no gr_passwd */ - CTRACE(tfp, "%s(%s) returned (%s:%s:%d:...)\n", - "HTAA_getGid: getgrgid", - current_prot->gid_name, - gr->gr_name, gr->gr_passwd, (int) gr->gr_gid); + if (TRACE) fprintf(stderr, + "%s(%s) returned (%s:%s:%d:...)\n", + "HTAA_getGid: getgrgid", + current_prot->gid_name, + gr->gr_name, gr->gr_passwd, gr->gr_gid); #endif return gr->gr_gid; } @@ -186,10 +189,11 @@ PUBLIC int HTAA_getGid NOARGS else { /* Group name (not number) */ if (NULL != (gr = getgrnam(current_prot->gid_name))) { #ifndef __EMX__ /* no gr_passwd */ - CTRACE(tfp, "%s(\"%s\") returned (%s:%s:%d:...)\n", - "HTAA_getGid: getgrnam", - current_prot->gid_name, - gr->gr_name, gr->gr_passwd, (int) gr->gr_gid); + if (TRACE) fprintf(stderr, + "%s(\"%s\") returned (%s:%s:%d:...)\n", + "HTAA_getGid: getgrnam", + current_prot->gid_name, + gr->gr_name, gr->gr_passwd, gr->gr_gid); #endif return gr->gr_gid; } @@ -199,8 +203,8 @@ PUBLIC int HTAA_getGid NOARGS ** Ok, then let's get gid for nogroup. */ if (NULL != (gr = getgrnam("nogroup"))) { - CTRACE(tfp, "HTAA_getGid: Gid for `nogroup' is %d\n", - (int) gr->gr_gid); + if (TRACE) fprintf(stderr, "HTAA_getGid: Gid for `nogroup' is %d\n", + gr->gr_gid); return gr->gr_gid; } /* @@ -290,16 +294,15 @@ PRIVATE void HTAA_parseProtFile ARGS2(HTAAProt *, prot, if (!prot->valid_schemes) prot->valid_schemes = HTList_new(); HTList_addObject(prot->valid_schemes,(void*)scheme); - CTRACE(tfp, "%s %s `%s'\n", - "HTAA_parseProtFile: valid", - "authentication scheme:", - HTAAScheme_name(scheme)); - } else { - CTRACE(tfp, "%s %s `%s'\n", - "HTAA_parseProtFile: unknown", - "authentication scheme:", - HTlex_buffer); + if (TRACE) fprintf(stderr, "%s %s `%s'\n", + "HTAA_parseProtFile: valid", + "authentication scheme:", + HTAAScheme_name(scheme)); } + else if (TRACE) fprintf(stderr, "%s %s `%s'\n", + "HTAA_parseProtFile: unknown", + "authentication scheme:", + HTlex_buffer); if (LEX_ITEM_SEP != (lex_item = lex(fp))) break; @@ -319,10 +322,10 @@ PRIVATE void HTAA_parseProtFile ARGS2(HTAAProt *, prot, lex_item=LEX_REC_SEP; /*groupdef parser read this already*/ if (TRACE) { if (prot->mask_group) { - fprintf(tfp, + fprintf(stderr, "HTAA_parseProtFile: Mask group:\n"); HTAA_printGroupDef(prot->mask_group); - } else fprintf(tfp, "HTAA_parseProtFile: %s\n", + } else fprintf(stderr, "HTAA_parseProtFile: %s\n", "Mask group syntax error"); } } /* if "Mask" */ @@ -334,19 +337,20 @@ PRIVATE void HTAA_parseProtFile ARGS2(HTAAProt *, prot, prot->values = HTAssocList_new(); HTAssocList_add(prot->values, fieldname, HTlex_buffer); lex_item = lex(fp); /* Read record separator */ - CTRACE(tfp, "%s `%s' bound to value `%s'\n", - "HTAA_parseProtFile: Name", - fieldname, HTlex_buffer); + if (TRACE) fprintf(stderr, + "%s `%s' bound to value `%s'\n", + "HTAA_parseProtFile: Name", + fieldname, HTlex_buffer); } } /* else name-value pair */ } /* if valid field */ if (lex_item != LEX_EOF && lex_item != LEX_REC_SEP) { - CTRACE(tfp, "%s %s %d (that line ignored)\n", - "HTAA_parseProtFile: Syntax error", - "in protection setup file at line", - HTlex_line); + if (TRACE) fprintf(stderr, "%s %s %d (that line ignored)\n", + "HTAA_parseProtFile: Syntax error", + "in protection setup file at line", + HTlex_line); do { lex_item = lex(fp); } while (lex_item != LEX_EOF && lex_item != LEX_REC_SEP); @@ -401,11 +405,12 @@ PRIVATE HTAAProt *HTAAProt_new ARGS3(CONST char *, cur_docname, } if (cache_item) { prot = cache_item->prot; - CTRACE(tfp, "%s `%s' already in cache\n", - "HTAAProt_new: Protection file", prot_filename); + if (TRACE) fprintf(stderr, "%s `%s' already in cache\n", + "HTAAProt_new: Protection file", prot_filename); } else { - CTRACE(tfp, "HTAAProt_new: Loading protection file `%s'\n", - prot_filename); + if (TRACE) fprintf(stderr, + "HTAAProt_new: Loading protection file `%s'\n", + prot_filename); if (!(prot = (HTAAProt*)calloc(1, sizeof(HTAAProt)))) outofmem(__FILE__, "HTAAProt_new"); @@ -428,11 +433,10 @@ PRIVATE HTAAProt *HTAAProt_new ARGS3(CONST char *, cur_docname, cache_item->prot_filename = NULL; StrAllocCopy(cache_item->prot_filename, prot_filename); HTList_addObject(prot_cache, (void*)cache_item); - } else { - CTRACE(tfp, "HTAAProt_new: %s `%s'\n", - "Unable to open protection setup file", - (prot_filename ? prot_filename : "(null)")); } + else if (TRACE) fprintf(stderr, "HTAAProt_new: %s `%s'\n", + "Unable to open protection setup file", + (prot_filename ? prot_filename : "(null)")); } if (cur_docname) @@ -471,9 +475,9 @@ PUBLIC void HTAA_setDefaultProtection ARGS3(CONST char *, cur_docname, if (prot_filename) { default_prot = HTAAProt_new(cur_docname, prot_filename, ids); } else { - CTRACE(tfp, "%s %s\n", - "HTAA_setDefaultProtection: ERROR: Protection file", - "not specified (obligatory for DefProt rule)!!\n"); + if (TRACE) fprintf(stderr, "%s %s\n", + "HTAA_setDefaultProtection: ERROR: Protection file", + "not specified (obligatory for DefProt rule)!!\n"); } } @@ -509,15 +513,15 @@ PUBLIC void HTAA_setCurrentProtection ARGS3(CONST char *, cur_docname, if (default_prot) { current_prot = default_prot; HTAA_setIds(current_prot, ids); - CTRACE(tfp, "%s %s %s\n", - "HTAA_setCurrentProtection: Protection file", - "not specified for Protect rule", - "-- using default protection"); + if (TRACE) fprintf(stderr, "%s %s %s\n", + "HTAA_setCurrentProtection: Protection file", + "not specified for Protect rule", + "-- using default protection"); } else { - CTRACE(tfp, "%s %s %s\n", - "HTAA_setCurrentProtection: ERROR: Protection", - "file not specified for Protect rule, and", - "default protection is not set!!"); + if (TRACE) fprintf(stderr, "%s %s %s\n", + "HTAA_setCurrentProtection: ERROR: Protection", + "file not specified for Protect rule, and", + "default protection is not set!!"); } } } diff --git a/WWW/Library/Implementation/HTAAProt.h b/WWW/Library/Implementation/HTAAProt.h index ed36f656..b4d00f49 100644 --- a/WWW/Library/Implementation/HTAAProt.h +++ b/WWW/Library/Implementation/HTAAProt.h @@ -5,6 +5,9 @@ #ifndef HTAAPROT_H #define HTAAPROT_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTGroup.h> #include <HTAssoc.h> diff --git a/WWW/Library/Implementation/HTAAServ.c b/WWW/Library/Implementation/HTAAServ.c index c081a3fa..98779830 100644 --- a/WWW/Library/Implementation/HTAAServ.c +++ b/WWW/Library/Implementation/HTAAServ.c @@ -43,6 +43,9 @@ #include <HTUtils.h> +/*#include <stdio.h> included by HTUtils.h -- FM *//* FILE */ +#include <string.h> /* strchr() */ + #include <HTString.h> #include <HTAccess.h> /* HTSecure */ #include <HTFile.h> /* HTLocalName */ @@ -89,34 +92,45 @@ PUBLIC char *HTAA_statusMessage NOARGS /* 401 cases */ case HTAA_NO_AUTH: return "Unauthorized -- authentication failed"; + break; case HTAA_NOT_MEMBER: return "Unauthorized to access the document"; + break; /* 403 cases */ case HTAA_BY_RULE: return "Forbidden -- by rule"; + break; case HTAA_IP_MASK: return "Forbidden -- server refuses to serve to your IP address"; + break; case HTAA_NO_ACL: case HTAA_NO_ENTRY: return "Forbidden -- access to file is never allowed"; + break; case HTAA_SETUP_ERROR: return "Forbidden -- server protection setup error"; + break; case HTAA_DOTDOT: return "Forbidden -- URL containing /../ disallowed"; + break; case HTAA_HTBIN: return "Forbidden -- /htbin feature not enabled on this server"; + break; /* 404 cases */ case HTAA_NOT_FOUND: return "Not found -- file doesn't exist or is read protected"; + break; /* Success */ case HTAA_OK: return "AA: Access should be ok but something went wrong"; + break; case HTAA_OK_GATEWAY: return "AA check bypassed (gatewaying) but something went wrong"; + break; /* Others */ default: @@ -133,34 +147,46 @@ PRIVATE char *status_name ARGS1(HTAAFailReasonType, reason) /* 401 cases */ case HTAA_NO_AUTH: return "NO-AUTHENTICATION"; + break; case HTAA_NOT_MEMBER: return "NOT-AUTHORIZED"; + break; /* 403 cases */ case HTAA_BY_RULE: return "FORB-RULE"; + break; case HTAA_IP_MASK: return "FORB-IP"; + break; case HTAA_NO_ACL: return "NO-ACL-FILE"; + break; case HTAA_NO_ENTRY: return "NO-ACL-ENTRY"; + break; case HTAA_SETUP_ERROR: return "SETUP-ERROR"; + break; case HTAA_DOTDOT: return "SLASH-DOT-DOT"; + break; case HTAA_HTBIN: return "HTBIN-OFF"; + break; /* 404 cases */ case HTAA_NOT_FOUND: return "NOT-FOUND"; + break; /* Success */ case HTAA_OK: return "OK"; + break; case HTAA_OK_GATEWAY: return "OK-GATEWAY"; + break; /* Others */ default: @@ -203,12 +229,14 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, htaa_user = NULL; if (!pathname) { - CTRACE(tfp, "HTAA_checkAuthorization: Forbidden by rule\n"); + if (TRACE) + fprintf(stderr, "HTAA_checkAuthorization: Forbidden by rule\n"); return HTAA_BY_RULE; } - CTRACE(tfp, "%s `%s' %s %s\n", - "HTAA_checkAuthorization: translated path:", - pathname, "method:", HTAAMethod_name(method)); + if (TRACE) + fprintf(stderr, "%s `%s' %s %s\n", + "HTAA_checkAuthorization: translated path:", + pathname, "method:", HTAAMethod_name(method)); /* ** Get protection setting (set up by callbacks from rule system) @@ -235,9 +263,10 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, htaa_user = HTAA_authenticate(scheme, scheme_specifics, prot); - CTRACE(tfp, "Authentication returned: %s\n", - (htaa_user ? htaa_user->username - : "NOT-AUTHENTICATED")); + if (TRACE) + fprintf(stderr, "Authentication returned: %s\n", + (htaa_user ? htaa_user->username + : "NOT-AUTHENTICATED")); } HTAA_resolveGroupReferences(prot->mask_group, group_def_list); reason = HTAA_userAndInetInGroup(prot->mask_group, @@ -245,13 +274,14 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, ? htaa_user->username : "", HTClientHost, NULL); - if (reason != HTAA_OK) { - CTRACE(tfp, "%s %s %s %s\n", + if (TRACE) { + if (reason != HTAA_OK) + fprintf(stderr, "%s %s %s %s\n", "HTAA_checkAuthorization: access denied", "by mask (no ACL, only Protect rule)", "host", HTClientHost); - } else { - CTRACE(tfp, "%s %s %s %s\n", + else + fprintf(stderr, "%s %s %s %s\n", "HTAA_checkAuthorization: request from", HTClientHost, "accepted by only mask match (no ACL, only", @@ -260,15 +290,17 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, return reason; } else { /* 403 Forbidden */ - CTRACE(tfp, "%s %s\n", - "HTAA_checkAuthorization: Protected, but", - "no mask group nor ACL -- forbidden"); + if (TRACE) + fprintf(stderr, "%s %s\n", + "HTAA_checkAuthorization: Protected, but", + "no mask group nor ACL -- forbidden"); return HTAA_NO_ACL; } } else { /* No protect rule and no ACL => OK 200 */ - CTRACE(tfp, "HTAA_checkAuthorization: %s\n", - "no protect rule nor ACL -- ok\n"); + if (TRACE) + fprintf(stderr, "HTAA_checkAuthorization: %s\n", + "no protect rule nor ACL -- ok\n"); return HTAA_OK; } } @@ -277,13 +309,15 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, ** Now we know that ACL exists */ if (!prot) { /* Not protected by "protect" rule */ - CTRACE(tfp, "HTAA_checkAuthorization: default protection\n"); + if (TRACE) + fprintf(stderr, "HTAA_checkAuthorization: default protection\n"); prot = HTAA_getDefaultProtection(); /* Also sets current protection */ if (!prot) { /* @@ Default protection not set ?? */ - CTRACE(tfp, "%s %s\n", - "HTAA_checkAuthorization: default protection", - "not set (internal server error)!!"); + if (TRACE) + fprintf(stderr, "%s %s\n", + "HTAA_checkAuthorization: default protection", + "not set (internal server error)!!"); return HTAA_SETUP_ERROR; } } @@ -303,9 +337,10 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, htaa_user = HTAA_authenticate(scheme, scheme_specifics, prot); - CTRACE(tfp, "Authentication returned: %s\n", - (htaa_user - ? htaa_user->username : "NOT-AUTHENTICATED")); + if (TRACE) + fprintf(stderr, "Authentication returned: %s\n", + (htaa_user + ? htaa_user->username : "NOT-AUTHENTICATED")); } /* ** Check mask group @@ -317,18 +352,20 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, HTClientHost, NULL); if (reason != HTAA_OK) { - CTRACE(tfp, "%s %s %s\n", - "HTAA_checkAuthorization: access denied", - "by mask, host:", HTClientHost); + if (TRACE) + fprintf(stderr, "%s %s %s\n", + "HTAA_checkAuthorization: access denied", + "by mask, host:", HTClientHost); return reason; } else { - CTRACE(tfp, "%s %s %s %s %s\n", - "HTAA_checkAuthorization: request from", - HTClientHost, - "accepted by just mask group match", - "(no ACL, only Protect rule, and only", - "mask enabled)"); + if (TRACE) + fprintf(stderr, "%s %s %s %s %s\n", + "HTAA_checkAuthorization: request from", + HTClientHost, + "accepted by just mask group match", + "(no ACL, only Protect rule, and only", + "mask enabled)"); /* And continue authorization checking */ } } @@ -339,8 +376,9 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, */ allowed_groups = HTAA_getAclEntry(acl_file, pathname, method); if (!allowed_groups) { - CTRACE(tfp, "%s `%s' %s\n", - "No entry for file", pathname, "in ACL"); + if (TRACE) + fprintf(stderr, "%s `%s' %s\n", + "No entry for file", pathname, "in ACL"); HTAA_closeAcl(acl_file); return HTAA_NO_ENTRY; /* Forbidden -- no entry in the ACL */ } @@ -420,8 +458,9 @@ PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url, ** be a security hole. */ if (strstr(local_copy, "/../")) { - CTRACE(tfp, "HTAA_checkAuthorization: %s (`%s')\n", - "Illegal attempt to use /../", url); + if (TRACE) + fprintf(stderr, "HTAA_checkAuthorization: %s (`%s')\n", + "Illegal attempt to use /../", url); HTAAFailReason = HTAA_DOTDOT; } else { @@ -443,7 +482,8 @@ PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url, } if (!pathname) { /* Forbidden by rule */ - CTRACE(tfp, "HTAA_checkAuthorization: Forbidden by rule\n"); + if (TRACE) + fprintf(stderr, "HTAA_checkAuthorization: Forbidden by rule\n"); HTAAFailReason = HTAA_BY_RULE; } else if (HTAAFailReason != HTAA_HTBIN) { @@ -460,7 +500,9 @@ PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url, } else { /* Not local access */ HTAAFailReason = HTAA_OK_GATEWAY; - CTRACE(tfp, "HTAA_checkAuthorization: %s (%s access)\n", + if (TRACE) + fprintf(stderr, + "HTAA_checkAuthorization: %s (%s access)\n", "Gatewaying -- skipping authorization check", acc_method); } @@ -479,14 +521,15 @@ PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url, htaa_user && htaa_user->username ? htaa_user->username : ""); fflush(htaa_logfile); /* Actually update it on disk */ - CTRACE(tfp, "Log: %24.24s %s %s %s %s %s\n", - ctime(&theTime), - HTClientHost ? HTClientHost : "local", - method_name, - url, - status_name(HTAAFailReason), - htaa_user && htaa_user->username - ? htaa_user->username : ""); + if (TRACE) + fprintf(stderr, "Log: %24.24s %s %s %s %s %s\n", + ctime(&theTime), + HTClientHost ? HTClientHost : "local", + method_name, + url, + status_name(HTAAFailReason), + htaa_user && htaa_user->username + ? htaa_user->username : ""); } switch (HTAAFailReason) { @@ -494,6 +537,7 @@ PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url, case HTAA_NO_AUTH: case HTAA_NOT_MEMBER: return 401; + break; case HTAA_BY_RULE: case HTAA_IP_MASK: @@ -503,13 +547,16 @@ PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url, case HTAA_DOTDOT: case HTAA_HTBIN: return 403; + break; case HTAA_NOT_FOUND: return 404; + break; case HTAA_OK: case HTAA_OK_GATEWAY: return 200; + break; default: return 500; @@ -546,6 +593,7 @@ PRIVATE char *compose_scheme_specifics ARGS2(HTAAScheme, scheme, (realm ? realm : "UNKNOWN")); return result; } + break; case HTAA_PUBKEY: { @@ -556,6 +604,7 @@ PRIVATE char *compose_scheme_specifics ARGS2(HTAAScheme, scheme, "PUBKEY-NOT-IMPLEMENTED"); return result; } + break; default: return NULL; } @@ -581,28 +630,28 @@ PRIVATE char *compose_scheme_specifics ARGS2(HTAAScheme, scheme, PUBLIC char *HTAA_composeAuthHeaders NOARGS { static char *result = NULL; - int n; + HTAAScheme scheme; char *scheme_name; char *scheme_params; HTAAProt *prot = HTAA_getCurrentProtection(); if (!prot) { - CTRACE(tfp, "%s %s\n", - "HTAA_composeAuthHeaders: Document not protected", - "-- why was this function called??"); + if (TRACE) + fprintf(stderr, "%s %s\n", + "HTAA_composeAuthHeaders: Document not protected", + "-- why was this function called??"); return NULL; - } else { - CTRACE(tfp, "HTAA_composeAuthHeaders: for file `%s'\n", - prot->filename); } + else if (TRACE) + fprintf(stderr, "HTAA_composeAuthHeaders: for file `%s'\n", + prot->filename); FREE(result); /* From previous call */ if (!(result = (char*)malloc(4096))) /* @@ */ outofmem(__FILE__, "HTAA_composeAuthHeaders"); *result = '\0'; - for (n = 0; n < (int) HTAA_MAX_SCHEMES; n++) { - HTAAScheme scheme = (HTAAScheme) n; + for (scheme=0; scheme < HTAA_MAX_SCHEMES; scheme++) { if (-1 < HTList_indexOf(prot->valid_schemes, (void*)scheme)) { if ((scheme_name = HTAAScheme_name(scheme))) { scheme_params = compose_scheme_specifics(scheme,prot); @@ -614,10 +663,9 @@ PUBLIC char *HTAA_composeAuthHeaders NOARGS } strcat(result, "\r\n"); } /* scheme name found */ - else { - CTRACE(tfp, "HTAA_composeAuthHeaders: %s %d\n", - "No name found for scheme number", scheme); - } + else if (TRACE) + fprintf(stderr, "HTAA_composeAuthHeaders: %s %d\n", + "No name found for scheme number", scheme); } /* scheme valid for requested document */ } /* for every scheme */ diff --git a/WWW/Library/Implementation/HTAAServ.h b/WWW/Library/Implementation/HTAAServ.h index a2946ec4..fdee1c2b 100644 --- a/WWW/Library/Implementation/HTAAServ.h +++ b/WWW/Library/Implementation/HTAAServ.h @@ -31,6 +31,10 @@ #ifndef HTAASERV_H #define HTAASERV_H +#ifndef HTUTILS_H +#include <HTUtils.h> /* BOOL, PARAMS, ARGS */ +#endif /* HTUTILS_H */ +/*#include <stdio.h> included by HTUtils.h -- FM *//* FILE */ #include <HTRules.h> /* This module interacts with rule system */ #include <HTAAUtil.h> /* Common parts of AA */ #include <HTAuth.h> /* Authentication */ diff --git a/WWW/Library/Implementation/HTAAUtil.c b/WWW/Library/Implementation/HTAAUtil.c index 05726a8e..b10dcde0 100644 --- a/WWW/Library/Implementation/HTAAUtil.c +++ b/WWW/Library/Implementation/HTAAUtil.c @@ -1,3 +1,4 @@ + /* MODULE HTAAUtil.c ** COMMON PARTS OF ACCESS AUTHORIZATION MODULE ** FOR BOTH SERVER AND BROWSER @@ -44,13 +45,13 @@ */ #include <HTUtils.h> - +#include <tcp.h> /* NETREAD() etc. */ +#include <string.h> #include <HTAAUtil.h> /* Implemented here */ #include <HTAssoc.h> /* Assoc list */ #include <HTTCP.h> #include <HTAlert.h> -#include <LYStrings.h> #include <LYLeaks.h> /* PUBLIC HTAAScheme_enum() @@ -66,12 +67,17 @@ PUBLIC HTAAScheme HTAAScheme_enum ARGS1(CONST char*, name) { char *upcased = NULL; + char *cur; if (!name) return HTAA_UNKNOWN; StrAllocCopy(upcased, name); - LYUpperCase(upcased); + cur = upcased; + while (*cur) { + *cur = TOUPPER(*cur); + cur++; + } if (!strncmp(upcased, "NONE", 4)) { FREE(upcased); @@ -110,16 +116,22 @@ PUBLIC char *HTAAScheme_name ARGS1(HTAAScheme, scheme) switch (scheme) { case HTAA_NONE: return "None"; + break; case HTAA_BASIC: return "Basic"; + break; case HTAA_PUBKEY: return "Pubkey"; + break; case HTAA_KERBEROS_V4: return "KerberosV4"; + break; case HTAA_KERBEROS_V5: return "KerberosV5"; + break; case HTAA_UNKNOWN: return "UNKNOWN"; + break; default: return "THIS-IS-A-BUG"; } @@ -137,12 +149,23 @@ PUBLIC char *HTAAScheme_name ARGS1(HTAAScheme, scheme) */ PUBLIC HTAAMethod HTAAMethod_enum ARGS1(CONST char *, name) { + char tmp[MAX_METHODNAME_LEN+1]; + CONST char *src = name; + char *dest = tmp; + if (!name) return METHOD_UNKNOWN; - if (0==strcasecomp(name, "GET")) + while (*src) { + *dest = TOUPPER(*src); + dest++; + src++; + } + *dest = 0; + + if (0==strcmp(tmp, "GET")) return METHOD_GET; - else if (0==strcasecomp(name, "PUT")) + else if (0==strcmp(tmp, "PUT")) return METHOD_PUT; else return METHOD_UNKNOWN; @@ -164,10 +187,13 @@ PUBLIC char *HTAAMethod_name ARGS1(HTAAMethod, method) switch (method) { case METHOD_GET: return "GET"; + break; case METHOD_PUT: return "PUT"; + break; case METHOD_UNKNOWN: return "UNKNOWN"; + break; default: return "THIS-IS-A-BUG"; } @@ -191,7 +217,8 @@ PUBLIC BOOL HTAAMethod_inList ARGS2(HTAAMethod, method, char *item; while (NULL != (item = (char*)HTList_nextObject(cur))) { - CTRACE(tfp, " %s", item); + if (TRACE) + fprintf(stderr, " %s", item); if (method == HTAAMethod_enum(item)) return YES; } @@ -340,8 +367,9 @@ PUBLIC char *HTAA_makeProtectionTemplate ARGS1(CONST char *, docname) else StrAllocCopy(template, "*"); - CTRACE(tfp, "make_template: made template `%s' for file `%s'\n", - template, docname); + if (TRACE) + fprintf(stderr, "make_template: made template `%s' for file `%s'\n", + template, docname); return template; } @@ -473,8 +501,9 @@ PRIVATE int in_soc = -1; ** will use this buffer first and then ** proceed to read from socket. */ -PUBLIC void HTAA_setupReader ARGS3(char *, start_of_headers, +PUBLIC void HTAA_setupReader ARGS4(char *, start_of_headers, int, length, + void *, handle, int, soc) { start_pointer = buffer; @@ -520,9 +549,10 @@ PUBLIC char *HTAA_getUnfoldedLine NOARGS BOOL peek_for_folding = NO; if (in_soc < 0) { - CTRACE(tfp, "%s %s\n", - "HTAA_getUnfoldedLine: buffer not initialized", - "with function HTAA_setupReader()"); + if (TRACE) + fprintf(stderr, "%s %s\n", + "HTAA_getUnfoldedLine: buffer not initialized", + "with function HTAA_setupReader()"); return NULL; } diff --git a/WWW/Library/Implementation/HTAAUtil.h b/WWW/Library/Implementation/HTAAUtil.h index 059d5b03..2f353a63 100644 --- a/WWW/Library/Implementation/HTAAUtil.h +++ b/WWW/Library/Implementation/HTAAUtil.h @@ -1,35 +1,39 @@ /* Utilities for the Authorization parts of libwww COMMON PARTS OF AUTHORIZATION MODULE TO BOTH SERVER AND BROWSER - + This module is the interface to the common parts of Access Authorization (AA) package for both server and browser. Important to know about memory allocation: - + Routines in this module use dynamic allocation, but free automatically all the memory reserved by them. - + Therefore the caller never has to (and never should) free() any object returned by these functions. - + Therefore also all the strings returned by this package are only valid until the next call to the same function is made. This approach is selected, because of the nature of access authorization: no string returned by the package needs to be valid longer than until the next call. - + This also makes it easy to plug the AA package in: you don't have to ponder whether to free() something here or is it done somewhere else (because it is always done somewhere else). - + The strings that the package needs to store are copied so the original strings given as parameters to AA functions may be freed or modified with no side effects. - + Also note: The AA package does not free() anything else than what it has itself allocated. - + */ #ifndef HTAAUTIL_H #define HTAAUTIL_H +#ifndef HTUTILS_H +#include <HTUtils.h> /* BOOL, PARAMS, ARGS */ +#endif /* HTUTILS_H */ +#include <tcp.h> #include <HTList.h> #ifdef SHORT_NAMES @@ -72,17 +76,22 @@ Default filenames #define MAX_FIELDNAME_LEN 16 /* @@ Longest field name in */ /* protection setup file */ #define MAX_PATHNAME_LEN 80 /* @@ Longest passwd/group file */ - /* pathname to allow */ + /* patname to allow */ + +/* +** Helpful macros +*/ +#define FREE(x) if (x) {free(x); x = NULL;} /* Datatype definitions HTAASCHEME - + The enumeration HTAAScheme represents the possible authentication schemes used by the WWW Access Authorization. - + */ typedef enum { @@ -98,7 +107,7 @@ typedef enum { /* ENUMERATION TO REPRESENT HTTP METHODS - + */ typedef enum { @@ -197,11 +206,11 @@ Match Template Against Filename ** ** ON ENTRY: ** template is a template string to match the file name -** against, may contain a single wildcard +** agaist, may contain a single wildcard ** character * which matches zero or more ** arbitrary characters. ** filename is the filename (or pathname) to be matched -** against the template. +** agaist the template. ** ** ON EXIT: ** returns YES, if filename matches the template. @@ -223,11 +232,11 @@ PUBLIC BOOL HTAA_templateMatch PARAMS((CONST char * template, ** ** ON ENTRY: ** template is a template string to match the file name -** against, may contain a single wildcard +** agaist, may contain a single wildcard ** character * which matches zero or more ** arbitrary characters. ** filename is the filename (or pathname) to be matched -** against the template. +** agaist the template. ** ** ON EXIT: ** returns YES, if filename matches the template. @@ -319,6 +328,7 @@ Header Line Reader */ PUBLIC void HTAA_setupReader PARAMS((char * start_of_headers, int length, + void * handle, int soc)); @@ -346,3 +356,6 @@ PUBLIC void HTAA_setupReader PARAMS((char * start_of_headers, PUBLIC char *HTAA_getUnfoldedLine NOPARAMS; #endif /* NOT HTAAUTIL_H */ +/* + + End of file HTAAUtil.h. */ diff --git a/WWW/Library/Implementation/HTACL.c b/WWW/Library/Implementation/HTACL.c index cca7753f..fe4e02e4 100644 --- a/WWW/Library/Implementation/HTACL.c +++ b/WWW/Library/Implementation/HTACL.c @@ -17,6 +17,10 @@ #include <HTUtils.h> + +/*#include <stdio.h> included by HTUtils.h -- FM *//* FILE */ +#include <string.h> + #include <HTAAFile.h> /* File routines */ #include <HTGroup.h> /* GroupDef */ #include <HTACL.h> /* Implemented here */ @@ -170,17 +174,20 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file, while (EOF != HTAAFile_readField(acl_file, buf, len+1)) { #ifdef VMS - if (HTAA_templateCaseMatch(buf, filename)) + if (HTAA_templateCaseMatch(buf, filename)) { #else /* not VMS */ - if (HTAA_templateMatch(buf, filename)) + if (HTAA_templateMatch(buf, filename)) { #endif /* not VMS */ - { HTList *methods = HTList_new(); HTAAFile_readList(acl_file, methods, MAX_METHODNAME_LEN); - CTRACE(tfp, "Filename '%s' matched template '%s', allowed methods:", + if (TRACE) { + fprintf(stderr, + "Filename '%s' matched template '%s', allowed methods:", filename, buf); + } if (HTAAMethod_inList(method, methods)) { /* right method? */ - CTRACE(tfp, " METHOD OK\n"); + if (TRACE) + fprintf(stderr, " METHOD OK\n"); HTList_delete(methods); methods = NULL; FREE(buf); @@ -190,15 +197,18 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file, ** separator so we don't call HTAAFile_nextRec(). */ return group_def; - } else { - CTRACE(tfp, " METHOD NOT FOUND\n"); + } else if (TRACE) { + fprintf(stderr, " METHOD NOT FOUND\n"); } HTList_delete(methods); methods = NULL; } /* if template match */ else { - CTRACE(tfp, "Filename '%s' didn't match template '%s'\n", + if (TRACE) { + fprintf(stderr, + "Filename '%s' didn't match template '%s'\n", filename, buf); + } } HTAAFile_nextRec(acl_file); @@ -208,3 +218,4 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file, return NULL; /* No entry for requested file */ /* (or an empty entry). */ } + diff --git a/WWW/Library/Implementation/HTACL.h b/WWW/Library/Implementation/HTACL.h index d1431b34..3dfef27c 100644 --- a/WWW/Library/Implementation/HTACL.h +++ b/WWW/Library/Implementation/HTACL.h @@ -5,6 +5,9 @@ #ifndef HTACL_H #define HTACL_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTAAUtil.h> #include <HTGroup.h> diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c index 12b17d54..df7f99c2 100644 --- a/WWW/Library/Implementation/HTAccess.c +++ b/WWW/Library/Implementation/HTAccess.c @@ -60,12 +60,11 @@ #include <UCMap.h> #include <GridText.h> -#include <GridText.h> -#include <LYGlobalDefs.h> #include <LYexit.h> -#include <LYUtils.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + extern HTCJKlang HTCJK; /* @@ -332,10 +331,10 @@ PUBLIC BOOL override_proxy ARGS1( ** ** On entry, ** addr must point to the fully qualified hypertext reference. -** anchor a parent anchor with whose address is addr +** anchor a pareent anchor with whose address is addr ** ** On exit, -** returns HT_NO_ACCESS Error has occurred. +** returns HT_NO_ACCESS Error has occured. ** HT_OK Success */ PRIVATE int get_physical ARGS2( @@ -353,7 +352,8 @@ PRIVATE int get_physical ARGS2( } if (anchor->isISMAPScript == TRUE) { StrAllocCat(physical, "?0,0"); - CTRACE(tfp, "HTAccess: Appending '?0,0' coordinate pair.\n"); + if (TRACE) + fprintf(stderr, "HTAccess: Appending '?0,0' coordinate pair.\n"); } HTAnchor_setPhysical(anchor, physical); FREE(physical); /* free our copy */ @@ -361,7 +361,8 @@ PRIVATE int get_physical ARGS2( if (anchor->isISMAPScript == TRUE) { StrAllocCopy(physical, addr); StrAllocCat(physical, "?0,0"); - CTRACE(tfp, "HTAccess: Appending '?0,0' coordinate pair.\n"); + if (TRACE) + fprintf(stderr, "HTAccess: Appending '?0,0' coordinate pair.\n"); HTAnchor_setPhysical(anchor, physical); FREE(physical); /* free our copy */ } else { @@ -450,10 +451,10 @@ PRIVATE int get_physical ARGS2( proxy = (char *)getenv(gateway_parameter); FREE(gateway_parameter); - if (gateway) - CTRACE(tfp, "Gateway found: %s\n", gateway); - if (proxy) - CTRACE(tfp, "proxy server found: %s\n", proxy); + if (TRACE && gateway) + fprintf(stderr, "Gateway found: %s\n", gateway); + if (TRACE && proxy) + fprintf(stderr, "proxy server found: %s\n", proxy); /* ** Proxy servers have precedence over gateway servers. @@ -579,13 +580,13 @@ PRIVATE int LYUCPopAssumed NOARGS ** ** On entry, ** addr must point to the fully qualified hypertext reference. -** anchor a parent anchor with whose address is addr +** anchor a pareent anchor with whose address is addr ** ** On exit, -** returns <0 Error has occurred. +** returns <0 Error has occured. ** HT_LOADED Success ** HT_NO_DATA Success, but no document loaded. -** (telnet session started etc) +** (telnet sesssion started etc) */ PRIVATE int HTLoad ARGS4( CONST char *, addr, @@ -623,6 +624,8 @@ PUBLIC HTStream *HTSaveStream ARGS1( return (*p->saveStream)(anchor); } +extern char LYinternal_flag; /* from LYMainLoop.c */ + /* Load a document - with logging etc HTLoadDocument() ** ---------------------------------- ** @@ -641,6 +644,16 @@ PUBLIC HTStream *HTSaveStream ARGS1( ** NO Failure */ +extern char LYforce_no_cache; /* from GridText.c */ +extern char LYoverride_no_cache; /* from LYMainLoop.c */ +extern char * HTLoadedDocumentURL NOPARAMS; /* in GridText.c */ +extern BOOL HText_hasNoCacheSet PARAMS((HText *text)); /* in GridText.c */ +extern BOOL reloading; +extern BOOL permanent_redirection; +#ifdef DIRED_SUPPORT +extern BOOLEAN lynx_edit_mode; +#endif + PRIVATE BOOL HTLoadDocument ARGS4( CONST char *, full_address, HTParentAnchor *, anchor, @@ -654,7 +667,8 @@ PRIVATE BOOL HTLoadDocument ARGS4( BOOL ForcingNoCache = LYforce_no_cache; static int redirection_attempts = 0; - CTRACE (tfp, "HTAccess: loading document %s\n", address_to_load); + if (TRACE) + fprintf (stderr, "HTAccess: loading document %s\n", address_to_load); /* ** Free use_this_url_instead and reset permanent_redirection @@ -710,9 +724,11 @@ PRIVATE BOOL HTLoadDocument ARGS4( !strncmp(cp, "Location=", 9)) { DocAddress NewDoc; - CTRACE (tfp, "HTAccess: '%s' is a redirection URL.\n", - anchor->address); - CTRACE (tfp, "HTAccess: Redirecting to '%s'\n", cp+9); + if (TRACE) { + fprintf (stderr, "HTAccess: '%s' is a redirection URL.\n", + anchor->address); + fprintf (stderr, "HTAccess: Redirecting to '%s'\n", cp+9); + } /* ** Don't exceed the redirection_attempts limit. - FM @@ -764,12 +780,12 @@ PRIVATE BOOL HTLoadDocument ARGS4( * If DONT_TRACK_INTERNAL_LINKS is defined, HText_AreDifferent() * is used to determine whether (3) applies. If the target address * differs from that of the current document only by a fragment - * and the target address has an appended fragment, repositioning + * and the taget address has an appended fragment, repositioning * without reloading is always assumed. * Note that HText_AreDifferent() currently always returns TRUE * if the target has a LYNXIMGMAP URL, so that an internally * generated pseudo-document will normally not be re-used unless - * condition (2) applies. (Condition (1) cannot apply since in + * condition (2) appplies. (Condition (1) cannot apply since in * LYMap.c, no_cache is always set in the anchor object). This * doesn't guarantee that the resource from which the MAP element * is taken will be read again (reloaded) when the list of links @@ -810,7 +826,8 @@ PRIVATE BOOL HTLoadDocument ARGS4( strncmp(full_address, "LYNXIMGMAP:", 11))) #endif /* TRACK_INTERNAL_LINKS */ { - CTRACE(tfp, "HTAccess: Document already in memory.\n"); + if (TRACE) + fprintf(stderr, "HTAccess: Document already in memory.\n"); HText_select(text); #ifdef DIRED_SUPPORT @@ -827,7 +844,9 @@ PRIVATE BOOL HTLoadDocument ARGS4( reloading = TRUE; #endif ForcingNoCache = YES; - CTRACE(tfp, "HTAccess: Auto-reloading document.\n"); + if (TRACE) { + fprintf(stderr, "HTAccess: Auto-reloading document.\n"); + } } } @@ -842,7 +861,9 @@ PRIVATE BOOL HTLoadDocument ARGS4( FREE(anchor->title); } status = HTLoad(address_to_load, anchor, format_out, sink); - CTRACE(tfp, "HTAccess: status=%d\n", status); + if (TRACE) { + fprintf(stderr, "HTAccess: status=%d\n", status); + } /* ** Log the access if necessary. @@ -856,7 +877,8 @@ PRIVATE BOOL HTLoadDocument ARGS4( status < 0 ? "FAIL" : "GET", full_address); fflush(HTlogfile); /* Actually update it on disk */ - CTRACE(tfp, "Log: %24.24s %s %s %s\n", + if (TRACE) + fprintf(stderr, "Log: %24.24s %s %s %s\n", ctime(&theTime), HTClientHost ? HTClientHost : "local", status < 0 ? "FAIL" : "GET", @@ -885,10 +907,12 @@ PRIVATE BOOL HTLoadDocument ARGS4( ** in LYGetFile.c when the status is HT_REDIRECTING. This may ** seem bizarre, but it works like a charm! - FM */ - CTRACE(tfp, "HTAccess: '%s' is a redirection URL.\n", - address_to_load); - CTRACE(tfp, "HTAccess: Redirecting to '%s'\n", - redirecting_url); + if (TRACE) { + fprintf(stderr, "HTAccess: '%s' is a redirection URL.\n", + address_to_load); + fprintf(stderr, "HTAccess: Redirecting to '%s'\n", + redirecting_url); + } /* ** Prevent circular references. */ @@ -928,59 +952,73 @@ PRIVATE BOOL HTLoadDocument ARGS4( permanent_redirection = FALSE; if (status == HT_LOADED) { - CTRACE(tfp, "HTAccess: `%s' has been accessed.\n", - full_address); + if (TRACE) { + fprintf(stderr, "HTAccess: `%s' has been accessed.\n", + full_address); + } return YES; } if (status == HT_PARTIAL_CONTENT) { HTAlert("Loading incomplete."); - CTRACE(tfp, "HTAccess: `%s' has been accessed, partial content.\n", - full_address); + if (TRACE) { + fprintf(stderr, "HTAccess: `%s' has been accessed, partial content.\n", + full_address); + } return YES; } if (status == HT_NO_DATA) { - CTRACE(tfp, "HTAccess: `%s' has been accessed, No data left.\n", - full_address); + if (TRACE) { + fprintf(stderr, + "HTAccess: `%s' has been accessed, No data left.\n", + full_address); + } return NO; } if (status == HT_NOT_LOADED) { - CTRACE(tfp, "HTAccess: `%s' has been accessed, No data loaded.\n", - full_address); + if (TRACE) { + fprintf(stderr, + "HTAccess: `%s' has been accessed, No data loaded.\n", + full_address); + } return NO; } if (status == HT_INTERRUPTED) { - CTRACE(tfp, "HTAccess: `%s' has been accessed, transfer interrupted.\n", - full_address); + if (TRACE) { + fprintf(stderr, + "HTAccess: `%s' has been accessed, transfer interrupted.\n", + full_address); + } +/* _HTProgress("Data transfer interrupted."); */ return NO; } - if (status > 0) { - /* - ** If you get this, then please find which routine is returning - ** a positive unrecognized error code! - */ - fprintf(stderr, - "**** HTAccess: socket or file number returned by obsolete load routine!\n"); - fprintf(stderr, - "**** HTAccess: Internal software error. Please mail lynx_dev@sig.net!\n"); - fprintf(stderr, "**** HTAccess: Status returned was: %d\n",status); - exit(-1); + if (status <= 0) { /* Failure in accessing a document */ + char *temp = NULL; + StrAllocCopy(temp, "Can't Access `"); + StrAllocCat(temp, full_address); + StrAllocCat(temp, "'"); + _HTProgress(temp); + FREE(temp); + if (TRACE) fprintf(stderr, + "HTAccess: Can't access `%s'\n", full_address); + HTLoadError(sink, 500, "Unable to access document."); + return NO; } - /* Failure in accessing a document */ - cp = NULL; - StrAllocCopy(cp, "Can't Access `"); - StrAllocCat(cp, full_address); - StrAllocCat(cp, "'"); - _HTProgress(cp); - FREE(cp); + /* + ** If you get this, then please find which routine is returning + ** a positive unrecognised error code! + */ + fprintf(stderr, + "**** HTAccess: socket or file number returned by obsolete load routine!\n"); + fprintf(stderr, + "**** HTAccess: Internal software error. Please mail lynx_dev@sig.net!\n"); + fprintf(stderr, "**** HTAccess: Status returned was: %d\n",status); + exit(-1); - CTRACE(tfp, "HTAccess: Can't access `%s'\n", full_address); - HTLoadError(sink, 500, "Unable to access document."); - return NO; } /* HTLoadDocument */ /* Load a document from absolute name. HTLoadAbsolute() @@ -1078,7 +1116,7 @@ PUBLIC BOOL HTLoadRelative ARGS2( ** ---------------------------------------- ** ** On Entry, -** destination The child or parent anchor to be loaded. +** destination The child or parenet anchor to be loaded. ** ** On Exit, ** returns YES Success @@ -1094,7 +1132,7 @@ PUBLIC BOOL HTLoadAnchor ARGS1( parent = HTAnchor_parent(destination); - if (HTAnchor_document(parent) == NULL) { /* If not already loaded */ + if (HTAnchor_document(parent) == NULL) { /* If not alread loaded */ /* TBL 921202 */ BOOL result; char * address = HTAnchor_address((HTAnchor*) parent); @@ -1220,16 +1258,16 @@ PUBLIC BOOL HTSearch ARGS2( ** the new address. ** ** On Entry, -** *keywords space-separated keyword list or similar search list -** *indexname is name of object search is to be done on. +** *keywords space-separated keyword list or similar search list +** *addres is name of object search is to be done on. */ PUBLIC BOOL HTSearchAbsolute ARGS2( CONST char *, keywords, - char *, indexname) + CONST char *, indexname) { DocAddress abs_doc; HTParentAnchor * anchor; - abs_doc.address = indexname; + abs_doc.address = (char *)indexname; abs_doc.post_data = NULL; abs_doc.post_content_type = NULL; abs_doc.bookmark = NULL; @@ -1247,7 +1285,7 @@ PUBLIC BOOL HTSearchAbsolute ARGS2( ** As it involves file access, this should only be done once ** when the program first runs. ** This is a default algorithm -- browser don't HAVE to use this. -** But consistency between browsers is STRONGLY recommended! +** But consistency betwen browsers is STRONGLY recommended! ** ** Priority order is: ** 1 WWW_HOME environment variable (logical name, etc) @@ -1305,7 +1343,9 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS if (fp) { fclose(fp); } else { - CTRACE(tfp, "HTBrowse: No local home document ~/%s or %s\n", + if (TRACE) + fprintf(stderr, + "HTBrowse: No local home document ~/%s or %s\n", PERSONAL_DEFAULT, LOCAL_DEFAULT_FILE); FREE(my_home_document); } @@ -1317,7 +1357,9 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS "file:", PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION); if (my_home_document) { - CTRACE(tfp, "HTAccess: Using custom home page %s i.e. address %s\n", + if (TRACE) + fprintf(stderr, + "HTAccess: Using custom home page %s i.e. address %s\n", my_home_document, ref); FREE(my_home_document); } diff --git a/WWW/Library/Implementation/HTAccess.h b/WWW/Library/Implementation/HTAccess.h index 32d8e562..1954e6de 100644 --- a/WWW/Library/Implementation/HTAccess.h +++ b/WWW/Library/Implementation/HTAccess.h @@ -15,6 +15,10 @@ extern char * use_this_url_instead; /* Definition uses: */ +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ +#include <tcp.h> #include <HTAnchor.h> #include <HTFormat.h> @@ -259,7 +263,7 @@ Search Given Indexname */ extern BOOL HTSearchAbsolute PARAMS(( CONST char * keywords, - char * indexname)); + CONST char * indexname)); /* diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c index ec332eb3..9c8b10cd 100644 --- a/WWW/Library/Implementation/HTAnchor.c +++ b/WWW/Library/Implementation/HTAnchor.c @@ -7,7 +7,7 @@ ** History ** ** Nov 1990 Written in Objective-C for the NeXT browser (TBL) -** 24-Oct-1991 (JFG), written in C, browser-independent +** 24-Oct-1991 (JFG), written in C, browser-independant ** 21-Nov-1991 (JFG), first complete version ** ** (c) Copyright CERN 1991 - See Copyright.html @@ -16,6 +16,8 @@ #define HASH_SIZE 101 /* Arbitrary prime. Memory/speed tradeoff */ #include <HTUtils.h> +#include <tcp.h> +#include <ctype.h> #include <HTAnchor.h> #include <HTParse.h> #include <UCAux.h> @@ -24,6 +26,8 @@ #include <LYCharSets.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + #ifdef NOT_DEFINED /* * This is the hashing function used to determine which list in the @@ -40,12 +44,12 @@ PRIVATE int HASH_FUNCTION ARGS1( CONST char *, cp_address) { int hash; - CONST unsigned char *p; + unsigned char *p; - for (p = (CONST unsigned char *)cp_address, hash = 0; *p; p++) - hash = (int) (hash * 3 + (*(CONST unsigned char *)p)) % HASH_SIZE; + for (p = (unsigned char *)cp_address, hash = 0; *p; p++) + hash = (int) (hash * 3 + (*(unsigned char *)p)) % HASH_SIZE; - return(hash); + return hash; } typedef struct _HyperDoc Hyperdoc; @@ -80,7 +84,7 @@ PRIVATE HTParentAnchor * HTParentAnchor_new NOARGS newAnchor->no_cache = FALSE; /* no-cache? - FM */ newAnchor->content_type = NULL; /* Content-Type. - FM */ newAnchor->content_language = NULL; /* Content-Language. - FM */ - newAnchor->content_encoding = NULL; /* Compression algorithm. - FM */ + newAnchor->content_encoding = NULL; /* Compression algorith. - FM */ newAnchor->content_base = NULL; /* Content-Base. - FM */ newAnchor->content_disposition = NULL; /* Content-Disposition. - FM */ newAnchor->content_location = NULL; /* Content-Location. - FM */ @@ -90,7 +94,7 @@ PRIVATE HTParentAnchor * HTParentAnchor_new NOARGS newAnchor->expires = NULL; /* Expires. - FM */ newAnchor->last_modified = NULL; /* Last-Modified. - FM */ newAnchor->server = NULL; /* Server. - FM */ - return(newAnchor); + return newAnchor; } PRIVATE HTChildAnchor * HTChildAnchor_new NOARGS @@ -116,12 +120,12 @@ PRIVATE BOOL HTEquivalent ARGS2( if (s && t) { /* Make sure they point to something */ for (; *s && *t; s++, t++) { if (TOUPPER(*s) != TOUPPER(*t)) { - return(NO); + return NO; } } - return( TOUPPER(*s) == TOUPPER(*t)); + return TOUPPER(*s) == TOUPPER(*t); } else { - return(s == t); /* Two NULLs are equivalent, aren't they ? */ + return s == t; /* Two NULLs are equivalent, aren't they ? */ } } @@ -143,12 +147,12 @@ PRIVATE BOOL HTIdentical ARGS2( if (s && t) { /* Make sure they point to something */ for (; *s && *t; s++, t++) { if (*s != *t) { - return(NO); + return NO; } } - return(*s == *t); + return *s == *t; } else { - return(s == t); /* Two NULLs are identical, aren't they ? */ + return s == t; /* Two NULLs are identical, aren't they ? */ } } #endif /* CASE_INSENSITIVE_ANCHORS */ @@ -168,8 +172,9 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2( HTList *kids; if (!parent) { - CTRACE(tfp, "HTAnchor_findChild called with NULL parent.\n"); - return(NULL); + if (TRACE) + fprintf(stderr, "HTAnchor_findChild called with NULL parent.\n"); + return NULL; } if ((kids = parent->children) != 0) { /* @@ -178,14 +183,15 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2( if (tag && *tag) { /* TBL */ while (NULL != (child=(HTChildAnchor *)HTList_nextObject(kids))) { #ifdef CASE_INSENSITIVE_ANCHORS - if (HTEquivalent(child->tag, tag)) /* Case insensitive */ + if (HTEquivalent(child->tag, tag)) { /* Case insensitive */ #else - if (HTIdentical(child->tag, tag)) /* Case sensitive - FM */ + if (HTIdentical(child->tag, tag)) { /* Case sensitive - FM */ #endif /* CASE_INSENSITIVE_ANCHORS */ - { - CTRACE(tfp, "Child anchor %p of parent %p with name `%s' already exists.\n", + if (TRACE) + fprintf(stderr, + "Child anchor %p of parent %p with name `%s' already exists.\n", (void *)child, (void *)parent, tag); - return(child); + return child; } } } /* end if tag is void */ @@ -194,14 +200,16 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2( } child = HTChildAnchor_new(); - CTRACE(tfp, "new Anchor %p named `%s' is child of %p\n", + if (TRACE) + fprintf(stderr, + "new Anchor %p named `%s' is child of %p\n", (void *)child, tag ? tag : (CONST char *)"", (void *)parent); /* int for apollo */ HTList_addObject (parent->children, child); child->parent = parent; StrAllocCopy(child->tag, tag); - return(child); + return child; } @@ -220,7 +228,8 @@ PUBLIC HTChildAnchor * HTAnchor_findChildAndLink ARGS4( { HTChildAnchor * child = HTAnchor_findChild(parent, tag); - CTRACE(tfp,"Entered HTAnchor_findChildAndLink\n"); + if (TRACE) + fprintf(stderr,"Entered HTAnchor_findChildAndLink\n"); if (href && *href) { char *relative_to = HTAnchor_address((HTAnchor *)parent); @@ -249,7 +258,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChildAndLink ARGS4( FREE(parsed_doc.address); FREE(relative_to); } - return(child); + return child; } /* @@ -297,7 +306,8 @@ PUBLIC HTAnchor * HTAnchor_findAddress ARGS1( /* Anchor tag specified ? */ char *tag = HTParse(newdoc->address, "", PARSE_ANCHOR); - CTRACE(tfp,"Entered HTAnchor_findAddress\n"); + if (TRACE) + fprintf(stderr,"Entered HTAnchor_findAddress\n"); /* ** If the address represents a sub-anchor, we recursively load its @@ -361,7 +371,9 @@ PUBLIC HTAnchor * HTAnchor_findAddress ARGS1( foundAnchor->isHEAD == newdoc->isHEAD) #endif /* CASE_INSENSITIVE_ANCHORS */ { - CTRACE(tfp, "Anchor %p with address `%s' already exists.\n", + if (TRACE) + fprintf(stderr, + "Anchor %p with address `%s' already exists.\n", (void *)foundAnchor, newdoc->address); return (HTAnchor *)foundAnchor; } @@ -371,7 +383,9 @@ PUBLIC HTAnchor * HTAnchor_findAddress ARGS1( ** Node not found: create new anchor. */ foundAnchor = HTParentAnchor_new(); - CTRACE(tfp, "New anchor %p has hash %d and address `%s'\n", + if (TRACE) + fprintf(stderr, + "New anchor %p has hash %d and address `%s'\n", (void *)foundAnchor, hash, newdoc->address); StrAllocCopy(foundAnchor->address, newdoc->address); if (newdoc->post_data) @@ -717,7 +731,7 @@ PUBLIC void HTAnchor_makeLastChild ARGS1( PUBLIC HTParentAnchor * HTAnchor_parent ARGS1( HTAnchor *, me) { - return( me ? me->parent : NULL); + return me ? me->parent : NULL; } PUBLIC void HTAnchor_setDocument ARGS2( @@ -731,7 +745,7 @@ PUBLIC void HTAnchor_setDocument ARGS2( PUBLIC HyperDoc * HTAnchor_document ARGS1( HTParentAnchor *, me) { - return( me ? me->document : NULL); + return me ? me->document : NULL; } @@ -764,7 +778,7 @@ PUBLIC char * HTAnchor_address ARGS1( me->parent->address, ((HTChildAnchor *)me)->tag); } } - return(addr); + return addr; } PUBLIC void HTAnchor_setFormat ARGS2( @@ -778,7 +792,7 @@ PUBLIC void HTAnchor_setFormat ARGS2( PUBLIC HTFormat HTAnchor_format ARGS1( HTParentAnchor *, me) { - return( me ? me->format : NULL); + return me ? me->format : NULL; } PUBLIC void HTAnchor_setIndex ARGS2( @@ -803,7 +817,7 @@ PUBLIC void HTAnchor_setPrompt ARGS2( PUBLIC BOOL HTAnchor_isIndex ARGS1( HTParentAnchor *, me) { - return( me ? me->isIndex : NO); + return me ? me->isIndex : NO; } /* Whether Anchor has been designated as an ISMAP link @@ -812,13 +826,13 @@ PUBLIC BOOL HTAnchor_isIndex ARGS1( PUBLIC BOOL HTAnchor_isISMAPScript ARGS1( HTAnchor *, me) { - return( me ? me->parent->isISMAPScript : NO); + return me ? me->parent->isISMAPScript : NO; } PUBLIC BOOL HTAnchor_hasChildren ARGS1( HTParentAnchor *, me) { - return( me ? ! HTList_isEmpty(me->children) : NO); + return me ? ! HTList_isEmpty(me->children) : NO; } #if defined(USE_HASH) @@ -827,7 +841,7 @@ PUBLIC BOOL HTAnchor_hasChildren ARGS1( PUBLIC CONST char * HTAnchor_style ARGS1( HTParentAnchor *, me) { - return( me ? me->style : NULL); + return me ? me->style : NULL; } PUBLIC void HTAnchor_setStyle ARGS2( @@ -846,7 +860,7 @@ PUBLIC void HTAnchor_setStyle ARGS2( PUBLIC CONST char * HTAnchor_title ARGS1( HTParentAnchor *, me) { - return( me ? me->title : NULL); + return me ? me->title : NULL; } PUBLIC void HTAnchor_setTitle ARGS2( @@ -888,7 +902,7 @@ PUBLIC void HTAnchor_appendTitle ARGS2( PUBLIC CONST char * HTAnchor_bookmark ARGS1( HTParentAnchor *, me) { - return( me ? me->bookmark : NULL); + return me ? me->bookmark : NULL; } PUBLIC void HTAnchor_setBookmark ARGS2( @@ -904,7 +918,7 @@ PUBLIC void HTAnchor_setBookmark ARGS2( PUBLIC CONST char * HTAnchor_owner ARGS1( HTParentAnchor *, me) { - return( me ? me->owner : NULL); + return (me ? me->owner : NULL); } PUBLIC void HTAnchor_setOwner ARGS2( @@ -921,7 +935,7 @@ PUBLIC void HTAnchor_setOwner ARGS2( PUBLIC CONST char * HTAnchor_RevTitle ARGS1( HTParentAnchor *, me) { - return( me ? me->RevTitle : NULL); + return (me ? me->RevTitle : NULL); } PUBLIC void HTAnchor_setRevTitle ARGS2( @@ -948,7 +962,7 @@ PUBLIC void HTAnchor_setRevTitle ARGS2( PUBLIC CONST char * HTAnchor_SugFname ARGS1( HTParentAnchor *, me) { - return( me ? me->SugFname : NULL); + return me ? me->SugFname : NULL; } /* Content-Encoding handling. - FM @@ -958,7 +972,7 @@ PUBLIC CONST char * HTAnchor_SugFname ARGS1( PUBLIC CONST char * HTAnchor_content_encoding ARGS1( HTParentAnchor *, me) { - return( me ? me->content_encoding : NULL); + return me ? me->content_encoding : NULL; } /* Content-Type handling. - FM @@ -966,7 +980,7 @@ PUBLIC CONST char * HTAnchor_content_encoding ARGS1( PUBLIC CONST char * HTAnchor_content_type ARGS1( HTParentAnchor *, me) { - return( me ? me->content_type : NULL); + return me ? me->content_type : NULL; } /* Last-Modified header handling. - FM @@ -974,7 +988,7 @@ PUBLIC CONST char * HTAnchor_content_type ARGS1( PUBLIC CONST char * HTAnchor_last_modified ARGS1( HTParentAnchor *, me) { - return( me ? me->last_modified : NULL); + return me ? me->last_modified : NULL; } /* Date header handling. - FM @@ -982,7 +996,7 @@ PUBLIC CONST char * HTAnchor_last_modified ARGS1( PUBLIC CONST char * HTAnchor_date ARGS1( HTParentAnchor *, me) { - return( me ? me->date : NULL); + return me ? me->date : NULL; } /* Server header handling. - FM @@ -990,7 +1004,7 @@ PUBLIC CONST char * HTAnchor_date ARGS1( PUBLIC CONST char * HTAnchor_server ARGS1( HTParentAnchor *, me) { - return( me ? me->server : NULL); + return me ? me->server : NULL; } /* Safe header handling. - FM @@ -998,7 +1012,7 @@ PUBLIC CONST char * HTAnchor_server ARGS1( PUBLIC BOOL HTAnchor_safe ARGS1( HTParentAnchor *, me) { - return( me ? me->safe : FALSE); + return me ? me->safe : FALSE; } /* Content-Base header handling. - FM @@ -1006,7 +1020,7 @@ PUBLIC BOOL HTAnchor_safe ARGS1( PUBLIC CONST char * HTAnchor_content_base ARGS1( HTParentAnchor *, me) { - return( me ? me->content_base : NULL); + return me ? me->content_base : NULL; } /* Content-Location header handling. - FM @@ -1014,7 +1028,7 @@ PUBLIC CONST char * HTAnchor_content_base ARGS1( PUBLIC CONST char * HTAnchor_content_location ARGS1( HTParentAnchor *, me) { - return( me ? me->content_location : NULL); + return me ? me->content_location : NULL; } /* Link me Anchor to another given one @@ -1026,8 +1040,10 @@ PUBLIC BOOL HTAnchor_link ARGS3( HTLinkType *, type) { if (!(source && destination)) - return(NO); /* Can't link to/from non-existing anchor */ - CTRACE(tfp, "Linking anchor %p to anchor %p\n", source, destination); + return NO; /* Can't link to/from non-existing anchor */ + if (TRACE) + fprintf(stderr, + "Linking anchor %p to anchor %p\n", source, destination); if (!source->mainLink.dest) { source->mainLink.dest = destination; source->mainLink.type = type; @@ -1044,7 +1060,7 @@ PUBLIC BOOL HTAnchor_link ARGS3( if (!destination->parent->sources) destination->parent->sources = HTList_new(); HTList_addObject (destination->parent->sources, source); - return(YES); /* Success */ + return YES; /* Success */ } @@ -1054,7 +1070,7 @@ PUBLIC BOOL HTAnchor_link ARGS3( PUBLIC HTAnchor * HTAnchor_followMainLink ARGS1( HTAnchor *, me) { - return( me->mainLink.dest); + return me->mainLink.dest; } PUBLIC HTAnchor * HTAnchor_followTypedLink ARGS2( @@ -1062,17 +1078,17 @@ PUBLIC HTAnchor * HTAnchor_followTypedLink ARGS2( HTLinkType *, type) { if (me->mainLink.type == type) - return( me->mainLink.dest); + return me->mainLink.dest; if (me->links) { HTList *links = me->links; HTLink *the_link; while (NULL != (the_link=(HTLink *)HTList_nextObject(links))) { if (the_link->type == type) { - return( the_link->dest); + return the_link->dest; } } } - return(NULL); /* No link of me type */ + return NULL; /* No link of me type */ } @@ -1084,7 +1100,7 @@ PUBLIC BOOL HTAnchor_makeMainLink ARGS2( { /* Check that everything's OK */ if (!(me && HTList_removeObject (me->links, movingLink))) { - return(NO); /* link not found or NULL anchor */ + return NO; /* link not found or NULL anchor */ } else { /* First push current main link onto top of links list */ HTLink *newLink = (HTLink *)calloc (1, sizeof (HTLink)); @@ -1098,7 +1114,7 @@ PUBLIC BOOL HTAnchor_makeMainLink ARGS2( memcpy((void *)&me->mainLink, (CONST void *)movingLink, sizeof (HTLink)); FREE(movingLink); - return(YES); + return YES; } } @@ -1112,7 +1128,7 @@ PUBLIC HTList * HTAnchor_methods ARGS1( if (!me->methods) { me->methods = HTList_new(); } - return( me->methods); + return me->methods; } /* Protocol @@ -1121,7 +1137,7 @@ PUBLIC HTList * HTAnchor_methods ARGS1( PUBLIC void * HTAnchor_protocol ARGS1( HTParentAnchor *, me) { - return( me->protocol); + return me->protocol; } PUBLIC void HTAnchor_setProtocol ARGS2( @@ -1137,7 +1153,7 @@ PUBLIC void HTAnchor_setProtocol ARGS2( PUBLIC char * HTAnchor_physical ARGS1( HTParentAnchor *, me) { - return( me->physical); + return me->physical; } PUBLIC void HTAnchor_setPhysical ARGS2( @@ -1179,7 +1195,7 @@ PUBLIC LYUCcharset * HTAnchor_getUCInfoStage ARGS2( { if (me && !me->UCStages) { int i; - int chndl = UCLYhndl_for_unspec; /* always >= 0 */ + int chndl = UCLYhndl_for_unspec; UCAnchorInfo * stages = (UCAnchorInfo*)calloc(1, sizeof(UCAnchorInfo)); if (stages == NULL) @@ -1190,25 +1206,28 @@ PUBLIC LYUCcharset * HTAnchor_getUCInfoStage ARGS2( } if (me->charset) { chndl = UCGetLYhndl_byMIME(me->charset); - if (chndl < 0) + if (chndl < 0) { chndl = UCLYhndl_for_unrec; - if (chndl < 0) - /* - ** UCLYhndl_for_unrec not defined :-( - ** fallback to UCLYhndl_for_unspec which always valid. - */ - chndl = UCLYhndl_for_unspec; /* always >= 0 */ + } + } + if (chndl >= 0) { + memcpy(&stages->s[UCT_STAGE_MIME].C, &LYCharSet_UC[chndl], + sizeof(LYUCcharset)); + stages->s[UCT_STAGE_MIME].lock = UCT_SETBY_DEFAULT; + } else { + /* + * Should not happen... + */ + stages->s[UCT_STAGE_MIME].C.UChndl = -1; + stages->s[UCT_STAGE_MIME].lock = UCT_SETBY_NONE; } - memcpy(&stages->s[UCT_STAGE_MIME].C, &LYCharSet_UC[chndl], - sizeof(LYUCcharset)); - stages->s[UCT_STAGE_MIME].lock = UCT_SETBY_DEFAULT; stages->s[UCT_STAGE_MIME].LYhndl = chndl; me->UCStages = stages; } if (me) { - return( &me->UCStages->s[which_stage].C); + return &me->UCStages->s[which_stage].C; } - return(NULL); + return NULL; } PUBLIC int HTAnchor_getUCLYhndl ARGS2( @@ -1223,10 +1242,10 @@ PUBLIC int HTAnchor_getUCLYhndl ARGS2( (void) HTAnchor_getUCInfoStage(me, which_stage); } if (me->UCStages->s[which_stage].lock > UCT_SETBY_NONE) { - return( me->UCStages->s[which_stage].LYhndl); + return me->UCStages->s[which_stage].LYhndl; } } - return( -1); + return -1; } PUBLIC LYUCcharset * HTAnchor_setUCInfoStage ARGS4( @@ -1252,10 +1271,10 @@ PUBLIC LYUCcharset * HTAnchor_setUCInfoStage ARGS4( else { p->UChndl = -1; } - return(p); + return p; } } - return(NULL); + return NULL; } PUBLIC LYUCcharset * HTAnchor_resetUCInfoStage ARGS4( @@ -1265,10 +1284,10 @@ PUBLIC LYUCcharset * HTAnchor_resetUCInfoStage ARGS4( int, set_by) { if (!me || !me->UCStages) - return(NULL); + return NULL; me->UCStages->s[which_stage].lock = set_by; me->UCStages->s[which_stage].LYhndl = LYhndl; - return( &me->UCStages->s[which_stage].C); + return &me->UCStages->s[which_stage].C; } /* @@ -1299,8 +1318,8 @@ PUBLIC LYUCcharset * HTAnchor_copyUCInfoStage ARGS4( me->UCStages->s[from_stage].LYhndl; if (p_to != p_from) memcpy(p_to, p_from, sizeof(LYUCcharset)); - return(p_to); + return p_to; } } - return(NULL); + return NULL; } diff --git a/WWW/Library/Implementation/HTAssoc.c b/WWW/Library/Implementation/HTAssoc.c index f5dcbf11..0736a269 100644 --- a/WWW/Library/Implementation/HTAssoc.c +++ b/WWW/Library/Implementation/HTAssoc.c @@ -16,8 +16,11 @@ ** */ + #include <HTUtils.h> +#include <string.h> + #include <HTAAUtil.h> #include <HTAssoc.h> #include <HTString.h> @@ -63,8 +66,8 @@ PUBLIC void HTAssocList_add ARGS3(HTAssocList *, alist, if (value) StrAllocCopy(assoc->value, value); HTList_addObject(alist, (void*)assoc); - } else { - CTRACE(tfp, "HTAssoc_add: ERROR: assoc list NULL!!\n"); + } else if (TRACE) { + fprintf(stderr, "HTAssoc_add: ERROR: assoc list NULL!!\n"); } } diff --git a/WWW/Library/Implementation/HTAssoc.h b/WWW/Library/Implementation/HTAssoc.h index 93183302..79cbe557 100644 --- a/WWW/Library/Implementation/HTAssoc.h +++ b/WWW/Library/Implementation/HTAssoc.h @@ -7,8 +7,12 @@ #ifndef HTASSOC_H #define HTASSOC_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTList.h> + #ifdef SHORT_NAMES #define HTAL_new HTAssocList_new #define HTAL_del HTAssocList_delete diff --git a/WWW/Library/Implementation/HTAtom.c b/WWW/Library/Implementation/HTAtom.c index e4af2962..e5aee433 100644 --- a/WWW/Library/Implementation/HTAtom.c +++ b/WWW/Library/Implementation/HTAtom.c @@ -12,17 +12,21 @@ ** (c) Copyright CERN 1991 - See Copyright.html ** */ - #include <HTUtils.h> #define HASH_SIZE 101 /* Tunable */ #include <HTAtom.h> +/*#include <stdio.h> included by HTUtils.h -- FM *//* joe@athena, TBL 921019 */ +#include <string.h> + #include <HTList.h> #include <LYexit.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + PRIVATE HTAtom * hash_table[HASH_SIZE]; PRIVATE BOOL initialised = NO; @@ -40,7 +44,7 @@ PUBLIC HTAtom * HTAtom_for ARGS1(CONST char *, string) { int hash; HTAtom * a; - + /* First time around, clear hash table */ /* @@ -54,20 +58,21 @@ PUBLIC HTAtom * HTAtom_for ARGS1(CONST char *, string) initialised = YES; atexit(free_atoms); } - + /* Generate hash function */ hash = HASH_FUNCTION(string); - + /* Search for the string in the list */ for (a = hash_table[hash]; a; a = a->next) { if (0 == strcasecomp(a->name, string)) { - /* CTRACE(tfp, "HTAtom: Old atom %p for `%s'\n", a, string); */ + /* if (TRACE) fprintf(stderr, + "HTAtom: Old atom %p for `%s'\n", a, string); */ return a; /* Found: return it */ } } - + /* Generate a new entry */ a = (HTAtom *)malloc(sizeof(*a)); @@ -80,7 +85,8 @@ PUBLIC HTAtom * HTAtom_for ARGS1(CONST char *, string) a->next = hash_table[hash]; /* Put onto the head of list */ hash_table[hash] = a; #ifdef NOT_DEFINED - CTRACE(tfp, "HTAtom: New atom %p for `%s'\n", a, string); + if (TRACE) + fprintf(stderr, "HTAtom: New atom %p for `%s'\n", a, string); #endif /* NOT_DEFINED */ return a; } @@ -141,7 +147,7 @@ PRIVATE BOOL mime_match ARGS2(CONST char *, name, } return NO; } - + PUBLIC HTList *HTAtom_templateMatches ARGS1(CONST char *, templ) { diff --git a/WWW/Library/Implementation/HTAtom.h b/WWW/Library/Implementation/HTAtom.h index fda46b86..c3319a3d 100644 --- a/WWW/Library/Implementation/HTAtom.h +++ b/WWW/Library/Implementation/HTAtom.h @@ -21,6 +21,9 @@ #ifndef HTATOM_H #define HTATOM_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTList.h> #ifdef SHORT_NAMES diff --git a/WWW/Library/Implementation/HTAuth.c b/WWW/Library/Implementation/HTAuth.c index f1e7efd5..b8b4d010 100644 --- a/WWW/Library/Implementation/HTAuth.c +++ b/WWW/Library/Implementation/HTAuth.c @@ -14,6 +14,7 @@ */ #include <HTUtils.h> +#include <string.h> #include <HTPasswd.h> /* Password file routines */ #include <HTAssoc.h> #include <HTAuth.h> /* Implemented here */ @@ -98,7 +99,8 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring, */ username = cleartext; if (!(password = strchr(cleartext, ':'))) { - CTRACE(tfp, "%s %s\n", + if (TRACE) + fprintf(stderr, "%s %s\n", "decompose_auth_string: password field", "missing in authentication string.\n"); return NULL; @@ -114,9 +116,9 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring, (*(timestamp++) ='\0'), !(browsers_key=strchr(timestamp,':')) || (*(browsers_key++)='\0')) { - CTRACE(tfp, "%s %s\n", - "decompose_auth_string: Pubkey scheme", - "fields missing in authentication string"); + if (TRACE) fprintf(stderr, "%s %s\n", + "decompose_auth_string: Pubkey scheme", + "fields missing in authentication string"); return NULL; } } @@ -130,12 +132,13 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring, user->timestamp = timestamp; user->secret_key = browsers_key; - if (scheme == HTAA_BASIC) { - CTRACE(tfp, "decompose_auth_string: %s (%s,%s)\n", + if (TRACE) { + if (scheme==HTAA_BASIC) + fprintf(stderr, "decompose_auth_string: %s (%s,%s)\n", "Basic scheme authentication string:", username, password); - } else { - CTRACE(tfp, "decompose_auth_string: %s (%s,%s,%s,%s,%s)\n", + else + fprintf(stderr, "decompose_auth_string: %s (%s,%s,%s,%s,%s)\n", "Pubkey scheme authentication string:", username, password, i_net_adr, timestamp, browsers_key); } @@ -145,13 +148,13 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring, -PRIVATE BOOL HTAA_checkTimeStamp ARGS1(CONST char *, timestamp GCC_UNUSED) +PRIVATE BOOL HTAA_checkTimeStamp ARGS1(CONST char *, timestamp) { return NO; /* This is just a stub */ } -PRIVATE BOOL HTAA_checkInetAddress ARGS1(CONST char *, i_net_adr GCC_UNUSED) +PRIVATE BOOL HTAA_checkInetAddress ARGS1(CONST char *, i_net_adr) { return NO; /* This is just a stub */ } @@ -198,6 +201,7 @@ PUBLIC HTAAUser *HTAA_authenticate ARGS3(HTAAScheme, scheme, else return NULL; } + break; default: /* Other authentication routines go here */ return NULL; diff --git a/WWW/Library/Implementation/HTAuth.h b/WWW/Library/Implementation/HTAuth.h index 0e88131c..f81eb1eb 100644 --- a/WWW/Library/Implementation/HTAuth.h +++ b/WWW/Library/Implementation/HTAuth.h @@ -8,6 +8,9 @@ #ifndef HTAUTH_H #define HTAUTH_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTAAUtil.h> #include <HTAAProt.h> diff --git a/WWW/Library/Implementation/HTBTree.c b/WWW/Library/Implementation/HTBTree.c index c545eb0e..986dfc8b 100644 --- a/WWW/Library/Implementation/HTBTree.c +++ b/WWW/Library/Implementation/HTBTree.c @@ -12,14 +12,18 @@ #ifndef __STRICT_BSD__ #include <stdlib.h> #endif +#include <string.h> #define MAXIMUM(a,b) ((a)>(b)?(a):(b)) #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + + PUBLIC HTBTree * HTBTree_new ARGS1(HTComparer, comp) /********************************************************* - ** This function returns an HTBTree with memory allocated + ** This function returns an HTBTree with memory allocated ** for it when given a mean to compare things */ { @@ -69,7 +73,7 @@ PRIVATE void HTBTElementAndObject_free ARGS1(HTBTElement*, element) if (element) { /* Just in case nothing was in the tree anyway */ if (element->left != NULL) HTBTElementAndObject_free(element->left); - if (element->right != NULL) + if (element->right != NULL) HTBTElementAndObject_free(element->right); FREE(element->object); FREE(element); @@ -106,12 +110,12 @@ PUBLIC void HTBTree_add ARGS2( int depth,depth2,corrections; /* father_of_element is a pointer to the structure that is the father of the ** new object "object". - ** added_element is a pointer to the structure that contains or will contain + ** added_element is a pointer to the structure that contains or will contain ** the new object "object". ** father_of_forefather and forefather_of_element are pointers that are used ** to modify the depths of upper elements, when needed. ** - ** father_found indicates by a value NO when the future father of "object" + ** father_found indicates by a value NO when the future father of "object" ** is found. ** top_found indicates by a value NO when, in case of a difference of depths ** < 2, the top of the tree is encountered and forbids any further try to @@ -142,24 +146,24 @@ PUBLIC void HTBTree_add ARGS2( tree->top->right_depth = 0; } else - { + { father_found = YES; father_of_element = tree->top; added_element = NULL; father_of_forefather = NULL; - forefather_of_element = NULL; + forefather_of_element = NULL; while (father_found) { if (tree->compare(object,father_of_element->object)<0) { if (father_of_element->left != NULL) father_of_element = father_of_element->left; - else + else { father_found = NO; - father_of_element->left = + father_of_element->left = (HTBTElement *)malloc(sizeof(HTBTElement)); - if (father_of_element->left==NULL) + if (father_of_element->left==NULL) outofmem(__FILE__, "HTBTree_add"); added_element = father_of_element->left; added_element->up = father_of_element; @@ -172,14 +176,14 @@ PUBLIC void HTBTree_add ARGS2( } if (tree->compare(object,father_of_element->object)>=0) { - if (father_of_element->right != NULL) + if (father_of_element->right != NULL) father_of_element = father_of_element->right; - else - { + else + { father_found = NO; - father_of_element->right = + father_of_element->right = (HTBTElement *)malloc(sizeof(HTBTElement)); - if (father_of_element->right==NULL) + if (father_of_element->right==NULL) outofmem(__FILE__, "HTBTree_add"); added_element = father_of_element->right; added_element->up = father_of_element; @@ -187,7 +191,7 @@ PUBLIC void HTBTree_add ARGS2( added_element->left = NULL; added_element->left_depth = 0; added_element->right = NULL; - added_element->right_depth = 0; + added_element->right_depth = 0; } } } @@ -201,7 +205,7 @@ PUBLIC void HTBTree_add ARGS2( if (father_of_forefather->left == forefather_of_element) { depth = father_of_forefather->left_depth; - father_of_forefather->left_depth = 1 + father_of_forefather->left_depth = 1 + MAXIMUM(forefather_of_element->right_depth, forefather_of_element->left_depth); depth2 = father_of_forefather->left_depth; @@ -217,7 +221,7 @@ PUBLIC void HTBTree_add ARGS2( forefather_of_element = father_of_forefather; father_of_forefather = father_of_forefather->up; } while ((depth != depth2) && (father_of_forefather != NULL)); - + /* @@ -230,7 +234,7 @@ PUBLIC void HTBTree_add ARGS2( if ((abs(father_of_element->left_depth - father_of_element->right_depth)) < 2) { - if (father_of_element->up != NULL) + if (father_of_element->up != NULL) father_of_element = father_of_element->up; else top_found = NO; } @@ -238,8 +242,8 @@ PUBLIC void HTBTree_add ARGS2( { /* We start the process of balancing */ corrections = corrections + 1; - /* - ** corrections is an integer used to avoid infinite + /* + ** corrections is an integer used to avoid infinite ** loops in cases such as: ** ** 3 3 @@ -247,22 +251,22 @@ PUBLIC void HTBTree_add ARGS2( ** 5 5 ** ** 3 is used to show that it need not be the top of the tree - ** But let's avoid these two exceptions anyhow + ** But let's avoid these two exceptions anyhow ** with the two following conditions (4 March 94 - AS) */ - if ((father_of_element->left == NULL) - && (father_of_element->right->right == NULL) - && (father_of_element->right->left->left == NULL) - && (father_of_element->right->left->right == NULL)) + if ((father_of_element->left == NULL) + && (father_of_element->right->right == NULL) + && (father_of_element->right->left->left == NULL) + && (father_of_element->right->left->right == NULL)) corrections = 7; - if ((father_of_element->right == NULL) - && (father_of_element->left->left == NULL) - && (father_of_element->left->right->right == NULL) + if ((father_of_element->right == NULL) + && (father_of_element->left->left == NULL) + && (father_of_element->left->right->right == NULL) && (father_of_element->left->right->left == NULL)) corrections = 7; - + if (father_of_element->left_depth > father_of_element->right_depth) { @@ -279,7 +283,7 @@ PUBLIC void HTBTree_add ARGS2( father_of_forefather = father_of_element->up; forefather_of_element = added_element; first_time = YES; - do + do { if (father_of_forefather->left == forefather_of_element->up) @@ -308,7 +312,7 @@ PUBLIC void HTBTree_add ARGS2( + MAXIMUM(forefather_of_element->left_depth, forefather_of_element->right_depth); first_time = NO; - } + } else father_of_forefather->right_depth = 1 + MAXIMUM(forefather_of_element->up->left_depth, @@ -317,7 +321,7 @@ PUBLIC void HTBTree_add ARGS2( } forefather_of_element = forefather_of_element->up; father_of_forefather = father_of_forefather->up; - } while ((depth != depth2) && + } while ((depth != depth2) && (father_of_forefather != NULL)); father_of_forefather = father_of_element->up; if (father_of_forefather->left == father_of_element) @@ -330,7 +334,7 @@ PUBLIC void HTBTree_add ARGS2( ** ** 3 is used to show that it may not be the top of the ** tree. - */ + */ father_of_forefather->left = added_element; father_of_element->left = added_element->right; added_element->right = father_of_element; @@ -360,7 +364,7 @@ PUBLIC void HTBTree_add ARGS2( ** When tree 2 3 becomes 4 1 ** 4 5 5 3 ** - ** 1 is used to show that it is the top of the tree + ** 1 is used to show that it is the top of the tree */ added_element->up = NULL; father_of_element->left = added_element->right; @@ -374,7 +378,7 @@ PUBLIC void HTBTree_add ARGS2( { added_element = father_of_element->right; father_of_element->right_depth = added_element->left_depth; - added_element->left_depth = 1 + + added_element->left_depth = 1 + MAXIMUM(father_of_element->right_depth, father_of_element->left_depth); if (father_of_element->up != NULL) @@ -385,9 +389,9 @@ PUBLIC void HTBTree_add ARGS2( father_of_forefather = father_of_element->up; forefather_of_element = added_element; first_time = YES; - do + do { - if (father_of_forefather->left + if (father_of_forefather->left == forefather_of_element->up) { depth = father_of_forefather->left_depth; @@ -422,7 +426,7 @@ PUBLIC void HTBTree_add ARGS2( } father_of_forefather = father_of_forefather->up; forefather_of_element = forefather_of_element->up; - } while ((depth != depth2) && + } while ((depth != depth2) && (father_of_forefather != NULL)); father_of_forefather = father_of_element->up; if (father_of_forefather->left == father_of_element) @@ -492,7 +496,7 @@ PUBLIC HTBTElement * HTBTree_next ARGS2( HTBTElement*, ele) /************************************************************************** ** this function returns a pointer to the leftmost element if ele is NULL, - ** and to the next object to the right otherwise. + ** and to the next object to the right otherways. ** If no elements left, returns a pointer to NULL. */ { @@ -518,7 +522,7 @@ PUBLIC HTBTElement * HTBTree_next ARGS2( else { father_of_forefather = father_of_element->up; - while (father_of_forefather && + while (father_of_forefather && (father_of_forefather->right == father_of_element)) { father_of_element = father_of_forefather; @@ -540,7 +544,7 @@ PUBLIC HTBTElement * HTBTree_next ARGS2( else printf("Pas de Pere\n"); if (father_of_element->left != NULL) printf("Objet du fils gauche = %s\t", - (char *)father_of_element->left->object); + (char *)father_of_element->left->object); else printf("Pas de fils gauche\t"); if (father_of_element->right != NULL) printf("Objet du fils droit = %s\n", @@ -563,7 +567,7 @@ main () { HTBTree * tree; HTBTElement * next_element; - + tree = HTBTree_new((HTComparer)strcasecomp); HTBTree_add(tree,"hypertext"); HTBTree_add(tree,"Addressing"); diff --git a/WWW/Library/Implementation/HTBTree.h b/WWW/Library/Implementation/HTBTree.h index 6facd048..55bfe6ab 100644 --- a/WWW/Library/Implementation/HTBTree.h +++ b/WWW/Library/Implementation/HTBTree.h @@ -9,11 +9,6 @@ part of libWWW */ -#ifndef HTBTREE_H -#define HTBTREE_H 1 - -#include <HTUtils.h> - #ifdef SHORT_NAMES #define HTBTree_new HTBTNew #define HTBTree_free HTBTFree @@ -104,4 +99,6 @@ Find next element in depth-first order */ extern HTBTElement * HTBTree_next PARAMS((HTBTree* tree, HTBTElement * ele)); -#endif /* HTBTREE_H */ +/* + + end */ diff --git a/WWW/Library/Implementation/HTCJK.h b/WWW/Library/Implementation/HTCJK.h index bc2c3aac..c5fa51af 100644 --- a/WWW/Library/Implementation/HTCJK.h +++ b/WWW/Library/Implementation/HTCJK.h @@ -11,8 +11,6 @@ #ifndef HTCJK_H #define HTCJK_H -#include <HTUtils.h> - /* ** STATUS CHANGE CODES */ @@ -98,15 +96,15 @@ extern unsigned char * EUC_TO_JIS PARAMS(( CONST char * toA)); extern unsigned char * TO_EUC PARAMS(( - CONST unsigned char * jis, + unsigned char * jis, unsigned char * euc)); extern void TO_SJIS PARAMS(( - CONST unsigned char * any, + unsigned char * any, unsigned char * sjis)); extern void TO_JIS PARAMS(( - CONST unsigned char * any, + unsigned char * any, unsigned char * jis)); #endif /* HTCJK_H */ diff --git a/WWW/Library/Implementation/HTChunk.c b/WWW/Library/Implementation/HTChunk.c index 7cab693c..db06f64e 100644 --- a/WWW/Library/Implementation/HTChunk.c +++ b/WWW/Library/Implementation/HTChunk.c @@ -5,9 +5,12 @@ #include <HTUtils.h> #include <HTChunk.h> +/*#include <stdio.h> included by HTUtils.h -- FM */ #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* Create a chunk with a certain allocation unit ** -------------- */ diff --git a/WWW/Library/Implementation/HTChunk.h b/WWW/Library/Implementation/HTChunk.h index 2afcdd9d..84c12de7 100644 --- a/WWW/Library/Implementation/HTChunk.h +++ b/WWW/Library/Implementation/HTChunk.h @@ -7,10 +7,6 @@ automatically reallocating them as necessary. */ -#ifndef HTCHUNK_H -#define HTCHUNK_H 1 - -#include <HTUtils.h> #include <UCMap.h> typedef struct { @@ -170,4 +166,6 @@ Append a zero character to a chunk extern void HTChunkTerminate PARAMS((HTChunk * ch)); -#endif /* HTCHUNK_H */ +/* + + end */ diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c index 2004f97b..5e22915b 100644 --- a/WWW/Library/Implementation/HTDOS.c +++ b/WWW/Library/Implementation/HTDOS.c @@ -2,8 +2,9 @@ */ -#include <HTUtils.h> -#include <HTDOS.h> +#include <mem.h> +#include <dos.h> + /* PUBLIC HTDOS_wwwName() ** CONVERTS DOS Name into WWW Name @@ -66,11 +67,10 @@ char * HTDOS_name(char *wwwname) } } - /* Needed to surf the root of a local drive. */ - - if(strlen(cp_url) < 4) cp_url[2] = ':'; +/* if(strlen(cp_url) < 4) cp_url[] = ':'; if(strlen(cp_url) == 3) cp_url[3] = '\\'; - if(strlen(cp_url) == 4) cp_url[4] = '.'; + + if(strlen(cp_url) == 4) cp_url[4] = '.'; */ if((strlen(cp_url) > 2) && (cp_url[1] == '|')) cp_url[1] = ':'; @@ -81,18 +81,14 @@ char * HTDOS_name(char *wwwname) printf("\n\n%s = i%\n\n",cp_url,strlen(cp_url)); sleep(5); #endif - CTRACE(tfp, "HTDOS_name changed `%s' to `%s'\n", - wwwname, cp_url); strcpy(wwwname, cp_url); - return(wwwname); /* return(cp_url); */ + return(wwwname); /* return(cp_url); */ } else { #if 0 printf("\n\n%s = %i\n\n",cp_url+1,strlen(cp_url)); sleep(5); #endif - CTRACE(tfp, "HTDOS_name changed `%s' to `%s'\n", - wwwname, cp_url+1); strcpy(wwwname, cp_url+1); - return(wwwname); /* return(cp_url+1); */ + return(wwwname); /* return(cp_url+1); */ } } diff --git a/WWW/Library/Implementation/HTDOS.h b/WWW/Library/Implementation/HTDOS.h index ff2ba194..d2a2e0be 100644 --- a/WWW/Library/Implementation/HTDOS.h +++ b/WWW/Library/Implementation/HTDOS.h @@ -13,7 +13,7 @@ ** returns WWW file specification ** */ -char * HTDOS_wwwName PARAMS((char * dosname)); +char * HTDOS_wwwName (char * dosname); /* PUBLIC HTDOS_name() @@ -26,7 +26,7 @@ char * HTDOS_wwwName PARAMS((char * dosname)); ** ** Bug: Returns pointer to static -- non-reentrant */ -char * HTDOS_name PARAMS((char * wwwname)); +char * HTDOS_name (char * wwwname); #endif /* HTDOS_H */ diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c index bd5a2ce7..48d0aa36 100644 --- a/WWW/Library/Implementation/HTFTP.c +++ b/WWW/Library/Implementation/HTFTP.c @@ -76,6 +76,7 @@ BUGS: @@@ Limit connection cache size! #endif #include <HTUtils.h> +#include <tcp.h> #include <HTAlert.h> @@ -109,8 +110,6 @@ BUGS: @@@ Limit connection cache size! #define IPPORT_FTP 21 #endif /* !IPORT_FTP */ -#include <LYUtils.h> -#include <LYStrings.h> #include <LYLeaks.h> typedef struct _connection { @@ -139,10 +138,15 @@ struct _HTStructured { /* ... */ }; +#define FREE(x) if (x) {free(x); x = NULL;} + +extern int HTCheckForInterrupt NOPARAMS; + + /* Global Variables ** --------------------- */ -PUBLIC int HTfileSortMethod = FILE_BY_NAME; +PUBLIC BOOLEAN HTfileSortMethod = FILE_BY_NAME; PRIVATE char ThisYear[8]; PRIVATE char LastYear[8]; PRIVATE int TheDate; @@ -260,15 +264,14 @@ PUBLIC char * HTMake_VMS_name ARGS2( strcpy(nodename, ""); /* On same node? Yes if node names match */ if (strncmp(nn, "localhost", 9)) { CONST char *p; - CONST char *q; - for (p = hostname, q = nn; + char *q; + for (p = hostname, q = (char *)nn; *p && *p != '.' && *q && *q != '.'; p++, q++){ if (TOUPPER(*p) != TOUPPER(*q)) { - char *r; strcpy(nodename, nn); - r = strchr(nodename, '.'); /* Mismatch */ - if (r) - *r = '\0'; /* Chop domain */ + q = strchr(nodename, '.'); /* Mismatch */ + if (q) + *q = '\0'; /* Chop domain */ strcat(nodename, "::"); /* Try decnet anyway */ break; } @@ -335,7 +338,7 @@ PRIVATE int close_connection ARGS1( connection * scan; int status = NETCLOSE(con->socket); if (TRACE) { - CTRACE(tfp, "HTFTP: Closing control socket %d\n", con->socket); + fprintf(stderr, "HTFTP: Closing control socket %d\n", con->socket); #ifdef UNIX if (status != 0) perror("HTFTP:close_connection"); @@ -372,7 +375,8 @@ PRIVATE void help_message_cache_add ARGS1( else StrAllocCopy(help_message_buffer, string); - CTRACE(tfp,"Adding message to help cache: %s\n",string); + if (TRACE) + fprintf(stderr,"Adding message to help cache: %s\n",string); } PRIVATE char *help_message_cache_non_empty NOARGS @@ -413,12 +417,14 @@ PRIVATE int response ARGS1( int status; if (!control) { - CTRACE(tfp, "HTFTP: No control connection set up!!\n"); - return -99; + if (TRACE) + fprintf(stderr, "HTFTP: No control connection set up!!\n"); + return -99; } if (cmd) { - CTRACE(tfp, " Tx: %s", cmd); + if (TRACE) + fprintf(stderr, " Tx: %s", cmd); #ifdef NOT_ASCII { char * p; @@ -429,7 +435,9 @@ PRIVATE int response ARGS1( #endif /* NOT_ASCII */ status = NETWRITE(control->socket, cmd, (int)strlen(cmd)); if (status < 0) { - CTRACE(tfp, "HTFTP: Error %d sending command: closing socket %d\n", + if (TRACE) + fprintf(stderr, + "HTFTP: Error %d sending command: closing socket %d\n", status, control->socket); close_connection(control); return status; @@ -444,15 +452,19 @@ PRIVATE int response ARGS1( char continuation; - if (interrupted_in_htgetcharacter) { - CTRACE (tfp, "HTFTP: Interrupted in HTGetCharacter, apparently.\n"); + if (interrupted_in_htgetcharacter) + { + if (TRACE) + fprintf (stderr, + "HTFTP: Interrupted in HTGetCharacter, apparently.\n"); NETCLOSE (control->socket); control->socket = -1; return HT_INTERRUPTED; - } + } *p = '\0'; /* Terminate the string */ - CTRACE(tfp, " Rx: %s", response_text); + if (TRACE) + fprintf(stderr, " Rx: %s", response_text); /* Check for login or help messages */ if (!strncmp(response_text,"230-",4) || @@ -472,15 +484,19 @@ PRIVATE int response ARGS1( break; } /* if end of line */ - if (interrupted_in_htgetcharacter) { - CTRACE (tfp, "HTFTP: Interrupted in HTGetCharacter, apparently.\n"); - NETCLOSE (control->socket); - control->socket = -1; - return HT_INTERRUPTED; - } + if (interrupted_in_htgetcharacter) + { + if (TRACE) + fprintf (stderr, + "HTFTP: Interrupted in HTGetCharacter, apparently.\n"); + NETCLOSE (control->socket); + control->socket = -1; + return HT_INTERRUPTED; + } if (*(p-1) == (char) EOF) { - CTRACE(tfp, "Error on rx: closing socket %d\n", + if (TRACE) + fprintf(stderr, "Error on rx: closing socket %d\n", control->socket); strcpy(response_text, "000 *** TCP read error on response\n"); close_connection(control); @@ -491,7 +507,8 @@ PRIVATE int response ARGS1( } while (continuation_response != -1); if (result == 421) { - CTRACE(tfp, "HTFTP: They close so we close socket %d\n", + if (TRACE) + fprintf(stderr, "HTFTP: They close so we close socket %d\n", control->socket); close_connection(control); return -1; @@ -547,7 +564,8 @@ PRIVATE void get_ftp_pwd ARGS2( if (*ServerType == TCPC_SERVER) { *ServerType = ((response_text[5] == '/') ? NCSA_SERVER : TCPC_SERVER); - CTRACE(tfp, "HTFTP: Treating as %s server.\n", + if (TRACE) + fprintf(stderr, "HTFTP: Treating as %s server.\n", ((*ServerType == NCSA_SERVER) ? "NCSA" : "TCPC")); } else if (response_text[5] == '/') { @@ -556,21 +574,25 @@ PRIVATE void get_ftp_pwd ARGS2( */ if (set_mac_binary(*ServerType)) { *ServerType = NCSA_SERVER; - CTRACE(tfp, "HTFTP: Treating as NCSA server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as NCSA server.\n"); } else { *ServerType = UNIX_SERVER; *UseList = TRUE; - CTRACE(tfp, "HTFTP: Treating as Unix server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as Unix server.\n"); } return; } else if (response_text[strlen(response_text)-1] == ']') { /* path names ending with ] imply VMS, right? */ *ServerType = VMS_SERVER; *UseList = TRUE; - CTRACE(tfp, "HTFTP: Treating as VMS server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as VMS server.\n"); } else { *ServerType = GENERIC_SERVER; - CTRACE(tfp, "HTFTP: Treating as Generic server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as Generic server.\n"); } if ((*ServerType == NCSA_SERVER) || @@ -691,35 +713,42 @@ PRIVATE int get_connection ARGS2( FREE(p1); } /* scope of p1 */ - status = HTDoConnect (arg, "FTP", IPPORT_FTP, (int *)&con->socket); + status = HTDoConnect (arg, "FTP", IPPORT_FTP, (int *)&con->socket); - if (status < 0) { - if (status == HT_INTERRUPTED) { - CTRACE (tfp, "HTFTP: Interrupted on connect\n"); - } else { - CTRACE(tfp, "HTFTP: Unable to connect to remote host for `%s'.\n", - arg); - } - if (status == HT_INTERRUPTED) { - _HTProgress ("Connection interrupted."); - status = HT_NOT_LOADED; - } else { - HTAlert("Unable to connect to FTP host."); + if (status < 0) + { + if (TRACE) + { + if (status == HT_INTERRUPTED) + fprintf (stderr, + "HTFTP: Interrupted on connect\n"); + else + fprintf(stderr, + "HTFTP: Unable to connect to remote host for `%s'.\n", + arg); } - if (con->socket != -1) + if (status == HT_INTERRUPTED) { + _HTProgress ("Connection interrupted."); + status = HT_NOT_LOADED; + } else { + HTAlert("Unable to connect to FTP host."); + } + if (con->socket != -1) { NETCLOSE(con->socket); } - FREE(username); - if (control == con) - control = NULL; - FREE(con); - return status; /* Bad return */ + FREE(username); + if (control == con) + control = NULL; + FREE(con); + return status; /* Bad return */ } - CTRACE(tfp, "FTP connected, socket %d control %ld\n", - con->socket, (long)con); + if (TRACE) { + fprintf(stderr, "FTP connected, socket %d control %ld\n", + con->socket, (long)con); + } control = con; /* Current control connection */ /* Initialise buffering for control connection */ @@ -731,13 +760,16 @@ PRIVATE int get_connection ARGS2( */ status = response((char *)0); /* Get greeting */ - if (status == HT_INTERRUPTED) { - CTRACE (tfp, "HTFTP: Interrupted at beginning of login.\n"); + if (status == HT_INTERRUPTED) + { + if (TRACE) + fprintf (stderr, + "HTFTP: Interrupted at beginning of login.\n"); _HTProgress ("Connection interrupted."); NETCLOSE(control->socket); control->socket = -1; return HT_INTERRUPTED; - } + } server_type = GENERIC_SERVER; /* reset */ if (status == 2) { /* Send username */ char *cp; /* look at greeting text */ @@ -768,13 +800,16 @@ PRIVATE int get_connection ARGS2( } status = response(command); FREE(command); - if (status == HT_INTERRUPTED) { - CTRACE (tfp, "HTFTP: Interrupted while sending username.\n"); + if (status == HT_INTERRUPTED) + { + if (TRACE) + fprintf (stderr, + "HTFTP: Interrupted while sending username.\n"); _HTProgress ("Connection interrupted."); NETCLOSE(control->socket); control->socket = -1; return HT_INTERRUPTED; - } + } } if (status == 3) { /* Send password */ if (password) { @@ -831,14 +866,16 @@ PRIVATE int get_connection ARGS2( } status = response(command); FREE(command); - if (status == HT_INTERRUPTED) { - CTRACE (tfp, + if (status == HT_INTERRUPTED) + { + if (TRACE) + fprintf (stderr, "HTFTP: Interrupted while sending password.\n"); _HTProgress ("Connection interrupted."); NETCLOSE(control->socket); control->socket = -1; return HT_INTERRUPTED; - } + } } FREE(username); @@ -846,21 +883,25 @@ PRIVATE int get_connection ARGS2( char temp[80]; sprintf(temp, "ACCT noaccount%c%c", CR, LF); status = response(temp); - if (status == HT_INTERRUPTED) { - CTRACE (tfp, "HTFTP: Interrupted while sending password.\n"); + if (status == HT_INTERRUPTED) + { + if (TRACE) + fprintf (stderr, + "HTFTP: Interrupted while sending password.\n"); _HTProgress ("Connection interrupted."); NETCLOSE(control->socket); control->socket = -1; return HT_INTERRUPTED; - } + } } if (status != 2) { - CTRACE(tfp, "HTFTP: Login fail: %s", response_text); + if (TRACE) + fprintf(stderr, "HTFTP: Login fail: %s", response_text); /* if (control->socket > 0) close_connection(control->socket); */ return -1; /* Bad return */ } - CTRACE(tfp, "HTFTP: Logged in.\n"); + if (TRACE) fprintf(stderr, "HTFTP: Logged in.\n"); /** Check for host type **/ if (server_type != NETPRESENZ_SERVER) @@ -872,71 +913,88 @@ PRIVATE int get_connection ARGS2( "UNIX Type: L8 MAC-OS MachTen", 28) == 0) { server_type = MACHTEN_SERVER; use_list = TRUE; - CTRACE(tfp, "HTFTP: Treating as MachTen server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as MachTen server.\n"); } else if (strstr(response_text+4, "UNIX") != NULL || strstr(response_text+4, "Unix") != NULL) { server_type = UNIX_SERVER; use_list = TRUE; - CTRACE(tfp, "HTFTP: Treating as Unix server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as Unix server.\n"); } else if (strstr(response_text+4, "MSDOS") != NULL) { server_type = MSDOS_SERVER; use_list = TRUE; - CTRACE(tfp, "HTFTP: Treating as MSDOS (Unix emulation) server.\n"); + if (TRACE) + fprintf(stderr, + "HTFTP: Treating as MSDOS (Unix emulation) server.\n"); } else if (strncmp(response_text+4, "VMS", 3) == 0) { server_type = VMS_SERVER; use_list = TRUE; - CTRACE(tfp, "HTFTP: Treating as VMS server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as VMS server.\n"); } else if ((strncmp(response_text+4, "VM/CMS", 6) == 0) || (strncmp(response_text+4, "VM ", 3) == 0)) { server_type = CMS_SERVER; use_list = TRUE; - CTRACE(tfp, "HTFTP: Treating as CMS server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as CMS server.\n"); } else if (strncmp(response_text+4, "DCTS", 4) == 0) { server_type = DCTS_SERVER; - CTRACE(tfp, "HTFTP: Treating as DCTS server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as DCTS server.\n"); } else if (strstr(response_text+4, "MAC-OS TCP/Connect II") != NULL) { server_type = TCPC_SERVER; - CTRACE(tfp, "HTFTP: Looks like a TCPC server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Looks like a TCPC server.\n"); get_ftp_pwd(&server_type, &use_list); unsure_type = TRUE; } else if (server_type == NETPRESENZ_SERVER) { /* already set above */ use_list = TRUE; set_mac_binary(server_type); - CTRACE(tfp, "HTFTP: Treating as NetPresenz (MACOS) server.\n"); + if (TRACE) + fprintf(stderr, + "HTFTP: Treating as NetPresenz (MACOS) server.\n"); } else if (strncmp(response_text+4, "MACOS Peter's Server", 20) == 0) { server_type = PETER_LEWIS_SERVER; use_list = TRUE; set_mac_binary(server_type); - CTRACE(tfp, "HTFTP: Treating as Peter Lewis (MACOS) server.\n"); + if (TRACE) + fprintf(stderr, + "HTFTP: Treating as Peter Lewis (MACOS) server.\n"); } else if (strncmp(response_text+4, "Windows_NT", 10) == 0) { server_type = WINDOWS_NT_SERVER; use_list = TRUE; - CTRACE(tfp, "HTFTP: Treating as Window_NT server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as Window_NT server.\n"); } else if (strncmp(response_text+4, "MS Windows", 10) == 0) { server_type = MS_WINDOWS_SERVER; use_list = TRUE; - CTRACE(tfp, "HTFTP: Treating as MS Windows server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Treating as MS Windows server.\n"); } else if (strncmp(response_text+4, "MACOS AppleShare IP FTP Server", 30) == 0) { server_type = APPLESHARE_SERVER; use_list = TRUE; set_mac_binary(server_type); - CTRACE(tfp, "HTFTP: Treating as AppleShare server.\n"); + if (TRACE) + fprintf(stderr, + "HTFTP: Treating as AppleShare server.\n"); } else { server_type = GENERIC_SERVER; - CTRACE(tfp, "HTFTP: Ugh! A Generic server.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Ugh! A Generic server.\n"); get_ftp_pwd(&server_type, &use_list); unsure_type = TRUE; } @@ -955,7 +1013,8 @@ PRIVATE int get_connection ARGS2( close_connection(control->socket); return -status; /* Bad return */ } - CTRACE(tfp, "HTFTP: Port defined.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Port defined.\n"); } #endif /* NOTREPEAT_PORT */ return con->socket; /* Good return */ @@ -974,7 +1033,8 @@ PRIVATE int close_master_socket NOARGS int status; FD_CLR(master_socket, &open_sockets); status = NETCLOSE(master_socket); - CTRACE(tfp, "HTFTP: Closed master socket %d\n", master_socket); + if (TRACE) + fprintf(stderr, "HTFTP: Closed master socket %d\n", master_socket); master_socket = -1; if (status < 0) return HTInetStatus("close master socket"); @@ -1019,7 +1079,8 @@ PRIVATE int get_listen_socket NOARGS if (new_socket < 0) return HTInetStatus("socket for master socket"); - CTRACE(tfp, "HTFTP: Opened master socket number %d\n", new_socket); + if (TRACE) + fprintf(stderr, "HTFTP: Opened master socket number %d\n", new_socket); /* Search for a free port. */ @@ -1054,7 +1115,9 @@ PRIVATE int get_listen_socket NOARGS /* Cast to generic sockaddr */ sizeof(soc_address))) == 0) break; - CTRACE(tfp, "TCP bind attempt to port %d yields %d, errno=%d\n", + if (TRACE) + fprintf(stderr, + "TCP bind attempt to port %d yields %d, errno=%d\n", port_number, status, SOCKET_ERRNO); } /* for */ } @@ -1398,8 +1461,7 @@ PRIVATE void parse_vms_dir_entry ARGS2( char *, line, EntryInfo *, entry_info) { - int i, j; - unsigned int ialloc; + int i, j, ialloc; char *cp, *cpd, *cps, date[16], *sp = " "; /** Get rid of blank lines, and information lines. **/ @@ -1415,8 +1477,8 @@ PRIVATE void parse_vms_dir_entry ARGS2( /** Cast VMS non-README file and directory names to lowercase. **/ if (strstr(entry_info->filename, "READ") == NULL) { - LYLowerCase(entry_info->filename); - i = strlen(entry_info->filename); + for (i = 0; entry_info->filename[i]; i++) + entry_info->filename[i] = TOLOWER(entry_info->filename[i]); } else { i = ((strstr(entry_info->filename, "READ") - entry_info->filename) + 4); if (!strncmp((char *)&entry_info->filename[i], "ME", 2)) { @@ -1429,7 +1491,8 @@ PRIVATE void parse_vms_dir_entry ARGS2( } else { i = 0; } - LYLowerCase(entry_info->filename + i); + for (; entry_info->filename[i]; i++) + entry_info->filename[i] = TOLOWER(entry_info->filename[i]); } /** Uppercase terminal .z's or _z's. **/ @@ -1529,10 +1592,11 @@ PRIVATE void parse_vms_dir_entry ARGS2( } /** Wrap it up **/ - CTRACE(tfp, "HTFTP: VMS filename: %s date: %s size: %d\n", - entry_info->filename, - entry_info->date ? entry_info->date : "", - entry_info->size); + if (TRACE) + fprintf(stderr, "HTFTP: VMS filename: %s date: %s size: %d\n", + entry_info->filename, + entry_info->date ? entry_info->date : "", + entry_info->size); return; } /* parse_vms_dir_entry() */ @@ -1550,22 +1614,28 @@ PRIVATE void parse_ms_windows_dir_entry ARGS2( char *end = line + strlen(line); /** Get rid of blank or junk lines. **/ - cp = LYSkipBlanks(cp); + while (*cp && isspace(*cp)) + cp++; if (!(*cp)) { entry_info->display = FALSE; return; } /** Cut out file or directory name. **/ - cps = LYSkipNonBlanks(cp); + cps = cp; + while (*cps && !isspace(*cps)) + cps++; *cps++ ='\0'; cpd = cps; StrAllocCopy(entry_info->filename, cp); /** Track down the size **/ if (cps < end) { - cps = LYSkipBlanks(cps); - cpd = LYSkipNonBlanks(cps); + while (*cps && isspace(*cps)) + cps++; + cpd = cps; + while (*cpd && !isspace(*cpd)) + cpd++; *cpd++ = '\0'; if (isdigit(*cps)) { entry_info->size = atoi(cps); @@ -1583,7 +1653,8 @@ PRIVATE void parse_ms_windows_dir_entry ARGS2( /** Track down the date. **/ if (cpd < end) { - cpd = LYSkipBlanks(cpd); + while (*cpd && isspace(*cpd)) + cpd++; if (strlen(cpd) > 17) { *(cpd+6) = '\0'; /* Month and Day */ *(cpd+11) = '\0'; /* Year */ @@ -1602,10 +1673,11 @@ PRIVATE void parse_ms_windows_dir_entry ARGS2( } /** Wrap it up **/ - CTRACE(tfp, "HTFTP: MS Windows filename: %s date: %s size: %d\n", - entry_info->filename, - entry_info->date ? entry_info->date : "", - entry_info->size); + if (TRACE) + fprintf(stderr, "HTFTP: MS Windows filename: %s date: %s size: %d\n", + entry_info->filename, + entry_info->date ? entry_info->date : "", + entry_info->size); return; } /* parse_ms_windows_dir_entry */ @@ -1625,7 +1697,8 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2( int i; /** Get rid of blank or junk lines. **/ - cp = LYSkipBlanks(cp); + while (*cp && isspace(*cp)) + cp++; if (!(*cp)) { entry_info->display = FALSE; return; @@ -1633,7 +1706,9 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2( /** Cut out file or directory name. **/ cpd = cp; - cps = LYSkipNonBlanks(end-1); + cps = (end-1); + while (cps >= cpd && !isspace(*cps)) + cps--; cp = (cps+1); if (!strcmp(cp, ".") || !strcmp(cp, "..")) { entry_info->display = FALSE; @@ -1652,14 +1727,18 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2( /** Cut out the date. **/ cp = cps = cpd; - cps = LYSkipNonBlanks(cps); + while (*cps && !isspace(*cps)) + cps++; *cps++ ='\0'; if (cps > end) { entry_info->display = FALSE; return; } - cps = LYSkipBlanks(cps); - cpd = LYSkipNonBlanks(cps); + while (*cps && isspace(*cps)) + cps++; + cpd = cps; + while (*cps && !isspace(*cps)) + cps++; *cps++ ='\0'; if (cps > end || cpd == cps || strlen(cpd) < 7) { entry_info->display = FALSE; @@ -1700,8 +1779,11 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2( /** Track down the size **/ if (cps < end) { - cps = LYSkipBlanks(cps); - cpd = LYSkipNonBlanks(cps); + while (*cps && isspace(*cps)) + cps++; + cpd = cps; + while (*cpd && !isspace(*cpd)) + cpd++; *cpd = '\0'; if (isdigit(*cps)) { entry_info->size = atoi(cps); @@ -1713,10 +1795,11 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2( } /** Wrap it up **/ - CTRACE(tfp, "HTFTP: Windows NT filename: %s date: %s size: %d\n", - entry_info->filename, - entry_info->date ? entry_info->date : "", - entry_info->size); + if (TRACE) + fprintf(stderr, "HTFTP: Windows NT filename: %s date: %s size: %d\n", + entry_info->filename, + entry_info->date ? entry_info->date : "", + entry_info->size); return; } /* parse_windows_nt_dir_entry */ #endif /* NOTDEFINED */ @@ -1738,20 +1821,25 @@ PRIVATE void parse_cms_dir_entry ARGS2( int i; /** Get rid of blank or junk lines. **/ - cp = LYSkipBlanks(cp); + while (*cp && isspace(*cp)) + cp++; if (!(*cp)) { entry_info->display = FALSE; return; } /** Cut out file or directory name. **/ - cps = LYSkipNonBlanks(cp); + cps = cp; + while (*cps && !isspace(*cps)) + cps++; *cps++ ='\0'; StrAllocCopy(entry_info->filename, cp); if (strchr(entry_info->filename, '.') != NULL) /** If we already have a dot, we did an NLST. **/ return; - cp = LYSkipBlanks(cps); + cp = cps; + while (*cp && isspace(*cp)) + cp++; if (!(*cp)) { /** If we don't have more, we've misparsed. **/ FREE(entry_info->filename); @@ -1759,7 +1847,9 @@ PRIVATE void parse_cms_dir_entry ARGS2( entry_info->display = FALSE; return; } - cps = LYSkipNonBlanks(cp); + cps = cp; + while (*cps && !isspace(*cps)) + cps++; *cps++ ='\0'; if ((0 == strcasecomp(cp, "DIR")) && (cp - line) > 17) { /** It's an SFS directory. **/ @@ -1774,8 +1864,11 @@ PRIVATE void parse_cms_dir_entry ARGS2( /** Track down the VM/CMS RECFM or type. **/ cp = cps; if (cp < end) { - cp = LYSkipBlanks(cp); - cps = LYSkipNonBlanks(cp); + while (*cp && isspace(*cp)) + cp++; + cps = cp; + while (*cps && !isspace(*cps)) + cps++; *cps++ = '\0'; /** Check cp here, if it's relevant someday. **/ } @@ -1784,8 +1877,11 @@ PRIVATE void parse_cms_dir_entry ARGS2( /** Track down the record length or dash. **/ cp = cps; if (cp < end) { - cp = LYSkipBlanks(cp); - cps = LYSkipNonBlanks(cp); + while (*cp && isspace(*cp)) + cp++; + cps = cp; + while (*cps && !isspace(*cps)) + cps++; *cps++ = '\0'; if (isdigit(*cp)) { RecordLength = atoi(cp); @@ -1795,8 +1891,11 @@ PRIVATE void parse_cms_dir_entry ARGS2( /** Track down the number of records or the dash. **/ cp = cps; if (cps < end) { - cp = LYSkipBlanks(cp); - cps = LYSkipNonBlanks(cp); + while (*cp && isspace(*cp)) + cp++; + cps = cp; + while (*cps && !isspace(*cps)) + cps++; *cps++ = '\0'; if (isdigit(*cp)) { Records = atoi(cp); @@ -1855,10 +1954,11 @@ PRIVATE void parse_cms_dir_entry ARGS2( } /** Wrap it up. **/ - CTRACE(tfp, "HTFTP: VM/CMS filename: %s date: %s size: %d\n", - entry_info->filename, - entry_info->date ? entry_info->date : "", - entry_info->size); + if (TRACE) + fprintf(stderr, "HTFTP: VM/CMS filename: %s date: %s size: %d\n", + entry_info->filename, + entry_info->date ? entry_info->date : "", + entry_info->size); return; } /* parse_cms_dir_entry */ @@ -2092,6 +2192,7 @@ PRIVATE EntryInfo * parse_dir_entry ARGS2( */ StrAllocCopy(entry_info->filename, entry); return(entry_info); /* mostly empty info */ + break; /* not needed */ } /* switch (server_type) */ @@ -2158,6 +2259,7 @@ PRIVATE int compare_EntryInfo_structs ARGS2( return(1); else return(-1); + break; case FILE_BY_TYPE: if (entry1->type && entry2->type) { @@ -2167,6 +2269,7 @@ PRIVATE int compare_EntryInfo_structs ARGS2( /* else fall to filename comparison */ } return (strcmp(entry1->filename, entry2->filename)); + break; case FILE_BY_DATE: if (entry1->date && entry2->date) { @@ -2258,6 +2361,7 @@ PRIVATE int compare_EntryInfo_structs ARGS2( /* else fall to filename comparison */ } return (strcmp(entry1->filename, entry2->filename)); + break; case FILE_BY_NAME: default: @@ -2427,13 +2531,15 @@ AgainForMultiNet: if (c == (char) EOF && chunk->size == 1) /* 1 means empty: includes terminating 0 */ break; - CTRACE(tfp, "HTFTP: Line in %s is %s\n", - lastpath, chunk->data); + if (TRACE) + fprintf(stderr, "HTFTP: Line in %s is %s\n", + lastpath, chunk->data); entry_info = parse_dir_entry(chunk->data, &first); if (entry_info->display) { - CTRACE(tfp, "Adding file to BTree: %s\n", - entry_info->filename); + if (TRACE) + fprintf(stderr, "Adding file to BTree: %s\n", + entry_info->filename); HTBTree_add(bt, (EntryInfo *)entry_info); } else { FREE(entry_info); @@ -2589,19 +2695,22 @@ PUBLIC int HTFTPLoad ARGS4( { status = response(port_command); if (status == HT_INTERRUPTED) { - CTRACE (tfp, "HTFTP: Interrupted in response (port_command)\n"); - _HTProgress ("Connection interrupted."); - NETCLOSE (control->socket); - control->socket = -1; - close_master_socket (); - return HT_INTERRUPTED; + if (TRACE) + fprintf (stderr, + "HTFTP: Interrupted in response (port_command)\n"); + _HTProgress ("Connection interrupted."); + NETCLOSE (control->socket); + control->socket = -1; + close_master_socket (); + return HT_INTERRUPTED; } if (status != 2) { /* Could have timed out */ if (status < 0) continue; /* try again - net error*/ return -status; /* bad reply */ } - CTRACE(tfp, "HTFTP: Port defined.\n"); + if (TRACE) + fprintf(stderr, "HTFTP: Port defined.\n"); } #endif /* REPEAT_PORT */ #else /* Use PASV */ @@ -2629,12 +2738,13 @@ PUBLIC int HTFTPLoad ARGS4( status = sscanf(p+1, "%d,%d,%d,%d,%d,%d", &h0, &h1, &h2, &h3, &p0, &p1); if (status < 4) { - fprintf(tfp, "HTFTP: PASV reply has no inet address!\n"); + fprintf(stderr, "HTFTP: PASV reply has no inet address!\n"); return -99; } passive_port = (p0<<8) + p1; - CTRACE(tfp, "HTFTP: Server is listening on port %d\n", - passive_port); + if (TRACE) + fprintf(stderr, "HTFTP: Server is listening on port %d\n", + passive_port); /* Open connection for data: @@ -2649,7 +2759,8 @@ PUBLIC int HTFTPLoad ARGS4( return status; /* Bad return */ } - CTRACE(tfp, "FTP data connected, socket %d\n", data_soc); + if (TRACE) + fprintf(stderr, "FTP data connected, socket %d\n", data_soc); } #endif /* use PASV */ status = 0; @@ -2676,7 +2787,10 @@ PUBLIC int HTFTPLoad ARGS4( init_help_message_cache(); /* to free memory */ NETCLOSE(control->socket); control->socket = -1; - CTRACE(tfp, "HTFTP: Rejecting path due to illegal escaped slash.\n"); + if (TRACE) { + fprintf(stderr, + "HTFTP: Rejecting path due to illegal escaped slash.\n"); + } return -1; } } @@ -2711,12 +2825,13 @@ PUBLIC int HTFTPLoad ARGS4( *(filename+1) = '\0'; } } - if (*type != '\0') { - CTRACE(tfp, "HTFTP: type=%s\n", type); + if (TRACE && *type != '\0') { + fprintf(stderr, "HTFTP: type=%s\n", type); } } HTUnEscape(filename); - CTRACE(tfp, "HTFTP: UnEscaped %s\n", filename); + if (TRACE) + fprintf(stderr, "HTFTP: UnEscaped %s\n", filename); if (filename[1] == '~') { /* ** Check if translation of HOME as tilde is supported, @@ -2834,7 +2949,10 @@ PUBLIC int HTFTPLoad ARGS4( init_help_message_cache(); /* to free memory */ NETCLOSE(control->socket); control->socket = -1; - CTRACE(tfp, "HTFTP: Rejecting path due to non-Unix-style syntax.\n"); + if (TRACE) { + fprintf(stderr, + "HTFTP: Rejecting path due to non-Unix-style syntax.\n"); + } return -1; } /** Handle any unescaped "/%2F" path **/ @@ -2844,15 +2962,21 @@ PUBLIC int HTFTPLoad ARGS4( for (i = 0; filename[(i+1)]; i++) filename[i] = filename[(i+1)]; filename[i] = '\0'; - CTRACE(tfp, "HTFTP: Trimmed '%s'\n", filename); + if (TRACE) { + fprintf(stderr, "HTFTP: Trimmed '%s'\n", filename); + } cp = HTMake_VMS_name("", filename); - CTRACE(tfp, "HTFTP: VMSized '%s'\n", cp); + if (TRACE) { + fprintf(stderr, "HTFTP: VMSized '%s'\n", cp); + } if ((cp1=strrchr(cp, ']')) != NULL) { cp1++; for (i = 0; cp1[i]; i++) filename[i] = cp1[i]; filename[i] = '\0'; - CTRACE(tfp, "HTFTP: Filename '%s'\n", filename); + if (TRACE) { + fprintf(stderr, "HTFTP: Filename '%s'\n", filename); + } *cp1 = '\0'; sprintf(command, "CWD %s%c%c", cp, CR, LF); status = response (command); @@ -2893,7 +3017,9 @@ PUBLIC int HTFTPLoad ARGS4( for (i = 0; cp1[i]; i++) filename[i] = cp1[i]; filename[i] = '\0'; - CTRACE(tfp, "HTFTP: Filename '%s'\n", filename); + if (TRACE) { + fprintf(stderr, "HTFTP: Filename '%s'\n", filename); + } *cp1 = '\0'; strcat(cp, "["); strcat(cp, filename); @@ -3233,7 +3359,8 @@ listen: /* Reset buffering to control connection DD 921208 */ status = NETCLOSE(data_soc); - CTRACE(tfp, "HTFTP: Closing data socket %d\n", data_soc); + if (TRACE) + fprintf(stderr, "HTFTP: Closing data socket %d\n", data_soc); if (status < 0 && rv != HT_INTERRUPTED && rv != -1) { (void) HTInetStatus("close"); /* Comment only */ data_soc = -1; /* invalidate it */ diff --git a/WWW/Library/Implementation/HTFTP.h b/WWW/Library/Implementation/HTFTP.h index 7b857076..6bcec339 100644 --- a/WWW/Library/Implementation/HTFTP.h +++ b/WWW/Library/Implementation/HTFTP.h @@ -10,6 +10,9 @@ #ifndef HTFTP_H #define HTFTP_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTAnchor.h> #include <HTStream.h> #include <HTParse.h> @@ -18,7 +21,7 @@ #define FILE_BY_TYPE 1 #define FILE_BY_SIZE 2 #define FILE_BY_DATE 3 -extern int HTfileSortMethod; /* specifies the method of sorting */ +extern BOOLEAN HTfileSortMethod; /* specifies the method of sorting */ /* PUBLIC HTMake_VMS_name() diff --git a/WWW/Library/Implementation/HTFWriter.c b/WWW/Library/Implementation/HTFWriter.c index 435fd3e8..8de75085 100644 --- a/WWW/Library/Implementation/HTFWriter.c +++ b/WWW/Library/Implementation/HTFWriter.c @@ -16,9 +16,10 @@ #include <HTAlert.h> #include <HTFile.h> -#include <LYUtils.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* Stream Object ** ------------ */ @@ -152,7 +153,8 @@ PRIVATE void HTFWriter_abort ARGS2(HTStream *, me, HTError, e) { fclose(me->fp); if (me->end_command) { /* Temp file */ - CTRACE(tfp, "HTFWriter: Aborting: file not executed.\n"); + if (TRACE) fprintf(stderr, + "HTFWriter: Aborting: file not executed.\n"); FREE(me->end_command); if (me->remove_command) { system(me->remove_command); @@ -248,7 +250,7 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3( /* Save the file under a suitably suffixed name */ - suffix = HTFileSuffix(pres->rep, anchor->content_encoding); + suffix = HTFileSuffix(pres->rep); fnam = (char *)malloc (L_tmpnam + 16 + strlen(suffix)); tmpnam (fnam); @@ -326,7 +328,7 @@ PUBLIC HTStream* HTSaveLocally ARGS3( /* Save the file under a suitably suffixed name */ - suffix = HTFileSuffix(pres->rep, anchor->content_encoding); + suffix = HTFileSuffix(pres->rep); fnam = (char *)malloc (L_tmpnam + 16 + strlen(suffix)); tmpnam (fnam); diff --git a/WWW/Library/Implementation/HTFWriter.h b/WWW/Library/Implementation/HTFWriter.h index 089ad0fb..334169e7 100644 --- a/WWW/Library/Implementation/HTFWriter.h +++ b/WWW/Library/Implementation/HTFWriter.h @@ -8,7 +8,11 @@ #ifndef HTFWRITE_H #define HTFWRITE_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTStream.h> +/*#include <stdio.h> included by HTUtils.h -- FM */ #include <HTFormat.h> #ifdef SHORT_NAMES diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c index d04b2013..039e9b65 100644 --- a/WWW/Library/Implementation/HTFile.c +++ b/WWW/Library/Implementation/HTFile.c @@ -20,8 +20,6 @@ ** the device or top directory. */ -#include <HTUtils.h> - #ifndef VMS /* #define LONG_LIST */ /* Define this for long style unix listings (ls -l) */ /* #define NO_PARENT_DIR_REFERENCE */ /* Define this for no parent links */ @@ -29,10 +27,13 @@ #ifdef DOSPATH #define HAVE_READDIR 1 +#include <dirent.h> #define USE_DIRENT #include <HTDOS.h> #endif /* DOSPATH */ +#include <HTUtils.h> +#include <tcp.h> #include <HTFile.h> /* Implemented here */ #ifdef VMS #include <stat.h> @@ -52,6 +53,14 @@ #define INFINITY 512 /* file name length @@ FIXME */ #define MULTI_SUFFIX ".multi" /* Extension for scanning formats */ +#define HT_EM_SPACE ((char)2) + +#define FREE(x) if (x) {free(x); x = NULL;} + +#ifdef VMS +#include <HTVMSUtils.h> +#endif /* VMS */ + #include <HTParse.h> #include <HTTCP.h> #ifndef DECNET @@ -72,7 +81,6 @@ #include <LYexit.h> #include <LYCharSets.h> #include <LYGlobalDefs.h> -#include <LYStrings.h> #include <LYUtils.h> #include <LYLeaks.h> @@ -92,10 +100,6 @@ typedef struct _HTSuffix { #endif /* NGROUPS_MAX */ #endif /* NGROUPS */ -#ifndef GETGROUPS_T -#define GETGROUPS_T int -#endif - #include <HTML.h> /* For directory object building */ #define PUTC(c) (*target->isa->put_character)(target, c) @@ -117,10 +121,15 @@ PUBLIC int HTDirAccess = HT_DIR_OK; #ifdef DIRED_SUPPORT PUBLIC int HTDirReadme = HT_DIR_README_NONE; +#define FILES_FIRST 1 +#define MIXED_STYLE 2 +extern BOOLEAN lynx_edit_mode; +extern BOOLEAN dir_list_style; #else PUBLIC int HTDirReadme = HT_DIR_README_TOP; #endif /* DIRED_SUPPORT */ +extern BOOLEAN LYRawMode; extern BOOL HTPassEightBitRaw; extern HTCJKlang HTCJK; @@ -214,7 +223,6 @@ PRIVATE void LYListFmtParse ARGS5( s++; c = *s; /* the format char. or \0 */ *s = '\0'; - buf[0] = '\0'; switch (c) { case '\0': @@ -228,7 +236,7 @@ PRIVATE void LYListFmtParse ARGS5( PUTS(buf); END(HTML_A); #ifdef S_IFLNK - if (c != 'A' && S_ISLNK(st.st_mode) && + if (c != 'A' && (st.st_mode & S_IFMT) == S_IFLNK && (len = readlink(file, buf, sizeof(buf))) >= 0) { PUTS(" -> "); buf[len] = '\0'; @@ -262,7 +270,7 @@ PRIVATE void LYListFmtParse ARGS5( break; case 'K': /* size in Kilobytes but not for directories */ - if (S_ISDIR(st.st_mode)) { + if ((st.st_mode & S_IFMT) == S_IFDIR) { sprintf(fmt, "%%%ss ", start); sprintf(buf, fmt, ""); break; @@ -557,60 +565,59 @@ PRIVATE int HTCreatePath ARGS1(CONST char *,path) ** On exit: ** Returns a malloc'ed string which must be freed by the caller. */ -PUBLIC char * HTnameOfFile_WWW ARGS3( - CONST char *, name, - BOOL, WWW_prefix, - BOOL, expand_all) +PUBLIC char * HTLocalName ARGS1( + CONST char *, name) { char * acc_method = HTParse(name, "", PARSE_ACCESS); char * host = HTParse(name, "", PARSE_HOST); char * path = HTParse(name, "", PARSE_PATH+PARSE_PUNCTUATION); - char * home; - char * result = NULL; - if (expand_all) - HTUnEscape(path); /* Interpret all % signs */ - else - HTUnEscapeSome(path, "/"); /* Interpret % signs for path delims */ + HTUnEscape(path); /* Interpret % signs */ - if (0 == strcmp(acc_method, "file") /* local file */ - || !*acc_method) { /* implicitly local? */ + if (0 == strcmp(acc_method, "file")) { /* local file */ + FREE(acc_method); if ((0 == strcasecomp(host, HTHostName())) || (0 == strcasecomp(host, "localhost")) || !*host) { - CTRACE(tfp, "Node `%s' means path `%s'\n", name, path); + FREE(host); + if (TRACE) + fprintf(stderr, "Node `%s' means path `%s'\n", name, path); #ifdef DOSPATH - StrAllocCopy(result, HTDOS_name(path)); -#else -#ifdef __EMX__ - if (path[0] == '/' - && isalpha(path[1]) - && path[2] == ':') /* pesky leading slash */ - StrAllocCopy(result, path+1); - else - StrAllocCopy(result, path); - CTRACE(tfp, "EMX hack changed `%s' to `%s'\n", path, result); + { + char *ret_path = NULL; + StrAllocCopy(ret_path, HTDOS_name(path)); + if (TRACE) { + fprintf(stderr, "HTDOS_name changed `%s' to `%s'\n", + path, ret_path); + } + FREE(path); + return(ret_path); + } #else - StrAllocCopy(result, path); -#endif /* __EMX__ */ + return(path); #endif /* DOSPATH */ - } else if (WWW_prefix) { - result = (char *)malloc( + } else { + char * result = (char *)malloc( strlen("/Net/")+strlen(host)+strlen(path)+1); - if (result == NULL) - outofmem(__FILE__, "HTLocalName"); + if (result == NULL) + outofmem(__FILE__, "HTLocalName"); sprintf(result, "%s%s%s", "/Net/", host, path); - CTRACE(tfp, "Node `%s' means file `%s'\n", name, result); - } else { - StrAllocCopy(result, path); + FREE(host); + FREE(path); + if (TRACE) + fprintf(stderr, "Node `%s' means file `%s'\n", name, result); + return result; } - } else if (WWW_prefix) { /* other access */ + } else { /* other access */ + char * result; #ifdef VMS - if ((home = getenv("HOME")) == 0) + char * home = getenv("HOME"); + if (!home) home = HTCacheRoot; else home = HTVMS_wwwName(home); #else - if ((home = getenv("HOME")) == 0) + CONST char * home = (CONST char*)getenv("HOME"); + if (!home) home = "/tmp"; #endif /* VMS */ result = (char *)malloc( @@ -618,15 +625,11 @@ PUBLIC char * HTnameOfFile_WWW ARGS3( if (result == NULL) outofmem(__FILE__, "HTLocalName"); sprintf(result, "%s/WWW/%s/%s%s", home, acc_method, host, path); - } else { - StrAllocCopy(result, path); + FREE(path); + FREE(acc_method); + FREE(host); + return result; } - - FREE(host); - FREE(path); - FREE(acc_method); - - return result; } /* Make a WWW name from a full local path name. @@ -660,7 +663,8 @@ PUBLIC char * WWW_nameOfFile ARGS1( outofmem(__FILE__, "WWW_nameOfFile"); sprintf(result, "file://%s%s", HTHostName(), name); } - CTRACE(tfp, "File `%s'\n\tmeans node `%s'\n", name, result); + if (TRACE) + fprintf(stderr, "File `%s'\n\tmeans node `%s'\n", name, result); return result; } @@ -855,13 +859,17 @@ PUBLIC HTFormat HTCharsetFormat ARGS3( char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4; BOOL chartrans_ok = FALSE; int chndl = -1; + int i; FREE(anchor->charset); StrAllocCopy(cp, format->name); - LYLowerCase(cp); + for (i = 0; cp[i]; i++) + cp[i] = TOLOWER(cp[i]); if (((cp1 = strchr(cp, ';')) != NULL) && (cp2 = strstr(cp1, "charset")) != NULL) { - CTRACE(tfp, "HTCharsetFormat: Extended MIME Content-Type is %s\n", + if (TRACE) + fprintf(stderr, + "HTCharsetFormat: Extended MIME Content-Type is %s\n", format->name); cp2 += 7; while (*cp2 == ' ' || *cp2 == '=') @@ -888,12 +896,6 @@ PUBLIC HTFormat HTCharsetFormat ARGS3( ** Got something but we don't recognize it. */ chndl = UCLYhndl_for_unrec; - if (chndl < 0) - /* - ** UCLYhndl_for_unrec not defined :-( - ** fallback to UCLYhndl_for_unspec which always valid. - */ - chndl = UCLYhndl_for_unspec; /* always >= 0 */ if (UCCanTranslateFromTo(chndl, current_char_set)) { chartrans_ok = YES; HTAnchor_setUCInfoStage(anchor, chndl, @@ -938,9 +940,35 @@ PUBLIC HTFormat HTCharsetFormat ARGS3( HTPassEightBitRaw = TRUE; } } else if (p_out->enc == UCT_ENC_CJK) { - Set_HTCJK(p_in->MIMEname, p_out->MIMEname); + if (LYRawMode) { + if ((!strcmp(p_in->MIMEname, "euc-jp") || + !strcmp(p_in->MIMEname, "shift_jis")) && + (!strcmp(p_out->MIMEname, "euc-jp") || + !strcmp(p_out->MIMEname, "shift_jis"))) { + HTCJK = JAPANESE; + } else if (!strcmp(p_in->MIMEname, "euc-cn") && + !strcmp(p_out->MIMEname, "euc-cn")) { + HTCJK = CHINESE; + } else if (!strcmp(p_in->MIMEname, "big-5") && + !strcmp(p_out->MIMEname, "big-5")) { + HTCJK = TAIPEI; + } else if (!strcmp(p_in->MIMEname, "euc-kr") && + !strcmp(p_out->MIMEname, "euc-kr")) { + HTCJK = KOREAN; + } else { + HTCJK = NOCJK; + } + } else { + HTCJK = NOCJK; + } } - } else { + /* + ** Check for an iso-8859-# we don't know. - FM + */ + } else if (!strncmp(cp4, "iso-8859-", 9) && + isdigit((unsigned char)cp4[9]) && + !strncmp(LYchar_set_names[current_char_set], + "Other ISO Latin", 15)) { /* ** Hope it's a match, for now. - FM */ @@ -1005,8 +1033,9 @@ PUBLIC float HTFileValue ARGS1( suff = (HTSuffix *)HTList_objectAt(HTSuffixes, i); ls = strlen(suff->suffix); if ((ls <= lf) && 0==strcmp(suff->suffix, filename + lf - ls)) { - CTRACE(tfp, "File: Value of %s is %.3f\n", - filename, suff->quality); + if (TRACE) + fprintf(stderr, "File: Value of %s is %.3f\n", + filename, suff->quality); return suff->quality; /* OK -- found */ } } @@ -1053,7 +1082,11 @@ PUBLIC BOOL HTEditable ARGS1( #ifdef NO_GROUPS return NO; /* Safe answer till we find the correct algorithm */ #else - GETGROUPS_T groups[NGROUPS]; +#ifdef NeXT + int groups[NGROUPS]; +#else + gid_t groups[NGROUPS]; +#endif /* NeXT */ uid_t myUid; int ngroups; /* The number of groups */ struct stat fileStatus; @@ -1067,16 +1100,14 @@ PUBLIC BOOL HTEditable ARGS1( if (TRACE) { int i2; - fprintf(tfp, + fprintf(stderr, "File mode is 0%o, uid=%d, gid=%d. My uid=%d, %d groups (", - (unsigned int) fileStatus.st_mode, - (int) fileStatus.st_uid, - (int) fileStatus.st_gid, - (int) myUid, - (int) ngroups); + (unsigned int) fileStatus.st_mode, fileStatus.st_uid, + fileStatus.st_gid, + myUid, ngroups); for (i2 = 0; i2 < ngroups; i2++) - fprintf(tfp, " %d", (int) groups[i2]); - fprintf(tfp, ")\n"); + fprintf(stderr, " %d", groups[i2]); + fprintf(stderr, ")\n"); } if (fileStatus.st_mode & 0002) /* I can write anyway? */ @@ -1093,7 +1124,8 @@ PUBLIC BOOL HTEditable ARGS1( return YES; } } - CTRACE(tfp, "\tFile is not editable.\n"); + if (TRACE) + fprintf(stderr, "\tFile is not editable.\n"); return NO; /* If no excuse, can't do */ #endif /* NO_GROUPS */ } @@ -1228,11 +1260,11 @@ PUBLIC BOOL HTDirTitles ARGS3( char * printable = NULL; #ifdef DIRED_SUPPORT - printable = HTfullURL_toFile( - (0 == strncasecomp(path, "/%2F", 4)) /* "//" ? */ - ? (path+1) - : path); - if (0 == strncasecomp(printable, "/vmsysu:", 8) || + if (0 == strncasecomp(path, "/%2F", 4)) + StrAllocCopy(printable, (path+1)); + else + StrAllocCopy(printable, path); + if (0 == strncasecomp(printable, "/vmsysu%2b", 10) || 0 == strncasecomp(printable, "/anonymou.", 10)) { StrAllocCopy(cp, (printable+1)); StrAllocCopy(printable, cp); @@ -1240,11 +1272,11 @@ PUBLIC BOOL HTDirTitles ARGS3( } #else StrAllocCopy(printable, (current ? current + 1 : "")); - HTUnEscape(printable); #endif /* DIRED_SUPPORT */ START(HTML_HEAD); PUTS("\n"); + HTUnEscape(printable); START(HTML_TITLE); PUTS(*printable ? printable : "Welcome"); PUTS(" directory"); @@ -1496,9 +1528,10 @@ PUBLIC int HTLoadFile ARGS4( ** to the directories or files listed. */ if (HTStat(filename, &stat_info) == -1) { - CTRACE(tfp, "HTLoadFile: Can't stat %s\n", filename); + if (TRACE) + fprintf(stderr, "HTLoadFile: Can't stat %s\n", filename); } else { - if (S_ISDIR(stat_info.st_mode)) { + if (((stat_info.st_mode) & S_IFMT) == S_IFDIR) { if (HTDirAccess == HT_DIR_FORBID) { FREE(filename); FREE(nodename); @@ -1544,12 +1577,14 @@ PUBLIC int HTLoadFile ARGS4( */ if (!fp) { char ultrixname[INFINITY]; - CTRACE(tfp, "HTLoadFile: Can't open as %s\n", vmsname); + if (TRACE) + fprintf(stderr, "HTLoadFile: Can't open as %s\n", vmsname); sprintf(ultrixname, "%s::\"%s\"", nodename, filename); fp = fopen(ultrixname, "r", "shr=put", "shr=upd"); if (!fp) { - CTRACE(tfp, "HTLoadFile: Can't open as %s\n", - ultrixname); + if (TRACE) + fprintf(stderr, "HTLoadFile: Can't open as %s\n", + ultrixname); } } if (fp) { @@ -1589,7 +1624,9 @@ PUBLIC int HTLoadFile ARGS4( *semicolon = ';'; gzfp = gzopen(vmsname, "rb"); - CTRACE(tfp, "HTLoadFile: gzopen of `%s' gives %p\n", + if (TRACE) + fprintf(stderr, + "HTLoadFile: gzopen of `%s' gives %p\n", vmsname, (void*)gzfp); use_gzread = YES; } else @@ -1635,7 +1672,9 @@ PUBLIC int HTLoadFile ARGS4( *semicolon = ';'; gzfp = gzopen(vmsname, "rb"); - CTRACE(tfp, "HTLoadFile: gzopen of `%s' gives %p\n", + if (TRACE) + fprintf(stderr, + "HTLoadFile: gzopen of `%s' gives %p\n", vmsname, (void*)gzfp); use_gzread = YES; } @@ -1718,7 +1757,7 @@ PUBLIC int HTLoadFile ARGS4( if ((strlen(localname) > strlen(MULTI_SUFFIX)) && (0 == strcmp(localname + strlen(localname) - strlen(MULTI_SUFFIX), MULTI_SUFFIX))) { - DIR *dp = 0; + DIR *dp; BOOL forget_multi = NO; STRUCT_DIRENT * dirbuf; @@ -1808,7 +1847,9 @@ PUBLIC int HTLoadFile ARGS4( } } if (value != NO_VALUE_FOUND) { - CTRACE(tfp, "HTLoadFile: value of presenting %s is %f\n", + if (TRACE) + fprintf(stderr, + "HTLoadFile: value of presenting %s is %f\n", HTAtom_name(rep), value); if (value > best) { best_rep = rep; @@ -1854,7 +1895,8 @@ PUBLIC int HTLoadFile ARGS4( #endif { /* if can't read file information */ - CTRACE(tfp, "HTLoadFile: can't stat %s\n", localname); + if (TRACE) + fprintf(stderr, "HTLoadFile: can't stat %s\n", localname); } else { /* Stat was OK */ @@ -1862,7 +1904,7 @@ PUBLIC int HTLoadFile ARGS4( if (stat(localname,&dir_info) == -1) dir_info.st_mode = S_IFDIR; #endif - if (S_ISDIR(dir_info.st_mode)) { + if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) { /* ** If localname is a directory. */ @@ -1878,7 +1920,8 @@ PUBLIC int HTLoadFile ARGS4( BOOL need_parent_link = FALSE; struct stat file_info; - CTRACE(tfp, "%s is a directory\n", localname); + if (TRACE) + fprintf(stderr, "%s is a directory\n", localname); /* ** Check directory access. @@ -2024,14 +2067,13 @@ PUBLIC int HTLoadFile ARGS4( StrAllocCat(tmpfilename, dirbuf->d_name); stat(tmpfilename, &file_info); - if (S_ISDIR(file_info.st_mode)) + if (((file_info.st_mode) & S_IFMT) == S_IFDIR) #ifndef DIRED_SUPPORT sprintf((char *)dirname, "D%s",dirbuf->d_name); else sprintf((char *)dirname, "F%s",dirbuf->d_name); /* D & F to have first directories, then files */ #else - { if (dir_list_style == MIXED_STYLE) sprintf((char *)dirname, " %s/", dirbuf->d_name); @@ -2041,7 +2083,6 @@ PUBLIC int HTLoadFile ARGS4( else sprintf((char *)dirname, "D%s", dirbuf->d_name); - } else if (dir_list_style == MIXED_STYLE) sprintf((char *)dirname, " %s", dirbuf->d_name); else if (dir_list_style == FILES_FIRST) @@ -2204,7 +2245,8 @@ PUBLIC int HTLoadFile ARGS4( { FILE * fp = fopen(localname, "r"); - CTRACE (tfp, "HTLoadFile: Opening `%s' gives %p\n", + if (TRACE) + fprintf (stderr, "HTLoadFile: Opening `%s' gives %p\n", localname, (void*)fp); if (fp) { /* Good! */ int len; @@ -2233,7 +2275,9 @@ PUBLIC int HTLoadFile ARGS4( fclose(fp); gzfp = gzopen(localname, "rb"); - CTRACE(tfp, "HTLoadFile: gzopen of `%s' gives %p\n", + if (TRACE) + fprintf(stderr, + "HTLoadFile: gzopen of `%s' gives %p\n", localname, (void*)gzfp); use_gzread = YES; } else @@ -2272,7 +2316,9 @@ PUBLIC int HTLoadFile ARGS4( fclose(fp); gzfp = gzopen(localname, "rb"); - CTRACE(tfp, "HTLoadFile: gzopen of `%s' gives %p\n", + if (TRACE) + fprintf(stderr, + "HTLoadFile: gzopen of `%s' gives %p\n", localname, (void*)gzfp); use_gzread = YES; } @@ -2359,7 +2405,8 @@ PUBLIC int HTLoadFile ARGS4( ** All attempts have failed. */ { - CTRACE(tfp, "Can't open `%s', errno=%d\n", addr, SOCKET_ERRNO); + if (TRACE) + fprintf(stderr, "Can't open `%s', errno=%d\n", addr, SOCKET_ERRNO); return HTLoadError(sink, 403, "Can't access requested file."); } diff --git a/WWW/Library/Implementation/HTFile.h b/WWW/Library/Implementation/HTFile.h index 9c7686f1..867e00d7 100644 --- a/WWW/Library/Implementation/HTFile.h +++ b/WWW/Library/Implementation/HTFile.h @@ -42,10 +42,7 @@ extern int HTDirReadme; /* Include readme files in listing? */ /* ** Convert filenames between local and WWW formats */ -extern char * HTnameOfFile_WWW PARAMS((CONST char * name, BOOL WWW_prefix, BOOL expand_all)); -#define HTLocalName(name) HTnameOfFile_WWW(name,TRUE,TRUE) -#define HTfullURL_toFile(name) HTnameOfFile_WWW(name,FALSE,TRUE) -#define HTpartURL_toFile(name) HTnameOfFile_WWW(name,FALSE,FALSE) +extern char * HTLocalName PARAMS((CONST char * name)); /* ** Make a WWW name from a full local path name diff --git a/WWW/Library/Implementation/HTFinger.c b/WWW/Library/Implementation/HTFinger.c index 91b8d40e..042d137c 100644 --- a/WWW/Library/Implementation/HTFinger.c +++ b/WWW/Library/Implementation/HTFinger.c @@ -26,6 +26,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTAlert.h> #include <HTML.h> #include <HTParse.h> @@ -34,12 +35,15 @@ #include <HTString.h> #include <HTFinger.h> -#include <LYUtils.h> #include <LYLeaks.h> +/* #define TRACE 1 */ + #define FINGER_PORT 79 /* See rfc742 */ #define BIG 1024 /* Bug */ +#define FREE(x) if (x) {free(x); x = NULL;} + #define PUTC(c) (*targetClass.put_character)(target, c) #define PUTS(s) (*targetClass.put_string)(target, s) #define START(e) (*targetClass.start_element)(target, e, 0, 0, -1, 0) @@ -125,10 +129,13 @@ PRIVATE int response ARGS5( /* Send the command. */ - CTRACE(tfp, "HTFinger command to be sent: %s", command); + if (TRACE) + fprintf(stderr, "HTFinger command to be sent: %s", command); status = NETWRITE(s, (char *)command, length); if (status < 0) { - CTRACE(tfp, "HTFinger: Unable to send command. Disconnecting.\n"); + if (TRACE) + fprintf(stderr, + "HTFinger: Unable to send command. Disconnecting.\n"); NETCLOSE(s); s = -1; return status; @@ -141,7 +148,8 @@ PRIVATE int response ARGS5( /* Create the results report. */ - CTRACE(tfp,"HTFinger: Reading finger information\n"); + if (TRACE) + fprintf(stderr,"HTFinger: Reading finger information\n"); START(HTML_HTML); PUTS("\n"); START(HTML_HEAD); @@ -182,7 +190,10 @@ PRIVATE int response ARGS5( while ((ch=NEXT_CHAR) != (char)EOF) { if (interrupted_in_htgetcharacter) { - CTRACE(tfp, "HTFinger: Interrupted in HTGetCharacter, apparently.\n"); + if (TRACE) { + fprintf(stderr, + "HTFinger: Interrupted in HTGetCharacter, apparently.\n"); + } _HTProgress ("Connection interrupted."); goto end_html; } @@ -259,7 +270,9 @@ PUBLIC int HTLoadFinger ARGS4( int port; /* Port number from URL */ int status; /* tcp return */ - CTRACE(tfp, "HTFinger: Looking for %s\n", (arg ? arg : "NULL")); + if (TRACE) { + fprintf(stderr, "HTFinger: Looking for %s\n", (arg ? arg : "NULL")); + } if (!(arg && *arg)) { HTAlert("Could not load data."); @@ -378,13 +391,17 @@ PUBLIC int HTLoadFinger ARGS4( /* Now, let's get a stream setup up from the FingerHost: ** CONNECTING to finger host */ - CTRACE(tfp, "HTFinger: doing HTDoConnect on '%s'\n", str); + if (TRACE) + fprintf(stderr, "HTFinger: doing HTDoConnect on '%s'\n", str); status = HTDoConnect(str, "finger", FINGER_PORT, &s); - CTRACE(tfp, "HTFinger: Done DoConnect; status %d\n", status); + if (TRACE) + fprintf(stderr, "HTFinger: Done DoConnect; status %d\n", status); if (status == HT_INTERRUPTED) { /* Interrupt cleanly */ - CTRACE(tfp, "HTFinger: Interrupted on connect; recovering cleanly.\n"); + if (TRACE) + fprintf(stderr, + "HTFinger: Interrupted on connect; recovering cleanly.\n"); HTProgress ("Connection interrupted."); FREE(str); FREE(command); @@ -393,13 +410,15 @@ PUBLIC int HTLoadFinger ARGS4( if (status < 0) { NETCLOSE(s); s = -1; - CTRACE(tfp, "HTFinger: Unable to connect to finger host.\n"); + if (TRACE) + fprintf(stderr, "HTFinger: Unable to connect to finger host.\n"); HTAlert("Could not access finger host."); FREE(str); FREE(command); return HT_NOT_LOADED; /* FAIL */ } - CTRACE(tfp, "HTFinger: Connected to finger host '%s'.\n", str); + if (TRACE) + fprintf(stderr, "HTFinger: Connected to finger host '%s'.\n", str); FREE(str); /* Send the command, and process response if successful. diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c index 859934e8..baffca71 100644 --- a/WWW/Library/Implementation/HTFormat.c +++ b/WWW/Library/Implementation/HTFormat.c @@ -11,6 +11,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTAccess.h> /* Implements: @@ -47,10 +48,13 @@ PUBLIC long int HTMaxBytes = 0; /* No effective limit */ #include <LYexit.h> #include <LYUtils.h> -#include <GridText.h> #include <LYGlobalDefs.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + +extern int HTCheckForInterrupt NOPARAMS; + PUBLIC BOOL HTOutputSource = NO; /* Flag: shortcut parser to stdout */ /* extern BOOL interactive; LJM */ @@ -231,11 +235,14 @@ PUBLIC char HTGetCharacter NOARGS if (status == 0) return (char)EOF; if (status == HT_INTERRUPTED) { - CTRACE(tfp, "HTFormat: Interrupted in HTGetCharacter\n"); + if (TRACE) + fprintf(stderr, + "HTFormat: Interrupted in HTGetCharacter\n"); interrupted_in_htgetcharacter = 1; return (char)EOF; } - CTRACE(tfp, "HTFormat: File read error %d\n", status); + if (TRACE) + fprintf(stderr, "HTFormat: File read error %d\n", status); return (char)EOF; /* -1 is returned by UCX at end of HTTP link */ } @@ -259,8 +266,9 @@ PRIVATE int half_match ARGS2(char *,trial_type, char *,target) if (!cp || *(cp+1) != '*') return 0; - CTRACE(tfp, "HTFormat: comparing %s and %s for half match\n", - trial_type, target); + if (TRACE) + fprintf(stderr,"HTFormat: comparing %s and %s for half match\n", + trial_type, target); /* main type matches */ if (!strncmp(trial_type, target, (cp-trial_type)-1)) @@ -287,7 +295,9 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3( { HTAtom * wildcard = HTAtom_for("*"); - CTRACE(tfp, "HTFormat: Looking up presentation for %s to %s\n", + if (TRACE) + fprintf(stderr, + "HTFormat: Looking up presentation for %s to %s\n", HTAtom_name(rep_in), HTAtom_name(rep_out)); /* don't do anymore do it in the Lynx code at startup LJM */ @@ -306,7 +316,9 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3( pres = (HTPresentation *)HTList_objectAt(HTPresentations, i); if (pres->rep == rep_in) { if (pres->rep_out == rep_out) { - CTRACE(tfp, "FindPresentation: found exact match: %s\n", + if (TRACE) + fprintf(stderr, + "FindPresentation: found exact match: %s\n", HTAtom_name(pres->rep)); return pres; @@ -316,7 +328,9 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3( if (!strong_wildcard_match) strong_wildcard_match = pres; /* otherwise use the first one */ - CTRACE(tfp, "StreamStack: found strong wildcard match: %s\n", + if (TRACE) + fprintf(stderr, + "StreamStack: found strong wildcard match: %s\n", HTAtom_name(pres->rep)); } @@ -329,7 +343,9 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3( if (!strong_subtype_wildcard_match) strong_subtype_wildcard_match = pres; /* otherwise use the first one */ - CTRACE(tfp, "StreamStack: found strong subtype wildcard match: %s\n", + if (TRACE) + fprintf(stderr, + "StreamStack: found strong subtype wildcard match: %s\n", HTAtom_name(pres->rep)); } } @@ -339,7 +355,9 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3( if (!weak_wildcard_match) weak_wildcard_match = pres; /* otherwise use the first one */ - CTRACE(tfp, "StreamStack: found weak wildcard match: %s\n", + if (TRACE) + fprintf(stderr, + "StreamStack: found weak wildcard match: %s\n", HTAtom_name(pres->rep_out)); } if (pres->rep_out == wildcard) { @@ -385,7 +403,9 @@ PUBLIC HTStream * HTStreamStack ARGS4( HTPresentation temp; HTPresentation *match; - CTRACE(tfp, "HTFormat: Constructing stream stack for %s to %s\n", + if (TRACE) + fprintf(stderr, + "HTFormat: Constructing stream stack for %s to %s\n", HTAtom_name(rep_in), HTAtom_name(rep_out)); /* don't return on WWW_SOURCE some people might like @@ -399,9 +419,13 @@ PUBLIC HTStream * HTStreamStack ARGS4( if ((match = HTFindPresentation(rep_in, rep_out, &temp))) { if (match == &temp) { - CTRACE(tfp, "StreamStack: Using %s\n", HTAtom_name(temp.rep_out)); + if (TRACE) + fprintf(stderr, + "StreamStack: Using %s\n", HTAtom_name(temp.rep_out)); } else { - CTRACE(tfp, "StreamStack: found exact match: %s\n", + if (TRACE) + fprintf(stderr, + "StreamStack: found exact match: %s\n", HTAtom_name(match->rep)); } return (*match->converter)(match, anchor, sink); @@ -442,7 +466,9 @@ PUBLIC float HTStackValue ARGS4( { HTAtom * wildcard = HTAtom_for("*"); - CTRACE(tfp, "HTFormat: Evaluating stream stack for %s worth %.3f to %s\n", + if (TRACE) + fprintf(stderr, + "HTFormat: Evaluating stream stack for %s worth %.3f to %s\n", HTAtom_name(rep_in), initial_value, HTAtom_name(rep_out)); if (rep_out == WWW_SOURCE || rep_out == rep_in) @@ -472,61 +498,13 @@ PUBLIC float HTStackValue ARGS4( } -/* Display the page while transfer in progress -** ------------------------------------------- -** -** Repaint the page only when necessary. -** -*/ -#ifdef DISP_PARTIAL -PRIVATE void HTDisplayPartial NOARGS -{ - if (display_partial) { - /* - ** HText_getNumOfLines() = "current" number of lines received - ** NumOfLines_partial = number of lines at the moment of last repaint. - ** - ** We update NumOfLines_partial only when we repaint the display. - ** -1 is the special value: - ** This is a synchronization flag switched to 0 when HText_new() - ** starts a new HTMainText object - all hypertext functions use it, - ** lines counter in particular [we call it from HText_getNumOfLines()]. - ** - ** Otherwise HTMainText holds info from the previous document - ** and we may repaint it instead of the new one: - ** prev doc scrolled to the first line (=Newline_partial) - ** is not good looking :-) 23 Aug 1998 Leonid Pauzner - ** - ** So repaint the page only when necessary: - */ - if ((NumOfLines_partial != -1) - /* new hypertext document available */ - && ((Newline_partial + display_lines) > NumOfLines_partial) - /* current page not complete... */ - && (partial_threshold > 0 ? ((Newline_partial + partial_threshold) < HText_getNumOfLines()) : - ((Newline_partial + display_lines) < HText_getNumOfLines()))) { - /* - * Originally we rendered by increments of 2 lines, - * but that got annoying on slow network connections. - * Then we switched to full-pages. Now it's configurable. - * If partial_threshold < 0, then it's a full page - */ - NumOfLines_partial = HText_getNumOfLines(); - HText_pageDisplay(Newline_partial, ""); - } - } -} -#else -#define HTDisplayPartial() /*nothing*/ -#endif - /* Push data from a socket down a stream ** ------------------------------------- ** ** This routine is responsible for creating and PRESENTING any ** graphic (or other) objects described by the file. ** -** The file number given is assumed to be a TELNET stream, i.e., containing +** The file number given is assumed to be a TELNET stream ie containing ** CRLF at the end of lines which need to be stripped to LF for unix ** when the format is textual. ** @@ -538,7 +516,8 @@ PUBLIC int HTCopy ARGS4( HTStream*, sink) { HTStreamClass targetClass; - int bytes; + char line[256]; + int bytes = 0; int rv = 0; /* Push the data down the stream @@ -549,7 +528,6 @@ PUBLIC int HTCopy ARGS4( ** ** This operation could be put into a main event loop */ - HTReadProgress(bytes = 0, 0); for (;;) { int status; @@ -587,7 +565,7 @@ PUBLIC int HTCopy ARGS4( SOCKET_ERRNO == ECONNRESET || SOCKET_ERRNO == EPIPE) { /* - * Arrrrgh, HTTP 0/1 compatibility problem, maybe. + * Arrrrgh, HTTP 0/1 compability problem, maybe. */ if (bytes <= 0) { /* @@ -601,7 +579,8 @@ PUBLIC int HTCopy ARGS4( * Treat what we've gotten already * as the complete transmission. - FM */ - CTRACE(tfp, + if (TRACE) + fprintf(stderr, "HTCopy: Unexpected server disconnect. Treating as completed.\n"); status = 0; break; @@ -620,9 +599,14 @@ PUBLIC int HTCopy ARGS4( #endif /* NOT_ASCII */ (*targetClass.put_block)(sink, input_buffer, status); + bytes += status; - HTReadProgress(bytes, anchor ? anchor->content_length : 0); - HTDisplayPartial(); + if (anchor && anchor->content_length > 0) + sprintf(line, "Read %d of %d bytes of data.", + bytes, anchor->content_length); + else + sprintf(line, "Read %d bytes of data.", bytes); + HTProgress(line); } /* next bufferload */ @@ -647,7 +631,8 @@ PUBLIC int HTFileCopy ARGS2( HTStream*, sink) { HTStreamClass targetClass; - int status, bytes; + char line[256]; + int status, bytes = 0, nreads = 0, nprogr = 0; int rv = HT_OK; /* Push the data down the stream @@ -656,15 +641,17 @@ PUBLIC int HTFileCopy ARGS2( /* Push binary from socket down sink */ - HTReadProgress(bytes = 0, 0); for (;;) { status = fread(input_buffer, 1, INPUT_BUFFER_SIZE, fp); + nreads++; if (status == 0) { /* EOF or error */ if (ferror(fp) == 0) { rv = HT_LOADED; break; } - CTRACE(tfp, "HTFormat: Read error, read returns %d\n", + if (TRACE) + fprintf(stderr, + "HTFormat: Read error, read returns %d\n", ferror(fp)); if (bytes) { rv = HT_PARTIAL_CONTENT; @@ -673,20 +660,41 @@ PUBLIC int HTFileCopy ARGS2( } break; } - (*targetClass.put_block)(sink, input_buffer, status); - bytes += status; - HTReadProgress(bytes, 0); - HTDisplayPartial(); - if (HTCheckForInterrupt()) { - _HTProgress ("Data transfer interrupted."); - if (bytes) { - rv = HT_INTERRUPTED; + bytes += status; + if (nreads >= 100) { + /* + ** Show progress messages for local files, and check for + ** user interruption. Start doing so only after a certain + ** number of reads have been done, and don't update it on + ** every read (normally reading in a local file should be + ** speedy). - KW + */ + if (nprogr == 0) { + if (bytes < 1024000) { + sprintf(line, "Read %d bytes of data.", bytes); + } else { + sprintf(line, "Read %d KB of data. %s", + bytes/1024, + "(Press 'z' if you want to abort loading.)"); + } + HTProgress(line); + if (HTCheckForInterrupt()) { + _HTProgress ("Data transfer interrupted."); + if (bytes) { + rv = HT_INTERRUPTED; + } else { + rv = -1; + } + break; + } + nprogr++; + } else if (nprogr == 25) { + nprogr = 0; } else { - rv = -1; + nprogr++; } - break; } } /* next bufferload */ @@ -707,7 +715,8 @@ PRIVATE int HTGzFileCopy ARGS2( HTStream*, sink) { HTStreamClass targetClass; - int status, bytes; + char line[256]; + int status, bytes = 0, nreads = 0, nprogr = 0; int gzerrnum; int rv = HT_OK; @@ -715,21 +724,23 @@ PRIVATE int HTGzFileCopy ARGS2( */ targetClass = *(sink->isa); /* Copy pointers to procedures */ - /* read and inflate gzip'd file, and push binary down sink + /* read and inflate gzipped file, and push binary down sink */ - HTReadProgress(bytes = 0, 0); for (;;) { status = gzread(gzfp, input_buffer, INPUT_BUFFER_SIZE); + nreads++; if (status <= 0) { /* EOF or error */ if (status == 0) { rv = HT_LOADED; break; } - CTRACE(tfp, "HTGzFileCopy: Read error, gzread returns %d\n", + if (TRACE) { + fprintf(stderr, + "HTGzFileCopy: Read error, gzread returns %d\n", status); - CTRACE(tfp, "gzerror : %s\n", + fprintf(stderr, + "gzerror : %s\n", gzerror(gzfp, &gzerrnum)); - if (TRACE) { if (gzerrnum == Z_ERRNO) perror("gzerror "); } @@ -740,20 +751,42 @@ PRIVATE int HTGzFileCopy ARGS2( } break; } - (*targetClass.put_block)(sink, input_buffer, status); - bytes += status; - HTReadProgress(bytes, -1); - HTDisplayPartial(); - if (HTCheckForInterrupt()) { - _HTProgress ("Data transfer interrupted."); - if (bytes) { - rv = HT_INTERRUPTED; + bytes += status; + if (nreads >= 100) { + /* + ** Show progress messages for local files, and check for + ** user interruption. Start doing so only after a certain + ** number of reads have been done, and don't update it on + ** every read (normally reading in a local file should be + ** speedy). - KW + */ + if (nprogr == 0) { + if (bytes < 1024000) { + sprintf(line, + "Read %d uncompressed bytes of data.", bytes); + } else { + sprintf(line, "Read %d uncompressed KB of data. %s", + bytes/1024, + "(Press 'z' to abort.)"); + } + HTProgress(line); + if (HTCheckForInterrupt()) { + _HTProgress ("Data transfer interrupted."); + if (bytes) { + rv = HT_INTERRUPTED; + } else { + rv = -1; + } + break; + } + nprogr++; + } else if (nprogr == 25) { + nprogr = 0; } else { - rv = -1; + nprogr++; } - break; } } /* next bufferload */ @@ -829,7 +862,8 @@ PUBLIC int HTParseSocket ARGS5( } sprintf(buffer, "Sorry, can't convert from %s to %s.", HTAtom_name(rep_in), HTAtom_name(format_out)); - CTRACE(tfp, "HTFormat: %s\n", buffer); + if (TRACE) + fprintf(stderr, "HTFormat: %s\n", buffer); return HTLoadError(sink, 501, buffer); /* returns -501 */ } @@ -877,7 +911,8 @@ PUBLIC int HTParseFile ARGS5( } sprintf(buffer, "Sorry, can't convert from %s to %s.", HTAtom_name(rep_in), HTAtom_name(format_out)); - CTRACE(tfp, "HTFormat(in HTParseFile): %s\n", buffer); + if (TRACE) + fprintf(stderr, "HTFormat(in HTParseFile): %s\n", buffer); return HTLoadError(sink, 501, buffer); } @@ -915,7 +950,7 @@ PRIVATE int HTCloseGzFile ARGS1( if (gzres == Z_ERRNO) { perror("gzclose "); } else if (gzres != Z_OK) { - CTRACE(tfp, "gzclose : error number %d\n", gzres); + fprintf(stderr, "gzclose : error number %d\n", gzres); } } return(gzres); @@ -938,6 +973,7 @@ PUBLIC int HTParseGzFile ARGS5( if (!stream) { char buffer[1024]; /* @@@@@@@@ */ + extern char LYCancelDownload; HTCloseGzFile(gzfp); if (LYCancelDownload) { LYCancelDownload = FALSE; @@ -945,7 +981,8 @@ PUBLIC int HTParseGzFile ARGS5( } sprintf(buffer, "Sorry, can't convert from %s to %s.", HTAtom_name(rep_in), HTAtom_name(format_out)); - CTRACE(tfp, "HTFormat(in HTParseGzFile): %s\n", buffer); + if (TRACE) + fprintf(stderr, "HTFormat(in HTParseGzFile): %s\n", buffer); return HTLoadError(sink, 501, buffer); } diff --git a/WWW/Library/Implementation/HTFormat.h b/WWW/Library/Implementation/HTFormat.h index 0e5c4634..866174a9 100644 --- a/WWW/Library/Implementation/HTFormat.h +++ b/WWW/Library/Implementation/HTFormat.h @@ -14,6 +14,9 @@ Preamble #ifndef HTFORMAT_H #define HTFORMAT_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTStream.h> #include <HTAtom.h> #include <HTList.h> diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index d6790693..e168ac8e 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -16,6 +16,7 @@ */ #include <HTUtils.h> /* Coding convention macros */ +#include <tcp.h> #include <HTAlert.h> #include <HTParse.h> #include <HTTCP.h> @@ -26,6 +27,8 @@ */ #include <HTGopher.h> +#define HT_EM_SPACE ((char)2) /* For now */ + #define GOPHER_PORT 70 /* See protocol spec */ #define CSO_PORT 105 /* See protocol spec */ #define BIG 1024 /* Bug */ @@ -58,17 +61,19 @@ #define GOPHER_PLUS_SOUND '<' #define GOPHER_PLUS_PDF 'P' +#include <ctype.h> + #include <HTParse.h> #include <HTFormat.h> #include <HTTCP.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* ** Hypertext object building machinery. */ #include <HTML.h> -#include <LYStrings.h> -#include <LYUtils.h> #include <LYLeaks.h> #define PUTC(c) (*targetClass.put_character)(target, c) @@ -191,7 +196,8 @@ PRIVATE void write_anchor ARGS2(CONST char *,text, CONST char *,addr) present[HTML_A_TITLE] = YES; ((CONST char **)value)[HTML_A_TITLE] = text; - CTRACE(tfp,"HTGopher: adding URL: %s\n",addr); + if(TRACE) + fprintf(stderr,"HTGopher: adding URL: %s\n",addr); HT_Is_Gopher_URL = TRUE; /* tell HTML.c that this is a Gopher URL */ (*targetClass.start_element)(target, HTML_A, present, @@ -252,7 +258,9 @@ PRIVATE void parse_menu ARGS2( while ((ch=NEXT_CHAR) != (char)EOF) { if (interrupted_in_htgetcharacter) { - CTRACE(tfp, "HTGopher: Interrupted in HTGetCharacter, apparently.\n"); + if (TRACE) + fprintf(stderr, + "HTGopher: Interrupted in HTGetCharacter, apparently.\n"); goto end_html; } @@ -265,7 +273,8 @@ PRIVATE void parse_menu ARGS2( bytes += p-line; /* add size */ p = line; /* Scan it to parse it */ port = 0; /* Flag "not parsed" */ - CTRACE(tfp, "HTGopher: Menu item: %s\n", line); + if (TRACE) + fprintf(stderr, "HTGopher: Menu item: %s\n", line); gtype = *p++; if (bytes > BytesReported + 1024) { @@ -419,7 +428,8 @@ PRIVATE void parse_menu ARGS2( else PUTS(name); } else { /* parse error */ - CTRACE(tfp, "HTGopher: Bad menu item.\n"); + if (TRACE) + fprintf(stderr, "HTGopher: Bad menu item.\n"); PUTS(line); } /* parse error */ @@ -879,6 +889,7 @@ PRIVATE int interpret_cso_key ARGS5( PRIVATE int parse_cso_field_info ARGS1( CSOfield_info *, blk) { + int i; char *info, *max_spec; /* @@ -892,7 +903,8 @@ PRIVATE int parse_cso_field_info ARGS1( ** are converted to all lower-case for comparison. */ info = blk->attributes; - LYLowerCase(info); + for (i = 0; info[i]; i++) + info[i] = TOLOWER(info[i]); if (strstr(info, "indexed ")) blk->indexed = 1; if (strstr(info, "default ")) @@ -938,7 +950,10 @@ PRIVATE int parse_cso_fields ARGS2( */ while ((ch = NEXT_CHAR) != (char)EOF) { if (interrupted_in_htgetcharacter) { - CTRACE(tfp, "HTLoadCSO: Interrupted in HTGetCharacter, apparently.\n"); + if (TRACE) { + fprintf(stderr, + "HTLoadCSO: Interrupted in HTGetCharacter, apparently.\n"); + } free_CSOfields(); buf[0] = '\0'; return HT_INTERRUPTED; @@ -1239,7 +1254,10 @@ PRIVATE int generate_cso_report ARGS2( while (!stop && (ch = NEXT_CHAR) != (char)EOF) { if (interrupted_in_htgetcharacter) { buf[0] = '\0'; - CTRACE(tfp, "HTLoadCSO: Interrupted in HTGetCharacter, apparently.\n"); + if (TRACE) { + fprintf(stderr, + "HTLoadCSO: Interrupted in HTGetCharacter, apparently.\n"); + } _HTProgress ("Connection interrupted."); goto end_CSOreport; } @@ -1481,7 +1499,8 @@ PRIVATE int HTLoadCSO ARGS4( return -3; /* Bad if no name sepcified */ if (!*arg) return -2; /* Bad if name had zero length */ - CTRACE(tfp, "HTLoadCSO: Looking for %s\n", arg); + if (TRACE) + fprintf(stderr, "HTLoadCSO: Looking for %s\n", arg); /* ** Set up a socket to the server for the data. @@ -1491,12 +1510,16 @@ PRIVATE int HTLoadCSO ARGS4( /* ** Interrupt cleanly. */ - CTRACE(tfp, "HTLoadCSO: Interrupted on connect; recovering cleanly.\n"); + if (TRACE) + fprintf(stderr, + "HTLoadCSO: Interrupted on connect; recovering cleanly.\n"); _HTProgress ("Connection interrupted."); return HT_NOT_LOADED; } if (status < 0) { - CTRACE(tfp, "HTLoadCSO: Unable to connect to remote host for `%s'.\n", + if (TRACE) + fprintf(stderr, + "HTLoadCSO: Unable to connect to remote host for `%s'.\n", arg); return HTInetStatus("connect"); } @@ -1506,13 +1529,16 @@ PRIVATE int HTLoadCSO ARGS4( if ((command = (char *)malloc(12)) == NULL) outofmem(__FILE__, "HTLoadCSO"); sprintf(command, "fields%c%c", CR, LF); - CTRACE(tfp, "HTLoadCSO: Connected, writing command `%s' to socket %d\n", + if (TRACE) + fprintf(stderr, + "HTLoadCSO: Connected, writing command `%s' to socket %d\n", command, s); _HTProgress ("Sending CSO/PH request."); status = NETWRITE(s, command, (int)strlen(command)); FREE(command); if (status < 0) { - CTRACE(tfp, "HTLoadCSO: Unable to send command.\n"); + if (TRACE) + fprintf(stderr, "HTLoadCSO: Unable to send command.\n"); return HTInetStatus("send"); } _HTProgress ("CSO/PH request sent; waiting for response."); @@ -1689,12 +1715,15 @@ PRIVATE int HTLoadCSO ARGS4( (*Target->isa->put_block)(Target, command, clen); strcpy(buf, "</H2>\n"); (*Target->isa->put_block)(Target, buf, strlen(buf)); - CTRACE(tfp, "HTLoadCSO: Writing command `%s' to socket %d\n", + if (TRACE) + fprintf(stderr, + "HTLoadCSO: Writing command `%s' to socket %d\n", command, s); status = NETWRITE(s, command, clen); FREE(command); if (status < 0) { - CTRACE(tfp, "HTLoadCSO: Unable to send command.\n"); + if (TRACE) + fprintf(stderr, "HTLoadCSO: Unable to send command.\n"); free_CSOfields(); return HTInetStatus("send"); } @@ -1732,7 +1761,8 @@ PRIVATE int HTLoadGopher ARGS4( return -3; /* Bad if no name sepcified */ if (!*arg) return -2; /* Bad if name had zero length */ - CTRACE(tfp, "HTGopher: Looking for %s\n", arg); + if (TRACE) + fprintf(stderr, "HTGopher: Looking for %s\n", arg); /* ** If it's a port 105 GOPHER_CSO gtype with no ISINDEX token ('?'), @@ -1745,7 +1775,8 @@ PRIVATE int HTLoadGopher ARGS4( if ((len = strlen(arg)) > 5) { if (0 == strcmp((CONST char *)&arg[len-6], ":105/2")) { /* Use CSO gateway. */ - CTRACE(tfp, "HTGopher: Passing to CSO/PH gateway.\n"); + if (TRACE) + fprintf(stderr, "HTGopher: Passing to CSO/PH gateway.\n"); return HTLoadCSO(arg, anAnchor, format_out, sink); } } @@ -1755,7 +1786,8 @@ PRIVATE int HTLoadGopher ARGS4( ** If it's a port 79/0[/...] URL, use the finger gateway. - FM */ if (strstr(arg, ":79/0") != NULL) { - CTRACE(tfp, "HTGopher: Passing to finger gateway.\n"); + if (TRACE) + fprintf(stderr, "HTGopher: Passing to finger gateway.\n"); return HTLoadFinger(arg, anAnchor, format_out, sink); } @@ -1852,13 +1884,17 @@ PRIVATE int HTLoadGopher ARGS4( /* ** Interrupt cleanly. */ - CTRACE(tfp, "HTGopher: Interrupted on connect; recovering cleanly.\n"); + if (TRACE) + fprintf(stderr, + "HTGopher: Interrupted on connect; recovering cleanly.\n"); _HTProgress ("Connection interrupted."); FREE(command); return HT_NOT_LOADED; } if (status < 0) { - CTRACE(tfp, "HTGopher: Unable to connect to remote host for `%s'.\n", + if (TRACE) + fprintf(stderr, + "HTGopher: Unable to connect to remote host for `%s'.\n", arg); FREE(command); return HTInetStatus("connect"); @@ -1866,7 +1902,9 @@ PRIVATE int HTLoadGopher ARGS4( HTInitInput(s); /* Set up input buffering */ - CTRACE(tfp, "HTGopher: Connected, writing command `%s' to socket %d\n", + if (TRACE) + fprintf(stderr, + "HTGopher: Connected, writing command `%s' to socket %d\n", command, s); #ifdef NOT_ASCII @@ -1883,7 +1921,8 @@ PRIVATE int HTLoadGopher ARGS4( status = NETWRITE(s, command, (int)strlen(command)); FREE(command); if (status < 0) { - CTRACE(tfp, "HTGopher: Unable to send command.\n"); + if (TRACE) + fprintf(stderr, "HTGopher: Unable to send command.\n"); return HTInetStatus("send"); } diff --git a/WWW/Library/Implementation/HTGroup.c b/WWW/Library/Implementation/HTGroup.c index a1b6fa4a..d48c298d 100644 --- a/WWW/Library/Implementation/HTGroup.c +++ b/WWW/Library/Implementation/HTGroup.c @@ -42,8 +42,9 @@ */ -#include <HTUtils.h> +#include <HTUtils.h> +#include <string.h> #include <HTAAUtil.h> #include <HTLex.h> /* Lexical analysor */ #include <HTGroup.h> /* Implemented here */ @@ -81,7 +82,8 @@ PRIVATE void syntax_error ARGS3(FILE *, fp, if (cnt < 40) buffer[cnt++] = ch; buffer[cnt] = (char)0; - CTRACE(tfp, "%s %d before: '%s'\nHTGroup.c: %s (got %s)\n", + if (TRACE) + fprintf(stderr, "%s %d before: '%s'\nHTGroup.c: %s (got %s)\n", "HTGroup.c: Syntax error in rule file at line", HTlex_line, buffer, msg, lex_verbose(lex_item)); HTlex_line++; @@ -395,7 +397,7 @@ PRIVATE GroupDefList *parse_group_file ARGS1(FILE *, fp) PRIVATE void print_item ARGS1(Item *, item) { if (!item) - fprintf(tfp, "\tNULL-ITEM\n"); + fprintf(stderr, "\tNULL-ITEM\n"); else { UserDefList *cur1 = item->user_def_list; AddressDefList *cur2 = item->address_def_list; @@ -403,20 +405,20 @@ PRIVATE void print_item ARGS1(Item *, item) Ref *addr_ref = (Ref*)HTList_nextObject(cur2); if (user_ref) { - fprintf(tfp, "\t[%s%s", user_ref->name, + fprintf(stderr, "\t[%s%s", user_ref->name, (user_ref->translation ? "*REF*" : "")); while (NULL != (user_ref = (Ref*)HTList_nextObject(cur1))) - fprintf(tfp, "; %s%s", user_ref->name, + fprintf(stderr, "; %s%s", user_ref->name, (user_ref->translation ? "*REF*" : "")); - fprintf(tfp, "] "); - } else fprintf(tfp, "\tANYBODY "); + fprintf(stderr, "] "); + } else fprintf(stderr, "\tANYBODY "); if (addr_ref) { - fprintf(tfp, "@ [%s", addr_ref->name); + fprintf(stderr, "@ [%s", addr_ref->name); while (NULL != (addr_ref = (Ref*)HTList_nextObject(cur2))) - fprintf(tfp, "; %s", addr_ref->name); - fprintf(tfp, "]\n"); - } else fprintf(tfp, "@ ANYADDRESS\n"); + fprintf(stderr, "; %s", addr_ref->name); + fprintf(stderr, "]\n"); + } else fprintf(stderr, "@ ANYADDRESS\n"); } } @@ -427,7 +429,7 @@ PRIVATE void print_item_list ARGS1(ItemList *, item_list) Item *item; if (!item_list) - fprintf(tfp, "EMPTY"); + fprintf(stderr, "EMPTY"); else while (NULL != (item = (Item*)HTList_nextObject(cur))) print_item(item); } @@ -436,15 +438,15 @@ PRIVATE void print_item_list ARGS1(ItemList *, item_list) PUBLIC void HTAA_printGroupDef ARGS1(GroupDef *, group_def) { if (!group_def) { - fprintf(tfp, "\nNULL RECORD\n"); + fprintf(stderr, "\nNULL RECORD\n"); return; } - fprintf(tfp, "\nGroup %s:\n", + fprintf(stderr, "\nGroup %s:\n", (group_def->group_name ? group_def->group_name : "NULL")); print_item_list(group_def->item_list); - fprintf(tfp, "\n"); + fprintf(stderr, "\n"); } @@ -481,7 +483,6 @@ PRIVATE BOOL part_match ARGS2(CONST char *, tcur, char actual[4]; CONST char *cur; int cnt; - BOOL status; if (!tcur || !icur) return NO; @@ -497,11 +498,14 @@ PRIVATE BOOL part_match ARGS2(CONST char *, tcur, actual[cnt++] = *(cur++); actual[cnt] = (char)0; - status = HTAA_templateMatch(required, actual); - CTRACE(tfp, "part_match: req: '%s' act: '%s' match: %s\n", + if (TRACE) { + BOOL status = HTAA_templateMatch(required, actual); + fprintf(stderr, "part_match: req: '%s' act: '%s' match: %s\n", required, actual, (status ? "yes" : "no")); + return status; + } - return status; + return HTAA_templateMatch(required, actual); } @@ -652,21 +656,21 @@ PUBLIC GroupDefList *HTAA_readGroupFile ARGS1(CONST char *, filename) while (NULL != (group_cache = (GroupCache*)HTList_nextObject(cur))) { if (!strcmp(filename, group_cache->group_filename)) { - CTRACE(tfp, "%s '%s' %s\n", - "HTAA_readGroupFile: group file", - filename, "already found in cache"); + if (TRACE) fprintf(stderr, "%s '%s' %s\n", + "HTAA_readGroupFile: group file", + filename, "already found in cache"); return group_cache->group_list; } /* if cache match */ } /* while cached files remain */ } /* cache exists */ - CTRACE(tfp, "HTAA_readGroupFile: reading group file `%s'\n", - filename); + if (TRACE) fprintf(stderr, "HTAA_readGroupFile: reading group file `%s'\n", + filename); if (!(fp = fopen(filename, "r"))) { - CTRACE(tfp, "%s '%s'\n", - "HTAA_readGroupFile: unable to open group file", - filename); + if (TRACE) fprintf(stderr, "%s '%s'\n", + "HTAA_readGroupFile: unable to open group file", + filename); return NULL; } @@ -679,9 +683,10 @@ PUBLIC GroupDefList *HTAA_readGroupFile ARGS1(CONST char *, filename) HTList_addObject(group_cache_list, (void*)group_cache); fclose(fp); - CTRACE(tfp, "Read group file '%s', results follow:\n", filename); - if (TRACE) + if (TRACE) { + fprintf(stderr, "Read group file '%s', results follow:\n", filename); print_group_def_list(group_cache->group_list); + } return group_cache->group_list; } diff --git a/WWW/Library/Implementation/HTGroup.h b/WWW/Library/Implementation/HTGroup.h index c578d3c3..398aa0bf 100644 --- a/WWW/Library/Implementation/HTGroup.h +++ b/WWW/Library/Implementation/HTGroup.h @@ -5,6 +5,9 @@ #ifndef HTGROUP_H #define HTGROUP_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTList.h> #ifdef SHORT_NAMES diff --git a/WWW/Library/Implementation/HTHistory.c b/WWW/Library/Implementation/HTHistory.c index fab1edc5..232e4341 100644 --- a/WWW/Library/Implementation/HTHistory.c +++ b/WWW/Library/Implementation/HTHistory.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> /* for standard io */ #include <HTHistory.h> @@ -70,9 +71,10 @@ HTAnchor * HTHistory_moveBy } return destination; } else { - CTRACE(tfp, "HTHistory_moveBy: offset by %+d goes out of list %p.\n", - offset, (void*)kids); - return NULL; + if (TRACE) fprintf(stderr, + "HTHistory_moveBy: offset by %+d goes out of list %p.\n", + offset, (void*)kids); + return NULL; } } else { /* Was a parent */ return NULL; /* FIXME we could possibly follow the next link... */ @@ -146,11 +148,10 @@ int HTHistory_count */ void HTHistory_leavingFrom - ARGS1 (HTAnchor *,anchor) + ARGS1 (HTAnchor *,anchor) { - if (HTList_removeLastObject (history)) { - HTList_addObject (history, anchor); - } else { - CTRACE(tfp, "HTHistory_leavingFrom: empty history !\n"); - } + if (HTList_removeLastObject (history)) + HTList_addObject (history, anchor); + else + if (TRACE) fprintf(stderr, "HTHistory_leavingFrom: empty history !\n"); } diff --git a/WWW/Library/Implementation/HTInit.c b/WWW/Library/Implementation/HTInit.c new file mode 100644 index 00000000..d367ca06 --- /dev/null +++ b/WWW/Library/Implementation/HTInit.c @@ -0,0 +1,176 @@ +/* Configuration-specific Initialialization HTInit.c +** ---------------------------------------- +*/ + +/* Define a basic set of suffixes and presentations +** ------------------------------------------------ +** +*/ + +#include <HTUtils.h> + +/* Implements: +*/ +#include <HTInit.h> + +#include <HTML.h> +#include <HTPlain.h> +#include <HTMLGen.h> +#include <HTFile.h> +#include <HTFormat.h> +#include <HTMIME.h> +#include <HTWSRC.h> +#include <HTFWriter.h> + +#include <LYLeaks.h> + +PUBLIC void HTFormatInit NOARGS +{ +#ifdef NeXT + HTSetPresentation("application/postscript", "open %s", 1.0, 2.0, 0.0, 0); + /* The following needs the GIF previewer -- you might not have it. */ + HTSetPresentation("image/gif", "open %s", 0.3, 2.0, 0.0, 0); + HTSetPresentation("image/x-tiff", "open %s", 1.0, 2.0, 0.0, 0); + HTSetPresentation("audio/basic", "open %s", 1.0, 2.0, 0.0, 0); + HTSetPresentation("*", "open %s", 1.0, 0.0, 0.0, 0); +#else + if (getenv("DISPLAY")) { /* Must have X11 */ + HTSetPresentation("application/postscript", "ghostview %s", + 1.0, 3.0, 0.0, 0); + HTSetPresentation("image/gif", "xv %s", 1.0, 3.0, 0.0, 0); + HTSetPresentation("image/x-tiff", "xv %s", 1.0, 3.0, 0.0, 0); + HTSetPresentation("image/jpeg", "xv %s", 1.0, 3.0, 0.0, 0); + } +#endif + HTSetConversion("www/mime", "*", HTMIMEConvert, + 1.0, 0.0, 0.0, 0); + HTSetConversion("application/x-wais-source","*", HTWSRCConvert, + 1.0, 0.0, 0.0, 0); + HTSetConversion("text/html", "text/x-c", HTMLToC, + 0.5, 0.0, 0.0, 0); + HTSetConversion("text/html", "text/plain", HTMLToPlain, + 0.5, 0.0, 0.0, 0); + HTSetConversion("text/html", "www/present", HTMLPresent, + 1.0, 0.0, 0.0, 0); + HTSetConversion("text/plain", "text/html", HTPlainToHTML, + 1.0, 0.0, 0.0, 0); + HTSetConversion("text/plain", "www/present", HTPlainPresent, + 1.0, 0.0, 0.0, 0); + HTSetConversion("application/octet-stream", "www/present", HTSaveLocally, + 0.1, 0.0, 0.0, 0); + HTSetConversion("www/unknown", "www/present", HTSaveLocally, + 0.3, 0.0, 0.0, 0); + HTSetConversion("www/source", "www/present", HTSaveLocally, + 0.3, 0.0, 0.0, 0); +} + + + +/* Define a basic set of suffixes +** ------------------------------ +** +** The LAST suffix for a type is that used for temporary files +** of that type. +** The quality is an apriori bias as to whether the file should be +** used. Not that different suffixes can be used to represent files +** which are of the same format but are originals or regenerated, +** with different values. +*/ + +#ifndef NO_INIT +PUBLIC void HTFileInit NOARGS +{ + /* Suffix Contenet-Type Content-Encoding Quality */ + + HTSetSuffix(".mime", "www/mime", "8bit", 1.0); /* Internal -- MIME is */ + /* not recursive */ + HTSetSuffix(".bin", "application/octet-stream", "binary", 1.0); /* Uninterpreted binary */ + HTSetSuffix(".oda", "application/oda", "binary", 1.0); + HTSetSuffix(".pdf", "application/pdf", "binary", 1.0); + HTSetSuffix(".ai", "application/postscript", "8bit", 0.5); /* Adobe Illustrator */ + HTSetSuffix(".PS", "application/postscript", "8bit", 0.8); /* PostScript */ + HTSetSuffix(".eps", "application/postscript", "8bit", 0.8); + HTSetSuffix(".ps", "application/postscript", "8bit", 0.8); + HTSetSuffix(".rtf", "application/x-rtf", "7bit", 1.0); /* RTF */ + HTSetSuffix(".Z", "application/x-compressed", "binary", 1.0); /* Compressed data */ + HTSetSuffix(".csh", "application/x-csh", "7bit", 0.5); /* C-shell script */ + HTSetSuffix(".dvi", "application/x-dvi", "binary", 1.0); /* TeX DVI */ + HTSetSuffix(".hdf", "application/x-hdf", "binary", 1.0); /* NCSA HDF data file */ + HTSetSuffix(".latex", "application/x-latex", "8bit", 1.0); /* LaTeX source */ + HTSetSuffix(".nc", "application/x-netcdf", "binary", 1.0); /* Unidata netCDF data */ + HTSetSuffix(".cdf", "application/x-netcdf", "binary", 1.0); + HTSetSuffix(".sh", "application/x-sh", "7bit", 0.5); /* Shell-script */ + HTSetSuffix(".tcl", "application/x-tcl", "7bit", 0.5); /* TCL-script */ + HTSetSuffix(".tex", "application/x-tex", "8bit", 1.0); /* TeX source */ + HTSetSuffix(".texi", "application/x-texinfo", "7bit", 1.0); /* Texinfo */ + HTSetSuffix(".texinfo","application/x-texinfo", "7bit", 1.0); + HTSetSuffix(".t", "application/x-troff", "7bit", 0.5); /* Troff */ + HTSetSuffix(".roff", "application/x-troff", "7bit", 0.5); + HTSetSuffix(".tr", "application/x-troff", "7bit", 0.5); + HTSetSuffix(".man", "application/x-troff-man", "7bit", 0.5); /* Troff with man macros*/ + HTSetSuffix(".me", "application/x-troff-me", "7bit", 0.5); /* Troff with me macros */ + HTSetSuffix(".ms", "application/x-troff-ms", "7bit", 0.5); /* Troff with ms macros */ + HTSetSuffix(".src", "application/x-wais-source", "7bit", 1.0); /* WAIS source */ + HTSetSuffix(".zip", "application/zip", "binary", 1.0); /* PKZIP */ + HTSetSuffix(".bcpio", "application/x-bcpio", "binary", 1.0); /* Old binary CPIO */ + HTSetSuffix(".cpio", "application/x-cpio", "binary", 1.0); /* POSIX CPIO */ + HTSetSuffix(".gtar", "application/x-gtar", "binary", 1.0); /* Gnu tar */ + HTSetSuffix(".shar", "application/x-shar", "8bit", 1.0); /* Shell archive */ + HTSetSuffix(".sv4cpio","application/x-sv4cpio", "binary", 1.0); /* SVR4 CPIO */ + HTSetSuffix(".sv4crc", "application/x-sv4crc", "binary", 1.0); /* SVR4 CPIO with CRC */ + HTSetSuffix(".tar", "application/x-tar", "binary", 1.0); /* 4.3BSD tar */ + HTSetSuffix(".ustar", "application/x-ustar", "binary", 1.0); /* POSIX tar */ + HTSetSuffix(".snd", "audio/basic", "binary", 1.0); /* Audio */ + HTSetSuffix(".au", "audio/basic", "binary", 1.0); + HTSetSuffix(".aiff", "audio/x-aiff", "binary", 1.0); + HTSetSuffix(".aifc", "audio/x-aiff", "binary", 1.0); + HTSetSuffix(".aif", "audio/x-aiff", "binary", 1.0); + HTSetSuffix(".wav", "audio/x-wav", "binary", 1.0); /* Windows+ WAVE format */ + HTSetSuffix(".gif", "image/gif", "binary", 1.0); /* GIF */ + HTSetSuffix(".ief", "image/ief", "binary", 1.0); /* Image Exchange fmt */ + HTSetSuffix(".jpg", "image/jpeg", "binary", 1.0); /* JPEG */ + HTSetSuffix(".JPG", "image/jpeg", "binary", 1.0); + HTSetSuffix(".JPE", "image/jpeg", "binary", 1.0); + HTSetSuffix(".jpe", "image/jpeg", "binary", 1.0); + HTSetSuffix(".JPEG", "image/jpeg", "binary", 1.0); + HTSetSuffix(".jpeg", "image/jpeg", "binary", 1.0); + HTSetSuffix(".tif", "image/tiff", "binary", 1.0); /* TIFF */ + HTSetSuffix(".tiff", "image/tiff", "binary", 1.0); + HTSetSuffix(".ras", "image/cmu-raster", "binary", 1.0); + HTSetSuffix(".pnm", "image/x-portable-anymap", "binary", 1.0); /* PBM Anymap format */ + HTSetSuffix(".pbm", "image/x-portable-bitmap", "binary", 1.0); /* PBM Bitmap format */ + HTSetSuffix(".pgm", "image/x-portable-graymap", "binary", 1.0); /* PBM Graymap format */ + HTSetSuffix(".ppm", "image/x-portable-pixmap", "binary", 1.0); /* PBM Pixmap format */ + HTSetSuffix(".rgb", "image/x-rgb", "binary", 1.0); + HTSetSuffix(".xbm", "image/x-xbitmap", "binary", 1.0); /* X bitmap */ + HTSetSuffix(".xpm", "image/x-xpixmap", "binary", 1.0); /* X pixmap format */ + HTSetSuffix(".xwd", "image/x-xwindowdump", "binary", 1.0); /* X window dump (xwd) */ + HTSetSuffix(".html", "text/html", "8bit", 1.0); /* HTML */ + HTSetSuffix(".c", "text/plain", "7bit", 0.5); /* C source */ + HTSetSuffix(".h", "text/plain", "7bit", 0.5); /* C headers */ + HTSetSuffix(".C", "text/plain", "7bit", 0.5); /* C++ source */ + HTSetSuffix(".cc", "text/plain", "7bit", 0.5); /* C++ source */ + HTSetSuffix(".hh", "text/plain", "7bit", 0.5); /* C++ headers */ + HTSetSuffix(".m", "text/plain", "7bit", 0.5); /* Objective-C source */ + HTSetSuffix(".f90", "text/plain", "7bit", 0.5); /* Fortran 90 source */ + HTSetSuffix(".txt", "text/plain", "7bit", 0.5); /* Plain text */ + HTSetSuffix(".rtx", "text/richtext", "7bit", 1.0); /* MIME Richtext format */ + HTSetSuffix(".tsv", "text/tab-separated-values", "7bit", 1.0); /* Tab-separated values */ + HTSetSuffix(".etx", "text/x-setext", "7bit", 0.9); /* Struct Enchanced Txt */ + HTSetSuffix(".MPG", "video/mpeg", "binary", 1.0); /* MPEG */ + HTSetSuffix(".mpg", "video/mpeg", "binary", 1.0); + HTSetSuffix(".MPE", "video/mpeg", "binary", 1.0); + HTSetSuffix(".mpe", "video/mpeg", "binary", 1.0); + HTSetSuffix(".MPEG", "video/mpeg", "binary", 1.0); + HTSetSuffix(".mpeg", "video/mpeg", "binary", 1.0); + HTSetSuffix(".qt", "video/quicktime", "binary", 1.0); /* QuickTime */ + HTSetSuffix(".mov", "video/quicktime", "binary", 1.0); + HTSetSuffix(".avi", "video/x-msvideo", "binary", 1.0); /* MS Video for Windows */ + HTSetSuffix(".movie", "video/x-sgi-movie", "binary", 1.0); /* SGI "moviepalyer" */ + + HTSetSuffix("*.*", "application/octet-stream", "binary", 0.1); + HTSetSuffix("*", "text/plain", "7bit", 0.5); + +} +#endif /* NO_INIT */ + diff --git a/WWW/Library/Implementation/HTInit.h b/WWW/Library/Implementation/HTInit.h index 4785f3e8..a003a6b5 100644 --- a/WWW/Library/Implementation/HTInit.h +++ b/WWW/Library/Implementation/HTInit.h @@ -10,14 +10,14 @@ Implemented by HTInit.c by default. */ - -#ifndef HTINIT_H -#define HTINIT_H 1 - +#ifndef HTUTILS_H #include <HTUtils.h> +#endif /* HTUTILS_H */ extern void HTFormatInit NOPARAMS; extern void HTPreparsedFormatInit NOPARAMS; extern void HTFileInit NOPARAMS; -#endif /* HTINIT_H */ +/* + + */ diff --git a/WWW/Library/Implementation/HTLex.c b/WWW/Library/Implementation/HTLex.c index e7568ea6..6cffe648 100644 --- a/WWW/Library/Implementation/HTLex.c +++ b/WWW/Library/Implementation/HTLex.c @@ -14,7 +14,6 @@ */ #include <HTUtils.h> - #include <HTAAUtil.h> #include <HTLex.h> /* Implemented here */ @@ -78,14 +77,14 @@ PUBLIC LexItem lex ARGS1(FILE *, fp) else return LEX_ALPH_STR; } else switch(ch) { - case EOF: return LEX_EOF; + case EOF: return LEX_EOF; break; case '\n': - HTlex_line++; return LEX_REC_SEP; - case ':': return LEX_FIELD_SEP; - case ',': return LEX_ITEM_SEP; - case '(': return LEX_OPEN_PAREN; - case ')': return LEX_CLOSE_PAREN; - case '@': return LEX_AT_SIGN; + HTlex_line++; return LEX_REC_SEP; break; + case ':': return LEX_FIELD_SEP; break; + case ',': return LEX_ITEM_SEP; break; + case '(': return LEX_OPEN_PAREN; break; + case ')': return LEX_CLOSE_PAREN; break; + case '@': return LEX_AT_SIGN; break; default: ; /* Leading white space ignored (SP,TAB,CR) */ } break; @@ -105,28 +104,39 @@ PUBLIC char *lex_verbose ARGS1(LexItem, lex_item) switch (lex_item) { case LEX_NONE: /* Internally used */ return "NO-LEX-ITEM"; + break; case LEX_EOF: /* End of file */ return "end-of-file"; + break; case LEX_REC_SEP: /* Record separator */ return "record separator (newline)"; + break; case LEX_FIELD_SEP: /* Field separator */ return "field separator ':'"; + break; case LEX_ITEM_SEP: /* List item separator */ return "item separator ','"; + break; case LEX_OPEN_PAREN: /* Group start tag */ return "'('"; + break; case LEX_CLOSE_PAREN: /* Group end tag */ return "')'"; + break; case LEX_AT_SIGN: /* Address qualifier */ return "address qualifier '@'"; + break; case LEX_ALPH_STR: /* Alphanumeric string */ sprintf(msg, "alphanumeric string '%s'", HTlex_buffer); return msg; + break; case LEX_TMPL_STR: /* Template string */ sprintf(msg, "template string '%s'", HTlex_buffer); return msg; + break; default: return "UNKNOWN-LEX-ITEM"; + break; } } diff --git a/WWW/Library/Implementation/HTLex.h b/WWW/Library/Implementation/HTLex.h index 205d6b19..dd02c3ae 100644 --- a/WWW/Library/Implementation/HTLex.h +++ b/WWW/Library/Implementation/HTLex.h @@ -5,12 +5,16 @@ #ifndef HTLEX_H #define HTLEX_H +#ifndef HTUTILS_H #include <HTUtils.h> +#endif /* HTUTILS_H */ + #ifdef SHORT_NAMES #define lex_verb lex_verbose #endif /*SHORT_NAMES*/ + typedef enum { LEX_NONE, /* Internally used */ LEX_EOF, /* End of file */ @@ -55,3 +59,6 @@ PUBLIC char *lex_verbose PARAMS((LexItem lex_item)); */ #endif /* not HTLEX_H */ +/* + + End of file HTLex.h. */ diff --git a/WWW/Library/Implementation/HTList.c b/WWW/Library/Implementation/HTList.c index 939af95b..28958181 100644 --- a/WWW/Library/Implementation/HTList.c +++ b/WWW/Library/Implementation/HTList.c @@ -9,8 +9,13 @@ #include <HTUtils.h> #include <HTList.h> +/*#include <stdio.h> included by HTUtils.h -- FM *//* joe@athena, TBL 921019 */ + #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + + /* Create list. */ PUBLIC HTList * HTList_new NOARGS @@ -58,9 +63,10 @@ PUBLIC void HTList_addObject ARGS2( newNode->next = me->next; me->next = newNode; - } else { - CTRACE(tfp, "HTList: Trying to add object %p to a nonexisting list\n", - newObject); + } else if (TRACE) { + fprintf(stderr, + "HTList: Trying to add object %p to a nonexisting list\n", + newObject); } return; @@ -100,14 +106,20 @@ PUBLIC void HTList_insertObjectAt ARGS3( int Pos = pos; if (!temp) { - CTRACE(tfp, "HTList: Trying to add object %p to a nonexisting list\n", + if (TRACE) { + fprintf(stderr, + "HTList: Trying to add object %p to a nonexisting list\n", newObject); + } return; } if (Pos < 0) { Pos = 0; - CTRACE(tfp, "HTList: Treating negative object position %d as %d.\n", + if (TRACE) { + fprintf(stderr, + "HTList: Treating negative object position %d as %d.\n", pos, Pos); + } } prevNode = temp; diff --git a/WWW/Library/Implementation/HTList.h b/WWW/Library/Implementation/HTList.h index c02c58af..095308c1 100644 --- a/WWW/Library/Implementation/HTList.h +++ b/WWW/Library/Implementation/HTList.h @@ -7,7 +7,9 @@ #ifndef HTLIST_H #define HTLIST_H -#include <HTUtils.h> +#ifndef HTUTILS_H +#include <HTUtils.h> /* for BOOL type and PARAMS and ARGS*/ +#endif /* HTUTILS_H */ typedef struct _HTList HTList; diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c index c518cba7..44a554eb 100644 --- a/WWW/Library/Implementation/HTMIME.c +++ b/WWW/Library/Implementation/HTMIME.c @@ -19,15 +19,23 @@ #include <UCDefs.h> #include <UCAux.h> -#include <LYCookie.h> #include <LYCharSets.h> -#include <LYStrings.h> -#include <LYUtils.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + +extern CONST char *LYchar_set_names[]; +extern BOOLEAN LYRawMode; extern BOOL HTPassEightBitRaw; extern HTCJKlang HTCJK; +extern void LYSetCookie PARAMS(( + CONST char * SetCookie, + CONST char * SetCookie2, + CONST char * address)); +extern time_t LYmktime PARAMS((char *string, BOOL absolute)); + + /* MIME Object ** ----------- */ @@ -224,13 +232,17 @@ PRIVATE void HTMIME_put_character ARGS2( case 'a': case 'A': me->state = miA; - CTRACE(tfp, "HTMIME: Got 'A' at beginning of line, state now A\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Got 'A' at beginning of line, state now A\n"); break; case 'c': case 'C': me->state = miC; - CTRACE (tfp, "HTMIME: Got 'C' at beginning of line, state now C\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Got 'C' at beginning of line, state now C\n"); break; case 'd': @@ -238,13 +250,17 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ate:"; me->if_ok = miDATE; me->state = miCHECK; - CTRACE (tfp, "HTMIME: Got 'D' at beginning of line, checking for 'ate:'\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Got 'D' at beginning of line, checking for 'ate:'\n"); break; case 'e': case 'E': me->state = miE; - CTRACE (tfp, "HTMIME: Got 'E' at beginning of line, state now E\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Got 'E' at beginning of line, state now E\n"); break; case 'k': @@ -252,19 +268,25 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "eep-alive:"; me->if_ok = miKEEP_ALIVE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Got 'K' at beginning of line, checking for 'eep-alive:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Got 'K' at beginning of line, checking for 'eep-alive:'\n"); break; case 'l': case 'L': me->state = miL; - CTRACE (tfp, "HTMIME: Got 'L' at beginning of line, state now L\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Got 'L' at beginning of line, state now L\n"); break; case 'p': case 'P': me->state = miP; - CTRACE (tfp, "HTMIME: Got 'P' at beginning of line, state now P\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Got 'P' at beginning of line, state now P\n"); break; case 'r': @@ -272,37 +294,49 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "etry-after:"; me->if_ok = miRETRY_AFTER; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Got 'R' at beginning of line, checking for 'etry-after'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Got 'R' at beginning of line, checking for 'etry-after'\n"); break; case 's': case 'S': me->state = miS; - CTRACE (tfp, "HTMIME: Got 'S' at beginning of line, state now S\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Got 'S' at beginning of line, state now S\n"); break; case 't': case 'T': me->state = miT; - CTRACE (tfp, "HTMIME: Got 'T' at beginning of line, state now T\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Got 'T' at beginning of line, state now T\n"); break; case 'u': case 'U': me->state = miU; - CTRACE (tfp, "HTMIME: Got 'U' at beginning of line, state now U\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Got 'U' at beginning of line, state now U\n"); break; case 'v': case 'V': me->state = miV; - CTRACE (tfp, "HTMIME: Got 'V' at beginning of line, state now V\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Got 'V' at beginning of line, state now V\n"); break; case 'w': case 'W': me->state = miW; - CTRACE (tfp, "HTMIME: Got 'W' at beginning of line, state now W\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Got 'W' at beginning of line, state now W\n"); break; case '\n': /* Blank line: End of Header! */ @@ -311,7 +345,9 @@ PRIVATE void HTMIME_put_character ARGS2( if (strchr(HTAtom_name(me->format), ';') != NULL) { char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4; - CTRACE(tfp, "HTMIME: Extended MIME Content-Type is %s\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Extended MIME Content-Type is %s\n", HTAtom_name(me->format)); StrAllocCopy(cp, HTAtom_name(me->format)); /* @@ -323,7 +359,8 @@ PRIVATE void HTMIME_put_character ARGS2( ** we'll make sure they're still gone from any ** charset parameter we check. - FM */ - LYLowerCase(cp); + for (i = 0; cp[i]; i++) + cp[i] = TOLOWER(cp[i]); if ((cp1 = strchr(cp, ';')) != NULL) { BOOL chartrans_ok = NO; if ((cp2 = strstr(cp1, "charset")) != NULL) { @@ -353,13 +390,6 @@ PRIVATE void HTMIME_put_character ARGS2( else if (chndl < 0) {/* got something but we don't recognize it */ chndl = UCLYhndl_for_unrec; - if (chndl < 0) - /* - ** UCLYhndl_for_unrec not defined :-( - ** fallback to UCLYhndl_for_unspec - ** which always valid. - */ - chndl = UCLYhndl_for_unspec; /* always >= 0 */ if (UCCanTranslateFromTo(chndl, current_char_set)) { chartrans_ok = YES; @@ -414,9 +444,46 @@ PRIVATE void HTMIME_put_character ARGS2( HTPassEightBitRaw = TRUE; } } else if (p_out->enc == UCT_ENC_CJK) { - Set_HTCJK(p_in->MIMEname, p_out->MIMEname); + if (LYRawMode) { + if ((!strcmp(p_in->MIMEname, + "euc-jp") || + !strcmp(p_in->MIMEname, + "shift_jis")) && + (!strcmp(p_out->MIMEname, + "euc-jp") || + !strcmp(p_out->MIMEname, + "shift_jis"))) { + HTCJK = JAPANESE; + } else if (!strcmp(p_in->MIMEname, + "euc-cn") && + !strcmp(p_out->MIMEname, + "euc-cn")) { + HTCJK = CHINESE; + } else if (!strcmp(p_in->MIMEname, + "big-5") && + !strcmp(p_out->MIMEname, + "big-5")) { + HTCJK = TAIPEI; + } else if (!strcmp(p_in->MIMEname, + "euc-kr") && + !strcmp(p_out->MIMEname, + "euc-kr")) { + HTCJK = KOREAN; + } else { + HTCJK = NOCJK; + } + } else { + HTCJK = NOCJK; + } } - } else { + /* + ** Check for an iso-8859-# we don't know. - FM + */ + } else if + (!strncmp(cp4, "iso-8859-", 9) && + isdigit((unsigned char)cp4[9]) && + !strncmp(LYchar_set_names[current_char_set], + "Other ISO Latin", 15)) { /* ** Hope it's a match, for now. - FM */ @@ -479,17 +546,26 @@ PRIVATE void HTMIME_put_character ARGS2( StrAllocCopy(me->anchor->content_type, HTAtom_name(me->format)); if (!me->compression_encoding) { - CTRACE(tfp, "HTMIME: MIME Content-Type is '%s', converting to '%s'\n", - HTAtom_name(me->format), HTAtom_name(me->targetRep)); + if (TRACE) { + fprintf(stderr, + "HTMIME: MIME Content-Type is '%s', converting to '%s'\n", + HTAtom_name(me->format), HTAtom_name(me->targetRep)); + } } else { /* ** Change the format to that for "www/compressed" ** and set up a stream to deal with it. - FM */ - CTRACE(tfp, "HTMIME: MIME Content-Type is '%s',\n", HTAtom_name(me->format)); + if (TRACE) { + fprintf(stderr, + "HTMIME: MIME Content-Type is '%s',\n", HTAtom_name(me->format)); + } me->format = HTAtom_for("www/compressed"); - CTRACE(tfp, " Treating as '%s'. Converting to '%s'\n", - HTAtom_name(me->format), HTAtom_name(me->targetRep)); + if (TRACE) { + fprintf(stderr, + " Treating as '%s'. Converting to '%s'\n", + HTAtom_name(me->format), HTAtom_name(me->targetRep)); + } } if (me->set_cookie != NULL || me->set_cookie2 != NULL) { LYSetCookie(me->set_cookie, @@ -501,7 +577,8 @@ PRIVATE void HTMIME_put_character ARGS2( me->target = HTStreamStack(me->format, me->targetRep, me->sink , me->anchor); if (!me->target) { - CTRACE(tfp, "HTMIME: Can't translate! ** \n"); + if (TRACE) + fprintf(stderr, "HTMIME: Can't translate! ** \n"); me->target = me->sink; /* Cheat */ } if (me->target) { @@ -521,6 +598,7 @@ PRIVATE void HTMIME_put_character ARGS2( default: goto bad_field_name; + break; } /* switch on character */ break; @@ -532,7 +610,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "cept-ranges:"; me->if_ok = miACCEPT_RANGES; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was A, found C, checking for 'cept-ranges:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was A, found C, checking for 'cept-ranges:'\n"); break; case 'g': @@ -540,19 +620,25 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "e:"; me->if_ok = miAGE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was A, found G, checking for 'e:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was A, found G, checking for 'e:'\n"); break; case 'l': case 'L': me->state = miAL; - CTRACE(tfp, "HTMIME: Was A, found L, state now AL'\n"); + if (TRACE) + fprintf(stderr, "HTMIME: Was A, found L, state now AL'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'g' or 'l'"); + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", + c, "'g' or 'l'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -564,7 +650,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ow:"; me->if_ok = miALLOW; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was AL, found L, checking for 'ow:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was AL, found L, checking for 'ow:'\n"); break; case 't': @@ -572,13 +660,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ernates:"; me->if_ok = miALTERNATES; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was AL, found T, checking for 'ernates:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was AL, found T, checking for 'ernates:'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'l' or 't'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -590,19 +683,25 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "che-control:"; me->if_ok = miCACHE_CONTROL; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was C, found A, checking for 'che-control:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was C, found A, checking for 'che-control:'\n"); break; case 'o': case 'O': me->state = miCO; - CTRACE(tfp, "HTMIME: Was C, found O, state now CO'\n"); + if (TRACE) + fprintf(stderr, "HTMIME: Was C, found O, state now CO'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a' or 'o'"); + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", + c, "'a' or 'o'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -612,7 +711,9 @@ PRIVATE void HTMIME_put_character ARGS2( case 'n': case 'N': me->state = miCON; - CTRACE(tfp, "HTMIME: Was CO, found N, state now CON\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CO, found N, state now CON\n"); break; case 'o': @@ -620,13 +721,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "kie:"; me->if_ok = miCOOKIE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CO, found O, checking for 'kie:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CO, found O, checking for 'kie:'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'n' or 'o'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -638,7 +744,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ection:"; me->if_ok = miCONNECTION; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CON, found N, checking for 'ection:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CON, found N, checking for 'ection:'\n"); break; case 't': @@ -646,13 +754,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ent-"; me->if_ok = miCONTENT_; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CON, found T, checking for 'ent-'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CON, found T, checking for 'ent-'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'n' or 't'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -664,7 +777,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ag:"; me->if_ok = miETAG; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was E, found T, checking for 'ag:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was E, found T, checking for 'ag:'\n"); break; case 'x': @@ -672,13 +787,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "pires:"; me->if_ok = miEXPIRES; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was E, found X, checking for 'pires:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was E, found X, checking for 'pires:'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'t' or 'x'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -690,7 +810,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "st-modified:"; me->if_ok = miLAST_MODIFIED; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was L, found A, checking for 'st-modified:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was L, found A, checking for 'st-modified:'\n"); break; case 'i': @@ -698,7 +820,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "nk:"; me->if_ok = miLINK; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was L, found I, checking for 'nk:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was L, found I, checking for 'nk:'\n"); break; case 'o': @@ -706,13 +830,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "cation:"; me->if_ok = miLOCATION; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was L, found O, checking for 'cation:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was L, found O, checking for 'cation:'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'a', 'i' or 'o'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -722,7 +851,8 @@ PRIVATE void HTMIME_put_character ARGS2( case 'r': case 'R': me->state = miPR; - CTRACE(tfp, "HTMIME: Was P, found R, state now PR'\n"); + if (TRACE) + fprintf(stderr, "HTMIME: Was P, found R, state now PR'\n"); break; case 'u': @@ -730,13 +860,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "blic:"; me->if_ok = miPUBLIC; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was P, found U, checking for 'blic:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was P, found U, checking for 'blic:'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'r' or 'u'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -748,7 +883,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "gma:"; me->if_ok = miPRAGMA; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was PR, found A, checking for 'gma'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was PR, found A, checking for 'gma'\n"); break; case 'o': @@ -756,13 +893,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "xy-authenticate:"; me->if_ok = miPROXY_AUTHENTICATE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was PR, found O, checking for 'xy-authenticate'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was PR, found O, checking for 'xy-authenticate'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'a' or 'o'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -774,19 +916,24 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "fe:"; me->if_ok = miSAFE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was S, found A, checking for 'fe:'\n"); + if (TRACE) + fprintf(stderr, "HTMIME: Was S, found A, checking for 'fe:'\n"); break; case 'e': case 'E': me->state = miSE; - CTRACE(tfp, "HTMIME: Was S, found E, state now SE'\n"); + if (TRACE) + fprintf(stderr, "HTMIME: Was S, found E, state now SE'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'a' or 'e'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -798,7 +945,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ver:"; me->if_ok = miSERVER; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was SE, found R, checking for 'ver'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was SE, found R, checking for 'ver'\n"); break; case 't': @@ -806,13 +955,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "-cookie"; me->if_ok = miSET_COOKIE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was SE, found T, checking for '-cookie'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was SE, found T, checking for '-cookie'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'r' or 't'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -822,20 +976,27 @@ PRIVATE void HTMIME_put_character ARGS2( case ':': me->field = miSET_COOKIE1; /* remember it */ me->state = miSKIP_GET_VALUE; - CTRACE(tfp, "HTMIME: Was SET_COOKIE, found :, processing\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was SET_COOKIE, found :, processing\n"); break; case '2': me->check_pointer = ":"; me->if_ok = miSET_COOKIE2; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was SET_COOKIE, found 2, checking for ':'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was SET_COOKIE, found 2, checking for ':'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "':' or '2'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -847,7 +1008,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "tle:"; me->if_ok = miTITLE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was T, found I, checking for 'tle:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was T, found I, checking for 'tle:'\n"); break; case 'r': @@ -855,13 +1018,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ansfer-encoding:"; me->if_ok = miTRANSFER_ENCODING; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was T, found R, checking for 'ansfer-encoding'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was T, found R, checking for 'ansfer-encoding'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'i' or 'r'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -873,7 +1041,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "grade:"; me->if_ok = miUPGRADE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was U, found P, checking for 'grade:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was U, found P, checking for 'grade:'\n"); break; case 'r': @@ -881,13 +1051,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "i:"; me->if_ok = miURI; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was U, found R, checking for 'i:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was U, found R, checking for 'i:'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'p' or 'r'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -899,7 +1074,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ry:"; me->if_ok = miVARY; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was V, found A, checking for 'ry:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was V, found A, checking for 'ry:'\n"); break; case 'i': @@ -907,13 +1084,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "a:"; me->if_ok = miVIA; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was V, found I, checking for 'a:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was V, found I, checking for 'a:'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'a' or 'i'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -925,7 +1107,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "rning:"; me->if_ok = miWARNING; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was W, found A, checking for 'rning:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was W, found A, checking for 'rning:'\n"); break; case 'w': @@ -933,13 +1117,18 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "w-authenticate:"; me->if_ok = miWWW_AUTHENTICATE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was W, found W, checking for 'w-authenticate:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was W, found W, checking for 'w-authenticate:'\n"); break; default: - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'a' or 'w'"); goto bad_field_name; + break; } /* switch on character */ break; @@ -949,22 +1138,27 @@ PRIVATE void HTMIME_put_character ARGS2( if (!*me->check_pointer) me->state = me->if_ok; } else { /* Error */ - CTRACE(tfp, "HTMIME: Bad character `%c' found where `%s' expected\n", + if (TRACE) + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", c, me->check_pointer - 1); goto bad_field_name; } break; case miCONTENT_: - CTRACE (tfp, "HTMIME: in case CONTENT_\n"); - + if (TRACE) + fprintf (stderr, + "HTMIME: in case CONTENT_\n"); switch(c) { case 'b': case 'B': me->check_pointer = "ase:"; me->if_ok = miCONTENT_BASE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_, found B, checking for 'ase:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_, found B, checking for 'ase:'\n"); break; case 'd': @@ -972,7 +1166,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "isposition:"; me->if_ok = miCONTENT_DISPOSITION; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_, found D, checking for 'isposition:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_, found D, checking for 'isposition:'\n"); break; case 'e': @@ -980,7 +1176,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ncoding:"; me->if_ok = miCONTENT_ENCODING; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_, found E, checking for 'ncoding:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_, found E, checking for 'ncoding:'\n"); break; case 'f': @@ -988,13 +1186,17 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "eatures:"; me->if_ok = miCONTENT_FEATURES; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_, found F, checking for 'eatures:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_, found F, checking for 'eatures:'\n"); break; case 'l': case 'L': me->state = miCONTENT_L; - CTRACE (tfp, "HTMIME: Was CONTENT_, found L, state now CONTENT_L\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Was CONTENT_, found L, state now CONTENT_L\n"); break; case 'm': @@ -1002,7 +1204,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "d5:"; me->if_ok = miCONTENT_MD5; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_, found M, checking for 'd5:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_, found M, checking for 'd5:'\n"); break; case 'r': @@ -1010,32 +1214,42 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ange:"; me->if_ok = miCONTENT_RANGE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_, found R, checking for 'ange:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_, found R, checking for 'ange:'\n"); break; case 't': case 'T': me->state = miCONTENT_T; - CTRACE(tfp, "HTMIME: Was CONTENT_, found T, state now CONTENT_T\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_, found T, state now CONTENT_T\n"); break; default: - CTRACE(tfp, "HTMIME: Was CONTENT_, found nothing; bleah\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_, found nothing; bleah\n"); goto bad_field_name; + break; } /* switch on character */ break; case miCONTENT_L: - CTRACE (tfp, "HTMIME: in case CONTENT_L\n"); - + if (TRACE) + fprintf (stderr, + "HTMIME: in case CONTENT_L\n"); switch(c) { case 'a': case 'A': me->check_pointer = "nguage:"; me->if_ok = miCONTENT_LANGUAGE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_L, found A, checking for 'nguage:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_L, found A, checking for 'nguage:'\n"); break; case 'e': @@ -1043,7 +1257,9 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "ngth:"; me->if_ok = miCONTENT_LENGTH; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_L, found E, checking for 'ngth:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_L, found E, checking for 'ngth:'\n"); break; case 'o': @@ -1051,26 +1267,34 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "cation:"; me->if_ok = miCONTENT_LOCATION; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_L, found O, checking for 'cation:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_L, found O, checking for 'cation:'\n"); break; default: - CTRACE (tfp, "HTMIME: Was CONTENT_L, found nothing; bleah\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Was CONTENT_L, found nothing; bleah\n"); goto bad_field_name; + break; } /* switch on character */ break; case miCONTENT_T: - CTRACE (tfp, "HTMIME: in case CONTENT_T\n"); - + if (TRACE) + fprintf (stderr, + "HTMIME: in case CONTENT_T\n"); switch(c) { case 'r': case 'R': me->check_pointer = "ansfer-encoding:"; me->if_ok = miCONTENT_TRANSFER_ENCODING; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_T, found R, checking for 'ansfer-encoding:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_T, found R, checking for 'ansfer-encoding:'\n"); break; case 'y': @@ -1078,12 +1302,17 @@ PRIVATE void HTMIME_put_character ARGS2( me->check_pointer = "pe:"; me->if_ok = miCONTENT_TYPE; me->state = miCHECK; - CTRACE(tfp, "HTMIME: Was CONTENT_T, found Y, checking for 'pe:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_T, found Y, checking for 'pe:'\n"); break; default: - CTRACE (tfp, "HTMIME: Was CONTENT_T, found nothing; bleah\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Was CONTENT_T, found nothing; bleah\n"); goto bad_field_name; + break; } /* switch on character */ break; @@ -1162,34 +1391,45 @@ PRIVATE void HTMIME_put_character ARGS2( switch (me->field) { case miACCEPT_RANGES: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Accept-Ranges: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Accept-Ranges: '%s'\n", me->value); break; case miAGE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Age: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Age: '%s'\n", me->value); break; case miALLOW: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Allow: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Allow: '%s'\n", me->value); break; case miALTERNATES: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Alternates: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Alternates: '%s'\n", me->value); break; case miCACHE_CONTROL: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Cache-Control: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Cache-Control: '%s'\n", me->value); if (!(me->value && *me->value)) break; /* ** Convert to lowercase and indicate in anchor. - FM */ - LYLowerCase(me->value); + for (i = 0; me->value[i]; i++) + me->value[i] = TOLOWER(me->value[i]); StrAllocCopy(me->anchor->cache_control, me->value); /* ** Check whether to set no_cache for the anchor. - FM @@ -1234,17 +1474,23 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miCOOKIE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Cookie: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Cookie: '%s'\n", me->value); break; case miCONNECTION: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Connection: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Connection: '%s'\n", me->value); break; case miCONTENT_BASE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-Base: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Base: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1255,7 +1501,9 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miCONTENT_DISPOSITION: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-Disposition: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Disposition: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1305,7 +1553,9 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miCONTENT_ENCODING: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-Encoding: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Encoding: '%s'\n", me->value); if (!(me->value && *me->value) || !strcasecomp(me->value, "identity")) @@ -1313,7 +1563,8 @@ PRIVATE void HTMIME_put_character ARGS2( /* ** Convert to lowercase and indicate in anchor. - FM */ - LYLowerCase(me->value); + for (i = 0; me->value[i]; i++) + me->value[i] = TOLOWER(me->value[i]); StrAllocCopy(me->anchor->content_encoding, me->value); FREE(me->compression_encoding); if (!strcmp(me->value, "8bit") || @@ -1323,7 +1574,9 @@ PRIVATE void HTMIME_put_character ARGS2( ** Some server indicated "8bit", "7bit" or "binary" ** inappropriately. We'll ignore it. - FM */ - CTRACE(tfp, " Ignoring it!\n"); + if (TRACE) + fprintf(stderr, + " Ignoring it!\n"); } else { /* ** Save it to use as a flag for setting @@ -1334,24 +1587,31 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miCONTENT_FEATURES: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-Features: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Features: '%s'\n", me->value); break; case miCONTENT_LANGUAGE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-Language: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Language: '%s'\n", me->value); if (!(me->value && *me->value)) break; /* ** Convert to lowercase and indicate in anchor. - FM */ - LYLowerCase(me->value); + for (i = 0; me->value[i]; i++) + me->value[i] = TOLOWER(me->value[i]); StrAllocCopy(me->anchor->content_language, me->value); break; case miCONTENT_LENGTH: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-Length: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Length: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1361,12 +1621,16 @@ PRIVATE void HTMIME_put_character ARGS2( me->anchor->content_length = atoi(me->value); if (me->anchor->content_length < 0) me->anchor->content_length = 0; - CTRACE(tfp, " Converted to integer: '%d'\n", + if (TRACE) + fprintf(stderr, + " Converted to integer: '%d'\n", me->anchor->content_length); break; case miCONTENT_LOCATION: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-Location: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Location: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1377,7 +1641,9 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miCONTENT_MD5: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-MD5: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-MD5: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1388,12 +1654,16 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miCONTENT_RANGE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-Range: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Range: '%s'\n", me->value); break; case miCONTENT_TRANSFER_ENCODING: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-Transfer-Encoding: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Transfer-Encoding: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1401,12 +1671,15 @@ PRIVATE void HTMIME_put_character ARGS2( ** Force the Content-Transfer-Encoding value ** to all lower case. - FM */ - LYLowerCase(me->value); + for (i = 0; me->value[i]; i++) + me->value[i] = TOLOWER(me->value[i]); me->encoding = HTAtom_for(me->value); break; case miCONTENT_TYPE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Content-Type: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Type: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1424,7 +1697,9 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miDATE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Date: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Date: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1435,12 +1710,16 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miETAG: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP ETag: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP ETag: '%s'\n", me->value); break; case miEXPIRES: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Expires: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Expires: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1451,12 +1730,16 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miKEEP_ALIVE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Keep-Alive: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Keep-Alive: '%s'\n", me->value); break; case miLAST_MODIFIED: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Last-Modified: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Last-Modified: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1467,17 +1750,23 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miLINK: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Link: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Link: '%s'\n", me->value); break; case miLOCATION: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Location: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Location: '%s'\n", me->value); break; case miPRAGMA: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Pragma: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Pragma: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1489,22 +1778,30 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miPROXY_AUTHENTICATE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Proxy-Authenticate: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Proxy-Authenticate: '%s'\n", me->value); break; case miPUBLIC: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Public: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Public: '%s'\n", me->value); break; case miRETRY_AFTER: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Retry-After: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Retry-After: '%s'\n", me->value); break; case miSAFE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Safe: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Safe: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1518,7 +1815,9 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miSERVER: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Server: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Server: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1529,7 +1828,9 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miSET_COOKIE1: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Set-Cookie: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Set-Cookie: '%s'\n", me->value); if (me->set_cookie == NULL) { StrAllocCopy(me->set_cookie, me->value); @@ -1540,7 +1841,9 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miSET_COOKIE2: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Set-Cookie2: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Set-Cookie2: '%s'\n", me->value); if (me->set_cookie2 == NULL) { StrAllocCopy(me->set_cookie2, me->value); @@ -1551,42 +1854,58 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miTITLE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Title: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Title: '%s'\n", me->value); break; case miTRANSFER_ENCODING: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Transfer-Encoding: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Transfer-Encoding: '%s'\n", me->value); break; case miUPGRADE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Upgrade: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Upgrade: '%s'\n", me->value); break; case miURI: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP URI: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP URI: '%s'\n", me->value); break; case miVARY: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Vary: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Vary: '%s'\n", me->value); break; case miVIA: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Via: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Via: '%s'\n", me->value); break; case miWARNING: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP Warning: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Warning: '%s'\n", me->value); break; case miWWW_AUTHENTICATE: HTMIME_TrimDoubleQuotes(me->value); - CTRACE(tfp, "HTMIME: PICKED UP WWW-Authenticate: '%s'\n", + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP WWW-Authenticate: '%s'\n", me->value); break; default: /* Should never get here */ @@ -1615,7 +1934,8 @@ PRIVATE void HTMIME_put_character ARGS2( return; value_too_long: - CTRACE(tfp, "HTMIME: *** Syntax error. (string too long)\n"); + if (TRACE) + fprintf(stderr, "HTMIME: *** Syntax error. (string too long)\n"); bad_field_name: /* Ignore it */ me->state = miJUNK_LINE; @@ -1640,7 +1960,8 @@ PRIVATE void HTMIME_put_string ARGS2( (*me->targetClass.put_string)(me->target,s); } else if (me->state != MIME_IGNORE) { - CTRACE(tfp, "HTMIME: %s\n", s); + if (TRACE) + fprintf(stderr, "HTMIME: %s\n", s); for (p=s; *p; p++) HTMIME_put_character(me, *p); @@ -1662,7 +1983,8 @@ PRIVATE void HTMIME_write ARGS3( (*me->targetClass.put_block)(me->target, s, l); } else { - CTRACE(tfp, "HTMIME: %.*s\n", l, s); + if (TRACE) + fprintf(stderr, "HTMIME: %.*s\n", l, s); for (p = s; p < s+l; p++) HTMIME_put_character(me, *p); @@ -1823,6 +2145,9 @@ PUBLIC HTStream* HTNetMIME ARGS3( ** Software Foundation Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* #include <stdio.h> */ /* Included via previous headers. - FM */ +/* #include <string.h> */ /* Included via previous headers. - FM */ + /* ** MIME decoding routines ** @@ -1955,7 +2280,8 @@ PUBLIC void HTmmdecode ARGS2( int LYhndl; *qm2 = '\0'; - LYLowerCase(s+2); + for (p = s+2; *p; p++) + *p = TOLOWER(*p); invalid = ((LYhndl = UCGetLYhndl_byMIME(s+2)) < 0 || UCCanTranslateFromTo(LYhndl, current_char_set)); diff --git a/WWW/Library/Implementation/HTMLDTD.c b/WWW/Library/Implementation/HTMLDTD.c index 966697a8..bf7a54b7 100644 --- a/WWW/Library/Implementation/HTMLDTD.c +++ b/WWW/Library/Implementation/HTMLDTD.c @@ -1597,17 +1597,16 @@ PUBLIC void HTSwitchDTD ARGS1( BOOL, new) { if (TRACE) - CTRACE(tfp,"HTMLDTD: Copying DTD element info of size %d, %d * %d\n", - (int) (new ? sizeof(tags_new) : sizeof(tags_old)), - HTML_ELEMENTS, - (int) sizeof(HTTag)); + fprintf(stderr,"HTMLDTD: Copying DTD element info of size %d, %d * %d\n", + new ? sizeof(tags_new) : sizeof(tags_old), + HTML_ELEMENTS, sizeof(HTTag)); if (new) memcpy(tags, tags_new, HTML_ELEMENTS * sizeof(HTTag)); else memcpy(tags, tags_old, HTML_ELEMENTS * sizeof(HTTag)); } -PUBLIC HTTag HTTag_unrecognized = +PUBLIC CONST HTTag HTTag_unrecognized = { NULL, NULL, 0, SGML_EMPTY,T__UNREC_}; /* diff --git a/WWW/Library/Implementation/HTMLDTD.h b/WWW/Library/Implementation/HTMLDTD.h index a112b7e5..07ce5195 100644 --- a/WWW/Library/Implementation/HTMLDTD.h +++ b/WWW/Library/Implementation/HTMLDTD.h @@ -12,6 +12,9 @@ #ifndef HTMLDTD_H #define HTMLDTD_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <SGML.h> /* @@ -953,7 +956,7 @@ extern CONST SGML_dtd HTML_dtd; extern void HTSwitchDTD PARAMS(( BOOL new)); -extern HTTag HTTag_unrecognized; +extern CONST HTTag HTTag_unrecognized; /* diff --git a/WWW/Library/Implementation/HTMLGen.c b/WWW/Library/Implementation/HTMLGen.c index 9581081f..da2b63e5 100644 --- a/WWW/Library/Implementation/HTMLGen.c +++ b/WWW/Library/Implementation/HTMLGen.c @@ -13,6 +13,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #define BUFFER_SIZE 200 /* Line buffer attempts to make neat breaks */ #define MAX_CLEANNESS 20 @@ -21,6 +22,7 @@ */ #include <HTMLGen.h> +#include <stdio.h> #include <HTMLDTD.h> #include <HTStream.h> #include <SGML.h> @@ -28,6 +30,8 @@ #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + #define PUTC(c) (*me->targetClass.put_character)(me->target, c) /* #define PUTS(s) (*me->targetClass.put_string)(me->target, s) */ #define PUTB(s,l) (*me->targetClass.put_block)(me->target, s, l) diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index 331b4fa7..89048385 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -7,6 +7,7 @@ */ #include <HTUtils.h> /* Coding convention macros */ +#include <tcp.h> /* Implements: */ @@ -15,7 +16,8 @@ #include <HTCJK.h> #include <HTMIME.h> #include <HTTCP.h> -#include <LYUtils.h> + +#define FREE(x) if (x) {free(x); x = NULL;} /* this define should be in HTFont.h :( */ #define HT_NON_BREAK_SPACE ((char)1) /* For now */ @@ -37,6 +39,8 @@ PUBLIC int HTNewsMaxChunk = 40; /* Largest number of articles in one window */ #define NEWS_NETCLOSE NETCLOSE #define NEXT_CHAR HTGetCharacter() +#include <ctype.h> + #include <HTML.h> #include <HTParse.h> #include <HTFormat.h> @@ -185,16 +189,17 @@ PRIVATE BOOL initialize NOARGS #else if (getenv("NNTPSERVER")) { StrAllocCopy(HTNewsHost, (char *)getenv("NNTPSERVER")); - CTRACE(tfp, "HTNews: NNTPSERVER defined as `%s'\n", - HTNewsHost); + if (TRACE) fprintf(stderr, "HTNews: NNTPSERVER defined as `%s'\n", + HTNewsHost); } else { char server_name[256]; FILE* fp = fopen(SERVER_FILE, "r"); if (fp) { if (fscanf(fp, "%s", server_name)==1) { StrAllocCopy(HTNewsHost, server_name); - CTRACE(tfp, "HTNews: File %s defines news host as `%s'\n", - SERVER_FILE, HTNewsHost); + if (TRACE) fprintf(stderr, + "HTNews: File %s defines news host as `%s'\n", + SERVER_FILE, HTNewsHost); } fclose(fp); } @@ -227,7 +232,7 @@ PRIVATE int response ARGS1(CONST char *,command) if (command) { int status; int length = strlen(command); - CTRACE(tfp, "NNTP command to be sent: %s", command); + if (TRACE) fprintf(stderr, "NNTP command to be sent: %s", command); #ifdef NOT_ASCII { CONST char * p; @@ -242,7 +247,8 @@ PRIVATE int response ARGS1(CONST char *,command) status = NEWS_NETWRITE(s, (char *)command, length); #endif /* NOT_ASCII */ if (status < 0){ - CTRACE(tfp, "HTNews: Unable to send command. Disconnecting.\n"); + if (TRACE) fprintf(stderr, + "HTNews: Unable to send command. Disconnecting.\n"); NEWS_NETCLOSE(s); s = -1; return status; @@ -253,19 +259,24 @@ PRIVATE int response ARGS1(CONST char *,command) if (((*p++ = NEXT_CHAR) == LF) || (p == &response_text[LINE_LENGTH])) { *--p = '\0'; /* Terminate the string */ - CTRACE(tfp, "NNTP Response: %s\n", response_text); + if (TRACE) + fprintf(stderr, "NNTP Response: %s\n", response_text); sscanf(response_text, "%d", &result); return result; } /* if end of line */ if ((ch = *(p-1)) == (char)EOF) { *(p-1) = '\0'; - if (interrupted_in_htgetcharacter) { - CTRACE(tfp, "HTNews: Interrupted on read, closing socket %d\n", + if (TRACE) { + if (interrupted_in_htgetcharacter) { + fprintf(stderr, + "HTNews: Interrupted on read, closing socket %d\n", s); - } else { - CTRACE(tfp, "HTNews: EOF on read, closing socket %d\n", + } else { + fprintf(stderr, + "HTNews: EOF on read, closing socket %d\n", s); + } } NEWS_NETCLOSE(s); /* End of file, close socket */ s = -1; @@ -549,7 +560,8 @@ PRIVATE char * author_name ARGS1 (char *,email) char *p, *e; StrAllocCopy(name, email); - CTRACE(tfp,"Trying to find name in: %s\n",name); + if (TRACE) + fprintf(stderr,"Trying to find name in: %s\n",name); if ((p = strchr(name, '(')) && (e = strchr(name, ')'))) { if (e > p) { @@ -586,7 +598,8 @@ PRIVATE char * author_address ARGS1(char *,email) char *p, *at, *e; StrAllocCopy(address, email); - CTRACE(tfp,"Trying to find address in: %s\n",address); + if (TRACE) + fprintf(stderr,"Trying to find address in: %s\n",address); if ((p = strchr(address, '<'))) { if ((e = strchr(p, '>')) && (at = strchr(p, '@'))) { @@ -757,7 +770,9 @@ PRIVATE void write_anchors ARGS1 (char *,text) */ PRIVATE void abort_socket NOARGS { - CTRACE(tfp, "HTNews: EOF on read, closing socket %d\n", s); + if (TRACE) + fprintf(stderr, + "HTNews: EOF on read, closing socket %d\n", s); NEWS_NETCLOSE(s); /* End of file, close socket */ PUTS("Network Error: connection lost"); PUTC('\n'); @@ -894,7 +909,12 @@ PRIVATE void post_article ARGS1( } } fclose(fd); - HTSYS_remove(postfile); +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ /* ** Send the nntp EOF and get the server's response. - FM @@ -963,7 +983,9 @@ PRIVATE int read_article NOARGS if (ch == (char)EOF) { if (interrupted_in_htgetcharacter) { interrupted_in_htgetcharacter = 0; - CTRACE(tfp, "HTNews: Interrupted on read, closing socket %d\n", + if (TRACE) + fprintf(stderr, + "HTNews: Interrupted on read, closing socket %d\n", s); NEWS_NETCLOSE(s); s = -1; @@ -974,7 +996,8 @@ PRIVATE int read_article NOARGS } if ((ch == LF) || (p == &line[LINE_LENGTH])) { *--p = '\0'; /* Terminate the string */ - CTRACE(tfp, "H %s\n", line); + if (TRACE) + fprintf(stderr, "H %s\n", line); if (line[0] == '\t' || line[0] == ' ') { int i = 0; @@ -1230,7 +1253,9 @@ PRIVATE int read_article NOARGS if (ch == (char)EOF) { if (interrupted_in_htgetcharacter) { interrupted_in_htgetcharacter = 0; - CTRACE(tfp, "HTNews: Interrupted on read, closing socket %d\n", + if (TRACE) + fprintf(stderr, + "HTNews: Interrupted on read, closing socket %d\n", s); NEWS_NETCLOSE(s); s = -1; @@ -1241,7 +1266,8 @@ PRIVATE int read_article NOARGS } if ((ch == LF) || (p == &line[LINE_LENGTH])) { *p++ = '\0'; /* Terminate the string */ - CTRACE(tfp, "B %s", line); + if (TRACE) + fprintf(stderr, "B %s", line); if (line[0] == '.') { /* ** End of article? @@ -1434,7 +1460,9 @@ PRIVATE int read_list ARGS1(char *, arg) if (ch == (char)EOF) { if (interrupted_in_htgetcharacter) { interrupted_in_htgetcharacter = 0; - CTRACE(tfp, "HTNews: Interrupted on read, closing socket %d\n", + if (TRACE) + fprintf(stderr, + "HTNews: Interrupted on read, closing socket %d\n", s); NEWS_NETCLOSE(s); s = -1; @@ -1454,7 +1482,9 @@ PRIVATE int read_list ARGS1(char *, arg) continue; } } else if (p == &line[LINE_LENGTH]) { - CTRACE(tfp, "b %.*s%c[...]\n", (LINE_LENGTH), line, ch); + if (TRACE) { + fprintf(stderr, "b %.*s%c[...]\n", (LINE_LENGTH), line, ch); + } *p = '\0'; if (ch == LF) { ; /* Will be dealt with below */ @@ -1464,7 +1494,9 @@ PRIVATE int read_list ARGS1(char *, arg) } else if (strchr(line, ' ') == NULL && strchr(line, '\t') == NULL) { /* No separator found */ - CTRACE(tfp, "HTNews..... group name too long, discarding.\n"); + if (TRACE) + fprintf(stderr, + "HTNews..... group name too long, discarding.\n"); skip_this_line = YES; /* ignore whole line */ continue; } else { @@ -1476,7 +1508,8 @@ PRIVATE int read_list ARGS1(char *, arg) if (ch == LF) { skip_rest_of_line = NO; /* done, reset flag */ *p = '\0'; /* Terminate the string */ - CTRACE(tfp, "B %s", line); + if (TRACE) + fprintf(stderr, "B %s", line); if (line[0] == '.') { /* ** End of article? @@ -1584,7 +1617,9 @@ PRIVATE int read_group ARGS3( PUTC('\n'); sscanf(response_text, " %d %d %d %d", &status, &count, &first, &last); - CTRACE(tfp, "Newsgroup status=%d, count=%d, (%d-%d) required:(%d-%d)\n", + if (TRACE) + fprintf(stderr, + "Newsgroup status=%d, count=%d, (%d-%d) required:(%d-%d)\n", status, count, first, last, first_required, last_required); if (last == 0) { PUTS("\nNo articles in this group.\n"); @@ -1607,8 +1642,9 @@ PRIVATE int read_group ARGS3( if (last_required-first_required+1 > HTNewsMaxChunk) { /* Trim this block */ first_required = last_required-HTNewsChunkSize+1; } - CTRACE(tfp, " Chunk will be (%d-%d)\n", - first_required, last_required); + if (TRACE) + fprintf(stderr, " Chunk will be (%d-%d)\n", + first_required, last_required); /* ** Set window title. @@ -1631,7 +1667,8 @@ PRIVATE int read_group ARGS3( before = first_required-HTNewsChunkSize; sprintf(buffer, "%s%s/%d-%d", NewsHREF, groupName, before, first_required-1); - CTRACE(tfp, " Block before is %s\n", buffer); + if (TRACE) + fprintf(stderr, " Block before is %s\n", buffer); PUTC('('); start_anchor(buffer); PUTS("Earlier articles"); @@ -1659,7 +1696,9 @@ PRIVATE int read_group ARGS3( if (ch == (char)EOF) { if (interrupted_in_htgetcharacter) { interrupted_in_htgetcharacter = 0; - CTRACE(tfp, "HTNews: Interrupted on read, closing socket %d\n", + if (TRACE) + fprintf(stderr, + "HTNews: Interrupted on read, closing socket %d\n", s); NEWS_NETCLOSE(s); s = -1; @@ -1670,7 +1709,8 @@ PRIVATE int read_group ARGS3( } if ((ch == '\n') || (p == &line[LINE_LENGTH])) { *p = '\0'; /* Terminate the string */ - CTRACE(tfp, "X %s", line); + if (TRACE) + fprintf(stderr, "X %s", line); if (line[0] == '.') { /* ** End of article? @@ -1762,7 +1802,9 @@ PRIVATE int read_group ARGS3( if (ch == (char)EOF) { if (interrupted_in_htgetcharacter) { interrupted_in_htgetcharacter = 0; - CTRACE(tfp, "HTNews: Interrupted on read, closing socket %d\n", + if (TRACE) + fprintf(stderr, + "HTNews: Interrupted on read, closing socket %d\n", s); NEWS_NETCLOSE(s); s = -1; @@ -1776,7 +1818,8 @@ PRIVATE int read_group ARGS3( *--p = '\0'; /* Terminate & chop LF*/ p = line; /* Restart at beginning */ - CTRACE(tfp, "G %s\n", line); + if (TRACE) + fprintf(stderr, "G %s\n", line); switch(line[0]) { case '.': @@ -1870,7 +1913,9 @@ PRIVATE int read_group ARGS3( */ } else if (status == HT_INTERRUPTED) { interrupted_in_htgetcharacter = 0; - CTRACE(tfp, "HTNews: Interrupted on read, closing socket %d\n", + if (TRACE) + fprintf(stderr, + "HTNews: Interrupted on read, closing socket %d\n", s); NEWS_NETCLOSE(s); s = -1; @@ -1912,7 +1957,8 @@ PRIVATE int read_group ARGS3( else sprintf(buffer, "%s%s/%d-%d", NewsHREF, groupName, last_required+1, after); - CTRACE(tfp, " Block after is %s\n", buffer); + if (TRACE) + fprintf(stderr, " Block after is %s\n", buffer); PUTC('('); start_anchor(buffer); PUTS("Later articles"); @@ -1983,7 +2029,7 @@ PRIVATE int HTLoadNews ARGS4( format_out == HTAtom_for("www/dump")); rawtext = NO; - CTRACE(tfp, "HTNews: Looking for %s\n", arg); + if (TRACE) fprintf(stderr, "HTNews: Looking for %s\n", arg); if (!initialized) initialized = initialize(); @@ -2184,7 +2230,9 @@ PRIVATE int HTLoadNews ARGS4( command[258] = '\0'; FREE(cp); sprintf(proxycmd, "GET %.251s%c%c%c%c", command, CR, LF, CR, LF); - CTRACE(tfp, "HTNews: Proxy command is '%.*s'\n", + if (TRACE) + fprintf(stderr, + "HTNews: Proxy command is '%.*s'\n", (int)(strlen(proxycmd) - 4), proxycmd); strcat(command, "/"); StrAllocCopy(ProxyHREF, NewsHREF); @@ -2326,7 +2374,8 @@ PRIVATE int HTLoadNews ARGS4( } else { sprintf (url, "%.259s", NewsHREF); } - CTRACE (tfp, "News: doing HTDoConnect on '%s'\n", url); + if (TRACE) + fprintf (stderr, "News: doing HTDoConnect on '%s'\n", url); _HTProgress("Connecting to NewsHost ..."); @@ -2335,7 +2384,9 @@ PRIVATE int HTLoadNews ARGS4( /* ** Interrupt cleanly. */ - CTRACE(tfp, "HTNews: Interrupted on connect; recovering cleanly.\n"); + if (TRACE) + fprintf(stderr, + "HTNews: Interrupted on connect; recovering cleanly.\n"); _HTProgress("Connection interrupted."); if (!(post_wanted || reply_wanted || spost_wanted || sreply_wanted)) { @@ -2347,7 +2398,12 @@ PRIVATE int HTLoadNews ARGS4( FREE(ProxyHREF); FREE(ListArg); if (postfile) { - HTSYS_remove(postfile); +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ FREE(postfile); } return HT_NOT_LOADED; @@ -2356,7 +2412,9 @@ PRIVATE int HTLoadNews ARGS4( char message[256]; NEWS_NETCLOSE(s); s = -1; - CTRACE(tfp, "HTNews: Unable to connect to news host.\n"); + if (TRACE) + fprintf(stderr, + "HTNews: Unable to connect to news host.\n"); if (retries < 1) continue; sprintf(message, "Could not access %s.", NewsHost); @@ -2366,17 +2424,25 @@ PRIVATE int HTLoadNews ARGS4( FREE(ProxyHREF); FREE(ListArg); if (postfile) { - HTSYS_remove(postfile); +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ FREE(postfile); } return HTLoadError(stream, 500, message); } else { - CTRACE(tfp, "HTNews: Connected to news host %s.\n", - NewsHost); + if (TRACE) + fprintf(stderr, "HTNews: Connected to news host %s.\n", + NewsHost); HTInitInput(s); /* set up buffering */ if (proxycmd[0]) { status = NEWS_NETWRITE(s, proxycmd, strlen(proxycmd)); - CTRACE(tfp, "HTNews: Proxy command returned status '%d'.\n", + if (TRACE) + fprintf(stderr, + "HTNews: Proxy command returned status '%d'.\n", status); } if (((status = response(NULL)) / 100) != 2) { @@ -2395,7 +2461,12 @@ PRIVATE int HTLoadNews ARGS4( FREE(ProxyHREF); FREE(ListArg); if (postfile) { - HTSYS_remove(postfile); +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ FREE(postfile); } return(HT_NOT_LOADED); @@ -2422,7 +2493,12 @@ PRIVATE int HTLoadNews ARGS4( } FREE(ListArg); if (postfile) { - HTSYS_remove(postfile); +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ FREE(postfile); } return(HT_NOT_LOADED); @@ -2443,7 +2519,12 @@ PRIVATE int HTLoadNews ARGS4( } FREE(ListArg); if (postfile) { - HTSYS_remove(postfile); +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ FREE(postfile); } return(HT_NOT_LOADED); @@ -2588,7 +2669,12 @@ Send_NNTP_command: if (status != 340) { HTAlert("Cannot POST to this host."); if (postfile) { - HTSYS_remove(postfile); +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ } } else { post_article(postfile); @@ -2650,7 +2736,12 @@ Send_NNTP_command: } FREE(ListArg); if (postfile) { - HTSYS_remove(postfile); +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ FREE(postfile); } return status; @@ -2673,7 +2764,12 @@ Send_NNTP_command: } FREE(ListArg); if (postfile) { - HTSYS_remove(postfile); +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ FREE(postfile); } return HT_NOT_LOADED; diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c index 7362a59a..97d3f5ea 100644 --- a/WWW/Library/Implementation/HTParse.c +++ b/WWW/Library/Implementation/HTParse.c @@ -3,10 +3,13 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTParse.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + #define HEX_ESCAPE '%' struct struct_parts { @@ -187,7 +190,9 @@ PUBLIC char * HTParse ARGS3( char * acc_method; struct struct_parts given, related; - CTRACE(tfp, "HTParse: aName:%s relatedName:%s\n", aName, relatedName); + if (TRACE) + fprintf(stderr, + "HTParse: aName:%s relatedName:%s\n", aName, relatedName); /* ** Allocate the output string. @@ -245,7 +250,7 @@ PUBLIC char * HTParse ARGS3( ** this is back to inheriting for identical ** schemes whether or not they are "file". ** If you want to try it again yourself, - ** uncomment the strcasecomp() below. - FM + ** uncomment the strncasecomp() below. - FM */ if ((given.access && related.access) && (/* strcasecomp(given.access, "file") || */ @@ -360,7 +365,8 @@ PUBLIC char * HTParse ARGS3( if (wanted & PARSE_PUNCTUATION) strcat(result, "/"); strcat(result, given.absolute); - CTRACE(tfp, "1\n"); + if (TRACE) + fprintf(stderr, "1\n"); } else if (related.absolute) { /* Adopt path not name */ strcat(result, "/"); strcat(result, related.absolute); @@ -374,13 +380,16 @@ PUBLIC char * HTParse ARGS3( strcat(result, given.relative); /* Add given one */ HTSimplify (result); } - CTRACE(tfp, "2\n"); + if (TRACE) + fprintf(stderr, "2\n"); } else if (given.relative) { strcat(result, given.relative); /* what we've got */ - CTRACE(tfp, "3\n"); + if (TRACE) + fprintf(stderr, "3\n"); } else if (related.relative) { strcat(result, related.relative); - CTRACE(tfp, "4\n"); + if (TRACE) + fprintf(stderr, "4\n"); } else { /* No inheritance */ if (strncasecomp(aName, "lynxcgi:", 8) && strncasecomp(aName, "lynxexec:", 9) && @@ -389,7 +398,8 @@ PUBLIC char * HTParse ARGS3( } if (!strcmp(result, "news:/")) result[5] = '*'; - CTRACE(tfp, "5\n"); + if (TRACE) + fprintf(stderr, "5\n"); } } @@ -404,7 +414,8 @@ PUBLIC char * HTParse ARGS3( strcat(result, (given.anchor) ? given.anchor : related.anchor); } - CTRACE(tfp, "HTParse: result:%s\n", result); + if (TRACE) + fprintf(stderr, "HTParse: result:%s\n", result); FREE(rel); FREE(name); @@ -636,7 +647,8 @@ PUBLIC char * HTRelative ARGS2( strcat(result, "../"); strcat(result, last_slash+1); } - CTRACE(tfp, "HT: `%s' expressed relative to\n `%s' is\n `%s'.", + if (TRACE) + fprintf(stderr, "HT: `%s' expressed relative to\n `%s' is\n `%s'.", aName, relatedName, result); return result; } diff --git a/WWW/Library/Implementation/HTParse.h b/WWW/Library/Implementation/HTParse.h index bea789d0..cf42d97b 100644 --- a/WWW/Library/Implementation/HTParse.h +++ b/WWW/Library/Implementation/HTParse.h @@ -8,7 +8,9 @@ #ifndef HTPARSE_H #define HTPARSE_H +#ifndef HTUTILS_H #include <HTUtils.h> +#endif /* HTUTILS_H */ /* ** The following are flag bits which may be ORed together to form diff --git a/WWW/Library/Implementation/HTPasswd.c b/WWW/Library/Implementation/HTPasswd.c index 764882d4..45a53aee 100644 --- a/WWW/Library/Implementation/HTPasswd.c +++ b/WWW/Library/Implementation/HTPasswd.c @@ -15,8 +15,10 @@ ** */ -#include <HTUtils.h> +#include <HTUtils.h> +#include <tcp.h> /* FROMASCII() */ +#include <string.h> #include <HTAAUtil.h> /* Common parts of AA */ #include <HTAAFile.h> /* File routines */ #include <HTAAServ.h> /* Server routines */ @@ -136,7 +138,7 @@ PUBLIC BOOL HTAA_passwdMatch ARGS2(CONST char *, password, CONST char *, encrypted) { char *result; - size_t len; + int len; int status; if (!password || !encrypted) @@ -150,7 +152,7 @@ PUBLIC BOOL HTAA_passwdMatch ARGS2(CONST char *, password, outofmem(__FILE__, "HTAA_encryptPasswd"); *result = (char)0; - while (len != 0) { + while (len > 0) { char salt[3]; char chunk[9]; CONST char *cur1 = password; @@ -174,7 +176,9 @@ PUBLIC BOOL HTAA_passwdMatch ARGS2(CONST char *, password, status = strncmp(result, encrypted, strlen(encrypted)); - CTRACE(tfp, "%s `%s' (encrypted: `%s') with: `%s' => %s\n", + if (TRACE) + fprintf(stderr, + "%s `%s' (encrypted: `%s') with: `%s' => %s\n", "HTAA_passwdMatch: Matching password:", password, result, encrypted, (status==0 ? "OK" : "INCORRECT")); @@ -262,14 +266,16 @@ PUBLIC BOOL HTAA_checkPassword ARGS3(CONST char *, username, else fp = fopen(PASSWD_FILE,"r"); if (!fp) { - CTRACE(tfp, "%s `%s'\n", - "HTAA_checkPassword: Unable to open password file", - (filename && *filename ? filename : PASSWD_FILE)); + if (TRACE) fprintf(stderr, "%s `%s'\n", + "HTAA_checkPassword: Unable to open password file", + (filename && *filename ? filename : PASSWD_FILE)); return NO; } do { if (2 == (status = HTAAFile_readPasswdRec(fp,user,pw))) { - CTRACE(tfp, "HTAAFile_validateUser: %s \"%s\" %s \"%s:%s\"\n", + if (TRACE) + fprintf(stderr, + "HTAAFile_validateUser: %s \"%s\" %s \"%s:%s\"\n", "Matching username:", username, "against passwd record:", user, pw); if (username && user && !strcmp(username,user)) { @@ -286,7 +292,7 @@ PUBLIC BOOL HTAA_checkPassword ARGS3(CONST char *, username, fclose(fp); - CTRACE(tfp, "HTAAFile_checkPassword: (%s,%s) %scorrect\n", + if (TRACE) fprintf(stderr, "HTAAFile_checkPassword: (%s,%s) %scorrect\n", username, password, ((status != EOF) ? "" : "in")); if (status == EOF) return NO; /* We traversed to the end without luck */ diff --git a/WWW/Library/Implementation/HTPasswd.h b/WWW/Library/Implementation/HTPasswd.h index 09007192..b82d1d4e 100644 --- a/WWW/Library/Implementation/HTPasswd.h +++ b/WWW/Library/Implementation/HTPasswd.h @@ -5,6 +5,9 @@ #ifndef HTPASSWD_H #define HTPASSWD_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTList.h> #ifdef SHORT_NAMES diff --git a/WWW/Library/Implementation/HTPlain.c b/WWW/Library/Implementation/HTPlain.c index 81e46d72..14b89bf8 100644 --- a/WWW/Library/Implementation/HTPlain.c +++ b/WWW/Library/Implementation/HTPlain.c @@ -7,8 +7,8 @@ ** Bugs: ** strings written must be less than buffer size. */ - #include <HTUtils.h> +#include <tcp.h> #include <HTPlain.h> @@ -31,6 +31,9 @@ #include <LYCharSets.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + +extern BOOLEAN LYRawMode; extern BOOL HTPassEightBitRaw; extern BOOL HTPassHighCtrlRaw; extern HTCJKlang HTCJK; @@ -51,7 +54,6 @@ struct _HTStream { /* ** The node_anchor UCInfo and handle for the output (HTEXT) stage. - FM */ - LYUCcharset * outUCI; int outUCLYhndl; /* ** Counter, value, buffer and pointer for UTF-8 handling. - FM @@ -89,7 +91,6 @@ PRIVATE void HTPlain_getChartransInfo ARGS2( me->outUCLYhndl = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_HTEXT); } me->inUCI = HTAnchor_getUCInfoStage(anchor, UCT_STAGE_PARSER); - me->outUCI = HTAnchor_getUCInfoStage(anchor, UCT_STAGE_HTEXT); } /* Write the buffer out to the socket @@ -135,14 +136,14 @@ PRIVATE void HTPlain_put_character ARGS2( HTPlain_lastraw = c; if (c == '\r') { HText_appendCharacter(me->text, '\n'); + } else if (HTCJK != NOCJK) { + HText_appendCharacter(me->text, c); } else if ((unsigned char)c >= 127) { /* ** For now, don't repeat everything here ** that has been done below - KW */ HTPlain_write(me, &c, 1); - } else if (HTCJK != NOCJK) { - HText_appendCharacter(me->text, c); } else if ((unsigned char)c >= 127 && (unsigned char)c < 161 && HTPassHighCtrlRaw) { HText_appendCharacter(me->text, c); @@ -155,9 +156,9 @@ PRIVATE void HTPlain_put_character ARGS2( HText_appendCharacter(me->text, c); } else if ((unsigned char)c > 160) { if (!HTPassEightBitRaw && - !((me->outUCLYhndl == LATIN1) || - (me->outUCI->enc & (UCT_CP_SUPERSETOF_LAT1)))) { - int len, high, low, i, diff = 1; + current_char_set != 0) { + size_t len, high, low, i; + int diff = 1; CONST char * name; UCode_t value = (UCode_t)((unsigned char)c - 160); @@ -171,7 +172,7 @@ PRIVATE void HTPlain_put_character ARGS2( diff = strncmp(HTML_dtd.entity_names[i], name, len); if (diff == 0) { HText_appendText(me->text, - LYCharSets[me->outUCLYhndl][i]); + LYCharSets[current_char_set][i]); break; } } @@ -217,8 +218,8 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) char c; unsigned char c_unsign; BOOL chk; - UCode_t code, uck = -1; - char saved_char_in = '\0'; + UCode_t code; + long uck = 0; for (p = s; p < e; p++) { #ifdef REMOVE_CR_ONLY @@ -251,7 +252,6 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) c = *p; c_unsign = (unsigned char)c; code = (UCode_t)c_unsign; - saved_char_in = '\0'; /* ** Combine any UTF-8 multibytes into Unicode ** to check for special characters. - FM @@ -282,9 +282,8 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) */ *(me->utf_buf_p) = '\0'; code = me->utf_char; - if (code > 0 && code < 256) { + if (code < 256) { c = FROMASCII((char)code); - c_unsign = (unsigned char)c; } } else { /* @@ -296,8 +295,9 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) /* ** Start handling a new multibyte character. - FM */ + me->utf_buf_p = me->utf_buf; me->utf_buf_p[0] = c; - me->utf_buf_p = &me->utf_buf[1]; + (me->utf_buf_p)++; if ((*p & 0xe0) == 0xc0) { me->utf_count = 1; me->utf_char = (c & 0x1f); @@ -318,45 +318,26 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) * We got garbage, so ignore it. - FM */ me->utf_count = 0; - me->utf_buf_p[0] = '\0'; me->utf_buf_p = me->utf_buf; + me->utf_buf_p[0] = '\0'; } /* ** Get the next byte. - FM */ continue; } - } else if (me->utf_count > 0) { + } else { /* - ** Got an ASCII character when expecting - ** UTF-8 multibytes, so ignore the buffered - ** multibye characters and fall through with - ** the current ASCII character. - FM + ** Got an ASCII character. */ me->utf_count = 0; me->utf_buf[0] = '\0'; me->utf_buf_p = me->utf_buf; - code = (UCode_t)c_unsign; - } else { - /* - ** Got a valid ASCII character, so fall - ** through with it. - FM - */ - code = (UCode_t)c_unsign; } } - /* - ** Convert characters from non-UTF-8 charsets - ** to Unicode (if appropriate). - FM - */ - if (!(me->T.decode_utf8 && - (unsigned char)(*p) > 127)) { -#ifdef NOTDEFINED - if (me->T.strip_raw_char_in) - saved_char_in = c; -#endif /* NOTDEFINED */ + if (me->T.trans_to_uni && - (code >= LYlowest_eightbit[me->inUCLYhndl] || + (code >= 127 || (code < 32 && code != 0 && me->T.trans_C0_to_uni))) { /* @@ -364,58 +345,10 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) */ code = (UCode_t)UCTransToUni(c, me->inUCLYhndl); if (code > 0) { - saved_char_in = c; if (code < 256) { - c = FROMASCII((char)code); - c_unsign = (unsigned char)c; + c = FROMASCII((char)code); } } - } else if (code < 32 && code != 0 && - me->T.trans_C0_to_uni) { - /* - ** Quote from SGML.c: - ** "This else if may be too ugly to keep. - KW" - */ - if (me->T.trans_from_uni && - (((code = UCTransToUni(c, me->inUCLYhndl)) >= 32) || - (me->T.transp && - (code = UCTransToUni(c, me->inUCLYhndl)) > 0))) { - saved_char_in = c; - if (code < 256) { - c = FROMASCII((char)code); - c_unsign = (unsigned char)c; - } - } else { - uck = -1; - if (me->T.transp) { - uck = UCTransCharStr(replace_buf, 60, c, - me->inUCLYhndl, - me->inUCLYhndl, NO); - } - if (!me->T.transp || uck < 0) { - uck = UCTransCharStr(replace_buf, 60, c, - me->inUCLYhndl, - me->outUCLYhndl, YES); - } - if (uck == 0) { - continue; - } else if (uck < 0) { - me->utf_buf[0] = '\0'; - code = (unsigned char)c; - } else { - c = replace_buf[0]; - if (c && replace_buf[1]) { - HText_appendText(me->text, replace_buf); - continue; - } - } - me->utf_buf[0] = '\0'; - code = (unsigned char)c; - } /* Next line end of ugly stuff for C0. - KW */ - } else { - me->utf_buf[0] = '\0'; - code = (unsigned char)c; - } } /* ** At this point we have either code in Unicode @@ -466,16 +399,17 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) c >= LYlowest_eightbit[me->outUCLYhndl]) || *p == '\n' || *p == '\t') { HText_appendCharacter(me->text, c); + + } else if (me->T.use_raw_char_in) { + HText_appendCharacter(me->text, *p); +#ifdef NOTDEFINED /* ** Use an ASCII space (32) for ensp, emsp or thinsp. - FM */ } else if (code == 8194 || code == 8195 || code == 8201) { HText_appendCharacter(me->text, ' '); - /* - ** If we want the raw character, pass it now. - FM - */ - } else if (me->T.use_raw_char_in && saved_char_in) { - HText_appendCharacter(me->text, saved_char_in); +#endif /* NOTDEFINED */ + /****************************************************************** * I. LATIN-1 OR UCS2 TO DISPLAY CHARSET ******************************************************************/ @@ -483,8 +417,11 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) (uck = UCTransUniChar(code, me->outUCLYhndl)) >= 32 && uck < 256) { - CTRACE(tfp, "UCTransUniChar returned 0x%.2lX:'%c'.\n", + if (TRACE) { + fprintf(stderr, + "UCTransUniChar returned 0x%.2lX:'%c'.\n", uck, FROMASCII((char)uck)); + } HText_appendCharacter(me->text, ((char)(uck & 0xff))); } else if (chk && (uck == -4 || @@ -526,29 +463,23 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) ** (somewhat) readable ASCII. */ HText_appendCharacter(me->text, (char)(*p & 0x7f)); -#endif /* NOTDEFINED */ - /* - ** If we don't actually want the character, - ** make it safe and output that now. - FM - */ - } else if ((c_unsign > 0 && - c_unsign < LYlowest_eightbit[me->outUCLYhndl]) || - (me->T.trans_from_uni && !HTPassEightBitRaw)) { /* ** If we do not have the "7-bit approximations" as our ** output character set (in which case we did it already) ** seek a translation for that. Otherwise, or if the ** translation fails, use UHHH notation. - FM */ - if ((chk = (me->outUCLYhndl != - UCGetLYhndl_byMIME("us-ascii"))) && + } else if (chk && + (chk = (!HTPassEightBitRaw && + (me->outUCLYhndl != + UCGetLYhndl_byMIME("us-ascii")))) && (uck = UCTransUniChar(code, UCGetLYhndl_byMIME("us-ascii"))) >= 32 && uck < 127) { /* ** Got an ASCII character (yippey). - FM */ - c = FROMASCII((char)uck); + c = ((char)(uck & 0xff)); HText_appendCharacter(me->text, c); } else if ((chk && uck == -4) && (uck = UCTransUniCharStr(replace_buf, @@ -558,33 +489,110 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) /* ** Got a repacement string (yippey). - FM */ - HText_appendText(me->text, replace_buf); - } else if (code == 8204 || code == 8205) { - /* - ** Ignore 8204 (zwnj) or 8205 (zwj), if we get to here. - FM - */ - CTRACE(tfp, "HTPlain_write: Ignoring '%ld'.\n", code); - } else if (code == 8206 || code == 8207) { - /* - ** Ignore 8206 (lrm) or 8207 (rlm), if we get to here. - FM - */ - CTRACE(tfp, "HTPlain_write: Ignoring '%ld'.\n", code); + HText_appendText(me->text, replace_buf); + } else if (code == 8204 || code == 8205) { + /* + ** Ignore 8204 (zwnj) or 8205 (zwj), if we get to here. - FM + */ + if (TRACE) { + fprintf(stderr, + "HTPlain_write: Ignoring '%ld'.\n", code); + } + } else if (code == 8206 || code == 8207) { + /* + ** Ignore 8206 (lrm) or 8207 (rlm), if we get to here. - FM + */ + if (TRACE) { + fprintf(stderr, + "HTPlain_write: Ignoring '%ld'.\n", code); + } +#endif /* NOTDEFINED */ + } else if (me->T.trans_from_uni && code > 255) { + if (PASSHI8BIT && PASSHICTRL && LYRawMode && + (unsigned char)*p >= LYlowest_eightbit[me->outUCLYhndl]) { + HText_appendCharacter(me->text, *p); } else { + sprintf(replace_buf, "U%.2lX", code); + HText_appendText(me->text, replace_buf); + } + /* + ** If we get to here and HTPassEightBitRaw or the + ** selected character set is not "ISO Latin 1", + ** use the translation tables for 161-255 8-bit + ** characters (173 was handled above). - FM + */ + } else if (code > 160) { + if (!HTPassEightBitRaw && code <= 255 && + me->outUCLYhndl != 0) { /* ** Out of luck, so use the UHHH notation (ugh). - FM */ - /* do not print UHHH for now + size_t len, high, low, i; + int diff = 1; + CONST char * name; + int value = (int)(code - 160); + + name = HTMLGetEntityName(value); + len = strlen(name); + for(low = 0, high = HTML_dtd.number_of_entities; + high > low; + diff < 0 ? (low = i+1) : (high = i)) { + /* Binary search */ + i = (low + (high-low)/2); + diff = strncmp(HTML_dtd.entity_names[i], name, len); + if (diff == 0) { + HText_appendText(me->text, + LYCharSets[me->outUCLYhndl][i]); + break; + } + } + if (diff) { + /* + ** Something went wrong in the translation, so + ** either output as UTF8 or a hex representation or + ** pass the raw character and hope it's OK. + */ + if (!PASSHI8BIT) + c = FROMASCII((char)code); + if (me->T.output_utf8 && + *me->utf_buf) { + HText_appendText(me->text, me->utf_buf); + me->utf_buf_p = me->utf_buf; + *(me->utf_buf_p) = '\0'; + + } else if (me->T.trans_from_uni) { sprintf(replace_buf, "U%.2lX", code); HText_appendText(me->text, replace_buf); - */ + } else + HText_appendCharacter(me->text, c); } + } else { /* - ** If we get to here and have a monobyte character, - ** pass it. - FM + ** Didn't attempt a translation. - FM */ - } else if (c_unsign != 0 && c_unsign < 256) { + /* Either output as UTF8 or a hex representation or + ** pass the raw character and hope it's OK. + */ + if (code <= 255 && !PASSHI8BIT) + c = FROMASCII((char)code); + if (code > 127 && me->T.output_utf8 && *me->utf_buf) { + HText_appendText(me->text, me->utf_buf); + me->utf_buf_p = me->utf_buf; + *(me->utf_buf_p) = '\0'; + + } else if (LYRawMode && + me->inUCLYhndl != me->outUCLYhndl && + (PASSHI8BIT || PASSHICTRL) && + (unsigned char)c >= + LYlowest_eightbit[me->outUCLYhndl]) { + HText_appendCharacter(me->text, c); + } else if (me->T.trans_from_uni && code >= 127) { + sprintf(replace_buf, "U%.2lX", code); + HText_appendText(me->text, replace_buf); + } else HText_appendCharacter(me->text, c); } + } #endif /* REMOVE_CR_ONLY */ } } @@ -650,7 +658,7 @@ PUBLIC HTStream* HTPlainPresent ARGS3( HTAnchor_getUCInfoStage(anchor,UCT_STAGE_HTEXT)); me->text = HText_new(anchor); - HText_setStyle(me->text, LYstyles(HTML_XMP) ); + HText_setStyle(me->text, styles[HTML_XMP] ); HText_beginAppend(me->text); return (HTStream*) me; diff --git a/WWW/Library/Implementation/HTRules.c b/WWW/Library/Implementation/HTRules.c index e666618f..24604e29 100644 --- a/WWW/Library/Implementation/HTRules.c +++ b/WWW/Library/Implementation/HTRules.c @@ -7,10 +7,10 @@ ** 10 Aug 91 Authorisation added after Daniel Martin (pass, fail) ** Rule order in file changed ** Comments allowed with # on 1st char of rule line -** 17 Jun 92 Bug fix: pass and fail failed if didn't contain '*' TBL -** 1 Sep 93 Bug fix: no memory check - Nathan Torkington -** BYTE_ADDRESSING removed - Arthur Secret -** 11 Sep 93 MD Changed %i into %d in debug printf. +** 17 Jun 92 Bug fix: pass and fail failed if didn't contain '*' TBL +** 1 Sep 93 Bug fix: no memory check - Nathan Torkington +** BYTE_ADDRESSING removed - Arthur Secret +** 11 Sep 93 MD Changed %i into %d in debug printf. ** VMS does not recognize %i. ** Bug Fix: in case of PASS, only one parameter to printf. ** 19 Sep 93 AL Added Access Authorization stuff. @@ -18,11 +18,12 @@ ** */ -#include <HTUtils.h> - /* (c) CERN WorldWideWeb project 1990,91. See Copyright.html for details */ #include <HTRules.h> +#include <HTUtils.h> +#include <tcp.h> +/*#include <stdio.h> included by HTUtils.h -- FM */ #include <HTFile.h> #include <HTAAServ.h> /* Access Authorization */ @@ -42,7 +43,7 @@ typedef struct _rule { ** ---------------- */ PUBLIC char *HTBinDir = NULL; /* Physical /htbin directory path. */ - /* In future this should not be global. */ + /* In future this should not be global. */ PUBLIC char *HTSearchScript = NULL; /* Search script name. */ @@ -60,11 +61,11 @@ PRIVATE rule * rule_tail = 0; /* Pointer to last on list */ ** -------------------- ** ** On entry, -** pattern points to 0-terminated string containing a single "*" +** pattern points to 0-terminated string containing a single "*" ** equiv points to the equivalent string with * for the ** place where the text matched by * goes. ** On exit, -** returns 0 if success, -1 if error. +** returns 0 if success, -1 if error. */ #ifdef __STDC__ @@ -76,32 +77,33 @@ int HTAddRule(op, pattern, equiv) char * equiv; #endif { /* BYTE_ADDRESSING removed and memory check - AS - 1 Sep 93 */ - rule * temp; - char * pPattern; + rule * temp; + char * pPattern; temp = (rule *)malloc(sizeof(*temp)); - if (temp==NULL) - outofmem(__FILE__, "HTAddRule"); + if (temp==NULL) + outofmem(__FILE__, "HTAddRule"); pPattern = (char *)malloc(strlen(pattern)+1); - if (pPattern==NULL) - outofmem(__FILE__, "HTAddRule"); + if (pPattern==NULL) + outofmem(__FILE__, "HTAddRule"); if (equiv) { /* Two operands */ char * pEquiv = (char *)malloc(strlen(equiv)+1); - if (pEquiv==NULL) - outofmem(__FILE__, "HTAddRule"); - temp->equiv = pEquiv; - strcpy(pEquiv, equiv); + if (pEquiv==NULL) + outofmem(__FILE__, "HTAddRule"); + temp->equiv = pEquiv; + strcpy(pEquiv, equiv); } else { - temp->equiv = 0; + temp->equiv = 0; } temp->pattern = pPattern; temp->op = op; strcpy(pPattern, pattern); - if (equiv) { - CTRACE(tfp, "Rule: For `%s' op %d `%s'\n", pattern, op, equiv); - } else { - CTRACE(tfp, "Rule: For `%s' op %d\n", pattern, op); + if (TRACE) { + if (equiv) + fprintf(stderr, "Rule: For `%s' op %d `%s'\n", pattern, op, equiv); + else + fprintf(stderr, "Rule: For `%s' op %d\n", pattern, op); } #ifdef PUT_ON_HEAD @@ -114,17 +116,17 @@ int HTAddRule(op, pattern, equiv) rule_tail = temp; #endif - + return 0; } -/* Clear all rules HTClearRules() +/* Clear all rules HTClearRules() ** --------------- ** ** On exit, ** There are no rules -** returns 0 if success, -1 if error. +** returns 0 if success, -1 if error. ** ** See also ** HTAddRule() @@ -136,7 +138,7 @@ int HTClearRules() #endif { while (rules) { - rule * temp = rules; + rule * temp = rules; rules = temp->next; FREE(temp->pattern); FREE(temp->equiv); @@ -158,7 +160,7 @@ int HTClearRules() ** On entry, ** required points to a string whose equivalent value is neeed ** On exit, -** returns the address of the equivalent string allocated from +** returns the address of the equivalent string allocated from ** the heap which the CALLER MUST FREE. If no translation ** occured, then it is a copy of te original. ** NEW FEATURES: @@ -183,7 +185,7 @@ char * HTTranslate(required) HTAA_clearProtections(); /* Reset from previous call -- AL */ for(r = rules; r; r = r->next) { - char * p = r->pattern; + char * p = r->pattern; int m=0; /* Number of characters matched against wildcard */ CONST char * q = current; for(;*p && *q; p++, q++) { /* Find first mismatch */ @@ -192,9 +194,9 @@ char * HTTranslate(required) if (*p == '*') { /* Match up to wildcard */ m = strlen(q) - strlen(p+1); /* Amount to match to wildcard */ - if(m<0) continue; /* tail is too short to match */ + if(m<0) continue; /* tail is too short to match */ if (0!=strcmp(q+m, p+1)) continue; /* Tail mismatch */ - } else /* Not wildcard */ + } else /* Not wildcard */ if (*p != *q) continue; /* plain mismatch: go to next rule */ switch (r->op) { /* Perform operation */ @@ -208,12 +210,13 @@ char * HTTranslate(required) char *eff_ids = NULL; char *prot_file = NULL; - CTRACE(tfp, "HTRule: `%s' matched %s %s: `%s'\n", - current, - (r->op==HT_Protect ? "Protect" : "DefProt"), - "rule, setup", - (r->equiv ? r->equiv : - (r->op==HT_Protect ?"DEFAULT" :"NULL!!"))); + if (TRACE) fprintf(stderr, + "HTRule: `%s' matched %s %s: `%s'\n", + current, + (r->op==HT_Protect ? "Protect" : "DefProt"), + "rule, setup", + (r->equiv ? r->equiv : + (r->op==HT_Protect ?"DEFAULT" :"NULL!!"))); if (r->equiv) { StrAllocCopy(local_copy, r->equiv); @@ -235,55 +238,57 @@ char * HTTranslate(required) #endif /* ACCESS_AUTH */ case HT_Pass: /* Authorised */ - if (!r->equiv) { - CTRACE(tfp, "HTRule: Pass `%s'\n", current); + if (!r->equiv) { + if (TRACE) fprintf(stderr, "HTRule: Pass `%s'\n", current); return current; - } + } /* Else fall through ...to map and pass */ - + case HT_Map: if (*p == *q) { /* End of both strings, no wildcard */ - CTRACE(tfp, "For `%s' using `%s'\n", current, r->equiv); - StrAllocCopy(current, r->equiv); /* use entire translation */ + if (TRACE) fprintf(stderr, + "For `%s' using `%s'\n", current, r->equiv); + StrAllocCopy(current, r->equiv); /* use entire translation */ } else { char * ins = strchr(r->equiv, '*'); /* Insertion point */ - if (ins) { /* Consistent rule!!! */ + if (ins) { /* Consistent rule!!! */ char * temp = (char *)malloc( strlen(r->equiv)-1 + m + 1); - if (temp==NULL) + if (temp==NULL) outofmem(__FILE__, "HTTranslate"); /* NT & AS */ - strncpy(temp, r->equiv, ins-r->equiv); + strncpy(temp, r->equiv, ins-r->equiv); /* Note: temp may be unterminated now! */ strncpy(temp+(ins-r->equiv), q, m); /* Matched bit */ strcpy (temp+(ins-r->equiv)+m, ins+1); /* Last bit */ - CTRACE(tfp, "For `%s' using `%s'\n", - current, temp); + if (TRACE) fprintf(stderr, "For `%s' using `%s'\n", + current, temp); FREE(current); - current = temp; /* Use this */ + current = temp; /* Use this */ } else { /* No insertion point */ char * temp = (char *)malloc(strlen(r->equiv)+1); - if (temp==NULL) + if (temp==NULL) outofmem(__FILE__, "HTTranslate"); /* NT & AS */ strcpy(temp, r->equiv); - CTRACE(tfp, "For `%s' using `%s'\n", + if (TRACE) fprintf(stderr, "For `%s' using `%s'\n", current, temp); FREE(current); - current = temp; /* Use this */ + current = temp; /* Use this */ } /* If no insertion point exists */ } if (r->op == HT_Pass) { - CTRACE(tfp, "HTRule: ...and pass `%s'\n", - current); + if (TRACE) fprintf(stderr, "HTRule: ...and pass `%s'\n", + current); return current; } break; case HT_Invalid: case HT_Fail: /* Unauthorised */ - CTRACE(tfp, "HTRule: *** FAIL `%s'\n", - current); - return (char *)0; + if (TRACE) fprintf(stderr, "HTRule: *** FAIL `%s'\n", + current); + return (char *)0; + } /* if tail matches ... switch operation */ } /* loop over rules */ @@ -308,7 +313,7 @@ PUBLIC int HTSetConfiguration ARGS1(CONST char *, config) float quality, secs, secs_per_byte; int maxbytes; int status; - + StrAllocCopy(line, config); { char * p = strchr(line, '#'); /* Chop off comments */ @@ -317,9 +322,9 @@ PUBLIC int HTSetConfiguration ARGS1(CONST char *, config) pointer = line; word1 = HTNextField(&pointer); if (!word1) { - FREE(line); + FREE(line); return 0; - } ; /* Comment only or blank */ + } ; /* Comment only or blank */ word2 = HTNextField(&pointer); @@ -336,7 +341,7 @@ PUBLIC int HTSetConfiguration ARGS1(CONST char *, config) } if (0==strcasecomp(word1, "suffix")) { - char * encoding = HTNextField(&pointer); + char * encoding = HTNextField(&pointer); if (pointer) status = sscanf(pointer, "%f", &quality); else status = 0; HTSetSuffix(word2, word3, @@ -344,12 +349,12 @@ PUBLIC int HTSetConfiguration ARGS1(CONST char *, config) status >= 1? quality : 1.0); } else if (0==strcasecomp(word1, "presentation")) { - if (pointer) status = sscanf(pointer, "%f%f%f%d", + if (pointer) status = sscanf(pointer, "%f%f%f%d", &quality, &secs, &secs_per_byte, &maxbytes); - else status = 0; + else status = 0; HTSetPresentation(word2, word3, - status >= 1? quality : 1.0, - status >= 2 ? secs : 0.0, + status >= 1? quality : 1.0, + status >= 2 ? secs : 0.0, status >= 3 ? secs_per_byte : 0.0, status >= 4 ? maxbytes : 0 ); @@ -361,17 +366,17 @@ PUBLIC int HTSetConfiguration ARGS1(CONST char *, config) StrAllocCopy(HTSearchScript, word2); /* Search script name */ } else { - op = 0==strcasecomp(word1, "map") ? HT_Map - : 0==strcasecomp(word1, "pass") ? HT_Pass - : 0==strcasecomp(word1, "fail") ? HT_Fail - : 0==strcasecomp(word1, "defprot") ? HT_DefProt + op = 0==strcasecomp(word1, "map") ? HT_Map + : 0==strcasecomp(word1, "pass") ? HT_Pass + : 0==strcasecomp(word1, "fail") ? HT_Fail + : 0==strcasecomp(word1, "defprot") ? HT_DefProt : 0==strcasecomp(word1, "protect") ? HT_Protect : HT_Invalid; if (op==HT_Invalid) { fprintf(stderr, "HTRule: Bad rule `%s'\n", config); - } else { + } else { HTAddRule(op, word2, word3); - } + } } FREE(line); return 0; @@ -386,7 +391,7 @@ PUBLIC int HTSetConfiguration ARGS1(CONST char *, config) ** On exit, ** Any existing rules will have been kept. ** Any new rules will have been loaded. -** Returns 0 if no error, 0 if error! +** Returns 0 if no error, 0 if error! ** ** Bugs: ** The strings may not contain spaces. @@ -396,9 +401,10 @@ int HTLoadRules ARGS1(CONST char *, filename) { FILE * fp = fopen(filename, "r"); char line[LINE_LENGTH+1]; - + if (!fp) { - CTRACE(tfp, "HTRules: Can't open rules file %s\n", filename); + if (TRACE) fprintf(stderr, + "HTRules: Can't open rules file %s\n", filename); return -1; /* File open error */ } for(;;) { diff --git a/WWW/Library/Implementation/HTRules.h b/WWW/Library/Implementation/HTRules.h index 3eb37169..d19b8a4b 100644 --- a/WWW/Library/Implementation/HTRules.h +++ b/WWW/Library/Implementation/HTRules.h @@ -16,7 +16,9 @@ #ifndef HTRULE_H #define HTRULE_H +#ifndef HTUTILS_H #include <HTUtils.h> +#endif /* HTUTILS_H */ typedef enum _HTRuleOp { HT_Invalid, diff --git a/WWW/Library/Implementation/HTStream.h b/WWW/Library/Implementation/HTStream.h index d2025274..5892a1a1 100644 --- a/WWW/Library/Implementation/HTStream.h +++ b/WWW/Library/Implementation/HTStream.h @@ -13,7 +13,9 @@ #ifndef HTSTREAM_H #define HTSTREAM_H +#ifndef HTUTILS_H #include <HTUtils.h> +#endif /* HTUTILS_H */ typedef struct _HTStream HTStream; @@ -23,7 +25,7 @@ typedef struct _HTStream HTStream; for end_document which must be called before free. It should be merged with free in fact: it should be dummy for new streams. - The put_block method was write, but this upset systems which had macros for write(). + The put_block method was write, but this upset systems whiuch had macros for write(). */ typedef struct _HTStreamClass { diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c index 00f70a6c..b669c379 100644 --- a/WWW/Library/Implementation/HTString.c +++ b/WWW/Library/Implementation/HTString.c @@ -6,12 +6,15 @@ ** 23 Jan 92 (TBL) Changed strallocc* to 8 char HTSAC* for VM and suchlike ** 6 Oct 92 (TBL) Moved WWW_TraceFlag in here to be in library */ - +#include <ctype.h> #include <HTUtils.h> +#include <tcp.h> #include <LYLeaks.h> #include <LYStrings.h> +#define FREE(x) if (x) {free(x); x = NULL;} + PUBLIC int WWW_TraceFlag = 0; /* Global trace flag for ALL W3 code */ #ifndef VC diff --git a/WWW/Library/Implementation/HTString.h b/WWW/Library/Implementation/HTString.h index 0609cb00..25c57002 100644 --- a/WWW/Library/Implementation/HTString.h +++ b/WWW/Library/Implementation/HTString.h @@ -7,7 +7,9 @@ #ifndef HTSTRING_H #define HTSTRING_H +#ifndef HTUTILS_H #include <HTUtils.h> +#endif /* HTUTILS_H */ extern int WWW_TraceFlag; /* Global flag for all W3 trace */ diff --git a/WWW/Library/Implementation/HTStyle.c b/WWW/Library/Implementation/HTStyle.c index 3469e44a..8fc72093 100644 --- a/WWW/Library/Implementation/HTStyle.c +++ b/WWW/Library/Implementation/HTStyle.c @@ -8,12 +8,13 @@ ** translation necessary to ** represent a document. It is a linked list of styles. */ - #include <HTUtils.h> #include <HTStyle.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* Create a new style */ PUBLIC HTStyle* HTStyleNew NOARGS @@ -183,7 +184,7 @@ HTStyle * HTStyleNamed ARGS2 (HTStyleSheet *,self, CONST char *,name) HTStyle * scan; for (scan=self->styles; scan; scan=scan->next) if (0==strcmp(scan->name, name)) return scan; - CTRACE(tfp, "StyleSheet: No style named `%s'\n", name); + if (TRACE) fprintf(stderr, "StyleSheet: No style named `%s'\n", name); return NULL; } @@ -234,8 +235,8 @@ HTStyle * HTStyleForRun (HTStyleSheet *self, NXRun *run) } } } - CTRACE(tfp, "HTStyleForRun: Best match for style is %d out of 18\n", - bestMatch); + if (TRACE) fprintf(stderr, "HTStyleForRun: Best match for style is %d out of 18\n", + bestMatch); return best; } #endif /* NEXT_SUPRESS */ @@ -324,7 +325,7 @@ HTStyleSheet * HTStyleSheetRead(HTStyleSheet * self, NXStream * stream) HTStyle * style; char styleName[80]; NXScanf(stream, " %d ", &numStyles); - CTRACE(tfp, "Stylesheet: Reading %d styles\n", numStyles); + if (TRACE) fprintf(stderr, "Stylesheet: Reading %d styles\n", numStyles); for (i=0; i<numStyles; i++) { NXScanf(stream, "%s", styleName); style = HTStyleNamed(self, styleName); @@ -352,7 +353,7 @@ HTStyleSheet * HTStyleSheetWrite(HTStyleSheet * self, NXStream * stream) for(style=self->styles; style; style=style->next) numStyles++; NXPrintf(stream, "%d\n", numStyles); - CTRACE(tfp, "StyleSheet: Writing %d styles\n", numStyles); + if (TRACE) fprintf(stderr, "StyleSheet: Writing %d styles\n", numStyles); for (style=self->styles; style; style=style->next) { NXPrintf(stream, "%s ", style->name); (void) HTStyleWrite(style, stream); diff --git a/WWW/Library/Implementation/HTStyle.h b/WWW/Library/Implementation/HTStyle.h index b4fcedaa..ae3e5d54 100644 --- a/WWW/Library/Implementation/HTStyle.h +++ b/WWW/Library/Implementation/HTStyle.h @@ -32,6 +32,9 @@ Overriding this module #ifndef HTStyle_H #define HTStyle_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTAnchor.h> typedef long int HTFont; /* Dummy definition instead */ diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index ba4a4b0f..56243a70 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -17,18 +17,20 @@ */ #include <HTUtils.h> +#include <tcp.h> /* Defines SHORT_NAMES if necessary */ #include <HTAccess.h> #include <HTParse.h> #include <HTAlert.h> #include <HTTCP.h> -#include <LYUtils.h> #ifdef NSL_FORK #include <signal.h> #include <sys/wait.h> #endif /* NSL_FORK */ -#define OK_HOST(p) ((p) != 0 && (p->h_length) != 0) +#define FREE(x) if (x) {free(x); x = NULL;} + +extern int HTCheckForInterrupt NOPARAMS; #ifdef SVR4_BSDSELECT PUBLIC int BSDselect PARAMS(( @@ -117,14 +119,11 @@ extern int sys_nerr; #ifdef _WINDOWS_NSL char host[512]; - struct hostent *phost; /* Pointer to host - See netdb.h */ - int donelookup; + struct hostent *phost; /* Pointer to host - See netdb.h */ unsigned long _fork_func (void *arglist) { - phost = gethostbyname(host); - donelookup = TRUE; - return (unsigned long)(phost); + return (unsigned long)(phost = gethostbyname(host)); } #endif /* _WINDOWS_NSL */ @@ -309,19 +308,6 @@ PUBLIC CONST char * HTInetString ARGS1( } #endif /* !DECNET */ -#ifdef NSL_FORK -/* -** Function to allow us to be killed with a normal signal (not -** SIGKILL), but don't go through normal libc exit() processing, which -** would screw up parent's stdio. -BL -*/ -PRIVATE void quench ARGS1( - int, sig GCC_UNUSED) -{ - _exit(2); -} -#endif /* NSL_FORK */ - /* Parse a network node address and port ** ------------------------------------- ** @@ -342,15 +328,19 @@ PUBLIC int HTParseInet ARGS2( int dotcount_ip = 0; /* for dotted decimal IP addr */ #ifndef _WINDOWS_NSL char *host = NULL; + struct hostent *phost; /* Pointer to host - See netdb.h */ #endif /* _WINDOWS_NSL */ if (!str) { - CTRACE(tfp, "HTParseInet: Can't parse `NULL'.\n"); + if (TRACE) { + fprintf(stderr, "HTParseInet: Can't parse `NULL'.\n"); + } return -1; } - CTRACE(tfp, "HTParseInet: parsing `%s'.\n", str); if (HTCheckForInterrupt()) { - CTRACE (tfp, "HTParseInet: INTERRUPTED for '%s'.\n", str); + if (TRACE) { + fprintf (stderr, "HTParseInet: INTERRUPTED for '%s'.\n", str); + } return -1; } #ifdef _WINDOWS_NSL @@ -378,8 +368,8 @@ PUBLIC int HTParseInet ARGS2( struct servent * serv = getservbyname(port, (char*)0); if (serv) { soc_in->sin_port = serv->s_port; - } else { - CTRACE(tfp, "TCP: Unknown service %s\n", port); + } else if (TRACE) { + fprintf(stderr, "TCP: Unknown service %s\n", port); } #endif /* SUPPRESS */ } @@ -392,8 +382,11 @@ PUBLIC int HTParseInet ARGS2( */ soc_in->sdn_nam.n_len = min(DN_MAXNAML, strlen(host)); /* <=6 in phase 4 */ strncpy(soc_in->sdn_nam.n_name, host, soc_in->sdn_nam.n_len + 1); - CTRACE(tfp, "DECnet: Parsed address as object number %d on host %.6s...\n", + if (TRACE) { + fprintf(stderr, + "DECnet: Parsed address as object number %d on host %.6s...\n", soc_in->sdn_objnum, host); + } #else /* parse Internet host: */ if (*host >= '0' && *host <= '9') { /* Test for numeric node address: */ @@ -434,7 +427,10 @@ PUBLIC int HTParseInet ARGS2( #endif /* _WINDOWS_NSL */ } else { /* Alphanumeric node name: */ #ifdef MVS /* Outstanding problem with crash in MVS gethostbyname */ - CTRACE(tfp, "HTParseInet: Calling gethostbyname(%s)\n", host); + if (TRACE) { + fprintf(stderr, + "HTParseInet: Calling gethostbyname(%s)\n", host); + } #endif /* MVS */ #ifdef NSL_FORK @@ -443,208 +439,160 @@ PUBLIC int HTParseInet ARGS2( ** checks for interrupts. - Tom Zerucha (tz@execpc.com) & FM */ { - int success = 0; /* - ** Pipe, child pid, status buffers, cycle count, select() - ** control variables. + ** Pipe, child pid, and status buffers. */ - pid_t fpid, waitret; - int pfd[2], h_length, selret, readret, waitstat = 0, cycle = 0; - fd_set readfds; - struct timeval timeout; - int dns_patience = 30; /* how many seconds will we wait for DNS? */ - int child_exited = 0; - - /* - ** Reap any children that have terminated since last time - ** through. This might include children that we killed, - ** then waited with WNOHANG before they were actually ready - ** to be reaped. (Should be max of 1 in this state, but - ** the loop is safe if waitpid() is implemented correctly: - ** returns 0 when children exist but none have exited; -1 - ** with errno == ECHILD when no children.) -BL - */ - do { - waitret = waitpid(-1, 0, WNOHANG); - } while (waitret > 0 || (waitret == -1 && errno == EINTR)); - waitret = 0; + pid_t fpid, waitret = (pid_t)0; + int pfd[2], cstat, cst1 = 0; pipe(pfd); if ((fpid = fork()) == 0 ) { - struct hostent *phost; /* Pointer to host - See netdb.h */ /* ** Child - for the long call. - ** - ** Make sure parent can kill us at will. -BL - */ - (void) signal(SIGTERM, quench); - - /* - ** Child won't use read side. -BL */ - close(pfd[0]); phost = gethostbyname(host); -#ifdef MVS - CTRACE(tfp, "HTParseInet: gethostbyname() returned %d\n", phost); -#endif /* MVS */ - + cst1 = 0; /* - ** Send length of subsequent value to parent (as a - ** native int). + ** Return value (or nulls). */ - if (OK_HOST(phost)) - h_length = phost->h_length; - else - h_length = 0; - write(pfd[1], &h_length, sizeof h_length); - - if (h_length) { - /* - ** Return value through pipe... - */ + if (phost != NULL) write(pfd[1], phost->h_addr, phost->h_length); - _exit(0); - } else { - /* - ** ... or return error as exit code. - */ - _exit(1); - } + else + write(pfd[1], &cst1, 4); + /* + ** Return an error code. + */ + _exit(phost == NULL); } /* - ** (parent) Wait until lookup finishes, or interrupt, - ** or cycled too many times (just in case) -BL + ** (parent) Wait until lookup finishes, or interrupt. */ - - close(pfd[1]); /* parent won't use write side -BL */ - - while (cycle < dns_patience) { - /* - ** Avoid infinite loop in the face of the unexpected. -BL - */ - cycle++; - - timeout.tv_sec = 1; - timeout.tv_usec = 0; - FD_ZERO(&readfds); - FD_SET(pfd[0], &readfds); -#ifndef USE_SLANG - /* - ** This allows us to abort immediately, not after 1-second - ** timeout, when user hits abort key. Can't do this when - ** using SLANG (or at least I don't know how), so SLANG - ** users must live with up-to-1s timeout. -BL - */ - FD_SET(0, &readfds); /* stdin -BL */ -#endif /* USE_SLANG */ - + cstat = 0; + while (cstat <= 0) { /* - ** Return when data received, interrupted, or failed. - ** If nothing is waiting, we sleep for 1 second in - ** select(), to be nice to the system. -BL + ** Exit when data sent. */ -#ifdef SOCKS - if (socks_flag) - selret = Rselect(pfd[0] + 1, (void *)&readfds, NULL, NULL, &timeout); - else -#endif /* SOCKS */ - selret = select(pfd[0] + 1, (void *)&readfds, NULL, NULL, &timeout); - - if ((selret > 0) && FD_ISSET(pfd[0], &readfds)) { - /* - ** First get length of address. -BL - */ - readret = read(pfd[0], (void *)&h_length, sizeof h_length); - if (readret == sizeof h_length && - h_length == sizeof soc_in->sin_addr) { - /* - ** Then get address itself. -BL - */ - readret = read(pfd[0], (void *)&soc_in->sin_addr, h_length); - if (readret == h_length) success = 1; - } - /* - ** Make sure child is cleaned up. -BL - */ - if (!child_exited) - waitret = waitpid(fpid, &waitstat, WNOHANG); - if (!WIFEXITED(waitstat) && !WIFSIGNALED(waitstat)) { - kill(fpid, SIGTERM); - waitret = waitpid(fpid, &waitstat, WNOHANG); - } + IOCTL(pfd[0], FIONREAD, &cstat); + if (cstat > 0) break; - } - /* - ** Clean up if child exited before & no data received. -BL + ** Exit if child exited. */ - if (child_exited) { - waitret = waitpid(fpid, &waitstat, WNOHANG); + if ((waitret = waitpid(fpid, &cst1, WNOHANG)) > 0) { break; } /* - ** If child exited, loop once more looking for data. -BL - */ - if ((waitret = waitpid(fpid, &waitstat, WNOHANG)) > 0) { - /* - ** Data will be arriving right now, so make sure we - ** don't short-circuit out for too many loops, and - ** skip the interrupt check. -BL - */ - child_exited = 1; - cycle--; - continue; - } - - /* ** Abort if interrupt key pressed. */ if (HTCheckForInterrupt()) { - CTRACE(tfp, "HTParseInet: INTERRUPTED gethostbyname.\n"); - kill(fpid, SIGTERM); - waitpid(fpid, NULL, WNOHANG); + if (TRACE) { + fprintf(stderr, + "HTParseInet: INTERRUPTED gethostbyname.\n"); + } + kill(fpid , SIGKILL); + waitpid(fpid, NULL, 0); FREE(host); close(pfd[0]); + close(pfd[1]); return HT_INTERRUPTED; } + /* + ** Be nice to the system. + */ + sleep(1); } - close(pfd[0]); if (waitret <= 0) { - kill(fpid, SIGTERM); - waitret = waitpid(fpid, &waitstat, WNOHANG); + waitret = waitpid(fpid, &cst1, WNOHANG); } - if (waitret > 0) { - if (WIFEXITED(waitstat)) { - CTRACE(tfp, "HTParseInet: NSL_FORK child %d exited, status 0x%x.\n", - (int)waitret, waitstat); - } else if (WIFSIGNALED(waitstat)) { - CTRACE(tfp, "HTParseInet: NSL_FORK child %d got signal, status 0x%x!\n", - (int)waitret, waitstat); + if (TRACE) { + if (WIFEXITED(cst1)) { + fprintf(stderr, + "HTParseInet: NSL_FORK child %d exited, status 0x%x.\n", + (int)waitret, cst1); + } else if (WIFSIGNALED(cst1)) { + fprintf(stderr, + "HTParseInet: NSL_FORK child %d got signal, status 0x%x!\n", + (int)waitret, cst1); #ifdef WCOREDUMP - if (WCOREDUMP(waitstat)) { - CTRACE(tfp, "HTParseInet: NSL_FORK child %d dumped core!\n", - (int)waitret); + if (WCOREDUMP(cst1)) { + fprintf(stderr, + "HTParseInet: NSL_FORK child %d dumped core!\n", + (int)waitret); } #endif /* WCOREDUMP */ - } else if (WIFSTOPPED(waitstat)) { - CTRACE(tfp, "HTParseInet: NSL_FORK child %d is stopped, status 0x%x!\n", - (int)waitret, waitstat); + } else if (WIFSTOPPED(cst1)) { + fprintf(stderr, + "HTParseInet: NSL_FORK child %d is stopped, status 0x%x!\n", + (int)waitret, cst1); } } - if (!success) { - memset((void *)&soc_in->sin_addr, 0, sizeof(soc_in->sin_addr)); - goto failed; + /* + ** Read as much as we can - should be the address. + */ + IOCTL(pfd[0], FIONREAD, &cstat); + if (cstat < 4) { + if (TRACE) { + fprintf(stderr, + "HTParseInet: NSL_FORK child returns only %d bytes.\n", + cstat); + fprintf(stderr, + " Trying again without forking.\n"); + } + phost = gethostbyname(host); /* See netdb.h */ + if (!phost) { + if (TRACE) { + fprintf(stderr, + "HTParseInet: Can't find internet node name `%s'.\n", + host); + } + memset((void *)&soc_in->sin_addr, 0, sizeof(soc_in->sin_addr)); + } else { + memcpy((void *)&soc_in->sin_addr, + phost->h_addr, phost->h_length); + } +#ifdef NOTDEFINED + cstat = read(pfd[0], (void *)&soc_in->sin_addr , 4); +#endif /* NOTDEFINED */ + } else { + cstat = read(pfd[0], (void *)&soc_in->sin_addr , cstat); } + close(pfd[0]); + close(pfd[1]); } + if (soc_in->sin_addr.s_addr == 0) { + if (TRACE) { + fprintf(stderr, + "HTParseInet: Can't find internet node name `%s'.\n", + host); + } +#ifndef _WINDOWS_NSL + FREE(host); +#endif /* _WINDOWS_NSL */ + return -1; + } +#ifndef _WINDOWS_NSL + FREE(host); +#endif /* _WINDOWS_NSL */ +#ifdef MVS + if (TRACE) { + fprintf(stderr, + "HTParseInet: gethostbyname() returned %d\n", phost); + } +#endif /* MVS */ + #else /* Not NSL_FORK: */ #ifdef DJGPP soc_in->sin_addr.s_addr = htonl(resolve(host)); + FREE(host); if (soc_in->sin_addr.s_addr == 0) { - goto failed; + if (TRACE) + fprintf(stderr, + "HTTPAccess: Can't find internet node name `%s'.\n",host); + return -1; /* Fail? */ } -#else /* !NSL_FORK, !DJGPP: */ +#else #ifdef _WINDOWS_NSL { #ifdef __BORLANDC__ @@ -663,9 +611,7 @@ PUBLIC int HTParseInet ARGS2( if (!hThread) MessageBox((void *)NULL, "CreateThread", "CreateThread Failed", 0L); - - donelookup = FALSE; - while (!donelookup) + while (!phost) if (HTCheckForInterrupt()) { /* Note that host is a character array and is not freed */ @@ -676,56 +622,54 @@ PUBLIC int HTParseInet ARGS2( return HT_INTERRUPTED; }; }; - if (!phost) goto failed; - memcpy((void *)&soc_in->sin_addr, phost->h_addr, phost->h_length); -#else /* !NSL_FORK, !DJGPP, !_WINDOWS_NSL: */ - { - struct hostent *phost; - phost = gethostbyname(host); /* See netdb.h */ +#else /* !_WINDOWS_NSL */ + phost = gethostbyname(host); /* See netdb.h */ +#endif /* _WINDOWS_NSL */ #ifdef MVS - CTRACE(tfp, "HTParseInet: gethostbyname() returned %d\n", phost); + if (TRACE) { + fprintf(stderr, + "HTParseInet: gethostbyname() returned %d\n", phost); + } #endif /* MVS */ - if (!phost) goto failed; + if (!phost) { + if (TRACE) { + fprintf(stderr, + "HTParseInet: Can't find internet node name `%s'.\n", + host); + } + FREE(host); + return -1; /* Fail? */ + } + FREE(host); #if defined(VMS) && defined(CMU_TCP) - /* - ** In LIBCMU, phost->h_length contains not the length of one address - ** (four bytes) but the number of bytes in *h_addr, i.e. some multiple - ** of four. Thus we need to hard code the value here, and remember to - ** change it if/when IP addresses change in size. :-( LIBCMU is no - ** longer supported, and CMU users are encouraged to obtain and use - ** SOCKETSHR/NETLIB instead. - S. Bjorndahl - */ - memcpy((void *)&soc_in->sin_addr, phost->h_addr, 4); + /* + ** In LIBCMU, phost->h_length contains not the length of one address + ** (four bytes) but the number of bytes in *h_addr, i.e. some multiple + ** of four. Thus we need to hard code the value here, and remember to + ** change it if/when IP addresses change in size. :-( LIBCMU is no + ** longer supported, and CMU users are encouraged to obtain and use + ** SOCKETSHR/NETLIB instead. - S. Bjorndahl + */ + memcpy((void *)&soc_in->sin_addr, phost->h_addr, 4); #else - memcpy((void *)&soc_in->sin_addr, phost->h_addr, phost->h_length); + memcpy((void *)&soc_in->sin_addr, phost->h_addr, phost->h_length); #endif /* VMS && CMU_TCP */ - } -#endif /* !NSL_FORK, !DJGPP, !_WINDOWS_NSL */ -#endif /* !NSL_FORK, !DJGPP */ -#endif /* !NSL_FORK */ -#ifndef _WINDOWS_NSL - FREE(host); -#endif /* _WINDOWS_NSL */ - +#endif /* DJGPP */ +#endif /* NSL_FORK */ } - CTRACE(tfp, "HTParseInet: Parsed address as port %d, IP address %d.%d.%d.%d\n", + if (TRACE) { + fprintf(stderr, + "HTParseInet: Parsed address as port %d, IP address %d.%d.%d.%d\n", (int)ntohs(soc_in->sin_port), (int)*((unsigned char *)(&soc_in->sin_addr)+0), (int)*((unsigned char *)(&soc_in->sin_addr)+1), (int)*((unsigned char *)(&soc_in->sin_addr)+2), (int)*((unsigned char *)(&soc_in->sin_addr)+3)); + } #endif /* Internet vs. Decnet */ return 0; /* OK */ - -failed: - CTRACE(tfp, "HTParseInet: Can't find internet node name `%s'.\n", - host); -#ifndef _WINDOWS_NSL - FREE(host); -#endif /* _WINDOWS_NSL */ - return -1; } /* Free our name for the host on which we are - FM @@ -779,15 +723,16 @@ PRIVATE void get_host_details NOARGS #ifndef DECNET /* Decnet ain't got no damn name server 8#OO */ #ifdef NEED_HOST_ADDRESS /* no -- needs name server! */ phost = gethostbyname(name); /* See netdb.h */ - if (!OK_HOST(phost)) { - CTRACE(tfp, "TCP: Can't find my own internet node address for `%s'!!\n", - name); + if (!phost) { + if (TRACE) fprintf(stderr, + "TCP: Can't find my own internet node address for `%s'!!\n", + name); return; /* Fail! */ } StrAllocCopy(hostname, phost->h_name); memcpy(&HTHostAddress, &phost->h_addr, phost->h_length); - CTRACE(tfp, " Name server says that I am `%s' = %s\n", - hostname, HTInetString(&HTHostAddress)); + if (TRACE) fprintf(stderr, " Name server says that I am `%s' = %s\n", + hostname, HTInetString(&HTHostAddress)); #endif /* NEED_HOST_ADDRESS */ #endif /* !DECNET */ @@ -821,7 +766,6 @@ PUBLIC int HTDoConnect ARGS4( /* ** Set up defaults. */ - memset(soc_in, 0, sizeof(*soc_in)); soc_in->sin_family = AF_INET; soc_in->sin_port = htons(default_port); @@ -1046,7 +990,8 @@ PUBLIC int HTDoConnect ARGS4( } } if (HTCheckForInterrupt()) { - CTRACE(tfp, "*** INTERRUPTED in middle of connect.\n"); + if (TRACE) + fprintf(stderr, "*** INTERRUPTED in middle of connect.\n"); status = HT_INTERRUPTED; SOCKET_ERRNO = EINTR; break; diff --git a/WWW/Library/Implementation/HTTCP.h b/WWW/Library/Implementation/HTTCP.h index 05e8278f..c7f16dcc 100644 --- a/WWW/Library/Implementation/HTTCP.h +++ b/WWW/Library/Implementation/HTTCP.h @@ -7,7 +7,10 @@ #ifndef HTTCP_H #define HTTCP_H +#ifndef HTUTILS_H #include <HTUtils.h> +#endif /* HTUTILS_H */ +#include <tcp.h> #ifdef SHORT_NAMES #define HTInetStatus HTInStat @@ -112,3 +115,6 @@ extern int HTDoRead PARAMS(( unsigned nbyte)); #endif /* HTTCP_H */ +/* + + End. */ diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index 4d128c81..996ebd4b 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -7,8 +7,9 @@ */ #include <HTUtils.h> +#include <tcp.h> + #include <HTTP.h> -#include <LYUtils.h> #define HTTP_VERSION "HTTP/1.0" @@ -24,18 +25,18 @@ #include <HTTCP.h> #include <HTFormat.h> #include <HTFile.h> +#include <ctype.h> #include <HTAlert.h> #include <HTMIME.h> #include <HTML.h> #include <HTInit.h> #include <HTAABrow.h> -#include <LYCookie.h> #include <LYGlobalDefs.h> -#include <GridText.h> -#include <LYStrings.h> #include <LYLeaks.h> +/* #define TRACE 1 */ + struct _HTStream { HTStreamClass * isa; @@ -64,6 +65,18 @@ extern char *http_error_file; /* Store HTTP status code in this file */ extern BOOL traversal; /* TRUE if we are doing a traversal */ extern BOOL dump_output_immediately; /* TRUE if no interactive user */ +extern char * HTLoadedDocumentURL NOPARAMS; +extern int HTCheckForInterrupt NOPARAMS; +extern void LYSetCookie PARAMS(( + CONST char * SetCookie, + CONST char * SetCookie2, + CONST char * address)); +extern char * LYCookie PARAMS(( + CONST char * hostname, + CONST char * path, + int port, + BOOL secure)); + #define HTTP_NETREAD(a, b, c, d) NETREAD(a, b, c) #define HTTP_NETWRITE(a, b, c, d) NETWRITE(a, b, c) #define HTTP_NETCLOSE(a, b) (void)NETCLOSE(a) @@ -152,6 +165,7 @@ try_again: ** so we can start over here... */ eol = 0; + bytes_already_read = 0; had_header = NO; length = 0; doing_redirect = FALSE; @@ -172,13 +186,17 @@ try_again: /* ** Interrupt cleanly. */ - CTRACE (tfp, "HTTP: Interrupted on connect; recovering cleanly.\n"); - _HTProgress ("Connection interrupted."); - status = HT_NOT_LOADED; - goto done; - } - if (status < 0) { - CTRACE(tfp, "HTTP: Unable to connect to remote host for `%s' (errno = %d).\n", + if (TRACE) + fprintf (stderr, + "HTTP: Interrupted on connect; recovering cleanly.\n"); + _HTProgress ("Connection interrupted."); + status = HT_NOT_LOADED; + goto done; + } + if (status < 0) { + if (TRACE) + fprintf(stderr, + "HTTP: Unable to connect to remote host for `%s' (errno = %d).\n", url, SOCKET_ERRNO); HTAlert("Unable to connect to remote host."); status = HT_NOT_LOADED; @@ -295,7 +313,8 @@ try_again: strcpy(line, pref_charset); if (line[strlen(line)-1] == ',') line[strlen(line)-1] = '\0'; - LYLowerCase(line); + for (i = 0; line[i]; i++) + line[i] = TOLOWER(line[i]); if (strstr(line, "iso-8859-1") == NULL) strcat(line, ", iso-8859-1;q=0.01"); if (strstr(line, "us-ascii") == NULL) @@ -422,7 +441,8 @@ try_again: */ sprintf(line, "%s%c%c", auth, CR, LF); StrAllocCat(command, line); - CTRACE(tfp, "HTTP: Sending authorization: %s\n", auth); + if (TRACE) + fprintf(stderr, "HTTP: Sending authorization: %s\n", auth); } else if (auth && *auth == '\0') { /* ** If auth is a zero-length string, the user either @@ -446,7 +466,9 @@ try_again: goto done; } } else { - CTRACE(tfp, "HTTP: Not sending authorization (yet).\n"); + if (TRACE) + fprintf(stderr, + "HTTP: Not sending authorization (yet).\n"); } /* ** Add 'Cookie:' header, if it's HTTP or HTTPS @@ -479,7 +501,9 @@ try_again: */ StrAllocCat(command, "Cookie2: $Version=\"1\""); StrAllocCat(command, crlf); - CTRACE(tfp, "HTTP: Sending Cookie2: $Version =\"1\"\n"); + if (TRACE) + fprintf(stderr, + "HTTP: Sending Cookie2: $Version =\"1\"\n"); } if (*cookie != '\0') { /* @@ -490,7 +514,8 @@ try_again: StrAllocCat(command, "Cookie: "); StrAllocCat(command, cookie); StrAllocCat(command, crlf); - CTRACE(tfp, "HTTP: Sending Cookie: %s\n", cookie); + if (TRACE) + fprintf(stderr, "HTTP: Sending Cookie: %s\n", cookie); } FREE(cookie); } @@ -515,7 +540,9 @@ try_again: */ sprintf(line, "%s%c%c", auth, CR, LF); StrAllocCat(command, line); - CTRACE(tfp, (auth_proxy ? + if (TRACE) + fprintf(stderr, + (auth_proxy ? "HTTP: Sending proxy authorization: %s\n" : "HTTP: Sending authorization: %s\n"), auth); @@ -542,7 +569,9 @@ try_again: goto done; } } else { - CTRACE(tfp, (auth_proxy ? + if (TRACE) + fprintf(stderr, + (auth_proxy ? "HTTP: Not sending proxy authorization (yet).\n" : "HTTP: Not sending authorization (yet).\n")); } @@ -552,10 +581,12 @@ try_again: auth_proxy = NO; } - if (do_post) { - CTRACE (tfp, "HTTP: Doing post, content-type '%s'\n", - anAnchor->post_content_type ? anAnchor->post_content_type - : "lose"); + if (do_post) + { + if (TRACE) + fprintf (stderr, "HTTP: Doing post, content-type '%s'\n", + anAnchor->post_content_type ? anAnchor->post_content_type + : "lose"); sprintf (line, "Content-type: %s%c%c", anAnchor->post_content_type ? anAnchor->post_content_type : "lose", CR, LF); @@ -578,9 +609,12 @@ try_again: else StrAllocCat(command, crlf); /* Blank line means "end" of headers */ - CTRACE (tfp, "Writing:\n%s%s----------------------------------\n", + if (TRACE) { + fprintf (stderr, + "Writing:\n%s%s----------------------------------\n", command, (anAnchor->post_data ? crlf : "")); + } _HTProgress ("Sending HTTP request."); @@ -588,7 +622,8 @@ try_again: FREE(command); if (status <= 0) { if (status == 0) { - CTRACE (tfp, "HTTP: Got status 0 in initial write\n"); + if (TRACE) + fprintf (stderr, "HTTP: Got status 0 in initial write\n"); /* Do nothing. */ } else if ((SOCKET_ERRNO == ENOTCONN || SOCKET_ERRNO == ECONNRESET || @@ -598,14 +633,18 @@ try_again: /* ** Arrrrgh, HTTP 0/1 compability problem, maybe. */ - CTRACE (tfp, "HTTP: BONZO ON WRITE Trying again with HTTP0 request.\n"); + if (TRACE) + fprintf (stderr, + "HTTP: BONZO ON WRITE Trying again with HTTP0 request.\n"); _HTProgress ("Retrying as HTTP0 request."); HTTP_NETCLOSE(s, handle); extensions = NO; already_retrying = TRUE; goto try_again; } else { - CTRACE (tfp, "HTTP: Hit unexpected network WRITE error; aborting connection.\n"); + if (TRACE) + fprintf (stderr, + "HTTP: Hit unexpected network WRITE error; aborting connection.\n"); HTTP_NETCLOSE(s, handle); status = -1; HTAlert("Unexpected network write error; connection aborted."); @@ -613,7 +652,8 @@ try_again: } } - CTRACE (tfp, "HTTP: WRITE delivered OK\n"); + if (TRACE) + fprintf (stderr, "HTTP: WRITE delivered OK\n"); _HTProgress ("HTTP request sent; waiting for response."); /* Read the first line of the response @@ -626,7 +666,6 @@ try_again: line_buffer = (char *)calloc(1, (buffer_length * sizeof(char))); - HTReadProgress (bytes_already_read = 0, 0); do {/* Loop to read in the first line */ /* ** Extend line buffer if necessary for those crazy WAIS URLs ;-) @@ -636,18 +675,21 @@ try_again: line_buffer = (char *)realloc(line_buffer, (buffer_length * sizeof(char))); } - CTRACE (tfp, "HTTP: Trying to read %d\n", + if (TRACE) + fprintf (stderr, "HTTP: Trying to read %d\n", buffer_length - length - 1); status = HTTP_NETREAD(s, line_buffer + length, buffer_length - length - 1, handle); - CTRACE (tfp, "HTTP: Read %d\n", status); + if (TRACE) + fprintf (stderr, "HTTP: Read %d\n", status); if (status <= 0) { /* * Retry if we get nothing back too. * Bomb out if we get nothing twice. */ if (status == HT_INTERRUPTED) { - CTRACE (tfp, "HTTP: Interrupted initial read.\n"); + if (TRACE) + fprintf (stderr, "HTTP: Interrupted initial read.\n"); _HTProgress ("Connection interrupted."); HTTP_NETCLOSE(s, handle); status = HT_NO_DATA; @@ -660,7 +702,9 @@ try_again: /* ** Arrrrgh, HTTP 0/1 compability problem, maybe. */ - CTRACE (tfp, "HTTP: BONZO Trying again with HTTP0 request.\n"); + if (TRACE) + fprintf (stderr, + "HTTP: BONZO Trying again with HTTP0 request.\n"); HTTP_NETCLOSE(s, handle); FREE(line_buffer); FREE(line_kept_clean); @@ -670,7 +714,9 @@ try_again: _HTProgress ("Retrying as HTTP0 request."); goto try_again; } else { - CTRACE (tfp, "HTTP: Hit unexpected network read error; aborting connection; status %d.\n", + if (TRACE) + fprintf (stderr, + "HTTP: Hit unexpected network read error; aborting connection; status %d.\n", status); HTAlert("Unexpected network read error; connection aborted."); HTTP_NETCLOSE(s, handle); @@ -680,7 +726,8 @@ try_again: } bytes_already_read += status; - HTReadProgress (bytes_already_read, 0); + sprintf (line, "Read %d bytes of data.", bytes_already_read); + HTProgress (line); #ifdef UCX /* UCX returns -1 on EOF */ if (status == 0 || status == -1) @@ -724,7 +771,8 @@ try_again: /* We now have a terminated unfolded line. Parse it. ** ------------------------------------------------- */ - CTRACE(tfp, "HTTP: Rx: %s\n", line_buffer); + if (TRACE) + fprintf(stderr, "HTTP: Rx: %s\n", line_buffer); /* ** Kludge to work with old buggy servers and the VMS Help gateway. @@ -740,7 +788,8 @@ try_again: FREE(line_kept_clean); extensions = NO; already_retrying = TRUE; - CTRACE(tfp, "HTTP: close socket %d to retry with HTTP0\n", s); + if (TRACE) + fprintf(stderr, "HTTP: close socket %d to retry with HTTP0\n", s); HTTP_NETCLOSE(s, handle); /* print a progress message */ _HTProgress ("Retrying as HTTP0 request."); @@ -759,7 +808,8 @@ try_again: server_version, &server_status); - CTRACE (tfp, "HTTP: Scanned %d fields from line_buffer\n", fields); + if (TRACE) + fprintf (stderr, "HTTP: Scanned %d fields from line_buffer\n", fields); if (http_error_file) { /* Make the status code externally available */ FILE *error_file; @@ -791,7 +841,8 @@ try_again: */ HTAtom * encoding; - CTRACE (tfp, "--- Talking HTTP0.\n"); + if (TRACE) + fprintf (stderr, "--- Talking HTTP0.\n"); format_in = HTFileFormat(url, &encoding, NULL); /* @@ -800,19 +851,27 @@ try_again: ** without looking at content. */ if (!strncmp(HTAtom_name(format_in), "text/plain",10)) { - CTRACE(tfp, "HTTP: format_in being changed to text/HTML\n"); + if (TRACE) + fprintf(stderr, + "HTTP: format_in being changed to text/HTML\n"); format_in = WWW_HTML; } if (!IsUnityEnc(encoding)) { /* ** Change the format to that for "www/compressed". */ - CTRACE(tfp, "HTTP: format_in is '%s',\n", HTAtom_name(format_in)); + if (TRACE) { + fprintf(stderr, + "HTTP: format_in is '%s',\n", HTAtom_name(format_in)); + } StrAllocCopy(anAnchor->content_type, HTAtom_name(format_in)); StrAllocCopy(anAnchor->content_encoding, HTAtom_name(encoding)); format_in = HTAtom_for("www/compressed"); - CTRACE(tfp, " Treating as '%s' with encoding '%s'\n", + if (TRACE) { + fprintf(stderr, + " Treating as '%s' with encoding '%s'\n", "www/compressed", HTAtom_name(encoding)); + } } start_of_data = line_kept_clean; @@ -821,7 +880,8 @@ try_again: ** Set up to decode full HTTP/1.n response. - FM */ format_in = HTAtom_for("www/mime"); - CTRACE (tfp, "--- Talking HTTP1.\n"); + if (TRACE) + fprintf (stderr, "--- Talking HTTP1.\n"); /* ** We set start_of_data to "" when !eol here because there @@ -881,6 +941,7 @@ try_again: HTTP_NETCLOSE(s, handle); status = HT_NO_DATA; goto clean_up; + break; case 205: /* @@ -894,6 +955,7 @@ try_again: HTTP_NETCLOSE(s, handle); status = HT_NO_DATA; goto clean_up; + break; case 206: /* @@ -906,6 +968,7 @@ try_again: HTTP_NETCLOSE(s, handle); status = HT_NO_DATA; goto clean_up; + break; default: /* @@ -1070,7 +1133,8 @@ try_again: /* * Impatient user. - FM */ - CTRACE (tfp, "HTTP: Interrupted followup read.\n"); + if (TRACE) + fprintf (stderr, "HTTP: Interrupted followup read.\n"); _HTProgress ("Connection interrupted."); status = HT_INTERRUPTED; goto clean_up; @@ -1083,7 +1147,9 @@ try_again: * Don't make the redirection permanent * if we have POST content. - FM */ - CTRACE(tfp, "HTTP: Have POST content. Treating 301 (Permanent) as Temporary.\n"); + if (TRACE) + fprintf(stderr, + "HTTP: Have POST content. Treating 301 (Permanent) as Temporary.\n"); HTAlert( "Have POST content. Treating Permanent Redirection as Temporary.\n"); } else { @@ -1301,7 +1367,9 @@ Cookie2_continuation: * thus is probably something in the body, so * we'll show the user what was returned. - FM */ - CTRACE(tfp, "HTTP: 'Location:' is zero-length!\n"); + if (TRACE) + fprintf(stderr, + "HTTP: 'Location:' is zero-length!\n"); if (cp1) *cp1 = LF; if (cp2) @@ -1320,7 +1388,9 @@ Cookie2_continuation: * seek the document at that Location. - FM */ HTProgress(line_buffer); - CTRACE(tfp, "HTTP: Picked up location '%s'\n", + if (TRACE) + fprintf(stderr, + "HTTP: Picked up location '%s'\n", redirecting_url); if (cp1) *cp1 = LF; @@ -1338,7 +1408,9 @@ Cookie2_continuation: * Append our URL. - FM */ StrAllocCat(redirecting_url, anAnchor->address); - CTRACE(tfp, "HTTP: Proxy URL is '%s'\n", + if (TRACE) + fprintf(stderr, + "HTTP: Proxy URL is '%s'\n", redirecting_url); } if (!do_post || @@ -1402,7 +1474,8 @@ Cookie2_continuation: * header, so we'll show the user what we got, if * anything. - FM */ - CTRACE (tfp, "HTTP: Failed to pick up location.\n"); + if (TRACE) + fprintf (stderr, "HTTP: Failed to pick up location.\n"); doing_redirect = FALSE; permanent_redirection = FALSE; start_of_data = line_kept_clean; @@ -1446,7 +1519,8 @@ Cookie2_continuation: */ if (show_401) break; - if (HTAA_shouldRetryWithAuth(start_of_data, length, s, NO)) { + if (HTAA_shouldRetryWithAuth(start_of_data, length, + (void *)handle, s, NO)) { HTTP_NETCLOSE(s, handle); if (dump_output_immediately && !authentication_info[0]) { @@ -1458,15 +1532,17 @@ Cookie2_continuation: goto clean_up; } - CTRACE(tfp, "%s %d %s\n", - "HTTP: close socket", s, - "to retry with Access Authorization"); + if (TRACE) + fprintf(stderr, "%s %d %s\n", + "HTTP: close socket", s, + "to retry with Access Authorization"); _HTProgress ( "Retrying with access authorization information."); FREE(line_buffer); FREE(line_kept_clean); goto try_again; + break; } else if (!(traversal || dump_output_immediately) && HTConfirm("Show the 401 message body?")) { break; @@ -1478,6 +1554,7 @@ Cookie2_continuation: status = -1; goto clean_up; } + break; case 407: /* @@ -1493,7 +1570,8 @@ Cookie2_continuation: */ if (!using_proxy || show_407) break; - if (HTAA_shouldRetryWithAuth(start_of_data, length, s, YES)) { + if (HTAA_shouldRetryWithAuth(start_of_data, length, + (void *)handle, s, YES)) { HTTP_NETCLOSE(s, handle); if (dump_output_immediately && !proxyauth_info[0]) { @@ -1505,15 +1583,17 @@ Cookie2_continuation: goto clean_up; } - CTRACE(tfp, "%s %d %s\n", - "HTTP: close socket", s, - "to retry with Proxy Authorization"); + if (TRACE) + fprintf(stderr, "%s %d %s\n", + "HTTP: close socket", s, + "to retry with Proxy Authorization"); _HTProgress ( "Retrying with proxy authorization information."); FREE(line_buffer); FREE(line_kept_clean); goto try_again; + break; } else if (!(traversal || dump_output_immediately) && HTConfirm("Show the 407 message body?")) { if (!dump_output_immediately && @@ -1534,6 +1614,7 @@ Cookie2_continuation: status = -1; goto clean_up; } + break; case 408: /* @@ -1544,6 +1625,7 @@ Cookie2_continuation: HTTP_NETCLOSE(s, handle); status = HT_NO_DATA; goto done; + break; default: /* @@ -1697,7 +1779,8 @@ Cookie2_continuation: (*target->isa->_abort)(target, NULL); HTTP_NETCLOSE(s, handle); if (!already_retrying && !do_post) { - CTRACE (tfp, "HTTP: Trying again with HTTP0 request.\n"); + if (TRACE) + fprintf (stderr, "HTTP: Trying again with HTTP0 request.\n"); /* ** May as well consider it an interrupt -- right? */ diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c index 5de48da1..3a03eb33 100644 --- a/WWW/Library/Implementation/HTTelnet.c +++ b/WWW/Library/Implementation/HTTelnet.c @@ -14,7 +14,7 @@ */ #include <HTUtils.h> -#include <LYUtils.h> +#include <tcp.h> /* Implements: */ @@ -24,6 +24,8 @@ #include <HTAnchor.h> #include <HTTP.h> #include <HTFile.h> +/*#include <errno.h> included by tcp.h -- FM */ +/*#include <stdio.h> included by HTUtils.h -- FM */ #include <HText.h> @@ -32,9 +34,10 @@ #include <userdefs.h> /* for TELNET_COMMAND and RLOGIN_COMMAND */ -#include <LYStrings.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + #define HT_NO_DATA -9999 @@ -52,6 +55,10 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) enum _login_protocol { telnet, rlogin, tn3270 } login_protocol = strcmp(acc_method, "rlogin") == 0 ? rlogin : strcmp(acc_method, "tn3270") == 0 ? tn3270 : telnet; +#ifdef VMS + extern int DCLsystem PARAMS((char *command)); +#define system(a) DCLsystem(a) /* use LYCurses.c routines for spawns */ +#endif /* VMS */ /* * Modified to allow for odd chars in a username only if exists. @@ -84,7 +91,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) *port++ = '\0'; /* Split */ if (!hostname || *hostname == '\0') { - CTRACE(tfp, "HTTelnet: No host specified!\n"); + if (TRACE) + fprintf(stderr, "HTTelnet: No host specified!\n"); return HT_NO_DATA; } @@ -141,7 +149,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) hostname, port ? port : ""); - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); return HT_NO_DATA; /* Ok - it was done but no data */ #define TELNET_DONE @@ -167,7 +176,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) port ? port : ""); } - CTRACE(tfp, "HTTelnet: Normal: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Normal: Command is: %s\n\n", command); #ifdef __DJGPP__ __djgpp_set_ctrl_c(0); _go32_want_ctrl_break(1); @@ -206,7 +216,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) hostname); } - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); return HT_NO_DATA; /* Ok - it was done but no data */ #define TELNET_DONE @@ -261,7 +272,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) } } - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); return HT_NO_DATA; /* Ok - it was done but no data */ } @@ -288,7 +300,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) port ? port : ""); } - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); return HT_NO_DATA; /* Ok - it was done but no data */ #define TELNET_DONE @@ -300,10 +313,12 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) port ? "/PORT=" : "", port ? port : "", hostname); - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); } else { + extern int LYgetch NOPARAMS; extern BOOLEAN HadVMSInterrupt; printf( @@ -343,7 +358,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) hostname); } - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); return HT_NO_DATA; /* Ok - it was done but no data */ } @@ -384,7 +400,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) } } - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); return HT_NO_DATA; /* Ok - it was done but no data */ } @@ -407,7 +424,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) port ? port : ""); } - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); return HT_NO_DATA; /* Ok - it was done but no data */ } @@ -417,10 +435,12 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) port ? "/PORT=" : "", port ? port : "", hostname); - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); } else { + extern int LYgetch NOPARAMS; extern BOOLEAN HadVMSInterrupt; printf( @@ -438,10 +458,12 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) port ? "/PORT=" : "", port ? port : "", hostname); - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); } else { + extern int LYgetch NOPARAMS; extern BOOLEAN HadVMSInterrupt; printf( @@ -464,7 +486,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) if (login_protocol == telnet) { /* telnet only */ sprintf(command, "TELNET %s", /* @@ Bug: port ignored */ hostname); - CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); return HT_NO_DATA; /* Ok - it was done but no data */ } @@ -482,6 +505,8 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) printf("\nlogging in with username %s", user); printf(".\n"); { + extern int LYgetch NOPARAMS; + printf("\nPress <return> to return to Lynx."); fflush(stdout); LYgetch(); @@ -524,7 +549,9 @@ ARGS4 int status; if (sink) { - CTRACE(tfp, "HTTelnet: Can't output a live session -- must be interactive!\n"); + if (TRACE) + fprintf(stderr, + "HTTelnet: Can't output a live session -- must be interactive!\n"); return HT_NO_DATA; } acc_method = HTParse(addr, "file:", PARSE_ACCESS); @@ -532,7 +559,8 @@ ARGS4 host = HTParse(addr, "", PARSE_HOST); if (!host || *host == '\0') { status = HT_NO_DATA; - CTRACE(tfp, "HTTelnet: No host specified!\n"); + if (TRACE) + fprintf(stderr, "HTTelnet: No host specified!\n"); } else { status = remote_session(acc_method, host); } diff --git a/WWW/Library/Implementation/HTUU.h b/WWW/Library/Implementation/HTUU.h index 3594b276..9c72a115 100644 --- a/WWW/Library/Implementation/HTUU.h +++ b/WWW/Library/Implementation/HTUU.h @@ -11,7 +11,9 @@ #ifndef HTUU_H #define HTUU_H +#ifndef HTUTILS_H #include <HTUtils.h> +#endif /* HTUTILS_H */ PUBLIC int HTUU_encode PARAMS((unsigned char *bufin, unsigned int nbytes, @@ -22,3 +24,6 @@ PUBLIC int HTUU_decode PARAMS((char *bufcoded, int outbufsize)); #endif +/* + + End of file. */ diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h index 16fc0eb2..d96a6cb7 100644 --- a/WWW/Library/Implementation/HTUtils.h +++ b/WWW/Library/Implementation/HTUtils.h @@ -1,7 +1,9 @@ -/* Utility macros for the W3 code library +/* Utitlity macros for the W3 code library MACROS FOR GENERAL USE - See also: the system dependent file "tcp.h", which is included here. + Generates: HTUtils.h + + See also: the system dependent file "tcp.h" */ @@ -15,12 +17,8 @@ #ifdef HAVE_CONFIG_H #include <lynx_cfg.h> /* generated by autoconf 'configure' script */ #include <sys/types.h> -#include <stdio.h> - #else -#include <stdio.h> - #define DONT_TRACK_INTERNAL_LINKS 1 /* Explicit system-configure */ @@ -29,7 +27,6 @@ #define NO_UNISTD_H #define NO_KEYPAD #define NO_UTMP -#define NO_FILIO_H #endif /* FIXME: these will be removed after completing auto-configure script */ @@ -77,10 +74,6 @@ #define HAVE_UTMP 1 #endif -#endif /* HAVE_CONFIG_H */ - -#ifndef LY_MAXPATH -#define LY_MAXPATH 256 #endif #ifndef GCC_UNUSED @@ -95,15 +88,6 @@ #define popen _popen #define pclose _pclose #endif /* _WINDOWS */ - -#ifdef __EMX__ -#include <unistd.h> /* should be re-include protected under EMX */ -#include <stdlib.h> /* should be re-include protected under EMX */ -#define getcwd _getcwd2 -#define chdir _chdir2 - -#endif - #ifdef SHORT_NAMES #define WWW_TraceFlag HTTrFlag @@ -114,6 +98,10 @@ Debug message control. */ +#ifndef STDIO_H +#include <stdio.h> +#define STDIO_H +#endif #ifdef DEBUG #define TRACE (WWW_TraceFlag) @@ -124,6 +112,9 @@ Debug message control. #define PROGRESS(str) /* nothing for now */ #endif +#define CTRACE if(TRACE)fprintf +#define tfp stderr + /* ERROR TYPE @@ -166,6 +157,7 @@ Standard C library for malloc() etc #include <malloc.h> #include <memory.h> +#include <stdio.h> #include <stdlib.h> /* ANSI */ /* BSN */ #endif /* !ultrix */ @@ -173,6 +165,7 @@ Standard C library for malloc() etc #include <stdlib.h> #include <unixlib.h> +#include <ctype.h> #if defined(VAXC) && !defined(__DECC) #define malloc VAXC$MALLOC_OPT #define calloc VAXC$CALLOC_OPT @@ -311,7 +304,6 @@ Sucess (>=0) and failure (<0) codes #define HT_ERROR -1 /* Generic failure */ -#define HT_CANNOT_TRANSLATE -4 #define HT_NO_ACCESS -10 /* Access not available */ #define HT_FORBIDDEN -11 /* Access forbidden */ #define HT_INTERNAL -12 /* Weird -- should never happen. */ @@ -321,12 +313,10 @@ Sucess (>=0) and failure (<0) codes #include <HTString.h> /* String utilities */ #ifndef va_arg -#if defined(__STDC__) || defined(VMS) +#ifdef __STDC__ #include <stdarg.h> -#define LYva_start(ap,format) va_start(ap,format) #else #include <varargs.h> -#define LYva_start(ap,format) va_start(ap) #endif #endif @@ -342,7 +332,11 @@ Out Of Memory checking for malloc() return: #include <LYexit.h> -extern void outofmem PARAMS((CONST char *fname, CONST char *func)); +#define outofmem(file, func)\ + { fprintf(stderr,\ + "\r\n\r\n\r\n%s %s: out of memory. Aborting...\r\n", file, func);\ + LYOutOfMemory = TRUE; exit(-1);} +/* extern void outofmem PARAMS((const char *fname, const char *func)); */ /* @@ -362,8 +356,6 @@ Upper- and Lowercase macros #define TOUPPER(c) (islower((unsigned char)c) ? toupper((unsigned char)c) : ((unsigned char)c)) #endif /* TOLOWER */ -#define FREE(x) if (x) {free(x); x = NULL;} - /* The local equivalents of CR and LF @@ -376,40 +368,8 @@ The local equivalents of CR and LF #define LF FROMASCII('\012') /* ASCII line feed LOCAL EQUIVALENT */ #define CR FROMASCII('\015') /* Will be converted to ^M for transmission */ -#define CTRACE if(TRACE)fprintf -#define tfp TraceFP() -#define CTRACE_SLEEP(secs) if (TRACE && LYTraceLogFP == 0) sleep(secs) -#define CTRACE_FLUSH(fp) if(TRACE) fflush(fp) - -extern FILE *TraceFP NOPARAMS; - -#include <tcp.h> - -/* - * We force this include-ordering since socks.h contains redefinitions of - * functions that probably are prototyped via other includes. The socks.h - * definitions have to be included everywhere, since they're making wrappers - * for the stdio functions as well as the network functions. - */ -#if defined(USE_SOCKS5) && !defined(DONT_USE_SOCKS5) -#define SOCKS4TO5 /* turn on the Rxxxx definitions used in Lynx */ -#include <socks.h> +#endif /* HTUTILS_H */ /* - * The AIX- and SOCKS4-specific definitions in socks.h are inconsistent. - * Repair them so they're consistent (and usable). - */ -#if defined(_AIX) && !defined(USE_SOCKS4_PREFIX) -#undef Raccept -#define Raccept accept -#undef Rgetsockname -#define Rgetsockname getsockname -#undef Rgetpeername -#define Rgetpeername getpeername -#endif -#endif /* USE_SOCKS5 */ - -#define SHORTENED_RBIND /* FIXME: do this in configure-script */ - -#endif /* HTUTILS_H */ + end of utilities */ diff --git a/WWW/Library/Implementation/HTVMSUtils.c b/WWW/Library/Implementation/HTVMSUtils.c index 7f49ff67..ca800517 100644 --- a/WWW/Library/Implementation/HTVMSUtils.c +++ b/WWW/Library/Implementation/HTVMSUtils.c @@ -14,12 +14,15 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTFormat.h> #include <HTStream.h> #include <UCDefs.h> #include <UCMap.h> #include <UCAux.h> #include <HTVMSUtils.h> +/*#include <stdio.h> included by HTUtils.h -- FM */ +/*#include <unixlib.h> included by HTUtils.h -- FM */ #include <ssdef.h> #include <jpidef.h> #include <prvdef.h> @@ -30,7 +33,6 @@ #include <starlet.h> #include <rmsdef.h> -#include <LYUtils.h> #include <LYLeaks.h> #define FREE(x) if (x) {free(x); x = NULL;} @@ -104,10 +106,12 @@ unsigned long Prv[2], PreviousPrv[2]; Prv[1] = 0; Result = sys$setprv(1,&Prv,0,&PreviousPrv); - if (Result == SS$_NORMAL) { - if (!(PreviousPrv[0] & PRV$M_SYSPRV)) { - CTRACE(tfp, "HTVMS_enableSysPrv: Enabled SYSPRV\n"); - } + if (TRACE) { + if (Result == SS$_NORMAL) { + if (!(PreviousPrv[0] & PRV$M_SYSPRV)) { + fprintf(stderr, "HTVMS_enableSysPrv: Enabled SYSPRV\n"); + } + } } } @@ -130,10 +134,12 @@ unsigned long Prv[2], PreviousPrv[2]; Prv[1] = 0; Result = sys$setprv(0,&Prv,0,&PreviousPrv); - if (Result == SS$_NORMAL) { - if (PreviousPrv[0] & PRV$M_SYSPRV) { - CTRACE(tfp, "HTVMS_disableSysPrv: Disabled SYSPRV\n"); - } + if (TRACE) { + if (Result == SS$_NORMAL) { + if (PreviousPrv[0] & PRV$M_SYSPRV) { + fprintf(stderr, "HTVMS_disableSysPrv: Disabled SYSPRV\n"); + } + } } } @@ -377,7 +383,7 @@ PUBLIC char * HTVMS_name ARGS2( */ PUBLIC int HTStat ARGS2( CONST char *, filename, - struct stat *, info) + stat_t *, info) { /* the following stuff does not work in VMS with a normal stat... @@ -473,6 +479,9 @@ char Name[256]; return(Result); } +/*** "dirent.h" ***/ +/* #include <types.h> already in tcp.h */ + #ifndef _POSIX_SOURCE #define d_ino d_fileno /* compatability */ #ifndef NULL @@ -725,7 +734,7 @@ typedef struct _VMSEntryInfo { BOOLEAN display; /* show this entry? */ } VMSEntryInfo; -PRIVATE void free_VMSEntryInfo_contents ARGS1(VMSEntryInfo *,entry_info) +PRIVATE void free_VMSEntryInfo_struct_contents ARGS1(VMSEntryInfo *,entry_info) { if (entry_info) { FREE(entry_info->filename); @@ -891,7 +900,7 @@ PUBLIC int HTVMSBrowseDir ARGS4( extern BOOLEAN no_dotfiles, show_dotfiles; HTUnEscape(pathname); - CTRACE(tfp,"HTVMSBrowseDir: Browsing `%s\'\n", pathname); + CTRACE(stderr,"HTVMSBrowseDir: Browsing `%s\'\n", pathname); /* * Require at least two elements (presumably a device and directory) @@ -1104,13 +1113,17 @@ PUBLIC int HTVMSBrowseDir ARGS4( StrAllocCopy(entry_info->type, cp); StrAllocCopy(entry_info->filename, dirbuf->d_name); - if (S_ISDIR(file_info.st_mode)) { + if ((file_info.st_mode & S_IFMT) == S_IFDIR) { /* strip .DIR part... */ char *dot; dot = strstr(entry_info->filename, ".DIR"); if (dot) *dot = '\0'; - LYLowerCase(entry_info->filename); + cp = entry_info->filename; + while (cp && *cp) { + *cp = TOLOWER(*cp); + cp++; + } StrAllocCopy(entry_info->type, "Directory"); } else { if ((cp = strstr(entry_info->filename, "READ")) == NULL) { @@ -1129,7 +1142,10 @@ PUBLIC int HTVMSBrowseDir ARGS4( cp = entry_info->filename; } } - LYLowerCase(cp); + while (cp && *cp) { + *cp = TOLOWER(*cp); + cp++; + } if (((len = strlen(entry_info->filename)) > 2) && entry_info->filename[len-1] == 'z') { if (entry_info->filename[len-2] == '.' || @@ -1154,7 +1170,7 @@ PUBLIC int HTVMSBrowseDir ARGS4( } /* Get the size */ - if (!S_ISDIR(file_info.st_mode)) + if ((file_info.st_mode & S_IFMT) != S_IFDIR) entry_info->size = (unsigned int)file_info.st_size; else entry_info->size = 0; @@ -1162,7 +1178,7 @@ PUBLIC int HTVMSBrowseDir ARGS4( /* Now, update the BTree etc. */ if(entry_info->display) { - CTRACE(tfp,"Adding file to BTree: %s\n", + CTRACE(stderr,"Adding file to BTree: %s\n", entry_info->filename); HTBTree_add(bt, (VMSEntryInfo *)entry_info); } @@ -1223,7 +1239,7 @@ PUBLIC int HTVMSBrowseDir ARGS4( PUTC('\n'); /* end of this entry */ - free_VMSEntryInfo_contents(entry_info); + free_VMSEntryInfo_struct_contents(entry_info); } } @@ -1246,33 +1262,3 @@ PUBLIC int HTVMSBrowseDir ARGS4( return HT_LOADED; } /* End of directory reading section */ - -/* - * Remove all versions of the given file. We assume there are no permissions - * problems, since we do this mainly for removing temporary files. - */ -int HTVMS_remove(char *filename) -{ - int code = remove(filename); /* return the first status code */ - while (remove(filename) == 0) - ; - return code; -} - -/* - * Remove all older versions of the given file. We may fail to remove some - * version due to permissions -- the loop stops either at that point, or when - * we run out of older versions to remove. - */ -void HTVMS_purge(char *filename) -{ - char *older_file = 0; - - StrAllocCopy(older_file, filename); - StrAllocCat(older_file, ";-1"); - - while (remove(older_file) == 0) - ; - - FREE(older_file); -} diff --git a/WWW/Library/Implementation/HTVMSUtils.h b/WWW/Library/Implementation/HTVMSUtils.h index 25fd5adb..e055d672 100644 --- a/WWW/Library/Implementation/HTVMSUtils.h +++ b/WWW/Library/Implementation/HTVMSUtils.h @@ -5,8 +5,7 @@ #ifndef HTVMSUTIL_H #define HTVMSUTIL_H -#include <HTUtils.h> -#include <HTAnchor.h> +#include <stat.h> extern BOOL HTVMSFileVersions; /* Include version numbers in listing? */ @@ -103,7 +102,7 @@ PUBLIC char * HTVMS_name PARAMS(( PUBLIC int HTStat PARAMS(( CONST char * filename, - struct stat * info)); + stat_t * info)); PUBLIC int HTVMSBrowseDir PARAMS(( CONST char * address, @@ -111,7 +110,7 @@ PUBLIC int HTVMSBrowseDir PARAMS(( HTFormat format_out, HTStream * sink)); -extern int HTVMS_remove(char *filename); -extern void HTVMS_purge(char *filename); - #endif /* not HTVMSUTIL_H */ +/* + + End of file HTVMSUtil.h. */ diff --git a/WWW/Library/Implementation/HTVMS_WaisProt.c b/WWW/Library/Implementation/HTVMS_WaisProt.c index 76081407..543de7ad 100644 --- a/WWW/Library/Implementation/HTVMS_WaisProt.c +++ b/WWW/Library/Implementation/HTVMS_WaisProt.c @@ -32,6 +32,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTVMS_WaisUI.h> #include <HTVMS_WaisProt.h> @@ -57,7 +58,7 @@ /*----------------------------------------------------------------------*/ -static unsigned long userInfoTagSize PARAMS((data_tag tag, +static unsigned long userInfoTagSize _AP((data_tag tag, unsigned long length)); static unsigned long @@ -79,7 +80,7 @@ unsigned long length; /*----------------------------------------------------------------------*/ -static char* writeUserInfoHeader PARAMS((data_tag tag,long infoSize, +static char* writeUserInfoHeader _AP((data_tag tag,long infoSize, long estHeaderSize,char* buffer, long* len)); @@ -126,7 +127,7 @@ long* len; /*----------------------------------------------------------------------*/ -static char* readUserInfoHeader PARAMS((data_tag* tag,unsigned long* num, +static char* readUserInfoHeader _AP((data_tag* tag,unsigned long* num, char* buffer)); static char* @@ -227,8 +228,8 @@ char* buffer; char* buf = buffer; unsigned long size; unsigned long headerSize; + data_tag tag; long chunkCode,chunkIDLen; - data_tag tag1; char* chunkMarker = NULL; char* highlightMarker = NULL; char* deHighlightMarker = NULL; @@ -236,7 +237,7 @@ char* buffer; chunkCode = chunkIDLen = UNUSED; - buf = readUserInfoHeader(&tag1,&size,buf); + buf = readUserInfoHeader(&tag,&size,buf); headerSize = buf - buffer; while (buf < (buffer + size + headerSize)) @@ -435,7 +436,7 @@ DocObj* doc; /*----------------------------------------------------------------------*/ -static char* writeDocObj PARAMS((DocObj* doc,char* buffer,long* len)); +static char* writeDocObj _AP((DocObj* doc,char* buffer,long* len)); static char* writeDocObj(doc,buffer,len) @@ -482,7 +483,7 @@ long* len; /*----------------------------------------------------------------------*/ -static char* readDocObj PARAMS((DocObj** doc,char* buffer)); +static char* readDocObj _AP((DocObj** doc,char* buffer)); static char* readDocObj(doc,buffer) @@ -609,7 +610,7 @@ char* buffer; { char* buf = buffer; unsigned long size; unsigned long headerSize; - data_tag tag1; + data_tag tag; char* seedWords = NULL; char* beginDateRange = NULL; char* endDateRange = NULL; @@ -623,7 +624,7 @@ char* buffer; dateFactor = maxDocsRetrieved = UNUSED; - buf = readUserInfoHeader(&tag1,&size,buf); + buf = readUserInfoHeader(&tag,&size,buf); headerSize = buf - buffer; while (buf < (buffer + size + headerSize)) @@ -768,7 +769,7 @@ long* len; unsigned long header_len = userInfoTagSize(DT_DocumentHeaderGroup , DefWAISDocHeaderSize); char* buf = buffer + header_len; - unsigned long size1; + unsigned long size; RESERVE_SPACE_FOR_WAIS_HEADER(len); @@ -799,8 +800,8 @@ long* len; buf = writeString(header->OriginCity,DT_OriginCity,buf,len); /* now write the header and size */ - size1 = buf - buffer; - buf = writeUserInfoHeader(DT_DocumentHeaderGroup,size1,header_len,buffer,len); + size = buf - buffer; + buf = writeUserInfoHeader(DT_DocumentHeaderGroup,size,header_len,buffer,len); return(buf); } @@ -813,9 +814,9 @@ WAISDocumentHeader** header; char* buffer; { char* buf = buffer; - unsigned long size1; + unsigned long size; unsigned long headerSize; - data_tag tag1; + data_tag tag; any* docID = NULL; long versionNumber,score,bestMatch,docLength,lines; char** types = NULL; @@ -826,10 +827,10 @@ char* buffer; versionNumber = score = bestMatch = docLength = lines = UNUSED; - buf = readUserInfoHeader(&tag1,&size1,buf); + buf = readUserInfoHeader(&tag,&size,buf); headerSize = buf - buffer; - while (buf < (buffer + size1 + headerSize)) + while (buf < (buffer + size + headerSize)) { data_tag tag = peekTag(buf); switch (tag) { case DT_DocumentID: @@ -976,13 +977,13 @@ char* buffer; char* buf = buffer; unsigned long size; unsigned long headerSize; - data_tag tag1; + data_tag tag; any* docID = NULL; long versionNumber,score,bestMatch,docLength,lines; versionNumber = score = bestMatch = docLength = lines = UNUSED; - buf = readUserInfoHeader(&tag1,&size,buf); + buf = readUserInfoHeader(&tag,&size,buf); headerSize = buf - buffer; while (buf < (buffer + size + headerSize)) @@ -1104,7 +1105,7 @@ long* len; unsigned long header_len = userInfoTagSize(DT_DocumentLongHeaderGroup , DefWAISLongHeaderSize); char* buf = buffer + header_len; - unsigned long size1; + unsigned long size; RESERVE_SPACE_FOR_WAIS_HEADER(len); @@ -1138,8 +1139,8 @@ long* len; buf = writeString(header->IndustryCodes,DT_IndustryCodes,buf,len); /* now write the header and size */ - size1 = buf - buffer; - buf = writeUserInfoHeader(DT_DocumentLongHeaderGroup,size1,header_len,buffer,len); + size = buf - buffer; + buf = writeUserInfoHeader(DT_DocumentLongHeaderGroup,size,header_len,buffer,len); return(buf); } @@ -1152,9 +1153,9 @@ WAISDocumentLongHeader** header; char* buffer; { char* buf = buffer; - unsigned long size1; + unsigned long size; unsigned long headerSize; - data_tag tag1; + data_tag tag; any* docID; long versionNumber,score,bestMatch,docLength,lines; char **types; @@ -1165,10 +1166,10 @@ char* buffer; types = NULL; source = date = headline = originCity = stockCodes = companyCodes = industryCodes = NULL; - buf = readUserInfoHeader(&tag1,&size1,buf); + buf = readUserInfoHeader(&tag,&size,buf); headerSize = buf - buffer; - while (buf < (buffer + size1 + headerSize)) + while (buf < (buffer + size + headerSize)) { data_tag tag = peekTag(buf); switch (tag) { case DT_DocumentID: @@ -1395,7 +1396,7 @@ long* len; /*----------------------------------------------------------------------*/ static void -cleanUpWaisSearchResponse PARAMS((char* buf,char* seedWordsUsed, +cleanUpWaisSearchResponse _AP((char* buf,char* seedWordsUsed, WAISDocumentHeader** docHeaders, WAISDocumentShortHeader** shortHeaders, WAISDocumentLongHeader** longHeaders, @@ -1473,7 +1474,7 @@ char* buffer; char* buf = buffer; unsigned long size; unsigned long headerSize; - data_tag tag1; + data_tag tag; void* header = NULL; WAISDocumentHeader** docHeaders = NULL; WAISDocumentShortHeader** shortHeaders = NULL; @@ -1490,7 +1491,7 @@ char* buffer; numDocHeaders = numLongHeaders = numShortHeaders = numText = numHeadlines = numCodes = 0; - buf = readUserInfoHeader(&tag1,&size,buf); + buf = readUserInfoHeader(&tag,&size,buf); headerSize = buf - buffer; while (buf < (buffer + size + headerSize)) @@ -1671,14 +1672,14 @@ char* buffer; char* buf = buffer; unsigned long size; unsigned long headerSize; - data_tag tag1; + data_tag tag; any *docID,*documentText; long versionNumber; docID = documentText = NULL; versionNumber = UNUSED; - buf = readUserInfoHeader(&tag1,&size,buf); + buf = readUserInfoHeader(&tag,&size,buf); headerSize = buf - buffer; while (buf < (buffer + size + headerSize)) @@ -1787,7 +1788,7 @@ char* buffer; char* buf = buffer; unsigned long size; unsigned long headerSize; - data_tag tag1; + data_tag tag; any* docID; long versionNumber; char *source,*date,*headline,*originCity; @@ -1796,7 +1797,7 @@ char* buffer; versionNumber = UNUSED; source = date = headline = originCity = NULL; - buf = readUserInfoHeader(&tag1,&size,buf); + buf = readUserInfoHeader(&tag,&size,buf); headerSize = buf - buffer; while (buf < (buffer + size + headerSize)) @@ -1912,7 +1913,7 @@ char* buffer; char* buf = buffer; unsigned long size; unsigned long headerSize; - data_tag tag1; + data_tag tag; any* docID; long versionNumber; char *stockCodes,*companyCodes,*industryCodes; @@ -1921,7 +1922,7 @@ char* buffer; versionNumber = UNUSED; stockCodes = companyCodes = industryCodes = NULL; - buf = readUserInfoHeader(&tag1,&size,buf); + buf = readUserInfoHeader(&tag,&size,buf); headerSize = buf - buffer; while (buf < (buffer + size + headerSize)) @@ -1961,9 +1962,9 @@ char* buffer; char* writePresentInfo(present,buffer,len) -PresentAPDU* present GCC_UNUSED; +PresentAPDU* present; char* buffer; -long* len GCC_UNUSED; +long* len; { /* The WAIS protocol doesn't use present info */ return(buffer); @@ -1985,9 +1986,9 @@ char* buffer; char* writePresentResponseInfo(response,buffer,len) -PresentResponseAPDU* response GCC_UNUSED; +PresentResponseAPDU* response; char* buffer; -long* len GCC_UNUSED; +long* len; { /* The WAIS protocol doesn't use presentResponse info */ return(buffer); @@ -2044,7 +2045,7 @@ char* buffer; ( XXX return type could be in the element set) */ -static query_term** makeWAISQueryTerms PARAMS((DocObj** docs)); +static query_term** makeWAISQueryTerms _AP((DocObj** docs)); static query_term** makeWAISQueryTerms(docs) @@ -2163,7 +2164,7 @@ DocObj** docs; /*----------------------------------------------------------------------*/ -static DocObj** makeWAISQueryDocs PARAMS((query_term** terms)); +static DocObj** makeWAISQueryDocs _AP((query_term** terms)); static DocObj** makeWAISQueryDocs(terms) diff --git a/WWW/Library/Implementation/HTVMS_WaisProt.h b/WWW/Library/Implementation/HTVMS_WaisProt.h index 1b2329b1..1a4e83d5 100644 --- a/WWW/Library/Implementation/HTVMS_WaisProt.h +++ b/WWW/Library/Implementation/HTVMS_WaisProt.h @@ -29,10 +29,8 @@ */ #ifndef _H_WAIS_protocol_ -#define _H_WAIS_protocol_ -#include <HTUtils.h> -#include <HTVMS_WaisUI.h> +#define _H_WAIS_protocol_ /*----------------------------------------------------------------------*/ /* Data types / constants */ @@ -220,97 +218,88 @@ typedef struct WAISSearchResponse { /*----------------------------------------------------------------------*/ /* Functions */ -char * -generate_search_apdu PARAMS((char* buff, /* buffer to hold the apdu */ - long *buff_len, /* number of bytes written to the buffer */ - char *seed_words, /* string of the seed words */ - char *database_name, - DocObj** docobjs, - long maxDocsRetrieved - )); - -DocObj* makeDocObjUsingWholeDocument PARAMS((any* aDocID,char* type)); -DocObj* makeDocObjUsingBytes PARAMS((any* aDocID,char* type,long start,long end)); -DocObj* makeDocObjUsingLines PARAMS((any* aDocID,char* type,long start,long end)); -DocObj* makeDocObjUsingParagraphs PARAMS((any* aDocID,char* type,any* start,any* end)); -void freeDocObj PARAMS((DocObj* doc)); - -WAISInitResponse* makeWAISInitResponse PARAMS((long chunkCode,long chunkIDLen, +DocObj* makeDocObjUsingWholeDocument _AP((any* aDocID,char* type)); +DocObj* makeDocObjUsingBytes _AP((any* aDocID,char* type,long start,long end)); +DocObj* makeDocObjUsingLines _AP((any* aDocID,char* type,long start,long end)); +DocObj* makeDocObjUsingParagraphs _AP((any* aDocID,char* type,any* start,any* end)); +void freeDocObj _AP((DocObj* doc)); + +WAISInitResponse* makeWAISInitResponse _AP((long chunkCode,long chunkIDLen, char* chunkMarker,char* highlightMarker, char* deHighlightMarker,char* newLineChars)); -void freeWAISInitResponse PARAMS((WAISInitResponse* init)); +void freeWAISInitResponse _AP((WAISInitResponse* init)); -WAISSearch* makeWAISSearch PARAMS(( +WAISSearch* makeWAISSearch _AP(( char* seedWords,DocObj** docs,char** textList, long dateFactor,char* beginDateRange,char* endDateRange, long maxDocsRetrieved)); -void freeWAISSearch PARAMS((WAISSearch* query)); +void freeWAISSearch _AP((WAISSearch* query)); -WAISDocumentHeader* makeWAISDocumentHeader PARAMS(( +WAISDocumentHeader* makeWAISDocumentHeader _AP(( any* aDocID,long versionNumber,long score,long bestMatch,long docLen, long lines,char** types,char* source,char* date,char* headline,char* originCity)); -void freeWAISDocumentHeader PARAMS((WAISDocumentHeader* header)); -char* writeWAISDocumentHeader PARAMS((WAISDocumentHeader* header,char* buffer,long* len)); -char* readWAISDocumentHeader PARAMS((WAISDocumentHeader** header,char* buffer)); +void freeWAISDocumentHeader _AP((WAISDocumentHeader* header)); +char* writeWAISDocumentHeader _AP((WAISDocumentHeader* header,char* buffer,long* len)); +char* readWAISDocumentHeader _AP((WAISDocumentHeader** header,char* buffer)); -WAISDocumentShortHeader* makeWAISDocumentShortHeader PARAMS(( +WAISDocumentShortHeader* makeWAISDocumentShortHeader _AP(( any* aDocID,long versionNumber,long score,long bestMatch,long docLen,long lines)); -void freeWAISDocumentShortHeader PARAMS((WAISDocumentShortHeader* header)); -char* writeWAISDocumentShortHeader PARAMS((WAISDocumentShortHeader* header, +void freeWAISDocumentShortHeader _AP((WAISDocumentShortHeader* header)); +char* writeWAISDocumentShortHeader _AP((WAISDocumentShortHeader* header, char* buffer,long* len)); -char* readWAISDocumentShortHeader PARAMS((WAISDocumentShortHeader** header,char* buffer)); +char* readWAISDocumentShortHeader _AP((WAISDocumentShortHeader** header,char* buffer)); -WAISDocumentLongHeader* makeWAISDocumentLongHeader PARAMS(( +WAISDocumentLongHeader* makeWAISDocumentLongHeader _AP(( any* aDocID,long versionNumber,long score,long bestMatch,long docLen, long lines,char** types,char* source,char* date, char* headline,char* originCity, char* stockCodes,char* companyCodes,char* industryCodes)); -void freeWAISDocumentLongHeader PARAMS((WAISDocumentLongHeader* header)); -char* writeWAISDocumentLongHeader PARAMS((WAISDocumentLongHeader* header,char* buffer,long* len)); -char* readWAISDocumentLongHeader PARAMS((WAISDocumentLongHeader** header,char* buffer)); +void freeWAISDocumentLongHeader _AP((WAISDocumentLongHeader* header)); +char* writeWAISDocumentLongHeader _AP((WAISDocumentLongHeader* header,char* buffer,long* len)); +char* readWAISDocumentLongHeader _AP((WAISDocumentLongHeader** header,char* buffer)); -WAISSearchResponse* makeWAISSearchResponse PARAMS(( +WAISSearchResponse* makeWAISSearchResponse _AP(( char* seedWordsUsed,WAISDocumentHeader** docHeaders, WAISDocumentShortHeader** shortHeaders, WAISDocumentLongHeader** longHeaders, WAISDocumentText** text,WAISDocumentHeadlines** headlines, WAISDocumentCodes** codes, diagnosticRecord** diagnostics)); -void freeWAISSearchResponse PARAMS((WAISSearchResponse* response)); +void freeWAISSearchResponse _AP((WAISSearchResponse* response)); -WAISDocumentText* makeWAISDocumentText PARAMS((any* aDocID,long versionNumber, +WAISDocumentText* makeWAISDocumentText _AP((any* aDocID,long versionNumber, any* documentText)); -void freeWAISDocumentText PARAMS((WAISDocumentText* docText)); -char* writeWAISDocumentText PARAMS((WAISDocumentText* docText,char* buffer,long* len)); -char* readWAISDocumentText PARAMS((WAISDocumentText** docText,char* buffer)); +void freeWAISDocumentText _AP((WAISDocumentText* docText)); +char* writeWAISDocumentText _AP((WAISDocumentText* docText,char* buffer,long* len)); +char* readWAISDocumentText _AP((WAISDocumentText** docText,char* buffer)); -WAISDocumentHeadlines* makeWAISDocumentHeadlines PARAMS(( +WAISDocumentHeadlines* makeWAISDocumentHeadlines _AP(( any* aDocID,long versionNumber,char* source,char* date,char* headline, char* originCity)); -void freeWAISDocumentHeadlines PARAMS((WAISDocumentHeadlines* docHeadline)); -char* writeWAISDocumentHeadlines PARAMS((WAISDocumentHeadlines* docHeadline,char* buffer,long* len)); -char* readWAISDocumentHeadlines PARAMS((WAISDocumentHeadlines** docHeadline,char* buffer)); +void freeWAISDocumentHeadlines _AP((WAISDocumentHeadlines* docHeadline)); +char* writeWAISDocumentHeadlines _AP((WAISDocumentHeadlines* docHeadline,char* buffer,long* len)); +char* readWAISDocumentHeadlines _AP((WAISDocumentHeadlines** docHeadline,char* buffer)); -WAISDocumentCodes* makeWAISDocumentCodes PARAMS(( +WAISDocumentCodes* makeWAISDocumentCodes _AP(( any* aDocID,long versionNumber,char* stockCodes,char* companyCodes, char* industryCodes)); -void freeWAISDocumentCodes PARAMS((WAISDocumentCodes* docCodes)); -char* writeWAISDocumentCodes PARAMS((WAISDocumentCodes* docCodes,char* buffer,long* len)); -char* readWAISDocumentCodes PARAMS((WAISDocumentCodes** docCodes,char* buffer)); - -any* makeWAISTextQuery PARAMS((DocObj** docs)); -DocObj** readWAISTextQuery PARAMS((any* terms)); - -void CSTFreeWAISInitResponse PARAMS((WAISInitResponse* init)); -void CSTFreeWAISSearch PARAMS((WAISSearch* query)); -void CSTFreeDocObj PARAMS((DocObj* doc)); -void CSTFreeWAISDocumentHeader PARAMS((WAISDocumentHeader* header)); -void CSTFreeWAISDocumentShortHeader PARAMS((WAISDocumentShortHeader* header)); -void CSTFreeWAISDocumentLongHeader PARAMS((WAISDocumentLongHeader* header)); -void CSTFreeWAISSearchResponse PARAMS((WAISSearchResponse* response)); -void CSTFreeWAISDocumentText PARAMS((WAISDocumentText* docText)); -void CSTFreeWAISDocHeadlines PARAMS((WAISDocumentHeadlines* docHeadline)); -void CSTFreeWAISDocumentCodes PARAMS((WAISDocumentCodes* docCodes)); -void CSTFreeWAISTextQuery PARAMS(( any* query)); +void freeWAISDocumentCodes _AP((WAISDocumentCodes* docCodes)); +char* writeWAISDocumentCodes _AP((WAISDocumentCodes* docCodes,char* buffer,long* len)); +char* readWAISDocumentCodes _AP((WAISDocumentCodes** docCodes,char* buffer)); + +any* makeWAISTextQuery _AP((DocObj** docs)); +DocObj** readWAISTextQuery _AP((any* terms)); + +void CSTFreeWAISInitResponse _AP((WAISInitResponse* init)); +void CSTFreeWAISSearch _AP((WAISSearch* query)); +void CSTFreeDocObj _AP((DocObj* doc)); +void CSTFreeWAISDocumentHeader _AP((WAISDocumentHeader* header)); +void CSTFreeWAISDocumentShortHeader _AP((WAISDocumentShortHeader* header)); +void CSTFreeWAISDocumentLongHeader _AP((WAISDocumentLongHeader* header)); +void CSTFreeWAISSearchResponse _AP((WAISSearchResponse* response)); +void CSTFreeWAISDocumentText _AP((WAISDocumentText* docText)); +void CSTFreeWAISDocHeadlines _AP((WAISDocumentHeadlines* docHeadline)); +void CSTFreeWAISDocumentCodes _AP((WAISDocumentCodes* docCodes)); +void CSTFreeWAISTextQuery _AP(( any* query)); /*----------------------------------------------------------------------*/ @@ -345,9 +334,6 @@ void CSTFreeWAISTextQuery PARAMS(( any* query)); #ifndef WMESSAGE_H #define WMESSAGE_H -#include <HTUtils.h> -#include <HTVMS_WaisUI.h> - typedef struct wais_header { char msg_len[10]; /* length in bytes of following message */ char msg_type; /* type of message: 'z'=Z39.50 APDU, @@ -381,9 +367,9 @@ typedef struct wais_header { #define UUENCODE 'u' -void readWAISPacketHeader PARAMS((char* msgBuffer,WAISMessage *header_struct)); -long getWAISPacketLength PARAMS((WAISMessage* header)); -void writeWAISPacketHeader PARAMS((char* header,long dataLen,long type, +void readWAISPacketHeader _AP((char* msgBuffer,WAISMessage *header_struct)); +long getWAISPacketLength _AP((WAISMessage* header)); +void writeWAISPacketHeader _AP((char* header,long dataLen,long type, char* server,long compression, long encoding,long version)); diff --git a/WWW/Library/Implementation/HTVMS_WaisUI.c b/WWW/Library/Implementation/HTVMS_WaisUI.c index 2301cbd6..f8f88da3 100644 --- a/WWW/Library/Implementation/HTVMS_WaisUI.c +++ b/WWW/Library/Implementation/HTVMS_WaisUI.c @@ -17,10 +17,10 @@ Brewster@think.com */ -/* +/* * this is a simple ui toolkit for building other ui's on top. * -brewster - * + * * top level functions: * generate_search_apdu * generate_retrieval_apdu @@ -32,22 +32,26 @@ * generate multiple queries for long documents. * this will crash if the file being retrieved is larger than 100k. * do log_write() - * + * */ #include <HTUtils.h> +#include <tcp.h> #include <HTVMS_WaisUI.h> #include <HTVMS_WaisProt.h> #include <HTTCP.h> - -#undef MAXINT /* we don't need it here, and tcp.h may conflict */ +/*#include <stdio> included by HTUtils.h -- FM */ +#include <string.h> +#include <ctype.h> #include <math.h> +#include <stdarg.h> #include <LYexit.h> #include <LYLeaks.h> void -log_write(char *s GCC_UNUSED) +log_write(s) +char *s; { return; } @@ -55,16 +59,21 @@ log_write(char *s GCC_UNUSED) /*----------------------------------------------------------------------*/ /* returns a pointer in the buffer of the first free byte. - if it overflows, then NULL is returned + if it overflows, then NULL is returned */ char * -generate_search_apdu( -char* buff, /* buffer to hold the apdu */ -long *buff_len, /* length of the buffer changed to reflect new data written */ -char *seed_words, /* string of the seed words */ -char *database_name, -DocObj** docobjs, -long maxDocsRetrieved) +generate_search_apdu(buff, + buff_len, + seed_words, + database_name, + docobjs, + maxDocsRetrieved) +char* buff; /* buffer to hold the apdu */ +long *buff_len; /* length of the buffer changed to reflect new data written */ +char *seed_words; /* string of the seed words */ +char *database_name; +DocObj** docobjs; +long maxDocsRetrieved; { /* local variables */ @@ -86,12 +95,12 @@ long maxDocsRetrieved) maxDocsRetrieved ); - search3 = makeSearchAPDU(30, + search3 = makeSearchAPDU(30, 5000, /* should be large */ 30, 1, /* replace indicator */ "", /* result set name */ - database_names, /* database name */ + database_names, /* database name */ QT_RelevanceFeedbackQuery, /* query_type */ 0, /* element name */ NULL, /* reference ID */ @@ -111,15 +120,22 @@ long maxDocsRetrieved) */ char * -generate_retrieval_apdu( -char *buff, -long *buff_len, /* length of the buffer changed to reflect new data written */ -any *docID, -long chunk_type, -long start, -long end, -char *type, -char *database_name) +generate_retrieval_apdu(buff, + buff_len, + docID, + chunk_type, + start, + end, + type, + database_name) +char *buff; +long *buff_len; /* length of the buffer changed to reflect new data written */ +any *docID; +long chunk_type; +long start; +long end; +char *type; +char *database_name; { SearchAPDU *search; char *end_ptr; @@ -143,9 +159,9 @@ char *database_name) refID.size = 1; refID.bytes = "3"; - + switch(chunk_type){ - case CT_line: + case CT_line: DocObjs[0] = makeDocObjUsingLines(docID, type, start, end); break; case CT_byte: @@ -154,11 +170,11 @@ char *database_name) } DocObjs[1] = NULL; - query = makeWAISTextQuery(DocObjs); - search = makeSearchAPDU( 10, 16, 15, + query = makeWAISTextQuery(DocObjs); + search = makeSearchAPDU( 10, 16, 15, 1, /* replace indicator */ "FOO", /* result set name */ - database_names, /* database name */ + database_names, /* database name */ QT_TextRetrievalQuery, /* query_type */ element_names, /* element name */ &refID, /* reference ID */ @@ -176,7 +192,10 @@ char *database_name) * to those trying to modify the transport code to use non-UNIX streams: * This is the function to modify! */ -PRIVATE long read_from_stream(int d, char *buf, long nbytes) +long read_from_stream(d,buf,nbytes) +int d; /* this is the stream */ +char *buf; +long nbytes; { long didRead; long toRead = nbytes; @@ -195,7 +214,7 @@ PRIVATE long read_from_stream(int d, char *buf, long nbytes) totalRead += didRead; } if(totalRead != nbytes) /* we overread for some reason */ - return(- totalRead); /* bad news */ + return(- totalRead); /* bad news */ return(totalRead); } @@ -203,21 +222,25 @@ PRIVATE long read_from_stream(int d, char *buf, long nbytes) /* returns the length of the response, 0 if an error */ -PRIVATE long -transport_message( - long connection, - char *request_message, - long request_length, - char *response_message, - long response_buffer_length) +long +transport_message(connection, + request_message, + request_length, + response_message, + response_buffer_length) +int connection; +char *request_message; +long request_length; +char *response_message; +long response_buffer_length; { WAISMessage header; long response_length; int rv; - + /* Write out message. Read back header. Figure out response length. */ - + if( request_length + HEADER_LENGTH != NETWRITE(connection,request_message, (int)( request_length +HEADER_LENGTH)) ) @@ -249,7 +272,7 @@ transport_message( response_length = atol(length_array); /* if(verbose){ - printf("WAIS header: '%s' length_array: '%s'\n", + printf("WAIS header: '%s' length_array: '%s'\n", response_message, length_array); } */ @@ -258,7 +281,7 @@ transport_message( and return 0 */ long i; for(i = 0; i < response_length; i++){ - rv = read_from_stream(connection, + rv = read_from_stream(connection, response_message + HEADER_LENGTH, 1); if (rv == HT_INTERRUPTED) @@ -269,7 +292,7 @@ transport_message( return(0); } } - rv = read_from_stream(connection, + rv = read_from_stream(connection, response_message + HEADER_LENGTH, response_length); if (rv == HT_INTERRUPTED) @@ -281,15 +304,19 @@ transport_message( /*----------------------------------------------------------------------*/ -/* returns the number of bytes written. 0 if an error */ +/* returns the number of bytes writen. 0 if an error */ long -interpret_message( - char *request_message, - long request_length, /* length of the buffer */ - char *response_message, - long response_buffer_length, - long connection, - boolean verbose GCC_UNUSED) +interpret_message(request_message,request_length, + response_message, + response_buffer_length, + connection, + verbose) +char *request_message; +long request_length; /* length of the buffer */ +char *response_message; +long response_buffer_length; +int connection; +boolean verbose; { long response_length; @@ -301,7 +328,7 @@ interpret_message( if(service_name && strlen(service_name) > 0) printf(" for service %s", service_name); printf("\n"); - twais_dsply_rsp_apdu(request_message + HEADER_LENGTH, + twais_dsply_rsp_apdu(request_message + HEADER_LENGTH, request_length); } @@ -331,7 +358,9 @@ interpret_message( /* modifies the string to exclude all seeker codes. sets length to the new length. */ -PRIVATE char *delete_seeker_codes(char *string, long *length) +char *delete_seeker_codes(string,length) +char *string; +long *length; { long original_count; /* index into the original string */ long new_count = 0; /* index into the collapsed string */ @@ -349,7 +378,7 @@ PRIVATE char *delete_seeker_codes(char *string, long *length) *length = new_count; return(string); } - + /*----------------------------------------------------------------------*/ #if defined(VMS) && defined(__GNUC__) /* 10-AUG-1995 [pr] */ @@ -369,10 +398,11 @@ static __const void *__const ctype_dummy[] = { &_ctype_, &ctype_dummy }; #endif /* VMS && __GNUC__ */ /* returns a pointer to a string with good stuff */ -char *trim_junk(char *headline) +char *trim_junk(headline) +char *headline; { long length = strlen(headline) + 1; /* include the trailing null */ - size_t i; + long i; headline = delete_seeker_codes(headline, &length); /* delete leading spaces */ for(i=0; i < strlen(headline); i++){ @@ -400,8 +430,8 @@ char *trim_junk(char *headline) **----------------------------------------------------------------------*/ /* WIDE AREA INFORMATION SERVER SOFTWARE:` No guarantees or restrictions. See the readme file for the full standard - disclaimer. - + disclaimer. + 3.26.90 Harry Morris, morris@think.com 3.30.90 Harry Morris - Changed any->bits to any->bytes 4.11.90 HWM - generalized conditional includes (see c-dialect.h) @@ -409,31 +439,44 @@ char *trim_junk(char *headline) #define RESERVE_SPACE_FOR_HEADER(spaceLeft) \ *spaceLeft -= HEADER_LEN; - + #define RELEASE_HEADER_SPACE(spaceLeft) \ if (*spaceLeft > 0) \ *spaceLeft += HEADER_LEN; - -/*----------------------------------------------------------------------*/ - -InitResponseAPDU* -makeInitResponseAPDU( -boolean result, -boolean search, -boolean present, -boolean deleteIt, -boolean accessControl, -boolean resourceControl, -long prefSize, -long maxMsgSize, -char* auth, -char* id, -char* name, -char* version, -any* refID, -void* userInfo) + +/*----------------------------------------------------------------------*/ + +InitResponseAPDU* +makeInitResponseAPDU(result, + search, + present, + deleteIt, + accessControl, + resourceControl, + prefSize, + maxMsgSize, + auth, + id, + name, + version, + refID, + userInfo) +boolean result; +boolean search; +boolean present; +boolean deleteIt; +boolean accessControl; +boolean resourceControl; +long prefSize; +long maxMsgSize; +char* auth; +char* id; +char* name; +char* version; +any* refID; +void* userInfo; /* build an initResponse APDU with user specified information */ -{ +{ InitResponseAPDU* init = (InitResponseAPDU*)s_malloc((size_t)sizeof(InitResponseAPDU)); init->PDUType = initResponseAPDU; @@ -451,14 +494,15 @@ void* userInfo) init->ImplementationVersion = s_strdup(version); init->ReferenceID = duplicateAny(refID); init->UserInformationField = userInfo; /* not copied! */ - + return(init); } /*----------------------------------------------------------------------*/ -void -freeInitResponseAPDU(InitResponseAPDU* init) +void +freeInitResponseAPDU(init) +InitResponseAPDU* init; /* free an initAPDU */ { s_free(init->IDAuthentication); @@ -471,20 +515,23 @@ freeInitResponseAPDU(InitResponseAPDU* init) /*----------------------------------------------------------------------*/ -char* -writeInitResponseAPDU(InitResponseAPDU* init, char* buffer, long* len) +char* +writeInitResponseAPDU(init,buffer,len) +InitResponseAPDU* init; +char* buffer; +long* len; /* write the initResponse to a buffer, adding system information */ -{ +{ char* buf = buffer + HEADER_LEN; /* leave room for the header-length-indicator */ long size; bit_map* optionsBM = NULL; RESERVE_SPACE_FOR_HEADER(len); - + buf = writePDUType(init->PDUType,buf,len); buf = writeBoolean(init->Result,buf,len); buf = writeProtocolVersion(buf,len); - + optionsBM = makeBitMap((unsigned long)5,init->willSearch,init->willPresent, init->willDelete,init->supportAccessControl, init->supportResourceControl); @@ -498,56 +545,58 @@ writeInitResponseAPDU(InitResponseAPDU* init, char* buffer, long* len) buf = writeString(init->ImplementationName,DT_ImplementationName,buf,len); buf = writeString(init->ImplementationVersion,DT_ImplementationVersion,buf,len); buf = writeAny(init->ReferenceID,DT_ReferenceID,buf,len); - + /* go back and write the header-length-indicator */ RELEASE_HEADER_SPACE(len); - size = buf - buffer - HEADER_LEN; + size = buf - buffer - HEADER_LEN; writeBinaryInteger(size,HEADER_LEN,buffer,len); if (init->UserInformationField != NULL) - buf = writeInitResponseInfo(init,buf,len); - + buf = writeInitResponseInfo(init,buf,len); + return(buf); } /*----------------------------------------------------------------------*/ -char* -readInitResponseAPDU(InitResponseAPDU** init, char* buffer) +char* +readInitResponseAPDU(init,buffer) +InitResponseAPDU** init; +char* buffer; { char* buf = buffer; boolean search,present,delete,accessControl,resourceControl; long prefSize,maxMsgSize; char *auth,*id,*name,*version; - long size; + long size; pdu_type pduType; bit_map* versionBM = NULL; bit_map* optionsBM = NULL; boolean result; any *refID = NULL; void* userInfo = NULL; - + auth = id = name = version = NULL; refID = NULL; - + /* read required part */ - buf = readBinaryInteger(&size,HEADER_LEN,buf); + buf = readBinaryInteger(&size,HEADER_LEN,buf); buf = readPDUType(&pduType,buf); buf = readBoolean(&result,buf); - buf = readBitMap(&versionBM,buf); + buf = readBitMap(&versionBM,buf); buf = readBitMap(&optionsBM,buf); buf = readNum(&prefSize,buf); buf = readNum(&maxMsgSize,buf); - + /* decode optionsBM */ search = bitAtPos(0,optionsBM); present = bitAtPos(1,optionsBM); delete = bitAtPos(2,optionsBM); accessControl = bitAtPos(3,optionsBM); resourceControl = bitAtPos(4,optionsBM); - + /* read optional part */ - while (buf < (buffer + size + HEADER_LEN)) + while (buf < (buffer + size + HEADER_LEN)) { data_tag tag = peekTag(buf); switch (tag) { case DT_IDAuthentication: @@ -589,12 +638,12 @@ readInitResponseAPDU(InitResponseAPDU** init, char* buffer) freeAny(refID); } RETURN_ON_NULL(buf); - + /* construct the basic init object */ *init = makeInitResponseAPDU(result, search,present,delete,accessControl,resourceControl, prefSize,maxMsgSize,auth,id,name,version,refID,userInfo); - + freeBitMap(versionBM); freeBitMap(optionsBM); s_free(auth); @@ -602,16 +651,19 @@ readInitResponseAPDU(InitResponseAPDU** init, char* buffer) s_free(name); s_free(version); freeAny(refID); - + return(buf); } /*----------------------------------------------------------------------*/ -InitResponseAPDU* -replyToInitAPDU(InitAPDU* init, boolean result, void* userInfo) +InitResponseAPDU* +replyToInitAPDU(init,result,userInfo) +InitAPDU* init; +boolean result; +void* userInfo; /* respond to an init message in the default way - echoing back - the init info + the init info */ { InitResponseAPDU* initResp; @@ -627,18 +679,27 @@ replyToInitAPDU(InitAPDU* init, boolean result, void* userInfo) /*----------------------------------------------------------------------*/ -SearchAPDU* -makeSearchAPDU( -long small, -long large, -long medium, -boolean replace, -char* name, -char** databases, -char* type, -char** elements, -any* refID, -void* queryInfo) +SearchAPDU* +makeSearchAPDU(small, + large, + medium, + replace, + name, + databases, + type, + elements, + refID, + queryInfo) +long small; +long large; +long medium; +boolean replace; +char* name; +char** databases; +char* type; +char** elements; +any* refID; +void* queryInfo; { char* ptr = NULL; long i; @@ -649,7 +710,7 @@ void* queryInfo) query->MediumSetPresentNumber = medium; query->ReplaceIndicator = replace; query->ResultSetName = s_strdup(name); - query->DatabaseNames = NULL; + query->DatabaseNames = NULL; if (databases != NULL) { for (i = 0, ptr = databases[i]; ptr != NULL; ptr = databases[++i]) { if (query->DatabaseNames == NULL) @@ -662,7 +723,7 @@ void* queryInfo) } } query->QueryType = s_strdup(type); - query->ElementSetNames = NULL; + query->ElementSetNames = NULL; if (elements != NULL) { for (i = 0, ptr = elements[i]; ptr != NULL; ptr = elements[++i]) { if (query->ElementSetNames == NULL) @@ -681,8 +742,9 @@ void* queryInfo) /*----------------------------------------------------------------------*/ -void -freeSearchAPDU(SearchAPDU* query) +void +freeSearchAPDU(query) +SearchAPDU* query; { s_free(query->ResultSetName); s_free(query->QueryType); @@ -700,16 +762,19 @@ freeSearchAPDU(SearchAPDU* query) #define ES_DELIMITER_1 "\037" /* separates database name from element name */ #define ES_DELIMITER_2 "\036" /* hex 1E separates <db,es> groups from one another */ -char* -writeSearchAPDU(SearchAPDU* query, char* buffer, long* len) -{ +char* +writeSearchAPDU(query,buffer,len) +SearchAPDU* query; +char* buffer; +long* len; +{ char* buf = buffer + HEADER_LEN; /* leave room for the header-length-indicator */ long size,i; char* ptr = NULL; char* scratch = NULL; RESERVE_SPACE_FOR_HEADER(len); - + buf = writePDUType(query->PDUType,buf,len); buf = writeBinaryInteger(query->SmallSetUpperBound,(size_t)3,buf,len); buf = writeBinaryInteger(query->LargeSetLowerBound,(size_t)3,buf,len); @@ -747,7 +812,7 @@ writeSearchAPDU(SearchAPDU* query, char* buffer, long* len) ptr = query->ElementSetNames[++i]; /* the element set name */ scratch = (char*)s_realloc(scratch,newScratchSize); s_strncat(scratch,ES_DELIMITER_1,2,newScratchSize); - s_strncat(scratch,ptr,strlen(ptr) + 1,newScratchSize); + s_strncat(scratch,ptr,strlen(ptr) + 1,newScratchSize); } } else @@ -757,37 +822,38 @@ writeSearchAPDU(SearchAPDU* query, char* buffer, long* len) s_strncat(scratch,ES_DELIMITER_2,2,newScratchSize); s_strncat(scratch,ptr,strlen(ptr) + 1,newScratchSize); s_strncat(scratch,ES_DELIMITER_1,2,newScratchSize); - s_strncat(scratch,esPtr,strlen(esPtr) + 1,newScratchSize); + s_strncat(scratch,esPtr,strlen(esPtr) + 1,newScratchSize); } } buf = writeString(scratch,DT_ElementSetNames,buf,len); s_free(scratch); - } + } buf = writeAny(query->ReferenceID,DT_ReferenceID,buf,len); - + /* go back and write the header-length-indicator */ RELEASE_HEADER_SPACE(len); - size = buf - buffer - HEADER_LEN; + size = buf - buffer - HEADER_LEN; writeBinaryInteger(size,HEADER_LEN,buffer,len); if (query->Query != NULL) - buf = writeSearchInfo(query,buf,len); - + buf = writeSearchInfo(query,buf,len); + return(buf); } /*----------------------------------------------------------------------*/ -SearchResponseAPDU* -makeSearchResponseAPDU( -long result, -long count, -long recordsReturned, -long nextPos, -long resultStatus, -long presentStatus, -any* refID, -void* records) +SearchResponseAPDU* +makeSearchResponseAPDU(result,count,recordsReturned,nextPos,resultStatus, + presentStatus,refID,records) +long result; +long count; +long recordsReturned; +long nextPos; +long resultStatus; +long presentStatus; +any* refID; +void* records; { SearchResponseAPDU* query = (SearchResponseAPDU*)s_malloc((size_t)sizeof(SearchResponseAPDU)); query->PDUType = searchResponseAPDU; @@ -799,13 +865,14 @@ void* records) query->PresentStatus = presentStatus; query->ReferenceID = duplicateAny(refID); query->DatabaseDiagnosticRecords = records; - return(query); + return(query); } /*----------------------------------------------------------------------*/ -void -freeSearchResponseAPDU(SearchResponseAPDU* queryResponse) +void +freeSearchResponseAPDU(queryResponse) +SearchResponseAPDU* queryResponse; { freeAny(queryResponse->ReferenceID); s_free(queryResponse); @@ -813,14 +880,17 @@ freeSearchResponseAPDU(SearchResponseAPDU* queryResponse) /*----------------------------------------------------------------------*/ -char* -writeSearchResponseAPDU(SearchResponseAPDU* queryResponse, char* buffer, long* len) +char* +writeSearchResponseAPDU(queryResponse,buffer,len) +SearchResponseAPDU* queryResponse; +char* buffer; +long* len; { char* buf = buffer + HEADER_LEN; /* leave room for the header-length-indicator */ long size; RESERVE_SPACE_FOR_HEADER(len); - + buf = writePDUType(queryResponse->PDUType,buf,len); buf = writeBinaryInteger(queryResponse->SearchStatus,(size_t)1,buf,len); buf = writeBinaryInteger(queryResponse->ResultCount,(size_t)3,buf,len); @@ -829,22 +899,24 @@ writeSearchResponseAPDU(SearchResponseAPDU* queryResponse, char* buffer, long* l buf = writeNum(queryResponse->ResultSetStatus,DT_ResultSetStatus,buf,len); buf = writeNum(queryResponse->PresentStatus,DT_PresentStatus,buf,len); buf = writeAny(queryResponse->ReferenceID,DT_ReferenceID,buf,len); - + /* go back and write the header-length-indicator */ RELEASE_HEADER_SPACE(len); - size = buf - buffer - HEADER_LEN; + size = buf - buffer - HEADER_LEN; writeBinaryInteger(size,HEADER_LEN,buffer,len); if (queryResponse->DatabaseDiagnosticRecords != NULL) - buf = writeSearchResponseInfo(queryResponse,buf,len); - + buf = writeSearchResponseInfo(queryResponse,buf,len); + return(buf); } /*----------------------------------------------------------------------*/ -char* -readSearchResponseAPDU(SearchResponseAPDU** queryResponse, char* buffer) +char* +readSearchResponseAPDU(queryResponse,buffer) +SearchResponseAPDU** queryResponse; +char* buffer; { char* buf = buffer; long size; @@ -853,20 +925,20 @@ readSearchResponseAPDU(SearchResponseAPDU** queryResponse, char* buffer) long resultStatus,presentStatus; any *refID = NULL; void* userInfo = NULL; - + /* read required part */ - buf = readBinaryInteger(&size,HEADER_LEN,buf); + buf = readBinaryInteger(&size,HEADER_LEN,buf); buf = readPDUType(&pduType,buf); buf = readBinaryInteger(&result,(size_t)1,buf); buf = readBinaryInteger(&count,(size_t)3,buf); buf = readBinaryInteger(&recordsReturned,(size_t)3,buf); buf = readBinaryInteger(&nextPos,(size_t)3,buf); - + resultStatus = presentStatus = UNUSED; refID = NULL; /* read optional part */ - while (buf < (buffer + size + HEADER_LEN)) + while (buf < (buffer + size + HEADER_LEN)) { data_tag tag = peekTag(buf); switch (tag) { case DT_ResultSetStatus: @@ -884,18 +956,18 @@ readSearchResponseAPDU(SearchResponseAPDU** queryResponse, char* buffer) break; } } - + buf = readSearchResponseInfo(&userInfo,buf); if (buf == NULL) freeAny(refID); RETURN_ON_NULL(buf); - + /* construct the search object */ *queryResponse = makeSearchResponseAPDU(result,count,recordsReturned,nextPos, (long)resultStatus,(long)presentStatus,refID,userInfo); freeAny(refID); - + return(buf); } @@ -906,11 +978,11 @@ readSearchResponseAPDU(SearchResponseAPDU** queryResponse, char* buffer) **----------------------------------------------------------------------*/ /* WIDE AREA INFORMATION SERVER SOFTWARE: No guarantees or restrictions. See the readme file for the full standard - disclaimer. - + disclaimer. + 3.26.90 Harry Morris, morris@think.com 3.30.90 Harry Morris - Changed any->bits to any->bytes - 4.11.90 HWM - fixed include file names, changed + 4.11.90 HWM - fixed include file names, changed - writeCompressedIntegerWithPadding() to writeCompressedIntWithPadding() - generalized conditional includes (see c-dialect.h) @@ -920,39 +992,43 @@ readSearchResponseAPDU(SearchResponseAPDU** queryResponse, char* buffer) char* readErrorPosition = NULL; /* pos where buf stoped making sense */ /*----------------------------------------------------------------------*/ -/* A note on error handling +/* A note on error handling read - these are low level routines, they do not check the type tags which (sometimes) preceed the data (this is done by the higher - level functions which call these functions). There is no + level functions which call these functions). There is no attempt made to check that the reading does not exceed the read - buffer. Such cases should be very rare and usually will be - caught by the calling functions. (note - it is unlikely that + buffer. Such cases should be very rare and usually will be + caught by the calling functions. (note - it is unlikely that a series of low level reads will go far off the edge without triggering a type error. However, it is possible for a single - bad read in an array function (eg. readAny) to attempt to read a + bad read in an array function (eg. readAny) to attempt to read a large ammount, possibly causing a segmentation violation or out of memory condition. */ /*----------------------------------------------------------------------*/ -diagnosticRecord* -makeDiag(boolean surrogate, char* code, char* addInfo) +diagnosticRecord* +makeDiag(surrogate,code,addInfo) +boolean surrogate; +char* code; +char* addInfo; { - diagnosticRecord* diag = + diagnosticRecord* diag = (diagnosticRecord*)s_malloc((size_t)sizeof(diagnosticRecord)); - + diag->SURROGATE = surrogate; memcpy(diag->DIAG,code,DIAGNOSTIC_CODE_SIZE); - diag->ADDINFO = s_strdup(addInfo); + diag->ADDINFO = s_strdup(addInfo); return(diag); } /*----------------------------------------------------------------------*/ -void -freeDiag(diagnosticRecord* diag) -{ +void +freeDiag(diag) +diagnosticRecord* diag; +{ if (diag != NULL) { if (diag->ADDINFO != NULL) s_free(diag->ADDINFO); @@ -964,50 +1040,53 @@ freeDiag(diagnosticRecord* diag) #define END_OF_RECORD 0x1D -char* -writeDiag(diagnosticRecord* diag, char* buffer, long* len) +char* +writeDiag(diag,buffer,len) +diagnosticRecord* diag; +char* buffer; +long* len; /* diagnostics (as per Appendix D) have a very weird format - this changes in SR-1 */ { char* buf = buffer; long length; - + if (diag == NULL) /* handle unspecified optional args */ return(buf); buf = writeTag(DT_DatabaseDiagnosticRecords,buf,len); CHECK_FOR_SPACE_LEFT(0,len); - - length = 3; + + length = 3; if (diag->ADDINFO != NULL) length += strlen(diag->ADDINFO); - + if (length >= 0xFFFF ) /* make sure the length is reasonable */ { length = 0xFFFF - 1; diag->ADDINFO[0xFFFF - 3 - 1] = '\0'; } - + buf = writeBinaryInteger(length,2,buf,len); CHECK_FOR_SPACE_LEFT(1,len); - buf[0] = diag->DIAG[0]; + buf[0] = diag->DIAG[0]; buf++; - + CHECK_FOR_SPACE_LEFT(1,len); buf[0] = diag->DIAG[1]; buf++; - + if (length > 3) { CHECK_FOR_SPACE_LEFT(3,len); memcpy(buf,diag->ADDINFO,(size_t)length - 3); buf += length - 3; } - + CHECK_FOR_SPACE_LEFT(1,len); buf[0] = diag->SURROGATE; buf++; - + CHECK_FOR_SPACE_LEFT(1,len); buf[0] = END_OF_RECORD; buf++; @@ -1017,23 +1096,25 @@ writeDiag(diagnosticRecord* diag, char* buffer, long* len) /*----------------------------------------------------------------------*/ -char* -readDiag(diagnosticRecord** diag, char* buffer) +char* +readDiag(diag,buffer) +diagnosticRecord** diag; +char* buffer; { char* buf = buffer; - diagnosticRecord* d + diagnosticRecord* d = (diagnosticRecord*)s_malloc((size_t)sizeof(diagnosticRecord)); data_tag tag; long len; - + buf = readTag(&tag,buf); - + buf = readBinaryInteger(&len,2,buf); - + d->DIAG[0] = buf[0]; d->DIAG[1] = buf[1]; d->DIAG[2] = '\0'; - + if (len > 3) { d->ADDINFO = (char*)s_malloc((size_t)(len - 3 + 1)); memcpy(d->ADDINFO,(char*)(buf + 2),(size_t)(len - 3)); @@ -1041,9 +1122,9 @@ readDiag(diagnosticRecord** diag, char* buffer) } else d->ADDINFO = NULL; - + d->SURROGATE = buf[len - 1]; - + *diag = d; return(buf + len + 1); @@ -1056,43 +1137,48 @@ readDiag(diagnosticRecord** diag, char* buffer) #define dataBits 7 char* -writeCompressedInteger(unsigned long num, char* buf, long* len) +writeCompressedInteger(num,buf,len) +unsigned long num; +char* buf; +long* len; /* write a binary integer in the format described on p. 40. - this might be sped up + this might be sped up */ { char byte; - unsigned long i; + long i; unsigned long size; - + size = writtenCompressedIntSize(num); CHECK_FOR_SPACE_LEFT(size,len); - - for (i = size - 1; i != 0; i--) + + for (i = size - 1; i >= 0; i--) { byte = num & dataMask; if (i != (size-1)) /* turn on continue bit */ byte = (char)(byte | continueBit); buf[i] = byte; num = num >> dataBits; /* don't and here */ } - + return(buf + size); -} +} /*----------------------------------------------------------------------*/ char* -readCompressedInteger(unsigned long *num, char* buf) +readCompressedInteger(num,buf) +unsigned long *num; +char* buf; /* read a binary integer in the format described on p. 40. - this might be sped up + this might be sped up */ { long i = 0; unsigned char byte; *num = 0; - - do + + do { byte = buf[i++]; *num = *num << dataBits; *num += (byte & dataMask); @@ -1100,29 +1186,29 @@ readCompressedInteger(unsigned long *num, char* buf) while (byte & continueBit); return(buf + i); -} +} /*----------------------------------------------------------------------*/ #define pad 128 /* high bit is set */ char* -writeCompressedIntWithPadding( -unsigned long num, -unsigned long size, -char* buffer, -long* len) +writeCompressedIntWithPadding(num,size,buffer,len) +unsigned long num; +unsigned long size; +char* buffer; +long* len; /* Like writeCompressedInteger, except writes padding (128) to make - sure that size bytes are used. This can be read correctly by + sure that size bytes are used. This can be read correctly by readCompressedInteger() */ { char* buf = buffer; unsigned long needed,padding; long i; - + CHECK_FOR_SPACE_LEFT(size,len); - + needed = writtenCompressedIntSize(num); padding = size - needed; i = padding - 1; @@ -1130,71 +1216,81 @@ long* len) for (i = padding - 1;i >= 0;i--) { buf[i] = pad; } - + buf = writeCompressedInteger(num,buf + padding,len); - + return(buf); -} +} /*----------------------------------------------------------------------*/ unsigned long -writtenCompressedIntSize(unsigned long num) +writtenCompressedIntSize(num) +unsigned long num; /* return the number of bytes needed to represnet the value num in compressed format. curently limited to 4 bytes */ { - if (num < CompressedInt1Byte) + if (num < CompressedInt1Byte) return(1); - else if (num < CompressedInt2Byte) + else if (num < CompressedInt2Byte) return(2); else if (num < CompressedInt3Byte) return(3); else - return(4); + return(4); } /*----------------------------------------------------------------------*/ char* -writeTag(data_tag tag, char* buf, long* len) +writeTag(tag,buf,len) +data_tag tag; +char* buf; +long* len; /* write out a data tag */ -{ +{ return(writeCompressedInteger(tag,buf,len)); -} +} /*----------------------------------------------------------------------*/ char* -readTag(data_tag* tag, char* buf) +readTag(tag,buf) +data_tag* tag; +char* buf; /* read a data tag */ -{ +{ return(readCompressedInteger(tag,buf)); -} +} /*----------------------------------------------------------------------*/ -unsigned long -writtenTagSize(data_tag tag) -{ +unsigned long +writtenTagSize(tag) +data_tag tag; +{ return(writtenCompressedIntSize(tag)); } /*----------------------------------------------------------------------*/ data_tag -peekTag(char* buf) +peekTag(buf) +char* buf; /* read a data tag without advancing the buffer */ { data_tag tag; readTag(&tag,buf); return(tag); -} +} /*----------------------------------------------------------------------*/ -any* -makeAny(unsigned long size, char* data) +any* +makeAny(size,data) +unsigned long size; +char* data; { any* a = (any*)s_malloc((size_t)sizeof(any)); a->size = size; @@ -1205,9 +1301,10 @@ makeAny(unsigned long size, char* data) /*----------------------------------------------------------------------*/ void -freeAny(any* a) +freeAny(a) +any* a; /* destroy an any and its associated data. Assumes a->bytes was - allocated using the s_malloc family of libraries + allocated using the s_malloc family of libraries */ { if (a != NULL) @@ -1219,8 +1316,9 @@ freeAny(any* a) /*----------------------------------------------------------------------*/ -any* -duplicateAny(any* a) +any* +duplicateAny(a) +any* a; { any* copy = NULL; @@ -1240,15 +1338,19 @@ duplicateAny(any* a) /*----------------------------------------------------------------------*/ -char* -writeAny(any* a, data_tag tag, char* buffer, long* len) +char* +writeAny(a,tag,buffer,len) +any* a; +data_tag tag; +char* buffer; +long* len; /* write an any + tag and size info */ { char* buf = buffer; if (a == NULL) /* handle unspecified optional args */ return(buf); - + /* write the tags */ buf = writeTag(tag,buf,len); buf = writeCompressedInteger(a->size,buf,len); @@ -1263,7 +1365,9 @@ writeAny(any* a, data_tag tag, char* buffer, long* len) /*----------------------------------------------------------------------*/ -char *readAny(any** anAny, char* buffer) +char *readAny(anAny,buffer) +any** anAny; +char* buffer; /* read an any + tag and size info */ { char *buf; @@ -1275,9 +1379,9 @@ char *readAny(any** anAny, char* buffer) a=(any*)s_malloc((size_t)sizeof(any)); buf=buffer; - + buf = readTag(&tag,buf); - + buf = readCompressedInteger(&a->size,buf); /* now simply copy the bytes */ @@ -1290,8 +1394,10 @@ a=(any*)s_malloc((size_t)sizeof(any)); /*----------------------------------------------------------------------*/ -unsigned long -writtenAnySize(data_tag tag, any* a) +unsigned long +writtenAnySize(tag,a) +data_tag tag; +any* a; { unsigned long size; @@ -1307,13 +1413,14 @@ writtenAnySize(data_tag tag, any* a) /*----------------------------------------------------------------------*/ any* -stringToAny(char* s) +stringToAny(s) +char* s; { any* a = NULL; - + if (s == NULL) return(NULL); - + a = (any*)s_malloc((size_t)sizeof(any)); a->size = strlen(s); a->bytes = (char*)s_malloc((size_t)a->size); @@ -1324,13 +1431,14 @@ stringToAny(char* s) /*----------------------------------------------------------------------*/ char* -anyToString(any* a) +anyToString(a) +any* a; { char* s = NULL; - + if (a == NULL) return(NULL); - + s = s_malloc((size_t)(a->size + 1)); memcpy(s,a->bytes,(size_t)a->size); s[a->size] = '\0'; @@ -1339,11 +1447,15 @@ anyToString(any* a) /*----------------------------------------------------------------------*/ -char* -writeString(char* s, data_tag tag, char* buffer, long* len) -/* Write a C style string. The terminating null is not written. +char* +writeString(s,tag,buffer,len) +char* s; +data_tag tag; +char* buffer; +long* len; +/* Write a C style string. The terminating null is not written. This function is not part of the Z39.50 spec. It is provided - for the convienience of those wishing to pass C strings in + for the convienience of those wishing to pass C strings in the place of an any. */ { @@ -1351,7 +1463,7 @@ writeString(char* s, data_tag tag, char* buffer, long* len) any* data = NULL; if (s == NULL) return(buffer); /* handle unused optional item before making an any */ - data = (any*)s_malloc((size_t)sizeof(any)); + data = (any*)s_malloc((size_t)sizeof(any)); data->size = strlen(s); data->bytes = s; /* save a copy here by not using stringToAny() */ buf = writeAny(data,tag,buf,len); @@ -1361,12 +1473,14 @@ writeString(char* s, data_tag tag, char* buffer, long* len) /*----------------------------------------------------------------------*/ -char* -readString(char** s, char* buffer) +char* +readString(s ,buffer) +char** s ; +char* buffer; /* Read an any and convert it into a C style string. This function is not part of the Z39.50 spec. It is provided - for the convienience of those wishing to pass C strings in - the place of an any. + for the convienience of those wishing to pass C strings in + the place of an any. */ { any* data = NULL; @@ -1378,8 +1492,10 @@ readString(char** s, char* buffer) /*----------------------------------------------------------------------*/ -unsigned long -writtenStringSize(data_tag tag, char* s) +unsigned long +writtenStringSize(tag,s) +data_tag tag; +char* s; { unsigned long size; @@ -1394,21 +1510,23 @@ writtenStringSize(data_tag tag, char* s) /*----------------------------------------------------------------------*/ -any* -longToAny(long num) +any* +longToAny(num) +long num; /* a convienience function */ { char s[40]; sprintf(s,"%ld",num); - + return(stringToAny(s)); } /*----------------------------------------------------------------------*/ long -anyToLong(any* a) +anyToLong(a) +any* a; /* a convienience function */ { long num; @@ -1419,7 +1537,7 @@ anyToLong(any* a) s_free(str); return(num); } - + /*----------------------------------------------------------------------*/ #define bitsPerByte 8 @@ -1429,22 +1547,22 @@ makeBitMap(unsigned long numBits, ...) /* construct and return a bitmap with numBits elements */ { va_list ap; - unsigned long i,j; + long i,j; bit_map* bm = NULL; - LYva_start(ap,numBits); - + va_start(ap,numBits); + bm = (bit_map*)s_malloc((size_t)sizeof(bit_map)); - bm->size = (unsigned long)(ceil((double)numBits / bitsPerByte)); + bm->size = (unsigned long)ceil((double)numBits / bitsPerByte); bm->bytes = (char*)s_malloc((size_t)bm->size); - + /* fill up the bits */ for (i = 0; i < bm->size; i++) /* iterate over bytes */ { char byte = 0; for (j = 0; j < bitsPerByte; j++) /* iterate over bits */ { if ((i * bitsPerByte + j) < numBits) { boolean bit = false; - bit = (boolean)va_arg(ap,boolean); + bit = (boolean)va_arg(ap,boolean); if (bit) { byte = byte | (1 << (bitsPerByte - j - 1)); } @@ -1461,7 +1579,8 @@ makeBitMap(unsigned long numBits, ...) /*----------------------------------------------------------------------*/ void -freeBitMap(bit_map* bm) +freeBitMap(bm) +bit_map* bm; /* destroy a bit map created by makeBitMap() */ { s_free(bm->bytes); @@ -1470,18 +1589,20 @@ freeBitMap(bit_map* bm) /*----------------------------------------------------------------------*/ -/* use this routine to interpret a bit map. pos specifies the bit - number. bit 0 is the Leftmost bit of the first byte. +/* use this routine to interpret a bit map. pos specifies the bit + number. bit 0 is the Leftmost bit of the first byte. Could do bounds checking. */ boolean -bitAtPos(unsigned long pos, bit_map* bm) +bitAtPos(pos,bm) +long pos; +bit_map* bm; { if (pos > bm->size*bitsPerByte) return false; else - return((bm->bytes[(pos / bitsPerByte)] & + return((bm->bytes[(pos / bitsPerByte)] & (0x80>>(pos % bitsPerByte))) ? true : false); } @@ -1489,27 +1610,40 @@ bitAtPos(unsigned long pos, bit_map* bm) /*----------------------------------------------------------------------*/ char* -writeBitMap(bit_map* bm, data_tag tag, char* buffer, long* len) +writeBitMap(bm,tag,buffer,len) +bit_map* bm; +data_tag tag; +char* buffer; +long* len; /* write a bitmap + type and size info */ -{ +{ return(writeAny((any*)bm,tag,buffer,len)); } /*----------------------------------------------------------------------*/ char* -readBitMap(bit_map** bm, char* buffer) +readBitMap(bm,buffer) +bit_map** bm; +char* buffer; /* read a bitmap + type and size info */ { - char *c; - c = readAny((any**)bm,buffer); - return(c); + char *c; + + + +c=readAny((any**)bm,buffer); + + return(c); } /*----------------------------------------------------------------------*/ -char* -writeByte(unsigned long byte, char* buf, long* len) +char* +writeByte(byte,buf,len) +unsigned long byte; +char* buf; +long* len; { CHECK_FOR_SPACE_LEFT(1,len); buf[0] = byte & 0xFF; /* we really only want the first byte */ @@ -1518,8 +1652,10 @@ writeByte(unsigned long byte, char* buf, long* len) /*----------------------------------------------------------------------*/ -char* -readByte(unsigned char* byte, char* buf) +char* +readByte(byte,buf) +unsigned char* byte; +char* buf; { *byte = buf[0]; return(buf + 1); @@ -1527,16 +1663,21 @@ readByte(unsigned char* byte, char* buf) /*----------------------------------------------------------------------*/ -char* -writeBoolean(boolean flag, char* buf, long* len) +char* +writeBoolean(flag,buf,len) +boolean flag; +char* buf; +long* len; { return(writeByte(flag,buf,len)); } /*----------------------------------------------------------------------*/ -char* -readBoolean(boolean* flag, char* buffer) +char* +readBoolean(flag,buffer) +boolean* flag; +char* buffer; { unsigned char byte; char* buf = readByte(&byte,buffer); @@ -1547,26 +1688,32 @@ readBoolean(boolean* flag, char* buffer) /*----------------------------------------------------------------------*/ char* -writePDUType(pdu_type pduType, char* buf, long* len) +writePDUType(pduType,buf,len) +pdu_type pduType; +char* buf; +long* len; /* PDUType is a single byte */ { return(writeBinaryInteger((long)pduType,(unsigned long)1,buf,len)); -} +} /*----------------------------------------------------------------------*/ char* -readPDUType(pdu_type* pduType, char* buf) +readPDUType(pduType,buf) +pdu_type* pduType; +char* buf; /* PDUType is a single byte */ { return(readBinaryInteger((long*)pduType,(unsigned long)1,buf)); -} +} /*----------------------------------------------------------------------*/ pdu_type -peekPDUType(char* buf) -/* read the next pdu without advancing the buffer, Note that this +peekPDUType(buf) +char* buf; +/* read the next pdu without advancing the buffer, Note that this function is to be used on a buffer that is known to contain an APDU. The pdu_type is written HEADER_LEN bytes into the buffer */ @@ -1581,7 +1728,11 @@ peekPDUType(char* buf) #define BINARY_INTEGER_BYTES sizeof(long) /* the number of bytes used by a "binary integer" */ char* -writeBinaryInteger(long num, unsigned long size, char* buf, long* len) +writeBinaryInteger(num,size,buf,len) +long num; +unsigned long size; +char* buf; +long* len; /* write out first size bytes of num - no type info XXX should this take unsigned longs instead ??? */ { @@ -1605,11 +1756,14 @@ writeBinaryInteger(long num, unsigned long size, char* buf, long* len) /*----------------------------------------------------------------------*/ char* -readBinaryInteger(long* num, unsigned long size, char* buf) +readBinaryInteger(num,size,buf) +long* num; +unsigned long size; +char* buf; /* read in first size bytes of num - no type info XXX this should take unsigned longs instead !!! */ { - unsigned long i; + long i; unsigned char byte; if (size < 1 || size > BINARY_INTEGER_BYTES) @@ -1627,10 +1781,11 @@ readBinaryInteger(long* num, unsigned long size, char* buf) /*----------------------------------------------------------------------*/ -unsigned long -writtenCompressedBinIntSize(long num) +unsigned long +writtenCompressedBinIntSize(num) +long num; /* return the number of bytes needed to represent the value num. - currently limited to max of 4 bytes + currently limited to max of 4 bytes Only compresses for positive nums - negatives get whole 4 bytes */ { @@ -1645,36 +1800,42 @@ writtenCompressedBinIntSize(long num) else return(4); } - + /*----------------------------------------------------------------------*/ char* -writeNum(long num, data_tag tag, char* buffer, long* len) +writeNum(num,tag,buffer,len) +long num; +data_tag tag; +char* buffer; +long* len; /* write a binary integer + size and tag info */ { char* buf = buffer; long size = writtenCompressedBinIntSize(num); - + if (num == UNUSED) return(buffer); - + buf = writeTag(tag,buf,len); - buf = writeCompressedInteger(size,buf,len); - buf = writeBinaryInteger(num,(unsigned long)size,buf,len); + buf = writeCompressedInteger(size,buf,len); + buf = writeBinaryInteger(num,(unsigned long)size,buf,len); return(buf); } /*----------------------------------------------------------------------*/ char* -readNum(long* num, char* buffer) +readNum(num,buffer) +long* num; +char* buffer; /* read a binary integer + size and tag info */ { char* buf = buffer; data_tag tag; unsigned long size; unsigned long val; - + buf = readTag(&tag,buf); buf = readCompressedInteger(&val,buf); size = (unsigned long)val; @@ -1684,25 +1845,29 @@ readNum(long* num, char* buffer) /*----------------------------------------------------------------------*/ -unsigned long -writtenNumSize(data_tag tag, long num) +unsigned long +writtenNumSize(tag,num) +data_tag tag; +long num; { long dataSize = writtenCompressedBinIntSize(num); long size; - + size = writtenTagSize(tag); /* space for the tag */ size += writtenCompressedIntSize(dataSize); /* space for the size */ size += dataSize; /* space for the data */ - + return(size); } /*----------------------------------------------------------------------*/ -typedef void (voidfunc)(void *); +typedef void (voidfunc)(); void -doList(void** list, voidfunc *func) +doList(list,func) +void** list; +voidfunc *func; /* call func on each element of the NULL terminated list of pointers */ { register long i; @@ -1715,8 +1880,10 @@ doList(void** list, voidfunc *func) /*----------------------------------------------------------------------*/ -char* -writeProtocolVersion(char* buf, long* len) +char* +writeProtocolVersion(buf,len) +char* buf; +long* len; /* write a bitmap describing the protocols available */ { static bit_map* version = NULL; @@ -1724,14 +1891,14 @@ writeProtocolVersion(char* buf, long* len) if (version == NULL) { version = makeBitMap((unsigned long)1,true); /* version 1! */ } - + return(writeBitMap(version,DT_ProtocolVersion,buf,len)); } /*----------------------------------------------------------------------*/ char* -defaultImplementationID(void) +defaultImplementationID() { static char ImplementationID[] = "TMC"; return(ImplementationID); @@ -1740,7 +1907,7 @@ defaultImplementationID(void) /*----------------------------------------------------------------------*/ char* -defaultImplementationName(void) +defaultImplementationName() { static char ImplementationName[] = "Thinking Machines Corporation Z39.50"; return(ImplementationName); @@ -1749,7 +1916,7 @@ defaultImplementationName(void) /*----------------------------------------------------------------------*/ char* -defaultImplementationVersion(void) +defaultImplementationVersion() { static char ImplementationVersion[] = "2.0A"; return(ImplementationVersion); @@ -1764,22 +1931,28 @@ defaultImplementationVersion(void) **----------------------------------------------------------------------*/ /* WIDE AREA INFORMATION SERVER SOFTWARE: No guarantees or restrictions. See the readme file for the full standard - disclaimer. - + disclaimer. + 3.26.90 Harry Morris, morris@think.com 4.11.90 HWM - generalized conditional includes (see c-dialect.h) */ /*----------------------------------------------------------------------*/ query_term* -makeAttributeTerm( -char* use, -char* relation, -char* position, -char* structure, -char* truncation, -char* completeness, -any* term) +makeAttributeTerm(use, + relation, + position, + structure, + truncation, + completeness, + term) +char* use; +char* relation; +char* position; +char* structure; +char* truncation; +char* completeness; +any* term; { query_term* qt = (query_term*)s_malloc((size_t)sizeof(query_term)); @@ -1803,8 +1976,9 @@ any* term) /*----------------------------------------------------------------------*/ query_term* -makeResultSetTerm(any* resultSet) -{ +makeResultSetTerm(resultSet) +any* resultSet; +{ query_term* qt = (query_term*)s_malloc((size_t)sizeof(query_term)); qt->TermType = TT_ResultSetID; @@ -1812,14 +1986,15 @@ makeResultSetTerm(any* resultSet) qt->ResultSetID = duplicateAny(resultSet); qt->Term = NULL; - + return(qt); } /*----------------------------------------------------------------------*/ -query_term* -makeOperatorTerm(char* operatorCode) +query_term* +makeOperatorTerm(operatorCode) +char* operatorCode; { query_term* qt = (query_term*)s_malloc((size_t)sizeof(query_term)); @@ -1835,10 +2010,10 @@ makeOperatorTerm(char* operatorCode) /*----------------------------------------------------------------------*/ -void -freeTerm(void* param) +void +freeTerm(qt) +query_term* qt; { - query_term* qt = (query_term*)param; switch (qt->TermType) { case TT_Attribute: freeAny(qt->Term); @@ -1862,23 +2037,26 @@ freeTerm(void* param) #define ATTRIBUTE_LIST_SIZE ATTRIBUTE_SIZE * 6 #define AT_DELIMITER " " -char* -writeQueryTerm(query_term* qt, char* buffer, long* len) +char* +writeQueryTerm(qt,buffer,len) +query_term* qt; +char* buffer; +long* len; { char* buf = buffer; char attributes[ATTRIBUTE_LIST_SIZE]; switch (qt->TermType) { case TT_Attribute: - strncpy(attributes,qt->Use,ATTRIBUTE_LIST_SIZE); + strncpy(attributes,qt->Use,ATTRIBUTE_LIST_SIZE); s_strncat(attributes,AT_DELIMITER,sizeof(AT_DELIMITER) + 1,ATTRIBUTE_LIST_SIZE); - s_strncat(attributes,qt->Relation,ATTRIBUTE_SIZE,ATTRIBUTE_LIST_SIZE); + s_strncat(attributes,qt->Relation,ATTRIBUTE_SIZE,ATTRIBUTE_LIST_SIZE); s_strncat(attributes,AT_DELIMITER,sizeof(AT_DELIMITER) + 1,ATTRIBUTE_LIST_SIZE); - s_strncat(attributes,qt->Position,ATTRIBUTE_SIZE,ATTRIBUTE_LIST_SIZE); + s_strncat(attributes,qt->Position,ATTRIBUTE_SIZE,ATTRIBUTE_LIST_SIZE); s_strncat(attributes,AT_DELIMITER,sizeof(AT_DELIMITER) + 1,ATTRIBUTE_LIST_SIZE); - s_strncat(attributes,qt->Structure,ATTRIBUTE_SIZE,ATTRIBUTE_LIST_SIZE); + s_strncat(attributes,qt->Structure,ATTRIBUTE_SIZE,ATTRIBUTE_LIST_SIZE); s_strncat(attributes,AT_DELIMITER,sizeof(AT_DELIMITER) + 1,ATTRIBUTE_LIST_SIZE); - s_strncat(attributes,qt->Truncation,ATTRIBUTE_SIZE,ATTRIBUTE_LIST_SIZE); + s_strncat(attributes,qt->Truncation,ATTRIBUTE_SIZE,ATTRIBUTE_LIST_SIZE); s_strncat(attributes,AT_DELIMITER,sizeof(AT_DELIMITER) + 1,ATTRIBUTE_LIST_SIZE); s_strncat(attributes,qt->Completeness,ATTRIBUTE_SIZE,ATTRIBUTE_LIST_SIZE); buf = writeString(attributes,DT_AttributeList,buf,len); @@ -1901,8 +2079,10 @@ writeQueryTerm(query_term* qt, char* buffer, long* len) /*----------------------------------------------------------------------*/ -char* -readQueryTerm(query_term** qt, char* buffer) +char* +readQueryTerm(qt,buffer) +query_term** qt; +char* buffer; { char* buf = buffer; char *attributeList = NULL; @@ -1917,7 +2097,7 @@ readQueryTerm(query_term** qt, char* buffer) any* resultSetID = NULL; data_tag tag; - + tag = peekTag(buffer); switch(tag) @@ -1937,7 +2117,7 @@ readQueryTerm(query_term** qt, char* buffer) break; case DT_ResultSetID: buf = readAny(&resultSetID,buf); - *qt = makeResultSetTerm(resultSetID); + *qt = makeResultSetTerm(resultSetID); freeAny(resultSetID); break; case DT_Operator: @@ -1949,20 +2129,21 @@ readQueryTerm(query_term** qt, char* buffer) REPORT_READ_ERROR(buf); break; } - + return(buf); } /*----------------------------------------------------------------------*/ -static unsigned long getQueryTermSize PARAMS((query_term* qt)); +static unsigned long getQueryTermSize _AP((query_term* qt)); static unsigned long -getQueryTermSize(query_term* qt) +getQueryTermSize(qt) +query_term* qt; /* figure out how many bytes it will take to write this query */ { - unsigned long size = 0; - static char attributes[] = "11 22 33 44 55 66"; /* we just need this to + unsigned long size; + static char attributes[] = "11 22 33 44 55 66"; /* we just need this to calculate its written size */ @@ -1988,12 +2169,13 @@ getQueryTermSize(query_term* qt) /*----------------------------------------------------------------------*/ -/* A query is simply a null terminated list of query terms. For +/* A query is simply a null terminated list of query terms. For transmission, a query is written into an any which is sent as the user information field. */ any* -writeQuery(query_term** terms) +writeQuery(terms) +query_term** terms; { any* info = NULL; char* writePos = NULL; @@ -2026,7 +2208,8 @@ writeQuery(query_term** terms) /*----------------------------------------------------------------------*/ query_term** -readQuery(any *info) +readQuery(info) +any *info; { char* readPos = info->bytes; query_term** terms = NULL; @@ -2044,7 +2227,7 @@ log_write(tmp); { terms = (query_term**)s_malloc((size_t)(sizeof(query_term*)*2)); } else - { terms = + { terms = (query_term**)s_realloc((char*)terms, (size_t)(sizeof(query_term*)*(numTerms+2))); } @@ -2075,13 +2258,14 @@ if(qt==NULL) * up a little window to explain the problem. * On a unix box, it will print out the error and call perror() */ - + /*----------------------------------------------------------------------*/ -static void exitAction PARAMS((long error)); +static void exitAction _AP((long error)); static void -exitAction(long error GCC_UNUSED) +exitAction(error) +long error; { long i; for (i = 0; i < 100000; i++) @@ -2099,11 +2283,11 @@ panic(char *format, ...) va_list ap; /* the variable arguments */ fprintf(stderr,PANIC_HEADER); - LYva_start(ap, format); /* init ap */ + va_start(ap, format); /* init ap */ vfprintf(stderr,format,ap); /* print the contents */ va_end(ap); /* free ap */ fflush(stderr); - + exitAction(0); } @@ -2114,20 +2298,24 @@ panic(char *format, ...) ** Routines originally from cutil.c -- FM ** **----------------------------------------------------------------------*/ -/* Wide AREA INFORMATION SERVER SOFTWARE +/* Wide AREA INFORMATION SERVER SOFTWARE No guarantees or restrictions. See the readme file for the full standard - disclaimer. - + disclaimer. + 3.26.90 Harry Morris, morris@think.com 4.11.90 HWM - generalized conditional includes (see c-dialect.h) */ +#include <varargs.h> + + /*----------------------------------------------------------------------*/ void -fs_checkPtr(void* ptr) +fs_checkPtr(ptr) +void* ptr; /* If the ptr is NULL, give an error */ -{ +{ if (ptr == NULL) panic("checkPtr found a NULL pointer"); } @@ -2135,41 +2323,45 @@ fs_checkPtr(void* ptr) /*----------------------------------------------------------------------*/ void* -fs_malloc(size_t size) +fs_malloc(size) +size_t size; /* does safety checks and optional accounting */ -{ +{ register void* ptr = NULL; ptr = (void*)calloc((size_t)size,(size_t)1); s_checkPtr(ptr); - + return(ptr); } /*----------------------------------------------------------------------*/ void* -fs_realloc(void* ptr, size_t size) -/* does safety checks and optional accounting +fs_realloc(ptr,size) +void* ptr; +size_t size; +/* does safety checks and optional accounting note - we don't know how big ptr's memory is, so we can't ensure that any new memory allocated is NULLed! */ -{ +{ register void* nptr = NULL; - + if (ptr == NULL) /* this is really a malloc */ return(s_malloc(size)); - + nptr = (void*)realloc(ptr,size); s_checkPtr(ptr); - + return(nptr); } /*----------------------------------------------------------------------*/ void -fs_free(void* ptr) +fs_free(ptr) +void* ptr; /* does safety checks and optional accounting */ { if (ptr != NULL) /* some non-ansi compilers/os's cant handle freeing null */ @@ -2182,19 +2374,20 @@ fs_free(void* ptr) /*----------------------------------------------------------------------*/ char* -s_strdup(char* s) +s_strdup(s) +char* s; /* return a copy of s. This is identical to the standard library routine - strdup(), except that it is safe. If s == NULL or malloc fails, + strdup(), except that it is safe. If s == NULL or malloc fails, appropriate action is taken. */ { unsigned long len; char* copy = NULL; - + if (s == NULL) /* saftey check to postpone stupid errors */ return(NULL); - + len = strlen(s); /* length of string - terminator */ copy = (char*)s_malloc((size_t)(sizeof(char)*(len + 1))); strncpy(copy,s,len + 1); @@ -2204,15 +2397,19 @@ s_strdup(char* s) /*----------------------------------------------------------------------*/ char* -fs_strncat(char* dst, char* src, size_t maxToAdd, size_t maxTotal) +fs_strncat(dst,src,maxToAdd,maxTotal) +char* dst; + char* src; + size_t maxToAdd; + size_t maxTotal; -/* like strncat, except the fourth argument limits the maximum total +/* like strncat, except the fourth argument limits the maximum total length of the resulting string */ { size_t dstSize = strlen(dst); size_t srcSize = strlen(src); - + if (dstSize + srcSize < maxTotal) /* use regular old strncat */ return(strncat(dst,src,maxToAdd)); else @@ -2228,14 +2425,16 @@ fs_strncat(char* dst, char* src, size_t maxToAdd, size_t maxTotal) /*----------------------------------------------------------------------*/ -char char_downcase(unsigned long long_ch) +char char_downcase(long_ch) +unsigned long long_ch; { unsigned char ch = long_ch & 0xFF; /* just want one byte */ /* when ansi is the way of the world, this can be tolower */ return (((ch >= 'A') && (ch <= 'Z')) ? (ch + 'a' -'A') : ch); } -char *string_downcase(char *word) +char *string_downcase(word) +char *word; { long i = 0; while(word[i] != '\0'){ diff --git a/WWW/Library/Implementation/HTVMS_WaisUI.h b/WWW/Library/Implementation/HTVMS_WaisUI.h index caa5d892..6f492b87 100644 --- a/WWW/Library/Implementation/HTVMS_WaisUI.h +++ b/WWW/Library/Implementation/HTVMS_WaisUI.h @@ -8,9 +8,13 @@ #ifndef HTVMSWAIS_H #define HTVMSWAIS_H -#include <HTUtils.h> +#ifndef __STDLIB_LOADED +#include <stdlib.h> +#endif /* __STDLIB_LOADED */ -void log_write PARAMS((char *)); +#define _AP(args) () + +void log_write _AP((char *)); /* ** Routines originally from Panic.h -- FM @@ -55,11 +59,11 @@ void panic (char* format,...); /* enhanced memory handling functions - don't call them directly, use the macros below */ -void fs_checkPtr PARAMS((void* ptr)); -void* fs_malloc PARAMS((size_t size)); -void* fs_realloc PARAMS((void* ptr,size_t size)); -void fs_free PARAMS((void* ptr)); -char* fs_strncat PARAMS((char* dst,char* src,size_t maxToAdd,size_t maxTotal)); +void fs_checkPtr _AP((void* ptr)); +void* fs_malloc _AP((size_t size)); +void* fs_realloc _AP((void* ptr,size_t size)); +void fs_free _AP((void* ptr)); +char* fs_strncat _AP((char* dst,char* src,size_t maxToAdd,size_t maxTotal)); /* macros for memory functions. call these in your program. */ #define s_checkPtr(ptr) fs_checkPtr(ptr) @@ -68,13 +72,13 @@ char* fs_strncat PARAMS((char* dst,char* src,size_t maxToAdd,size_t maxTotal)); #define s_free(ptr) { fs_free((char*)ptr); ptr = NULL; } #define s_strncat(dst,src,maxToAdd,maxTotal) fs_strncat((dst),(src),(maxToAdd),(maxTotal)) -char* s_strdup PARAMS((char* s)); +char* s_strdup _AP((char* s)); #define IS_DELIMITER 1 #define NOT_DELIMITER !IS_DELIMITER -char char_downcase PARAMS((unsigned long ch)); -char *string_downcase PARAMS((char* word)); +char char_downcase _AP((unsigned long ch)); +char *string_downcase _AP((char* word)); /*----------------------------------------------------------------------*/ @@ -279,71 +283,71 @@ extern char* readErrorPosition; /* pos where buf stoped making sense */ /*----------------------------------------------------------------------*/ -diagnosticRecord* makeDiag PARAMS((boolean surrogate,char* code,char* addInfo)); -void freeDiag PARAMS((diagnosticRecord* diag)); -char* writeDiag PARAMS((diagnosticRecord* diag,char* buffer,long* len)); -char* readDiag PARAMS((diagnosticRecord** diag,char* buffer)); +diagnosticRecord* makeDiag _AP((boolean surrogate,char* code,char* addInfo)); +void freeDiag _AP((diagnosticRecord* diag)); +char* writeDiag _AP((diagnosticRecord* diag,char* buffer,long* len)); +char* readDiag _AP((diagnosticRecord** diag,char* buffer)); -char* writeCompressedInteger PARAMS((unsigned long num,char* buf,long* len)); -char* readCompressedInteger PARAMS((unsigned long *num,char* buf)); -char* writeCompressedIntWithPadding PARAMS((unsigned long num,unsigned long size, +char* writeCompressedInteger _AP((unsigned long num,char* buf,long* len)); +char* readCompressedInteger _AP((unsigned long *num,char* buf)); +char* writeCompressedIntWithPadding _AP((unsigned long num,unsigned long size, char* buffer,long* len)); -unsigned long writtenCompressedIntSize PARAMS((unsigned long num)); +unsigned long writtenCompressedIntSize _AP((unsigned long num)); -char* writeTag PARAMS((data_tag tag,char* buf,long* len)); -char* readTag PARAMS((data_tag* tag,char* buf)); -data_tag peekTag PARAMS((char* buf)); -unsigned long writtenTagSize PARAMS((data_tag tag)); +char* writeTag _AP((data_tag tag,char* buf,long* len)); +char* readTag _AP((data_tag* tag,char* buf)); +data_tag peekTag _AP((char* buf)); +unsigned long writtenTagSize _AP((data_tag tag)); -any* makeAny PARAMS((unsigned long size,char* data)); -void freeAny PARAMS((any* a)); -any* duplicateAny PARAMS((any* a)); -char* writeAny PARAMS((any* a,data_tag tag,char* buffer,long* len)); -char* readAny PARAMS((any** anAny,char* buffer)); -unsigned long writtenAnySize PARAMS((data_tag tag,any* a)); +any* makeAny _AP((unsigned long size,char* data)); +void freeAny _AP((any* a)); +any* duplicateAny _AP((any* a)); +char* writeAny _AP((any* a,data_tag tag,char* buffer,long* len)); +char* readAny _AP((any** anAny,char* buffer)); +unsigned long writtenAnySize _AP((data_tag tag,any* a)); -any* stringToAny PARAMS((char* s)); -char* anyToString PARAMS((any* a)); -unsigned long writtenStringSize PARAMS((data_tag tag,char* s)); +any* stringToAny _AP((char* s)); +char* anyToString _AP((any* a)); +unsigned long writtenStringSize _AP((data_tag tag,char* s)); -any* longToAny PARAMS((long Num)); -long anyToLong PARAMS((any* a)); +any* longToAny _AP((long Num)); +long anyToLong _AP((any* a)); -char* writeString PARAMS((char* s,data_tag tag,char* buffer,long* len)); -char* readString PARAMS((char** s,char* buffer)); +char* writeString _AP((char* s,data_tag tag,char* buffer,long* len)); +char* readString _AP((char** s,char* buffer)); bit_map* makeBitMap (unsigned long numBits,...); -void freeBitMap PARAMS((bit_map* bm)); -boolean bitAtPos PARAMS((unsigned long pos,bit_map* bm)); -char* writeBitMap PARAMS((bit_map* bm,data_tag tag,char* buffer,long* len)); -char* readBitMap PARAMS((bit_map** bm,char* buffer)); +void freeBitMap _AP((bit_map* bm)); +boolean bitAtPos _AP((long pos,bit_map* bm)); +char* writeBitMap _AP((bit_map* bm,data_tag tag,char* buffer,long* len)); +char* readBitMap _AP((bit_map** bm,char* buffer)); -char* writeByte PARAMS((unsigned long byte,char* buf,long* len)); -char* readByte PARAMS((unsigned char* byte,char* buf)); +char* writeByte _AP((unsigned long byte,char* buf,long* len)); +char* readByte _AP((unsigned char* byte,char* buf)); -char* writeBoolean PARAMS((boolean flag,char* buf,long* len)); -char* readBoolean PARAMS((boolean* flag,char* buf)); +char* writeBoolean _AP((boolean flag,char* buf,long* len)); +char* readBoolean _AP((boolean* flag,char* buf)); -char* writePDUType PARAMS((pdu_type pduType,char* buf,long* len)); -char* readPDUType PARAMS((pdu_type* pduType,char* buf)); -pdu_type peekPDUType PARAMS((char* buf)); +char* writePDUType _AP((pdu_type pduType,char* buf,long* len)); +char* readPDUType _AP((pdu_type* pduType,char* buf)); +pdu_type peekPDUType _AP((char* buf)); -char* writeBinaryInteger PARAMS((long num,unsigned long size, +char* writeBinaryInteger _AP((long num,unsigned long size, char* buf,long* len)); -char* readBinaryInteger PARAMS((long* num,unsigned long size,char* buf)); -unsigned long writtenCompressedBinIntSize PARAMS((long num)); +char* readBinaryInteger _AP((long* num,unsigned long size,char* buf)); +unsigned long writtenCompressedBinIntSize _AP((long num)); -char* writeNum PARAMS((long num,data_tag tag,char* buffer,long* len)); -char* readNum PARAMS((long* num,char* buffer)); -unsigned long writtenNumSize PARAMS((data_tag tag,long num)); +char* writeNum _AP((long num,data_tag tag,char* buffer,long* len)); +char* readNum _AP((long* num,char* buffer)); +unsigned long writtenNumSize _AP((data_tag tag,long num)); -void doList PARAMS((void** list,void (*func)(void *))); +void doList _AP((void** list,void (*func)())); -char* writeProtocolVersion PARAMS((char* buf,long* len)); -char* defaultImplementationID PARAMS((void)); -char* defaultImplementationName PARAMS((void)); -char* defaultImplementationVersion PARAMS((void)); +char* writeProtocolVersion _AP((char* buf,long* len)); +char* defaultImplementationID _AP((void)); +char* defaultImplementationName _AP((void)); +char* defaultImplementationVersion _AP((void)); /*----------------------------------------------------------------------*/ @@ -458,16 +462,16 @@ typedef struct query_term { /*----------------------------------------------------------------------*/ /* functions */ -query_term* makeAttributeTerm PARAMS(( +query_term* makeAttributeTerm _AP(( char* use,char* relation,char* position,char* structure, char* truncation,char* completeness,any* term)); -query_term* makeResultSetTerm PARAMS((any* resultSet)); -query_term* makeOperatorTerm PARAMS((char* operatorCode)); -void freeTerm PARAMS((void* qt)); -char* writeQueryTerm PARAMS((query_term* qt,char* buffer,long* len)); -char* readQueryTerm PARAMS((query_term** qt,char* buffer)); -any* writeQuery PARAMS((query_term** terms)); -query_term** readQuery PARAMS((any* info)); +query_term* makeResultSetTerm _AP((any* resultSet)); +query_term* makeOperatorTerm _AP((char* operatorCode)); +void freeTerm _AP((query_term* qt)); +char* writeQueryTerm _AP((query_term* qt,char* buffer,long* len)); +char* readQueryTerm _AP((query_term** qt,char* buffer)); +any* writeQuery _AP((query_term** terms)); +query_term** readQuery _AP((any* info)); /*----------------------------------------------------------------------*/ @@ -478,7 +482,16 @@ query_term** readQuery PARAMS((any* info)); **----------------------------------------------------------------------*/ char * -generate_retrieval_apdu PARAMS((char *buff, +generate_search_apdu _AP((char* buff, /* buffer to hold the apdu */ + long *buff_len, /* number of bytes written to the buffer */ + char *seed_words, /* string of the seed words */ + char *database_name, + DocObj** docobjs, + long maxDocsRetrieved + )); + +char * +generate_retrieval_apdu _AP((char *buff, long *buff_len, any *docID, long chunk_type, @@ -488,14 +501,19 @@ generate_retrieval_apdu PARAMS((char *buff, long -interpret_message PARAMS((char *request_message, +interpret_message _AP((char *request_message, long request_length, char *response_message, long response_buffer_length, /* length of the buffer (modified)*/ - long connection, + FILE *connection, boolean verbose)); -char *trim_junk PARAMS((char *headline)); + +void +display_text_record_completely _AP((WAISDocumentText *record, + boolean quote_string_quotes)); + +char *trim_junk _AP((char *headline)); @@ -583,74 +601,74 @@ typedef struct PresentResponseAPDU { /*----------------------------------------------------------------------*/ /* Functions */ -InitAPDU* makeInitAPDU PARAMS((boolean search,boolean present,boolean deleteIt, +InitAPDU* makeInitAPDU _AP((boolean search,boolean present,boolean deleteIt, boolean accessControl,boolean resourceControl, long prefMsgSize,long maxMsgSize, char* auth,char* id,char* name, char* version, any* refID,void* userInfo)); -void freeInitAPDU PARAMS((InitAPDU* init)); -char* writeInitAPDU PARAMS((InitAPDU* init,char* buffer,long* len)); -char* readInitAPDU PARAMS((InitAPDU** init,char* buffer)); +void freeInitAPDU _AP((InitAPDU* init)); +char* writeInitAPDU _AP((InitAPDU* init,char* buffer,long* len)); +char* readInitAPDU _AP((InitAPDU** init,char* buffer)); -InitResponseAPDU* makeInitResponseAPDU PARAMS((boolean result, +InitResponseAPDU* makeInitResponseAPDU _AP((boolean result, boolean search,boolean present,boolean deleteIt, boolean accessControl,boolean resourceControl, long prefMsgSize,long maxMsgSize, char* auth,char* id,char* name, char* version, any* refID,void* userInfo)); -void freeInitResponseAPDU PARAMS((InitResponseAPDU* init)); -char* writeInitResponseAPDU PARAMS((InitResponseAPDU* init,char* buffer,long* len)); -char* readInitResponseAPDU PARAMS((InitResponseAPDU** init,char* buffer)); -InitResponseAPDU* replyToInitAPDU PARAMS((InitAPDU* init,boolean result,void* userInfo)); +void freeInitResponseAPDU _AP((InitResponseAPDU* init)); +char* writeInitResponseAPDU _AP((InitResponseAPDU* init,char* buffer,long* len)); +char* readInitResponseAPDU _AP((InitResponseAPDU** init,char* buffer)); +InitResponseAPDU* replyToInitAPDU _AP((InitAPDU* init,boolean result,void* userInfo)); -SearchAPDU* makeSearchAPDU PARAMS((long small,long large, long medium, +SearchAPDU* makeSearchAPDU _AP((long small,long large, long medium, boolean replace,char* name,char** databases, char* type,char** elements,any* refID,void* queryInfo)); -void freeSearchAPDU PARAMS((SearchAPDU* query)); -char* writeSearchAPDU PARAMS((SearchAPDU* query,char* buffer,long* len)); -char* readSearchAPDU PARAMS((SearchAPDU** query,char* buffer)); +void freeSearchAPDU _AP((SearchAPDU* query)); +char* writeSearchAPDU _AP((SearchAPDU* query,char* buffer,long* len)); +char* readSearchAPDU _AP((SearchAPDU** query,char* buffer)); -SearchResponseAPDU* makeSearchResponseAPDU PARAMS((long result,long count, +SearchResponseAPDU* makeSearchResponseAPDU _AP((long result,long count, long recordsReturned,long nextPos, long resultStatus,long presentStatus, any* refID,void* records)); -void freeSearchResponseAPDU PARAMS((SearchResponseAPDU* queryResponse)); -char* writeSearchResponseAPDU PARAMS((SearchResponseAPDU* queryResponse,char* buffer,long* len)); -char* readSearchResponseAPDU PARAMS((SearchResponseAPDU** queryResponse,char* buffer)); +void freeSearchResponseAPDU _AP((SearchResponseAPDU* queryResponse)); +char* writeSearchResponseAPDU _AP((SearchResponseAPDU* queryResponse,char* buffer,long* len)); +char* readSearchResponseAPDU _AP((SearchResponseAPDU** queryResponse,char* buffer)); -PresentAPDU* makePresentAPDU PARAMS((long recsReq, long startPos, +PresentAPDU* makePresentAPDU _AP((long recsReq, long startPos, char* resultID,any* refID,void* info)); -void freePresentAPDU PARAMS((PresentAPDU* present)); -char* writePresentAPDU PARAMS((PresentAPDU* present,char* buffer,long* len)); -char* readPresentAPDU PARAMS((PresentAPDU** present,char* buffer)); +void freePresentAPDU _AP((PresentAPDU* present)); +char* writePresentAPDU _AP((PresentAPDU* present,char* buffer,long* len)); +char* readPresentAPDU _AP((PresentAPDU** present,char* buffer)); -PresentResponseAPDU* makePresentResponseAPDU PARAMS((boolean status,long recsRet, +PresentResponseAPDU* makePresentResponseAPDU _AP((boolean status,long recsRet, long nextPos,any* refID, void* records)); -void freePresentResponseAPDU PARAMS((PresentResponseAPDU* present)); -char* writePresentResponseAPDU PARAMS((PresentResponseAPDU* present,char* buffer,long* len)); -char* readPresentResponseAPDU PARAMS((PresentResponseAPDU** present,char* buffer)); +void freePresentResponseAPDU _AP((PresentResponseAPDU* present)); +char* writePresentResponseAPDU _AP((PresentResponseAPDU* present,char* buffer,long* len)); +char* readPresentResponseAPDU _AP((PresentResponseAPDU** present,char* buffer)); /*----------------------------------------------------------------------*/ /* user extension hooks: */ -extern char* writeInitInfo PARAMS((InitAPDU* init,char* buffer,long* len)); -extern char* readInitInfo PARAMS((void** info,char* buffer)); +extern char* writeInitInfo _AP((InitAPDU* init,char* buffer,long* len)); +extern char* readInitInfo _AP((void** info,char* buffer)); -extern char* writeInitResponseInfo PARAMS((InitResponseAPDU* init,char* buffer,long* len)); -extern char* readInitResponseInfo PARAMS((void** info,char* buffer)); +extern char* writeInitResponseInfo _AP((InitResponseAPDU* init,char* buffer,long* len)); +extern char* readInitResponseInfo _AP((void** info,char* buffer)); -extern char* writeSearchInfo PARAMS((SearchAPDU* query,char* buffer,long* len)); -extern char* readSearchInfo PARAMS((void** info,char* buffer)); +extern char* writeSearchInfo _AP((SearchAPDU* query,char* buffer,long* len)); +extern char* readSearchInfo _AP((void** info,char* buffer)); -extern char* writeSearchResponseInfo PARAMS((SearchResponseAPDU* query,char* buffer,long* len)); -extern char* readSearchResponseInfo PARAMS((void** info,char* buffer)); +extern char* writeSearchResponseInfo _AP((SearchResponseAPDU* query,char* buffer,long* len)); +extern char* readSearchResponseInfo _AP((void** info,char* buffer)); -extern char* writePresentInfo PARAMS((PresentAPDU* present,char* buffer,long* len)); -extern char* readPresentInfo PARAMS((void** info,char* buffer)); +extern char* writePresentInfo _AP((PresentAPDU* present,char* buffer,long* len)); +extern char* readPresentInfo _AP((void** info,char* buffer)); -extern char* writePresentResponseInfo PARAMS((PresentResponseAPDU* present,char* buffer,long* len)); -extern char* readPresentResponseInfo PARAMS((void** info,char* buffer)); +extern char* writePresentResponseInfo _AP((PresentResponseAPDU* present,char* buffer,long* len)); +extern char* readPresentResponseInfo _AP((void** info,char* buffer)); #endif /* HTVMSWAIS_H */ diff --git a/WWW/Library/Implementation/HTWAIS.c b/WWW/Library/Implementation/HTWAIS.c index 81d7239a..627086ab 100644 --- a/WWW/Library/Implementation/HTWAIS.c +++ b/WWW/Library/Implementation/HTWAIS.c @@ -49,6 +49,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTParse.h> #include <HTAccess.h> /* We implement a protocol */ #include <HTML.h> /* The object we will generate */ @@ -77,6 +78,10 @@ */ #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + +extern int HTCheckForInterrupt NOPARAMS; + #define DIRECTORY "/cnidr.org:210/directory-of-servers" /* #define DIRECTORY "/quake.think.com:210/directory-of-servers" */ @@ -267,20 +272,22 @@ PRIVATE char * WWW_from_WAIS ARGS1( int i, l; if (TRACE) { char *p; - fprintf(tfp, "WAIS id (%d bytes) is ", (int)docid->size); + fprintf(stderr, "WAIS id (%d bytes) is ", (int)docid->size); for (p = docid->bytes; p < docid->bytes+docid->size; p++) { if ((*p >= ' ') && (*p<= '~')) /* Assume ASCII! */ - fprintf(tfp, "%c", *p); + fprintf(stderr, "%c", *p); else - fprintf(tfp, "<%x>", (unsigned)*p); + fprintf(stderr, "<%x>", (unsigned)*p); } - fprintf(tfp, "\n"); + fprintf(stderr, "\n"); } for (p = docid->bytes; (p < docid->bytes+docid->size) && (q < &buf[BIG]);) { - CTRACE(tfp, " Record type %d, length %d\n", p[0], p[1]); + if (TRACE) + fprintf(stderr, " Record type %d, length %d\n", p[0], p[1]); if (*p > 10) { - CTRACE(tfp, "Eh? DOCID record type of %d!\n", *p); + if (TRACE) + fprintf(stderr, "Eh? DOCID record type of %d!\n", *p); return 0; } { /* Bug fix -- allow any byte value 15 Apr 93 */ @@ -309,7 +316,8 @@ PRIVATE char * WWW_from_WAIS ARGS1( *q++= ';'; /* Terminate field */ } *q++ = 0; /* Terminate string */ - CTRACE(tfp, "WWW form of id: %s\n", buf); + if (TRACE) + fprintf(stderr, "WWW form of id: %s\n", buf); { char * result = (char *)malloc(strlen(buf)+1); if (!result) @@ -339,8 +347,8 @@ PRIVATE any * WAIS_from_WWW ARGS2( char *q; /* Poisition of "=" */ char *s; /* Position of semicolon */ int n; /* size */ - - CTRACE(tfp, "WWW id (to become WAIS id): %s\n", docname); + if (TRACE) + fprintf(stderr, "WWW id (to become WAIS id): %s\n", docname); for (n = 0, p = docname; *p; p++) { /* Count sizes of strings */ n++; if (*p == ';') @@ -396,14 +404,14 @@ PRIVATE any * WAIS_from_WWW ARGS2( if (TRACE) { char *p; - fprintf(tfp, "WAIS id (%d bytes) is ", (int)docid->size); + fprintf(stderr, "WAIS id (%d bytes) is ", (int)docid->size); for (p = docid->bytes; p < docid->bytes+docid->size; p++) { if ((*p >= ' ') && (*p<= '~')) /* Assume ASCII! */ - fprintf(tfp, "%c", *p); + fprintf(stderr, "%c", *p); else - fprintf(tfp, "<%x>", (unsigned)*p); + fprintf(stderr, "<%x>", (unsigned)*p); } - fprintf(tfp, "\n"); + fprintf(stderr, "\n"); } return docid; /* Ok */ @@ -465,7 +473,8 @@ PRIVATE void display_search_response ARGS4( BOOL archie = strstr(database, "archie")!=0; /* Specical handling */ - CTRACE(tfp, "HTWAIS: Displaying search response\n"); + if (TRACE) + fprintf(stderr, "HTWAIS: Displaying search response\n"); PUTS("Index "); START(HTML_EM); PUTS(database); @@ -503,7 +512,9 @@ PRIVATE void display_search_response ARGS4( /* ** Make a printable string out of the document id. */ - CTRACE(tfp, "HTWAIS: %2ld: Score: %4ld, lines:%4ld '%s'\n", + if (TRACE) + fprintf(stderr, + "HTWAIS: %2ld: Score: %4ld, lines:%4ld '%s'\n", i, (long int)(info->DocHeaders[k]->Score), (long int)(info->DocHeaders[k]->Lines), @@ -695,7 +706,8 @@ PUBLIC int HTLoadWAIS ARGS4( if (!ok) return HTLoadError(sink, 500, "Syntax error in WAIS URL"); - CTRACE(tfp, "HTWAIS: Parsed OK\n"); + if (TRACE) + fprintf(stderr, "HTWAIS: Parsed OK\n"); service = strchr(names, ':'); if (service) @@ -712,16 +724,19 @@ PUBLIC int HTLoadWAIS ARGS4( } else if (!(key && !*key)) { int status; - CTRACE (tfp, "===WAIS=== calling mosaic_connect_to_server\n"); + if (TRACE) + fprintf (stderr, "===WAIS=== calling mosaic_connect_to_server\n"); status = mosaic_connect_to_server(server_name, atoi(service), &connection); if (status == 0) { - CTRACE (tfp, "===WAIS=== connection failed\n"); + if (TRACE) + fprintf (stderr, "===WAIS=== connection failed\n"); FREE(names); return HT_NOT_LOADED; } else if (status == -1) { - CTRACE (tfp, "===WAIS=== connection interrupted\n"); + if (TRACE) + fprintf (stderr, "===WAIS=== connection interrupted\n"); FREE(names); return HT_NOT_LOADED; } @@ -794,9 +809,10 @@ PUBLIC int HTLoadWAIS ARGS4( server_name, service, www_database); fp = fopen(filename, "r"); /* Have we found this already? */ - CTRACE(tfp, "HTWAIS: Description of server %s %s.\n", - filename, - fp ? "exists already" : "does NOT exist!"); + if (TRACE) fprintf(stderr, + "HTWAIS: Description of server %s %s.\n", + filename, + fp ? "exists already" : "does NOT exist!"); if (fp) { char c; @@ -805,7 +821,6 @@ PUBLIC int HTLoadWAIS ARGS4( while((c=getc(fp))!=EOF) PUTC(c); /* Transfer file */ END(HTML_PRE); fclose(fp); - } #endif START(HTML_P); PUTS("\nEnter the 's'earch command and then specify search words.\n"); @@ -850,8 +865,8 @@ PUBLIC int HTLoadWAIS ARGS4( PUTS("\n"); request_buffer_length = MAX_MESSAGE_LEN; /* Amount left */ - CTRACE(tfp, "HTWAIS: Search for `%s' in `%s'\n", - keywords, wais_database); + if (TRACE) fprintf(stderr, "HTWAIS: Search for `%s' in `%s'\n", + keywords, wais_database); if(NULL == generate_search_apdu(request_message + HEADER_LENGTH, &request_buffer_length, @@ -909,8 +924,9 @@ PUBLIC int HTLoadWAIS ARGS4( any doc_chunk; any * docid = &doc_chunk; - CTRACE(tfp, "HTWAIS: Retrieve document id `%s' type `%s' length %ld\n", - docname, doctype, document_length); + if (TRACE) fprintf(stderr, + "HTWAIS: Retrieve document id `%s' type `%s' length %ld\n", + docname, doctype, document_length); format_in = !strcmp(doctype, "WSRC") ? HTAtom_for("application/x-wais-source") : @@ -946,7 +962,8 @@ PUBLIC int HTLoadWAIS ARGS4( char *type = s_strdup(doctype); /* Gets freed I guess */ #endif /* VMS */ request_buffer_length = MAX_MESSAGE_LEN; /* Amount left */ - CTRACE(tfp, "HTWAIS: Slice number %ld\n", count); + if (TRACE) + fprintf(stderr, "HTWAIS: Slice number %ld\n", count); if (HTCheckForInterrupt()) { HTAlert ("Data transfer interrupted."); diff --git a/WWW/Library/Implementation/HTWAIS.h b/WWW/Library/Implementation/HTWAIS.h index e8a6b7f2..fe203ef9 100644 --- a/WWW/Library/Implementation/HTWAIS.h +++ b/WWW/Library/Implementation/HTWAIS.h @@ -25,6 +25,9 @@ #ifndef HTWAIS_H #define HTWAIS_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTAccess.h> #ifdef GLOBALREF_IS_MACRO diff --git a/WWW/Library/Implementation/HTWSRC.c b/WWW/Library/Implementation/HTWSRC.c index 8b764a73..baf759c9 100644 --- a/WWW/Library/Implementation/HTWSRC.c +++ b/WWW/Library/Implementation/HTWSRC.c @@ -9,6 +9,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTWSRC.h> @@ -18,6 +19,8 @@ #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + #define BIG 10000 /* Arbitrary limit to value length */ #define PARAM_MAX BIG #define CACHE_PERIOD (7*86400) /* Time to keep .src file in seconds */ @@ -159,8 +162,9 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c) } } if (!par_name[me->param_number]) { /* Unknown field */ - CTRACE(tfp, "HTWSRC: Unknown field `%s' in source file\n", - me->param); + if (TRACE) fprintf(stderr, + "HTWSRC: Unknown field `%s' in source file\n", + me->param); me->param_number = PAR_UNKNOWN; me->state = before_value; /* Could be better ignore */ return; diff --git a/WWW/Library/Implementation/HTWSRC.h b/WWW/Library/Implementation/HTWSRC.h index 62617022..cde25467 100644 --- a/WWW/Library/Implementation/HTWSRC.h +++ b/WWW/Library/Implementation/HTWSRC.h @@ -11,6 +11,10 @@ #ifndef HTWSRC_H #define HTWSRC_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ + #include <HTFormat.h> extern char from_hex PARAMS((char c)); diff --git a/WWW/Library/Implementation/HTWriter.c b/WWW/Library/Implementation/HTWriter.c index c4dba35b..601bdb0a 100644 --- a/WWW/Library/Implementation/HTWriter.c +++ b/WWW/Library/Implementation/HTWriter.c @@ -2,15 +2,19 @@ ** =========== ** */ - #include <HTUtils.h> +#include <tcp.h> #include <HTWriter.h> #define BUFFER_SIZE 4096 /* Tradeoff */ +/*#include <stdio.h> included by HTUtils.h -- FM */ + #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* HTML Object ** ----------- */ @@ -48,7 +52,8 @@ PRIVATE void flush ARGS1(HTStream *, me) status = NETWRITE(me->soc, me->buffer, /* Put timeout? @@@ */ write_pointer - read_pointer); if (status<0) { - CTRACE(tfp, "HTWrite: Error: write() on socket returns %d !!!\n", status); + if(TRACE) fprintf(stderr, + "HTWrite: Error: write() on socket returns %d !!!\n", status); return; } read_pointer = read_pointer + status; @@ -103,7 +108,8 @@ PRIVATE void HTWriter_write ARGS3(HTStream *, me, CONST char*, s, int, l) int status = NETWRITE(me->soc, (char *)read_pointer, write_pointer - read_pointer); if (status<0) { - CTRACE(tfp, "HTWriter_write: Error on socket output stream!!!\n"); + if(TRACE) fprintf(stderr, + "HTWriter_write: Error on socket output stream!!!\n"); return; } read_pointer = read_pointer + status; diff --git a/WWW/Library/Implementation/LYLeaks.h b/WWW/Library/Implementation/LYLeaks.h index 19fc69f4..91bfbaac 100644 --- a/WWW/Library/Implementation/LYLeaks.h +++ b/WWW/Library/Implementation/LYLeaks.h @@ -41,6 +41,7 @@ /* ** Required includes */ +#include <stdlib.h> #include <HTUtils.h> /* diff --git a/WWW/Library/Implementation/LYexit.h b/WWW/Library/Implementation/LYexit.h index f53561a4..93bc8070 100644 --- a/WWW/Library/Implementation/LYexit.h +++ b/WWW/Library/Implementation/LYexit.h @@ -19,6 +19,7 @@ /* * Required includes */ +#include <stdlib.h> #include <HTUtils.h> /* diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index 7f6324a0..91c1b00d 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -4,12 +4,13 @@ ** This module implements an HTStream object. To parse an ** SGML file, create this object which is a parser. The object ** is (currently) created by being passed a DTD structure, -** and a target HTStructured object at which to throw the parsed stuff. +** and a target HTStructured oject at which to throw the parsed stuff. ** -** 6 Feb 93 Binary searches used. Interface modified. +** 6 Feb 93 Binary seraches used. Intreface modified. */ #include <HTUtils.h> +#include <tcp.h> /* For FROMASCII */ /* Remove the following to disable the experimental HTML DTD parsing. Currently only used in this source file. - kw */ @@ -25,21 +26,24 @@ #include <UCDefs.h> #include <UCAux.h> +#include <ctype.h> +/*#include <stdio.h> included in HTUtils.h -- FM */ #include <HTChunk.h> #include <LYCharSets.h> -#include <LYStrings.h> #include <LYLeaks.h> #define INVALID (-1) +#define FREE(x) if (x) {free(x); x = NULL;} + PUBLIC HTCJKlang HTCJK = NOCJK; /* CJK enum value. */ PUBLIC BOOL HTPassEightBitRaw = FALSE; /* Pass 161-172,174-255 raw. */ PUBLIC BOOL HTPassEightBitNum = FALSE; /* Pass ^ numeric entities raw. */ PUBLIC BOOL HTPassHighCtrlRaw = FALSE; /* Pass 127-160,173, raw. */ PUBLIC BOOL HTPassHighCtrlNum = FALSE; /* Pass €-Ÿ raw. */ -/* extern int LYlowest_eightbit[]; for completeness here */ +extern int LYlowest_eightbit[]; /* The State (context) of the parser ** @@ -52,7 +56,7 @@ PUBLIC BOOL HTPassHighCtrlNum = FALSE; /* Pass €-Ÿ raw. */ /* Element Stack ** ------------- -** This allows us to return down the stack reselecting styles. +** This allows us to return down the stack reselcting styles. ** As we return, attribute values will be garbage in general. */ typedef struct _HTElement HTElement; @@ -70,7 +74,7 @@ struct _HTStream { CONST HTStreamClass * isa; /* inherited from HTStream */ CONST SGML_dtd *dtd; - CONST HTStructuredClass *actions; /* target class */ + HTStructuredClass *actions; /* target class */ HTStructured *target; /* target object */ HTTag *current_tag; @@ -196,7 +200,7 @@ PRIVATE void set_chartrans_handling ARGS3( context->T.trans_from_uni) { context->current_tag_charset = UCGetLYhndl_byMIME("utf-8"); } else { - context->current_tag_charset = LATIN1; + context->current_tag_charset = 0; } } @@ -278,15 +282,17 @@ PRIVATE void handle_attribute_name ARGS2( FREE(context->value[i]); #ifdef USE_COLOR_STYLE current_is_class=(!strcasecomp("class", s)); - CTRACE(tfp, "SGML: found attribute %s, %d\n", s, current_is_class); + if (TRACE) + fprintf(stderr, "SGML: found attribute %s, %d\n", s, current_is_class); #endif return; } /* if */ } /* for */ - CTRACE(tfp, "SGML: Unknown attribute %s for tag %s\n", - s, context->current_tag->name); + if (TRACE) + fprintf(stderr, "SGML: Unknown attribute %s for tag %s\n", + s, context->current_tag->name); context->current_attribute_number = INVALID; /* Invalid */ } @@ -304,15 +310,18 @@ PRIVATE void handle_attribute_value ARGS2( if (current_is_class) { strncpy (class_string, s, TEMPSTRINGSIZE); - CTRACE(tfp, "SGML: class is '%s'\n", s); + if (TRACE) + fprintf(stderr, "SGML: class is '%s'\n", s); } else { - CTRACE(tfp, "SGML: attribute value is '%s'\n", s); + if (TRACE) + fprintf(stderr, "SGML: attribute value is '%s'\n", s); } #endif } else { - CTRACE(tfp, "SGML: Attribute value %s ignored\n", s); + if (TRACE) + fprintf(stderr, "SGML: Attribute value %s ignored\n", s); } context->current_attribute_number = INVALID; /* can't have two assignments! */ } @@ -322,10 +331,9 @@ PRIVATE void handle_attribute_value ARGS2( ** Translate some Unicodes to Lynx special codes and output them. ** Special codes - ones those output depend on parsing. ** -** Additional issue, like handling bidirectional text if necessary +** Additional issue, like handling bidirectional text if nesseccery ** may be called from here: zwnj (8204), zwj (8205), lrm (8206), rlm (8207) -** - currently they are ignored in SGML.c and LYCharUtils.c -** but also in UCdomap.c because they are non printable... +** - currently they are passed to def7_uni.tbl as regular characters. ** */ PRIVATE BOOL put_special_unicodes ARGS2( @@ -353,7 +361,10 @@ PRIVATE BOOL put_special_unicodes ARGS2( ** in the context of line wrapping. Unfortunately, if we use ** HT_EM_SPACE we override the chartrans tables for those spaces ** (e.g., emsp= double space) with a single '32' for all (but do line - ** wrapping more fancy). So we probably need HT_EN_SPACE etc... + ** wrapping more fancy). In the future we need HT_SPACE with a + ** transferred parameter (Unicode number) which falls back to + ** chartrans if line wrapping is not the case. + ** */ PUTC(HT_EM_SPACE); #ifdef NOTUSED_FOTEMODS @@ -392,6 +403,11 @@ PRIVATE BOOL put_special_unicodes ARGS2( PRIVATE char replace_buf [64]; /* buffer for replacement strings */ PRIVATE BOOL FoundEntity = FALSE; +#define IncludesLatin1Enc \ + (context->outUCLYhndl == 0 || \ + (context->outUCI && \ + (context->outUCI->enc & (UCT_CP_SUPERSETOF_LAT1)))) + PRIVATE void handle_entity ARGS2( HTStream *, context, char, term) @@ -400,6 +416,9 @@ PRIVATE void handle_entity ARGS2( long uck; CONST char *p; CONST char *s = context->string->data; +#ifdef NOTUSED_FOTEMODS + int high, low, i, diff; +#endif /* @@ -453,32 +472,89 @@ PRIVATE void handle_entity ARGS2( FoundEntity = TRUE; return; } +#ifdef NOTUSED_FOTEMODS /* - ** Ignore zwnj (8204) and zwj (8205), if we get to here. - ** Note that zwnj may have been handled as <WBR> - ** by the calling function. - FM + ** If the value is greater than 255 and we do not + ** have the "7-bit approximations" as our output + ** character set (in which case we did it already) + ** seek a translation for that. - FM */ - if (!strcmp(s, "zwnj") || - !strcmp(s, "zwj")) { - CTRACE(tfp, "handle_entity: Ignoring '%s'.\n", s); + if ((chk = ((code > 255) && + context->outUCLYhndl != + UCGetLYhndl_byMIME("us-ascii"))) && + (uck = UCTransUniChar(code, + UCGetLYhndl_byMIME("us-ascii")))>= 32 && + uck < 127) { + /* + ** Got an ASCII character (yippey). - FM + */ + PUTC(((char)(uck & 0xff))); + FoundEntity = TRUE; + return; + } else if ((chk && uck == -4) && + (uck = UCTransUniCharStr(replace_buf, + 60, code, + UCGetLYhndl_byMIME("us-ascii"), + 0) >= 0)) { + /* + ** Got a replacement string (yippey). - FM + */ + for (p = replace_buf; *p; p++) + PUTC(*p); FoundEntity = TRUE; return; } - /* - ** Ignore lrm (8206), and rln (8207), if we get to here. - FM - */ - if (!strcmp(s, "lrm") || - !strcmp(s, "rlm")) { - CTRACE(tfp, "handle_entity: Ignoring '%s'.\n", s); + } + /* + ** Ignore zwnj (8204) and zwj (8205), if we get to here. + ** Note that zwnj may have been handled as <WBR> + ** by the calling function. - FM + */ + if (!strcmp(s, "zwnj") || + !strcmp(s, "zwj")) { + if (TRACE) { + fprintf(stderr, "handle_entity: Ignoring '%s'.\n", s); + } + FoundEntity = TRUE; + return; + } + + /* + ** Ignore lrm (8206), and rln (8207), if we get to here. - FM + */ + if (!strcmp(s, "lrm") || + !strcmp(s, "rlm")) { + if (TRACE) { + fprintf(stderr, "handle_entity: Ignoring '%s'.\n", s); + } + FoundEntity = TRUE; + return; + } + + /* + ** We haven't succeeded yet, so try the old LYCharSets + ** arrays for translation strings. - FM + */ + for (low = 0, high = context->dtd->number_of_entities; + high > low; + diff < 0 ? (low = i+1) : (high = i)) { /* Binary search */ + i = (low + (high-low)/2); + diff = strcmp(entities[i], s); /* Case sensitive! */ + if (diff == 0) { /* success: found it */ + for (p = LYCharSets[context->outUCLYhndl][i]; *p; p++) { + PUTC(*p); + } FoundEntity = TRUE; return; } +#endif } /* ** If entity string not found, display as text. */ - CTRACE(tfp, "SGML: Unknown entity '%s'\n", s); + if (TRACE) + fprintf(stderr, "SGML: Unknown entity '%s'\n", s); PUTC('&'); for (p = s; *p; p++) { PUTC(*p); @@ -496,7 +572,8 @@ PRIVATE void handle_comment ARGS1( { CONST char *s = context->string->data; - CTRACE(tfp, "SGML Comment:\n<%s>\n", s); + if (TRACE) + fprintf(stderr, "SGML Comment:\n<%s>\n", s); if (context->csi == NULL && strncmp(s, "!--#", 4) == 0 && @@ -516,7 +593,8 @@ PRIVATE void handle_identifier ARGS1( { CONST char *s = context->string->data; - CTRACE(tfp, "SGML Identifier\n<%s>\n", s); + if (TRACE) + fprintf(stderr, "SGML Identifier\n<%s>\n", s); return; } @@ -530,7 +608,8 @@ PRIVATE void handle_doctype ARGS1( { CONST char *s = context->string->data; - CTRACE(tfp, "SGML Doctype\n<%s>\n", s); + if (TRACE) + fprintf(stderr, "SGML Doctype\n<%s>\n", s); return; } @@ -544,7 +623,8 @@ PRIVATE void handle_marked ARGS1( { CONST char *s = context->string->data; - CTRACE(tfp, "SGML Marked Section:\n<%s>\n", s); + if (TRACE) + fprintf(stderr, "SGML Marked Section:\n<%s>\n", s); return; } @@ -558,7 +638,8 @@ PRIVATE void handle_sgmlent ARGS1( { CONST char *s = context->string->data; - CTRACE(tfp, "SGML Entity Declaration:\n<%s>\n", s); + if (TRACE) + fprintf(stderr, "SGML Entity Declaration:\n<%s>\n", s); return; } @@ -572,7 +653,8 @@ PRIVATE void handle_sgmlele ARGS1( { CONST char *s = context->string->data; - CTRACE(tfp, "SGML Element Declaration:\n<%s>\n", s); + if (TRACE) + fprintf(stderr, "SGML Element Declaration:\n<%s>\n", s); return; } @@ -586,7 +668,8 @@ PRIVATE void handle_sgmlatt ARGS1( { CONST char *s = context->string->data; - CTRACE(tfp, "SGML Attribute Declaration:\n<%s>\n", s); + if (TRACE) + fprintf(stderr, "SGML Attribute Declaration:\n<%s>\n", s); return; } @@ -633,7 +716,6 @@ PRIVATE canclose_t can_close ARGS2( return ((stacked_tag->tagclass & new_tag->canclose) ? close_error : close_NO); } - PRIVATE void do_close_stacked ARGS1( HTStream *, context) { @@ -650,7 +732,6 @@ PRIVATE void do_close_stacked ARGS1( context->element_stack = stacked->next; FREE(stacked); } - PRIVATE int is_on_stack ARGS2( HTStream *, context, HTTag *, old_tag) @@ -684,7 +765,8 @@ PRIVATE void end_element ARGS2( (stackpos > 1 || (!extra_action_taken && stackpos == 0))) { canclose_check = can_close(old_tag, context->element_stack->tag); if (canclose_check != close_NO) { - CTRACE(tfp, "SGML: End </%s> \t<- %s end </%s>\n", + if (TRACE) + fprintf(stderr, "SGML: End </%s> \t<- %s end </%s>\n", context->element_stack->tag->name, canclose_check == close_valid ? "supplied," : "forced by", old_tag->name); @@ -692,7 +774,8 @@ PRIVATE void end_element ARGS2( extra_action_taken = YES; stackpos = is_on_stack(context, old_tag); } else { - CTRACE(tfp, "SGML: Still open %s \t<- invalid end </%s>\n", + if (TRACE) + fprintf(stderr, "SGML: Still open %s \t<- invalid end </%s>\n", context->element_stack->tag->name, old_tag->name); return; @@ -700,7 +783,8 @@ PRIVATE void end_element ARGS2( } if (stackpos == 0 && old_tag->contents != SGML_EMPTY) { - CTRACE(tfp, "SGML: Still open %s, no open %s for </%s>\n", + if (TRACE) + fprintf(stderr, "SGML: Still open %s, no open %s for </%s>\n", context->element_stack ? context->element_stack->tag->name : "none", old_tag->name, @@ -708,7 +792,8 @@ PRIVATE void end_element ARGS2( return; } if (stackpos > 1) { - CTRACE(tfp, "SGML: Nesting <%s>...<%s> \t<- invalid end </%s>\n", + if (TRACE) + fprintf(stderr, "SGML: Nesting <%s>...<%s> \t<- invalid end </%s>\n", old_tag->name, context->element_stack->tag->name, old_tag->name); @@ -733,36 +818,42 @@ PRIVATE void end_element ARGS2( /* ** Ignore the end tag. - FM */ - CTRACE(tfp, "SGML: Ignoring end tag </%s> in SELECT block.\n", + if (TRACE) { + fprintf(stderr, + "SGML: Ignoring end tag </%s> in SELECT block.\n", old_tag->name); + } return; } } /* ** Handle the end tag. - FM */ - CTRACE(tfp, "SGML: End </%s>\n", old_tag->name); + if (TRACE) + fprintf(stderr, "SGML: End </%s>\n", old_tag->name); if (old_tag->contents == SGML_EMPTY) { - CTRACE(tfp, "SGML: Illegal end tag </%s> found.\n", - old_tag->name); + if (TRACE) + fprintf(stderr, "SGML: Illegal end tag </%s> found.\n", + old_tag->name); return; } #ifdef WIND_DOWN_STACK - while (context->element_stack) /* Loop is error path only */ + while (context->element_stack) { /* Loop is error path only */ #else - if (context->element_stack) /* Substitute and remove one stack element */ + if (context->element_stack) { /* Substitute and remove one stack element */ #endif /* WIND_DOWN_STACK */ - { HTElement * N = context->element_stack; HTTag * t = N->tag; if (old_tag != t) { /* Mismatch: syntax error */ if (context->element_stack->next) { /* This is not the last level */ - CTRACE(tfp, "SGML: Found </%s> when expecting </%s>. </%s> assumed.\n", - old_tag->name, t->name, t->name); + if (TRACE) fprintf(stderr, + "SGML: Found </%s> when expecting </%s>. </%s> assumed.\n", + old_tag->name, t->name, t->name); } else { /* last level */ - CTRACE(tfp, "SGML: Found </%s> when expecting </%s>. </%s> Ignored.\n", - old_tag->name, t->name, old_tag->name); + if (TRACE) fprintf(stderr, + "SGML: Found </%s> when expecting </%s>. </%s> Ignored.\n", + old_tag->name, t->name, old_tag->name); return; /* Ignore */ } } @@ -781,8 +872,9 @@ PRIVATE void end_element ARGS2( /* Syntax error path only */ } - CTRACE(tfp, "SGML: Extra end tag </%s> found and ignored.\n", - old_tag->name); + if (TRACE) + fprintf(stderr, "SGML: Extra end tag </%s> found and ignored.\n", + old_tag->name); } @@ -809,7 +901,8 @@ PRIVATE void start_element ARGS1( direct_container))) { canclose_check = can_close(new_tag, context->element_stack->tag); if (canclose_check != close_NO) { - CTRACE(tfp, "SGML: End </%s> \t<- %s start <%s>\n", + if (TRACE) + fprintf(stderr, "SGML: End </%s> \t<- %s start <%s>\n", context->element_stack->tag->name, canclose_check == close_valid ? "supplied," : "forced by", new_tag->name); @@ -818,7 +911,8 @@ PRIVATE void start_element ARGS1( if (canclose_check == close_error) direct_container = NO; } else { - CTRACE(tfp, "SGML: Still open %s \t<- invalid start <%s>\n", + if (TRACE) + fprintf(stderr, "SGML: Still open %s \t<- invalid start <%s>\n", context->element_stack->tag->name, new_tag->name); } @@ -827,7 +921,8 @@ PRIVATE void start_element ARGS1( (context->element_stack->tag->flags & Tgf_strict) && !(valid = element_valid_within(new_tag, context->element_stack->tag, direct_container))) { - CTRACE(tfp, "SGML: Still open %s \t<- ignoring start <%s>\n", + if (TRACE) + fprintf(stderr, "SGML: Still open %s \t<- ignoring start <%s>\n", context->element_stack->tag->name, new_tag->name); return; @@ -840,7 +935,8 @@ PRIVATE void start_element ARGS1( for (; i< new_tag->number_of_attributes && !has_attributes; i++) has_attributes = context->present[i]; if (!has_attributes) { - CTRACE(tfp, "SGML: Still open %s, converting invalid <%s> to </%s>\n", + if (TRACE) + fprintf(stderr, "SGML: Still open %s, converting invalid <%s> to </%s>\n", context->element_stack->tag->name, new_tag->name, new_tag->name); @@ -855,7 +951,8 @@ PRIVATE void start_element ARGS1( new_tag, context->element_stack->tag, direct_container))) { - CTRACE(tfp, "SGML: Still open %s \t<- invalid start <%s>\n", + if (TRACE) + fprintf(stderr, "SGML: Still open %s \t<- invalid start <%s>\n", context->element_stack->tag->name, new_tag->name); } @@ -901,14 +998,18 @@ PRIVATE void start_element ARGS1( ** It is another form-related start tag, so terminate ** the current SELECT block and fall through. - FM */ - CTRACE(tfp, "SGML: Faking SELECT end tag before <%s> start tag.\n", + if (TRACE) + fprintf(stderr, + "SGML: Faking SELECT end tag before <%s> start tag.\n", new_tag->name); end_element(context, SGMLFindTag(context->dtd, "SELECT")); } else { /* ** Ignore the start tag. - FM */ - CTRACE(tfp, "SGML: Ignoring start tag <%s> in SELECT block.\n", + if (TRACE) + fprintf(stderr, + "SGML: Ignoring start tag <%s> in SELECT block.\n", new_tag->name); return; } @@ -917,7 +1018,8 @@ PRIVATE void start_element ARGS1( /* ** Handle the start tag. - FM */ - CTRACE(tfp, "SGML: Start <%s>\n", new_tag->name); + if (TRACE) + fprintf(stderr, "SGML: Start <%s>\n", new_tag->name); (*context->actions->start_element)( context->target, new_tag - context->dtd->tags, @@ -945,7 +1047,7 @@ PRIVATE void start_element ARGS1( ** ------------------------ ** ** On entry, -** dtd points to dtd structure including valid tag list +** dtd points to dtd structire including valid tag list ** string points to name of tag in question ** ** On exit, @@ -971,7 +1073,7 @@ PUBLIC HTTag * SGMLFindTag ARGS2( /* ** Unrecognized, but may be valid. - KW */ - return &HTTag_unrecognized; + return (HTTag *)&HTTag_unrecognized; } return NULL; } @@ -1097,7 +1199,7 @@ PRIVATE void SGML_character ARGS2( CONST char * EntityName; char * p; BOOLEAN chk; /* Helps (?) walk through all the else ifs... */ - UCode_t clong, uck = 0; /* Enough bits for UCS4 ... */ + UCode_t clong, uck; /* Enough bits for UCS4 ... */ char c; char saved_char_in = '\0'; @@ -1206,7 +1308,7 @@ PRIVATE void SGML_character ARGS2( ** to Unicode, try that now. - FM */ if (context->T.trans_to_uni && - ((unsign_c >= LYlowest_eightbit[context->inUCLYhndl]) || + ((unsign_c >= 127) || (unsign_c < 32 && unsign_c != 0 && context->T.trans_C0_to_uni))) { /* @@ -1301,7 +1403,7 @@ top0a: ** which unsign_c has been defined), and from below ** when we are recycling a character (e.g., because ** it terminated an entity but is not the standard -** semi-colon). The character will already have +** semi-colon). The chararcter will already have ** been put through the Unicode conversions. - FM */ top1: @@ -1431,8 +1533,11 @@ top1: (uck = UCTransUniChar(unsign_c, context->outUCLYhndl)) >= 32 && uck < 256) { - CTRACE(tfp, "UCTransUniChar returned 0x%.2lX:'%c'.\n", + if (TRACE) { + fprintf(stderr, + "UCTransUniChar returned 0x%.2lX:'%c'.\n", uck, FROMASCII((char)uck)); + } /* ** We got one octet from the conversions, so use it. - FM */ @@ -1449,7 +1554,7 @@ top1: 0) >= 0)) { /* ** Got a replacement string. - ** No further tests for validity - assume that whoever + ** No further tests for valididy - assume that whoever ** defined replacement strings knew what she was doing. - KW */ for (p = replace_buf; *p; p++) @@ -1460,19 +1565,13 @@ top1: } else if (context->T.output_utf8 && PUTUTF8(clong)) { ; /* do nothing more */ /* - ** If it's any other (> 160) 8-bit character, and + ** If it's any other (> 160) 8-bit chararcter, and ** we have not set HTPassEightBitRaw nor HTCJK, nor ** have the "ISO Latin 1" character set selected, ** back translate for our character set. - FM */ -#define IncludesLatin1Enc \ - (context->outUCLYhndl == LATIN1 || \ - (context->outUCI && \ - (context->outUCI->enc & (UCT_CP_SUPERSETOF_LAT1)))) - #define PASSHI8BIT (HTPassEightBitRaw || \ (context->T.do_8bitraw && !context->T.trans_from_uni)) - } else if (unsign_c > 160 && unsign_c < 256 && !(PASSHI8BIT || HTCJK != NOCJK) && !IncludesLatin1Enc) { @@ -1553,16 +1652,14 @@ top1: for (p = replace_buf; *p; p++) PUTC(*p); } else { -#endif /* NOTUSED_FOTEMODS */ /* ** Out of luck, so use the UHHH notation (ugh). - FM */ - /* do not print UHHH for now +#endif /* NOTUSED_FOTEMODS */ sprintf(replace_buf, "U%.2lX", unsign_c); for (p = replace_buf; *p; p++) { PUTC(*p); } - */ #ifdef NOTUSED_FOTEMODS } #endif /* NOTUSED_FOTEMODS */ @@ -1652,8 +1749,10 @@ top1: */ char temp[8]; - CTRACE(tfp, "SGML_character: Handling 'zwnj' entity as 'WBR' element.\n"); - + if (TRACE) { + fprintf(stderr, + "SGML_character: Handling 'zwnj' entity as 'WBR' element.\n"); + } if (c != ';') { sprintf(temp, "<WBR>%c", c); } else { @@ -1742,7 +1841,7 @@ top1: if ((context->isHex ? sscanf(string->data, "%lx", &code) : sscanf(string->data, "%ld", &code)) == 1) { if ((code == 1) || - (code > 127 && code < 156)) { + (code > 129 && code < 156)) { /* ** Assume these are Microsoft code points, ** inflicted on us by FrontPage. - FM @@ -1758,12 +1857,6 @@ top1: */ code = 0x263a; break; - case 128: - /* - ** EURO currency sign - */ - code = 0x20ac; - break; case 130: /* ** SINGLE LOW-9 QUOTATION MARK (sbquo) @@ -1888,8 +1981,10 @@ top1: */ char temp[8]; - CTRACE(tfp, "SGML_character: Handling '8204' (zwnj) reference as 'WBR' element.\n"); - + if (TRACE) { + fprintf(stderr, + "SGML_character: Handling '8204' (zwnj) reference as 'WBR' element.\n"); + } /* ** Include the terminator if it is not ** the standard semi-colon. - FM @@ -1978,7 +2073,6 @@ top1: */ for (p = replace_buf; *p; p++) PUTC(*p); -#endif /* NOTUSED_FOTEMODS */ /* ** Ignore 8205 (zwj), ** 8206 (lrm), and 8207 (rln), if we get to here. - FM @@ -1991,7 +2085,7 @@ top1: LYstrncpy(replace_buf, string->data, (string->size < 64 ? string->size : 63)); - fprintf(tfp, + fprintf(stderr, "SGML_character: Ignoring '%s%s'.\n", (context->isHex ? "&#x" : "&#"), replace_buf); @@ -2002,6 +2096,7 @@ top1: if (c != ';') goto top1; break; +#endif /* NOTUSED_FOTEMODS */ /* ** Show the numeric entity if we get to here ** and the value: @@ -2171,8 +2266,9 @@ top1: */ HTTag * t; if (c == '/') { - if (string->size != 0) - CTRACE(tfp,"SGML: `<%s/' found!\n", string->data); + if (TRACE) + if (string->size!=0) + fprintf(stderr,"SGML: `<%s/' found!\n", string->data); context->state = S_end; break; } @@ -2190,18 +2286,21 @@ top1: for (i = 0; i < 3; i++) /* recover */ PUTC(string->data[i]); PUTC(c); - CTRACE(tfp, "SGML: Treating <%s%c as text\n", + if (TRACE) + fprintf(stderr, "SGML: Treating <%s%c as text\n", string->data, c); string->size = 0; context->state = S_text; break; } else if (!t) { - CTRACE(tfp, "SGML: *** Invalid element %s\n", + if (TRACE) + fprintf(stderr, "SGML: *** Invalid element %s\n", string->data); context->state = (c == '>') ? S_text : S_junk_tag; break; } else if (t == context->unknown_tag) { - CTRACE(tfp, "SGML: *** Unknown element %s\n", + if (TRACE) + fprintf(stderr, "SGML: *** Unknown element %s\n", string->data); /* ** Fall through and treat like valid @@ -2556,7 +2655,8 @@ top1: if (WHITE(c)) break; /* Before attribute value */ if (c == '>') { /* End of tag */ - CTRACE(tfp, "SGML: found = but no value\n"); + if (TRACE) + fprintf(stderr, "SGML: found = but no value\n"); if (context->current_tag->name) start_element(context); context->state = S_text; @@ -2702,7 +2802,8 @@ top1: t = SGMLFindTag(dtd, string->data); } if (!t || t == context->unknown_tag) { - CTRACE(tfp, "Unknown end tag </%s>\n", string->data); + if (TRACE) + fprintf(stderr, "Unknown end tag </%s>\n", string->data); } else { BOOL tag_OK = (c == '>' || WHITE(c)); context->current_tag = t; @@ -2730,7 +2831,9 @@ top1: ** Don't treat these end tags as invalid, ** nor act on them. - FM */ - CTRACE(tfp, "SGML: `</%s%c' found! Ignoring it.\n", + if (TRACE) + fprintf(stderr, + "SGML: `</%s%c' found! Ignoring it.\n", string->data, c); string->size = 0; context->current_attribute_number = INVALID; @@ -2768,19 +2871,27 @@ top1: /* ** It is not at FORM end tag, so ignore it. - FM */ - CTRACE(tfp, "SGML: Ignoring end tag </%s> in SELECT block.\n", + if (TRACE) { + fprintf(stderr, + "SGML: Ignoring end tag </%s> in SELECT block.\n", string->data); + } } else { /* ** End the SELECT block and then ** handle the FORM end tag. - FM */ - CTRACE(tfp, "SGML: Faking SELECT end tag before </%s> end tag.\n", + if (TRACE) { + fprintf(stderr, + "SGML: Faking SELECT end tag before </%s> end tag.\n", string->data); + } end_element(context, SGMLFindTag(context->dtd, "SELECT")); - CTRACE(tfp, "SGML: End </%s>\n", string->data); - + if (TRACE) { + fprintf(stderr, + "SGML: End </%s>\n", string->data); + } (*context->actions->end_element) (context->target, (context->current_tag - context->dtd->tags), @@ -2791,7 +2902,9 @@ top1: ** Treat a P end tag like a P start tag (Ugh, ** what a hack! 8-). - FM */ - CTRACE(tfp, "SGML: `</%s%c' found! Treating as '<%s%c'.\n", + if (TRACE) + fprintf(stderr, + "SGML: `</%s%c' found! Treating as '<%s%c'.\n", string->data, c, string->data, c); { int i; @@ -2804,8 +2917,10 @@ top1: if (context->current_tag->name) start_element(context); } else { - CTRACE(tfp, "SGML: End </%s>\n", string->data); - + if (TRACE) { + fprintf(stderr, + "SGML: End </%s>\n", string->data); + } (*context->actions->end_element) (context->target, (context->current_tag - context->dtd->tags), @@ -2830,8 +2945,8 @@ top1: string->size = 0; context->current_attribute_number = INVALID; if (c != '>') { - if (!WHITE(c)) - CTRACE(tfp,"SGML: `</%s%c' found!\n", string->data, c); + if (TRACE && !WHITE(c)) + fprintf(stderr,"SGML: `</%s%c' found!\n", string->data, c); context->state = S_junk_tag; } else { context->state = S_text; @@ -3093,7 +3208,7 @@ PUBLIC HTStream* SGML_new ARGS3( context->string = HTChunkCreate(128); /* Grow by this much */ context->dtd = dtd; context->target = target; - context->actions = (CONST HTStructuredClass*)(((HTStream*)target)->isa); + context->actions = (HTStructuredClass*)(((HTStream*)target)->isa); /* Ugh: no OO */ context->unknown_tag = &HTTag_unrecognized; context->state = S_text; @@ -3150,7 +3265,7 @@ PUBLIC HTStream* SGML_new ARGS3( ** Added 24-Mar-96 by FM, based on: ** //////////////////////////////////////////////////////////////////////// -Copyright (c) 1993 Electrotechnical Laboratory (ETL) +Copyright (c) 1993 Electrotechnical Laboratry (ETL) Permission to use, copy, modify, and distribute this material for any purpose and without fee is hereby granted, provided @@ -3181,69 +3296,19 @@ PUBLIC void JISx0201TO0208_EUC ARGS4( register unsigned char *, OLO) { static char *table[] = { - "\241\243", /* A1,A3 */ - "\241\326", /* A1,D6 */ - "\241\327", /* A1,D7 */ - "\241\242", /* A1,A2 */ - "\241\246", /* A1,A6 */ - "\245\362", /* A5,F2 */ - "\245\241", /* A5,A1 */ - "\245\243", /* A5,A3 */ - "\245\245", /* A5,A5 */ - "\245\247", /* A5,A7 */ - "\245\251", /* A5,A9 */ - "\245\343", /* A5,E3 */ - "\245\345", /* A5,E5 */ - "\245\347", /* A5,E7 */ - "\245\303", /* A5,C3 */ - "\241\274", /* A1,BC */ - "\245\242", /* A5,A2 */ - "\245\244", /* A5,A4 */ - "\245\246", /* A5,A6 */ - "\245\250", /* A5,A8 */ - "\245\252", /* A5,AA */ - "\245\253", /* A5,AB */ - "\245\255", /* A5,AD */ - "\245\257", /* A5,AF */ - "\245\261", /* A5,B1 */ - "\245\263", /* A5,B3 */ - "\245\265", /* A5,B5 */ - "\245\267", /* A5,B7 */ - "\245\271", /* A5,B9 */ - "\245\273", /* A5,BB */ - "\245\275", /* A5,BD */ - "\245\277", /* A5,BF */ - "\245\301", /* A5,C1 */ - "\245\304", /* A5,C4 */ - "\245\306", /* A5,C6 */ - "\245\310", /* A5,C8 */ - "\245\312", /* A5,CA */ - "\245\313", /* A5,CB */ - "\245\314", /* A5,CC */ - "\245\315", /* A5,CD */ - "\245\316", /* A5,CE */ - "\245\317", /* A5,CF */ - "\245\322", /* A5,D2 */ - "\245\325", /* A5,D5 */ - "\245\330", /* A5,D8 */ - "\245\333", /* A5,DB */ - "\245\336", /* A5,DE */ - "\245\337", /* A5,DF */ - "\245\340", /* A5,E0 */ - "\245\341", /* A5,E1 */ - "\245\342", /* A5,E2 */ - "\245\344", /* A5,E4 */ - "\245\346", /* A5,E6 */ - "\245\350", /* A5,E8 */ - "\245\351", /* A5,E9 */ - "\245\352", /* A5,EA */ - "\245\353", /* A5,EB */ - "\245\354", /* A5,EC */ - "\245\355", /* A5,ED */ - "\245\357", /* A5,EF */ - "\245\363", /* A5,F3 */ - "\241\253", /* A1,AB */ - "\241\254" /* A1,AC */ + "\xA1\xA3", "\xA1\xD6", "\xA1\xD7", "\xA1\xA2", "\xA1\xA6", "\xA5\xF2", + "\xA5\xA1", "\xA5\xA3", "\xA5\xA5", "\xA5\xA7", "\xA5\xA9", + "\xA5\xE3", "\xA5\xE5", "\xA5\xE7", "\xA5\xC3", "\xA1\xBC", + "\xA5\xA2", "\xA5\xA4", "\xA5\xA6", "\xA5\xA8", "\xA5\xAA", + "\xA5\xAB", "\xA5\xAD", "\xA5\xAF", "\xA5\xB1", "\xA5\xB3", + "\xA5\xB5", "\xA5\xB7", "\xA5\xB9", "\xA5\xBB", "\xA5\xBD", + "\xA5\xBF", "\xA5\xC1", "\xA5\xC4", "\xA5\xC6", "\xA5\xC8", + "\xA5\xCA", "\xA5\xCB", "\xA5\xCC", "\xA5\xCD", "\xA5\xCE", + "\xA5\xCF", "\xA5\xD2", "\xA5\xD5", "\xA5\xD8", "\xA5\xDB", + "\xA5\xDE", "\xA5\xDF", "\xA5\xE0", "\xA5\xE1", "\xA5\xE2", + "\xA5\xE4", "\xA5\xE6", "\xA5\xE8", "\xA5\xE9", "\xA5\xEA", + "\xA5\xEB", "\xA5\xEC", "\xA5\xED", "\xA5\xEF", "\xA5\xF3", + "\xA1\xAB", "\xA1\xAC" }; if ((IHI == 0x8E) && (ILO >= 0xA1) && (ILO <= 0xDF)) { @@ -3312,7 +3377,7 @@ PUBLIC void JISx0201TO0208_SJIS ARGS3( { unsigned char SJCODE[2]; - JISx0201TO0208_EUC('\216', I, OHI, OLO); + JISx0201TO0208_EUC('\x8E', I, OHI, OLO); JIS_TO_SJIS1(*OHI&0x7F, *OLO&0x7F, SJCODE); *OHI = SJCODE[0]; *OLO = SJCODE[1]; @@ -3422,11 +3487,10 @@ PUBLIC unsigned char * EUC_TO_JIS ARGS4( } PUBLIC unsigned char * TO_EUC ARGS2( - CONST unsigned char *, jis, + unsigned char *, jis, unsigned char *, euc) { - register CONST unsigned char *s; - register unsigned char *d, c, jis_stat; + register unsigned char *s, *d, c, jis_stat; register int to1B, to2B; register int in_sjis = 0; @@ -3476,7 +3540,7 @@ PUBLIC unsigned char * TO_EUC ARGS2( } PUBLIC void TO_SJIS ARGS2( - CONST unsigned char *, any, + unsigned char *, any, unsigned char *, sjis) { unsigned char *euc; @@ -3494,7 +3558,7 @@ PUBLIC void TO_SJIS ARGS2( } PUBLIC void TO_JIS ARGS2( - CONST unsigned char *, any, + unsigned char *, any, unsigned char *, jis) { unsigned char *euc; diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h index 22f4bded..fd0bf759 100644 --- a/WWW/Library/Implementation/SGML.h +++ b/WWW/Library/Implementation/SGML.h @@ -20,6 +20,9 @@ #ifndef SGML_H #define SGML_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* HTUTILS_H */ #include <HTStream.h> #include <HTAnchor.h> diff --git a/WWW/Library/Implementation/UCAux.h b/WWW/Library/Implementation/UCAux.h index 3b1df229..a1e3df46 100644 --- a/WWW/Library/Implementation/UCAux.h +++ b/WWW/Library/Implementation/UCAux.h @@ -1,8 +1,6 @@ #ifndef UCAUX_H #define UCAUX_H -#include <HTUtils.h> - extern BOOL UCCanUniTranslateFrom PARAMS((int from)); extern BOOL UCCanTranslateUniTo PARAMS((int to)); extern BOOL UCCanTranslateFromTo PARAMS((int from, int to)); diff --git a/WWW/Library/Implementation/UCDefs.h b/WWW/Library/Implementation/UCDefs.h index 0da30713..ac2dc3bc 100644 --- a/WWW/Library/Implementation/UCDefs.h +++ b/WWW/Library/Implementation/UCDefs.h @@ -3,29 +3,21 @@ #ifndef UCDEFS_H #define UCDEFS_H -#include <HTUtils.h> - typedef struct _LYUCcharset { int UChndl; CONST char * MIMEname; int enc; - - /* parameters below are not used by chartrans mechanism, */ - /* they describe some relationships against built-in Latin1 charset...*/ - int repertoire; /* unused */ - int codepoints; /* subset/superset of Latin1 ? */ - int cpranges; /* unused, obsolete by LYlowest_eightbit; - "which ranges have valid displayable chars - (including nbsp and shy)" */ - int like8859; /* currently used for nbsp and shy only - (but UCT_R_8859SPECL assumed for any UCT_R_8BIT...); - "for which ranges is it like 8859-1" */ + int repertoire; + int codepoints; + int cpranges; /* which ranges have valid displayable chars + (including nbsp and shy) */ + int like8859; /* for which ranges is it like 8859-1 */ } LYUCcharset; #define UCT_ENC_7BIT 0 #define UCT_ENC_8BIT 1 -#define UCT_ENC_8859 2 /* no displayable chars in 0x80-0x9F */ -#define UCT_ENC_8BIT_C0 3 /* 8-bit + some chars in C0 control area */ +#define UCT_ENC_8859 2 +#define UCT_ENC_8BIT_C0 3 /* 8-bit some chars in C0 control area */ #define UCT_ENC_MAYBE2022 4 #define UCT_ENC_CJK 5 #define UCT_ENC_16BIT 6 @@ -53,13 +45,13 @@ typedef struct _LYUCcharset { * More specific bitflags for practically important code point ranges: */ #define UCT_R_LOWCTRL 0x08 /* 0x00-0x1F, for completeness */ -#define UCT_R_7BITINV 0x10 /* invariant???, displayable 7bit chars */ -#define UCT_R_7BITNAT 0x20 /* displayable 7bit, national??? */ -#define UCT_R_HIGHCTRL 0x40 /* chars in 0x80-0x9F range */ +#define UCT_R_7BITINV 0x10 /* invariant, displayable 7bit chars */ +#define UCT_R_7BITNAT 0x20 /* displayable 7bit, national */ +#define UCT_R_HIGHCTRL 0x40 #define UCT_R_8859SPECL 0x80 /* special chars in 8859-x sets: nbsp and shy*/ #define UCT_R_HIGH8BIT 0x100 /* rest of 0xA0-0xFF range */ -#define UCT_R_ASCII UCT_R_7BITINV | UCT_R_7BITNAT /* displayable US-ASCII */ +#define UCT_R_ASCII UCT_R_7BITINV | UCT_R_7BITNAT /*displayable US-ASCII*/ #define UCT_R_LAT1 UCT_R_ASCII | UCT_R_8859SPECL | UCT_R_HIGH8BIT #define UCT_R_8BIT UCT_R_LAT1 | UCT_R_HIGHCTRL /* full 8bit range */ diff --git a/WWW/Library/Implementation/UCMap.h b/WWW/Library/Implementation/UCMap.h index 15df5f02..e634f760 100644 --- a/WWW/Library/Implementation/UCMap.h +++ b/WWW/Library/Implementation/UCMap.h @@ -1,8 +1,7 @@ + #ifndef UCMAP_H #define UCMAP_H -#include <HTUtils.h> - typedef long UCode_t; extern int UCTransUniChar PARAMS(( @@ -32,52 +31,18 @@ extern int UCTransCharStr PARAMS(( extern UCode_t UCTransToUni PARAMS(( char ch_in, int charset_in)); +extern int UCGetLYhndl_byMIME PARAMS(( + CONST char * p)); extern int UCGetRawUniMode_byLYhndl PARAMS(( int i)); -extern int UCGetLYhndl_byMIME PARAMS(( - CONST char * p)); /* returns -1 if name not recognized */ -extern int safeUCGetLYhndl_byMIME PARAMS(( - CONST char * p)); /* returns LATIN1 if name not recognized */ extern int UCLYhndl_for_unspec; extern int UCLYhndl_for_unrec; extern int UCLYhndl_HTFile_for_unspec; extern int UCLYhndl_HTFile_for_unrec; -/* easy to type: */ -#define LATIN1 UCGetLYhndl_byMIME("iso-8859-1") -#define US_ASCII UCGetLYhndl_byMIME("us-ascii") - -/* -In general, Lynx translates letters from document charset to display charset. -If document charset is not specified or not recognized by Lynx, we fall back -to different assumptions below, read also lynx.cfg for info. - -UCLYhndl_for_unspec - assume this as charset for documents that don't - specify a charset parameter in HTTP headers or via META - this corresponds to "assume_charset" - -UCLYhndl_HTFile_for_unspec - assume this as charset of local file - this corresponds to "assume_local_charset" - -UCLYhndl_for_unrec - in case a charset parameter is not recognized; - this corresponds to "assume_unrec_charset" - -UCLYhndl_HTFile_for_unrec - the same but only for local files, - currently not used. - - -current_char_set - this corresponds to "display charset", - declared in LYCharSets.c and really important. - -All external charset information is available in so called MIME format. -For internal needs Lynx uses charset handlers as integers -from UCGetLYhndl_byMIME(). However, there is no way to recover -from user's error in configuration file lynx.cfg or command line switches, -those unrecognized MIME names are assumed as LATIN1 (via safeUCGetLYhndl...). -*/ - - #define UCTRANS_NOTFOUND (-4) +#define HT_CANNOT_TRANSLATE -4 /* could go into HTUtils.h */ + #endif /* UCMAP_H */ diff --git a/WWW/Library/Implementation/crypt.c b/WWW/Library/Implementation/crypt.c index 3645f63e..1a01711c 100644 --- a/WWW/Library/Implementation/crypt.c +++ b/WWW/Library/Implementation/crypt.c @@ -23,7 +23,9 @@ * */ +#ifndef HTUTILS_H #include <HTUtils.h> +#endif #include <ufc-crypt.h> diff --git a/WWW/Library/Implementation/crypt_util.c b/WWW/Library/Implementation/crypt_util.c index 91868b75..bdec6f7b 100644 --- a/WWW/Library/Implementation/crypt_util.c +++ b/WWW/Library/Implementation/crypt_util.c @@ -23,7 +23,13 @@ * */ +#ifndef HTUTILS_H #include <HTUtils.h> +#endif + +#ifdef DEBUG +/*#include <stdio.h> included by HTUTils.h - FM */ +#endif #ifndef STATIC #define STATIC static diff --git a/WWW/Library/Implementation/entities.h b/WWW/Library/Implementation/entities.h index a6ca7c1d..55ce977b 100644 --- a/WWW/Library/Implementation/entities.h +++ b/WWW/Library/Implementation/entities.h @@ -15,12 +15,6 @@ * Why keep two structures for entities? Backward compatibility.. */ -#ifndef ENTITIES_H -#define ENTITIES_H 1 - -#include <HTUtils.h> -#include <SGML.h> - /* UC_entity_info structure is defined in SGML.h. This has to be sorted alphabetically (case-sensitive), bear this in mind when you add some more entities.. */ @@ -1088,5 +1082,3 @@ static CONST UC_entity_info unicode_entities[] = { /* {"scnap", 0x????}, succeeds, not approximately equal to # ISOamsn */ /* {"smid", 0x????}, shortmid # ISOamsr */ }; - -#endif /* ENTITIES_H */ diff --git a/WWW/Library/Implementation/getline.c b/WWW/Library/Implementation/getline.c index 3168b9ec..4ee2e744 100644 --- a/WWW/Library/Implementation/getline.c +++ b/WWW/Library/Implementation/getline.c @@ -17,11 +17,14 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* CHANGED FOR VMS */ + /* * <getline.c> */ #include <HTUtils.h> +#include <tcp.h> +#include <stddef.h> #include <LYLeaks.h> diff --git a/WWW/Library/Implementation/getpass.c b/WWW/Library/Implementation/getpass.c index f209da77..0e8ffdfa 100644 --- a/WWW/Library/Implementation/getpass.c +++ b/WWW/Library/Implementation/getpass.c @@ -23,6 +23,7 @@ Cambridge, MA 02139, USA. */ */ #include <HTUtils.h> +/*#include <stdio.h> included by HTUtils.h -- FM */ #include <descrip.h> #include <psldef.h> #include <iodef.h> diff --git a/WWW/Library/Implementation/tcp.h b/WWW/Library/Implementation/tcp.h index fba85b5b..fc424056 100644 --- a/WWW/Library/Implementation/tcp.h +++ b/WWW/Library/Implementation/tcp.h @@ -1,20 +1,20 @@ /* System dependencies in the W3 library SYSTEM DEPENDENCIES - + System-system differences for TCP include files and macros. This file includes for each system the files necessary for network and file I/O. It should be used in conjunction with HTUtils.h to help ensure portability across as many platforms and flavors of platforms as possible. - + AUTHORS - + TBL Tim Berners-Lee, W3 project, CERN, <timbl@info.cern.ch> EvA Eelco van Asperen <evas@cs.few.eur.nl> MA Marc Andreessen NCSA AT Aleksandar Totic <atotic@ncsa.uiuc.edu> SCW Susan C. Weber <sweber@kyle.eitech.com> - + HISTORY: 22 Feb 91 Written (TBL) as part of the WWW library. 16 Jan 92 PC code from EvA @@ -29,13 +29,17 @@ #ifndef TCP_H #define TCP_H +#ifndef HTUTILS_H +#include <HTUtils.h> +#endif /* !HTUTILS_H */ + /* Default values These values may be reset and altered by system-specific sections later on. there are also a bunch of defaults at the end . - + */ /* Default values of those: */ #define NETCLOSE close /* Routine to close a TCP-IP socket */ @@ -55,61 +59,61 @@ Default values typedef struct sockaddr_in SockA; /* See netinet/in.h */ + +#ifndef STDIO_H +#include <stdio.h> +#define STDIO_H +#endif /* !STDIO_H */ + #ifndef VMS #include <sys/types.h> -#if defined(__DJGPP__) || defined(__BORLANDC__) -#define HAVE_DIRENT_H -#undef HAVE_SYS_FILIO_H -#endif /* DJGPP or __BORLANDC__ */ - -#ifdef HAVE_DIRENT_H +#if HAVE_DIRENT_H # include <dirent.h> # define D_NAMLEN(dirent) strlen((dirent)->d_name) # define STRUCT_DIRENT struct dirent #else # define D_NAMLEN(dirent) (dirent)->d_namlen # define STRUCT_DIRENT struct direct -# ifdef HAVE_SYS_NDIR_H +# if HAVE_SYS_NDIR_H # include <sys/ndir.h> # endif -# ifdef HAVE_SYS_DIR_H +# if HAVE_SYS_DIR_H # include <sys/dir.h> # endif -# ifdef HAVE_NDIR_H +# if HAVE_NDIR_H # include <ndir.h> # endif #endif /* HAVE_DIRENT_H */ #endif /* !VMS */ -#ifdef TIME_WITH_SYS_TIME +#if TIME_WITH_SYS_TIME # include <sys/time.h> # include <time.h> #else -# ifdef HAVE_SYS_TIME_H +# if HAVE_SYS_TIME_H # include <sys/time.h> # else # include <time.h> # endif #endif -#if defined(_AIX) && !defined(AIX) +#ifdef _AIX #define AIX #endif /* _AIX */ - -#if defined(AIX) && !defined(unix) +#ifdef AIX #define unix #endif /* AIX */ -#ifdef HAVE_FCNTL_H +#if HAVE_FCNTL_H #include <fcntl.h> #else -#ifdef HAVE_SYS_FCNTL_H +#if HAVE_SYS_FCNTL_H #include <sys/fcntl.h> #endif #endif -#ifdef HAVE_STRING_H +#if HAVE_STRING_H #include <string.h> /* For bzero etc */ #endif /* HAVE_STRING_H */ @@ -149,6 +153,7 @@ IBM-PC running Windows NT #include <time.h> #include <errno.h> #include <direct.h> +#include <stdio.h> #include <winsock.h> typedef struct sockaddr_in SockA; /* See netinet/in.h */ #define EINPROGRESS (WSABASEERR+36) @@ -171,23 +176,23 @@ VAX/VMS Under VMS, there are many versions of TCP-IP. Define one if you do not use Digital's UCX product: - + UCX DEC's "Ultrix connection" (default) CMU_TCP Available via FTP from sacusr.mp.usbr.gov SOCKETSHR Eckhart Meyer's interface to NETLIB WIN_TCP From Wollongong, now GEC software. MULTINET From SRI, became TGV, then Cisco. DECNET Cern's TCP socket emulation over DECnet - + The last three do not interfere with the unix i/o library, and so they need special calls to read, write and close sockets. In these cases the socket number is a VMS channel number, so we make the @@@ HORRIBLE @@@ assumption that a channel number will be greater than 10 but a unix file descriptor less than 10. It works. - + */ -#ifdef VMS +#ifdef VMS #ifdef UCX #undef IOCTL @@ -261,6 +266,11 @@ extern int socket_ioctl(); #include <string.h> +#ifndef STDIO_H +#include <stdio.h> +#define STDIO_H +#endif /* !STDIO_H */ + #include <file.h> #include <stat.h> #include <unixio.h> @@ -279,6 +289,7 @@ extern int socket_ioctl(); */ extern int multinet_accept(); extern int multinet_bind(); +extern int bzero(); extern int multinet_connect(); extern int multinet_gethostname(); extern int multinet_getsockname(); @@ -295,7 +306,6 @@ extern char *vms_errno_string(); #include <time.h> #include <types.h> #ifdef __TIME_T -#undef __TYPES #define __TYPES 1 #define __TYPES_LOADED 1 #endif /* __TIME_T */ @@ -308,11 +318,9 @@ extern char *vms_errno_string(); #endif /* !__SOCKET_TYPEDEFS */ #include "multinet_root:[multinet.include]errno.h" #ifdef __TYPES -#undef __TIME_T #define __TIME_T 1 #endif /* __TYPE */ #ifdef __TIME_LOADED -#undef __TIME #define __TIME 1 /* to avoid double definitions in in.h */ #endif /* __TIME_LOADED */ #include "multinet_root:[multinet.include.sys]time.h" @@ -437,7 +445,7 @@ struct timeval { On VMS machines, the linker needs to be told to put global data sections into a data segment using these storage classes. (MarkDonszelmann) - + */ #if defined(VAXC) && !defined(__DECC) #define GLOBALDEF globaldef @@ -475,14 +483,13 @@ struct timeval { #define NETREAD read_s #undef NETCLOSE #define NETCLOSE close_s -#define getsockname getsockname_s #endif -#ifdef HAVE_UNISTD_H +#if HAVE_UNISTD_H #include <unistd.h> #endif /* HAVE_UNISTD_H */ -#ifdef HAVE_SYS_FILIO_H +#if HAVE_SYS_FILIO_H #include <sys/filio.h> #endif /* HAVE_SYS_FILIO_H */ @@ -501,7 +508,7 @@ Regular BSD unix versions */ #ifndef INCLUDES_DONE #include <sys/types.h> -#ifdef HAVE_STRING_H +#if HAVE_STRING_H #include <string.h> #endif /* HAVE_STRING_H */ #include <errno.h> /* independent */ @@ -526,6 +533,10 @@ typedef unsigned short mode_t; typedef int pid_t; #endif /* !pid_t */ +#ifndef S_ISREG +#define S_ISREG(m) (((m) & 0170000) == 0100000) +#endif /* S_ISREG */ + #ifndef WEXITSTATUS #ifdef sony_news #define WEXITSTATUS(s) WIFEXITED(s) @@ -612,70 +623,6 @@ Defaults #include <netdb.h> #endif /* TCP includes */ -#ifndef S_ISLNK -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#endif /* S_ISLNK */ - -#ifndef S_ISDIR -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif /* S_ISDIR */ - -#ifndef S_ISREG -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif /* S_ISREG */ - -#ifndef S_ISUID -#define S_ISUID 0004000 -#endif -#ifndef S_ISGID -#define S_ISGID 0002000 -#endif -#ifndef S_ISVTX -#define S_ISVTX 0001000 -#endif - -#ifndef S_IRWXU -#define S_IRWXU 00700 -#endif - -#ifndef S_IRUSR -#define S_IRUSR 00400 -#endif -#ifndef S_IWUSR -#define S_IWUSR 00200 -#endif -#ifndef S_IXUSR -#define S_IXUSR 00100 -#endif - -#ifndef S_IRWXG -#define S_IRWXG 00070 -#endif - -#ifndef S_IRGRP -#define S_IRGRP 00040 -#endif -#ifndef S_IWGRP -#define S_IWGRP 00020 -#endif -#ifndef S_IXGRP -#define S_IXGRP 00010 -#endif - -#ifndef S_IRWXO -#define S_IRWXO 00007 -#endif - -#ifndef S_IROTH -#define S_IROTH 00004 -#endif -#ifndef S_IWOTH -#define S_IWOTH 00002 -#endif -#ifndef S_IXOTH -#define S_IXOTH 00001 -#endif - /* ROUGH ESTIMATE OF MAX PATH LENGTH diff --git a/WWW/Library/djgpp/makefile b/WWW/Library/djgpp/makefile index 71408d21..d7272e45 100644 --- a/WWW/Library/djgpp/makefile +++ b/WWW/Library/djgpp/makefile @@ -7,12 +7,8 @@ WWW_MACH = djgpp # The ASIS repository's name for the machine we are on #ASIS_MACH = hardware/os -CFLAGS = -O3 -DUSE_ZLIB -DDOSPATH -DNOUSERS -DDEBUG -DDISP_PARTIAL \ --I../Implementation \ --I../../../djgpp/tcplib/include \ --I../../../djgpp/tcplib/include/tcp \ --I../../../src \ --I../../.. +CFLAGS = -O3 -DUSE_ZLIB -DDOSPATH -DNOUSERS -DDEBUG -I../../../djgpp/tcplib/include -I../../../djgpp/tcplib/include/tcp \ +-I../../../src -I../../.. LFLAGS = CC = gcc diff --git a/WWW/Library/unix/makefile.in b/WWW/Library/unix/makefile.in index ed69fe50..94918497 100644 --- a/WWW/Library/unix/makefile.in +++ b/WWW/Library/unix/makefile.in @@ -7,7 +7,6 @@ WWW_MACH = unix # The ASIS repository's name for the machine we are on ASIS_MACH = hardware/os -ECHO = @DONT_ECHO_CC@ LFLAGS = prefix = @prefix@ @@ -21,12 +20,7 @@ LYFLAGS = # FIXME: set in parent makefile CC = @CC@ DEFS = @DEFS@ CPPFLAGS = @CPPFLAGS@ -CPPOPTS = $(DEFS) $(CPPFLAGS) $(LYFLAGS) \ - -I../../.. \ - -I../../../src \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/WWW/Library/Implementation +CPPOPTS = $(DEFS) $(CPPFLAGS) $(LYFLAGS) -I../../.. -I../../../src -I$(top_srcdir) -I$(top_srcdir)/src LY_CFLAGS = @CFLAGS@ CFLAGS = $(CPPOPTS) $(LY_CFLAGS) diff --git a/WWW/Library/vms/descrip.mms b/WWW/Library/vms/descrip.mms index a6231d02..216e6aee 100644 --- a/WWW/Library/vms/descrip.mms +++ b/WWW/Library/vms/descrip.mms @@ -76,14 +76,12 @@ DEBUGFLAGS = /Debug /NoOptimize .endif -INCLUDES = /Include=([-.Implementation],[---.src],[---]) - ! defines valid for all compilations EXTRADEFINES = DEBUG, ACCESS_AUTH, VC="""$(VC)""" ! DECC flags for all compilations .ifdef DEC_C -DCFLAGS = /NoMember /Warning=(disable=implicitfunc) $(INCLUDES) +DCFLAGS = /NoMember /Warning=(disable=implicitfunc) .endif .ifdef UCX @@ -91,7 +89,7 @@ TCP = UCX .ifdef DEC_C CFLAGS = /decc/Prefix=All $(DEBUGFLAGS) $(DCFLAGS) /Define=($(EXTRADEFINES), UCX) .else -CFLAGS = $(DEBUGFLAGS) /Define=($(EXTRADEFINES), UCX) $(INCLUDES) +CFLAGS = $(DEBUGFLAGS) /Define=($(EXTRADEFINES), UCX) .endif .endif @@ -100,7 +98,7 @@ TCP = TCPWARE .ifdef DEC_C CFLAGS = /decc/Prefix=All $(DEBUGFLAGS) $(DCFLAGS) /Define=($(EXTRADEFINES), UCX, TCPWARE) .else -CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), UCX, TCPWARE) $(INCLUDES) +CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), UCX, TCPWARE) .endif .endif @@ -109,7 +107,7 @@ TCP = MULTINET .ifdef DEC_C CFLAGS = /decc/Prefix=ANSI $(DEBUGFLAGS) $(DCFLAGS) /Define=(_DECC_V4_SOURCE, __SOCKET_TYPEDEFS, $(EXTRADEFINES), MULTINET) .else -CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), MULTINET) $(INCLUDES) +CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), MULTINET) .endif .endif @@ -118,7 +116,7 @@ TCP = WIN_TCP .ifdef DEC_C CFLAGS = /decc/Prefix=ANSI $(DEBUGFLAGS) $(DCFLAGS) /Define=($(EXTRADEFINES), WIN_TCP) .else -CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), WIN_TCP) $(INCLUDES) +CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), WIN_TCP) .endif .endif @@ -127,7 +125,7 @@ TCP = CMU_TCP .ifdef DEC_C CFLAGS = /decc/Prefix=ANSI $(DEBUGFLAGS) $(DCFLAGS) /Define=($(EXTRADEFINES), CMU_TCP) .else -CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), CMU_TCP) $(INCLUDES) +CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), CMU_TCP) .endif .endif @@ -136,7 +134,7 @@ TCP = SOCKETSHR_TCP .ifdef DEC_C CFLAGS = /decc/Prefix=ANSI $(DEBUGFLAGS) $(DCFLAGS) /Define=($(EXTRADEFINES), SOCKETSHR_TCP) .else -CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), SOCKETSHR_TCP) $(INCLUDES) +CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), SOCKETSHR_TCP) .endif .endif @@ -145,7 +143,7 @@ TCP = DECNET .ifdef DEC_C CFLAGS = /decc/Prefix=All $(DEBUGFLAGS) $(DCFLAGS) /Define=($(EXTRADEFINES), DECNET) .else -CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), DECNET) $(INCLUDES) +CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), DECNET) .endif .endif @@ -155,7 +153,7 @@ TCP = MULTINET ! (Default to MULTINET) .ifdef DEC_C CFLAGS = /decc/Prefix=ANSI $(DEBUGFLAGS) $(DCFLAGS) /Define=(_DECC_V4_SOURCE, __SOCKET_TYPEDEFS, $(EXTRADEFINES), MULTINET) .else -CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), MULTINET) $(INCLUDES) +CFLAGS = $(DEBUGFLAGS) /Define = ($(EXTRADEFINES), MULTINET) .endif .endif @@ -38,18 +38,13 @@ AC_DEFUN([CF_ALT_CHAR_SET], [ AC_MSG_CHECKING([if curses supports alternate-character set]) AC_CACHE_VAL(cf_cv_alt_char_set,[ -for mapname in acs_map _acs_map -do AC_TRY_LINK([ -#include <${cf_cv_ncurses_header-curses.h}> - ],[chtype x = $mapname['l']; $mapname['m'] = 0], - [cf_cv_alt_char_set=$mapname - break], - [cf_cv_alt_char_set=no]) -done - ]) +#include <$cf_cv_ncurses_header> + ],[chtype x = acs_map['l']; acs_map['m'] = 0], + [cf_cv_alt_char_set=yes], + [cf_cv_alt_char_set=no])]) AC_MSG_RESULT($cf_cv_alt_char_set) -test $cf_cv_alt_char_set != no && AC_DEFINE_UNQUOTED(ALT_CHAR_SET,$cf_cv_alt_char_set) +test $cf_cv_alt_char_set = yes && AC_DEFINE(ALT_CHAR_SET) ])dnl dnl --------------------------------------------------------------------------- dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' @@ -67,13 +62,7 @@ cf_save_CFLAGS="$CFLAGS" # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) -for cf_arg in "-DCC_HAS_PROTOS" \ - "" \ - -qlanglvl=ansi \ - -std1 \ - "-Aa -D_HPUX_SOURCE +e" \ - "-Aa -D_HPUX_SOURCE" \ - -Xc +for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc do CFLAGS="$cf_save_CFLAGS $cf_arg" AC_TRY_COMPILE( @@ -137,7 +126,7 @@ AC_DEFUN([CF_BOOL_DEFS], AC_MSG_CHECKING(if TRUE/FALSE are defined) AC_CACHE_VAL(cf_cv_bool_defs,[ AC_TRY_COMPILE([ -#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_cv_ncurses_header> #include <stdio.h>],[int x = TRUE, y = FALSE], [cf_cv_bool_defs=yes], [cf_cv_bool_defs=no])]) @@ -243,7 +232,7 @@ dnl --------------------------------------------------------------------------- dnl Check if curses supports color. (Note that while SVr3 curses supports dnl color, it does this differently from SVr4 curses; more work would be needed dnl to accommodate SVr3). -dnl +dnl AC_DEFUN([CF_COLOR_CURSES], [ AC_MSG_CHECKING(if curses supports color attributes) @@ -315,7 +304,7 @@ if test ".$ac_cv_func_initscr" != .yes ; then # Check for library containing initscr test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" - for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown + for cf_curs_lib in curses ncurses xcurses cursesX jcurses unknown do AC_CHECK_LIB($cf_curs_lib,initscr,[break]) done @@ -357,7 +346,7 @@ AC_MSG_CHECKING([for curses performance tradeoff]) AC_CACHE_VAL(cf_cv_curs_performance,[ cf_cv_curs_performance=no AC_TRY_COMPILE([ -#include <${cf_cv_ncurses_header-curses.h}>],[ +#include <$cf_cv_ncurses_header>],[ #if defined(wbkgdset) && defined(clearok) && defined(getbkgd) int x = ERR; #else @@ -366,7 +355,7 @@ AC_CACHE_VAL(cf_cv_curs_performance,[ ],[ AC_TRY_COMPILE([ #define CURS_PERFORMANCE -#include <${cf_cv_ncurses_header-curses.h}>],[ +#include <$cf_cv_ncurses_header>],[ #if defined(wbkgdset) && defined(clearok) && defined(getbkgd) int x = ; /* force an error */ #else @@ -438,7 +427,7 @@ AC_DEFUN([CF_FANCY_CURSES], AC_MSG_CHECKING(if curses supports fancy attributes) AC_CACHE_VAL(cf_cv_fancy_curses,[ AC_TRY_LINK([ -#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_cv_ncurses_header> ], [attrset(A_UNDERLINE|A_BOLD|A_REVERSE); wattrset(stdscr, A_BLINK|A_DIM); @@ -791,7 +780,7 @@ all : @echo 'cf_make_include=\$(RESULT)' CF_EOF cf_make_include="" - eval `(cd $cf_dir && ${MAKE-make}) 2>&AC_FD_CC | grep cf_make_include=OK` + eval `cd $cf_dir && ${MAKE-make} 2>&AC_FD_CC | grep cf_make_include=OK` if test -n "$cf_make_include"; then make_include_left="$cf_include" make_include_quote="$cf_quote" @@ -829,7 +818,7 @@ if test "$cf_cv_ncurses_version" != no ; then AC_MSG_CHECKING(for obsolete/broken version of ncurses) AC_CACHE_VAL(cf_cv_ncurses_broken,[ AC_TRY_COMPILE([ -#include <${cf_cv_ncurses_header-curses.h}>],[ +#include <$cf_cv_ncurses_header>],[ #if defined(NCURSES_VERSION) && defined(wgetbkgd) make an error #else @@ -1122,15 +1111,7 @@ fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_$1 do if test -z "$cf_path_prog" ; then @@ -1330,75 +1311,6 @@ AC_MSG_RESULT($cf_result) test $cf_result = no && LIBS="$cf_slang_LIBS3" ])dnl dnl --------------------------------------------------------------------------- -dnl Check for socks library -dnl $1 = the [optional] directory in which the library may be found -dnl $2 = the [optional] name of the library -AC_DEFUN([CF_SOCKS],[ -case "$1" in #(vi -no|yes) #(vi - ;; -*) - LIBS="$LIBS -L$1" - ;; -esac -LIBS="$LIBS -lsocks" -AC_DEFINE(SOCKS) -AC_DEFINE(accept,Raccept) -AC_DEFINE(bind,Rbind) -AC_DEFINE(connect,Rconnect) -AC_DEFINE(getpeername,Rgetpeername) -AC_DEFINE(getsockname,Rgetsockname) -AC_DEFINE(listen,Rlisten) -AC_DEFINE(recvfrom,Rrecvfrom) -AC_DEFINE(select,Rselect) -AC_TRY_LINK([ -#include <stdio.h>],[ - accept((char *)0)],, - [AC_ERROR(Cannot link with socks library)]) -])dnl -dnl --------------------------------------------------------------------------- -dnl Check for socks5 configuration -dnl $1 = the [optional] directory in which the library may be found -AC_DEFUN([CF_SOCKS5],[ -case "$1" in #(vi -no|yes) #(vi - ;; -*) - LIBS="$LIBS -L$1" - CFLAGS="$CFLAGS -I$1/../include" - ;; -esac -LIBS="$LIBS -lsocks5" -AC_DEFINE(USE_SOCKS5) -AC_DEFINE(SOCKS) -AC_MSG_CHECKING(if the socks library uses socks4 prefix) -AC_TRY_LINK([ -#include <socks.h>],[ - Rinit((char *)0)], - [AC_DEFINE(USE_SOCKS4_PREFIX) - cf_use_socks4=yes], - [AC_TRY_LINK([#include <socks.h>], - [SOCKSinit((char *)0)], - [cf_use_socks4=no], - [AC_ERROR(Cannot link with socks5 library)])]) -AC_MSG_RESULT($cf_use_socks4) -if test "$cf_use_socks4" = "yes" ; then - AC_DEFINE(accept,Raccept) - AC_DEFINE(bind,Rbind) - AC_DEFINE(connect,Rconnect) - AC_DEFINE(getpeername,Rgetpeername) - AC_DEFINE(getsockname,Rgetsockname) - AC_DEFINE(listen,Rlisten) - AC_DEFINE(recvfrom,Rrecvfrom) - AC_DEFINE(select,Rselect) -else - AC_DEFINE(accept,SOCKSaccept) - AC_DEFINE(getpeername,SOCKSgetpeername) - AC_DEFINE(getsockname,SOCKSgetsockname) - AC_DEFINE(recvfrom,SOCKSrecvfrom) -fi -])dnl -dnl --------------------------------------------------------------------------- dnl Remove "-g" option from the compiler options AC_DEFUN([CF_STRIP_G_OPT], [$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])dnl @@ -1466,27 +1378,6 @@ if test "$cf_cv_lib_termcap" = none; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl Check if including termio.h with <curses.h> dies like on sysv68 -dnl FIXME: this is too Lynx-specific -AC_DEFUN([CF_TERMIO_AND_CURSES], -[ -AC_CACHE_CHECK(if we can include termio.h with curses,cf_cv_termio_and_curses,[ - cf_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -DHAVE_CONFIG_H -I. -I${srcdir-.} -I${srcdir-.}/src -I${srcdir-.}/WWW/Library/Implementation" - touch lynx_cfg.h - AC_TRY_COMPILE([ -#include <$1> -#include <termio.h>], - [putchar(0x0a)], - [cf_cv_termio_and_curses=yes], - [cf_cv_termio_and_curses=no]) - CFLAGS="$cf_save_CFLAGS" - rm -f lynx_cfg.h -]) - -test $cf_cv_termio_and_curses = yes && AC_DEFINE(TERMIO_AND_CURSES) -])dnl -dnl --------------------------------------------------------------------------- dnl Check if including both termio.h and termios.h die like on DG.UX AC_DEFUN([CF_TERMIO_AND_TERMIOS], [ @@ -1510,7 +1401,7 @@ AC_DEFUN([CF_TTYTYPE], [ AC_MSG_CHECKING(if ttytype is declared in curses library) AC_CACHE_VAL(cf_cv_have_ttytype,[ - AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], + AC_TRY_LINK([#include <$cf_cv_ncurses_header>], [char *x = &ttytype[1]; *x = 1], [cf_cv_have_ttytype=yes], [cf_cv_have_ttytype=no]) diff --git a/build-slang.com b/build-slang.com index ff05f510..852afcae 100644 --- a/build-slang.com +++ b/build-slang.com @@ -107,7 +107,7 @@ $ read sys$command/prompt="Agent [1,2,3,4,5,6] (RETURN = [1]) " agent $ EndIf $ ENDIF $ option = "" -$ if agent .eq. 1 .or. agent .eqs. "" .or. p1 .eqs. "" .or. p1 .eqs. "MULTINET" then - +$ if agent .eq. 1 .or. agent .eqs. "" .or. p1 .eqs. "MULTINET" then - option = "MULTINET" $ if agent .eq. 2 .or. p1 .eqs. "UCX" then option = "UCX" $ if agent .eq. 3 .or. p1 .eqs. "WIN_TCP" then option = "WIN_TCP" @@ -115,12 +115,6 @@ $ if agent .eq. 4 .or. p1 .eqs. "CMU_TCP" then option = "CMU_TCP" $ if agent .eq. 5 .or. p1 .eqs. "SOCKETSHR_TCP" then option = "SOCKETSHR_TCP" $ if agent .eq. 6 .or. p1 .eqs. "TCPWARE" then option = "TCPWARE" $! -$ if option .eqs. "" -$ then -$ write sys$output "TCP/IP agent could not be determined" -$ exit 18 -$ endif -$ $ if option .eqs. "TCPWARE" $ then $ write sys$output "Building Lynx for TCPWARE with UCX emulation..." @@ -223,7 +217,7 @@ $ v1 = f$verify(1) $! DECC: $ cc := cc/decc/prefix=all/nomember'cc_opts' - /DEFINE=(DEBUG,ACCESS_AUTH,'option''extra',USE_SLANG,__VMS_CURSES)- - /INCLUDE=([],[-],[-.WWW.Library.Implementation],[.chrtrans],'SLANGINC') + /INCLUDE=([-],[-.WWW.Library.Implementation],'SLANGINC') $ v1 = 'f$verify(0)' $ ELSE $ if option .eqs. "UCX" then optfile = "UCXOLB" @@ -235,7 +229,7 @@ $ v1 = f$verify(1) $! GNUC: $ cc := gcc'cc_opts' - /DEFINE=(DEBUG,ACCESS_AUTH,'option''extra',USE_SLANG)- - /INCLUDE=([],[-],[-.WWW.Library.Implementation],[.chrtrans],'SLANGINC') + /INCLUDE=([-],[-.WWW.Library.Implementation],'SLANGINC') $ v1 = 'f$verify(0)' $ ELSE $ compiler := "VAXC" @@ -243,7 +237,7 @@ $ v1 = f$verify(1) $! VAXC: $ cc := cc'cc_opts' - /DEFINE=(DEBUG,ACCESS_AUTH,'option''extra',USE_SLANG)- - /INCLUDE=([],[-],[-.WWW.Library.Implementation],[.chrtrans],'SLANGINC') + /INCLUDE=([-],[-.WWW.Library.Implementation],'SLANGINC') $ v1 = 'f$verify(0)' $ ENDIF $ ENDIF @@ -86,7 +86,7 @@ $ read sys$command/prompt="Agent [1,2,3,4,5,6] (RETURN = [1]) " agent $ EndIf $ ENDIF $ option = "" -$ if agent .eq. 1 .or. agent .eqs. "" .or. p1 .eqs. "" .or. p1 .eqs. "MULTINET" then - +$ if agent .eq. 1 .or. agent .eqs. "" .or. p1 .eqs. "MULTINET" then - option = "MULTINET" $ if agent .eq. 2 .or. p1 .eqs. "UCX" then option = "UCX" $ if agent .eq. 3 .or. p1 .eqs. "WIN_TCP" then option = "WIN_TCP" @@ -94,12 +94,6 @@ $ if agent .eq. 4 .or. p1 .eqs. "CMU_TCP" then option = "CMU_TCP" $ if agent .eq. 5 .or. p1 .eqs. "SOCKETSHR_TCP" then option = "SOCKETSHR_TCP" $ if agent .eq. 6 .or. p1 .eqs. "TCPWARE" then option = "TCPWARE" $! -$ if option .eqs. "" -$ then -$ write sys$output "TCP/IP agent could not be determined" -$ exit 18 -$ endif -$ $ if option .eqs. "TCPWARE" $ then $ write sys$output "Building Lynx for TCPWARE with UCX emulation..." @@ -200,9 +194,9 @@ $ if option .eqs. "MULTINET" then - extra = extra + ",_DECC_V4_SOURCE,__SOCKET_TYPEDEFS" $ v1 = f$verify(1) $! DECC: -$ cc := cc/decc/prefix=all/nomember'cc_opts' - +$ cc := cc/decc/prefix=all/nomember'cc_opts'- /DEFINE=(DEBUG,ACCESS_AUTH,'option''extra',__VMS_CURSES)- - /INCLUDE=([],[-],[-.WWW.Library.Implementation],[.chrtrans]) + /INCLUDE=([-],[-.WWW.Library.Implementation],[.chrtrans]) $ v1 = 'f$verify(0)' $ ELSE $ if option .eqs. "UCX" then optfile = "UCXOLB" @@ -214,7 +208,7 @@ $ v1 = f$verify(1) $! GNUC: $ cc := gcc'cc_opts' - /DEFINE=(DEBUG,ACCESS_AUTH,'option''extra')- - /INCLUDE=([],[-],[-.WWW.Library.Implementation],[.chrtrans]) + /INCLUDE=([-],[-.WWW.Library.Implementation],[.chrtrans]) $ v1 = 'f$verify(0)' $ ELSE $ compiler := "VAXC" @@ -222,7 +216,7 @@ $ v1 = f$verify(1) $! VAXC: $ cc := cc'cc_opts' - /DEFINE=(DEBUG,ACCESS_AUTH,'option''extra')- - /INCLUDE=([],[-],[-.WWW.Library.Implementation],[.chrtrans]) + /INCLUDE=([-],[-.WWW.Library.Implementation],[.chrtrans]) $ v1 = 'f$verify(0)' $ ENDIF $ ENDIF diff --git a/cfg_defs.sh b/cfg_defs.sh deleted file mode 100755 index d20a77f7..00000000 --- a/cfg_defs.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# Translate the lynx_cfg.h and config.cache data into a table, useful for -# display at runtime. - -cat <<EOF -#ifndef CFG_DEFS_H -#define CFG_DEFS_H 1 - -static CONST struct { - CONST char *name; - CONST char *value; -} config_cache[] = { -EOF - -# Empirical test for format of config.cache. -# I'd welcome a better touchstone. -# Ideally, "configure" should generate a uniform format config.cache. -# -- gil -case `grep '^ac_cv_func_' config.cache | head -1` in - - # `set' quotes correctly as required by POSIX, so do not add quotes. - *{*'="'* ) - sed \ - -e '/^#/d' \ - -e 's/^.[^=]*_cv_/ { "/' \ - -e 's/=\${.*=/", /' \ - -e 's/}$/ },/' \ - config.cache | sort - ;; - # `set' does not quote correctly, so add quotes - # ( cf. configure script's building config.cache ) - * ) -sed -e '/^#/d' \ - -e 's/"/\\"/g' \ - -e 's/=}$/=""}/' \ - -e "s/'/\"/g" \ - -e 's/^.[^=]*_cv_/ { "/' \ - -e 's/=${[^=]*="/", "/' \ - -e 's/=${[^=]*=/", "/' \ - -e 's/"}$/}/' \ - -e 's/}$/" },/' \ - config.cache | sort - ;; esac - -cat <<EOF -}; - -static CONST struct { - CONST char *name; - CONST char *value; -} config_defines[] = { -EOF -fgrep '#define' lynx_cfg.h |sort | -sed -e 's@ @ @g' \ - -e 's@ @ @g' \ - -e 's@[ ]*#define @@' \ - -e 's@[ ]*/\*.*\*/@@' \ - -e 's@"$@@' \ - -e 's@"@@' \ - -e 's@ @", "@' \ - -e 's@^@ { "@' \ - -e 's@$@" },@' -cat <<EOF -}; - -#endif /* CFG_DEFS_H */ -EOF diff --git a/config.guess b/config.guess index e7b60f32..5bb9a89d 100755 --- a/config.guess +++ b/config.guess @@ -1,6 +1,6 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. +# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -52,53 +52,11 @@ trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <<EOF >dummy.s - .globl main - .ent main -main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - ${CC-cc} dummy.s -o dummy 2>/dev/null - if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'` exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 @@ -110,35 +68,11 @@ EOF echo m68k-cbm-netbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + echo m68k-cbm-openbsd${UNAME_RELEASE} + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -174,18 +108,6 @@ EOF sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; @@ -193,25 +115,19 @@ EOF echo m68k-atari-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} + echo m68k-atari-openbsd${UNAME_RELEASE} exit 0 ;; sun3*:NetBSD:*:*) echo m68k-sun-netbsd${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} + echo m68k-sun-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:NetBSD:*:*) echo m68k-apple-netbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} + echo m68k-apple-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} @@ -462,8 +378,8 @@ EOF hp3[0-9][05]:NetBSD:*:*) echo m68k-hp-netbsd${UNAME_RELEASE} exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} + hp3[0-9][05]:OpenBSD:*:*) + echo m68k-hp-openbsd${UNAME_RELEASE} exit 0 ;; i?86:BSD/386:*:* | *:BSD/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -478,10 +394,7 @@ EOF echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin32 - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 + echo i386-pc-cygwin32 exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin32 @@ -490,134 +403,43 @@ EOF echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:Linux:*:*) - # uname on the ARM produces all sorts of strangeness, and we need to - # filter it out. - case "$UNAME_MACHINE" in - arm* | sa110*) UNAME_MACHINE="arm" ;; - esac - # The BFD linker knows what the default object file format is, so # first see if it will tell us. ld_help_string=`ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d - s/[ ][ ]*/ /g - s/.*supported emulations: *// - s/ .*// - p'` - case "$ld_supported_emulations" in - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; - esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <<EOF >dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - ${CC-cc} dummy.s -o dummy 2>/dev/null - if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >dummy.c <<EOF -main(argc, argv) - int argc; - char *argv[]; -{ -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} -EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then + echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then + echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then + echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then + echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then + echo "powerpc-unknown-linux-gnu" ; exit 0 + elif test "${UNAME_MACHINE}" = "alpha" ; then + echo alpha-unknown-linux-gnu ; exit 0 + elif test "${UNAME_MACHINE}" = "sparc" ; then + echo sparc-unknown-linux-gnu ; exit 0 else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac + # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us + # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout. + test ! -d /usr/lib/ldscripts/. \ + && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 # Determine whether the default compiler is a.out or elf cat >dummy.c <<EOF -#include <features.h> main(argc, argv) - int argc; - char *argv[]; +int argc; +char *argv[]; { #ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif + printf ("%s-pc-linux-gnu\n", argv[1]); #else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); + printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } @@ -630,31 +452,9 @@ EOF i?86:DYNIX/ptx:4*:*) echo i386-sequent-sysv4 exit 0 ;; - i?86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - # SysVr5/Unixware7 - i?86:*:5*:* | i?86:SYSTEM_V:5*:*) - if uname -a | grep SCO >/dev/null 2>/dev/null ; then - (/bin/uname -s|egrep UnixWare >/dev/null) && UNAME_VER=uw${UNAME_VERSION} - if /bin/uname -X 2>/dev/null >/dev/null ; then - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - fi - echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}${UNAME_VER} - else - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv4.2uw${UNAME_VERSION} + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi @@ -673,11 +473,6 @@ EOF echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; - pc:*:*:*) - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; @@ -737,10 +532,6 @@ EOF echo ns32k-sni-sysv fi exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm @@ -753,9 +544,6 @@ EOF mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - news*:NEWS-OS:*:6*) - echo mips-sony-newsos6 - exit 0 ;; R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} @@ -763,6 +551,10 @@ EOF echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -15,26 +15,19 @@ #undef DECL_STRSTR #undef DECL_SYS_ERRLIST #undef DIRED_SUPPORT /* AC_ARG_WITH(dired) */ -#undef DISP_PARTIAL /* CF_ARG_ENABLE(partial) */ #undef DONT_TRACK_INTERNAL_LINKS /* CF_ARG_DISABLE(internal-links) */ -#undef EXEC_LINKS /* CF_ARG_ENABLE(exec-links) */ -#undef EXEC_SCRIPTS /* CF_ARG_ENABLE(exec-scripts) */ -#undef EXP_CHARTRANS_AUTOSWITCH /* AC_ARG_ENABLE(font-switch) */ -#undef EXP_PERSISTENT_COOKIES /* AC_ARG_ENABLE(persistent-cookies) */ +#undef EXP_8BIT_TOUPPER /* AC_ARG_WITH(8bit-toupper) */ +#undef EXP_CHARTRANS_AUTOSWITCH /* AC_ARG_WITH(font-switch) */ #undef FANCY_CURSES /* defined by CF_FANCY_CURSES */ #undef GCC_UNUSED /* CF_GCC_ATTRIBUTES */ -#undef GETGROUPS_T /* AC_TYPE_GETGROUPS */ #undef GZIP_PATH /* CF_PATH_PROG(gzip) */ #undef HAVE_CBREAK -#undef HAVE_CURSESX_H #undef HAVE_CUSERID -#undef HAVE_DEFINE_KEY #undef HAVE_DIRENT_H /* defined by AC_HEADER_DIRENT */ #undef HAVE_FCNTL_H /* have <fcntl.h> */ #undef HAVE_GETBKGD /* defined by CF_COLOR_CURSES */ #undef HAVE_GETCWD #undef HAVE_GETGROUPS -#undef HAVE_JCURSES_H #undef HAVE_KEYPAD #undef HAVE_LIMITS_H #undef HAVE_LSTAT /* defined by CF_FUNC_LSTAT */ @@ -51,8 +44,8 @@ #undef HAVE_SYS_IOCTL_H /* have <sys/ioctl.h> */ #undef HAVE_SYS_NDIR_H /* defined by AC_HEADER_DIRENT */ #undef HAVE_SYS_WAIT_H /* have <sys/wait.h> */ -#undef HAVE_TERMIOS_H /* have <termios.h> */ #undef HAVE_TERMIO_H /* have <termio.h> */ +#undef HAVE_TERMIOS_H /* have <termios.h> */ #undef HAVE_TTYTYPE #undef HAVE_TYPE_UNIONWAIT /* CF_UNION_WAIT */ #undef HAVE_UNISTD_H /* have <unistd.h> */ @@ -67,7 +60,6 @@ #undef LINUX /* FIXME: make tests? */ #undef LOCALE /* for locale support */ #undef LONG_LIST /* CF_ARG_DISABLE(long-list) */ -#undef LYNXCGI_LINKS /* CF_ARG_ENABLE(cgi-links) */ #undef LYNX_CFG_FILE /* $libdir/lynx.cfg */ #undef LYNX_LSS_FILE /* $libdir/lynx.lss */ #undef LY_FIND_LEAKS /* configure --disable-leaks */ @@ -79,10 +71,7 @@ #undef NEED_REMOVE /* defined by CF_REMOVE_BROKEN */ #undef NGROUPS /* defined by CF_NGROUPS */ #undef NO_CHANGE_EXECUTE_PERMS /* CF_ARG_DISABLE(dired-xpermit) */ -#undef NO_CONFIG_INFO /* CF_ARG_DISABLE(config-info) */ #undef NO_EXTENDED_HTMLDTD /* CF_ARG_DISABLE(extended-dtd) */ -#undef NO_OPTION_FORMS /* CF_ARG_DISABLE(forms-options) */ -#undef NO_OPTION_MENU /* CF_ARG_DISABLE(option-menu) */ #undef NO_PARENT_DIR_REFERENCE /* configure --disable-parent-dir */ #undef NSL_FORK /* CF_ARG_ENABLE(nsl-fork) */ #undef OK_GZIP /* CF_ARG_DISABLE(dired-gzip) */ @@ -92,14 +81,11 @@ #undef OK_UUDECODE /* CF_ARG_DISABLE(dired-uudecode) */ #undef OK_ZIP /* CF_ARG_DISABLE(dired-zip) */ #undef RM_PATH /* CF_PATH_PROG(rm) */ -#undef SOCKS /* CF_SOCKS, CF_SOCKS5 */ #undef STDC_HEADERS -#undef SYSLOG_REQUESTED_URLS /* CF_ARG_ENABLE(syslog) */ #undef SYSTEM_MAIL /* CF_DEFINE_PROG */ #undef SYSTEM_MAIL_FLAGS /* defined by CF_SYSTEM_MAIL_FLAGS */ #undef TAR_PATH /* CF_PATH_PROG(tar) */ -#undef TERMIO_AND_CURSES /* CF_TERMIO_AND_CURSES workaround */ -#undef TERMIO_AND_TERMIOS /* CF_TERMIO_AND_TERMIOS workaround */ +#undef TERMIO_AND_TERMIOS /* termio.h and termios.h combo bug */ #undef TOUCH_PATH /* CF_PATH_PROG(touch) */ #undef ULTRIX /* config.sub */ #undef UNCOMPRESS_PATH /* CF_PATH_PROG(gunzip) */ @@ -113,8 +99,6 @@ #undef USE_HASH /* see USE_COLOR_STYLE */ #undef USE_SIZECHANGEHACK /* FIXME: find a case where this works! */ #undef USE_SLANG /* AC_ARG_WITH(screen=slang) */ -#undef USE_SOCKS4_PREFIX /* CF_SOCKS5 */ -#undef USE_SOCKS5 /* CF_SOCKS5 */ #undef USE_ZLIB /* AC_ARG_WITH(zlib) */ #undef UTMPX_FOR_UTMP /* use <utmpx.h> since <utmp.h> not found */ #undef UUDECODE_PATH /* CF_PATH_PROG(uudecode) */ @@ -122,36 +106,24 @@ #undef WAIT_USES_UNION /* CF_FUNC_WAIT */ #undef ZCAT_PATH /* CF_PATH_PROG(zcat) */ #undef ZIP_PATH /* CF_PATH_PROG(zip) */ -#undef _ALL_SOURCE /* AC_AIX */ #undef const /* defined by AC_C_CONST */ #undef mode_t /* defined by AC_TYPE_MODE_T */ -#undef pid_t /* defined by AC_TYPE_PID_T */ -#undef uid_t /* defined by AC_TYPE_UID_T */ #undef vfork /* defined by AC_FUNC_FORK */ - /* FIXME:ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */ /* FIXME:DECLARE_WAIS_LOGFILES */ /* FIXME:DGUX */ /* FIXME:DGUX_OLD */ +/* FIXME:EXEC_LINKS */ +/* FIXME:EXEC_SCRIPTS */ /* FIXME:HP_TERMINAL */ /* FIXME:NOPORT */ /* FIXME:POSIX_JC */ /* FIXME:REVERSE_CLEAR_SCREEN_PROBLEM */ /* FIXME:SHORTENED_RBIND */ /* FIXME:SNAKE */ +/* FIXME:SOCKS */ /* FIXME:SVR4_BSDSELECT */ - -/* Some older socks libraries, especially AIX need special definitions */ -#if defined(_AIX) && !defined(USE_SOCKS5) -#undef accept -#undef bind -#undef connect -#undef getpeername -#undef getsockname -#undef listen -#undef recvfrom -#undef select -#endif +/* FIXME:SYSLOG_REQUESTED_URLS */ #ifndef HAVE_LSTAT #define lstat stat @@ -1,6 +1,6 @@ #! /bin/sh # Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. @@ -149,20 +149,19 @@ esac case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 \ + tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \ + | arme[lb] | pyramid \ | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \ - | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ - | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el \ - | sparc | sparclet | sparclite | sparc64 | v850) + | alpha | we32k | ns16k | clipper | i370 | sh \ + | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \ + | pdp11 | mips64el | mips64orion | mips64orionel \ + | sparc | sparclet | sparclite | sparc64) basic_machine=$basic_machine-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) + i[3456]86) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -171,18 +170,14 @@ case $basic_machine in exit 1 ;; # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ - | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \ - | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ - | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mipstx39-* | mipstx39el-* \ - | f301-*) + vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \ + | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \ + | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \ + | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \ + | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* | f301-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -209,9 +204,9 @@ case $basic_machine in amiga | amiga-*) basic_machine=m68k-cbm ;; - amigaos | amigados) + amigados) basic_machine=m68k-cbm - os=-amigaos + os=-amigados ;; amigaunix | amix) basic_machine=m68k-cbm @@ -350,19 +345,19 @@ case $basic_machine in os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) + i[3456]86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; - i[34567]86v4*) + i[3456]86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; - i[34567]86v) + i[3456]86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; - i[34567]86sol2) + i[3456]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; @@ -394,14 +389,6 @@ case $basic_machine in miniframe) basic_machine=m68000-convergent ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; @@ -469,23 +456,25 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | nexen) - basic_machine=i586-pc + pentium | p5) + basic_machine=i586-intel ;; - pentiumpro | p6 | k6 | 6x86) - basic_machine=i686-pc + pentiumpro | p6) + basic_machine=i686-intel ;; - pentiumii | pentium2) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | nexen-*) + pentium-* | p5-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumpro-* | p6-* | k6-* | 6x86-*) + pentiumpro-* | p6-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + k5) + # We don't have specific support for AMD's K5 yet, so just call it a Pentium + basic_machine=i586-amd + ;; + nexen) + # We don't have specific support for Nexgen yet, so just call it a Pentium + basic_machine=i586-nexgen ;; pn) basic_machine=pn-gould @@ -569,12 +558,6 @@ case $basic_machine in basic_machine=i386-sequent os=-dynix ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; tower | tower-32) basic_machine=m68k-ncr ;; @@ -594,7 +577,7 @@ case $basic_machine in basic_machine=vax-dec os=-vms ;; - vpp*|vx|vx-*) + vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) @@ -624,11 +607,7 @@ case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi + basic_machine=mips-mips ;; romp) basic_machine=romp-ibm @@ -689,12 +668,9 @@ case $os in -solaris) os=-solaris2 ;; - -svr4*) + -unixware* | svr4*) os=-sysv4 ;; - -unixware*) - os=-sysv4.2uw - ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; @@ -705,8 +681,7 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ + | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ @@ -714,7 +689,7 @@ case $os in | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv*) + | -linux-gnu* | -uxpv*) # Remember, each alternative MUST END IN *, to match a version number. ;; -linux*) @@ -840,7 +815,7 @@ case $basic_machine in os=-sysv ;; *-cbm) - os=-amigaos + os=-amigados ;; *-dg) os=-dgux @@ -190,33 +190,20 @@ Development Options: --enable-warnings GCC compiler warnings (default: off) Basic Configuration Options: --disable-full-paths control whether full utility pathnames are used (default: on) - --with-socks[=path] link with socks library if available - --with-socks5[=path] link with socks5 library if available --with-screen=XXX select screen type (XXX is curses (default), ncurses or slang) Miscellaneous Options: - --disable-forms-options disable experimental forms-based options (default: on) - --disable-menu-options disable old-style option menu (default: on) -EOF -cat <<EOF - --disable-config-info disable browsable configuration-info (default: on) - --enable-persistent-cookies use experimental persistent-cookie support (default: off) + --enable-8bit-toupper use experimental 8-bit case-conversion (default: off) --enable-color-style use optional/experimental color style (default: off) - --disable-partial use partial-display logic (default: on) --enable-default-colors enable use of default-colors (ncurses/slang) (default: off) --disable-extended-dtd disable extended HTML DTD logic (default: on) - --enable-externs use external commands (default: off) - --enable-font-switch use Linux setfont for character-translation (default: off) - --enable-cgi-links support cgi links w/o a http daemon (default: off) - --enable-exec-links support cgi links w/o a http daemon (default: off) - --enable-exec-scripts support cgi links w/o a http daemon (default: off) - --enable-internal-links handle following links to same doc differently (default: off) EOF cat <<EOF + --enable-externs use external commands (default: off) + --enable-font-switch use Linux setfont for character-translation (default: off) + --enable-internal-links handle following links to same doc differently (default: off) --enable-nsl-fork fork NSL requests, allowing them to be aborted (default: off) - --enable-syslog log URL requests via syslog (default: off) --enable-underlines underline links rather than using boldface (default: off) - --enable-gzip-help install gzip'ed help files (default: off) --with-zlib use zlib for decompression of some gzip files Directory Editor Options: --disable-dired enable optional directory-editor, DirEd (default: on) @@ -224,9 +211,9 @@ Directory Editor Options: --disable-dired-override disable private keymaps (default: on) --disable-dired-permit disable chmod/attrib commands (default: on) --disable-dired-xpermit disable chmod/attrib commands (default: on) - --disable-dired-tar disable "tar" command (default: on) EOF cat <<EOF + --disable-dired-tar disable "tar" command (default: on) --disable-dired-uudecode disable "uudecode" command (default: on) --disable-dired-zip disable "zip", "unzip" commands (default: on) --disable-dired-gzip disable "gzip", "gunzip" commands (default: on) @@ -598,7 +585,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:602: checking host system type" >&5 +echo "configure:589: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -623,7 +610,7 @@ echo "$ac_t""$host" 1>&6 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:627: checking for $ac_word" >&5 +echo "configure:614: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -652,7 +639,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:656: checking for $ac_word" >&5 +echo "configure:643: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -700,7 +687,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:704: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:691: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -710,11 +697,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 714 "configure" +#line 701 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -734,12 +721,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:738: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:725: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:743: checking whether we are using GNU C" >&5 +echo "configure:730: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -748,7 +735,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:752: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:739: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -763,7 +750,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:767: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:754: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -791,7 +778,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:795: checking how to run the C preprocessor" >&5 +echo "configure:782: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -806,13 +793,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 810 "configure" +#line 797 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:803: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -823,13 +810,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 827 "configure" +#line 814 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:820: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -854,7 +841,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:858: checking for $ac_word" >&5 +echo "configure:845: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -881,7 +868,7 @@ else fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:885: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:872: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -909,7 +896,7 @@ fi echo $ac_n "checking for style of include in makefiles""... $ac_c" 1>&6 -echo "configure:913: checking for style of include in makefiles" >&5 +echo "configure:900: checking for style of include in makefiles" >&5 make_include_left="" make_include_right="" @@ -931,7 +918,7 @@ all : @echo 'cf_make_include=\$(RESULT)' CF_EOF cf_make_include="" - eval `(cd $cf_dir && ${MAKE-make}) 2>&5 | grep cf_make_include=OK` + eval `cd $cf_dir && ${MAKE-make} 2>&5 | grep cf_make_include=OK` if test -n "$cf_make_include"; then make_include_left="$cf_include" make_include_quote="$cf_quote" @@ -970,7 +957,7 @@ echo "$ac_t""${make_include_left}file${make_include_right}" 1>&6 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:974: checking for a BSD compatible install" >&5 +echo "configure:961: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1024,7 +1011,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1028: checking for $ac_word" >&5 +echo "configure:1015: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LINT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1053,58 +1040,12 @@ test -n "$LINT" && break done -echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:1058: checking for AIX" >&5 -cat > conftest.$ac_ext <<EOF -#line 1060 "configure" -#include "confdefs.h" -#ifdef _AIX - yes -#endif - -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF -#define _ALL_SOURCE 1 -EOF - -else - rm -rf conftest* - echo "$ac_t""no" 1>&6 -fi -rm -f conftest* - - -echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1082: checking for POSIXized ISC" >&5 -if test -d /etc/conf/kconfig.d && - grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 -then - echo "$ac_t""yes" 1>&6 - ISC=yes # If later tests want to check for ISC. - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - if test "$GCC" = yes; then - CC="$CC -posix" - else - CC="$CC -Xp" - fi -else - echo "$ac_t""no" 1>&6 - ISC= -fi - - echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6 -echo "configure:1108: checking if you want to see long compiling messages" >&5 +echo "configure:1049: checking if you want to see long compiling messages" >&5 # Check whether --enable-echo or --disable-echo was given. if test "${enable_echo+set}" = set; then @@ -1143,16 +1084,8 @@ echo "$ac_t""$enableval" 1>&6 -# special case for WWW/* -if test -n "$ECHO_CC" ; then - DONT_ECHO_CC="$SHOW_CC ;" -else - DONT_ECHO_CC='' -fi - - echo $ac_n "checking if you want to check memory-leaks""... $ac_c" 1>&6 -echo "configure:1156: checking if you want to check memory-leaks" >&5 +echo "configure:1089: checking if you want to check memory-leaks" >&5 # Check whether --enable-find-leaks or --disable-find-leaks was given. if test "${enable_find_leaks+set}" = set; then @@ -1176,7 +1109,7 @@ EOF echo $ac_n "checking if you want to enable debug-code""... $ac_c" 1>&6 -echo "configure:1180: checking if you want to enable debug-code" >&5 +echo "configure:1113: checking if you want to enable debug-code" >&5 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then @@ -1207,21 +1140,21 @@ CFLAGS=`echo ${CFLAGS} | sed -e 's/-O[1-9]\? //' -e 's/-O[1-9]\?$//'` esac else case $host_os in - osf*) #(vi - test -z "$GCC" && CFLAGS="$CFLAGS -std1" + ultrix*|osf*) #(vi CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'` ;; *) - CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'` + CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'` ;; esac fi + if test -n "$GCC" then echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6 -echo "configure:1225: checking if you want to turn on gcc warnings" >&5 +echo "configure:1158: checking if you want to turn on gcc warnings" >&5 # Check whether --enable-warnings or --disable-warnings was given. if test "${enable_warnings+set}" = set; then @@ -1261,9 +1194,9 @@ EOF if test -n "$GCC" then echo "checking for gcc __attribute__ directives" 1>&6 -echo "configure:1265: checking for gcc __attribute__ directives" >&5 +echo "configure:1198: checking for gcc __attribute__ directives" >&5 cat > conftest.$ac_ext <<EOF -#line 1267 "configure" +#line 1200 "configure" #include "confdefs.h" #include "conftest.h" #include "conftest.i" @@ -1301,7 +1234,7 @@ EOF EOF ;; esac - if { (eval echo configure:1305: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:1238: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... $cf_attribute" 1>&6 cat conftest.h >>confdefs.h # else @@ -1318,11 +1251,11 @@ fi if test -n "$GCC" then cat > conftest.$ac_ext <<EOF -#line 1322 "configure" +#line 1255 "configure" int main(int argc, char *argv[]) { return argv[argc-1] == 0; } EOF echo "checking for gcc warning options" 1>&6 -echo "configure:1326: checking for gcc warning options" >&5 +echo "configure:1259: checking for gcc warning options" >&5 cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-W -Wall" cf_warn_CONST="" @@ -1340,7 +1273,7 @@ echo "configure:1326: checking for gcc warning options" >&5 Wstrict-prototypes $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo configure:1344: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:1277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES" @@ -1358,7 +1291,7 @@ fi echo $ac_n "checking if you want full utility pathnames""... $ac_c" 1>&6 -echo "configure:1362: checking if you want full utility pathnames" >&5 +echo "configure:1295: checking if you want full utility pathnames" >&5 # Check whether --enable-full-paths or --disable-full-paths was given. if test "${enable_full_paths+set}" = set; then @@ -1379,7 +1312,7 @@ echo "$ac_t""$with_full_paths" 1>&6 echo $ac_n "checking for system mailer""... $ac_c" 1>&6 -echo "configure:1383: checking for system mailer" >&5 +echo "configure:1316: checking for system mailer" >&5 if eval "test \"`echo '$''{'cf_cv_SYSTEM_MAIL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1406,7 +1339,7 @@ EOF echo $ac_n "checking system mail flags""... $ac_c" 1>&6 -echo "configure:1410: checking system mail flags" >&5 +echo "configure:1343: checking system mail flags" >&5 if eval "test \"`echo '$''{'cf_cv_system_mail_flags'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1434,7 +1367,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "chmod", so it can be a program name with args. set dummy chmod; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1438: checking for $ac_word" >&5 +echo "configure:1371: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_CHMOD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1465,21 +1398,13 @@ fi else echo $ac_n "checking for chmod""... $ac_c" 1>&6 -echo "configure:1469: checking for chmod" >&5 +echo "configure:1402: checking for chmod" >&5 echo "$ac_t""$CHMOD" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_CHMOD do if test -z "$cf_path_prog" ; then @@ -1507,7 +1432,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "compress", so it can be a program name with args. set dummy compress; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1511: checking for $ac_word" >&5 +echo "configure:1436: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_COMPRESS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1538,21 +1463,13 @@ fi else echo $ac_n "checking for compress""... $ac_c" 1>&6 -echo "configure:1542: checking for compress" >&5 +echo "configure:1467: checking for compress" >&5 echo "$ac_t""$COMPRESS" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_COMPRESS do if test -z "$cf_path_prog" ; then @@ -1580,7 +1497,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1584: checking for $ac_word" >&5 +echo "configure:1501: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_COPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1611,21 +1528,13 @@ fi else echo $ac_n "checking for cp""... $ac_c" 1>&6 -echo "configure:1615: checking for cp" >&5 +echo "configure:1532: checking for cp" >&5 echo "$ac_t""$COPY" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_COPY do if test -z "$cf_path_prog" ; then @@ -1653,7 +1562,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "gzip", so it can be a program name with args. set dummy gzip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1657: checking for $ac_word" >&5 +echo "configure:1566: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GZIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1684,21 +1593,13 @@ fi else echo $ac_n "checking for gzip""... $ac_c" 1>&6 -echo "configure:1688: checking for gzip" >&5 +echo "configure:1597: checking for gzip" >&5 echo "$ac_t""$GZIP" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_GZIP do if test -z "$cf_path_prog" ; then @@ -1726,7 +1627,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "mkdir", so it can be a program name with args. set dummy mkdir; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1730: checking for $ac_word" >&5 +echo "configure:1631: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1757,21 +1658,13 @@ fi else echo $ac_n "checking for mkdir""... $ac_c" 1>&6 -echo "configure:1761: checking for mkdir" >&5 +echo "configure:1662: checking for mkdir" >&5 echo "$ac_t""$MKDIR" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_MKDIR do if test -z "$cf_path_prog" ; then @@ -1799,7 +1692,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "mv", so it can be a program name with args. set dummy mv; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1803: checking for $ac_word" >&5 +echo "configure:1696: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1830,21 +1723,13 @@ fi else echo $ac_n "checking for mv""... $ac_c" 1>&6 -echo "configure:1834: checking for mv" >&5 +echo "configure:1727: checking for mv" >&5 echo "$ac_t""$MV" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_MV do if test -z "$cf_path_prog" ; then @@ -1872,7 +1757,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1876: checking for $ac_word" >&5 +echo "configure:1761: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1903,21 +1788,13 @@ fi else echo $ac_n "checking for rm""... $ac_c" 1>&6 -echo "configure:1907: checking for rm" >&5 +echo "configure:1792: checking for rm" >&5 echo "$ac_t""$RM" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_RM do if test -z "$cf_path_prog" ; then @@ -1945,7 +1822,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "tar", so it can be a program name with args. set dummy tar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1949: checking for $ac_word" >&5 +echo "configure:1826: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1976,21 +1853,13 @@ fi else echo $ac_n "checking for tar""... $ac_c" 1>&6 -echo "configure:1980: checking for tar" >&5 +echo "configure:1857: checking for tar" >&5 echo "$ac_t""$TAR" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_TAR do if test -z "$cf_path_prog" ; then @@ -2018,7 +1887,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "touch", so it can be a program name with args. set dummy touch; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2022: checking for $ac_word" >&5 +echo "configure:1891: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TOUCH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2049,21 +1918,13 @@ fi else echo $ac_n "checking for touch""... $ac_c" 1>&6 -echo "configure:2053: checking for touch" >&5 +echo "configure:1922: checking for touch" >&5 echo "$ac_t""$TOUCH" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_TOUCH do if test -z "$cf_path_prog" ; then @@ -2091,7 +1952,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "gunzip", so it can be a program name with args. set dummy gunzip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2095: checking for $ac_word" >&5 +echo "configure:1956: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_UNCOMPRESS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2122,21 +1983,13 @@ fi else echo $ac_n "checking for gunzip""... $ac_c" 1>&6 -echo "configure:2126: checking for gunzip" >&5 +echo "configure:1987: checking for gunzip" >&5 echo "$ac_t""$UNCOMPRESS" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_UNCOMPRESS do if test -z "$cf_path_prog" ; then @@ -2164,7 +2017,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "unzip", so it can be a program name with args. set dummy unzip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2168: checking for $ac_word" >&5 +echo "configure:2021: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_UNZIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2195,21 +2048,13 @@ fi else echo $ac_n "checking for unzip""... $ac_c" 1>&6 -echo "configure:2199: checking for unzip" >&5 +echo "configure:2052: checking for unzip" >&5 echo "$ac_t""$UNZIP" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_UNZIP do if test -z "$cf_path_prog" ; then @@ -2237,7 +2082,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "uudecode", so it can be a program name with args. set dummy uudecode; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2241: checking for $ac_word" >&5 +echo "configure:2086: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_UUDECODE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2268,21 +2113,13 @@ fi else echo $ac_n "checking for uudecode""... $ac_c" 1>&6 -echo "configure:2272: checking for uudecode" >&5 +echo "configure:2117: checking for uudecode" >&5 echo "$ac_t""$UUDECODE" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_UUDECODE do if test -z "$cf_path_prog" ; then @@ -2310,7 +2147,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "zcat", so it can be a program name with args. set dummy zcat; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2314: checking for $ac_word" >&5 +echo "configure:2151: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ZCAT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2341,21 +2178,13 @@ fi else echo $ac_n "checking for zcat""... $ac_c" 1>&6 -echo "configure:2345: checking for zcat" >&5 +echo "configure:2182: checking for zcat" >&5 echo "$ac_t""$ZCAT" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_ZCAT do if test -z "$cf_path_prog" ; then @@ -2383,7 +2212,7 @@ if test "$with_full_paths" = yes ; then # Extract the first word of "zip", so it can be a program name with args. set dummy zip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2387: checking for $ac_word" >&5 +echo "configure:2216: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ZIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2414,21 +2243,13 @@ fi else echo $ac_n "checking for zip""... $ac_c" 1>&6 -echo "configure:2418: checking for zip" >&5 +echo "configure:2247: checking for zip" >&5 echo "$ac_t""$ZIP" 1>&6 fi cf_path_prog="" cf_path_args="" -IFS="${IFS= }"; cf_save_ifs="$IFS" -case $host_os in #(vi -os2*) #(vi - IFS="${IFS};" - ;; -*) - IFS="${IFS}:" - ;; -esac +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" for cf_temp in $ac_cv_path_ZIP do if test -z "$cf_path_prog" ; then @@ -2475,7 +2296,7 @@ EOF if test -z "$GCC" ; then echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:2479: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:2300: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2489,17 +2310,11 @@ cf_save_CFLAGS="$CFLAGS" # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) -for cf_arg in "-DCC_HAS_PROTOS" \ - "" \ - -qlanglvl=ansi \ - -std1 \ - "-Aa -D_HPUX_SOURCE +e" \ - "-Aa -D_HPUX_SOURCE" \ - -Xc +for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc do CFLAGS="$cf_save_CFLAGS $cf_arg" cat > conftest.$ac_ext <<EOF -#line 2503 "configure" +#line 2318 "configure" #include "confdefs.h" #ifndef CC_HAS_PROTOS @@ -2515,7 +2330,7 @@ int main() { struct s2 {int (*f) (double a);}; ; return 0; } EOF -if { (eval echo configure:2519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2334: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ansi_cc="$cf_arg"; break else @@ -2543,12 +2358,12 @@ fi fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2547: checking for working const" >&5 +echo "configure:2362: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2552 "configure" +#line 2367 "configure" #include "confdefs.h" int main() { @@ -2597,7 +2412,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:2601: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2619,27 +2434,26 @@ fi PROG_EXT= -TRY_CFLAGS= case $host_os in aix4*) - CFLAGS="$CFLAGS -DAIX4 -D_BSD=44 -D_AIX" + CFLAGS="$CFLAGS -DAIX4 -D_BSD=44" LIBS="$LIBS -lbsd" ;; aix*) LIBS="$LIBS -lbsd" ;; apollo*) - TRY_CFLAGS="$TRY_CFLAGS -D_BUILTINS -W0,-opt,4" + CFLAGS="$CFLAGS -D_BUILTINS -W0,-opt,4" ;; bsdi*) - CFLAGS="$CFLAGS -DBSDI" + CFLAGS="$CFLAGS -DBSDI" ;; clix*) # Tested on CLIX 3.1 (T.Dickey). The original makefile entry # contributed by Alex Matulich (matuli_a@marlin.navsea.navy.mil) also # references -lmalloc and -lbsd. echo $ac_n "checking for strcmp in -lc_s""... $ac_c" 1>&6 -echo "configure:2643: checking for strcmp in -lc_s" >&5 +echo "configure:2457: checking for strcmp in -lc_s" >&5 ac_lib_var=`echo c_s'_'strcmp | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2647,7 +2461,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 2651 "configure" +#line 2465 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2658,7 +2472,7 @@ int main() { strcmp() ; return 0; } EOF -if { (eval echo configure:2662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2690,10 +2504,10 @@ convex*) CFLAGS="$CFLAGS -D__STDC__ -Dunix" ;; dgux*) - CFLAGS="$CFLAGS -DDGUX" + CFLAGS="$CFLAGS -DDGUX" ;; hpux*) - CFLAGS="$CFLAGS -DSNAKE" + CFLAGS="$CFLAGS -DSNAKE" ;; isc*) # -DPOSIX_JC is necessary, else LYBookmark.c never finds out what a mode_t is. @@ -2704,10 +2518,10 @@ irix*) # The original makefile used the $CFLAGS option -cckr for some form # of K&R compatibility. However, this causes compilation warnings for # varargs on IRIX 5.2, and does not appear to be needed. - #removed: CFLAGS="$CFLAGS -cckr" + #removed: CFLAGS="$CFLAGS -cckr" ;; linux*) - CFLAGS="$CFLAGS -DLINUX" + CFLAGS="$CFLAGS -DLINUX" ;; next*) CFLAGS="$CFLAGS -DNEXT -DXMOSAIC_HACK" @@ -2721,18 +2535,13 @@ os2*) LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"` PROG_EXT=".exe" ;; -osf4*) - # The -Olimit flag (see below) is no longer available with - # Digital C 5.2, which is bundled with Digital UNIX 4.0. - CFLAGS="$CFLAGS -DDSYS5" - ;; osf*) # Increase the maximum size of functions that will be optimized. - test -z "$GCC" && TRY_CFLAGS="$TRY_CFLAGS -O -Olimit 4000" + test -z "$GCC" && CFLAGS="$CFLAGS -O -Olimit 4000" CFLAGS="$CFLAGS -DDSYS5" ;; sco3.2v5*) - test $ac_cv_prog_gcc != yes && TRY_CFLAGS="$TRY_CFLAGS -belf" + test $ac_cv_prog_gcc != yes && CC="cc -belf" ;; sco*) LIBS="$LIBS -lmalloc" @@ -2747,7 +2556,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2751: checking for $ac_word" >&5 +echo "configure:2560: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2791,17 +2600,17 @@ sony-newsos*) do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2795: checking for $ac_hdr" >&5 +echo "configure:2604: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2800 "configure" +#line 2609 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2614: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2839,23 +2648,23 @@ sunos4*) ;; ultrix*) # Increase the maximum size of functions that will be optimized. - test -z "$GCC" && TRY_CFLAGS="$TRY_CFLAGS -O -Olimit 600 -G 7" - CFLAGS="$CFLAGS -DULTRIX" + test -z "$GCC" && CFLAGS="$CFLAGS -O -Olimit 600 -G 7" + CFLAGS="$CFLAGS -DULTRIX" for ac_hdr in cursesX.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2849: checking for $ac_hdr" >&5 +echo "configure:2658: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2854 "configure" +#line 2663 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2859: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2668: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2875,11 +2684,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then cat >> confdefs.h <<EOF #define $ac_tr_hdr 1 EOF - cat >> confdefs.h <<\EOF -#define HAVE_CURSESX_H 1 -EOF - - cf_cv_ncurses_header=cursesX.h + cf_cv_ncurses_header=cursesX.h else echo "$ac_t""no" 1>&6 fi @@ -2889,262 +2694,11 @@ done esac -if test -n "$TRY_CFLAGS" ; then - cf_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $TRY_CFLAGS" - echo $ac_n "checking if we should use compile options $TRY_CFLAGS""... $ac_c" 1>&6 -echo "configure:2897: checking if we should use compile options $TRY_CFLAGS" >&5 - cat > conftest.$ac_ext <<EOF -#line 2899 "configure" -#include "confdefs.h" -#include <stdio.h> -int main() { -FILE *fp = stdin -; return 0; } -EOF -if { (eval echo configure:2906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - cf_result=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cf_result=no -fi -rm -f conftest* - echo "$ac_t""$cf_result" 1>&6 - test "$cf_result" = no && CFLAGS="$cf_save_CFLAGS" -fi - - -### Look for network libraries first, since some functions (such as gethostname) -### are used in a lot of places. -echo $ac_n "checking if you want socks library""... $ac_c" 1>&6 -echo "configure:2924: checking if you want socks library" >&5 -if eval "test \"`echo '$''{'cf_cv_use_libsocks'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - -# Check whether --with-socks or --without-socks was given. -if test "${with_socks+set}" = set; then - withval="$with_socks" - cf_cv_use_libsocks=$withval -else - cf_cv_use_libsocks=no -fi - - -fi - -echo "$ac_t""$cf_cv_use_libsocks" 1>&6 - -echo $ac_n "checking if you want socks5 library""... $ac_c" 1>&6 -echo "configure:2944: checking if you want socks5 library" >&5 -if eval "test \"`echo '$''{'cf_cv_use_libsocks5'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - -# Check whether --with-socks5 or --without-socks5 was given. -if test "${with_socks5+set}" = set; then - withval="$with_socks5" - cf_cv_use_libsocks5=$withval -else - cf_cv_use_libsocks5=no -fi - - -fi - -echo "$ac_t""$cf_cv_use_libsocks5" 1>&6 - -if test "x$cf_cv_use_libsocks" != xno ; then - -case "$cf_cv_use_libsocks" in #(vi -no|yes) #(vi - ;; -*) - LIBS="$LIBS -L$cf_cv_use_libsocks" - ;; -esac -LIBS="$LIBS -lsocks" -cat >> confdefs.h <<\EOF -#define SOCKS 1 -EOF - -cat >> confdefs.h <<\EOF -#define accept Raccept -EOF - -cat >> confdefs.h <<\EOF -#define bind Rbind -EOF - -cat >> confdefs.h <<\EOF -#define connect Rconnect -EOF - -cat >> confdefs.h <<\EOF -#define getpeername Rgetpeername -EOF - -cat >> confdefs.h <<\EOF -#define getsockname Rgetsockname -EOF - -cat >> confdefs.h <<\EOF -#define listen Rlisten -EOF - -cat >> confdefs.h <<\EOF -#define recvfrom Rrecvfrom -EOF - -cat >> confdefs.h <<\EOF -#define select Rselect -EOF - -cat > conftest.$ac_ext <<EOF -#line 3010 "configure" -#include "confdefs.h" - -#include <stdio.h> -int main() { - - accept((char *)0) -; return 0; } -EOF -if { (eval echo configure:3019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - { echo "configure: error: Cannot link with socks library" 1>&2; exit 1; } -fi -rm -f conftest* - -elif test "x$cf_cv_use_libsocks5" != xno ; then - -case "$cf_cv_use_libsocks5" in #(vi -no|yes) #(vi - ;; -*) - LIBS="$LIBS -L$cf_cv_use_libsocks5" - CFLAGS="$CFLAGS -I$cf_cv_use_libsocks5/../include" - ;; -esac -LIBS="$LIBS -lsocks5" -cat >> confdefs.h <<\EOF -#define USE_SOCKS5 1 -EOF - -cat >> confdefs.h <<\EOF -#define SOCKS 1 -EOF - -echo $ac_n "checking if the socks library uses socks4 prefix""... $ac_c" 1>&6 -echo "configure:3049: checking if the socks library uses socks4 prefix" >&5 -cat > conftest.$ac_ext <<EOF -#line 3051 "configure" -#include "confdefs.h" - -#include <socks.h> -int main() { - - Rinit((char *)0) -; return 0; } -EOF -if { (eval echo configure:3060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define USE_SOCKS4_PREFIX 1 -EOF - - cf_use_socks4=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cat > conftest.$ac_ext <<EOF -#line 3072 "configure" -#include "confdefs.h" -#include <socks.h> -int main() { -SOCKSinit((char *)0) -; return 0; } -EOF -if { (eval echo configure:3079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - cf_use_socks4=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - { echo "configure: error: Cannot link with socks5 library" 1>&2; exit 1; } -fi -rm -f conftest* -fi -rm -f conftest* -echo "$ac_t""$cf_use_socks4" 1>&6 -if test "$cf_use_socks4" = "yes" ; then - cat >> confdefs.h <<\EOF -#define accept Raccept -EOF - - cat >> confdefs.h <<\EOF -#define bind Rbind -EOF - - cat >> confdefs.h <<\EOF -#define connect Rconnect -EOF - - cat >> confdefs.h <<\EOF -#define getpeername Rgetpeername -EOF - - cat >> confdefs.h <<\EOF -#define getsockname Rgetsockname -EOF - - cat >> confdefs.h <<\EOF -#define listen Rlisten -EOF - - cat >> confdefs.h <<\EOF -#define recvfrom Rrecvfrom -EOF - - cat >> confdefs.h <<\EOF -#define select Rselect -EOF - -else - cat >> confdefs.h <<\EOF -#define accept SOCKSaccept -EOF - - cat >> confdefs.h <<\EOF -#define getpeername SOCKSgetpeername -EOF - - cat >> confdefs.h <<\EOF -#define getsockname SOCKSgetsockname -EOF - cat >> confdefs.h <<\EOF -#define recvfrom SOCKSrecvfrom -EOF - -fi - -else - cf_test_netlibs=no echo $ac_n "checking for network libraries""... $ac_c" 1>&6 -echo "configure:3148: checking for network libraries" >&5 +echo "configure:2702: checking for network libraries" >&5 if eval "test \"`echo '$''{'cf_cv_netlibs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3155,12 +2709,12 @@ cf_test_netlibs=yes for ac_func in gethostname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3159: checking for $ac_func" >&5 +echo "configure:2713: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3164 "configure" +#line 2718 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3183,7 +2737,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3206,7 +2760,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6 -echo "configure:3210: checking for gethostname in -lnsl" >&5 +echo "configure:2764: checking for gethostname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3214,7 +2768,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $cf_cv_netlibs $LIBS" cat > conftest.$ac_ext <<EOF -#line 3218 "configure" +#line 2772 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3225,7 +2779,7 @@ int main() { gethostname() ; return 0; } EOF -if { (eval echo configure:3229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3258,7 +2812,7 @@ else echo $ac_n "checking for gethostname in -lsocket""... $ac_c" 1>&6 -echo "configure:3262: checking for gethostname in -lsocket" >&5 +echo "configure:2816: checking for gethostname in -lsocket" >&5 ac_lib_var=`echo socket'_'gethostname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3266,7 +2820,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $cf_cv_netlibs $LIBS" cat > conftest.$ac_ext <<EOF -#line 3270 "configure" +#line 2824 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3277,7 +2831,7 @@ int main() { gethostname() ; return 0; } EOF -if { (eval echo configure:3281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3321,21 +2875,21 @@ done # FIXME: sequent needs this library (i.e., -lsocket -linet -lnsl), but # I don't know the entrypoints - 97/7/22 TD echo $ac_n "checking for -linet""... $ac_c" 1>&6 -echo "configure:3325: checking for -linet" >&5 +echo "configure:2879: checking for -linet" >&5 if eval "test \"`echo '$''{'ac_cv_lib_inet'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-linet $LIBS" cat > conftest.$ac_ext <<EOF -#line 3332 "configure" +#line 2886 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:3339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_lib_inet=yes else @@ -3358,12 +2912,12 @@ if test "$ac_cv_func_lsocket" != no ; then for ac_func in socket do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3362: checking for $ac_func" >&5 +echo "configure:2916: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3367 "configure" +#line 2921 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3386,7 +2940,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3409,7 +2963,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:3413: checking for socket in -lsocket" >&5 +echo "configure:2967: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3417,7 +2971,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $cf_cv_netlibs $LIBS" cat > conftest.$ac_ext <<EOF -#line 3421 "configure" +#line 2975 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3428,7 +2982,7 @@ int main() { socket() ; return 0; } EOF -if { (eval echo configure:3432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3461,7 +3015,7 @@ else echo $ac_n "checking for socket in -lbsd""... $ac_c" 1>&6 -echo "configure:3465: checking for socket in -lbsd" >&5 +echo "configure:3019: checking for socket in -lbsd" >&5 ac_lib_var=`echo bsd'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3469,7 +3023,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbsd $cf_cv_netlibs $LIBS" cat > conftest.$ac_ext <<EOF -#line 3473 "configure" +#line 3027 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3480,7 +3034,7 @@ int main() { socket() ; return 0; } EOF -if { (eval echo configure:3484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3525,12 +3079,12 @@ fi for ac_func in gethostbyname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3529: checking for $ac_func" >&5 +echo "configure:3083: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3534 "configure" +#line 3088 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3553,7 +3107,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3576,7 +3130,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3580: checking for gethostbyname in -lnsl" >&5 +echo "configure:3134: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3584,7 +3138,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $cf_cv_netlibs $LIBS" cat > conftest.$ac_ext <<EOF -#line 3588 "configure" +#line 3142 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3595,7 +3149,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:3599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3636,12 +3190,12 @@ done for ac_func in strcasecmp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3640: checking for $ac_func" >&5 +echo "configure:3194: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3645 "configure" +#line 3199 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3664,7 +3218,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3687,7 +3241,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for strcasecmp in -lresolv""... $ac_c" 1>&6 -echo "configure:3691: checking for strcasecmp in -lresolv" >&5 +echo "configure:3245: checking for strcasecmp in -lresolv" >&5 ac_lib_var=`echo resolv'_'strcasecmp | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3695,7 +3249,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $cf_cv_netlibs $LIBS" cat > conftest.$ac_ext <<EOF -#line 3699 "configure" +#line 3253 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3706,7 +3260,7 @@ int main() { strcasecmp() ; return 0; } EOF -if { (eval echo configure:3710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3749,10 +3303,9 @@ fi LIBS="$LIBS $cf_cv_netlibs" test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&6 -fi echo $ac_n "checking for screen type""... $ac_c" 1>&6 -echo "configure:3756: checking for screen type" >&5 +echo "configure:3309: checking for screen type" >&5 if eval "test \"`echo '$''{'cf_cv_screen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3787,12 +3340,12 @@ case $cf_cv_screen in curses) echo $ac_n "checking for initscr""... $ac_c" 1>&6 -echo "configure:3791: checking for initscr" >&5 +echo "configure:3344: checking for initscr" >&5 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3796 "configure" +#line 3349 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char initscr(); below. */ @@ -3815,7 +3368,7 @@ initscr(); ; return 0; } EOF -if { (eval echo configure:3819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_initscr=yes" else @@ -3836,7 +3389,7 @@ else case $host_os in #(vi freebsd*) #(vi echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 -echo "configure:3840: checking for tgoto in -lmytinfo" >&5 +echo "configure:3393: checking for tgoto in -lmytinfo" >&5 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3844,7 +3397,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmytinfo $LIBS" cat > conftest.$ac_ext <<EOF -#line 3848 "configure" +#line 3401 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3855,7 +3408,7 @@ int main() { tgoto() ; return 0; } EOF -if { (eval echo configure:3859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3878,7 +3431,7 @@ fi ;; hpux10.*) echo $ac_n "checking for initscr in -lcur_colr""... $ac_c" 1>&6 -echo "configure:3882: checking for initscr in -lcur_colr" >&5 +echo "configure:3435: checking for initscr in -lcur_colr" >&5 ac_lib_var=`echo cur_colr'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3886,7 +3439,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcur_colr $LIBS" cat > conftest.$ac_ext <<EOF -#line 3890 "configure" +#line 3443 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3897,7 +3450,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:3901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3921,7 +3474,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for initscr in -lHcurses""... $ac_c" 1>&6 -echo "configure:3925: checking for initscr in -lHcurses" >&5 +echo "configure:3478: checking for initscr in -lHcurses" >&5 ac_lib_var=`echo Hcurses'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3929,7 +3482,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lHcurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 3933 "configure" +#line 3486 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3940,7 +3493,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:3944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3986,12 +3539,12 @@ if test ".$ac_cv_func_initscr" != .yes ; then # Check for library containing tgoto. Do this before curses library # because it may be needed to link the test-case for initscr. echo $ac_n "checking for tgoto""... $ac_c" 1>&6 -echo "configure:3990: checking for tgoto" >&5 +echo "configure:3543: checking for tgoto" >&5 if eval "test \"`echo '$''{'ac_cv_func_tgoto'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3995 "configure" +#line 3548 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char tgoto(); below. */ @@ -4014,7 +3567,7 @@ tgoto(); ; return 0; } EOF -if { (eval echo configure:4018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3571: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_tgoto=yes" else @@ -4035,7 +3588,7 @@ else for cf_term_lib in termcap termlib unknown do echo $ac_n "checking for tgoto in -l$cf_term_lib""... $ac_c" 1>&6 -echo "configure:4039: checking for tgoto in -l$cf_term_lib" >&5 +echo "configure:3592: checking for tgoto in -l$cf_term_lib" >&5 ac_lib_var=`echo $cf_term_lib'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4043,7 +3596,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$cf_term_lib $LIBS" cat > conftest.$ac_ext <<EOF -#line 4047 "configure" +#line 3600 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4054,7 +3607,7 @@ int main() { tgoto() ; return 0; } EOF -if { (eval echo configure:4058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4081,10 +3634,10 @@ fi # Check for library containing initscr test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" - for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown + for cf_curs_lib in curses ncurses xcurses cursesX jcurses unknown do echo $ac_n "checking for initscr in -l$cf_curs_lib""... $ac_c" 1>&6 -echo "configure:4088: checking for initscr in -l$cf_curs_lib" >&5 +echo "configure:3641: checking for initscr in -l$cf_curs_lib" >&5 ac_lib_var=`echo $cf_curs_lib'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4092,7 +3645,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$cf_curs_lib $LIBS" cat > conftest.$ac_ext <<EOF -#line 4096 "configure" +#line 3649 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4103,7 +3656,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:4107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4129,16 +3682,16 @@ fi LIBS="-l$cf_curs_lib $cf_save_LIBS" if test "$cf_term_lib" = unknown ; then echo $ac_n "checking if we can link with $cf_curs_lib library""... $ac_c" 1>&6 -echo "configure:4133: checking if we can link with $cf_curs_lib library" >&5 +echo "configure:3686: checking if we can link with $cf_curs_lib library" >&5 cat > conftest.$ac_ext <<EOF -#line 4135 "configure" +#line 3688 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header-curses.h}> int main() { initscr() ; return 0; } EOF -if { (eval echo configure:4142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_result=yes else @@ -4152,16 +3705,16 @@ rm -f conftest* test $cf_result = no && { echo "configure: error: Cannot link curses library" 1>&2; exit 1; } elif test "$cf_term_lib" != predefined ; then echo $ac_n "checking if we need both $cf_curs_lib and $cf_term_lib libraries""... $ac_c" 1>&6 -echo "configure:4156: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 +echo "configure:3709: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 cat > conftest.$ac_ext <<EOF -#line 4158 "configure" +#line 3711 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header-curses.h}> int main() { initscr(); tgoto((char *)0, 0, 0); ; return 0; } EOF -if { (eval echo configure:4165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_result=no else @@ -4171,14 +3724,14 @@ else LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 4175 "configure" +#line 3728 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header-curses.h}> int main() { initscr() ; return 0; } EOF -if { (eval echo configure:4182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_result=yes else @@ -4200,17 +3753,17 @@ fi echo $ac_n "checking for curses performance tradeoff""... $ac_c" 1>&6 -echo "configure:4204: checking for curses performance tradeoff" >&5 +echo "configure:3757: checking for curses performance tradeoff" >&5 if eval "test \"`echo '$''{'cf_cv_curs_performance'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_curs_performance=no cat > conftest.$ac_ext <<EOF -#line 4211 "configure" +#line 3764 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_cv_ncurses_header> int main() { #if defined(wbkgdset) && defined(clearok) && defined(getbkgd) @@ -4221,15 +3774,15 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4225: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 4229 "configure" +#line 3782 "configure" #include "confdefs.h" #define CURS_PERFORMANCE -#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_cv_ncurses_header> int main() { #if defined(wbkgdset) && defined(clearok) && defined(getbkgd) @@ -4240,7 +3793,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4244: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3797: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_curs_performance=yes else @@ -4265,13 +3818,13 @@ EOF ncurses) echo $ac_n "checking for ncurses header file""... $ac_c" 1>&6 -echo "configure:4269: checking for ncurses header file" >&5 +echo "configure:3822: checking for ncurses header file" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_header'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4275 "configure" +#line 3828 "configure" #include "confdefs.h" #include <curses.h> int main() { @@ -4288,7 +3841,7 @@ make an error ; return 0; } EOF -if { (eval echo configure:4292: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3845: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ncurses_header=predefined else @@ -4374,7 +3927,7 @@ done ;; esac echo $ac_n "checking for ncurses version""... $ac_c" 1>&6 -echo "configure:4378: checking for ncurses version" >&5 +echo "configure:3931: checking for ncurses version" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4399,7 +3952,7 @@ Autoconf "old" #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" - { (eval echo configure:4403: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } + { (eval echo configure:3956: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } if test -f conftest.out ; then cf_out=`cat conftest.out | sed -e 's@^Autoconf @@' -e 's@^[^"]*"@@' -e 's@".*@@'` test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" @@ -4408,7 +3961,7 @@ EOF else cat > conftest.$ac_ext <<EOF -#line 4412 "configure" +#line 3965 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header-curses.h}> @@ -4431,7 +3984,7 @@ int main() exit(0); } EOF -if { (eval echo configure:4435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then cf_cv_ncurses_version=`cat $cf_tempfile` @@ -4456,7 +4009,7 @@ echo "$ac_t""$cf_cv_ncurses_version" 1>&6 cf_ncurses_LIBS="" cf_ncurses_SAVE="$LIBS" echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 -echo "configure:4460: checking for Gpm_Open in -lgpm" >&5 +echo "configure:4013: checking for Gpm_Open in -lgpm" >&5 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4464,7 +4017,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <<EOF -#line 4468 "configure" +#line 4021 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4475,7 +4028,7 @@ int main() { Gpm_Open() ; return 0; } EOF -if { (eval echo configure:4479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4491,7 +4044,7 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for initscr in -lgpm""... $ac_c" 1>&6 -echo "configure:4495: checking for initscr in -lgpm" >&5 +echo "configure:4048: checking for initscr in -lgpm" >&5 ac_lib_var=`echo gpm'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4499,7 +4052,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <<EOF -#line 4503 "configure" +#line 4056 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4510,7 +4063,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:4514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4541,7 +4094,7 @@ freebsd*) # This is only necessary if you are linking against an obsolete # version of ncurses (but it should do no harm, since it's static). echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 -echo "configure:4545: checking for tgoto in -lmytinfo" >&5 +echo "configure:4098: checking for tgoto in -lmytinfo" >&5 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4549,7 +4102,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmytinfo $LIBS" cat > conftest.$ac_ext <<EOF -#line 4553 "configure" +#line 4106 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4560,7 +4113,7 @@ int main() { tgoto() ; return 0; } EOF -if { (eval echo configure:4564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4588,12 +4141,12 @@ LIBS="$cf_ncurses_LIBS $LIBS" cf_cv_have_lib_ncurses=no cf_libdir="" echo $ac_n "checking for initscr""... $ac_c" 1>&6 -echo "configure:4592: checking for initscr" >&5 +echo "configure:4145: checking for initscr" >&5 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4597 "configure" +#line 4150 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char initscr(); below. */ @@ -4616,7 +4169,7 @@ initscr(); ; return 0; } EOF -if { (eval echo configure:4620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_initscr=yes" else @@ -4636,17 +4189,17 @@ else cf_save_LIBS="$LIBS" echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6 -echo "configure:4640: checking for initscr in -lncurses" >&5 +echo "configure:4193: checking for initscr in -lncurses" >&5 LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 4643 "configure" +#line 4196 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header-curses.h}> int main() { initscr() ; return 0; } EOF -if { (eval echo configure:4650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cf_cv_have_lib_ncurses=yes @@ -4673,17 +4226,17 @@ test "$prefix" != /usr && cf_search="$cf_search /usr/lib /usr/lib/ncur for cf_libdir in $cf_search do echo $ac_n "checking for -lncurses in $cf_libdir""... $ac_c" 1>&6 -echo "configure:4677: checking for -lncurses in $cf_libdir" >&5 +echo "configure:4230: checking for -lncurses in $cf_libdir" >&5 LIBS="-L$cf_libdir -lncurses $cf_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 4680 "configure" +#line 4233 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header-curses.h}> int main() { initscr() ; return 0; } EOF -if { (eval echo configure:4687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cf_cv_have_lib_ncurses=yes @@ -4715,7 +4268,7 @@ esac if test -n "$cf_ncurses_LIBS" ; then echo $ac_n "checking if we can link ncurses without $cf_ncurses_LIBS""... $ac_c" 1>&6 -echo "configure:4719: checking if we can link ncurses without $cf_ncurses_LIBS" >&5 +echo "configure:4272: checking if we can link ncurses without $cf_ncurses_LIBS" >&5 cf_ncurses_SAVE="$LIBS" for p in $cf_ncurses_LIBS ; do q=`echo $LIBS | sed -e 's/'$p' //' -e 's/'$p'$//'` @@ -4724,14 +4277,14 @@ echo "configure:4719: checking if we can link ncurses without $cf_ncurses_LIBS" fi done cat > conftest.$ac_ext <<EOF -#line 4728 "configure" +#line 4281 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header-curses.h}> int main() { initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); ; return 0; } EOF -if { (eval echo configure:4735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -4748,20 +4301,20 @@ fi slang) echo $ac_n "checking for slang header file""... $ac_c" 1>&6 -echo "configure:4752: checking for slang header file" >&5 +echo "configure:4305: checking for slang header file" >&5 if eval "test \"`echo '$''{'cf_cv_slang_header'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4758 "configure" +#line 4311 "configure" #include "confdefs.h" #include <slang.h> int main() { printf("%s\n", SLANG_VERSION) ; return 0; } EOF -if { (eval echo configure:4765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_slang_header=predefined else @@ -4845,7 +4398,7 @@ cf_cv_lib_termcap=none # HP-UX 9.x terminfo has setupterm, but no tigetstr. if test "$termlib" = none; then echo $ac_n "checking for tigetstr in -ltermlib""... $ac_c" 1>&6 -echo "configure:4849: checking for tigetstr in -ltermlib" >&5 +echo "configure:4402: checking for tigetstr in -ltermlib" >&5 ac_lib_var=`echo termlib'_'tigetstr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4853,7 +4406,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <<EOF -#line 4857 "configure" +#line 4410 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4864,7 +4417,7 @@ int main() { tigetstr() ; return 0; } EOF -if { (eval echo configure:4868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4887,7 +4440,7 @@ fi fi if test "$cf_cv_lib_termcap" = none; then echo $ac_n "checking for tgoto in -ltermlib""... $ac_c" 1>&6 -echo "configure:4891: checking for tgoto in -ltermlib" >&5 +echo "configure:4444: checking for tgoto in -ltermlib" >&5 ac_lib_var=`echo termlib'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4895,7 +4448,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <<EOF -#line 4899 "configure" +#line 4452 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4906,7 +4459,7 @@ int main() { tgoto() ; return 0; } EOF -if { (eval echo configure:4910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4930,7 +4483,7 @@ fi if test "$cf_cv_lib_termcap" = none; then # allow curses library for broken AIX system. echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6 -echo "configure:4934: checking for initscr in -lcurses" >&5 +echo "configure:4487: checking for initscr in -lcurses" >&5 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4938,7 +4491,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 4942 "configure" +#line 4495 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4949,7 +4502,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:4953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4970,7 +4523,7 @@ else fi echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6 -echo "configure:4974: checking for tgoto in -ltermcap" >&5 +echo "configure:4527: checking for tgoto in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4978,7 +4531,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 4982 "configure" +#line 4535 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4989,7 +4542,7 @@ int main() { tgoto() ; return 0; } EOF -if { (eval echo configure:4993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5012,7 +4565,7 @@ fi fi if test "$cf_cv_lib_termcap" = none; then echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6 -echo "configure:5016: checking for tgoto in -ltermcap" >&5 +echo "configure:4569: checking for tgoto in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5020,7 +4573,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 5024 "configure" +#line 4577 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5031,7 +4584,7 @@ int main() { tgoto() ; return 0; } EOF -if { (eval echo configure:5035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5054,7 +4607,7 @@ fi fi if test "$cf_cv_lib_termcap" = none; then echo $ac_n "checking for tgoto in -lncurses""... $ac_c" 1>&6 -echo "configure:5058: checking for tgoto in -lncurses" >&5 +echo "configure:4611: checking for tgoto in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5062,7 +4615,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 5066 "configure" +#line 4619 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5073,7 +4626,7 @@ int main() { tgoto() ; return 0; } EOF -if { (eval echo configure:5077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5103,12 +4656,12 @@ fi cf_slang_LIBS2="$LIBS" echo $ac_n "checking for acos""... $ac_c" 1>&6 -echo "configure:5107: checking for acos" >&5 +echo "configure:4660: checking for acos" >&5 if eval "test \"`echo '$''{'ac_cv_func_acos'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5112 "configure" +#line 4665 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char acos(); below. */ @@ -5131,7 +4684,7 @@ acos(); ; return 0; } EOF -if { (eval echo configure:5135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_acos=yes" else @@ -5150,7 +4703,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for acos in -lm""... $ac_c" 1>&6 -echo "configure:5154: checking for acos in -lm" >&5 +echo "configure:4707: checking for acos in -lm" >&5 ac_lib_var=`echo m'_'acos | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5158,7 +4711,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 5162 "configure" +#line 4715 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5169,7 +4722,7 @@ int main() { acos() ; return 0; } EOF -if { (eval echo configure:5173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5209,12 +4762,12 @@ fi cf_cv_have_lib_slang=no cf_libdir="" echo $ac_n "checking for SLtt_get_screen_size""... $ac_c" 1>&6 -echo "configure:5213: checking for SLtt_get_screen_size" >&5 +echo "configure:4766: checking for SLtt_get_screen_size" >&5 if eval "test \"`echo '$''{'ac_cv_func_SLtt_get_screen_size'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5218 "configure" +#line 4771 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char SLtt_get_screen_size(); below. */ @@ -5237,7 +4790,7 @@ SLtt_get_screen_size(); ; return 0; } EOF -if { (eval echo configure:5241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_SLtt_get_screen_size=yes" else @@ -5257,17 +4810,17 @@ else cf_save_LIBS="$LIBS" echo $ac_n "checking for SLtt_get_screen_size in -lslang""... $ac_c" 1>&6 -echo "configure:5261: checking for SLtt_get_screen_size in -lslang" >&5 +echo "configure:4814: checking for SLtt_get_screen_size in -lslang" >&5 LIBS="-lslang $LIBS" cat > conftest.$ac_ext <<EOF -#line 5264 "configure" +#line 4817 "configure" #include "confdefs.h" #include <slang.h> int main() { SLtt_get_screen_size() ; return 0; } EOF -if { (eval echo configure:5271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cf_cv_have_lib_slang=yes @@ -5294,17 +4847,17 @@ test "$prefix" != /usr && cf_search="$cf_search /usr/lib /usr/lib/slan for cf_libdir in $cf_search do echo $ac_n "checking for -lslang in $cf_libdir""... $ac_c" 1>&6 -echo "configure:5298: checking for -lslang in $cf_libdir" >&5 +echo "configure:4851: checking for -lslang in $cf_libdir" >&5 LIBS="-L$cf_libdir -lslang $cf_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 5301 "configure" +#line 4854 "configure" #include "confdefs.h" #include <slang.h> int main() { SLtt_get_screen_size() ; return 0; } EOF -if { (eval echo configure:5308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cf_cv_have_lib_slang=yes @@ -5335,7 +4888,7 @@ esac cf_slang_LIBS3="$LIBS" echo $ac_n "checking if we can link slang without termcap""... $ac_c" 1>&6 -echo "configure:5339: checking if we can link slang without termcap" >&5 +echo "configure:4892: checking if we can link slang without termcap" >&5 if test -n "`echo $cf_slang_LIBS1 | sed -e 's/ //g'`" ; then cf_exclude=`echo ".$cf_slang_LIBS2" | sed -e "s@$cf_slang_LIBS1@@" -e 's@^.@@'` else @@ -5343,14 +4896,14 @@ else fi LIBS=`echo ".$cf_slang_LIBS3" | sed -e "s@$cf_exclude@@" -e 's@^.@@'` cat > conftest.$ac_ext <<EOF -#line 5347 "configure" +#line 4900 "configure" #include "confdefs.h" #include <slang.h> int main() { SLtt_get_screen_size() ; return 0; } EOF -if { (eval echo configure:5354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_result=yes else @@ -5370,7 +4923,7 @@ eval cf_libdir=$libdir cf_libdir=`echo $cf_libdir | sed -e s@'^NONE/'@$prefix/@ -e s@'^NONE/'@$ac_default_prefix/@` echo $ac_n "checking for location of config-file""... $ac_c" 1>&6 -echo "configure:5374: checking for location of config-file" >&5 +echo "configure:4927: checking for location of config-file" >&5 LYNX_CFG_FILE=$cf_libdir/lynx.cfg cat >> confdefs.h <<EOF #define LYNX_CFG_FILE "$LYNX_CFG_FILE" @@ -5380,12 +4933,12 @@ echo "$ac_t""$LYNX_CFG_FILE" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:5384: checking for ANSI C header files" >&5 +echo "configure:4937: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5389 "configure" +#line 4942 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -5393,7 +4946,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5397: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5410,7 +4963,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 5414 "configure" +#line 4967 "configure" #include "confdefs.h" #include <string.h> EOF @@ -5428,7 +4981,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 5432 "configure" +#line 4985 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -5449,7 +5002,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 5453 "configure" +#line 5006 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -5460,7 +5013,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:5464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -5484,12 +5037,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:5488: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:5041: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5493 "configure" +#line 5046 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -5498,7 +5051,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:5502: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -5523,12 +5076,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:5527: checking for $ac_hdr that defines DIR" >&5 +echo "configure:5080: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5532 "configure" +#line 5085 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -5536,7 +5089,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:5540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -5561,7 +5114,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:5565: checking for opendir in -ldir" >&5 +echo "configure:5118: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5569,7 +5122,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 5573 "configure" +#line 5126 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5580,7 +5133,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:5584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5602,7 +5155,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:5606: checking for opendir in -lx" >&5 +echo "configure:5159: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5610,7 +5163,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 5614 "configure" +#line 5167 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5621,7 +5174,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:5625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5660,17 +5213,17 @@ for ac_hdr in \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5664: checking for $ac_hdr" >&5 +echo "configure:5217: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5669 "configure" +#line 5222 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5674: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5227: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5698,13 +5251,13 @@ done echo $ac_n "checking termio.h and termios.h""... $ac_c" 1>&6 -echo "configure:5702: checking termio.h and termios.h" >&5 +echo "configure:5255: checking termio.h and termios.h" >&5 if eval "test \"`echo '$''{'cf_cv_termio_and_termios'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5708 "configure" +#line 5261 "configure" #include "confdefs.h" #if HAVE_TERMIO_H @@ -5717,7 +5270,7 @@ int main() { putchar (0x0a) ; return 0; } EOF -if { (eval echo configure:5721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5274: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_termio_and_termios=yes else @@ -5740,17 +5293,17 @@ for ac_hdr in sys/wait.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5744: checking for $ac_hdr" >&5 +echo "configure:5297: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5749 "configure" +#line 5302 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5787,17 +5340,17 @@ for ac_hdr in wait.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5791: checking for $ac_hdr" >&5 +echo "configure:5344: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5796 "configure" +#line 5349 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5354: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5827,17 +5380,17 @@ for ac_hdr in waitstatus.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5831: checking for $ac_hdr" >&5 +echo "configure:5384: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5836 "configure" +#line 5389 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5841: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5394: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5878,13 +5431,13 @@ fi echo $ac_n "checking for union wait""... $ac_c" 1>&6 -echo "configure:5882: checking for union wait" >&5 +echo "configure:5435: checking for union wait" >&5 if eval "test \"`echo '$''{'cf_cv_type_unionwait'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5888 "configure" +#line 5441 "configure" #include "confdefs.h" $cf_wait_headers int main() { @@ -5895,7 +5448,7 @@ int x; ; return 0; } EOF -if { (eval echo configure:5899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_type_unionwait=no echo compiles ok w/o union wait 1>&5 @@ -5906,7 +5459,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 5910 "configure" +#line 5463 "configure" #include "confdefs.h" $cf_wait_headers int main() { @@ -5921,7 +5474,7 @@ union wait x; ; return 0; } EOF -if { (eval echo configure:5925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_type_unionwait=yes echo compiles ok with union wait and possibly macros too 1>&5 @@ -5948,20 +5501,20 @@ EOF if test $cf_cv_type_unionwait = yes; then echo $ac_n "checking if union wait can be used as wait-arg""... $ac_c" 1>&6 -echo "configure:5952: checking if union wait can be used as wait-arg" >&5 +echo "configure:5505: checking if union wait can be used as wait-arg" >&5 if eval "test \"`echo '$''{'cf_cv_arg_union_wait'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5958 "configure" +#line 5511 "configure" #include "confdefs.h" $cf_wait_headers int main() { union wait x; wait(&x) ; return 0; } EOF -if { (eval echo configure:5965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_arg_union_wait=yes else @@ -5981,20 +5534,20 @@ EOF echo $ac_n "checking if union wait can be used as waitpid-arg""... $ac_c" 1>&6 -echo "configure:5985: checking if union wait can be used as waitpid-arg" >&5 +echo "configure:5538: checking if union wait can be used as waitpid-arg" >&5 if eval "test \"`echo '$''{'cf_cv_arg_union_waitpid'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5991 "configure" +#line 5544 "configure" #include "confdefs.h" $cf_wait_headers int main() { union wait x; waitpid(0, &x, 0) ; return 0; } EOF -if { (eval echo configure:5998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5551: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_arg_union_waitpid=yes else @@ -6015,118 +5568,48 @@ EOF fi -echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:6020: checking for uid_t in sys/types.h" >&5 -if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then +echo $ac_n "checking for mode_t""... $ac_c" 1>&6 +echo "configure:5573: checking for mode_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6025 "configure" +#line 5578 "configure" #include "confdefs.h" #include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "uid_t" >/dev/null 2>&1; then + egrep "mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* - ac_cv_type_uid_t=yes + ac_cv_type_mode_t=yes else rm -rf conftest* - ac_cv_type_uid_t=no + ac_cv_type_mode_t=no fi rm -f conftest* fi - -echo "$ac_t""$ac_cv_type_uid_t" 1>&6 -if test $ac_cv_type_uid_t = no; then - cat >> confdefs.h <<\EOF -#define uid_t int -EOF - +echo "$ac_t""$ac_cv_type_mode_t" 1>&6 +if test $ac_cv_type_mode_t = no; then cat >> confdefs.h <<\EOF -#define gid_t int -EOF - -fi - -echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:6054: checking type of array argument to getgroups" >&5 -if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_type_getgroups=cross -else - cat > conftest.$ac_ext <<EOF -#line 6062 "configure" -#include "confdefs.h" - -/* Thanks to Mike Rendell for this test. */ -#include <sys/types.h> -#define NGID 256 -#undef MAX -#define MAX(x, y) ((x) > (y) ? (x) : (y)) -main() -{ - gid_t gidset[NGID]; - int i, n; - union { gid_t gval; long lval; } val; - - val.lval = -1; - for (i = 0; i < NGID; i++) - gidset[i] = val.gval; - n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, - gidset); - /* Exit non-zero if getgroups seems to require an array of ints. This - happens when gid_t is short but getgroups modifies an array of ints. */ - exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); -} - -EOF -if { (eval echo configure:6087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - ac_cv_type_getgroups=gid_t -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_type_getgroups=int -fi -rm -fr conftest* -fi - -if test $ac_cv_type_getgroups = cross; then - cat > conftest.$ac_ext <<EOF -#line 6101 "configure" -#include "confdefs.h" -#include <unistd.h> +#define mode_t int EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "getgroups.*int.*gid_t" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_getgroups=gid_t -else - rm -rf conftest* - ac_cv_type_getgroups=int -fi -rm -f conftest* fi -fi -echo "$ac_t""$ac_cv_type_getgroups" 1>&6 -cat >> confdefs.h <<EOF -#define GETGROUPS_T $ac_cv_type_getgroups -EOF echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:6125: checking for pid_t" >&5 +echo "configure:5608: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6130 "configure" +#line 5613 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -6153,88 +5636,19 @@ EOF fi -echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:6158: checking for uid_t in sys/types.h" >&5 -if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 6163 "configure" -#include "confdefs.h" -#include <sys/types.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "uid_t" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_uid_t=yes -else - rm -rf conftest* - ac_cv_type_uid_t=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_type_uid_t" 1>&6 -if test $ac_cv_type_uid_t = no; then - cat >> confdefs.h <<\EOF -#define uid_t int -EOF - - cat >> confdefs.h <<\EOF -#define gid_t int -EOF - -fi - -echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:6192: checking for mode_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 6197 "configure" -#include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_mode_t=yes -else - rm -rf conftest* - ac_cv_type_mode_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_mode_t" 1>&6 -if test $ac_cv_type_mode_t = no; then - cat >> confdefs.h <<\EOF -#define mode_t int -EOF - -fi - - - ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:6228: checking for vfork.h" >&5 +echo "configure:5642: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6233 "configure" +#line 5647 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6238: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -6259,18 +5673,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:6263: checking for working vfork" >&5 +echo "configure:5677: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:6269: checking for vfork" >&5 +echo "configure:5683: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6274 "configure" +#line 5688 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -6293,7 +5707,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:6297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -6314,7 +5728,7 @@ fi else cat > conftest.$ac_ext <<EOF -#line 6318 "configure" +#line 5732 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -6409,7 +5823,7 @@ main() { } } EOF -if { (eval echo configure:6413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -6433,13 +5847,13 @@ fi echo $ac_n "checking if we should use fcntl or ioctl""... $ac_c" 1>&6 -echo "configure:6437: checking if we should use fcntl or ioctl" >&5 +echo "configure:5851: checking if we should use fcntl or ioctl" >&5 if eval "test \"`echo '$''{'cf_cv_fionbio'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6443 "configure" +#line 5857 "configure" #include "confdefs.h" #include <sys/types.h> @@ -6451,7 +5865,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_fionbio=ioctl else @@ -6460,7 +5874,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 6464 "configure" +#line 5878 "configure" #include "confdefs.h" #include <sys/types.h> @@ -6477,7 +5891,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_fionbio=fcntl else @@ -6500,20 +5914,20 @@ EOF echo $ac_n "checking for broken/missing definition of remove""... $ac_c" 1>&6 -echo "configure:6504: checking for broken/missing definition of remove" >&5 +echo "configure:5918: checking for broken/missing definition of remove" >&5 if eval "test \"`echo '$''{'cf_cv_baddef_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6510 "configure" +#line 5924 "configure" #include "confdefs.h" #include <stdio.h> int main() { remove("dummy") ; return 0; } EOF -if { (eval echo configure:6517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_baddef_remove=no else @@ -6521,7 +5935,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 6525 "configure" +#line 5939 "configure" #include "confdefs.h" #include <stdio.h> int __unlink(name) { return unlink(name); } @@ -6529,7 +5943,7 @@ int main() { remove("dummy") ; return 0; } EOF -if { (eval echo configure:6533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_baddef_remove=yes else @@ -6553,13 +5967,13 @@ EOF echo $ac_n "checking for lstat""... $ac_c" 1>&6 -echo "configure:6557: checking for lstat" >&5 +echo "configure:5971: checking for lstat" >&5 if eval "test \"`echo '$''{'ac_cv_func_lstat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6563 "configure" +#line 5977 "configure" #include "confdefs.h" #include <sys/types.h> @@ -6568,7 +5982,7 @@ int main() { lstat(".", (struct stat *)0) ; return 0; } EOF -if { (eval echo configure:6572: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_lstat=yes else @@ -6600,12 +6014,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6604: checking for $ac_func" >&5 +echo "configure:6018: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6609 "configure" +#line 6023 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6628,7 +6042,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6658,12 +6072,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6662: checking for $ac_func" >&5 +echo "configure:6076: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6667 "configure" +#line 6081 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6686,7 +6100,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6717,12 +6131,12 @@ for ac_func in strstr do echo $ac_n "checking for $ac_func declaration""... $ac_c" 1>&6 -echo "configure:6721: checking for $ac_func declaration" >&5 +echo "configure:6135: checking for $ac_func declaration" >&5 if eval "test \"`echo '$''{'ac_cv_func_decl_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6726 "configure" +#line 6140 "configure" #include "confdefs.h" #include <string.h> int main() { @@ -6731,11 +6145,11 @@ extern int ${ac_func}(); #endif ; return 0; } EOF -if { (eval echo configure:6735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 6739 "configure" +#line 6153 "configure" #include "confdefs.h" #include <string.h> int main() { @@ -6744,7 +6158,7 @@ int (*p)() = ${ac_func}; #endif ; return 0; } EOF -if { (eval echo configure:6748: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_decl_$ac_func=yes" @@ -6786,12 +6200,12 @@ for ac_func in getgrgid getgrnam do echo $ac_n "checking for $ac_func declaration""... $ac_c" 1>&6 -echo "configure:6790: checking for $ac_func declaration" >&5 +echo "configure:6204: checking for $ac_func declaration" >&5 if eval "test \"`echo '$''{'ac_cv_func_decl_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6795 "configure" +#line 6209 "configure" #include "confdefs.h" #include <stdio.h> @@ -6802,11 +6216,11 @@ extern int ${ac_func}(); #endif ; return 0; } EOF -if { (eval echo configure:6806: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6220: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 6810 "configure" +#line 6224 "configure" #include "confdefs.h" #include <stdio.h> @@ -6817,7 +6231,7 @@ int (*p)() = ${ac_func}; #endif ; return 0; } EOF -if { (eval echo configure:6821: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6235: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_decl_$ac_func=yes" @@ -6859,22 +6273,22 @@ done echo $ac_n "checking if TRUE/FALSE are defined""... $ac_c" 1>&6 -echo "configure:6863: checking if TRUE/FALSE are defined" >&5 +echo "configure:6277: checking if TRUE/FALSE are defined" >&5 if eval "test \"`echo '$''{'cf_cv_bool_defs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6869 "configure" +#line 6283 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_cv_ncurses_header> #include <stdio.h> int main() { int x = TRUE, y = FALSE ; return 0; } EOF -if { (eval echo configure:6878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6292: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_bool_defs=yes else @@ -6901,13 +6315,13 @@ fi echo $ac_n "checking declaration of errno""... $ac_c" 1>&6 -echo "configure:6905: checking declaration of errno" >&5 +echo "configure:6319: checking declaration of errno" >&5 if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6911 "configure" +#line 6325 "configure" #include "confdefs.h" #if HAVE_STDLIB_H @@ -6920,7 +6334,7 @@ int main() { long x = (long) errno ; return 0; } EOF -if { (eval echo configure:6924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6338: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval 'cf_cv_dcl_'errno'=yes' else @@ -6950,9 +6364,9 @@ cf_result=`echo $cf_result | tr '[a-z]' '[A-Z]'` EOF echo $ac_n "checking existence of errno""... $ac_c" 1>&6 -echo "configure:6954: checking existence of errno" >&5 +echo "configure:6368: checking existence of errno" >&5 cat > conftest.$ac_ext <<EOF -#line 6956 "configure" +#line 6370 "configure" #include "confdefs.h" #undef errno @@ -6962,7 +6376,7 @@ int main() { errno = 2 ; return 0; } EOF -if { (eval echo configure:6966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval 'cf_cv_have_'errno'=yes' else @@ -6992,20 +6406,20 @@ EOF echo $ac_n "checking for setlocale()""... $ac_c" 1>&6 -echo "configure:6996: checking for setlocale()" >&5 +echo "configure:6410: checking for setlocale()" >&5 if eval "test \"`echo '$''{'cf_cv_locale'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7002 "configure" +#line 6416 "configure" #include "confdefs.h" #include <locale.h> int main() { setlocale(LC_ALL, "") ; return 0; } EOF -if { (eval echo configure:7009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_locale=yes else @@ -7026,13 +6440,13 @@ EOF echo $ac_n "checking if NGROUPS is defined""... $ac_c" 1>&6 -echo "configure:7030: checking if NGROUPS is defined" >&5 +echo "configure:6444: checking if NGROUPS is defined" >&5 if eval "test \"`echo '$''{'cf_cv_ngroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7036 "configure" +#line 6450 "configure" #include "confdefs.h" #if HAVE_SYS_PARAM_H @@ -7046,7 +6460,7 @@ int main() { int x = NGROUPS ; return 0; } EOF -if { (eval echo configure:7050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ngroups=yes else @@ -7054,7 +6468,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 7058 "configure" +#line 6472 "configure" #include "confdefs.h" #if HAVE_SYS_PARAM_H @@ -7068,7 +6482,7 @@ int main() { int x = NGROUPS_MAX ; return 0; } EOF -if { (eval echo configure:7072: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6486: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ngroups=NGROUPS_MAX else @@ -7102,13 +6516,13 @@ for cf_name in sys_nerr sys_errlist do echo $ac_n "checking declaration of $cf_name""... $ac_c" 1>&6 -echo "configure:7106: checking declaration of $cf_name" >&5 +echo "configure:6520: checking declaration of $cf_name" >&5 if eval "test \"`echo '$''{'cf_cv_dcl_$cf_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7112 "configure" +#line 6526 "configure" #include "confdefs.h" #if HAVE_STDLIB_H @@ -7121,7 +6535,7 @@ int main() { long x = (long) $cf_name ; return 0; } EOF -if { (eval echo configure:7125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval 'cf_cv_dcl_'$cf_name'=yes' else @@ -7151,9 +6565,9 @@ cf_result=`echo $cf_result | tr '[a-z]' '[A-Z]'` EOF echo $ac_n "checking existence of $cf_name""... $ac_c" 1>&6 -echo "configure:7155: checking existence of $cf_name" >&5 +echo "configure:6569: checking existence of $cf_name" >&5 cat > conftest.$ac_ext <<EOF -#line 7157 "configure" +#line 6571 "configure" #include "confdefs.h" #undef $cf_name @@ -7163,7 +6577,7 @@ int main() { $cf_name = 2 ; return 0; } EOF -if { (eval echo configure:7167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval 'cf_cv_have_'$cf_name'=yes' else @@ -7194,13 +6608,13 @@ done echo $ac_n "checking if struct utmp is declared""... $ac_c" 1>&6 -echo "configure:7198: checking if struct utmp is declared" >&5 +echo "configure:6612: checking if struct utmp is declared" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7204 "configure" +#line 6618 "configure" #include "confdefs.h" #include <sys/types.h> @@ -7209,7 +6623,7 @@ int main() { struct utmp x; char *y = &x.ut_host[0] ; return 0; } EOF -if { (eval echo configure:7213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp=yes else @@ -7217,14 +6631,14 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 7221 "configure" +#line 6635 "configure" #include "confdefs.h" #include <utmpx.h> int main() { struct utmpx x; char *y = &x.ut_host[0] ; return 0; } EOF -if { (eval echo configure:7228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp=utmpx else @@ -7255,27 +6669,24 @@ EOF if test $cf_cv_screen != slang ; then echo $ac_n "checking if curses supports alternate-character set""... $ac_c" 1>&6 -echo "configure:7259: checking if curses supports alternate-character set" >&5 +echo "configure:6673: checking if curses supports alternate-character set" >&5 if eval "test \"`echo '$''{'cf_cv_alt_char_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else -for mapname in acs_map _acs_map -do cat > conftest.$ac_ext <<EOF -#line 7267 "configure" +#line 6679 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_cv_ncurses_header> int main() { -chtype x = $mapname['l']; $mapname['m'] = 0 +chtype x = acs_map['l']; acs_map['m'] = 0 ; return 0; } EOF -if { (eval echo configure:7276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - cf_cv_alt_char_set=$mapname - break + cf_cv_alt_char_set=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -7283,28 +6694,26 @@ else cf_cv_alt_char_set=no fi rm -f conftest* -done - fi echo "$ac_t""$cf_cv_alt_char_set" 1>&6 -test $cf_cv_alt_char_set != no && cat >> confdefs.h <<EOF -#define ALT_CHAR_SET $cf_cv_alt_char_set +test $cf_cv_alt_char_set = yes && cat >> confdefs.h <<\EOF +#define ALT_CHAR_SET 1 EOF echo $ac_n "checking if curses supports fancy attributes""... $ac_c" 1>&6 -echo "configure:7299: checking if curses supports fancy attributes" >&5 +echo "configure:6708: checking if curses supports fancy attributes" >&5 if eval "test \"`echo '$''{'cf_cv_fancy_curses'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7305 "configure" +#line 6714 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_cv_ncurses_header> int main() { attrset(A_UNDERLINE|A_BOLD|A_REVERSE); @@ -7314,7 +6723,7 @@ attrset(A_UNDERLINE|A_BOLD|A_REVERSE); ; return 0; } EOF -if { (eval echo configure:7318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_fancy_curses=yes else @@ -7334,7 +6743,7 @@ EOF echo $ac_n "checking for ncurses version""... $ac_c" 1>&6 -echo "configure:7338: checking for ncurses version" >&5 +echo "configure:6747: checking for ncurses version" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7359,7 +6768,7 @@ Autoconf "old" #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" - { (eval echo configure:7363: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } + { (eval echo configure:6772: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } if test -f conftest.out ; then cf_out=`cat conftest.out | sed -e 's@^Autoconf @@' -e 's@^[^"]*"@@' -e 's@".*@@'` test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" @@ -7368,7 +6777,7 @@ EOF else cat > conftest.$ac_ext <<EOF -#line 7372 "configure" +#line 6781 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header-curses.h}> @@ -7391,7 +6800,7 @@ int main() exit(0); } EOF -if { (eval echo configure:7395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then cf_cv_ncurses_version=`cat $cf_tempfile` @@ -7411,16 +6820,16 @@ echo "$ac_t""$cf_cv_ncurses_version" 1>&6 if test "$cf_cv_ncurses_version" != no ; then echo $ac_n "checking for obsolete/broken version of ncurses""... $ac_c" 1>&6 -echo "configure:7415: checking for obsolete/broken version of ncurses" >&5 +echo "configure:6824: checking for obsolete/broken version of ncurses" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7421 "configure" +#line 6830 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_cv_ncurses_header> int main() { #if defined(NCURSES_VERSION) && defined(wgetbkgd) @@ -7431,7 +6840,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:7435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6844: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ncurses_broken=no else @@ -7456,13 +6865,13 @@ fi echo $ac_n "checking if curses supports color attributes""... $ac_c" 1>&6 -echo "configure:7460: checking if curses supports color attributes" >&5 +echo "configure:6869: checking if curses supports color attributes" >&5 if eval "test \"`echo '$''{'cf_cv_color_curses'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7466 "configure" +#line 6875 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header-curses.h}> @@ -7477,7 +6886,7 @@ chtype x = COLOR_BLUE; ; return 0; } EOF -if { (eval echo configure:7481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_color_curses=yes else @@ -7504,7 +6913,7 @@ fi echo $ac_n "checking declaration of size-change""... $ac_c" 1>&6 -echo "configure:7508: checking declaration of size-change" >&5 +echo "configure:6917: checking declaration of size-change" >&5 if eval "test \"`echo '$''{'cf_cv_sizechange'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7518,7 +6927,7 @@ do CFLAGS="$cf_save_CFLAGS" test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts" cat > conftest.$ac_ext <<EOF -#line 7522 "configure" +#line 6931 "configure" #include "confdefs.h" #include <sys/types.h> #if HAVE_TERMIOS_H @@ -7557,7 +6966,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:7561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sizechange=yes else @@ -7589,20 +6998,20 @@ EOF echo $ac_n "checking if ttytype is declared in curses library""... $ac_c" 1>&6 -echo "configure:7593: checking if ttytype is declared in curses library" >&5 +echo "configure:7002: checking if ttytype is declared in curses library" >&5 if eval "test \"`echo '$''{'cf_cv_have_ttytype'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7599 "configure" +#line 7008 "configure" #include "confdefs.h" -#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_cv_ncurses_header> int main() { char *x = &ttytype[1]; *x = 1 ; return 0; } EOF -if { (eval echo configure:7606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cf_cv_have_ttytype=yes else @@ -7623,19 +7032,18 @@ EOF for ac_func in \ cbreak \ - define_key \ keypad \ use_default_colors \ wborder \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7634: checking for $ac_func" >&5 +echo "configure:7042: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7639 "configure" +#line 7047 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7658,7 +7066,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7687,104 +7095,32 @@ fi -echo $ac_n "checking if new-style forms-based options screen should be used""... $ac_c" 1>&6 -echo "configure:7692: checking if new-style forms-based options screen should be used" >&5 - -# Check whether --enable-forms-options or --disable-forms-options was given. -if test "${enable_forms_options+set}" = set; then - enableval="$enable_forms_options" - test "$enableval" != no && enableval=yes - if test "$enableval" != "yes" ; then - use_forms_options=$enableval - else - use_forms_options=yes - fi -else - enableval=yes - use_forms_options=yes - -fi - -echo "$ac_t""$use_forms_options" 1>&6 -test $use_forms_options = no && cat >> confdefs.h <<\EOF -#define NO_OPTION_FORMS 1 -EOF - - -echo $ac_n "checking if old-style options menu should be used""... $ac_c" 1>&6 -echo "configure:7716: checking if old-style options menu should be used" >&5 - -# Check whether --enable-menu-options or --disable-menu-options was given. -if test "${enable_menu_options+set}" = set; then - enableval="$enable_menu_options" - test "$enableval" != no && enableval=yes - if test "$enableval" != "yes" ; then - use_menu_options=$enableval - else - use_menu_options=yes - fi -else - enableval=yes - use_menu_options=yes - -fi - -echo "$ac_t""$use_menu_options" 1>&6 -test $use_menu_options = no && cat >> confdefs.h <<\EOF -#define NO_OPTION_MENU 1 -EOF +echo $ac_n "checking if experimental 8-bit case-conversion should be used""... $ac_c" 1>&6 +echo "configure:7100: checking if experimental 8-bit case-conversion should be used" >&5 - -echo $ac_n "checking if configuration info should be browsable""... $ac_c" 1>&6 -echo "configure:7740: checking if configuration info should be browsable" >&5 - -# Check whether --enable-config-info or --disable-config-info was given. -if test "${enable_config_info+set}" = set; then - enableval="$enable_config_info" - test "$enableval" != no && enableval=yes - if test "$enableval" != "yes" ; then - use_config_info=$enableval - else - use_config_info=yes - fi -else - enableval=yes - use_config_info=yes - -fi - -echo "$ac_t""$use_config_info" 1>&6 -test $use_config_info = no && cat >> confdefs.h <<\EOF -#define NO_CONFIG_INFO 1 -EOF - - -echo $ac_n "checking if experimental persistent-cookie logic should be used""... $ac_c" 1>&6 -echo "configure:7764: checking if experimental persistent-cookie logic should be used" >&5 - -# Check whether --enable-persistent-cookies or --disable-persistent-cookies was given. -if test "${enable_persistent_cookies+set}" = set; then - enableval="$enable_persistent_cookies" +# Check whether --enable-8bit-toupper or --disable-8bit-toupper was given. +if test "${enable_8bit_toupper+set}" = set; then + enableval="$enable_8bit_toupper" test "$enableval" != yes && enableval=no if test "$enableval" != "no" ; then - use_filed_cookies=$enableval + use_8bit_toupper=$enableval else - use_filed_cookies=no + use_8bit_toupper=no fi else enableval=no - use_filed_cookies=no + use_8bit_toupper=no fi -echo "$ac_t""$use_filed_cookies" 1>&6 -test $use_filed_cookies != no && cat >> confdefs.h <<\EOF -#define EXP_PERSISTENT_COOKIES 1 +echo "$ac_t""$use_8bit_toupper" 1>&6 +test $use_8bit_toupper != no && cat >> confdefs.h <<\EOF +#define EXP_8BIT_TOUPPER 1 EOF echo $ac_n "checking if color-style code should be used""... $ac_c" 1>&6 -echo "configure:7788: checking if color-style code should be used" >&5 +echo "configure:7124: checking if color-style code should be used" >&5 # Check whether --enable-color-style or --disable-color-style was given. if test "${enable_color_style+set}" = set; then @@ -7832,7 +7168,7 @@ EOF echo "$ac_t""yes" 1>&6 echo $ac_n "checking for location of style-sheet file""... $ac_c" 1>&6 -echo "configure:7836: checking for location of style-sheet file" >&5 +echo "configure:7172: checking for location of style-sheet file" >&5 LYNX_LSS_FILE=$cf_libdir/lynx.lss cat >> confdefs.h <<EOF #define LYNX_LSS_FILE "$LYNX_LSS_FILE" @@ -7844,37 +7180,13 @@ EOF esac -echo $ac_n "checking if partial-display should be used""... $ac_c" 1>&6 -echo "configure:7849: checking if partial-display should be used" >&5 - -# Check whether --enable-partial or --disable-partial was given. -if test "${enable_partial+set}" = set; then - enableval="$enable_partial" - test "$enableval" != no && enableval=yes - if test "$enableval" != "yes" ; then - use_partial_display=$enableval - else - use_partial_display=yes - fi -else - enableval=yes - use_partial_display=yes - -fi - -echo "$ac_t""$use_partial_display" 1>&6 -test $use_partial_display != no && cat >> confdefs.h <<\EOF -#define DISP_PARTIAL 1 -EOF - - use_dft_colors=no test ".$cf_cv_screen" = ".slang" && use_dft_colors=maybe test ".$ac_cv_func_use_default_colors" = ".yes" && use_dft_colors=maybe if test "$use_dft_colors" != no ; then echo $ac_n "checking if you want to use default-colors""... $ac_c" 1>&6 -echo "configure:7878: checking if you want to use default-colors" >&5 +echo "configure:7190: checking if you want to use default-colors" >&5 # Check whether --enable-default-colors or --disable-default-colors was given. if test "${enable_default_colors+set}" = set; then @@ -7899,7 +7211,7 @@ EOF fi echo $ac_n "checking if you want to use extended HTML DTD logic""... $ac_c" 1>&6 -echo "configure:7903: checking if you want to use extended HTML DTD logic" >&5 +echo "configure:7215: checking if you want to use extended HTML DTD logic" >&5 # Check whether --enable-extended-dtd or --disable-extended-dtd was given. if test "${enable_extended_dtd+set}" = set; then @@ -7923,7 +7235,7 @@ EOF echo $ac_n "checking if you want to use external commands""... $ac_c" 1>&6 -echo "configure:7927: checking if you want to use external commands" >&5 +echo "configure:7239: checking if you want to use external commands" >&5 # Check whether --enable-externs or --disable-externs was given. if test "${enable_externs+set}" = set; then @@ -7947,7 +7259,7 @@ EOF echo $ac_n "checking if you want to use setfont support""... $ac_c" 1>&6 -echo "configure:7951: checking if you want to use setfont support" >&5 +echo "configure:7263: checking if you want to use setfont support" >&5 # Check whether --enable-font-switch or --disable-font-switch was given. if test "${enable_font_switch+set}" = set; then @@ -7970,65 +7282,8 @@ test $use_setfont = yes && cat >> confdefs.h <<\EOF EOF -echo $ac_n "checking if you want cgi-link support""... $ac_c" 1>&6 -echo "configure:7975: checking if you want cgi-link support" >&5 - -# Check whether --enable-cgi-links or --disable-cgi-links was given. -if test "${enable_cgi_links+set}" = set; then - enableval="$enable_cgi_links" - test "$enableval" != yes && enableval=no - if test "$enableval" != "no" ; then - cat >> confdefs.h <<\EOF -#define LYNXCGI_LINKS 1 -EOF - - fi -else - enableval=no -fi - -echo "$ac_t""$enableval" 1>&6 - -echo $ac_n "checking if you want exec-links support""... $ac_c" 1>&6 -echo "configure:7994: checking if you want exec-links support" >&5 - -# Check whether --enable-exec-links or --disable-exec-links was given. -if test "${enable_exec_links+set}" = set; then - enableval="$enable_exec_links" - test "$enableval" != yes && enableval=no - if test "$enableval" != "no" ; then - cat >> confdefs.h <<\EOF -#define EXEC_LINKS 1 -EOF - - fi -else - enableval=no -fi - -echo "$ac_t""$enableval" 1>&6 - -echo $ac_n "checking if you want exec-scripts support""... $ac_c" 1>&6 -echo "configure:8013: checking if you want exec-scripts support" >&5 - -# Check whether --enable-exec-scripts or --disable-exec-scripts was given. -if test "${enable_exec_scripts+set}" = set; then - enableval="$enable_exec_scripts" - test "$enableval" != yes && enableval=no - if test "$enableval" != "no" ; then - cat >> confdefs.h <<\EOF -#define EXEC_SCRIPTS 1 -EOF - - fi -else - enableval=no -fi - -echo "$ac_t""$enableval" 1>&6 - echo $ac_n "checking if you want internal-links feature""... $ac_c" 1>&6 -echo "configure:8032: checking if you want internal-links feature" >&5 +echo "configure:7287: checking if you want internal-links feature" >&5 # Check whether --enable-internal-links or --disable-internal-links was given. if test "${enable_internal_links+set}" = set; then @@ -8052,7 +7307,7 @@ EOF echo $ac_n "checking if you want to fork NSL requests""... $ac_c" 1>&6 -echo "configure:8056: checking if you want to fork NSL requests" >&5 +echo "configure:7311: checking if you want to fork NSL requests" >&5 # Check whether --enable-nsl-fork or --disable-nsl-fork was given. if test "${enable_nsl_fork+set}" = set; then @@ -8075,32 +7330,8 @@ test $use_nsl_fork = yes && cat >> confdefs.h <<\EOF EOF -echo $ac_n "checking if you want to log URL requests via syslog""... $ac_c" 1>&6 -echo "configure:8080: checking if you want to log URL requests via syslog" >&5 - -# Check whether --enable-syslog or --disable-syslog was given. -if test "${enable_syslog+set}" = set; then - enableval="$enable_syslog" - test "$enableval" != yes && enableval=no - if test "$enableval" != "no" ; then - use_syslog=yes - else - use_syslog=no - fi -else - enableval=no - use_syslog=no - -fi - -echo "$ac_t""$use_syslog" 1>&6 -test $use_syslog = yes && cat >> confdefs.h <<\EOF -#define SYSLOG_REQUESTED_URLS 1 -EOF - - echo $ac_n "checking if you want to underline links""... $ac_c" 1>&6 -echo "configure:8104: checking if you want to underline links" >&5 +echo "configure:7335: checking if you want to underline links" >&5 # Check whether --enable-underlines or --disable-underlines was given. if test "${enable_underlines+set}" = set; then @@ -8123,37 +7354,8 @@ test $use_underline = yes && cat >> confdefs.h <<\EOF EOF -echo $ac_n "checking if help files should be gzip'ed""... $ac_c" 1>&6 -echo "configure:8128: checking if help files should be gzip'ed" >&5 - -# Check whether --enable-gzip-help or --disable-gzip-help was given. -if test "${enable_gzip_help+set}" = set; then - enableval="$enable_gzip_help" - test "$enableval" != yes && enableval=no - if test "$enableval" != "no" ; then - use_gzip_help=$enableval - else - use_gzip_help=no - fi -else - enableval=no - use_gzip_help=no - -fi - -echo "$ac_t""$use_gzip_help" 1>&6 - -COMPRESS_PROG= -COMPRESS_EXT= -if test $use_gzip_help = yes ; then - COMPRESS_PROG=$ac_cv_path_GZIP - COMPRESS_EXT=.gz -fi - - - echo $ac_n "checking if you want to use zlib for decompression of some gzip files""... $ac_c" 1>&6 -echo "configure:8157: checking if you want to use zlib for decompression of some gzip files" >&5 +echo "configure:7359: checking if you want to use zlib for decompression of some gzip files" >&5 # Check whether --with-zlib or --without-zlib was given. if test "${with_zlib+set}" = set; then @@ -8170,12 +7372,12 @@ if test ".$use_zlib" != ".no" ; then cf_cv_have_lib_z=no cf_libdir="" echo $ac_n "checking for gzopen""... $ac_c" 1>&6 -echo "configure:8174: checking for gzopen" >&5 +echo "configure:7376: checking for gzopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_gzopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8179 "configure" +#line 7381 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gzopen(); below. */ @@ -8198,7 +7400,7 @@ gzopen(); ; return 0; } EOF -if { (eval echo configure:8202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gzopen=yes" else @@ -8218,17 +7420,17 @@ else cf_save_LIBS="$LIBS" echo $ac_n "checking for gzopen in -lz""... $ac_c" 1>&6 -echo "configure:8222: checking for gzopen in -lz" >&5 +echo "configure:7424: checking for gzopen in -lz" >&5 LIBS="-lz $LIBS" cat > conftest.$ac_ext <<EOF -#line 8225 "configure" +#line 7427 "configure" #include "confdefs.h" #include <zlib.h> int main() { gzopen("name","mode") ; return 0; } EOF -if { (eval echo configure:8232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cf_cv_have_lib_z=yes @@ -8255,17 +7457,17 @@ test "$prefix" != /usr && cf_search="$cf_search /usr/lib /usr/lib/z" for cf_libdir in $cf_search do echo $ac_n "checking for -lz in $cf_libdir""... $ac_c" 1>&6 -echo "configure:8259: checking for -lz in $cf_libdir" >&5 +echo "configure:7461: checking for -lz in $cf_libdir" >&5 LIBS="-L$cf_libdir -lz $cf_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 8262 "configure" +#line 7464 "configure" #include "confdefs.h" #include <zlib.h> int main() { gzopen("name","mode") ; return 0; } EOF -if { (eval echo configure:8269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cf_cv_have_lib_z=yes @@ -8306,7 +7508,7 @@ fi # All DirEd functions that were enabled on compilation can be disabled # or modified at run time via DIRED_MENU symbols in lynx.cfg. echo $ac_n "checking if directory-editor code should be used""... $ac_c" 1>&6 -echo "configure:8310: checking if directory-editor code should be used" >&5 +echo "configure:7512: checking if directory-editor code should be used" >&5 # Check whether --enable-dired or --disable-dired was given. if test "${enable_dired+set}" = set; then @@ -8332,7 +7534,7 @@ EOF echo $ac_n "checking if you wish to allow extracting from archives via DirEd""... $ac_c" 1>&6 -echo "configure:8336: checking if you wish to allow extracting from archives via DirEd" >&5 +echo "configure:7538: checking if you wish to allow extracting from archives via DirEd" >&5 # Check whether --enable-dired-archive or --disable-dired-archive was given. if test "${enable_dired_archive+set}" = set; then @@ -8351,7 +7553,7 @@ fi echo "$ac_t""$enableval" 1>&6 echo $ac_n "checking if you wish to allow users to redefine DirEd keys""... $ac_c" 1>&6 -echo "configure:8355: checking if you wish to allow users to redefine DirEd keys" >&5 +echo "configure:7557: checking if you wish to allow users to redefine DirEd keys" >&5 # Check whether --enable-dired-override or --disable-dired-override was given. if test "${enable_dired_override+set}" = set; then @@ -8377,7 +7579,7 @@ fi echo "$ac_t""$enableval" 1>&6 echo $ac_n "checking if you wish to allow permissions commands via DirEd""... $ac_c" 1>&6 -echo "configure:8381: checking if you wish to allow permissions commands via DirEd" >&5 +echo "configure:7583: checking if you wish to allow permissions commands via DirEd" >&5 # Check whether --enable-dired-permit or --disable-dired-permit was given. if test "${enable_dired_permit+set}" = set; then @@ -8403,7 +7605,7 @@ fi echo "$ac_t""$enableval" 1>&6 echo $ac_n "checking if you wish to allow executable-permission commands via DirEd""... $ac_c" 1>&6 -echo "configure:8407: checking if you wish to allow executable-permission commands via DirEd" >&5 +echo "configure:7609: checking if you wish to allow executable-permission commands via DirEd" >&5 # Check whether --enable-dired-xpermit or --disable-dired-xpermit was given. if test "${enable_dired_xpermit+set}" = set; then @@ -8422,7 +7624,7 @@ fi echo "$ac_t""$enableval" 1>&6 echo $ac_n "checking if you wish to allow "tar" commands from DirEd""... $ac_c" 1>&6 -echo "configure:8426: checking if you wish to allow "tar" commands from DirEd" >&5 +echo "configure:7628: checking if you wish to allow "tar" commands from DirEd" >&5 # Check whether --enable-dired-tar or --disable-dired-tar was given. if test "${enable_dired_tar+set}" = set; then @@ -8448,7 +7650,7 @@ fi echo "$ac_t""$enableval" 1>&6 echo $ac_n "checking if you wish to allow "uudecode" commands from DirEd""... $ac_c" 1>&6 -echo "configure:8452: checking if you wish to allow "uudecode" commands from DirEd" >&5 +echo "configure:7654: checking if you wish to allow "uudecode" commands from DirEd" >&5 # Check whether --enable-dired-uudecode or --disable-dired-uudecode was given. if test "${enable_dired_uudecode+set}" = set; then @@ -8474,7 +7676,7 @@ fi echo "$ac_t""$enableval" 1>&6 echo $ac_n "checking if you wish to allow "zip" and "unzip" commands from DirEd""... $ac_c" 1>&6 -echo "configure:8478: checking if you wish to allow "zip" and "unzip" commands from DirEd" >&5 +echo "configure:7680: checking if you wish to allow "zip" and "unzip" commands from DirEd" >&5 # Check whether --enable-dired-zip or --disable-dired-zip was given. if test "${enable_dired_zip+set}" = set; then @@ -8500,7 +7702,7 @@ fi echo "$ac_t""$enableval" 1>&6 echo $ac_n "checking if you wish to allow "gzip" and "gunzip" commands from DirEd""... $ac_c" 1>&6 -echo "configure:8504: checking if you wish to allow "gzip" and "gunzip" commands from DirEd" >&5 +echo "configure:7706: checking if you wish to allow "gzip" and "gunzip" commands from DirEd" >&5 # Check whether --enable-dired-gzip or --disable-dired-gzip was given. if test "${enable_dired_gzip+set}" = set; then @@ -8527,7 +7729,7 @@ fi fi echo $ac_n "checking if you want long-directory listings""... $ac_c" 1>&6 -echo "configure:8531: checking if you want long-directory listings" >&5 +echo "configure:7733: checking if you want long-directory listings" >&5 # Check whether --enable-long-list or --disable-long-list was given. if test "${enable_long_list+set}" = set; then @@ -8553,7 +7755,7 @@ fi echo "$ac_t""$enableval" 1>&6 echo $ac_n "checking if parent-directory references are permitted""... $ac_c" 1>&6 -echo "configure:8557: checking if parent-directory references are permitted" >&5 +echo "configure:7759: checking if parent-directory references are permitted" >&5 # Check whether --enable-parent-dir-refs or --disable-parent-dir-refs was given. if test "${enable_parent_dir_refs+set}" = set; then @@ -8571,49 +7773,6 @@ fi echo "$ac_t""$enableval" 1>&6 - -echo $ac_n "checking if we can include termio.h with curses""... $ac_c" 1>&6 -echo "configure:8577: checking if we can include termio.h with curses" >&5 -if eval "test \"`echo '$''{'cf_cv_termio_and_curses'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - cf_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -DHAVE_CONFIG_H -I. -I${srcdir-.} -I${srcdir-.}/src -I${srcdir-.}/WWW/Library/Implementation" - touch lynx_cfg.h - cat > conftest.$ac_ext <<EOF -#line 8586 "configure" -#include "confdefs.h" - -#include <LYCurses.h> -#include <termio.h> -int main() { -putchar(0x0a) -; return 0; } -EOF -if { (eval echo configure:8595: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - cf_cv_termio_and_curses=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cf_cv_termio_and_curses=no -fi -rm -f conftest* - CFLAGS="$cf_save_CFLAGS" - rm -f lynx_cfg.h - -fi - -echo "$ac_t""$cf_cv_termio_and_curses" 1>&6 - -test $cf_cv_termio_and_curses = yes && cat >> confdefs.h <<\EOF -#define TERMIO_AND_CURSES 1 -EOF - - - ### Finally, build config.h and the makefiles CFLAGS="$CFLAGS $EXTRA_CFLAGS" srcdir="$srcdir" @@ -8779,7 +7938,6 @@ s%@ECHO_LD@%$ECHO_LD%g s%@RULE_CC@%$RULE_CC%g s%@SHOW_CC@%$SHOW_CC%g s%@ECHO_CC@%$ECHO_CC%g -s%@DONT_ECHO_CC@%$DONT_ECHO_CC%g s%@EXTRA_CFLAGS@%$EXTRA_CFLAGS%g s%@CHMOD@%$CHMOD%g s%@COMPRESS@%$COMPRESS%g @@ -8798,8 +7956,6 @@ s%@ZIP@%$ZIP%g s%@PROG_EXT@%$PROG_EXT%g s%@LIBOBJS@%$LIBOBJS%g s%@INSTALL_LSS@%$INSTALL_LSS%g -s%@COMPRESS_PROG@%$COMPRESS_PROG%g -s%@COMPRESS_EXT@%$COMPRESS_EXT%g s%@SRCDIR_CLEAN@%$SRCDIR_CLEAN%g CEOF diff --git a/configure.in b/configure.in index 3418d032..49051ce8 100644 --- a/configure.in +++ b/configure.in @@ -4,8 +4,6 @@ dnl by T.E.Dickey <dickey@clark.net> dnl and Jim Spath <jspath@mail.bcpl.lib.md.us> AC_PREREQ(2.12) -rm -f config.cache - AC_INIT(userdefs.h) AC_CONFIG_HEADER(lynx_cfg.h:config.hin) @@ -24,9 +22,6 @@ CF_MAKE_INCLUDE AC_PROG_INSTALL AC_CHECK_PROGS(LINT, lint alint lclint tdlint, []) -AC_AIX -AC_ISC_POSIX - dnl -------------------------------------------------------------------------- dnl Debug/development/test dnl -------------------------------------------------------------------------- @@ -36,14 +31,6 @@ Development Options:) CF_DISABLE_ECHO -# special case for WWW/* -if test -n "$ECHO_CC" ; then - DONT_ECHO_CC="$SHOW_CC ;" -else - DONT_ECHO_CC='' -fi -AC_SUBST(DONT_ECHO_CC) - AC_MSG_CHECKING(if you want to check memory-leaks) CF_ARG_ENABLE(find-leaks, [ --enable-find-leaks logic for testing memory leaks], @@ -69,17 +56,17 @@ if test "$with_debug" = "yes" ; then esac else case $host_os in - osf*) #(vi - test -z "$GCC" && CFLAGS="$CFLAGS -std1" + ultrix*|osf*) #(vi CF_STRIP_G_OPT(CFLAGS) ;; *) - CF_STRIP_G_OPT(CFLAGS) + CF_STRIP_G_OPT(CFLAGS) ;; esac fi + if test -n "$GCC" then AC_MSG_CHECKING(if you want to turn on gcc warnings) @@ -155,20 +142,19 @@ AC_C_CONST dnl Only add to this case statement things that we cannot design tests for. PROG_EXT= -TRY_CFLAGS= case $host_os in aix4*) - CFLAGS="$CFLAGS -DAIX4 -D_BSD=44 -D_AIX" + CFLAGS="$CFLAGS -DAIX4 -D_BSD=44" LIBS="$LIBS -lbsd" ;; aix*) LIBS="$LIBS -lbsd" ;; apollo*) - TRY_CFLAGS="$TRY_CFLAGS -D_BUILTINS -W0,-opt,4" + CFLAGS="$CFLAGS -D_BUILTINS -W0,-opt,4" ;; bsdi*) - CFLAGS="$CFLAGS -DBSDI" + CFLAGS="$CFLAGS -DBSDI" ;; clix*) # Tested on CLIX 3.1 (T.Dickey). The original makefile entry @@ -180,10 +166,10 @@ convex*) CFLAGS="$CFLAGS -D__STDC__ -Dunix" ;; dgux*) - CFLAGS="$CFLAGS -DDGUX" + CFLAGS="$CFLAGS -DDGUX" ;; hpux*) - CFLAGS="$CFLAGS -DSNAKE" + CFLAGS="$CFLAGS -DSNAKE" ;; isc*) # -DPOSIX_JC is necessary, else LYBookmark.c never finds out what a mode_t is. @@ -194,10 +180,10 @@ irix*) # The original makefile used the $CFLAGS option -cckr for some form # of K&R compatibility. However, this causes compilation warnings for # varargs on IRIX 5.2, and does not appear to be needed. - #removed: CFLAGS="$CFLAGS -cckr" + #removed: CFLAGS="$CFLAGS -cckr" ;; linux*) - CFLAGS="$CFLAGS -DLINUX" + CFLAGS="$CFLAGS -DLINUX" ;; next*) CFLAGS="$CFLAGS -DNEXT -DXMOSAIC_HACK" @@ -211,18 +197,13 @@ os2*) LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"` PROG_EXT=".exe" ;; -osf4*) - # The -Olimit flag (see below) is no longer available with - # Digital C 5.2, which is bundled with Digital UNIX 4.0. - CFLAGS="$CFLAGS -DDSYS5" - ;; osf*) # Increase the maximum size of functions that will be optimized. - test -z "$GCC" && TRY_CFLAGS="$TRY_CFLAGS -O -Olimit 4000" + test -z "$GCC" && CFLAGS="$CFLAGS -O -Olimit 4000" CFLAGS="$CFLAGS -DDSYS5" ;; sco3.2v5*) - test $ac_cv_prog_gcc != yes && TRY_CFLAGS="$TRY_CFLAGS -belf" + test $ac_cv_prog_gcc != yes && CC="cc -belf" ;; sco*) LIBS="$LIBS -lmalloc" @@ -257,55 +238,22 @@ sunos4*) ;; ultrix*) # Increase the maximum size of functions that will be optimized. - test -z "$GCC" && TRY_CFLAGS="$TRY_CFLAGS -O -Olimit 600 -G 7" - CFLAGS="$CFLAGS -DULTRIX" - AC_CHECK_HEADERS(cursesX.h, - [AC_DEFINE(HAVE_CURSESX_H) - cf_cv_ncurses_header=cursesX.h]) + test -z "$GCC" && CFLAGS="$CFLAGS -O -Olimit 600 -G 7" + CFLAGS="$CFLAGS -DULTRIX" + AC_CHECK_HEADERS(cursesX.h, cf_cv_ncurses_header=cursesX.h) ;; esac AC_SUBST(PROG_EXT) -dnl Collect tests for compiler options into one place -if test -n "$TRY_CFLAGS" ; then - cf_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $TRY_CFLAGS" - AC_MSG_CHECKING(if we should use compile options $TRY_CFLAGS) - AC_TRY_COMPILE([#include <stdio.h>],[FILE *fp = stdin],[cf_result=yes],[cf_result=no]) - AC_MSG_RESULT($cf_result) - test "$cf_result" = no && CFLAGS="$cf_save_CFLAGS" -fi - dnl -------------------------------------------------------------------------- dnl Checks for library configuration (added right-to-left) dnl -------------------------------------------------------------------------- -### Look for network libraries first, since some functions (such as gethostname) -### are used in a lot of places. -AC_CACHE_CHECK(if you want socks library,cf_cv_use_libsocks,[ -AC_ARG_WITH(socks, - [ --with-socks[=path] link with socks library if available], - [cf_cv_use_libsocks=$withval], - [cf_cv_use_libsocks=no]) -]) - -AC_CACHE_CHECK(if you want socks5 library,cf_cv_use_libsocks5,[ -AC_ARG_WITH(socks5, - [ --with-socks5[=path] link with socks5 library if available], - [cf_cv_use_libsocks5=$withval], - [cf_cv_use_libsocks5=no]) -]) - -if test "x$cf_cv_use_libsocks" != xno ; then - CF_SOCKS($cf_cv_use_libsocks) -elif test "x$cf_cv_use_libsocks5" != xno ; then - CF_SOCKS5($cf_cv_use_libsocks5) -else - CF_NETLIBS -fi +CF_NETLIBS +AC_MSG_CHECKING(for screen type) dnl This has to be cached, since there's a lot of interdependent tests. -AC_CACHE_CHECK(for screen type, cf_cv_screen,[ +AC_CACHE_VAL(cf_cv_screen,[ AC_ARG_WITH(screen, [ --with-screen=XXX select screen type (XXX is curses (default), ncurses or slang)], @@ -318,6 +266,7 @@ curses|ncurses|slang) ;; esac], [cf_cv_screen=curses])]) +AC_MSG_RESULT($cf_cv_screen) if test $cf_cv_screen != ncurses ; then if eval "test \"`echo '$''{'cf_cv_ncurses_header'+set}'`\" != set"; then @@ -374,9 +323,6 @@ AC_CHECK_HEADERS( \ ) CF_TERMIO_AND_TERMIOS CF_FUNC_WAIT -AC_TYPE_GETGROUPS -AC_TYPE_PID_T -AC_TYPE_UID_T AC_TYPE_MODE_T dnl -------------------------------------------------------------------------- @@ -428,7 +374,6 @@ if test $cf_cv_screen != slang ; then CF_TTYTYPE AC_CHECK_FUNCS( \ cbreak \ - define_key \ keypad \ use_default_colors \ wborder \ @@ -442,37 +387,13 @@ dnl -------------------------------------------------------------------------- CF_HELP_MESSAGE( Miscellaneous Options:) -AC_MSG_CHECKING(if new-style forms-based options screen should be used) -CF_ARG_DISABLE(forms-options, -[ --disable-forms-options disable experimental forms-based options], - [use_forms_options=$enableval], - [use_forms_options=yes]) -AC_MSG_RESULT($use_forms_options) -test $use_forms_options = no && AC_DEFINE(NO_OPTION_FORMS) - -AC_MSG_CHECKING(if old-style options menu should be used) -CF_ARG_DISABLE(menu-options, -[ --disable-menu-options disable old-style option menu], - [use_menu_options=$enableval], - [use_menu_options=yes]) -AC_MSG_RESULT($use_menu_options) -test $use_menu_options = no && AC_DEFINE(NO_OPTION_MENU) - -AC_MSG_CHECKING(if configuration info should be browsable) -CF_ARG_DISABLE(config-info, -[ --disable-config-info disable browsable configuration-info], - [use_config_info=$enableval], - [use_config_info=yes]) -AC_MSG_RESULT($use_config_info) -test $use_config_info = no && AC_DEFINE(NO_CONFIG_INFO) - -AC_MSG_CHECKING(if experimental persistent-cookie logic should be used) -CF_ARG_ENABLE(persistent-cookies, -[ --enable-persistent-cookies use experimental persistent-cookie support], - [use_filed_cookies=$enableval], - [use_filed_cookies=no]) -AC_MSG_RESULT($use_filed_cookies) -test $use_filed_cookies != no && AC_DEFINE(EXP_PERSISTENT_COOKIES) +AC_MSG_CHECKING(if experimental 8-bit case-conversion should be used) +CF_ARG_ENABLE(8bit-toupper, +[ --enable-8bit-toupper use experimental 8-bit case-conversion], + [use_8bit_toupper=$enableval], + [use_8bit_toupper=no]) +AC_MSG_RESULT($use_8bit_toupper) +test $use_8bit_toupper != no && AC_DEFINE(EXP_8BIT_TOUPPER) AC_MSG_CHECKING(if color-style code should be used) CF_ARG_ENABLE(color-style, @@ -509,14 +430,6 @@ no) esac AC_SUBST(INSTALL_LSS) -AC_MSG_CHECKING(if partial-display should be used) -CF_ARG_DISABLE(partial, -[ --disable-partial use partial-display logic], - [use_partial_display=$enableval], - [use_partial_display=yes]) -AC_MSG_RESULT($use_partial_display) -test $use_partial_display != no && AC_DEFINE(DISP_PARTIAL) - use_dft_colors=no test ".$cf_cv_screen" = ".slang" && use_dft_colors=maybe test ".$ac_cv_func_use_default_colors" = ".yes" && use_dft_colors=maybe @@ -555,27 +468,9 @@ CF_ARG_ENABLE(font-switch, AC_MSG_RESULT($use_setfont) test $use_setfont = yes && AC_DEFINE(EXP_CHARTRANS_AUTOSWITCH) -AC_MSG_CHECKING(if you want cgi-link support) -CF_ARG_ENABLE(cgi-links, -[ --enable-cgi-links support cgi links w/o a http daemon], - [AC_DEFINE(LYNXCGI_LINKS)]) -AC_MSG_RESULT($enableval) - -AC_MSG_CHECKING(if you want exec-links support) -CF_ARG_ENABLE(exec-links, -[ --enable-exec-links support cgi links w/o a http daemon], - [AC_DEFINE(EXEC_LINKS)]) -AC_MSG_RESULT($enableval) - -AC_MSG_CHECKING(if you want exec-scripts support) -CF_ARG_ENABLE(exec-scripts, -[ --enable-exec-scripts support cgi links w/o a http daemon], - [AC_DEFINE(EXEC_SCRIPTS)]) -AC_MSG_RESULT($enableval) - AC_MSG_CHECKING(if you want internal-links feature) CF_ARG_ENABLE(internal-links, -[ --enable-internal-links handle following links to same doc differently], +[ --enable-internal-links handle following links to same doc differently], [use_internal_links=yes], [use_internal_links=no]) AC_MSG_RESULT($use_internal_links) @@ -589,14 +484,6 @@ CF_ARG_ENABLE(nsl-fork, AC_MSG_RESULT($use_nsl_fork) test $use_nsl_fork = yes && AC_DEFINE(NSL_FORK) -AC_MSG_CHECKING(if you want to log URL requests via syslog) -CF_ARG_ENABLE(syslog, -[ --enable-syslog log URL requests via syslog], - [use_syslog=yes], - [use_syslog=no]) -AC_MSG_RESULT($use_syslog) -test $use_syslog = yes && AC_DEFINE(SYSLOG_REQUESTED_URLS) - AC_MSG_CHECKING(if you want to underline links) CF_ARG_ENABLE(underlines, [ --enable-underlines underline links rather than using boldface], @@ -605,22 +492,6 @@ CF_ARG_ENABLE(underlines, AC_MSG_RESULT($use_underline) test $use_underline = yes && AC_DEFINE(UNDERLINE_LINKS) -AC_MSG_CHECKING(if help files should be gzip'ed) -CF_ARG_ENABLE(gzip-help, -[ --enable-gzip-help install gzip'ed help files], - [use_gzip_help=$enableval], - [use_gzip_help=no]) -AC_MSG_RESULT($use_gzip_help) - -COMPRESS_PROG= -COMPRESS_EXT= -if test $use_gzip_help = yes ; then - COMPRESS_PROG=$ac_cv_path_GZIP - COMPRESS_EXT=.gz -fi -AC_SUBST(COMPRESS_PROG) -AC_SUBST(COMPRESS_EXT) - AC_MSG_CHECKING(if you want to use zlib for decompression of some gzip files) AC_ARG_WITH(zlib, [ --with-zlib use zlib for decompression of some gzip files], @@ -709,11 +580,6 @@ CF_ARG_DISABLE(parent-dir-refs, [AC_DEFINE(NO_PARENT_DIR_REFERENCE)]) AC_MSG_RESULT($enableval) -dnl -------------------------------------------------------------------------- -dnl Test features that rely on configure-definitions -dnl -------------------------------------------------------------------------- -CF_TERMIO_AND_CURSES(LYCurses.h) - ### Finally, build config.h and the makefiles CFLAGS="$CFLAGS $EXTRA_CFLAGS" srcdir="$srcdir" diff --git a/descrip.mms b/descrip.mms index 21f2d69d..91dde18b 100644 --- a/descrip.mms +++ b/descrip.mms @@ -97,12 +97,12 @@ lynx.exe : library exe library : Set Default [.www.library.implementation] .ifdef DEC_C - $(MMS) $(MMSQUALIFIERS) /Description = [-.VMS]DESCRIP.MMS /Macro = ($(TCPM)=1, DEC_C=1) Library + $(MMS) /Description = [-.VMS]DESCRIP.MMS /Macro = ($(TCPM)=1, DEC_C=1) Library .else .ifdef GNU_C - $(MMS) $(MMSQUALIFIERS) /Description = [-.VMS]DESCRIP.MMS /Macro = ($(TCPM)=1, GNU_C=1) Library + $(MMS) /Description = [-.VMS]DESCRIP.MMS /Macro = ($(TCPM)=1, GNU_C=1) Library .else - $(MMS) $(MMSQUALIFIERS) /Description = [-.VMS]DESCRIP.MMS /Macro = ($(TCPM)=1) Library + $(MMS) /Description = [-.VMS]DESCRIP.MMS /Macro = ($(TCPM)=1) Library .endif .endif Set Default [---] @@ -110,12 +110,12 @@ library : exe : Set Default [.src] .ifdef DEC_C - $(MMS) $(MMSQUALIFIERS) /Macro = ($(TCPM)=1, DEC_C=1) Lynx + $(MMS) /Macro = ($(TCPM)=1, DEC_C=1) Lynx .else .ifdef GNU_C - $(MMS) $(MMSQUALIFIERS) /Macro = ($(TCPM)=1, GNU_C=1) Lynx + $(MMS) /Macro = ($(TCPM)=1, GNU_C=1) Lynx .else - $(MMS) $(MMSQUALIFIERS) /Macro = ($(TCPM)=1) Lynx + $(MMS) /Macro = ($(TCPM)=1) Lynx .endif .endif Copy /NoLog /NoConfirm lynx.exe [-] @@ -124,9 +124,9 @@ exe : clean : Set Default [.www.library.implementation] - $(MMS) $(MMSQUALIFIERS) /Description = [-.VMS]DESCRIP.MMS clean + $(MMS) /Description = [-.VMS]DESCRIP.MMS clean Set Default [---] Set Default [.src] - $(MMS) $(MMSQUALIFIERS) clean + $(MMS) clean Set Default [-] - Purge /NoLog /NoConfirm diff --git a/docs/IBMPC-charsets.announce b/docs/IBMPC-charsets.announce index 3e6aa639..870abe5b 100644 --- a/docs/IBMPC-charsets.announce +++ b/docs/IBMPC-charsets.announce @@ -9,11 +9,10 @@ General Information =================== Lynx comes with built-in translation tables to map the 8-bit character codes or character entities coming in from an HTML document to their equivalent codes, -where possible, for various character sets. - -IMPORTANT: you should choose display character set in Lynx Options Menu -according to your font installed locally. Probably it would be cpXXX. Please -contact lynx-dev mailing list if you want any new codepage not listed there. +where possible, for various character sets. You should choose display +character set in Lynx Options Menu according to your font installed locally. +Please contact lynx-dev mailing list if you want any new codepage not listed +there. Note that all points of the connection between the display at your end and Lynx at the remote end must be 8-bit clean. If the high bit is being stripped at @@ -51,7 +50,7 @@ you're not. If you see box and line-drawing characters and mismatched letters and so on, you are likely displaying 7 bit data, not 8. Ensure that all points of your connection are 8-bit clean: - On any remote UNIX systems you must pass through, do + On any remote UNIX systems you must pass through, do 'stty cs8 -istrip' or 'stty pass8'. 'stty -a' should list your settings. On any remote VMS systems, do 'set terminal /eightbit'. @@ -63,9 +62,9 @@ of your connection are 8-bit clean: 8 bit, some 8-bit character sequences, including those passed by Lynx as well as those which are for your terminal type (vt100, etc.) will be processed by Procomm as ANSI screen - control codes and will most likely result in a garbled display. + control codes and will most likely result in a garbled display. Set it to 7 bit. - If going through a dialup terminal server, you may have to set the + If going through a dialup terminal server, you may have to set the terminal server itself to pass 8 bit data. How to do this varies with the make of the server, and in some cases only a system admin in charge of the box will have the authorization diff --git a/docs/README.chartrans b/docs/README.chartrans index 471d4bcc..81aedd45 100644 --- a/docs/README.chartrans +++ b/docs/README.chartrans @@ -1,22 +1,22 @@ Lynx CHARTRANS Features (in addition to those which Lynx 2.7.1 already has): - + - Can (attempt to) translate from any document charset to any display - character set, *IF* the document charset is known by a translation + character set, *IF* the document charset is known by a translation table (compiled in at installation). - New method to define character sets: used for input charset as well - as display character set, translation tables compiled in from + as display character set, translation tables compiled in from separate files (one per charset). One table is designated as default and can be used for fallback translation to 7-bit replacements for display. - New method for specifying translations of SGML entities. - - Unicode (UTF-8) support: can (attempt to) decode and translate UTF-8 to + - Unicode (UTF8) support: can (attempt to) decode and translate UTF8 to display character set, or pass through UTF to display (if terminal - or console understands UTF-8). [raw display of UTF only tested with Slang + or console understands UTF8). [raw display of UTF only tested with Slang so far, does not always position everything correctly on screen] - Support for CHARSET attribute on A tag (and sometimes LINK), as in HTML @@ -25,14 +25,13 @@ Lynx CHARTRANS - Support for ACCEPT-CHARSET attribute of FORM tags. - - EXPERIMENTAL, currently enabled only for Linux console: + - EXPERIMENTAL, currently enabled only for Linux console: can (attempt to) automatically switch terminal mode and load new code pages on change of display character set. - - some minor changes: sometimes invalid characters were displayed in a hex + - some minor changes: sometimes invalid characters are displayed in a hex notation Uxxxx (helps debugging, but I also regard it as at least not - worse than showing the wrong char without warning), now they are not - displayed to reduce garbage. + worse than showing the wrong char without warning). Additions/changes to user interface: @@ -69,7 +68,7 @@ Requirements: same as for Lynx in general :) The chartrans code is now merged with Wayne Buttle's changes for 32-bit MS Windows and DOS/DJGPP, with Thomas Dickey's and Jim Spath's emerging auto-configure mechanism, and with BUGFIXES from Foteos -Macrides. See the accompanying file CHANGES for the current +Macrides. See the accompanying file CHANGES.new for the current status. @@ -79,6 +78,12 @@ which are then interpreted as control chars, there is no protection against if strange things are defined in the table files. +HOW TO GET SOURCES: + +The development code is available at + <URL: http://sol.slcc.edu/lynx/current/> +in various formats. + HOW TO INSTALL: (4) before compiling: @@ -108,13 +113,13 @@ HOW TO INSTALL: (6) Some things to look at if compilation fails: In src/chrtrans/UCkd.h there is a typedef for an unsigned 16bit - numeric type which may need to be changed for your system. + numeric type which may need to be changed for your system. See comment near top there. For recompiling Lynx, `make clean' should not be necessary if only - files in src/chrtrans have been changed. On the other hand + files in src/chrtrans have been changed. On the other hand may not propagate to the src/chrtrans directory (depending how things - are going with auto-config), you may have to cd to that directory + are going with auto-config), you may have to cd to that directory and `make clean' there to really clean up there. (7) To customize (add/change translation tables etc.): @@ -126,7 +131,7 @@ HOW TO INSTALL: Note that definition of new character entities (if e.g. you want Lynx to recognize Ž) are not covered by these table files, - they have to be listed in entities.h. + they have to be listed in entities.h. _If you are on a Linux system_ and using Lynx on the console (i.e. not xterm, not a dialup *into* the Linux box), you can compile @@ -135,29 +140,29 @@ HOW TO INSTALL: change the console state. You need to have the Linux kbd package installed, with a working `setfont' command executable by the user, and the right font files - check the source in src/UCAuto.c for - the files used and/or to change them! + the files used and/or to change them! NOTE that with this enabled, - Lynx currently will not clean up the console state at exit, it will probably left like the last Display Character Set you used. - Loading a font is global across _all_ virtual text consoles, so using Lynx (compiled with this flag) may change the appearance of - text on other consoles (if that text contains characters - beyond US-ASCII). + text on other consoles (if that text contains characters + beyond ASCII). (8) Some suggested Web pages for testing: <URL: http://www.tezcat.com/~kweide/lynx-chartrans/test/> <URL: http://www.isoc.org:8080/>, - especially + especially <URL: http://www.isoc.org:8080/liste_ml.htm>. <URL: http://www.accentsoft.com/un/un-all.htm> -(9) Please report bugs, unexpected behavior, etc. +(9) Please report bugs, unexpected behavior, etc. to <lynx-dev@sig.net>. - Suggestions for improvement would be welcome, as well as + Suggestions for improvement would be welcome, as well as contributed translation tables (for stuff that is not available at ftp://dkuug.dk or ftp://ftp.unicode.org). diff --git a/docs/djgpp.key b/docs/djgpp.key deleted file mode 100644 index 18463347..00000000 --- a/docs/djgpp.key +++ /dev/null @@ -1,219 +0,0 @@ - DJGPP Keyhandler Keymaps - -Control_A 0x001 -Control_B 0x002 -Control_C 0x003 -Control_D 0x004 -Control_E 0x005 -Control_F 0x006 -Control_G 0x007 -BackSpace 0x008 -Control_H 0x008 -Tab 0x009 -Control_I 0x009 -LineFeed 0x00a -Control_J 0x00a -Control_K 0x00b -Control_L 0x00c -Return 0x00d -Control_M 0x00d -Control_N 0x00e -Control_O 0x00f -Control_P 0x010 -Control_Q 0x011 -Control_R 0x012 -Control_S 0x013 -Control_T 0x014 -Control_U 0x015 -Control_V 0x016 -Control_W 0x017 -Control_X 0x018 -Control_Y 0x019 -Control_Z 0x01a -Control_LBracket 0x01b -Escape 0x01b -Control_BackSlash 0x01c -Control_RBracket 0x01d -Control_Caret 0x01e -Control_Underscore 0x01f -Space 0x020 -ExclamationPoint 0x021 -DoubleQuote 0x022 -Hash 0x023 -Dollar 0x024 -Percent 0x025 -Ampersand 0x026 -Quote 0x027 -LParen 0x028 -RParen 0x029 -Star 0x02a -Plus 0x02b -Comma 0x02c -Dash 0x02d -Period 0x02e -Slash 0x02f -Colon 0x03a -SemiColon 0x03b -LAngle 0x03c -Equals 0x03d -RAngle 0x03e -QuestionMark 0x03f -At 0x040 -LBracket 0x05b -BackSlash 0x05c -RBracket 0x05d -Caret 0x05e -UnderScore 0x05f -BackQuote 0x060 -LBrace 0x07b -Pipe 0x07c -RBrace 0x07d -Tilde 0x07e -Control_Backspace 0x07f -Alt_Escape 0x101 -Control_At 0x103 -Alt_Backspace 0x10e -BackTab 0x10f -Alt_Q 0x110 -Alt_W 0x111 -Alt_E 0x112 -Alt_R 0x113 -Alt_T 0x114 -Alt_Y 0x115 -Alt_U 0x116 -Alt_I 0x117 -Alt_O 0x118 -Alt_P 0x119 -Alt_LBracket 0x11a -Alt_RBracket 0x11b -Alt_Return 0x11c -Alt_A 0x11e -Alt_S 0x11f -Alt_D 0x120 -Alt_F 0x121 -Alt_G 0x122 -Alt_H 0x123 -Alt_J 0x124 -Alt_K 0x125 -Alt_L 0x126 -Alt_Semicolon 0x127 -Alt_Quote 0x128 -Alt_Backquote 0x129 -Alt_Backslash 0x12b -Alt_Z 0x12c -Alt_X 0x12d -Alt_C 0x12e -Alt_V 0x12f -Alt_B 0x130 -Alt_N 0x131 -Alt_M 0x132 -Alt_Comma 0x133 -Alt_Period 0x134 -Alt_Slash 0x135 -Alt_KPStar 0x137 -F1 0x13b -F2 0x13c -F3 0x13d -F4 0x13e -F5 0x13f -F6 0x140 -F7 0x141 -F8 0x142 -F9 0x143 -F10 0x144 -Alt_KPMinus 0x14a -Center 0x14c -Alt_KPPlus 0x14e -Insert 0x152 -Delete 0x153 -Shift_F1 0x154 -Shift_F2 0x155 -Shift_F3 0x156 -Shift_F4 0x157 -Shift_F5 0x158 -Shift_F6 0x159 -Shift_F7 0x15a -Shift_F8 0x15b -Shift_F9 0x15c -Shift_F10 0x15d -Control_F1 0x15e -Control_F2 0x15f -Control_F3 0x160 -Control_F4 0x161 -Control_F5 0x162 -Control_F6 0x163 -Control_F7 0x164 -Control_F8 0x165 -Control_F9 0x166 -Control_F10 0x167 -Alt_F1 0x168 -Alt_F2 0x169 -Alt_F3 0x16a -Alt_F4 0x16b -Alt_F5 0x16c -Alt_F6 0x16d -Alt_F7 0x16e -Alt_F8 0x16f -Alt_F9 0x170 -Alt_F10 0x171 -Control_Print 0x172 -Control_Left 0x173 -Control_Right 0x174 -Control_End 0x175 -Control_PageDown 0x176 -Control_Home 0x177 -Alt_1 0x178 -Alt_2 0x179 -Alt_3 0x17a -Alt_4 0x17b -Alt_5 0x17c -Alt_6 0x17d -Alt_7 0x17e -Alt_8 0x17f -Alt_9 0x180 -Alt_0 0x181 -Alt_Dash 0x182 -Alt_Equals 0x183 -Control_PageUp 0x184 -F11 0x185 -F12 0x186 -Shift_F11 0x187 -Shift_F12 0x188 -Control_F11 0x189 -Control_F12 0x18a -Alt_F11 0x18b -Alt_F12 0x18c -Control_Up 0x18d -Control_KPDash 0x18e -Control_Center 0x18f -Control_KPPlus 0x190 -Control_Down 0x191 -Control_Insert 0x192 -Control_Delete 0x193 -Control_KPSlash 0x195 -Control_KPStar 0x196 -Alt_EHome 0x197 -Alt_EUp 0x198 -Alt_EPageUp 0x199 -Alt_ELeft 0x19b -Alt_ERight 0x19d -Alt_EEnd 0x19f -Alt_EDown 0x1a0 -Alt_EPageDown 0x1a1 -Alt_EInsert 0x1a2 -Alt_EDelete 0x1a3 -Alt_KPSlash 0x1a4 -Alt_Tab 0x1a5 -Alt_Enter 0x1a6 -EInsert 0x252 -EDelete 0x253 -Control_ELeft 0x273 -Control_ERight 0x274 -Control_EEnd 0x275 -Control_EPageDown 0x276 -Control_EHome 0x277 -Control_EPageUp 0x284 -Control_EUp 0x28d -Control_EDown 0x291 -Control_EInsert 0x292 -Control_EDelete 0x293 diff --git a/docs/pdcurses.key b/docs/pdcurses.key deleted file mode 100644 index 927e8b31..00000000 --- a/docs/pdcurses.key +++ /dev/null @@ -1,119 +0,0 @@ - PDCurses Keymaps - -KEY_F0 0x108 /* function keys. space for */ -KEY_F(n) (KEY_F0+(n))/* 64 keys are reserved. */ -ALT_0 0x197 /* Alt-0 */ -ALT_1 0x198 /* Alt-1 */ -ALT_2 0x199 /* Alt-2 */ -ALT_3 0x19a /* Alt-3 */ -ALT_4 0x19b /* Alt-4 */ -ALT_5 0x19c /* Alt-5 */ -ALT_6 0x19d /* Alt-6 */ -ALT_7 0x19e /* Alt-7 */ -ALT_8 0x19f /* Alt-8 */ -ALT_9 0x1a0 /* Alt-9 */ -ALT_A 0x1a1 /* Alt-A */ -ALT_B 0x1a2 /* Alt-B */ -ALT_C 0x1a3 /* Alt-C */ -ALT_D 0x1a4 /* Alt-D */ -ALT_E 0x1a5 /* Alt-E */ -ALT_F 0x1a6 /* Alt-F */ -ALT_G 0x1a7 /* Alt-G */ -ALT_H 0x1a8 /* Alt-H */ -ALT_I 0x1a9 /* Alt-I */ -ALT_J 0x1aa /* Alt-J */ -ALT_K 0x1ab /* Alt-K */ -ALT_L 0x1ac /* Alt-L */ -ALT_M 0x1ad /* Alt-M */ -ALT_N 0x1ae /* Alt-N */ -ALT_O 0x1af /* Alt-O */ -ALT_P 0x1b0 /* Alt-P */ -ALT_Q 0x1b1 /* Alt-Q */ -ALT_R 0x1b2 /* Alt-R */ -ALT_S 0x1b3 /* Alt-S */ -ALT_T 0x1b4 /* Alt-T */ -ALT_U 0x1b5 /* Alt-U */ -ALT_V 0x1b6 /* Alt-V */ -ALT_W 0x1b7 /* Alt-W */ -ALT_X 0x1b8 /* Alt-X */ -ALT_Y 0x1b9 /* Alt-Y */ -ALT_Z 0x1ba /* Alt-Z */ -CTL_LEFT 0x1bb /* Control-Left-Arrow */ -CTL_RIGHT 0x1bc /* Control-Right-Arrow */ -CTL_PGUP 0x1bd /* Control-PgUp */ -CTL_PGDN 0x1be /* Control-PgDn */ -CTL_HOME 0x1bf /* Control-Home */ -CTL_END 0x1c0 /* Control-End */ -KEY_B2 0x1c5 /* center on Virt. keypad */ -PADSLASH 0x1ca /* slash on keypad */ -PADENTER 0x1cb /* enter on keypad */ -CTL_PADENTER 0x1cc /* ctl-enter on keypad */ -ALT_PADENTER 0x1cd /* alt-enter on keypad */ -PADSTOP 0x1ce /* stop on keypad */ -PADSTAR 0x1cf /* star on keypad */ -PADMINUS 0x1d0 /* minus on keypad */ -PADPLUS 0x1d1 /* plus on keypad */ -CTL_PADSTOP 0x1d2 /* ctl-stop on keypad */ -CTL_PADCENTER 0x1d3 /* ctl-enter on keypad */ -CTL_PADPLUS 0x1d4 /* ctl-plus on keypad */ -CTL_PADMINUS 0x1d5 /* ctl-minus on keypad */ -CTL_PADSLASH 0x1d6 /* ctl-slash on keypad */ -CTL_PADSTAR 0x1d7 /* ctl-star on keypad */ -ALT_PADPLUS 0x1d8 /* alt-plus on keypad */ -ALT_PADMINUS 0x1d9 /* alt-minus on keypad */ -ALT_PADSLASH 0x1da /* alt-slash on keypad */ -ALT_PADSTAR 0x1db /* alt-star on keypad */ -ALT_PADSTOP 0x1dc /* alt-star on keypad */ -CTL_INS 0x1dd /* ctl-insert */ -ALT_DEL 0x1de /* alt-delete */ -ALT_INS 0x1df /* alt-insert */ -CTL_UP 0x1e0 /* ctl-up arrow */ -CTL_DOWN 0x1e1 /* ctl-down arrow */ -CTL_TAB 0x1e2 /* ctl-tab */ -ALT_TAB 0x1e3 /* alt-tab */ -ALT_MINUS 0x1e4 /* alt-minus */ -ALT_EQUAL 0x1e5 /* alt-equal */ -ALT_HOME 0x1e6 /* alt-home */ -ALT_PGUP 0x1e7 /* alt-pgup */ -ALT_PGDN 0x1e8 /* alt-pgdn */ -ALT_END 0x1e9 /* alt-end */ -ALT_UP 0x1ea /* alt-up arrow */ -ALT_DOWN 0x1eb /* alt-down arrow */ -ALT_RIGHT 0x1ec /* alt-right arrow */ -ALT_LEFT 0x1ed /* alt-left arrow */ -ALT_ENTER 0x1ee /* alt-enter */ -ALT_ESC 0x1ef /* alt-escape */ -ALT_BQUOTE 0x1f0 /* alt-back quote */ -ALT_LBRACKET 0x1f1 /* alt-left bracket */ -ALT_RBRACKET 0x1f2 /* alt-right bracket */ -ALT_SEMICOLON 0x1f3 /* alt-semi-colon */ -ALT_FQUOTE 0x1f4 /* alt-forward quote */ -ALT_COMMA 0x1f5 /* alt-comma */ -ALT_STOP 0x1f6 /* alt-stop */ -ALT_FSLASH 0x1f7 /* alt-forward slash */ -ALT_BKSP 0x1f8 /* alt-backspace */ -CTL_BKSP 0x1f9 /* ctl-backspace */ -PAD0 0x1fa /* ctl-keypad 0 */ -CTL_PAD0 0x1fb /* ctl-keypad 0 */ -CTL_PAD1 0x1fc /* ctl-keypad 1 */ -CTL_PAD2 0x1fd /* ctl-keypad 2 */ -CTL_PAD3 0x1fe /* ctl-keypad 3 */ -CTL_PAD4 0x1ff /* ctl-keypad 4 */ -CTL_PAD5 0x200 /* ctl-keypad 5 */ -CTL_PAD6 0x201 /* ctl-keypad 6 */ -CTL_PAD7 0x202 /* ctl-keypad 7 */ -CTL_PAD8 0x203 /* ctl-keypad 8 */ -CTL_PAD9 0x204 /* ctl-keypad 9 */ -ALT_PAD0 0x205 /* ctl-keypad 0 */ -ALT_PAD1 0x206 /* ctl-keypad 1 */ -ALT_PAD2 0x207 /* ctl-keypad 2 */ -ALT_PAD3 0x208 /* ctl-keypad 3 */ -ALT_PAD4 0x209 /* ctl-keypad 4 */ -ALT_PAD5 0x20a /* ctl-keypad 5 */ -ALT_PAD6 0x20b /* ctl-keypad 6 */ -ALT_PAD7 0x20c /* ctl-keypad 7 */ -ALT_PAD8 0x20d /* ctl-keypad 8 */ -ALT_PAD9 0x20e /* ctl-keypad 9 */ -CTL_DEL 0x20f /* clt-delete */ -ALT_BSLASH 0x210 /* alt-back slash */ -CTL_ENTER 0x211 /* ctl-enter */ diff --git a/docs/slang.key b/docs/slang.key deleted file mode 100644 index 3d7ef381..00000000 --- a/docs/slang.key +++ /dev/null @@ -1,4 +0,0 @@ - S-Lang Keymaps for DOS - -F0 0x200 -F(X) (SL_KEY_F0 + X) @@ -2,7 +2,6 @@ # The default placement for this file is /usr/local/lib/lynx.cfg (Unix) # or Lynx_Dir:lynx.cfg (VMS) # -# # Definition pairs are of the form VARIABLE:DEFINITION # NO spaces are allowed between the pair items. # @@ -16,24 +15,6 @@ # All definitions must be flush left and have NO spaces.!!! # # -# Starting with Lynx 2.8.1, the lynx.cfg file has a crude "include" -# facility. This means that you can take advantage of the global lynx.cfg -# while also supplying your own tweaks. -# -# You can use a command-line argument (-cfg /where/is/lynx.cfg) or an -# environment variable (LYNX_CFG=/where/is/lynx.cfg). -# For instance, put in your .profile or .login: -# -# LYNX_CFG=~/lynx.cfg; export LYNX_CFG # in .profile for sh/ksh/bash/etc. -# setenv LYNX_CFG ~/lynx.cfg # in .login for [t]csh -# -# Then in ~/lynx.cfg: -# -#INCLUDE:/usr/local/lib/lynx.cfg -# ^^^^^^^^^^^^^^^^^^^^^^^ or whatever's appropriate on your system -#and now your own tweaks. - -# # STARTFILE is the default URL if none is specified on the command line # or via a WWW_HOME environment variable. # note: these files can be remote (http://www.w3.org/default.html) @@ -160,107 +141,95 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # #LOCAL_DOMAIN:ukans.edu -# CHARACTER_SET defines the display character set, i.e., that assumed to be -# installed on the user's terminal. It determines which characters or strings -# will be used to represent 8-bit character entities within HTML. New -# character sets may be defined as explained in the README files of the -# src/chrtrans directory in the Lynx source code distribution. For Asian (CJK) -# character sets, it also determines how Kanji code will be handled. The -# default is defined in userdefs.h and can be changed here, and via the -# 'o'ptions menu. The 'o'ptions menu setting will be stored in the user's RC -# file whenever those settings are saved, and thereafter will be used as the -# default. For Lynx a "character set" has two names: MIME name (for -# recognizing properly labeled charset parameters in HTTP headers etc.), and a -# human-readable string for the 'O'ptions Menu (so you may find info about -# language or group of languages besides MIME name). Not all 'human-readable' -# names correspond to exactly one valid MIME charset (example is "Chinese"), in -# that case an appropriate valid (and more specific) MIME name should be used -# where required. Well-known synonyms are also processed in the code. -# -# Lynx normally translates characters from document's charset to display -# charset, using ASSUME_CHARSET value (see below) if document's charset is not -# specified explicitly. There is the so called `raw or CJK mode' which is OFF -# for this case. (When the document charset specified explicitly -# it override any assumption like ASSUME_CHARSET or raw or CJK mode). -# -# For the Asian (CJK) display character sets the corresponding charset is -# assumed in documents, i.e., raw or CJK mode is ON by default. In raw CJK -# mode, 8-bit characters are not reverse translated in relation to the entity -# conversion arrays, i.e., they are assumed to be appropriate for the display -# character set. It should be toggled OFF when an Asian (CJK) display -# character set is selected but the document is not CJK and its charset not -# specified explicitly. -# -# The `raw or CJK mode' may be toggled by user via '@' (LYK_RAW_TOGGLE) key, -# with -raw command line switch or from 'o'ptions menu. -# -# Raw mode effectively changes the charset assumption about unlabeled -# documents. You can toggle raw mode ON if you believe the document has a -# charset which does correspond to your Display Character Set. On the other -# hand, if you set ASSUME_CHARSET the same as Display Character Set you get raw -# mode ON by default (but you get assume_charset=iso-8859-1 if you try raw mode -# OFF after it). -# -# Note that "raw" does not mean that every byte will be passed to the screen. -# HTML character entities may get expanded and translated, inappropriate -# control characters filtered out, etc. There is a "Transparent" pseudo +# CHARACTER_SET defines the default character set, i.e., that assumed +# to be installed on the user's terminal. It determines which characters +# or strings will be used to represent 8-bit character entities within +# HTML. New character sets may be defined as explained in the README +# files of the src/chrtrans directory in the Lynx source code distribution. +# For Asian (CJK) character sets, it also determines how Kanji code will +# be handled. The default is defined in userdefs.h and can be changed +# here, and via the 'o'ptions menu. The 'o'ptions menu setting will be +# stored in the user's RC file whenever those settings are saved, and +# thereafter will be used as the default. For Lynx a "character set" has +# two names: a Display Character Set string for the Options screen and +# for setting CHARACTER_SET here, and a corresponding MIME name (for +# recognizing properly labelled charset parameters in HTTP headers etc.). +# Not all Display Character Set names correspond to exactly one valid MIME +# charset (for example "Chinese", "Transparent"), in that case +# an appropriate valid (and more specific) MIME name should be used +# where required. The actions of the -raw switch and LYK_RAW_TOGGLE ('@') +# are dependent on the character set. For the Asian (CJK) sets the +# corresponding charset is assumed in documents, i.e., raw or CJK mode is +# ON by default, so that -raw or the initial LYK_RAW_TOGGLE will turn the +# mode OFF. The toggling also can be done via the 'o'ptions menu. In raw +# CJK mode, 8-bit characters are not reverse translated in relation to the +# entity conversion arrays, i.e., they are assumed to be appropriate for +# the current character set. It should be toggled OFF when an Asian (CJK) +# character set is selected but the document is not CJK. +# The default for "raw mode" (before it is changed by -raw or LYK_RAW_TOGGLE), +# if the display character set is not a CJK character set, depends on the +# display character set as well as the ASSUME_CHARSET value (see below) from +# either this file or an -assume_charset command line option. The mode +# defaults to ON if the ASSUME_CHARSET value corresponds to the display +# character set, otherwise to OFF. +# It can be toggled ON if you believe the document has a charset which does +# correspond to your Display Character Set, but was not detected to have +# that charset and was handled as having the default charset (normally +# iso-8859-1). You also can specify the default charset (to one other +# than iso-8859-1) via the ASSUME_CHARSET value (see below) from either +# this file or an -assume_charset command line option. Note that "raw" +# does not mean that every byte will be passed to the screen. HTML +# character entities may get expanded and translated, inappropriate control +# characters filtered out, etc. Raw mode effectively changes the charset +# assumption about unlabelled documents. There is a "Transparent" pseudo # character set for more "rawness". # -# Since Lynx now supports a wide range of platforms it may be useful to note -# that cpXXX codepages used by IBM PC compatible computers, and windows-xxxx -# used by native MS-Windows apps. We also note that cpXXX pages rerely found -# on Internet but mostly for local needs on DOS. -# -# Recognized character sets include: -# -# string for 'O'ptions Menu MIME name -# =========================== ========= -# 7 bit approximations (US-ASCII) us-ascii -# Western (ISO-8859-1) iso-8859-1 -# Western (cp850) cp850 -# Western (windows-1252) windows-1251 -# IBM PC US codepage (cp437) cp437 -# DEC Multinational dec-mcs -# Macintosh (8 bit) macintosh -# NeXT character set next -# Chinese euc-cn -# Japanese (EUC-JP) euc-jp -# Japanese (Shift_JIS) shift_jis -# Korean euc-kr -# Taipei (Big5) big5 -# Vietnamese (VISCII) viscii -# Eastern European (ISO-8859-2) iso-8859-2 -# Eastern European (cp852) cp852 -# Eastern European (windows-1250) windows-1250 -# Latin 3 (ISO-8859-3) iso-8859-3 -# Latin 4 (ISO-8859-4) iso-8859-4 -# Baltic Rim (cp775) cp775 -# Baltic Rim (windows-1257) windows-1257 -# Cyrillic (ISO-8859-5) iso-8859-5 -# Cyrillic (cp866) cp866 -# Cyrillic (windows-1251) windows-1251 -# Cyrillic (KOI8-R) koi8-r -# Arabic (ISO-8859-6) iso-8859-6 -# Arabic (cp864) cp864 -# Arabic (windows-1256) windows-1256 -# Greek (ISO-8859-7) iso-8859-7 -# Greek (cp737) cp737 -# Greek2 (cp869) cp869 -# Greek (windows-1253) windows-1253 -# Hebrew (ISO-8859-8) iso-8859-8 -# Hebrew (cp862) cp862 -# Hebrew (windows-1255) windows-1255 -# Turkish (ISO-8859-9) iso-8859-9 -# ISO-8859-10 iso-8859-10 -# UNICODE (UTF-8) utf-8 -# RFC 1345 w/o Intro mnemonic+ascii+0 -# RFC 1345 Mnemonic mnemonic -# Transparent x-transparent -# -# The value should be the MIME name of a character set recognized by -# Lynx (case insensitive). -# -#CHARACTER_SET:iso-8859-1 +# The default character sets include: +# Display Character Set name MIME name +# ========================== ========= +# 7 bit approximations us-ascii +# Chinese euc-cn +# DEC Multinational dec-mcs +# DosArabic (cp864) cp864 +# DosBaltRim (cp775) cp775 +# DosCyrillic (cp866) cp866 +# DosGreek (cp737) cp737 +# DosGreek2 (cp869) cp869 +# DosHebrew (cp862) cp862 +# DosLatin1 (cp850) cp850 +# DosLatin2 (cp852) cp852 +# DosLatinUS (cp437) cp437 +# ISO 8859-10 iso-8859-10 +# ISO 8859-5 Cyrillic iso-8859-5 +# ISO 8859-6 Arabic iso-8859-6 +# ISO 8859-7 Greek iso-8859-7 +# ISO 8859-8 Hebrew iso-8859-8 +# ISO 8859-9 (Latin 5) iso-8859-9 +# ISO Latin 1 iso-8859-1 +# ISO Latin 2 iso-8859-2 +# ISO Latin 3 iso-8859-3 +# ISO Latin 4 iso-8859-4 +# Japanese (EUC) euc-jp +# Japanese (SJIS) shift_jis +# KOI8-R Cyrillic koi8-r +# Korean euc-kr +# Macintosh (8 bit) macintosh +# NeXT character set next +# RFC 1345 Mnemonic mnemonic +# RFC 1345 w/o Intro mnemonic+ascii+0 +# Taipei (Big5) big5 +# Transparent x-transparent +# UNICODE UTF 8 utf-8 +# Vietnamese (VISCII) viscii +# WinArabic (cp1256) windows-1256 +# WinBaltRim (cp1257) windows-1257 +# WinCyrillic (cp1251) windows-1251 +# WinGreek (cp1253) windows-1253 +# WinHebrew (cp1255) windows-1255 +# WinLatin1 (cp1252) windows-1252 +# WinLatin2 (cp1250) windows-1250 +# +#CHARACTER_SET:ISO Latin 1 # ASSUME_CHARSET changes the handling of documents which do not # explicitly specify a charset. Normally Lynx assumes that 8-bit @@ -270,8 +239,8 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # Lynx will treat documents as if they were encoded accordingly. # See above on how this interacts with "raw mode" and the Display # Character Set. -# ASSUME_CHARSET can also be changed via the 'o'ptions menu but will -# not be saved as permanent value in user's .lynxrc file to avoid more chaos. +# The value should be the MIME name of a character set recognized by +# Lynx (case insensitive). # #ASSUME_CHARSET:iso-8859-1 @@ -279,10 +248,9 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # files. If no setting is given here or by an -assume_local_charset # command line option, the value for ASSUME_CHARSET or -assume_charset # is used. It works for both text/plain and text/html files. -# This option will ignore "raw mode" toggling when local files are viewed -# (it is "stronger" than "assume_charset" or the effective change -# of the charset assumption caused by changing "raw mode"), -# so only use when necessary. +# This option may interfere with "raw mode" toggling when local files +# are viewed (it is "stronger" than the effective change of the charset +# assumption caused by changing "raw mode"), so only use when necessary. # #ASSUME_LOCAL_CHARSET:iso-8859-1 @@ -302,33 +270,6 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # #PREPEND_CHARSET_TO_SOURCE:FALSE -# NCR_IN_BOOKMARKS:TRUE allows you to save 8-bit characters in bookmark titles -# with unicode format (NCR). This may be useful if you need switching display -# charset frequently. This is the case when you use lynx on different -# platforms, e.g. on UNIX and from remote PC, but want to keep bookmarks file -# persistent. -# Another side is compatibility: NCR as part of I18N and HTML4.0 -# specifications supported starting with Lynx 2.7.2, Netscape 4.0 and MSIE 4.0 -# Older versions fail, keep NCR_IN_BOOKMARKS:FALSE if you plan to use them. -# -#NCR_IN_BOOKMARKS:FALSE - -# FORCE_8BIT_TOUPPER overrides locale settings and uses internal 8-bit -# case-conversion mechanism for case-insensitive searches in non-ASCII display -# character set, FALSE by default (should not be changed unless you encounter -# problems with case-insensitive searches). -# -#FORCE_8BIT_TOUPPER:FALSE - -# While lynx supports different platforms and display character sets -# we need to limit outgoing mail character repertoire to reduce -# trouble for remote recipient who may not recognize our charset. -# You may try US-ASCII as the safest value (7 bit), any other MIME name -# or leave this field blank (default) to use display character set. -# (Translation currently implemented for mail "subjects= " only). -# -#OUTGOING_MAIL_CHARSET: - # If Lynx encounters a charset parameter it doesn't recognize, it will # replace the value given by ASSUME_UNREC_CHARSET (or a corresponding # -assume_unrec_charset command line option) for it. This can be used @@ -355,12 +296,12 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # The value should NOT include "ISO-8859-1" or "US-ASCII", # since those values are always assumed by default. # If a file in that character set is available, the server will send it. -# "If no Accept-Charset header is present, the default is that any +# If no Accept-Charset header is present, the default is that any # character set is acceptable. If an Accept-Charset header is present, # and if the server cannot send a response which is acceptable # according to the Accept-Charset header, then the server SHOULD send # an error response with the 406 (not acceptable) status code, though -# the sending of an unacceptable response is also allowed." (RFC2068) +# the sending of an unacceptable response is also allowed. (RFC2068) # #PREFERRED_CHARSET: @@ -388,28 +329,11 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html #URL_DOMAIN_PREFIXES:www. #URL_DOMAIN_SUFFIXES:.com,.edu,.net,.org -# Lynx Options Menu style toggle: forms-based or old-style. -# Works if old-style menu is compiled in as well as the forms-based menu. -#FORMS_OPTIONS:TRUE - -# Display partial pages while downloading -#PARTIAL:TRUE - -# Set the threshold # of lines Lynx must render before it -# redraws the screen in PARTIAL mode. Anything < 0 implies -# use the screen size. -#PARTIAL_THRES:-1 - -# While getting large files, Lynx shows the approximate rate of transfer. -# Set this to change the units shown: -# TRUE for KB/sec or FALSE for bytes/sec: default is TRUE. -#SHOW_KB_RATE:TRUE - # The following three definitions set the number of seconds for # pauses following statusline messages that would otherwise be # replaced immediately, and are more important than the unpaused # progress messages. Those set by INFOSECS are also basically -# progress messages (e.g., that a prompted input has been canceled) +# progress messages (e.g., that a prompted input has been cancelled) # and should have the shortest pause. Those set by MESSAGESECS are # informational (e.g., that a function is disabled) and should have # a pause of intermediate duration. Those set by ALERTSECS typically @@ -446,14 +370,6 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # #SHOW_CURSOR:FALSE -# VERBOSE_IMAGES controls whether or not Lynx replaces the [LINK], [INLINE] and -# [IMAGE] comments (for images without ALT) with filenames of these images. -# This is extremely useful because now we can determine immediately what images -# are just decorations (button.gif, line.gif) and what images are important. -# -# If this option is set here, it will override the setting in userdefs.h. -#VERBOSE_IMAGES:TRUE - # If BOLD_HEADERS is set to TRUE the HT_BOLD default style will be acted # upon for <H1> through <H6> headers. The compilation default is FALSE # (only the indentation styles are acted upon, but see BOLD_H1, below). @@ -795,17 +711,12 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html #USE_MOUSE: FALSE # If COLLAPSE_BR_TAGS is set FALSE, Lynx will not collapse serial BR tags. -# If set TRUE, two or more concurrent BRs will be collapsed into a single -# line break. Note that the valid way to insert extra blank lines in HTML -# is via a PRE block with only newlines in the block. +# Note that the valid way to insert extra blank lines in HTML is via a PRE +# block with only newlines in the block. +# The default is defined in userdefs.h, and can be overridden here. # #COLLAPSE_BR_TAGS:TRUE -# If TAGSOUP is set, Lynx uses the "Tag Soup DTD" rather than "SortaSGML". -# The two approaches differ by the style of error detection and recovery. -# Tag Soup DTD allows for improperly nested tags; SortaSGML is stricter. -#TAGSOUP:FALSE - # If SET_COOKIES is set FALSE, Lynx will ignore Set-Cookie headers # in http server replies. # The default is defined in userdefs.h, and can be overridden here, @@ -813,32 +724,6 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # #SET_COOKIES:TRUE -# If ACCEPT_ALL_COOKIES is set TRUE, Lynx will accept cookies from all -# domains with no user interaction. -# The default is defined in userdefs.h and can be overridden here, -# and/or toggled via the -accept_all_cookies command line switch. -# -#ACCEPT_ALL_COOKIES:FALSE - -# COOKIE_ACCEPT_DOMAINS and COOKIE_REJECT_DOMAINS are comma-delimited lists of -# domains (with a leading '.') to automatically accept or reject all cookies -# from. These can also be specified in the lynxrc file, and are overridden by -# the ACCEPT_ALL_COOKIES parameter. If a single domain is specified in both -# COOKIE_ACCEPT_DOMAINS and in COOKIE_REJECT_DOMAINS, the rejection will take -# precedence. -# -#COOKIE_ACCEPT_DOMAINS: -#COOKIE_REJECT_DOMAINS: - -# COOKIE_FILE is the default file to store persistent downloaded cookies -# in, if Lynx was compiled with EXP_PERSISTENT_COOKIES. The cookie file -# can also be specified in .lynxrc or on the commandline. -#COOKIE_FILE:~/.lynx_cookies - -# PERSISTENT_COOKIES is tested only if Lynx was compiled with -# EXP_PERSISTENT_COOKIES. Use this flag to disable the feature. -#PERSISTENT_COOKIES:TRUE - # VMS: #===== # The mail command and qualifiers are defined in userdefs.h. Lynx @@ -853,7 +738,7 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # function in LYPrint.c, may be required. # #SYSTEM_MAIL:PMDF SEND -#SYSTEM_MAIL_FLAGS:/headers +#SYSERM_MAIL_FLAGS:/headers # #SYSTEM_MAIL:MAIL #SYSTEM_MAIL_FLAGS: @@ -994,15 +879,16 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html #SYSTEM_EDITOR: # Proxy variables -# Lynx version 2.2 and beyond supports the use of proxy servers that can act as -# firewall gateways and caching servers. They are preferable to the older -# gateway servers. Each protocol used by Lynx can be mapped separately using -# PROTOCOL_proxy environment variables (see INSTALLATION). If you have not set -# them externally, you can set them at run time via this configuration file. -# They will not override external settings. The no_proxy variable can be used -# to inhibit proxying to selected regions of the Web (see below). Note that on -# VMS these proxy variables are set as process logicals rather than symbols, to -# preserve lowercasing, and will outlive the Lynx image. +# Lynx version 2.2 and beyond supports the use of proxy servers that can +# act as firewall gateways and caching servers. They are preferable to +# the older gateway servers. Each protocol used by Lynx can be mapped +# separately using PROTOCOL_proxy environment variables (see INSTALLATION). +# If you have not set them externally, you can set them at run time via +# this configuration file. They will not override external settings. +# The no_proxy variable can be a comma-separated list of hosts which should +# not be proxied, or an asterisk to override all proxy variables. +# Note that on VMS they are set as process logicals rather than symbols, +# to preserve lowercasing, and will outlive the Lynx image. # #http_proxy:http://some.server.dom:port/ #https_proxy:http://some.server.dom:port/ @@ -1020,94 +906,119 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html #cso_proxy:http://some.server.dom:port/ #no_proxy:host.domain.dom -# The no_proxy variable can be a comma-separated list of strings defining -# no-proxy zones in the DNS domain name space. If a tail substring of the -# domain-path for a host matches one of these strings, transactions with that -# node will not be proxied. -#no_proxy:domain.path1,path2 -# -# A single asterisk as an entry will override all proxy variables and no -# transactions will be proxied. -#no_proxy:* -# This is the only allowed use of * in no_proxy. -# -# Warning: Note that setting 'il' as an entry in this list will block proxying -# for the .mil domain as well as the .il domain. If the entry is '.il' this -# will not happen. - -# PRINTER & DOWNLOADER DEFINITIONS: -# Lynx has 4 pre-defined print options & 1 pre-defined download option, -# which are called up on-screen when `p' or `d' are entered; -# any number of options can be added by the user, as explained below. -# -# For `p' pre-defined options are: `Save to local file', `E-mail the file', -# `Print to screen' and `Print to local printer attached to vt100'. -# `Print to screen' allows file transfers in the absence of alternatives -# and is often the only option allowed here for anonymous users; -# the 3rd & 4th options are not pre-defined for DOS/WINDOWS versions of Lynx. -# For `d' the pre-defined option is: `Download to local file'. -# -# To define your own print or download option use the following formats: -# PRINTER:<name>:<command>:<option>:<lines/page> -# DOWNLOADER:<name>:<command>:<option> -# -# <name> is what you will see on the print/download screen. -# <command> is the command your system will execute: -# the 1st %s in the command will be replaced -# by the temporary filename used by Lynx; -# a 2nd %s will be replaced by a filename of your choice, -# for which Lynx will prompt, offering a suggestion; -# if the command format of your printer/downloader requires -# a different layout, you will need to use a script -# (see the last 2 download examples below). -# <option> TRUE : the printer/downloader will always be ENABLED, -# except that downloading is disabled when -validate is used; -# FALSE : both will be DISABLED for anonymous users -# and printing will be disabled when -noprint is used. -# <lines/page> (printers: optional) the number of lines/page (default 66): -# used to compute the approximate output size -# and prompt if the document is > 4 printer pages; -# it uses current screen length for the computation -# when `Print to screen' is selected. -# -# You must put the whole definition on one line; -# if you use a colon, precede it with a backslash. -# -# `Printer' can be any file-handling program you find useful, -# even if it does not physically print anything. -# Usually, downloading involves the use of (e.g.) Ckermit or ZModem -# to transfer files to a user's local machine over a serial link, -# but download options do not have to be download-protocol programs. -# -# Printer examples: +# Printer definitions +# any number of printers may be defined by using multiple +# printer definition sets. Printers may be any program +# that could be useful to your users, they do not necessarily +# have to print. +# +# the definition of a printer is of the form +# PRINTER:<printer name>:<printer command>:<printer option>:<lines/page> +# +# <printer name> is the name that the user will see. +# <printer command> is the command line arguments for printing a file. +# The %s will be replaced with the file being printed. +# If a second %s is given the second %s will be replaced by +# a suggested filename that is prettier than the tempfile +# name given in the first %s. This does not remove the first +# %s from the command line in any manner. If you need to +# use only the second %s file name in your printer command, +# then I suggest creating a script which will first copy the +# first %s file name to the second %s file name, and then +# executing your print command with the second %s file name. +# <printer option> specifies whether the printer should be disabled for +# users without printing options. The options are +# TRUE or FALSE; +# TRUE means the printer will always be ENABLED +# regardless of printer or anonymous settings +# FALSE means the printer will be DISABLED when +# the -noprint option is on, or for anonymous +# users which are not allowed to print +# +# <lines/page> is an optional parameter for indicating the number of +# lines per page for the printer. Defaults to 66. Used +# for computing the approximate number of pages and +# generating a statusline query of whether to proceed if +# the document is longer than 4 printer pages. Uses the +# current screen length for the computation when the +# built in "print to screen" option is selected. +# +# You must put the whole definition on one line. +# +# If you must use a colon, precede it with a backslash! +# +# If you have a very busy VMS print queue and Lynx deletes the temporary +# files before they have been queued, use the VMSPrint.com included in +# the distribution. +# +# examples #PRINTER:Computer Center printer:lpr -Pccprt %s:FALSE #PRINTER:Office printer:lpr -POffprt %s:TRUE #PRINTER:VMS printer:print /queue=cc$print %s:FALSE:58 -# If you have a very busy VMS print queue -# and Lynx deletes the temporary files before they have been queued, -# use the VMSPrint.com included in the distribution: #PRINTER:Busy VMS printer:@Lynx_Dir\:VMSPrint sys$print %s:FALSE:58 -# To specify a print option at run-time: -# NBB if you have ANONYMOUS users, DO NOT allow this option! -#PRINTER:Specify at run-time:echo -n "Enter a print command\: "; read word; sh -c "$word %s":FALSE -# To pass to a sophisticated file viewer: -k suppresses invocation -# of hex display mode if 8-bit or control characters are present; -# +s invokes secure mode (see ftp://space.mit.edu/pub/davis/most): +# Check out the lpansi program in utils/ for printing on vt100 +# attached printers. +#PRINTER:Use vt100 print sequence to print from your local terminal:lpansi %s:TRUE +# Don't use the following printer on anonymous accounts since +# allowing shell input is very dangerous. +#PRINTER:Specify your own print command:echo -n "Enter a print command\: "; read word; sh -c "$word %s":FALSE +# Pass to a sophisticated file viewer (sources for most are available in +# ftp://space.mit.edu/pub/davis/most). The most -k switch suppresses the +# invocation of hexadecimal display mode if 8-bit or control characters +# are present. The +s switch invokes secure mode. #PRINTER:Use Most to view:most -k +s %s:TRUE:23 + +# Downloader definitions +# any number of downloaders may be defined by using multiple +# downloader definition sets. Downloaders may be any program +# that could be useful to your users, they do not necessarily +# have to be a download protocol program. The most common use +# of a downloader is to use Ckermit or some other transfer +# program so that the user may easily transfer files back to +# their local machine over a serial link. +# +# the definition of a downloader is of the form +# DOWNLOADER:<downloadername>:<downloader command>:<downloader option> +# +# <downloader name> is the name that the user will see. +# <downloader command> is the command line arguments for downloading a file. +# The %s will be replaced with the file being downloaded. +# If a second %s is given the second %s will be replaced +# by a suggested filename that is nicer than the tempfile +# name given in the first %s. This does not replace the +# first %s in the command line. If your command needs +# the suggest file name on the command line only, then +# I suggest creating a script that will first copy the +# first %s file name to the second %s file name, and then +# execute the downloading command using the second %s file +# name (e.g., 'sz' needs such a script interposed). +# <downloader option> specifies whether the downloader should be disabled for +# anonymous users. The options are +# TRUE or FALSE; +# TRUE means the downloader will always be ENABLED +# regardless of the anonymous settings (however, +# all downloading is disabled by -validate). +# FALSE means the downloader will be DISABLED when +# the user is anonymous. +# +# You must put the whole definition on one line. +# +# If you must use a colon, precede it with a backslash! # -# Downloader examples: -# in Kermit, -s %s is the filename sent, -a %s the filename on arrival -# (if they are given in reverse order here, the command will fail): -#DOWNLOADER:Use Kermit to download to the terminal:kermit -i -s %s -a %s:TRUE -# NB don't use -k with Most, so that binaries will invoke hexadecimal mode: +# examples #DOWNLOADER:Use Most to view:most +s %s:TRUE -# The following example gives wrong filenames -# (`sz' doesn't support a suggested filename parameter): +# (don't use most's -k switch, so that binaries will invoke hexadecimal mode) +#DOWNLOADER:Use Kermit to download to the local terminal:kermit -i -s %s -a %s:TRUE #DOWNLOADER:Use Zmodem to download to the local terminal:sz %s:TRUE -# The following example returns correct filenames -# by using a script to make a subdirectory in /tmp, -# but may conflict with very strong security or permissions restrictions: #DOWNLOADER:Use Zmodem to download to the local terminal:set %s %s;td=/tmp/Lsz$$;mkdir $td;ln -s $1 $td/"$2";sz $td/"$2";rm -r $td:TRUE +# +# Note for Zmodem: The first variant gives wrong filenames ("sz" doesn't support +# a suggested filename parameter, sorry). The second returns correct filenames +# but may conflict with very strong security or permissions restrictions +# (it uses the script to make a subdirectory in /tmp, see below). +# (example script in lieu of :sz %s: for offering a suggested filename) +# :set %s %s;td=/tmp/Lsz$$;mkdir $td;ln -s $1 $td/"$2";sz $td/"$2";rm -r $td: +# # Unix ONLY: #=========== @@ -1134,7 +1045,6 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # # example #UPLOADER:Use Kermit to upload from your computer: kermit -i -r -a %s:TRUE -#UPLOADER:Use Zmodem to upload from your computer: rz %s:TRUE # If NO_DOT_FILES is TRUE (normal default via userdefs.h), the user will not # be allowed to specify files beginning with a dot in reply to output filename @@ -1179,7 +1089,7 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # strings will be links for the resolved SRC rather than just text. For # ISMAP or other graphic links, the ALT or pseudo-ALT ("[ISMAP]" or "[LINK]") # strings will have '-' and a link labeled "[IMAGE]" for the resolved SRC -# appended. See also VERBOSE_IMAGES flag. +# appended. # # The default defined here will override that in userdefs.h, and the user # can use LYK_IMAGE_TOGGLE to toggle the feature on or off at run time. @@ -1193,7 +1103,6 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html # i.e., they'll be treated as having ALT="". If MAKE_LINKS_FOR_ALL_IMAGES # is defined or toggled to TRUE, however, the pseudo-ALTs will be created # for inlines, so that they can be used as links to the SRCs. -# See also VERBOSE_IMAGES flag. # # The default defined here will override that in userdefs.h, and the user # can use LYK_INLINE_TOGGLE to toggle the feature on or off at run time. @@ -1358,7 +1267,6 @@ MINIMAL_COMMENTS:TRUE #SUFFIX:.tar:application/octet-stream #SUFFIX:.Z:application/octet-stream #SUFFIX:.gz:application/octet-stream -#SUFFIX:.bz2:application/octet-stream #SUFFIX:.zip:application/octet-stream #SUFFIX:.lzh:application/octet-stream #SUFFIX:.lha:application/octet-stream @@ -1549,7 +1457,7 @@ MINIMAL_COMMENTS:TRUE #KEYMAP:o:OPTIONS # Show the options menu #KEYMAP:i:INDEX_SEARCH # Search a server based index #KEYMAP:/:WHEREIS # Find a string within the current document -#KEYMAP:n:NEXT # Find next occurrence of string within document +#KEYMAP:n:NEXT # Find next occurence of string within document #KEYMAP:c:COMMENT # Comment to the author of the current document #KEYMAP:e:EDIT # Edit current document #KEYMAP:E:ELGOTO # Edit the current link's URL or ACTION and go to it @@ -1651,7 +1559,7 @@ MINIMAL_COMMENTS:TRUE # Unix ONLY: #=========== # DIRED_MENU items are used to compose the F)ull menu list in DIRED mode -# The behavior of the default configuration given here is much the same +# The behaviour of the default configuration given here is much the same # as it was when this menu was hard-coded but these items can now be adjusted # to suit local needs. In particular, many of the LYNXDIRED actions can be # replaced with lynxexec, lynxprog and lynxcgi script references. @@ -1829,3 +1737,23 @@ MINIMAL_COMMENTS:TRUE # # EXTERNAL:ftp:wget %s &:TRUE +# Raw DOS Key hack +# If RAW_DOS_KEY_HACK is set to FALSE, it will bypass the DOS key hack. +# The DOS key hack is only present if compiled with -DRAWDOSKEYHACK +# The hack is as follows: +# if (c == 0) c = '/'; +# if (c > 255) { /* handle raw dos keys */ +# switch (c) +# { +# case 464: c = '-'; break; /* keypad minus*/ +# case 465: c = '+'; break; /* keypad plus*/ +# case 459: c = 13; break; /* keypad enter*/ +# case 463: c = '*'; break; /* keypad * */ +# case 440: c = 'Q'; break; /* alt x */ +# case 265: c = 'H'; break; /* F1 */ +# default: break; +# } +# } +# +# RAW_DOS_KEY_HACK:TRUE + @@ -1,6 +1,6 @@ 1 LYNX NAME - lynx - a general purpose distributed information browser for the World + lynx - a general purpose distributed information browser for the World Wide Web 2 SYNOPSIS @@ -15,8 +15,7 @@ display). It will display hypertext markup language (HTML) documents con- taining links to files residing on the local system, as well as files residing on remote systems running Gopher, HTTP, FTP, WAIS, and NNTP - servers. Current versions of Lynx run on Unix, VMS, Windows95/NT, - 386DOS and OS/2 EMX. + servers. Current versions of Lynx run on Unix and VMS. Lynx can be used to access information on the World Wide Web, or to build information systems intended primarily for local access. For example, Lynx @@ -24,7 +23,7 @@ addition, Lynx can be used to build systems isolated within a single LAN. 2 OPTIONS - At start up, Lynx will load any local file or remote URL specified at + At start up, Lynx will load any local file or remote URL specified at the command line. For help with URLs, press "?" or "h" while running Lynx. Then follow the link titled, "Help on URLs." @@ -35,9 +34,6 @@ -get_data or -post_data arguments (see below). Encase it in double-quotes ("-"). - -accept_all_cookies - accept all cookies. - -anonymous used to specify the anonymous account. @@ -99,16 +95,10 @@ -cookies toggles handling of Set-Cookie headers. - -cookie_file=FILENAME - specifies a file to use to store cookies. - -crawl with -traversal, output each page to a file. with -dump, format output as with -traversal, but to stdout. - -debug_partial - incremental display stages with MessageSecs delay - -display=DISPLAY set the display variable for X rexec-ed programs. @@ -131,9 +121,6 @@ -error_file=FILE define a file where Lynx will report HTTP access codes. - -exec - enable local program execution (normally not configured). - -fileversions include all versions of files in local VMS directory listings. @@ -143,13 +130,10 @@ -force_secure toggles forcing of the secure flag for SSL cookies. - -forms_options - toggles the style of options (menu or forms). - -from toggles transmissions of From headers. - -ftp + -ftp disable ftp access. -get_data @@ -159,22 +143,7 @@ send a HEAD request for the mime headers. -help - print the Lynx command syntax usage message. - - -hiddenlinks=[option] - control the display of hidden links. - - + merge - hidden links show up as bracketed numbers and are numbered together - with other links in the sequence of their occurrence in the document. - - + listonly - hidden links are shown only on L)ist screens and listings generated by - -dump or from the P)rint menu, but appear separately at the end of - those lists. This is the default behavior. - - + ignore - hidden links do not appear even in listings. + print this Lynx command syntax usage message. -historical toggles use of '>' or '-->' as a terminator for comments. @@ -261,9 +230,6 @@ -number_links force numbering of links. - -partial - display partial pages while downloading. - -pauth=ID:PASSWD set authorization ID and password for a protected proxy server at startup. Be sure to protect any script files @@ -399,23 +365,13 @@ changed in userdefs.h or lynx.cfg. The command line switch toggles the default. - -soft_dquotes - toggles emulation of the old Netscape and Mosaic bug which - treated '>' as a co-terminator for double-quotes and tags. - -source works the same as dump but outputs HTML source instead of formatted text. - -stack_dump - disable SIGINT cleanup handler - -startfile_ok allow non-http startfile and homepage with -validate. - -tagsoup - initialize parser, using Tag Soup DTD rather than SortaSGML. - -telnet disable recognition of telnet commands. @@ -440,14 +396,6 @@ -underscore toggles use of _underline_ format in dumps. - -use_mouse - turn on xterm mouse support. - Clicking the left mouse button on a link traverses it. - Clicking the right mouse button pops back. - Click in the first line of a page to scroll up. - Click in the last line of a page to scroll down. - Lynx must be compiled with ncurses or slang to support this feature. - -useragent=Name set alternate Lynx User-Agent header. @@ -455,12 +403,8 @@ accept only http URLs (for validation). Complete security restrictions also are implemented. - -verbose - taggles [LINK], [IMAGE] and [INLINE] comments - with filenames of these images. - -version - print version information. + print version information -vikeys enable vi-like key movement. @@ -476,7 +420,7 @@ o Type "k" for a complete list of the current key-stroke command mappings. 2 NOTES - This is the Lynx v2.8.1 Release + This is the Lynx v2.8 Release If you wish to contribute to the further development of Lynx, subscribe to our mailing list. Send email to <majordomo@sig.net> with @@ -494,10 +438,10 @@ Lynx has incorporated code from a variety of sources along the way. The earliest versions of Lynx included code from Earl Fogel of Computing Services at the University of Saskatchewan, who implemented HYPERREZ - in the Unix environment. HYPERREZ was developed by Niel Larson of + in the Unix environment. HYPERREZ was developed by Niel Larson of Think.com and served as the model for the early versions of Lynx. Those versions also incorporated libraries from the Unix Gopher clients - developed at the University of Minnesota, and the later versions of + developed at the University of Minnesota, and the later versions of Lynx rely on the WWW client library code developed by Tim Berners-Lee and the WWW community. Also a special thanks to Foteos Macrides who ported much of Lynx to VMS and did or organized most of its development @@ -512,7 +456,7 @@ Academic Computing Services University of Kansas Lawrence, Kansas 66047 - + Foteos Macrides Worcester Foundation for Biomedical Research Shrewsbury, Massachusetts 01545 @@ -47,10 +47,10 @@ Lynx can be used to build systems isolated within a single LAN. .SH OPTIONS -At start up, \fILynx\fR will load any local +At start up, \fILynx\fR will load any local file or remote URL specified at the command line. For help with URLs, press \fB"?"\fR -or \fB"H"\fR while running \fILynx\fR. +or \fB"h"\fR while running \fILynx\fR. Then follow the link titled, "Help on URLs." .PP .TP @@ -60,9 +60,6 @@ the arguments from stdin. This is to allow for the potentially very long command line that can be associated with the -get_data or -post_data arguments (see below). .TP -.B -accept_all_cookies -accept all cookies. -.TP .B -anonymous used to specify the anonymous account. .TP @@ -72,7 +69,7 @@ charset for documents that don't specify it. .B -assume_local_charset\fR=\fIID\fR:\fIMIMEname charset assumed for local files. .TP -.B -assume_unrec_charset\fR=\fIMIMEname +.B -assume_unrec_charset\fR=\fIID\fR:\fIMIMEname use this instead of unrecognized charsets. .TP .B -auth\fR=\fIID\fR:\fIPASSWD @@ -126,9 +123,6 @@ in .lynxrc on startup is overridden by this flag. .B -cookies toggles handling of Set-Cookie headers. .TP -.B -cookie_file\fR=\fIFILENAME -specifies a file to use to store cookies. -.TP .B -core toggles forced core dumps on fatal errors. .TP @@ -136,17 +130,13 @@ toggles forced core dumps on fatal errors. with -traversal, output each page to a file. with -dump, format output as with -traversal, but to stdout. .TP -.B -debug_partial -incremental display stages with MessageSecs delay -.TP .B -display\fR=\fIDISPLAY set the display variable for X rexec-ed programs. .TP .B -dump dumps the formatted output of the default document or one -specified on the command line to standard out. +specified on the command line to standard out. This can be used in the following way: -.sp lynx -dump http://www.crl.com/~subir/lynx.html. .TP .B -editor\fR=\fIEDITOR @@ -163,10 +153,7 @@ toggles compatibility with comm programs' scrollback keys .B -error_file\fR=\fIFILE define a file where Lynx will report HTTP access codes. .TP -.B -exec -enable local program execution (normally not configured). -.TP -.B -fileversions +.B -fileversions include all versions of files in local VMS directory listings. .TP .B -force_html @@ -175,13 +162,10 @@ forces the first document to be interpreted as HTML. .B -force_secure toggles forcing of the secure flag for SSL cookies. .TP -.B -forms_options -toggles the style of options (menu or forms). -.TP .B -from toggles transmissions of From headers. .TP -.B -ftp +.B -ftp disable ftp access. .TP .B -get_data @@ -191,7 +175,7 @@ send form data from stdin using GET method and dump results. send a HEAD request for the mime headers. .TP .B -help -print the Lynx command syntax usage message. +print this Lynx command syntax usage message. .TP .B -hiddenlinks=[option] control the display of hidden links. @@ -295,9 +279,6 @@ disable the retrieval status messages. .B -number_links force numbering of links. .TP -.B -partial -display partial pages while downloading. -.TP .B -pauth\fR=\fIID\fR:\fIPASSWD set authorization ID and password for a protected proxy server at startup. Be sure to protect any script files @@ -336,12 +317,12 @@ allows a list of services to be disabled selectively. The following list is printed if no options are specified. -.I all +.I all - restricts all options. -.I bookmark -- disallow changing the location of the bookmark -file. +.I bookmark +- disallow changing the location of the bookmark +file. .I bookmark_exec - disallow execution links via the bookmark file. @@ -351,57 +332,57 @@ file. (but still allow it for directories) when local file management is enabled. -.I default -- same as command line option -anonymous. -Disables default services for anonymous users. -Currently set to all restricted except for: -inside_telnet, outside_telnet, inside_news, +.I default +- same as command line option -anonymous. +Disables default services for anonymous users. +Currently set to all restricted except for: +inside_telnet, outside_telnet, inside_news, inside_ftp, outside_ftp, inside_rlogin, -outside_rlogin, jump, mail and goto. Defaults +outside_rlogin, jump, mail and goto. Defaults are setable within userdefs.h. .I dired_support - disallow local file management. -.I disk_save +.I disk_save - disallow saving to disk in the download and print menus. .I download - disallow downloaders in the download menu. -.I editor +.I editor - disallow editing. -.I exec +.I exec - disable execution scripts. .I exec_frozen -- disallow the user from changing the local +- disallow the user from changing the local execution option. -.I file_url +.I file_url - disallow using G)oto, served links or bookmarks for file: URLs. -.I goto -- disable the 'g' (goto) command. +.I goto +- disable the 'g' (goto) command. .I inside_ftp - disallow ftps for people coming from inside your domain (utmp required for selectivity). .I inside_news -- disallow USENET news posting for people coming +- disallow USENET news posting for people coming from inside your domain (utmp required for selectivity). .I inside_rlogin - disallow rlogins for people coming from inside your domain (utmp required for selectivity). -.I inside_telnet -- disallow telnets for people coming from inside -your domain (utmp required for selectivity). +.I inside_telnet +- disallow telnets for people coming from inside +your domain (utmp required for selectivity). .I jump - disable the 'j' (jump) command. @@ -415,7 +396,7 @@ your domain (utmp required for selectivity). .I news_post - disallow USENET News posting. -.I options_save +.I options_save - disallow saving options in .lynxrc. .I outside_ftp @@ -423,24 +404,24 @@ your domain (utmp required for selectivity). domain (utmp required for selectivity). .I outside_news -- disallow USENET news posting for people coming +- disallow USENET news posting for people coming from outside your domain (utmp required for selectivity). .I outside_rlogin - disallow rlogins for people coming from outside your domain (utmp required for selectivity). -.I outside_telnet -- disallow telnets for people coming from -outside your domain (utmp required for selectivity). +.I outside_telnet +- disallow telnets for people coming from +outside your domain (utmp required for selectivity). -.I print -- disallow most print options. +.I print +- disallow most print options. -.I shell +.I shell - disallow shell escapes and lynxexec or lynxprog G)oto's. -.I suspend +.I suspend - disallow Unix Control-Z suspends with escape to shell. .I telnet_port @@ -469,23 +450,13 @@ systems without FANCY_CURSES capabilities. The default configuration can be changed in userdefs.h or lynx.cfg. The command line switch toggles the default. .TP -.B -soft_dquotes -toggles emulation of the old Netscape and Mosaic bug which -treated '>' as a co-terminator for double-quotes and tags. -.TP .B -source works the same as dump but outputs HTML source instead of formatted text. .TP -.B -stack_dump -disable SIGINT cleanup handler -.TP .B -startfile_ok allow non-http startfile and homepage with -validate. .TP -.B -tagsoup -initialize parser, using Tag Soup DTD rather than SortaSGML. -.TP .B -telnet disable recognition of telnet commands. .TP @@ -510,14 +481,6 @@ for more information. .B -underscore toggles use of _underline_ format in dumps. .TP -.B -use_mouse -turn on xterm mouse support. -Clicking the left mouse button on a link traverses it. -Clicking the right mouse button pops back. -Click in the first line of a page to scroll up. -Click in the last line of a page to scroll down. -Lynx must be compiled with ncurses or slang to support this feature. -.TP .B -useragent=Name set alternate Lynx User-Agent header. .TP @@ -525,9 +488,6 @@ set alternate Lynx User-Agent header. accept only http URLs (for validation). Complete security restrictions also are implemented. .TP -.B -verbose -taggles [LINK], [IMAGE] and [INLINE] comments with filenames of these images. -.TP .B -version print version information. .TP @@ -543,13 +503,13 @@ o \fBRight arrow\fR or \fBReturn\fR will follow a highlighted hypertext link. .br o \fBLeft Arrow\fR will retreat from a link. .br -o Type \fB"H"\fR or \fB"?"\fR for online help and descriptions +o Type \fB"h"\fR or \fB"?"\fR for online help and descriptions of key-stroke commands. .br -o Type \fB"K"\fR for a complete list of the current key-stroke +o Type \fB"k"\fR for a complete list of the current key-stroke command mappings. .SH NOTES -This is the Lynx v2.8.1 Release +This is the Lynx v2.8 Release .PP If you wish to contribute to the further development of \fILynx\fR, subscribe to our mailing list. Send email to @@ -566,10 +526,10 @@ Do not send the unsubscribe message to the lynx-dev list, itself. Lynx has incorporated code from a variety of sources along the way. The earliest versions of Lynx included code from Earl Fogel of Computing Services at the University of Saskatchewan, who implemented HYPERREZ -in the Unix environment. HYPERREZ was developed by Niel Larson of +in the Unix environment. HYPERREZ was developed by Niel Larson of Think.com and served as the model for the early versions of Lynx. Those versions also incorporated libraries from the Unix Gopher clients -developed at the University of Minnesota, and the later versions of +developed at the University of Minnesota, and the later versions of Lynx rely on the WWW client library code developed by Tim Berners-Lee and the WWW community. Also a special thanks to Foteos Macrides who ported much of Lynx to VMS and did or organized most of its development since the diff --git a/lynx_help/Lynx_users_guide.html b/lynx_help/Lynx_users_guide.html index 2341e928..49cec8d3 100644 --- a/lynx_help/Lynx_users_guide.html +++ b/lynx_help/Lynx_users_guide.html @@ -1,12 +1,12 @@ <!DOCTYPE html public "-//IETF//DTD HTML 3.0//EN"> <html> <head> -<title>Lynx Users Guide v2.8.1</title> +<title>Lynx Users Guide v2.8</title> <link rev="made" href="mailto:lynx-dev@sig.net"> </head> <body> -<h1>Lynx Users Guide v2.8.1</h1> +<h1>Lynx Users Guide v2.8</h1> Lynx is a fully-featured <em>World Wide Web</em> (<em>WWW</em>) client for users running cursor-addressable, character-cell display devices (e.g., @@ -18,7 +18,7 @@ well as files on remote systems running <em>http</em>, <em>gopher</em>, <em>cso</em>/<em>ph</em>/<em>qi</em> servers, and services accessible via logins to <em>telnet</em>, <em>tn3270</em> or <em>rlogin</em> accounts (see <a href="lynx_url_support.html">URL Schemes Supported by Lynx</a>). -<a href="#Hist">Current</a> versions of Lynx run on Unix, VMS, +<a href="#32">Current</a> versions of Lynx run on Unix, VMS, Windows95/NT, 386DOS and OS/2 EMX. <p>Lynx can be used to access information on the <em>WWW</em>, or to build @@ -27,59 +27,57 @@ has been used to build several <em>Campus Wide Information Systems</em> (<em>CWIS</em>). In addition, Lynx can be used to build systems isolated within a single LAN. -<h2 ID="TOC"><A NAME="Contents"><em>Table of Contents</em></A></h2> +<h2><A NAME="TOC"><em>Table of Contents</em></A></h2> <ul> -<li><A HREF="#Help" NAME="ToC-Help">Lynx online help</A> -<li><A HREF="#Local" NAME="ToC-Local">Viewing local files with Lynx</A> -<li><A HREF="#Leaving" NAME="ToC-Leaving">Leaving Lynx</A> -<li><A HREF="#Remote" NAME="ToC-Remote">Starting Lynx with a Remote File</A> -<li><A HREF="#EnVar" NAME="ToC-EnVar">Starting Lynx with the WWW_HOME environment variable.</A> -<li><A HREF="#IntraDocNav" NAME="ToC-IntraDocNav">Navigating hypertext documents with Lynx</A> -<li><A HREF="#Disposing" NAME="ToC-Disposing">Printing, Mailing, and Saving rendered files to disk.</A> -<li><A HREF="#LocalSource" NAME="ToC-LocalSource">Viewing the HTML document source and editing documents</A> -<li><A HREF="#RemoteSource" NAME="ToC-RemoteSource">Downloading and Saving source files.</A> -<li><A HREF="#ReDo" NAME="ToC-ReDo">Reloading files and refreshing the display</A> -<li><A HREF="#Search" NAME="ToC-Search">Lynx searching commands</A> -<li><A HREF="#InteractiveOptions" NAME="ToC-InteractiveOptions">Lynx Options Menu</A> -<li><A HREF="#Mail" NAME="ToC-Mail">Comments and mailto: links</A> -<li><A HREF="#News" NAME="ToC-News">USENET News posting</A> -<li><A HREF="#Bookmarks" NAME="ToC-Bookmarks">Lynx bookmarks</A> -<li><A HREF="#Jumps" NAME="ToC-Jumps">Jump command</A> -<li><A HREF="#DirEd" NAME="ToC-DirEd">Directory Editing</A> -<li><A HREF="#MiscKeys" NAME="ToC-MiscKeys">Scrolling and Other useful commands</A> -<li><a href="#Forms" NAME="ToC-Forms">Lynx and HTML Forms</a> -<li><a href="#Tables" NAME="ToC-Tables">Lynx and HTML Tables</a> -| <a href="#Tabs" NAME="ToC-Tabs">Lynx and HTML Tabs</a> -<li><a href="#Frames" NAME="ToC-Frames">Lynx and HTML Frames</a> -| <a href="#Banners" NAME="ToC-Banners">Lynx and HTML Banners</a> -<li><a href="#Footnotes" NAME="ToC-Footnotes">Lynx and HTML Footnotes</a> -| <a href="#Notes" NAME="ToC-Notes">Lynx and HTML Notes</a> -<li><a href="#Lists" NAME="ToC-Lists">Lynx and HTML Lists</a> -<li><a href="#Quotes" NAME="ToC-Quotes">Lynx and HTML Quotes</a> -<li><a href="#USEMAP" NAME="ToC-USEMAP">Lynx and Client-Side-Image-Maps</a> -<li><a href="#Refresh" NAME="ToC-Refresh">Lynx and Client-Side-Pull</a> -<li><a href="#Cookies" NAME="ToC-Cookies">Lynx and State Management</a> (Me want <em>cookie</em>!) -<li><A HREF="#Invoking" NAME="ToC-Invoking">The Lynx command line</A> -<li><A HREF="#lynx.cfg" NAME="ToC-lynx.cfg">Main configuration file lynx.cfg</A> -<li><A HREF="#Hist" NAME="ToC-Hist">Lynx development history</A> +<li><A HREF="#1">Lynx online help</A> +<li><A HREF="#2">Viewing local files with Lynx</A> +<li><A HREF="#3">Leaving Lynx</A> +<li><A HREF="#4">Starting Lynx with a Remote File</A> +<li><A HREF="#5">Starting Lynx with the WWW_HOME environment variable.</A> +<li><A HREF="#6">Navigating hypertext documents with Lynx</A> +<li><A HREF="#7">Printing, Mailing, and Saving rendered files to disk.</A> +<li><A HREF="#8">Viewing the HTML document source and editing documents</A> +<li><A HREF="#9">Downloading and Saving source files.</A> +<li><A HREF="#10">Reloading files and refreshing the display</A> +<li><A HREF="#11">Lynx searching commands</A> +<li><A HREF="#12">Lynx Options Menu</A> +<li><A HREF="#13">Comments and mailto: links</A> +<li><A HREF="#14">USENET News posting</A> +<li><A HREF="#15">Lynx bookmarks</A> +<li><A HREF="#16">Jump command</A> +<li><A HREF="#17">Directory Editing</A> +<li><A HREF="#18">Scrolling and Other useful commands</A> +<li><a href="#19">Lynx and HTML Forms</a> +<li><a href="#20">Lynx and HTML Tables</a> +| <a href="#21">Lynx and HTML Tabs</a> +<li><a href="#22">Lynx and HTML Frames</a> +| <a href="#23">Lynx and HTML Banners</a> +<li><a href="#24">Lynx and HTML Footnotes</a> +| <a href="#25">Lynx and HTML Notes</a> +<li><a href="#26">Lynx and HTML Lists</a> +<li><a href="#27">Lynx and HTML Quotes</a> +<li><a href="#28">Lynx and Client-Side-Image-Maps</a> +<li><a href="#29">Lynx and Client-Side-Pull</a> +<li><a href="#30">Lynx and State Management</a> (Me want <em>cookie</em>!) +<li><A HREF="#31">The Lynx command line</A> +<li><A HREF="#32">Lynx development history</A> </ul> -<h2 ID="Help"><A NAME="Help"><em>Lynx online help</em></A></h2> +<h2><A NAME="1"><em>Lynx online help</em></A></h2> Online help is available while viewing any document. Press the -'<em>?</em>' or '<em>H</em>' key (or the '<em>h</em> key if -vi-like key movement is not on) to see a list of help topics. -See the section titled <A HREF="#IntraDocNav">Navigating -hypertext documents with Lynx</A> for information on navigating -through the help files. +'<em>?</em>' or '<em>H</em>' key (or the '<em>h</em> key if vi-like +key movement is not on) to see a list of help topics. See the section +titled <A HREF="#6">Navigating hypertext documents with Lynx</A> for +information on navigating through the help files. <p>In addition, a summary description of all the Lynx keystroke commands and their key bindings is available by pressing the '<em>K</em>' key (or the '<em>k</em>' key if vi-like key movement is not on). -[<A HREF="#ToC-Help">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="Local"><A NAME="Local"><em>Viewing local files with Lynx</em></A></h2> +<h2><A NAME="2"><em>Viewing local files with Lynx</em></A></h2> Lynx can be started by entering the Lynx command along with the name of a file to display. For example these commands could @@ -153,18 +151,18 @@ wishes to download the file or cancel. If the user selects '<em>D'</em> for download, Lynx will transfer the file into a temporary location and present the user with a list of options. The only default option is <em>Save to disk</em>, which is disabled if Lynx is running in anonymous -mode. Additional download methods may be defined in the -<A HREF="#lynx.cfg">lynx.cfg</A> file. Programs like kermit, zmodem -and FTP are some possible options. [<A HREF="#ToC-Local">ToC</A>] +mode. Any number of additional download methods may be defined in the +lynx.cfg file by the system administrator. Programs like kermit, zmodem +and FTP are some possible options. [<A HREF="#TOC">ToC</A>] -<h2 ID="Leaving"><A NAME="Leaving"><em>Leaving Lynx</em></A></h2> +<h2><A NAME="3"><em>Leaving Lynx</em></A></h2> To exit Lynx use the '<em>q</em>' command. You will be asked whether you really want to quit. Answering '<em>y</em>' will exit and '<em>n</em>' will return you to the current document. Use '<em>Q</em>' or -<em>Control-D</em> to quit without verification. [<A HREF="#ToC-Leaving">ToC</A>] +<em>Control-D</em> to quit without verification. [<A HREF="#TOC">ToC</A>] -<h2 ID="Remote"><A NAME="Remote"><em>Starting Lynx with a Remote File</em></A></h2> +<h2><A NAME="4"><em>Starting Lynx with a Remote File</em></A></h2> If you wish to view a remote file (that is, a file residing on some computer system other than the one upon which you are running @@ -221,9 +219,10 @@ portions of it in the startfile argument. For example:<br> <tab indent="62">will be expanded to:<br> <tab indent="14"><em>ftp://ftp.more.net/pub</em><br> See <a href="lynx_url_support.html">URL Schemes Supported by Lynx</a> for -more detailed information. [<A HREF="#ToC-Remote">ToC</A>] +more detailed information. [<A HREF="#TOC">ToC</A>] -<h2 ID="EnVar"><A NAME="EnVar"><em>Starting Lynx with the WWW_HOME environment variable.</em></A></h2> +<h2><A NAME="5" +><em>Starting Lynx with the WWW_HOME environment variable.</em></A></h2> You may also specify a starting file for Lynx using the WWW_HOME environment variable, @@ -243,9 +242,9 @@ environment variable, </dl> Note that on VMS the double-quoting <em>must</em> be included to preserve -casing. [<A HREF="#ToC-EnVar">ToC</A>] +casing. -<h2 ID="IntraDocNav"><A NAME="IntraDocNav"><em>Navigating hypertext documents with Lynx</em></A></h2> +<h2><A NAME="6"><em>Navigating hypertext documents with Lynx</em></A></h2> The process of moving within a hypertext web, selecting and displaying links is known as "navigation." With Lynx almost all navigation can be @@ -269,7 +268,7 @@ accomplished with the arrow keys and the numeric keypad. There are also a few other keyboard commands to aid in navigation. The Control and Function keys used for navigation within the current document are described in <A -HREF="#MiscKeys"><em>Scrolling and Other useful commands</em></A>. Some +HREF="#18"><em>Scrolling and Other useful commands</em></A>. Some additional commands depend on the fact that Lynx keeps a list of each link you visited to reach the current document, called the <a href="keystrokes/history_help.html">History Page</a>, and a @@ -298,9 +297,9 @@ program you are using was configured. will automatically prompt for a username and a password. If you give the correct information, you will then be served the requested information. Lynx will automatically send your username and password to the same server -if it is needed again. [<A HREF="#ToC-IntraDocNav">ToC</A>] +if it is needed again. [<A HREF="#TOC">ToC</A>] -<h2 ID="Disposing"><A NAME="Disposing" +<h2><A NAME="7" ><em>Printing, Mailing, and Saving rendered files to disk.</em></A></h2> Rendered HTML documents, and plain text files, may be printed using the @@ -318,8 +317,8 @@ mail files to themselves and print the entire file to the screen. Lynx from their own accounts (that is, so-called "non-anonymous users"). In particular, the <em>Save to a local file</EM> option allows you to save the document into a file on your disk -space. Additional print options may also be -available as configured in the <A HREF="#lynx.cfg">lynx.cfg</A> file. +space. Any number of additional print options may also be +available as configured by your system administrator. <p>Some options, such as <em>Save to a local file</em>, involve prompting for an output filename. All output filename entries are saved in a @@ -327,11 +326,10 @@ circular buffer, and any previous entries can be retrieved for re-use by pressing the <em>up-arrow</em> or <em>down-arrow</em> keys at the prompt. <p>Note that if you want exact copies of text files without any expansions -of TAB characters to spaces you should use the -<a href="#RemoteSource">Download</a> options. -[<A HREF="#ToC-Disposing">ToC</A>] +of TAB characters to spaces you should use the <a href="#9">Download</a> +options. [<A HREF="#TOC">ToC</A>] -<h2 ID="LocalSource"><A NAME="LocalSource" +<h2><A NAME="8" ><em>Viewing the HTML document source and editing documents</em></A></h2> When viewing HTML documents it is possible to retrieve and display the @@ -344,7 +342,7 @@ When viewing unrendered documents you may print them as any normal document. <p>Selecting the <em>Print to a local file</em> option from the Print Menu, makes it possible to save the source of the document to disk so that you may have a local copy of the document source, but it is better to <a -href="#RemoteSource">Download</a> the source. +href="#9">Download</a> the source. <p>NOTE: When saving an HTML document it is important to name the document with a <em>.html</em> extension, if you want to read it with @@ -368,45 +366,32 @@ documents by using the '<em>e</em>' command. When the '<em>e</em>' command is entered your specified editor is spawned to edit the file. After changes are completed, exit your editor and you will return to Lynx. Lynx will reload and render the file so that changes can be immediately -examined. [<A HREF="#ToC-LocalSource">ToC</A>] - -<h2 ID="RemoteSource"><A NAME="RemoteSource"><em>Downloading and Saving source files.</em></A></h2> - -If the DOWNLOAD keystroke command ('<em>d</em>' or <em>D</em>) is -used when positioned on a link for an HTML, plain text, or binary -file, Lynx will transfer the file, without rendering, into a -temporary location and present the user with a list of options, -just as it does when a link for a binary file of a type for which -no viewer has been mapped is activated. - -<P>There is a default <em>Download option</em> of <em>Save to -disk</em>. This is disabled if Lynx is running in anonymous -mode. Any number of download methods such as kermit and zmodem -may be defined in addition to this default in the -<em>lynx.cfg</em> file. Using the <em>Save to disk</em> option -under the PRINT command after viewing the source of an HTML with -the VIEW SOURCE (<em>\</em>) command will result in a file which -differs from the original source in various ways such as tab -characters expanded to spaces. Lynx formats the source presentation -in this mode. On the other hand, if the DOWNLOAD command is used, -the only change will be that Lynx optionally puts -<blockquote> -<!--X-URL: http://www.site.foo/path/to/file.html --><BR> -<BASE href="http://www.site.foo/path/to/file.html"> -</blockquote> -at the start of the file so that relative URLs in the document -will still work. - -Even this modification can be prevented by setting -PREPEND_BASE_TO_SOURCE:FALSE in lynx.cfg. +examined. [<A HREF="#TOC">ToC</A>] + +<h2><A NAME="9"><em>Downloading and Saving source files.</em></A></h2> + +If the DOWNLOAD keystroke command ('<em>d</em>' or <em>D</em>) is used +when positioned on a link for an HTML, plain text, or binary file, Lynx +will transfer the file, without rendering or modification, into a temporary +location and present the user with a list of options, as when a link for a +binary file of a type for which no viewer has been mapped is activated. +As described above, the only default <em>Download option</em> is +<em>Save to disk</em>, which is disabled if Lynx is running in +anonymous mode, and any number of additional download methods such as +kermit and zmodem may be defined in the <em>lynx.cfg</em> file by the +system administrator. Downloading the sources of HTML and plain text +files, instead of toggling to <a href="#8">display the source</a> +('<em>\</em>') and then using <a href="#7">Printing</a> options, ensures +that no modifications of the source (e.g., expansions of TAB characters +to a series of spaces) will occur. <p>Some options, such as <em>Save to disk</em>, involve prompting for an output filename. All output filename entries are saved in a circular buffer, and any previous entries can be retrieved for re-use by pressing the <em>up-arrow</em> or <em>down-arrow</em> keys at the prompt. -[<A HREF="#ToC-RemoteSource">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="ReDo"><A NAME="ReDo" +<h2><A NAME="10" ><em>Reloading files and refreshing the display</em></A></h2> The RELOAD (<em>Control-R</em>) command will reload and re-render the file @@ -421,19 +406,17 @@ cache from a previous request or submission exits. The request or submission will include <em>Pragma: no-cache</em> and <em>Cache-Control: no-cache</em> in its headers. Note that FORMs with POST content will be resubmitted regardless of whether the NOCACHE or ACTIVATE command is used (see <A -HREF="#Forms"><em>Lynx and HTML Forms</em></A>). -[<A HREF="#ToC-ReDo">ToC</A>] +HREF="#19"><em>Lynx and HTML Forms</em></A>). [<A HREF="#TOC">ToC</A>] -<h2 ID="Search"><A NAME="Search"><em>Lynx searching commands</em></A></h2> +<h2><A NAME="11"><em>Lynx searching commands</em></A></h2> Two commands activate searching in Lynx: '<em>/</em>' and '<em>s</em>'. -<p>While viewing a normal document use the '<em>/</em>' command -to find a word or phrase within the current document. The search -type will depend on the search option setting in the <a -href="#InteractiveOptions">Options Menu</a>. The search options -are case sensitive and case insensitive. These searches are -entirely local to Lynx. +<p>While viewing a normal document use the '<em>/</em>' command to find a +word or phrase within the current document. The search type will depend on +the search option setting in the <a href="#12">Options Menu</a>. The search +options are case sensitive and case insensitive. These searches are entirely +local to Lynx. <p>Some documents are designated <em>index documents</em> by virtue of an ISINDEX element in their HEAD section. These documents can be used to @@ -458,7 +441,7 @@ documents, or if the current document is reloaded. The search cycles to the top of the document if the word or phrase is not located below your current position. -<p>Although <a href="#Forms">HTML Forms</a> have largely replaced index +<p>Although <a href="#19">HTML Forms</a> have largely replaced index documents for searches via http servers, they are still useful for performing searches directly via WAIS or Gopher servers in conjunction with the internal gateways for such servers. For example, an HTML index document can act as a @@ -467,68 +450,13 @@ strings for searching it, and include an element such as:<BR> <tab indent="12"><em><ISINDEX <tab id="idx">PROMPT="Enter WAIS query:"<BR> <tab to="idx">HREF="wais://net.bio.net/biologists-addresses"></em><BR> for submitting a search of the Biologist's Addresses database directly -to the net.bio.net WAIS server. [<A HREF="#ToC-Search">ToC</A>] +to the net.bio.net WAIS server. [<A HREF="#TOC">ToC</A>] -<h2 ID="InteractiveOptions"><A NAME="InteractiveOptions"><em>Lynx Options Menu</em></A></h2> +<h2><A NAME="12"><em>Lynx Options Menu</em></A></h2> The Lynx <em>Options Menu</em> may be accessed by pressing the '<em>o</em>' -key. The current Options Menu allows you to change options which are -useful at runtime. Most of these are read/saved from your .lynxrc file. -Other options are stored in the <A HREF="#lynx.cfg">lynx.cfg</A> file. - -<p>Lynx supports two styles of options menu. The new style shown below is an HTML -file generated at runtime: - -<pre> - - Options Menu (Lynx Version 2.8.1pre.2) - - Accept Changes - Reset Changes Left Arrow cancels changes HELP! - - Save options to disk: [_] - - Personal Preferences - Cookies : [ask user..] - Editor : __________________________________________ - Emacs keys : [OFF] - Keypad mode : [Numbers act as arrows.............] - Personal mail address : __________________________________________ - Popups for select fields : [ON.] - Searching type : [Case insensitive] - Show color : [ON....] - Show cursor : [OFF] - User mode : [Novice......] - Verbose images : [OFF] - VI keys : [OFF] - X Display : __________________________________________ - - Bookmark Options - Multi-bookmarks : [OFF.....] - Bookmarks file : __________________________________________ - - Character Set Options - Assumed document character set : [iso-8859-1......] - Display character set : [Western (ISO-8859-1)...........] - Raw 8-bit : [ON.] - - File Management Options - Ftp sort criteria : [By Name] - Local directory sort criteria : [Mixed style......] - - Headers transferred to remote server - Preferred document character set : _________________________________ - Preferred document language : _________________________________ - User-Agent header : __________________________________________ - - Check your lynx.cfg here - - Accept Changes - Reset Changes Left Arrow cancels changes - -</pre> - -<p>The old style of options menu is a fixed form. Normally this will be -compiled into Lynx, and is accessed by setting FORMS_OPTIONS true in your -<A HREF="#lynx.cfg">lynx.cfg</A> file. +key. The current <em>Options Menu</em> contains the following configurable +options. <pre> Options Menu @@ -548,7 +476,7 @@ compiled into Lynx, and is accessed by setting FORMS_OPTIONS true in your K)eypad mode : Numbers act as arrows li(N)e edit style : Default Binding l(I)st directory style : Mixed style - U)ser mode : Advanced verbose images (!) : ON + U)ser mode : Advanced user (A)gent : [User-Agent header] local e(X)ecution links : FOR LOCAL FILES ONLY </pre> @@ -566,14 +494,13 @@ to get back to the <em>Command?</em> prompt. to toggle the choices and press the <em>Return</em> key to finish the change. -<p>For fields where you potentially have more than two choices, -popup windows may be evoked which function homologously to those -for select fields in <a href="#Forms">HTML Forms</a>. The popup -windows will be invoked only if you have popups for select fields -set to ON (see below). Otherwise, your cursor will be positioned -at the current choice, and you can press any key to cycle through -the choices, then press the <em>Return</em> key to finish the -change. +<p>For fields where you potentially have more than two choices, popup +windows may be evoked which function homologously to those for select +fields in <a href="#19">HTML Forms</a>. The popup windows will be invoked +only if you have popups for select fields set to ON (see below). Otherwise, +your cursor will be positioned at the current choice, and you can press any +key to cycle through the choices, then press the <em>Return</em> key to +finish the change. <p>When you are done changing options use the '<em>r</em>' command to return to Lynx or the '<em>></em>' command to save the options to a @@ -615,7 +542,7 @@ return to Lynx or the '<em>></em>' command to save the options to a href="keystrokes/edit_help.html">Line Editor</a>. Bookmark files allow frequently traveled links to be stored in personal easy to access files. Using the '<em>a</em>'dd bookmark - link command (see <a href="#Bookmarks">Lynx bookmarks</a>) you may save + link command (see <a href="#15">Lynx bookmarks</a>) you may save any link that does not have associated POST content into a bookmark file. All bookmark files must be in or under your account's home directory. If the location specified does not @@ -644,8 +571,7 @@ return to Lynx or the '<em>></em>' command to save the options to a yourself and will be included as the From: address in any mail or comments that you send. It will also be sent as the From: field in HTTP or HTTPS requests if inclusion of that header - has been enabled via the NO_FROM_HEADER definition in - <A HREF="#lynx.cfg">lynx.cfg</A> + has been enabled via the NO_FROM_HEADER definition in lynx.cfg (the compilation default is not to send the header), or via the <em>-from</em> command line toggle. @@ -685,41 +611,24 @@ return to Lynx or the '<em>></em>' command to save the options to a according to your terminal's character set so that characters other than 7-bit ASCII can be displayed correctly, using approximations if necessary. You must have the selected - character set installed on your terminal. (Since Lynx now - supports a wide range of platforms it may be useful to note - that cpXXX codepages used within IBM PC computers, and - windows-xxxx within native MS-Windows apps.) + character set installed on your terminal. <dt>Raw 8-bit or CJK Mode <dd>Whether 8-bit characters are assumed to correspond with the - display character set and therefore are processed without + selected character set and therefore are processed without translation via the chartrans conversion tables. Should be ON - by default when the display character set is one of the - Asian (CJK) sets and the 8-bit characters are Kanji multibytes. - Should be OFF for the other display character sets, - but can be turned ON + by default when the selected character set is one of the Asian + (CJK) sets and the 8-bit characters are Kanji multibytes. + Should be OFF for the other character sets, but can be turned ON when the document's charset is unknown (e.g., is not ISO-8859-1 and no charset parameter was specified in a reply header from an HTTP server to indicate what it is) but you know by some means that you have the matching display character set selected. Should be OFF when an Asian (CJK) set is selected but the document - is ISO-8859-1 or another 'assumed document character set'. - The setting also can be toggled via the RAW_TOGGLE + is ISO-8859-1. The setting also can be toggled via the RAW_TOGGLE command, normally mapped to '<em>@</em>', and at startup via the <em>-raw</em> switch. - <dt>Assumed document character set - <dd>This option changes the handling of documents which do not - explicitly specify a charset. Normally Lynx assumes that 8-bit - characters in those documents are encoded according to iso-8859-1 - (the official default for the HTTP protocol). Unfortunately, - many non-English web pages "forget" to include proper charset info; - this option helps you to browse those broken pages if you know - by some means what the charset is. When the value - given here or by an -assume_charset command line flag is in effect, - Lynx will treat documents as if they were encoded accordingly. - This option active when 'Raw 8-bit or CJK Mode' is OFF. - <dt>Show color. <dd>This option will be present if color support is available. If set to ON or ALWAYS, color mode will be forced on if possible. @@ -800,9 +709,9 @@ return to Lynx or the '<em>></em>' command to save the options to a selected or made current by numbers as well as using the arrow keys, or having every link as well as every form field numbered so that they can be selected or sought by numbers. See the<br> - <a href="keystrokes/follow_help.html" +  <a href="keystrokes/follow_help.html" >Follow link (or page) number:</a> and<br> - <a +  <a href="keystrokes/follow_help.html#select-option" >Select option (or page) number:</a><br> help for more information. @@ -842,31 +751,23 @@ return to Lynx or the '<em>></em>' command to save the options to a link at the bottom of the screen. </dl> - <dt>Verbose Images - <dd>Controls whether or not Lynx replaces the [LINK], [INLINE] and - [IMAGE] comments (for images without ALT) with filenames of these - images. This is extremely useful because now we can determine - immediately what images are just decorations (button.gif, line.gif) - and what images are important. This setting can also be toggled - on startup via the <em>-verbose</em> switch. - <dt>User Agent <dd>The header string which Lynx sends to servers to indicate the User-Agent is displayed here. Changes may be disallowed via the <em>-restrictions</em> switch. Otherwise, the header can be - changed temporarily to a string such as <em>L_y_n_x/2.8.1</em> + changed temporarily to a string such as <em>L_y_n_x/2.8</em> for access to sites which discriminate against Lynx based on checks for the presence of "Lynx" in the header. If changed during a Lynx session, the default User-Agent header can be restored by deleting the modified string in the - Options Menu. Whenever the User-Agent header is + <em>Options Menu</em>. Whenever the User-Agent header is changed, the current document is reloaded, with the no-cache - flags set, on exit from the Options Menu. Changes of + flags set, on exit from the <em>Options Menu</em>. Changes of the header are not saved in the RC file. <dd><em>NOTE</em> that Netscape Communications Corp. has claimed that false transmissions of "Mozilla" as the User-Agent are a copyright infringement, which will be prosecuted. <em>DO NOT</em> - misrepresent Lynx as Mozilla. The Options Menu issues + misrepresent Lynx as Mozilla. The <em>Options Menu</em> issues a warning about possible copyright infringement whenever the header is changed to one which does not include "Lynx" or "lynx". @@ -895,10 +796,10 @@ return to Lynx or the '<em>></em>' command to save the options to a executed Lynx will show the script within the Lynx window and inform the user that the script is not allowed to be executed and will ask the user to check his/her options. - [<A HREF="#ToC-InteractiveOptions">ToC</A>] + [<A HREF="#TOC">ToC</A>] </dl> -<h2 ID="Mail"><A NAME="Mail"><em>Comments and mailto: links</em></A></h2> +<h2><A NAME="13"><em>Comments and mailto: links</em></A></h2> At any time while viewing documents within Lynx, you may use the '<em>c</em>' command to send a mail message to the owner of the current @@ -924,13 +825,12 @@ scheme will allow you to enter your message. using the simple line mode input scheme, type a '<em>.</em>' (period) on a line by itself. You will be asked a final time whether to send the message. If you press '<em>y</em>', you will be prompted whether to -append your signature file if one was defined in -<A HREF="#lynx.cfg">lynx.cfg</A> and is accessible, +append your signature file if one was defined in lynx.cfg and is accessible, and then the message will be sent, whereas if you press '<em>n</em>' the message will be deleted. Entering Control-G in response to any prompts -also will cancel the mailing.[<A HREF="#ToC-Mail">ToC</A>] +also will cancel the mailing.[<A HREF="#TOC">ToC</A>] -<h2 ID="News"><A NAME="News"><em>USENET News posting</em></A></h2> +<h2><A NAME="14"><em>USENET News posting</em></A></h2> While reading <a href="http://www.w3.org/hypertext/DataSources/News/Groups/Overview.html" @@ -955,14 +855,14 @@ received the article supports posting from your site, a link that says Once you have typed in your message, you will be asked for confirmation of whether to proceed with the posting, and whether to append your signature file if one was defined in - <A HREF="#lynx.cfg">lynx.cfg</A> and is accessible. See <a + lynx.cfg and is accessible. See <a href="lynx_url_support.html">Supported URLs</a> for more information about the URL schemes for posting or sending followups (replies) to nntp servers with Lynx. - [<A HREF="#ToC-News">ToC</A>] + [<A HREF="#TOC">ToC</A>] </dl> -<h2 ID="Bookmarks"><A NAME="Bookmarks"><em>Lynx bookmarks</em></A></h2> +<h2><A NAME="15"><em>Lynx bookmarks</em></A></h2> It is often useful to place a bookmark to aid in returning quickly to a document. To use the bookmark feature you must first use the @@ -1010,17 +910,16 @@ and spacing (other than the <em>A</em>nchor content or <em>HREF</em> value) within lines is changed or other HTML markup is added, the '<em>a</em>'dd and '<em>r</em>'emove commands may not work properly. -<p>When multi-bookmarks (see <a -href="#InteractiveOptions">Options Menu</a>) is OFF, you will -always view or add links to the default bookmark file. When it -is STANDARD, a menu of up to 26 bookmark files will be invoked, -and you select the bookmark file by entering its letter -token. When it is ADVANCED, you will be prompted for the letter -token, but can enter '<em>=</em>' to invoke the STANDARD -selection menu, or <em>RETURN</em> for the default bookmark file. -[<A HREF="#ToC-Bookmarks">ToC</A>] +<p>When multi-bookmarks (see <a href="#12">Options Menu</a>) is OFF, +you will always view or add links to the default bookmark file. When +it is STANDARD, a menu of up to 26 bookmark files will be invoked, +and you select the bookmark file by entering its letter token. When +it is ADVANCED, you will be prompted for the letter token, but can +enter '<em>=</em>' to invoke the STANDARD selection menu, or +<em>RETURN</em> for the default bookmark file. +[<A HREF="#TOC">ToC</A>] -<h2 ID="Jumps"><A NAME="Jumps"><em>Jump Command</em></a></h2> +<h2><A NAME="16"><em>Jump Command</em></a></h2> A feature similar to the Lynx bookmarks is the jump command. The jump command allows you to enter a shortcut name to access a URL. If the jump @@ -1032,12 +931,11 @@ of shortcut names available. previous entries can be retrieved for re-use by pressing the <em>up-arrow</em> or <em>down-arrow</em> keys at the prompt. -<p>Note to System Administrators: -Read the <A HREF="#lynx.cfg">lynx.cfg</A> file on how +<p>Note to System Administrators: Read the <em>lynx.cfg</em> file on how to set up the jump command for your system and how to define shortcut names. -[<A HREF="#ToC-Jumps">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="DirEd"><A NAME="DirEd"><em>Directory Editing</em></a></h2> +<h2><A NAME="17"><em>Directory Editing</em></a></h2> Lynx offers extended DIRED support on Unix (on VMS the more powerful CSwing program is recommended for character cell terminals, and can be @@ -1081,9 +979,9 @@ on your local system. The commands available in DIRED mode are <dd>Type '<em>u</em>' to upload a file to the present directory. Upload methods are defined by your system administrator. </dl> -[<A HREF="#ToC-DirEd">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="MiscKeys"><A NAME="MiscKeys"><em>Scrolling and Other useful commands</em></A></h2> +<h2><A NAME="18"><em>Scrolling and Other useful commands</em></A></h2> A summary of all the keystroke commands and their key bindings can be invoked via the KEYMAP command, normally mapped to '<em>k</em>' and @@ -1110,8 +1008,7 @@ commands. the current document, and thus is a synonym for the Keypad and Function <em>Page-Up</em> keys. However, <em>Control-B</em> acts as <em>right-arrow</em> when emacs-like key movement is - enabled (see <A HREF="#InteractiveOptions">Lynx - Options Menu</A>). + enabled (see <A HREF="#12">Lynx Options Menu</A>). <dt><em>^F</em> <dd><em>Control-F</em> normally jumps you to the next page of the current document, and thus is a synonym for the Keypad and @@ -1199,7 +1096,7 @@ commands. document's author. <dt><em>;</em> <dd>The <em>;</em> command shows the <em>Lynx Trace Log</em> - (<em>Lynx.trace</em> in the home directory) if one has been + (<em>lynx.trace</em> in the home directory) if one has been started for the current session. If a log has not been started, any trace and other stderr messages will be sent to the screen (and will disturb the normal display) unless the system supports @@ -1258,10 +1155,10 @@ commands. href="keystrokes/follow_help.html#select-option" >Select option (or page) number:</a><br> prompts. - [<A HREF="#ToC-MiscKeys">ToC</A>] + [<A HREF="#TOC">ToC</A>] </dl> -<h2 ID="Forms"><A NAME="Forms"><em>Lynx and HTML Forms</em></a></h2> +<h2><A NAME="19"><em>Lynx and HTML Forms</em></a></h2> This section describes the Lynx Forms Interface. HTML gives document providers the ability to create on-line forms which may be filled out @@ -1298,11 +1195,10 @@ options from a list, and fields for entering text. <em>page-down</em>, and other navigation keys to move the cursor among options, and the <em>right-arrow</em> or <em>Return</em> key to select an option. You also can use the '<em>/</em>' and '<em>n</em>'ext - <a href="#Search">searching</a> commands for navigating to options which + <a href="#11">searching</a> commands for navigating to options which contain particular strings. <em>NOTE</em> that the popup menu feature can be disabled via compilation and/or configuration options, - or via the <a href="#InteractiveOptions">Options Menu</a>, - in which case the selection + or via the <a href="#12">Options Menu</a>, in which case the selection field options will be converted to a list of radio buttons. The default setting for use of popups or radio button lists can be toggled via the <em>-popup</em> command line switch. @@ -1375,7 +1271,7 @@ which you activated, and then you go back via the PREV_DOC (<em>left-arrow</em>) command or via the <a href="keystrokes/history_help.html">History Page</a>. Lynx can be compiled so that it resubmits the form in those cases as well, and the default -can be changed via <A HREF="#lynx.cfg">lynx.cfg</A>, and toggled via the +can be changed via <em>lynx.cfg</em>, and toggled via the <em>-resubmit_posts</em> command line switch. <p>If the form has one <em>text entry</em> field and no other fields except, @@ -1394,7 +1290,7 @@ content. <p>Inlined images can be used as submit buttons in forms. If such buttons are assigned NAMEs in the markup, for graphic clients they can -also serve as <a href="#USEMAP">image maps</a>, and the x,y coordinates of +also serve as <a href="#28">image maps</a>, and the x,y coordinates of the graphic client's cursor position in the image when it was <em>clicked</em> are included in the form content. Since Lynx cannot inline the image, and the user could not have moved a cursor from the @@ -1489,9 +1385,9 @@ any document: <tab indent="12" ><em><META <tab id="cdis">HTTP-EQUIV="Content-Disposition"<BR> <tab to="cdis">CONTENT="file; filename=name.suffix"></em><BR> -[<A HREF="#ToC-Forms">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="Tables"><A NAME="Tables"><em>Lynx and HTML Tables</em></a></h2> +<h2><A NAME="20"><em>Lynx and HTML Tables</em></a></h2> HTML includes markup for creating <em>tables</em> structured as arrays of cells aligned by columns and rows on the displayed page. @@ -1511,11 +1407,11 @@ alignments intended for the <em>table</em> will be missed. <p>If inherently tabular data must be presented with Lynx, one can use PRE formatted content, or, if the <em>table</em> includes markup not allowed for PRE content, construct the <em>table</em> using <a -href="#Tabs">HTML Tabs</a>. An example <em>table</em> using <em>TAB</em> +href="#21">HTML Tabs</a>. An example <em>table</em> using <em>TAB</em> elements is included in the test subdirectory of the Lynx distribution. -[<A HREF="#ToC-Tables">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="Tabs"><A NAME="Tabs"><em>Lynx and HTML Tabs</em></a></h2> +<h2><A NAME="21"><em>Lynx and HTML Tabs</em></a></h2> Lynx implements the <a href="http://www.w3.org/MarkUp/html3/Contents.html">HTML 3.0</a> @@ -1533,11 +1429,11 @@ distribution as a model for using this functionality. <p>Note that this <em>Users Guide</em> and the <a href="lynx_url_support.html">Supported URLs</a> page include TAB markup in a manner which <em>degrades gracefully</em> for WWW browsers which do not -support it. Toggle to display of <a href="#LocalSource">source</a> and <a -href="#Search">search</a> for <em><tab</em> to examine the use of TAB markup -in these documents. [<A HREF="#ToC-Tabs">ToC</A>] +support it. Toggle to display of <a href="#8">source</a> and <a +href="#11">search</a> for <em><tab</em> to examine the use of TAB markup +in these documents. [<A HREF="#TOC">ToC</A>] -<h2 ID="Frames"><A NAME="Frames"><em>Lynx and HTML Frames</em></a></h2> +<h2><A NAME="22"><em>Lynx and HTML Frames</em></a></h2> Some implementations of HTML include markup, primarily designed for graphic clients, that is intended to create an array of simultaneously displayed, @@ -1555,14 +1451,14 @@ section or a link in it to a document suitable for text clients, you can usually guess from the labeling of the <em>frame</em> links which one has the substantive material (if there is any), or you can try each of those links to see if anything worthwhile is returned. -[<A HREF="#ToC-Frames">ToC</A>] +[<A HREF="#TOC">ToC</A>] <p>Some sites -- in ignorance of Lynx capabilities -- may tell you (for example) "to view this page you need Netscape Navigator". You can simply ignore such warnings and access the frames via the Lynx-generated links as above. -<h2 ID="Banners"><A NAME="Banners"><em>Lynx and HTML Banners</em></a></h2> +<h2><A NAME="23"><em>Lynx and HTML Banners</em></a></h2> Some implementations of HTML markup include provisions for creating a non-scrolling window to be positioned at the top of each page, containing @@ -1627,9 +1523,9 @@ content with a '<em>#</em>' because the content need not be only a series of links with brief, descriptive links names, but does add a '<em>#</em>' at the top, left-hand corner of the screen when the content is not being displayed, to indicate it's accessibility via the TOOLBAR keystroke command. -[<A HREF="#ToC-Banners">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="Footnotes"><A NAME="Footnotes"><em>Lynx and HTML Footnotes</em></a></h2> +<h2><A NAME="24"><em>Lynx and HTML Footnotes</em></a></h2> Lynx implements the <a href="http://www.w3.org/MarkUp/html3/Contents.html">HTML 3.0</a> @@ -1651,9 +1547,9 @@ does not use popups for FN blocks.</a></p><em></FN></em> you can return to your previous position in the document by pressing the <em>left-arrow</em> key. The content of an FN element can be any HTML markup that is valid in the BODY of the document. -[<A HREF="#ToC-Footnotes">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="Notes"><A NAME="Notes"><em>Lynx and HTML Notes</em></a></h2> +<h2><A NAME="25"><em>Lynx and HTML Notes</em></a></h2> Lynx implements the <a href="http://www.w3.org/MarkUp/html3/Contents.html">HTML 3.0</a> @@ -1666,8 +1562,7 @@ default label <em>NOTE:</em> will be used. Lynx recognizes the values <em>caution</em> and <em>warning</em>, for which, respectively, the labels <em>CAUTION:</em> or <em>WARNING:</em> will be used. The NOTE element can have an ID attribute, which will be treated as a named <em>A</em>nchor, as -for <a href="#Footnotes">HTML Footnotes</a>, -but the NOTE block need not be placed +for <a href="#24">HTML Footnotes</a>, but the NOTE block need not be placed at the bottom of the document. The content of a NOTE block can be any HTML markup that is valid in the BODY of the document. This is an example:<BR> <tab indent="12"><em><NOTE CLASS="warning" ID="too-bad"><BR> @@ -1676,9 +1571,9 @@ NOTE in the HTML 3.2 draft.</p><BR> <tab indent="12"></NOTE></em><BR> It will <em>degrade gracefully</em> for WWW browsers which do not support NOTE, except for recognition of the ID attribute as a named <em>A</em>nchor. -[<A HREF="#ToC-Notes">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="Lists"><A NAME="Lists"><em>Lynx and HTML Lists</em></a></h2> +<h2><A NAME="26"><em>Lynx and HTML Lists</em></a></h2> Lynx implements the <a href="http://www.w3.org/MarkUp/html3/Contents.html">HTML 3.0</a> @@ -1736,9 +1631,9 @@ nesting levels. by default, i.e., single spaces between LH and LI elements within those blocks. For DL blocks, double spacing will be used to separate the DT and DD elements unless the COMPACT attribute has been specified. -[<A HREF="#ToC-Lists">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="Quotes"><A NAME="Quotes"><em>Lynx and HTML Quotes</em></a></h2> +<h2><A NAME="27"><em>Lynx and HTML Quotes</em></a></h2> The <a href="http://www.w3.org/MarkUp/html3/Contents.html">HTML 3.0</a> and @@ -1761,11 +1656,10 @@ its first line. (<em>"</em>) versus grave accent (<em>`</em>) and apostrophe (<em>'</em>), respectively, for even versus odd depths in the nest. -<p>Any ID attributes in BLOCKQUOTE, BQ or Q elements can be the target -of a hyperlink in the form URL#id. It is treated just -like the NAME in <em>A</em>nchors. [<A HREF="#ToC-Quotes">ToC</A>] +<p>Any ID attributes in BLOCKQUOTE, BQ or Q elements will be treated as +named <em>A</em>nchors. [<A HREF="#TOC">ToC</A>] -<h2 ID="USEMAP"><A NAME="USEMAP"><em>Lynx and Client-Side-Image-Maps</em></a></h2> +<h2><A NAME="28"><em>Lynx and Client-Side-Image-Maps</em></a></h2> HTML includes markup, designed primarily for graphic clients, that treats inlined images as maps, such that areas of the image within which a mouse @@ -1813,8 +1707,7 @@ map can be accessed, and their nature indicated via ALT attributes, Lynx-friendly sites can map 0,0 such that the server returns a for-text-client document homologous to the content of FIG elements (see below). Inclusion of such a link for submissions to the server can be -disabled by default via the configuration file -(<A HREF="#lynx.cfg">lynx.cfg</A>), and the +disabled by default via the configuration file (lynx.cfg), and the default can be toggled via the <em>-ismap</em> command line switch. <p>Lynx also recognizes the <a @@ -1832,9 +1725,9 @@ the SHAPES attribute equivalently to its handling of FIG. Lynx also handles OBJECT elements with the USEMAP and/or ISMAP attributes equivalently to its handling of IMG elements with <em>client-side-image-maps</em> and/or <em>server-side-image-maps</em>. -[<A HREF="#ToC-USEMAP">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="Refresh"><A NAME="Refresh"><em>Lynx and Client-Side-Pull</em></a></h2> +<h2><A NAME="29"><em>Lynx and Client-Side-Pull</em></a></h2> HTML includes provision for passing instructions to clients via directives in META elements, and one such instruction, via the token <em>Refresh</em>, @@ -1861,16 +1754,16 @@ is not critical and you can activate the link whenever you like. If it is long (e.g., 60 seconds), a server process may be generating new documents or images at that interval, and you would be wasting bandwidth by activating the link at a shorter interval. -[<A HREF="#ToC-Refresh">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="Cookies"><A NAME="Cookies"><em>Lynx State Management</em></A> +<h2><A NAME="30"><em>Lynx State Management</em></A> (Me want <em>cookie</em>!)</h2> HTTP provides a means to carry state information across successive connections between a browser and an http server. Normally, http servers respond to each browser request without relating that request to previous or subsequent requests. Though the inclusion of INPUT fields with -TYPE="hidden" can be used as a sort of state management by <a href="#Forms" +TYPE="hidden" can be used as a sort of state management by <a href="#19" >HTML Forms</a>, a more general approach involves exchanges of MIME headers between the server and browser. When replying to a request, the server can send a <em>Set-Cookie</em> MIME header which contains @@ -1884,20 +1777,9 @@ more elaborate format for cookies, designated as <em>Version 1</em>, is being standardized by the IETF (Internet Engineering Task Force). Lynx supports both <em>Version 0</em> and <em>Version 1</em> cookie exchanges. This support can be disabled by default via the SET_COOKIES symbol in the -compilation (<em>userdefs.h</em>) and/or run time -(<A HREF="#lynx.cfg">lynx.cfg</A>) +compilation (<em>userdefs.h</em>) and/or run time (<em>lynx.cfg</em>) configuration files, and that default setting can be toggled via the <em>-cookies</em> command line switch. -The SET_COOKIES symbol can be further modified by the ACCEPT_ALL_COOKIES mode. -If ACCEPT_ALL_COOKIES is set TRUE, and SET_COOKIES is TRUE, Lynx will accept -all cookies. Additionally, the cookies that are automatically accepted or -rejected by Lynx can be further modified with the COOKIE_ACCEPT_DOMAINS and -COOKIE_REJECT_DOMAINS options in your .lynxrc file, each of which is a -comma-separated list of domains to perform the desired action. The domain -listed in these options must be identical to the domain the cookie comes -from, there is no wildcard matching. If a domain is specific in both -COOKIE_ACCEPT_DOMAINS and COOKIE_REJECT_DOMAINS, rejection will take -precedence. <p>When cookie support is enabled, <em>Set-Cookie</em> MIME headers received from an http server invoke confirmation prompts with possible @@ -1910,10 +1792,9 @@ prompts, or ne'<em>V</em>'er to never allow cookies from that MIME headers). All unexpired cookies are held in a hypothetical <em>Cookie Jar</em> which can be examined via the COOKIE_JAR keystroke command, normally mapped to <em>Ctrl-K</em>, for invoking the <a -href="keystrokes/cookie_help.html">Cookie Jar Page</a>. If Lynx has been -compiled with the --enable-persistent-cookies flag, then unexpired cookies -will be stored between sessions in the filename set with the COOKIE_FILE -option in your .lynxrc. +href="keystrokes/cookie_help.html">Cookie Jar Page</a>. The +<em>Cookie Jar</em>, and any '<em>A</em>'lways or ne'<em>V</em>'er +'allow' settings, do not presently outlast the Lynx session. <p>A common use of cookies by http servers is simply to track the documents visited by individual users. Though this can be useful to the @@ -1934,9 +1815,9 @@ about how they will be used in subsequent requests to that site, nor can infer how they will be used, you can <em>Gobble</em> (delete) the cookies and/or change the 'allow' setting for its <em>domain</em> via the <a href="keystrokes/cookie_help.html">Cookie Jar Page</a>. -[<A HREF="#ToC-Cookies">ToC</A>] +[<A HREF="#TOC">ToC</A>] -<h2 ID="Invoking"><A NAME="Invoking"><em>The Lynx command line</em></A></h2> +<h2><A NAME="31"><em>The Lynx command line</em></A></h2> A summary of the Lynx command line options (switches) is returned to stdout if Lynx is invoked with the <em>-help</em> switch. A description @@ -1983,8 +1864,6 @@ where command file input terminated by a line that begins with '<em>$</em>'. On Unix, the keyboard input terminator is <em>Control-D</em>. On Win32, [???]. - <dt><code>-accept_all_cookies</code> - <dd>accept all cookies. <dt><code>-anonymous</code> <dd>used to specify the anonymous account. <dt><code>-assume_charset=MIMEname</code> @@ -2023,7 +1902,7 @@ where <dd>enable case-sensitive string searching. <dt><code>-cfg=FILENAME</code> <dd>specifies a Lynx configuration file other than the default - <A HREF="#lynx.cfg">lynx.cfg</A>. + lynx.cfg. <dt><code>-child</code> <dd>exit on left-arrow in startfile, and disable save to disk. <dt><code>-color</code> @@ -2148,8 +2027,6 @@ where <dd>disable the retrieval status messages. <dt><code>-number_links</code> <dd>force numbering of links. - <dt><code>-partial</code> - <dd>display partial pages while downloading. <dt><code>-pauth=ID:PW</code> <dd>set authorization ID and password for a protected proxy server at startup. Be sure to protect any script files @@ -2157,8 +2034,7 @@ where <dt><code>-popup</code> <dd>toggles handling of single-choice SELECT options via popup windows or as lists of radio buttons. The default - configuration can be changed in userdefs.h or - <A HREF="#lynx.cfg">lynx.cfg</A>. + configuration can be changed in userdefs.h or lynx.cfg. It also can be set and saved via the 'o'ptions menu. The command line switch toggles the default. <dt><code>-post_data</code> @@ -2285,8 +2161,7 @@ where corner but will instead be positioned at the start of the currently selected link. Show cursor is the default for systems without FANCY_CURSES capabilities. The default - configuration can be changed in userdefs.h or - <A HREF="#lynx.cfg">lynx.cfg</A>. + configuration can be changed in userdefs.h or lynx.cfg. It also can be set and saved via the 'o'ptions menu. The command line switch toggles the default. <dt><code>-soft_dquotes</code> @@ -2299,8 +2174,6 @@ where <dt><code>-startfile_ok</code> <dd>allow non-http startfile and homepage with <em>-validate</em>. - <dt><code>-tagsoup</code> - <dd>initialize DTD with "TagSoup" tables. <dt><code>-telnet</code> <dd>disable recognition of telnet commands. <dt><code>-term=TERM</code> @@ -2310,7 +2183,7 @@ where a script that, in turn, starts another Lynx process.) <dt><code>-tlog</code> <dd>toggles use of a <em>Lynx Trace Log</em> for the current - session. The log is named <em>Lynx.trace</em> and is + session. The log is named <em>lynx.trace</em> and is created in the home directory when Lynx trace mode is turned on via the <em>-trace</em> command line switch (see below), or via the TOGGLE_TRACE (<em>Control-T</em>) @@ -2321,7 +2194,7 @@ where keystroke command. <dt><code>-trace</code> <dd>turns on Lynx trace mode. If a Lynx Trace Log - (<em>Lynx.trace</em> in the home directory) has + (<em>lynx.trace</em> in the home directory) has been started for the current session, all trace and other stderr messages are written to that log, and can be examined during the session via the TRACE_LOG @@ -2338,11 +2211,8 @@ where <dt><code>-validate</code> <dd>accept only http URLs (for validation). Complete security restrictions also are implemented. - <dt><code>-verbose</code> - <dd>toggles [LINK], [IMAGE] and [INLINE] comments - with filenames of these images. <dt><code>-version</code> - <dd>print version information. + <dd>print version information <dt><code>-vikeys</code> <dd>enable vi-like key movement. <dt><code>-width=NUMBER</code> @@ -2352,43 +2222,9 @@ where <p>No options are required, nor is a startfile argument required. White space may be substituted for any equal sign ('<em>=</em>') -appearing in the option list above. [<A HREF="#ToC-Invoking">ToC</A>] - - -<h2 ID="lynx.cfg"><A NAME="lynx.cfg"><em>Main configuration file lynx.cfg</em></A></h2> - -Lynx has several levels of customization: -from the Options Menu (accessible on-line, -and possibly stored in your local .lynxrc file), -via command-line switches -on startup (mainly for batch processing). -The most important and numerous default settings are stored -in the Lynx configuration file <em>lynx.cfg</em>. - -<p>If you are on a UNIX system you should have -appropriate permissions to make changes there or ask your -system administrator to modify lynx.cfg for your needs. -This file provides default settings for all accounts on your system. -It may be copied to your shell account and included with -cfg command line -switch or via an environment variable LYNX_CFG (if you have shell access). -Starting with version 2.8.1 Lynx has an include facility so you can -load the system-wide configuration file and easily add one or more settings -from your local add-on configuration file. It is really cool to read -lynx.cfg with its comments for hundreds of options, -most of them commented out because they are built-in defaults. - -<p>To see the current lynx.cfg state you may press <em>'='</em> key -for <em>Lynx Information Page</em> and follow <em>your lynx.cfg</em> link -from there near the top. - -<p>However, for those who have a restricted account many Lynx features -may be disabled by the system administrator, you probably will not see -your lynx.cfg. - - -[<A HREF="#ToC-lynx.cfg">ToC</A>] +appearing in the option list above. [<A HREF="#TOC">ToC</A>] -<h2 ID="Hist"><A NAME="Hist"><em>Lynx development history</em></A></h2> +<h2><A NAME="32"><em>Lynx development history</em></A></h2> Lynx grew out of efforts to build a campus-wide information system at The University of Kansas. The earliest versions of Lynx provided a @@ -2439,7 +2275,6 @@ The Lynx2-6FM code set was released as v2.7 in February 1997. The v2-7FM code set was released as v2.7.1 in April 1997. The v2-7-1FM code set was released as v2.7.2 in January 1998. The 2.7.1 development set was released as v2.8 in March 1998. -The 2.8 development set was released as v2.8.1 in October 1998. <p>Since early 1997, the Lynx code has expanded into autoconfigure and PC versions. The branching of the Lynx source base from a single diff --git a/lynx_help/keystrokes/cookie_help.html b/lynx_help/keystrokes/cookie_help.html index 081bb3e5..0fd5b255 100644 --- a/lynx_help/keystrokes/cookie_help.html +++ b/lynx_help/keystrokes/cookie_help.html @@ -10,7 +10,7 @@ The Cookie Jar Page displays all of the unexpired cookies you have accumulated in the hypothetical <em>Cookie Jar</em>. The cookies are obtained via <em>Set-Cookie</em> MIME headers in replies from http servers, -and are used for <A HREF="../Lynx_users_guide.html#Cookies">State Management</A> +and are used for <A HREF="../Lynx_users_guide.html#30">State Management</A> across successive requests to the servers. <p>The cookies are listed by <em>domain</em> (server's Fully Qualified @@ -29,10 +29,13 @@ for the request which caused the cookie to be sent, and whether the <em>secure</em> flag is set for the cookie, in which case it will be sent only via secure connections (presently, only SSL). The <em>Maximum Gobble Date</em>, i.e., when the cookie is intended to -expire, also is indicated. Also, a server may change the expiration date, -or cause the cookie to be deleted, in its replies to subsequent requests -from Lynx. If the server included any explanatory comments in its -<em>Set-Cookie</em> MIME headers, those also are displayed in the listing. +expire, also is indicated. Note, however, that Lynx presently gobbles +all of it's accumulated cookies on exit from the current session, even +if the server indicated an expiration in the distant future. Also, a +server may change the expiration date, or cause the cookie to be deleted, +in its replies to subsequent requests from Lynx. If the server included +any explanatory comments in its <em>Set-Cookie</em> MIME headers, those +also are displayed in the listing. <p>The <em>domain</em>=value pairs, and each cookie's name=value, are links in the listing. Activating a <em>domain</em>=value link will @@ -41,7 +44,7 @@ should be <em>Gobbled</em> (deleted from the <em>Cookie Jar</em>), and/or whether the <em>domain</em> entry should be <em>Gobbled</em> if all of its cookies have been <em>Gobbled</em>, or whether to change the 'allow' setting for that <em>domain</em>. Activating a cookie's -name=value link will cause that particular cookie to be <em>Gobbled</em>. +name=value link will cause that particular cookie to be <em>Gobbled</em>. You will be prompted for confirmations of deletions, to avoid any accidental <em>Gobbling</em>. </BODY> diff --git a/lynx_help/keystrokes/keystroke_help.html b/lynx_help/keystrokes/keystroke_help.html index 3a2724ae..f3a57bc3 100644 --- a/lynx_help/keystrokes/keystroke_help.html +++ b/lynx_help/keystrokes/keystroke_help.html @@ -85,8 +85,7 @@ CTRL-R - Reload current file and refresh the screen CTRL-V - Switch to alternative parsing of HTML documents CTRL-W - Refresh the screen - CTRL-U - Erase input line (<a href="edit_help.html" - >more input line commands</a>) + CTRL-U - Erase input line CTRL-G - Cancel input or transfer CTRL-T - Toggle trace mode on and off ; - View the Lynx Trace Log for the current diff --git a/lynx_help/keystrokes/option_help.html b/lynx_help/keystrokes/option_help.html index fad258c5..2ef8151c 100644 --- a/lynx_help/keystrokes/option_help.html +++ b/lynx_help/keystrokes/option_help.html @@ -5,314 +5,258 @@ <LINK rev="made" href="mailto:lynx-dev@sig.net"> </HEAD> <BODY> -<h1>OPTIONS SCREEN HELP</h1> - -The Options Screen allows you to set and modify many Lynx features.<BR> -Note: some options appear on the screen only if they have been -compiled in or chosen in `lynx.cfg':<P> - -<UL> -<LI>Personal Preferences -<UL> -<LI><A HREF="#CK">Cookies</A> -<LI><A HREF="#ED">Editor</A> -<LI><A HREF="#EM">Emacs keys</A> -<LI><A HREF="#LL">Execution links</A> -<LI><A HREF="#KM">Keypad mode</A> -<LI><A HREF="#PM">Personal Mail Address</A> -<LI><A HREF="#PU">Pop-ups for select fields</A> -<LI><A HREF="#ST">Searching type</A> -<LI><A HREF="#SC">Show color</A> -<LI><A HREF="#CL">Show cursor for current link or option</A> -<LI><A HREF="#UM">User Mode</A> -<LI><A HREF="#VB">Verbose Images</A> -<LI><A HREF="#VI">VI keys</A> -<LI><A HREF="#DV">X DISPLAY variable</A></UL> -<LI>Bookmark Options -<UL> -<LI><A HREF="#MB">Multi-bookmarks</A> -<LI><A HREF="#BF">Bookmark file</A></UL> -<LI>Character Set Options -<UL> -<LI><A HREF="#AD">Assumed document character set</A> -<LI><A HREF="#DC">Display Character set</A> -<LI><A HREF="#JK">Raw 8-bit or CJK mode</A></UL> -<LI>File Management Options -<UL> -<LI><A HREF="#FT">FTP sort criteria</A> -<LI><A HREF="#LD">Local directory sort criteria</A> -<LI><A HREF="#DF">Show dot files</A></UL> -<LI>Headers transferred to remote server -<UL> -<LI><A HREF="#PC">Preferred Document Charset</A> -<LI><A HREF="#PL">Preferred Document Language</A> -<LI><A HREF="#UA">User Agent</A></UL> -<LI> -- not in Options Form -- -<UL> -<LI><A HREF="#LE">Line edit style</A></UL> -</UL> - -<H1><A NAME="CK">Cookies</A></H1> - -This can be set to accept or reject all cookies or to ask each time. -See the Users Guide (under `h'elp) for details of cookie usage. - -<H1><A NAME="ED">Editor</A></H1> - -If non-empty, it defines the editor to spawn when editing a local file -or sending mail. Any valid text editor may be entered here. - -<H1><A NAME="EM">Emacs keys</A></H1> - -If set to 'ON' then the CTRL-P, CTRL-N, CTRL-F and CTRL-B keys will be mapped -to up-arrow, down-arrow, right-arrow and left-arrow respectively. Otherwise, -they remain mapped to their configured bindings (normally UP_TWO lines, -DOWN_TWO lines, NEXT_PAGE and PREV_PAGE respectively). - -<H1><A NAME="LL">Execution links</A></H1> - -If set to 'ALWAYS ON', Lynx will locally execute commands contained -inside any links. This can be HIGHLY DANGEROUS, so it is recommended -that they remain 'ALWAYS OFF' or 'FOR LOCAL FILES ONLY'. - -<H1><A NAME="KM">Keypad mode</A></H1> - -This gives the choice between navigating with the keypad (as arrows; -see Lynx Navigation) and having every link numbered (numbered links) -so that the links may be selected by numbers instead of moving to them -with the arrow keys. You can also number form fields. - -<H1><A NAME="PM">Personal Mail Address</A></H1> - -You may set your mail address here so that when mailing messages -to other people or mailing files to yourself, your email address can be -automatically filled in. Your email address will also be sent -to HTTP servers in a `from:' field. - -<H1><A NAME="PU">Pop-ups for select fields</A></H1> - -Lynx normally uses a pop-up window for the OPTIONs in form SELECT fields -when the field does not have the MULTIPLE attribute specified, and thus -only one OPTION can be selected. The use of pop-up windows can be disabled -by changing this setting to OFF, in which case the OPTIONs will be rendered -as a list of radio buttons. Note that if the SELECT field does have -the MULTIPLE attribute specified, the OPTIONs always are rendered -as a list of checkboxes. - -<H1><A NAME="ST">Searching type</A></H1> - -If set to 'case sensitive', user searches invoked by '/' will be -case-sensitive substring searches. Default is 'Case Insensitive'. - -<H1><A NAME="SC">Show color</A></H1> - -This will be present if color support is available. -<ul> -<li>If set to ON or ALWAYS, -color mode will be forced on if possible. If (n)curses color support -is available but cannot be used for the current terminal type, selecting ON -is rejected with a message. -<li>If set to OFF or NEVER, color mode will be -turned off. -<li>ALWAYS and NEVER are not offered in anonymous accounts. -If saved to a '.lynxrc' file in non-anonymous accounts, ALWAYS will cause Lynx -to set color mode on at startup if supported. -</ul> -If Lynx is built with slang, -this is equivalent to having included the -color command line switch -or having the COLORTERM environment variable set. If color support is -provided by curses or ncurses, this is equivalent to the default behavior -of using color when the terminal type supports it. If (n)curses color support -is available but cannot be used for the current terminal type, the preference -can still be saved but will have no effect. - -<p>A saved value of NEVER will -cause Lynx to assume a monochrome terminal at start-up. It is similar -to the -nocolor switch, but (when the slang library is used) can be overridden -with the -color switch. If the setting is OFF or ON when the current options -are saved to a '.lynxrc' file, the default start-up behavior is retained, -such that color mode will be turned on at startup only if the terminal info -indicates that you have a color-capable terminal, or (when slang is used) -if forced on via the -color switch or COLORTERM variable. This default -behavior always is used in anonymous accounts, or if the 'option'_save -restriction is set explicitly. If for any reason the start-up color mode -is incorrect for your terminal, set it appropriately on or off via this option. - -<H1><A NAME="CL">Show cursor for current link or option</A></H1> - -Lynx normally hides the cursor by positioning it to the right and if possible -the very bottom of the screen, so that the current link or OPTION is indicated -solely by its highlighting or color. If show cursor is set to ON, the cursor -will be positioned at the left of the current link or OPTION. This is helpful -when Lynx is being used with a speech or braille interface. It is also useful -for sighted users when the terminal cannot distinguish the character attributes -used to distinguish the current link or OPTION from the others in the display. - -<H1><A NAME="UM">User Mode</A></H1> - -<dl> -<dt><EM>Novice</EM>: Shows 2 extra lines of help at the bottom of the screen -for beginners. -<dt><EM>Intermediate (normal)</EM>: Normal status-line messages appear. -<dt><EM>Advanced</EM>: The URL is shown on the status line. -</dl> - -<H1><A NAME="VB">Verbose Images</A></H1> - -Controls whether or not Lynx replaces the [LINK], [INLINE] and [IMAGE] comments -(for images without ALT) with filenames of these images. This is extremely -useful because now we can determine immediately which images are decorations -(button.gif, line.gif) and which are important. - -<H1><A NAME="VI">VI keys</A></H1> - -If set to 'ON' then the lowercase h, j, k and l keys will be mapped -to left-arrow, down-arrow, up-arrow and right-arrow respectively. -<p>The uppercase H, J, K, and L keys remain mapped to their configured bindings -(normally HELP, JUMP, KEYMAP and LIST, respectively). - -<H1><A NAME="DV">X DISPLAY variable</A></H1> - -If non-empty, it specifies your <A HREF="xterm_help.html">X terminal</A> -display address. - -<H1><A NAME="MB">Multi-bookmarks</A></H1> - -Manage multiple bookmark files: -<ul> -<li>When OFF, the default bookmark file is used for the 'v'iew-bookmarks -and 'a'dd-bookmark link commands. -<li>If set to STANDARD, a menu of available -bookmarks is always invoked when you seek to view a bookmark file -or add a link, and you select the bookmark file by its letter token -in that menu. -<li>If set to ADVANCED, you are instead prompted for the letter -of the desired bookmark file, but can enter '=' to invoke the STANDARD -selection menu, or RETURN for the default bookmark file. -</ul> - -<H1><A NAME="BF">Bookmark file</A></H1> - -Manage the default bookmark file: -<ul> -<li>If non-empty and multi-bookmarks is OFF, -it specifies your default '<A HREF="bookmark_help.html">Bookmark file</A>'. -<li>If multi-bookmarks is STANDARD or ADVANCED, -entering 'B' will invoke a menu in which you can specify -filepaths and descriptions of up to 26 bookmark files. -</ul> -The filepaths must be from your home directory and begin with './' -if subdirectories are included (e.g., './BM/lynx_bookmarks.html'). -<P> -Lynx will create bookmark files when you first 'a'dd a link, -but any subdirectories in the filepath must already exist. - -<H1><A NAME="AD">Assumed document character set</A></H1> - -This changes the handling of documents which do not explicitly specify -a charset. Normally Lynx assumes that 8-bit characters in those documents -are encoded according to iso-8859-1 (the official default for HTTP protocol). -Unfortunately, many non-English web pages forget to include proper charset -info; this option helps you browse those broken pages if you know somehow -what the charset is. When the value given here or by an -assume_charset -command-line flag is in effect, Lynx will treat documents as if they were -encoded accordingly. Option is active when 'Raw 8-bit or CJK Mode' is OFF. - -<H1><A NAME="DC">Display Character set</A></H1> - -This allows you to set up the default character set for your specific terminal. -The display character set provides a mapping from the character encodings -of viewed documents and from HTML entities into viewable characters. -It should be set according to your terminal's character set -so that characters other than 7-bit ASCII can be displayed correctly, -using approximations if necessary. You must have the selected character set -installed on your terminal. Since Lynx now supports a wide range of platforms -it may be useful to note that cpXXX codepages are used within IBM PC computers, -and windows-xxxx within native MS-Windows applications. - -<H1><A NAME="JK">Raw 8-bit or CJK mode</A></H1> - -This is set automatically, but can be toggled manually in certain cases: -it toggles whether 8-bit characters are assumed to correspond with the display -character set and therefore are processed without translation -via the chartrans conversion tables. ON by default when the display -character set is one of the Asian (CJK) sets and the 8-bit characters -are Kanji multibytes. OFF for the other display character sets, -but can be turned ON when the document's charset is unknown -(e.g., is not ISO-8859-1 and no charset parameter was specified -in a reply header from an HTTP server to indicate what it is), -but you have no better idea than viewing it as from display character set -(see 'assumed document character set' for best choice). Should be OFF -when an Asian (CJK) set is selected but the document is ISO-8859-1 -or another 'assumed document character set'. The setting can also be toggled -via the RAW_TOGGLE command, normally mapped to '@', and at startup -via the -raw switch. - -<H1><A NAME="FT">FTP sort criteria</A></H1> - -This allows you to specify how files will be sorted within FTP listings. -The current options include -`By Filename', `By Size', `By Type', `By Date'. - -<H1><A NAME="LD">List directory style</A></H1> - -Applies to Directory Editing. -Files and directories can be presented in the following ways: -<dl> -<dt><EM>Mixed style</EM>: Files and directories are listed together -in alphabetical order. -<dt><EM>Directories first</EM>: Files and directories are separated -into 2 alphabetical lists: directories are listed first. -<dt><EM>Files first</EM>: Files and directories are separated -into 2 alphabetical lists: files are listed first. -</dl> - -<H1><A NAME="DF">Show dot files</A></H1> - -If display/creation of hidden (dot) files/directories is enabled, -you can turn the feature on or off via this setting. - -<H1><A NAME="PC">Preferred Document Charset</A></H1> - -The character set you prefer if sets in addition to ISO-8859-1 and US-ASCII -are available from servers. Use MIME notation (e.g., ISO-8859-2) -and do not include ISO-8859-1 or US-ASCII, since those values are always -assumed by default. Can be a comma-separated list, which may be interpreted -by servers as descending order of preferences; you can make your order -of preference explicit by using `q factors' as defined by the HTTP protocol, -for servers which understand it: e.g., <kbd>iso-8859-5, utf-8;q=0.8</kbd>. - -<H1><A NAME="PL">Preferred Document Language</A></H1> - -The language you prefer if multi-language files are available from servers. -Use RFC 1766 tags, e.g., `en' English, `fr' French. Can be a comma-separated -list, and you can use `q factors' (see previous help item): -e.g., <kbd>da, en-gb;q=0.8, en;q=0.7</kbd> . - -<H1><A NAME="UA">User Agent</A></H1> - -The header string which Lynx sends to servers to indicate the User-Agent -is displayed here. Changes may be disallowed via the -restrictions switch. -Otherwise, the header can be changed temporarily to e.g., L_y_n_x/2.8.1 -for access to sites which discriminate against Lynx based on checks -for the presence of `Lynx' in the header. If changed during a Lynx session, -the default User-Agent header can be restored by deleting the modified string -in the Options Menu. Whenever the User-Agent header is changed, the current -document is reloaded, with the no-cache flags set, on exit from Options Menu. -Changes of the header are not saved in the .lynxrc file. -<P> -NOTE Netscape Communications Corp. has claimed that false transmissions -of `Mozilla' as the User-Agent are a copyright infringement, which will -be prosecuted. DO NOT misrepresent Lynx as Mozilla. The Options Menu issues -a warning about possible copyright infringement whenever the header is changed -to one which does not include `Lynx' or `lynx'. - -<H1><A NAME="LE">Line edit style</A></H1> - -This allows you to set alternate key bindings for the built-in line editor, -if your system administrator has installed alternates. -Otherwise, Lynx uses the <A HREF="edit_help.html">Default Binding</A>. - +<h1>+++ Options Screen Help +++</h1> +<PRE> + The Options Screen allows you to set and + modify many of Lynx's features. The following + options may be set. + + Editor - If non-empty it defines the editor to spawn + when editing a local file or sending mail. + Any valid text editor may be entered here. + + DISPLAY variable - If non-empty it specifies your <A HREF="xterm_help.html">X terminal</A> + display address. + + Multi-bookmarks - When OFF, the default bookmark file is used + for the 'v'iew bookmarks and 'a'dd bookmark + link commands. If set to STANDARD, a menu + of available bookmarks always is invoked + when you seek to view a bookmark file or add + a link, and you select the bookmark file by + its letter token in that menu. If set to + ADVANCED, you instead are prompted for the + letter of the desired bookmark file, but can + enter '=' to invoke the STANDARD selection + menu, or RETURN for the default bookmark file. + + Bookmark file - If non-empty and multi-bookmarks is OFF, it + specifies your default '<A HREF="bookmark_help.html">Bookmark file</A>'. + If multi-bookmarks is STANDARD or ADVANCED, + entering 'B' will invoke a menu in which you + can specify the filepaths and descriptions + of up to 26 bookmark files. The filepaths + must be from your home directory, and begin + with dot-slash (./) if subdirectories are + included (e.g, ./BM/lynx_bookmarks.html). + Lynx will create bookmark files when you + first 'a'dd a link, but any subdirectories + in the filepath must already exist. + + FTP sort criteria - This option allows you to specify how files + will be sorted within FTP listings. The + current options include "By Filename", + "By Size", "By Type", and "By Date". + + Personal Mail - You may set your mail address here so that + Address when mailing messages to other people or + mailing files to yourself, your email address + can be automatically filled in. Your email + address will also be sent to HTTP servers in + a from: field. + + Searching type - If set to 'case sensitive', user searches + invoked by the '/' command will be case + sensitive substring searches. The + default is 'Case Insensitive' substring + searches + + Preferred Document - The language you prefer if multi-language files + Language are available from servers. Use RFC 1766 tags, + e.g., en for English, fr for French, etc. Can be + a comma-separated list, which may be interpreted + by servers as descending order of preferences. + You can also make your order of preference explicit + by using q factors as defined by the HTTP protocol, + for servers which understand it, for example: + <kbd>da, en-gb;q=0.8, en;q=0.7</kbd> + + Preferred Document - The character set you prefer if sets in addition + Charset to ISO-8859-1 and US-ASCII are available from + servers. Use MIME notation (e.g., ISO-8859-2) + and do not include ISO-8859-1 or US-ASCII, since + those values are always assumed by default. Can + be a comma-separated list, which may be interpreted + by servers as descending order of preferences. + You can also make your order of preference explicit + by using q factors as defined by the HTTP protocol, + for servers which understand it, for example: + <kbd>iso-8859-5, unicode-1-1;q=0.8</kbd> + + Display Character - This option allows you to set up the default + set character set for your specific terminal. + The character set provides a mapping of 8-bit ISO + Latin character entities and/or Asian (CJK) or + Unicode characters into viewable characters and + should be set according to your terminal's + character set if you will be viewing such + characters with Lynx. You must have the selected + character set installed on your terminal. + + Raw 8-bit or CJK - Toggles whether 8-bit characters are assumed to + mode correspond with the selected character set and + therefore are processed without translation via + the chartrans conversion tables. Should be ON + by default when the selected character set is one + of the Asian (CJK) sets and the 8-bit characters + are Kanji multibytes. Should be OFF for the other + character sets, but can be turned ON when the + document's charset is unknown (e.g., is not + ISO-8859-1 and no charset parameter was included in + a reply header from an HTTP server to indicate what + it is) but you know by some means that you have the + matching display character set selected. Should be + OFF when an Asian (CJK) set is selected but the + document is ISO-8859-1. The setting also can be + toggled via the RAW_TOGGLE command, normally mapped + to '@', and at startup via the -raw switch. + + Show color - This option will be present if color support is + available. If set to ON or ALWAYS, color mode will + be forced on if possible. If (n)curses color + support is available but cannot be used for the + current terminal type, selecting ON is rejected + with a message. If set to OFF or NEVER, color mode + will be turned off. + ALWAYS and NEVER are not offered in anonymous + accounts. If saved to a '.lynxrc' file in + non-anonymous accounts, ALWAYS will cause Lynx to + set color mode on at startup if supported. If Lynx + is built with the slang library, this is equivalent + to having included the -color command line switch + or having the COLORTERM environment variable + set. If color support is provided by curses or + ncurses, this is equivalent to the default behavior + of using color when the terminal type supports it. + If (n)curses color support is available but cannot + be used for the current terminal type, the + preference can still be saved but will have no + effect. + A saved value of NEVER will cause Lynx to assume a + monochrome terminal at startup. It is similar to + the -nocolor switch, but (when the slang library is + used) can be overridden with the -color switch. + If the setting is OFF or ON when the current + options are saved to a '.lynxrc' file, the default + startup behavior is retained, such that color mode + will be turned on at startup only if the terminal + info indicates that you have a color-capable + terminal, or (when the slang library is used) if + forced on via the -color switch or COLORTERM + variable. This default behavior always is used in + anonymous accounts, or if the 'option'_save + restriction is set explicitly. If for any reason + the startup color mode is incorrect for your + terminal, set it appropriately on or off via this + option. + + VI keys - If set to 'ON' then the lowercase h, j, k, and l, + keys will be mapped to left-arrow, down-arrow, + up-arrow, and right-arrow, respectively. The + uppercase H, J, K, and L keys remain mapped to + their configured bindings (normally HELP, JUMP, + KEYMAP, and LIST, respectively). + + Emacs keys - If set to 'ON' then the CTRL-P, CTRL-N, CTRL-F, + and CTRL-B keys will be mapped to up-arrow, + down-arrow, right-arrow, and left-arrow, + respectively. Otherwise, they remain mapped + to their configured bindings (normally UP_TWO + lines, DOWN_TWO lines, NEXT_PAGE, and PREV_PAGE, + respectively). + + Show dot files - If display/creation of hidden (dot) + files/directories is enabled, you can turn + the feature on or off via this setting. + + Popups for select - Lynx normally uses a popup window for the + fields OPTIONs in form SELECT fields when the field + does not have the MULTIPLE attribute specified, + and thus only one OPTION can be selected. The + use of popup windows can be disabled by changing + this setting to OFF, in which case the OPTIONs + will be rendered as a list of radio buttons. + Note that if the SELECT field does have the + MULTIPLE attribute specified, the OPTIONs always + are rendered as a list of checkboxes. + + Show cursor for - Lynx normally hides the cursor by positioning it + current link or to the right and if possible the very bottom of + option the screen, so that the current link or OPTION + is indicated solely by its highlighting or color. + If show cursor is set to ON, the cursor will be + positioned at the left of the current link or + OPTION. This is helpful when Lynx is being used + with a speech or braille interface. It also is + useful for sighted users when the terminal cannot + distinguish the character attributes used to + distinguish the current link or OPTION from the + others in the screen display. + + Keypad mode - This option gives the choice between navigating + with the keypad (as arrows; see Lynx Navigation) + and having every link numbered (numbered links) + so that the links may be selected by numbers + instead of moving to them with the arrow keys. + + Line edit style - This option allows you to set alternate key + bindings for the built-in line editor, if your + system administrator has installed alternates. + Otherwise, Lynx uses the <A HREF="edit_help.html">Default Binding</A>. + + List directory - Applies to Directory Editing. Files and + style directories can be presented in the following + ways: + Mixed style + Files and directories are listed together in + alphabetical order. + Directories first + Files and directories are separated into two + alphabetical lists. Directories are listed + first. + Files first + Files and directories are separated into two + alphabetical lists. Files are listed first. + + User Mode - Beginner + Shows two extra lines of help at the bottom + of the screen + Intermediate (normal mode) + The "normal" statusline messages appear. + Advanced + The URL is shown on the statusline. + + User Agent - The header string which Lynx sends to servers + to indicate the User-Agent is displayed here. + Changes may be disallowed via the -restrictions + switch. Otherwise, the header can be changed + temporarily to a string such as L_y_n_x/2.7.2 for + access to sites which discriminate against Lynx + based on checks for the presence of "Lynx" in the + header. If changed during a Lynx session, the + default User-Agent header can be restored by + deleting the modified string in the Options Menu. + Whenever the User-Agent header is changed, the + current document is reloaded, with the no-cache + flags set, on exit from the Options Menu. Changes + of the header are not saved in the RC file. + NOTE that Netscape Communications Corp. has + claimed that false transmissions of "Mozilla" as + the User-Agent are a copyright infringement, which + will be prosecuted. DO NOT misrepresent Lynx as + Mozilla. The Options Menu issues a warning about + possible copyright infringement whenever the header + is changed to one which does not include "Lynx" or + "lynx". + + Local execution - If set to 'ALWAYS ON', Lynx will locally execute + links commands contained inside of any links. This + can be HIGHLY DANGEROUS so it is recommended + that they remain 'ALWAYS OFF' or 'FOR LOCAL + FILES ONLY' unless otherwise set by your system + administrator. This option may not be available + on most versions of Lynx. + +</PRE> </BODY> </HTML> - diff --git a/lynx_help/keystrokes/visited_help.html b/lynx_help/keystrokes/visited_help.html index 0a6874f3..ebb03a70 100644 --- a/lynx_help/keystrokes/visited_help.html +++ b/lynx_help/keystrokes/visited_help.html @@ -20,8 +20,8 @@ the URLs differ due to appended fragments), and is supplementary to the <p>You may <A HREF="movement_help.html">select</A> any link on the Visited Links Page to retrieve a document that you had previously visited, or you can use this list to save such links in your <A HREF="bookmark_help.html" ->bookmark files</A>, or to <A HREF="../Lynx_users_guide.html#RemoteSource" ->Download</A> them. +>bookmark files</A>, or to <A HREF="../Lynx_users_guide.html#9">Download</A> +them. <p>In contrast to the History Page, the Visited Links Page includes any links which were retrieved for '<em>d</em>'ownloading or were passed to diff --git a/lynx_help/lynx-dev.html b/lynx_help/lynx-dev.html index c9076cfb..f062f674 100644 --- a/lynx_help/lynx-dev.html +++ b/lynx_help/lynx-dev.html @@ -13,100 +13,48 @@ <h1><em>Lynx-Dev Discussion List</em></h1> -Lynx-dev is a majordomo mailing list used by developers and -interested users as a forum to discuss the further development of -the Lynx World Wide Web browser. Topic issues include fixing -known bugs, porting Lynx to various systems, and increasing the -usability of Lynx. - -<h2><em>Open access</em></h2> -<P> -Anyone may read what has been said on Lynx-dev by visiting the -<a href="http://www.flora.org/lynx-dev/html/"> archives</a>. - -<P> - -Anyone may ask a question or offer a comment on Lynx-dev by -sending mail to lynx-dev@sig.net, the posting address for this -list. Because of the public archive, requests for a personal -reply may not be honored, and you should check the archive to -find all follow-up responses. Messages from non-subscribers are -not immediately distributed to the list to avoid distributing -spam. Usually, if your message is on topic, it will be retrieved -from the pile of spam headed for the wastebasket within a day or -so and distributed to the list. So, for best results subscribe -as described below. +Lynx-dev is a majordomo mailing list used by developers and interested +users as a forum to discuss the further development of the Lynx World +Wide Web browser. Topic issues include fixing known bugs, porting Lynx +to various systems, and increasing the usability of Lynx. <h2><em>Subscribing to Lynx-Dev</em></h2> -If you are interested in <em>joining</em> this mailing list, send -email to <a -href="mailto:majordomo@sig.net"> majordomo@sig.net</a> with -only the following request in the body of your message: -<em>SUBSCRIBE LYNX-DEV address</em><br> where inclusion of your -email address is optional if it can be obtained, correctly, from -the mail headers of your subscription request. You will be asked -to answer one follow-up question to confirm that you want the -subscription, and Majordomo will enroll you as a subscriber. -<P> -Majordomo will thereafter -send all messages which you address to the posting address to all -subscribers of the list, and you will receive all messages set to -that address by other subscribers. - +If you are interested in <em>joining</em> this mailing list, +send email to <a href="mailto:majordomo@sig.net" +>majordomo@sig.net</a> with only the following request +in the body of your message: <em>SUBSCRIBE LYNX-DEV address</em><br> +where inclusion of your email address is optional if it can be obtained, +correctly, from the mail headers of your subscription request. <p><em>NOTE:</em> Subject headers are ignored by the majordomo. <h2><em>Unsubscribing from Lynx-Dev</em></h2> To <em>unsubscribe</em>, send an email message to -<a href="mailto:majordomo@sig.net"> majordomo@sig.net</a> -with only the following request +<a href="mailto:majordomo@sig.net" +>majordomo@sig.net</a> with only the following request in the body: <em>UNSUBSCRIBE LYNX-DEV address</em><br> where inclusion of your email address is optional if it can be obtained, correctly, from the mail headers of your request. -<h2><em>Subscribing to Lynx-Dev-Contrib</em></h2> -<p> -If you subscribe an email address to lynx-dev-contrib, mail from -that address posted to lynx-dev will be recognized as from a -subscriber and automatically distributed to the list. -To make such a subscription, send -email to <a -href="mailto:majordomo@sig.net"> majordomo@sig.net</a> with -only the following request in the body of your message: -<em>SUBSCRIBE LYNX-DEV-CONTRIB address</em>. -<p> -If you prefer to read the lynx-dev discussion using Lynx and -the archive, and not receive all the posts as email, subscribe -to lynx-dev-contrib and not to lynx-dev. If you have multiple -accounts from which you would like to post to lynx-dev, subscribe -one of them to lynx-dev (where you will receive the list mail) and -the others to lynx-dev-contrib. - <h2><em>Majordomo Commands</em></h2> -To receive a brief description of majordomo <em>commands</em>, -place the following request in a message to <a -href="mailto:majordomo@sig.net"> majordomo@sig.net</a>: -<em>HELP</em> - -<p> -Read the HELP that you receive by return mail to learn the -details of the <em>which</em> command you can use to check on -your subscriptions, etc. Further information is available from the -<a href="http://www.greatcircle.com/majordomo/"> majordomo website</a>. +To receive a brief description of majordomo <em>commands</em>, place +the following request in a message to <a href="mailto:majordomo@sig.net" +>majordomo@sig.net</a>: <em>HELP</em> <h2><em>Contacting Lynx-Dev</em></h2> If you have questions, problems, or comments about using Lynx or -installing it on your system, send email to -<a href="mailto:lynx-dev@sig.net"> lynx-dev@sig.net</a>. +installing it on your system, send email to +<a href="mailto:lynx-dev@sig.net" +>lynx-dev@sig.net</a> (<em>after you've subscribed</em>). <p>If you have problems with majordomo not responding to your requests, -send email to the <em>list owner</em>: -<a href="mailto:majordomo-owner@sig.net"> majordomo-owner@sig.net</a>. -Please, +send email to the <em>list owner</em>: <a +href="mailto:majordomo-owner@sig.net" +>majordomo-owner@sig.net</a>. Please, <em>DO NOT</em> send them to <em>lynx-dev@sig.net</em> as they will be distributed to everyone on the list and will clutter up their mailboxes. diff --git a/lynx_help/lynx_help_main.html b/lynx_help/lynx_help_main.html index 3af49161..0871f1d9 100644 --- a/lynx_help/lynx_help_main.html +++ b/lynx_help/lynx_help_main.html @@ -2,90 +2,83 @@ <html> <head> <link rev="made" href="mailto:lynx-dev@sig.net"> -<title>The Lynx Help Page</title> +<title>Help! - Press the Left arrow key to exit help</title> </head> <body> -<h2>Lynx help files (usually in your local directories):</h2> +<H1>Lynx Help Menu</h1> -<ul> +<ul plain> +<lh><em>Choose a subject:</em></lh> <li><a href="Lynx_users_guide.html">Lynx Users Guide</a> - -- complete account of all Lynx features +<ul plain> <li><a href="keystrokes/keystroke_help.html">Key-stroke Commands</a> - -- quick outline of what various keys do -<li><a href="keystrokes/edit_help.html">Line Editor</a> - -- when entering URLs etc +| <a href="keystrokes/edit_help.html">Line Editor</a> <li><a href="lynx_url_support.html">Supported URLs</a> - -- how Lynx handles various types of URL +| <a href="http://www.w3.org/Addressing/Addressing.html" +>Help on URLs</a> +<li><a href="http://leb.net/blinux/blynx/" +>Speech-Friendly Lynx Help Files</a> +<li><a href="http://lynx.browser.org/">Lynx Information</a> +| <a href="http://www.crl.com/~subir/lynx.html" +>Lynx links</a> +| <a href="http://www.slcc.edu/lynx/faq.html" +>Lynx FAQ</a> <li><a href="about_lynx.html">About Lynx</a> - -- credits, copyright etc -<li><a href="lynx-dev.html">About Lynx-Dev</a> - -- the developers & how to contact them +| <a href="lynx-dev.html">About Lynx-Dev</a> +| <a href="http://www.access.digex.net/~asgilman/lynx/FAQ/" +>Al's Picks (FAQ)</a> </ul> -<h2>Other sources of Lynx help:</h2> +<li><a +href="http://www.w3.org/MarkUp/html-spec/html-spec_toc.html" +>HTML 2.0</a> +| <a href="http://www.w3.org/MarkUp/html3/Contents.html" +>HTML 3.0</a> +| <a href="http://www.alis.com:8085/ietf/html/" +>HTML i18n</a> +| <a href="http://www.w3.org/MarkUp/" +>HTML 3.2</a> +| <a href="http://www.w3.org/TR/PR-html40/" +>HTML 4.0</a> -<ul> -<li><a href="http://www.chass.utoronto.ca/%7Epurslow/lhfb.html">Lynx Help for Beginners</a> -- quick help on many common problems -<li><a href="http://www.access.digex.net/%7Easgilman/lynx/FAQ/">Al Gilman's FAQs</a> -- many common queries, some more advanced -<li><a href="http://www.crl.com/%7Esubir/lynx.html">Lynx Links</a> - -- source & binaries, FAQs, developers & archives,<br> -SSL & security, and more -<li><A HREF="http://www.ocf.berkeley.edu/%7Ejeffwong/lynxstuff/">Lynxstuff</A> - -- SSL, Wyse terminals, Lynx-friendly Web design -<li><a href="http://leb.net/blinux/blynx/">Blynx</a> - -- Speech-Friendly Help for the visually impaired +<ul plain> +<li><a href="http://www.stonehand.com/doc/" +>Spyglass/Stonehand Technical Reference</a> +<ul plain> +<li><a +href="http://www.stonehand.com/doc/comments.html" +>Keep Your Comments Legal</a> </ul> - -<h2>World Wide Web Consortium documents:</h2> - -<ul> -<li>HTML -- <a href="http://www.w3.org/TR/PR-html40/">4.0</a> - -- <a href="http://www.w3.org/MarkUp/">3.2</a> - -- <a href="http://www.w3.org/MarkUp/html3/Contents.html">3.0</a> - -- <a href="http://www.w3.org/MarkUp/html-spec/html-spec_toc.html">2.0</a> -<li>HTTP -- <a href="http://www.w3.org/Protocols/">1.1</a> - -- <a href="http://ds.internic.net/rfc/rfc1945.txt">1.0</a> -<li><a href="http://www.w3.org/Addressing/Addressing.html">Web Naming & Addressing Overview: URIs, URLs etc</a> -<li><a href="http://www.alis.com:8085/ietf/html/">HTML Internationalisation</a> -<li><a href="http://www.w3.org/TheProject.html">WWW Consortium: home page</a> +<li><a +href="http://ugweb.cs.ualberta.ca/~gerald/validate/" +>A Kinder, Gentler HTML Validator</a> +<li><a href="http://www.webtechs.com/html-val-svc/" +>WebTechs HTML Validation Service</a> +<li><a href="http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html" +>HTML Primer</a> +| <a href="http://kuhttp.cc.ukans.edu/lynx_help/HTML_quick.html" +>HTML Quick Reference Guide</a> </ul> -<h2>Help with HTML:</h2> - -<ul> -<li><a href="http://www.htmlhelp.com/reference/html40/">HTML 4.0 Reference</a> -<li><a href="http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html">NCSA Beginner's Guide To HTML</a> -<li><a href="http://www.cc.ukans.edu/~acs/docs/other/HTML_quick.shtml">HTML Quick Reference Guide</a> -<li><a href="http://www.stonehand.com/doc/">Spyglass/Stonehand Technical Reference</a> -</ul> +<li><a +href="http://ds.internic.net/rfc/rfc1945.txt" +>HTTP 1.0</a> +| <a href="http://www.w3.org/Protocols/" +>HTTP 1.1</a> -<h2>HTML validation services:</h2> +<li><a +href="http://www.w3.org/TheProject.html" +>The World Wide Web Consortium (W3C)</a> -<ul> -<li><a href="http://validator.w3.org/">W3C HTML Validation Service</a> -<li><a href="http://www.webtechs.com/html-val-svc/">WebTechs HTML Validation Service</a> +<li><a href="http://www.altavista.digital.com/">Alta Vista</a> +| <a href="http://www.yahoo.com/">Yahoo!</a> +| <a href="http://guaraldi.cs.colostate.edu:2000/">Savvy Search</a> +| <a href="http://www.webcrawler.com/">WebCrawler</a> +<li><a href="http://guide.Infoseek.com/">Infoseek Guide</a> +| <a href="http://www.lycos.com/">Lycos</a> +| <a href="http://www.excite.com/">Excite</a> +| <a href="http://www.metacrawler.com/">MetaCrawler</a> </ul> - -<H2>Meta-indexes: lists of links</H2> - -<ul> -<li><a href="http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html">NCSA Mosaic</a> -</ul> - -<H2>Search engines:</H2> - -<ul> -<li><a href="http://www.altavista.digital.com/">Alta Vista</a> -<li><a href="http://www.excite.com/">Excite</a> -<li><a href="http://www.infind.com/">Inference Find</a> -<li><a href="http://guide.Infoseek.com/">Infoseek</a> -<li><a href="http://www.lycos.com/">Lycos</a> -<li><a href="http://www.metacrawler.com/">MetaCrawler</a> -<li><a href="http://guaraldi.cs.colostate.edu:2000/">Savvy Search</a> -<li><a href="http://www.webcrawler.com/">WebCrawler</a> -<li><a href="http://www.yahoo.com/">Yahoo!</a> -</ul> - </body> </html> diff --git a/makefile.in b/makefile.in index 769be1dc..ffe0dafe 100644 --- a/makefile.in +++ b/makefile.in @@ -22,14 +22,10 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ -## This is the version which we are developing (or, upon release, make this -## the same). Use no dots in the name, since it must work on VMS and MS-DOS. -VERSION = 2-8-1 - ##this is the name of the directory the lynx source code is in. ##(e.g. lynx2-8, not the full path) -lynxdir= lynx$(VERSION) -lynxname= lynx$(VERSION) +lynxdir= lynx2-8 +lynxname= lynx2-8 ## Where you want lynx installed bindir= @bindir@ @@ -40,23 +36,17 @@ mandir= @mandir@/man1 ## Where you want the lynx.cfg file installed libdir= @libdir@ -## Where you want the doc-files installed -docdir= @libdir@/lynx_doc - ## Where you want the help-files installed helpdir= @libdir@/lynx_help +installbin= @INSTALL_PROGRAM@ -s -m 755 +installdoc= @INSTALL_DATA@ + ##set the relative location of the WWW library Implementation directory, ##from this directory ##do not set this to be an absolute path!!! WWWINC= WWW/Library/Implementation -## Path to gzip that will compress the help files. -## It will be used when --enable-gzip-help is set by configure. -## Leave *both* empty if you don't want to gzip help files. -COMPRESS_PROG=@COMPRESS_PROG@ -COMPRESS_EXT=@COMPRESS_EXT@ - # !!!!!!!!!!! SUN resolv LIBRARY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # To include resolv in the LIBS="" list for SUN 3, 4 or Solaris OS, # point RESOLVLIB to that library. You need this if you get the message @@ -65,6 +55,20 @@ COMPRESS_EXT=@COMPRESS_EXT@ # See the PROBLEMS file for more information. #RESOLVLIB= -lresolv +# !!!!!!!!!!! Alternate socket functions for SOCKS !!!!!!!!!!!!!!!!!! +# To make a SOCKSified lynx, include -DSOCKS in your SITE_LYDEFS and +# SITE_DEFS, below, and point SOCKSLIB to your SOCKS library. Note +# that you may have problems accessing FTP servers. Also, instead of +# SOCKSifying lynx for use behind a firewall, you are better off if +# you make it normally, and set it up to use a proxy server. You can +# SOCKSify the proxy server, and it will handle all clients, not just +# Lynx (see the INSTALLATION file in this distribution). If your SOCKS +# server was compiled to use the short version of Rbind, also include +# -DSHORTENED_RBIND in your SITE_LYDEFS and SITE_DEFS. If you do +# SOCKSify lynx, you can turn off SOCKS proxy usage via a -nosocks +# command line switch. +#SOCKSLIB= /usr/local/lib/libsocks.a + # !!!!!!!!!!!!! DIRECT WAIS ACCESS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # If you are adding direct wais access you must fill in the # location of wais.a, client.a and the standard math library, libm.a. @@ -106,6 +110,7 @@ SITE_DEFS = # Your defines here # -DNO_CPU_LIMIT Disables Max CPU timeout (includes CLOCKS_PER_SECOND) # -DSHORTENED_RBIND For a SOCKSified lynx with the short version of Rbind. # -DSLANG_MBCS_HACK prevent cutoff lines when using UTF8 console (slang only) +# -DSOCKS For making a SOCKSified lynx. # # if you are linking to freeWAIS-0.202 or older, you should define this # in SITE_DEFS @@ -126,25 +131,21 @@ SITE_DEFS = # Your defines here # for their inet_addr(host) calls. # # -DDGUX_OLD +# +# if you would like logging of client requests via syslog(), you should +# define this in SITE_DEFS +# +# -DSYSLOG_REQUESTED_URLS # defines which have configure options (see INSTALLATION, Section II-1c.): # -DARCHIVE_ONLY # -DDIRED_SUPPORT -# -DDISP_PARTIAL -# -DDONT_TRACK_INTERNAL_LINKS -# -DEXEC_LINKS -# -DEXEC_SCRIPTS # -DEXP_CHARTRANS_AUTOSWITCH -# -DEXP_PERSISTENT_COOKIES # -DLINKEDSTYLES # -DLONG_LIST -# -DLYNXCGI_LINKS # -DLY_FIND_LEAKS # -DNCURSES # -DNO_CHANGE_EXECUTE_PERMS -# -DNO_EXTENDED_HTMLDTD -# -DOPTIONS_FORMS -# -DOPTIONS_MENU # -DNO_PARENT_DIR_REFERENCE # -DNSL_FORK # -DOK_GZIP @@ -153,21 +154,16 @@ SITE_DEFS = # Your defines here # -DOK_TAR # -DOK_UUDECODE # -DOK_ZIP -# -DSOCKS -# -DSYSLOG_REQUESTED_URLS # -DUNDERLINE_LINKS # -DUSE_COLOR_STYLE -# -DUSE_DEFAULT_COLORS -# -DUSE_EXTERNALS # -DUSE_HASH # -DUSE_SLANG -# -DUSE_SOCKS5 # -DUSE_ZLIB # # for installation of local execution links, please see the file userdefs.h # TESTED: Linux FreeBSD SunOS Solaris IRIX CLIX HP-UX AIX SCO -all lynx$x: cfg_defs.h LYHelp.h +all lynx$x: cd WWW/Library/unix && $(MAKE) CC="$(CC)" \ LY_CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" \ @@ -175,7 +171,7 @@ all lynx$x: cfg_defs.h LYHelp.h cd src && $(MAKE) all CC="$(CC)" \ CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" \ - LIBS="$(LIBS) $(RESOLVLIB) $(WAISLIB) $(SITE_LIBS)" \ + LIBS="$(LIBS) $(RESOLVLIB) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \ SITE_DEFS="$(SITE_DEFS)" \ WWWINC=$(WWWINC) \ WWWLIB="../WWW/Library/unix/libwww.a" @@ -196,9 +192,9 @@ clean: rm -f WWW/Library/*/*.[aob] rm -f WWW/Library/*/.created cd src && $(MAKE) clean - rm -f *.b src/lynx$x core Lynx.leaks cfg_defs.h LYHelp.h + rm -f *.b src/lynx$x core Lynx.leaks -depend: cfg_defs.h LYHelp.h +depend: cd WWW/Library/unix && $(MAKE) $@ cd src && $(MAKE) $@ @@ -247,99 +243,33 @@ compress: tar install: lynx$x install-bin install-man install-cfg @INSTALL_LSS@ @echo @echo "Use $(MAKE) install-help to install the help-files" - @echo "Use $(MAKE) install-doc to install extra documentation files" @echo install-bin: $(bindir) -mv -f $(bindir)/lynx$x $(bindir)/lynx.old - $(INSTALL_PROGRAM) lynx$x $(bindir)/ + $(installbin) lynx$x $(bindir)/ -install-man : $(mandir) - $(INSTALL_DATA) $(srcdir)/lynx.man $(mandir)/lynx.1 - -install-doc : $(docdir) - @echo Copying sample files - (cd $(srcdir) && tar cf - C[HO]* PROBLEMS README samples test ) | \ - ( cd $(docdir) && tar xf - ) - -rm -f $(libdir)/lynx.tmp - -# HPUX 'sed' does not seem to like '=' as pattern delimiter. -FIX_SED = tr '=' '%' -#FIX_SED = cat +install-man : $(mandir) + $(installdoc) $(srcdir)/lynx.man $(mandir)/lynx.1 install-help : $(helpdir) (cd $(helpdir) && rm -rf *) - @echo Constructing sed-script - @ECHO_CC@sed -e '/^#/d' -e '/^$$/d' \ - -e 's%\(.*\)=\(.*\@.*\)%s=@\1@=\2=g%' \ - -e 's%\(.*\)=\(http:.*\)%s=@\1@=\2=g%' \ - -e 's%\(.*\)=\(ftp:.*\)%s=@\1@=\2=g%' \ - -e 's%\(.*\)=\(.*\.html\)$$%s=@\1@=\2$(COMPRESS_EXT)=g%' \ - $(srcdir)/lynx_help/help_files.txt | $(FIX_SED) > \ - $(helpdir)/help_files.sed - @echo Appending interim-fix for existing html files - @ECHO_CC@sed -e '/^#/d' -e '/[:@]/d' -e '/^$$/d' \ - -e 's%\(.*\)=\(.*\.html\)$$%s=\2=\2$(COMPRESS_EXT)=g%' \ - -e 's%\.html=%\\.html=%' \ - $(srcdir)/lynx_help/help_files.txt | $(FIX_SED) >> \ - $(helpdir)/help_files.sed - @echo Translating/copying html files - @ECHO_CC@sh -c 'cd $(srcdir)/lynx_help && ( \ - dirs=keystrokes; \ - (cd $(helpdir) && mkdir $$dirs 2>/dev/null ) ; \ - files="*.html */*.html" ; \ - for f in $$files ; do \ - sed -f $(helpdir)/help_files.sed $$f > $(helpdir)/$$f ; \ - done ; \ - if test "$(COMPRESS_PROG)" != "" ; then \ - (cd $(helpdir) && $(COMPRESS_PROG) $$files ) \ - fi ; \ - )' - -rm -f $(helpdir)/help_files.sed - @echo Updating $(libdir)/lynx.cfg + (cd $(srcdir)/lynx_help && tar cf - . ) | ( cd $(helpdir) && tar xf - ) + (cd $(srcdir) && tar cf - C[HO]* PROBLEMS README samples test ) | \ + ( cd $(helpdir) && tar xf - ) + -rm -f $(libdir)/lynx.tmp sh -c 'if test -f $(libdir)/lynx.cfg ; then \ mv $(libdir)/lynx.cfg $(libdir)/lynx.tmp ; \ else \ cp $(srcdir)/lynx.cfg $(libdir)/lynx.tmp ; \ fi' - @echo Updating $(libdir)/lynx.cfg to point to installed help-files - @ECHO_CC@sed -e '/^HELPFILE:http/s@^@#@' \ + sed -e '/^HELPFILE:http/s@^@#@' \ -e '/^#HELPFILE:file/s@#@@' \ -e '/^HELPFILE:file/s@/PATH_TO/lynx_help@$(helpdir)@' \ - -e '/^HELPFILE:file/s@$$@$(COMPRESS_EXT)@' \ - -e '/^HELPFILE:file/s@$(COMPRESS_EXT)$(COMPRESS_EXT)$$@$(COMPRESS_EXT)@' \ $(libdir)/lynx.tmp >$(libdir)/lynx.cfg chmod 644 $(libdir)/lynx.cfg -rm -f $(libdir)/lynx.tmp -LYHelp.h : LYHelp.hin - @echo Constructing sed-script - @ECHO_CC@sed -e '/^#/d' -e '/^$$/d' \ - -e 's%\(.*\)=\(.*\@.*\)%s=@\1@=\2=g%' \ - -e 's%\(.*\)=\(http:.*\)%s=@\1@=\2=g%' \ - -e 's%\(.*\)=\(ftp:.*\)%s=@\1@=\2=g%' \ - -e 's%\(.*\)=\(.*\.html\)$$%s=@\1@=\2$(COMPRESS_EXT)=g%' \ - $(srcdir)/lynx_help/help_files.txt | $(FIX_SED) > \ - help_files.sed - @echo Creating $@ - @sed -f help_files.sed $(srcdir)/LYHelp.hin > $@ - -@rm -f help_files.sed - @echo '**********************************************' - @echo - @sh -c 'if test "$(COMPRESS_PROG)" = "" ; then \ - echo " Help files will NOT be gzipped."; \ - else \ - echo " Help links point to compressed files"; \ - echo " To access them properly you have to type"; \ - echo " make install-help"; \ - fi' - @echo - @echo '**********************************************' - -cfg_defs.h : $(srcdir)/cfg_defs.sh - @rm -f $@ - sh $(srcdir)/cfg_defs.sh >$@ - install-cfg : $(libdir) -mv -f $(libdir)/lynx.cfg $(libdir)/lynx.oldcfg $(INSTALL_DATA) $(srcdir)/lynx.cfg $(libdir)/lynx.cfg @@ -353,8 +283,7 @@ uninstall: -rm -f $(mandir)/lynx.1 -rm -f $(libdir)/lynx.cfg -rm -f $(libdir)/lynx.lss - -rm -rf $(helpdir) - -rm -rf $(docdir) + -rm -rf $(libdir)/lynx_help -$(bindir) $(mandir) $(libdir) $(helpdir) $(docdir) : +$(bindir) $(mandir) $(libdir) $(helpdir) : $(srcdir)/mkdirs.sh $@ diff --git a/samples/lynx-keymaps b/samples/lynx-keymaps deleted file mode 100644 index 311aa8bc..00000000 --- a/samples/lynx-keymaps +++ /dev/null @@ -1,103 +0,0 @@ -# This is a sample key sequence definition file. It is used by Lynx when built -# with ncurses or slang, to augment the definitions from your terminal's -# termcap or terminfo description. - -# Lines that start with a '#' are comment lines. Blank lines are ignored. - -# The 'setkey' function may be used in two ways: -# -# 1. setkey ESC-SEQUENCE KEYSYM -# 2. setkey ESC-SEQUENCE KEYSYM_NAME -# -# where KEYSYM is an integer. A keysym is essentually with the lynx.rc -# file calls a 'keystroke', but I think that keysym is a more appropriate -# name. The keysym is an integer and may be expressed in various ways: -# -# as a decimal integer: 97 -# hexadecimal: 0x61 -# Octal: 0141 -# as an ASCII character: 'a' -# -# Some keysyms may be expressed symbolically as a keysym name using the -# second form. The currently recognized symbolic names are: -# -# UPARROW -# DNARROW -# RTARROW -# LTARROW -# PGDOWN -# PGUP -# HOME -# END -# F1 -# DO_KEY -# FIND_KEY -# SELECT_KEY -# INSERT_KEY -# REMOVE_KEY -# DO_NOTHING -# -# It does not matter if your keyboard does not have some of the keys -# implied by the above names. The fact is that lynx uses these keys as an -# an intermediate representation. -# -# The ESC-SEQUENCE should be enclosed in double quotes. The '^' character -# is special and indicates a control character, e.g., ^K is Ctrl-K. An ESC -# character (ascii 27) may be represented as ^[. As an example, many -# terminals have arrow keys that emit 'ESC [ A' for the UP arrow. This may -# be represented as the escape sequence "^[[A". The default keymapping is -# given below: -# -setkey "\033[A" UPARROW -setkey "\033OA" UPARROW -setkey "\033[B" DNARROW -setkey "\033OB" DNARROW -setkey "\033[C" RTARROW -setkey "\033OC" RTARROW -setkey "\033[D" LTARROW -setkey "\033OD" LTARROW -setkey "\033[1~" FIND_KEY -setkey "\033[2~" INSERT_KEY -setkey "\033[3~" REMOVE_KEY -setkey "\033[4~" SELECT_KEY -setkey "\033[5~" PGUP -setkey "\033[6~" PGDOWN -setkey "\033[8~" END -setkey "\033[7~" HOME -setkey "\033[28~" F1 -setkey "\033[29~" DO_KEY -# -# All other keys map to themselves, e.g, -# -setkey "a" 'a' -# -# Now suppose that your terminal produces different escape sequences for -# HOME and END. In particular, suppose that the home key produces 'ESC [ -# H' and that the end key produces 'ESC [ K'. Then these may be defined to -# map to lynx HOME and END keys via -# -setkey "^[[H" HOME -setkey "^[[K" END -# -# Similarly, we may map emacs-like sequences to these functions: -# -setkey "^[<" HOME -setkey "^[>" END -# -# Other special escapes: -# \a bell -# \b backspace -# \f form-feed -# \n newline (line-feed) -# \r carriage-return -# \t tab -# \v vertical tab -# \<number> octal number, up to 3 digits, e.g., "\033". -# \d<number> decimal number, up to 3 digits, e.g., "\d99" -# \x<number> hexidecimal number, up to 2 digits, e.g., "\xFF" -# -# For Unix-systems (which have termcap or terminfo) you may also use symbols -# that refer to the termcap/terminfo, by referencing the name bracketed by -# "^(" and ")", e.g., -setkey "^(cuu1)" UPARROW -setkey "^(up)" UPARROW diff --git a/src/AttrList.h b/src/AttrList.h index b58456ff..cacb02e4 100644 --- a/src/AttrList.h +++ b/src/AttrList.h @@ -56,7 +56,7 @@ typedef struct _linkedlist { } linked_list; #endif -#define HText_characterStyle CTRACE(tfp,"HTC called from %s/%d\n",__FILE__,__LINE__);_internal_HTC +#define HText_characterStyle if(TRACE)fprintf(stderr,"HTC called from %s/%d\n",__FILE__,__LINE__);_internal_HTC #undef HText_characterStyle #define HText_characterStyle _internal_HTC diff --git a/src/DefaultStyle.c b/src/DefaultStyle.c index 2e00ba62..bff1b11d 100644 --- a/src/DefaultStyle.c +++ b/src/DefaultStyle.c @@ -4,6 +4,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTStyle.h> #include <HTFont.h> diff --git a/src/GridText.c b/src/GridText.c index 8319737c..0e489dbb 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -3,6 +3,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTString.h> #include <HTFont.h> #include <HTAccess.h> @@ -15,6 +16,7 @@ #include <UCAux.h> #include <assert.h> +#include <ctype.h> #ifndef VMS #ifdef SYSLOG_REQUESTED_URLS #include <syslog.h> @@ -41,8 +43,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#undef DEBUG_APPCH - #ifdef USE_COLOR_STYLE #include <AttrList.h> #include <LYHash.h> @@ -54,16 +54,16 @@ unsigned int cached_styles[CACHEH][CACHEW]; #ifdef USE_COLOR_STYLE_UNUSED void LynxClearScreenCache NOARGS { - int i,j; - - CTRACE(tfp, "flushing cached screen styles\n"); - for (i=0;i<CACHEH;i++) - for (j=0;j<CACHEW;j++) - cached_styles[i][j]=s_a; + int i,j; +if (TRACE) + fprintf(stderr, "flushing cached screen styles\n"); + for (i=0;i<CACHEH;i++) + for (j=0;j<CACHEW;j++) + cached_styles[i][j]=s_a; } #endif /* USE_COLOR_STYLE */ -struct _HTStream { /* only know it as object */ +struct _HTStream { /* only know it as object */ CONST HTStreamClass * isa; /* ... */ }; @@ -72,6 +72,8 @@ struct _HTStream { /* only know it as object */ #define IS_UTF_EXTRA(ch) (text->T.output_utf8 && \ ((unsigned char)(ch)&0xc0) == 0x80) +#define FREE(x) if (x) {free(x); x = NULL;} + extern BOOL HTPassHighCtrlRaw; extern HTkcode kanji_code; extern HTCJKlang HTCJK; @@ -114,8 +116,8 @@ typedef struct _stylechange { typedef struct _line { struct _line *next; struct _line *prev; - unsigned offset; /* Implicit initial spaces */ - unsigned size; /* Number of characters */ + int unsigned offset; /* Implicit initial spaces */ + int unsigned size; /* Number of characters */ BOOL split_after; /* Can we split after? */ BOOL bullet; /* Do we bullet? */ #if defined(USE_COLOR_STYLE) @@ -179,7 +181,7 @@ struct _HText { int top_of_screen; /* Line number */ HTLine * top_of_screen_line; /* Top */ HTLine * next_line; /* Bottom + 1 */ - unsigned permissible_split; /* in last line */ + int permissible_split; /* in last line */ BOOL in_line_1; /* of paragraph */ BOOL stale; /* Must refresh */ BOOL page_has_target; /* has target on screen */ @@ -189,7 +191,7 @@ struct _HText { S_nonascii_text, S_dollar_paren, S_jisx0201_text } state; /* Escape sequence? */ - int kanji_buf; /* Lead multibyte */ + char kanji_buf; /* Lead multibyte */ int in_sjis; /* SJIS flag */ int halted; /* emergency halt */ @@ -244,7 +246,7 @@ PRIVATE int HText_TrueLineSize PARAMS(( /* * text->halted = 1: have set fake 'Z' and output a message - * 2: next time when HText_appendCharacter is called + * 2: next time when HText_appendCharacter is called * it will append *** MEMORY EXHAUSTED ***, then set * to 3. * 3: normal text output will be suppressed (but not anchors, @@ -310,8 +312,9 @@ PRIVATE void * LY_check_calloc ARGS2( HText * t = HTList_objectAt(loaded_texts, i); if (t == HTMainText) t = NULL; /* shouldn't happen */ - { - CTRACE(tfp, "\r *** Emergency freeing document %d/%d for '%s'%s!\n", + if (TRACE) { + fprintf(stderr, + "\r *** Emergency freeing document %d/%d for '%s'%s!\n", i + 1, n, ((t && t->node_anchor && t->node_anchor->address) ? @@ -405,7 +408,8 @@ PUBLIC HText * HText_new ARGS1( #if defined(VMS) && defined (VAXC) && !defined(__DECC) status = lib$stat_vm(&VMType, &VMTotal); - CTRACE(tfp, "GridText: VMTotal = %d\n", VMTotal); + if (TRACE) + fprintf(stderr, "GridText: VMTotal = %d\n", VMTotal); #endif /* VMS && VAXC && !__DECC */ if (!loaded_texts) { @@ -421,26 +425,28 @@ PUBLIC HText * HText_new ARGS1( * and free it before reloading. - Dick Wesseling (ftu@fi.ruu.nl) */ if (anchor->document) { - HTList_removeObject(loaded_texts, anchor->document); - CTRACE(tfp, "GridText: Auto-uncaching\n") ; - ((HText *)anchor->document)->node_anchor = NULL; - HText_free((HText *)anchor->document); - anchor->document = NULL; + HTList_removeObject(loaded_texts, anchor->document); + if (TRACE) + fprintf(stderr, "GridText: Auto-uncaching\n") ; + ((HText *)anchor->document)->node_anchor = NULL; + HText_free((HText *)anchor->document); + anchor->document = NULL; } HTList_addObject(loaded_texts, self); #if defined(VMS) && defined(VAXC) && !defined(__DECC) while (HTList_count(loaded_texts) > HTCacheSize && - VMTotal > HTVirtualMemorySize) + VMTotal > HTVirtualMemorySize) { #else - if (HTList_count(loaded_texts) > HTCacheSize) + if (HTList_count(loaded_texts) > HTCacheSize) { #endif /* VMS && VAXC && !__DECC */ - { - CTRACE(tfp, "GridText: Freeing off cached doc.\n"); + if (TRACE) + fprintf(stderr, "GridText: Freeing off cached doc.\n"); HText_free((HText *)HTList_removeFirstObject(loaded_texts)); #if defined(VMS) && defined (VAXC) && !defined(__DECC) status = lib$stat_vm(&VMType, &VMTotal); - CTRACE(tfp, "GridText: VMTotal reduced to %d\n", VMTotal); + if (TRACE) + fprintf(stderr, "GridText: VMTotal reduced to %d\n", VMTotal); #endif /* VMS && VAXC && !__DECC */ } @@ -527,22 +533,11 @@ PUBLIC HText * HText_new ARGS1( underline_on = FALSE; /* reset */ bold_on = FALSE; -#ifdef DISP_PARTIAL - /* - * By this function we create HText object and set new Lines counter - * so we may start displaying the document while downloading. - LP - */ - if (display_partial) - NumOfLines_partial = 0; /* enable HTDisplayPartial() */ -#endif - - CTRACE(tfp, "GridText: start HText_new\n"); - return self; } -/* Creation Method 2 -** --------------- +/* Creation Method 2 +** --------------- ** ** Stream is assumed open and left open. */ @@ -578,9 +573,9 @@ PUBLIC void HText_free ARGS1( l->prev->next = l->next; /* Unlink l */ self->last_line = l->prev; if (l != self->last_line) { - FREE(l); + FREE(l); } else { - free(l); + free(l); } } if (l == self->last_line) { /* empty */ @@ -758,9 +753,9 @@ PRIVATE int display_line ARGS2( #define CStyle line->styles[current_style] while (current_style < line->numstyles && - i >= (int) (CStyle.horizpos + line->offset + 1)) + i >= CStyle.horizpos + line->offset + 1) { - LynxChangeStyle (CStyle.style,CStyle.direction,CStyle.previous); + (void) LynxChangeStyle (CStyle.style,CStyle.direction,CStyle.previous); current_style++; } #endif @@ -768,7 +763,7 @@ PRIVATE int display_line ARGS2( #ifndef USE_COLOR_STYLE case LY_UNDERLINE_START_CHAR: - if (dump_output_immediately && use_underscore) { + if (dump_output_immediately && use_underscore) { addch('_'); i++; } else { @@ -777,7 +772,7 @@ PRIVATE int display_line ARGS2( break; case LY_UNDERLINE_END_CHAR: - if (dump_output_immediately && use_underscore) { + if (dump_output_immediately && use_underscore) { addch('_'); i++; } else { @@ -792,15 +787,10 @@ PRIVATE int display_line ARGS2( case LY_BOLD_END_CHAR: stop_bold (); break; - #endif - case LY_SOFT_NEWLINE: - if (!dump_output_immediately) - addch('+'); - break; case LY_SOFT_HYPHEN: - if (*data != '\0' || + if (*data != '\0' || isspace((unsigned char)LastDisplayChar) || LastDisplayChar == '-') { /* @@ -894,7 +884,7 @@ PRIVATE int display_line ARGS2( #else while (current_style < line->numstyles) { - LynxChangeStyle (CStyle.style, CStyle.direction, CStyle.previous); + (void) LynxChangeStyle (CStyle.style, CStyle.direction, CStyle.previous); current_style++; } #undef CStyle @@ -964,7 +954,7 @@ PRIVATE void display_title ARGS1( sprintf(percent, " (p%d of %d)", ((text->top_of_screen >= start_of_last_page) ? total_pages : - ((text->top_of_screen + display_lines)/(display_lines))), + ((text->top_of_screen + display_lines)/(display_lines))), total_pages); } else { percent[0] = '\0'; /* Null string */ @@ -979,13 +969,13 @@ PRIVATE void display_title ARGS1( if (*title && (tmp = (unsigned char *)calloc(1, (strlen(title) + 1)))) { if (kanji_code == EUC) { - TO_EUC((unsigned char *)title, tmp); + TO_EUC((unsigned char *)title, tmp); } else if (kanji_code == SJIS) { - TO_SJIS((unsigned char *)title, tmp); + TO_SJIS((unsigned char *)title, tmp); } else { - for (i = 0, j = 0; title[i]; i++) { + for (i = 0, j = 0; title[i]; i++) { if (title[i] != '\033') { - tmp[j++] = title[i]; + tmp[j++] = title[i]; } } tmp[j] = '\0'; @@ -1100,7 +1090,7 @@ PRIVATE void display_page ARGS3( #else assert(line->next != NULL); #endif /* !VMS */ - } /* Loop */ + } if (LYlowest_eightbit[current_char_set] <= 255 && (current_char_set != charset_last_displayed) && @@ -1330,7 +1320,7 @@ PRIVATE void display_page ARGS3( * in it. - FM */ move((i + 2), 0); - } /* end while */ + } #endif /* FANCY CURSES || USE_SLANG */ /* @@ -1349,8 +1339,8 @@ PRIVATE void display_page ARGS3( } display_flag = TRUE; line = line->next; - } /* end of "Verify and display each line." loop */ - } /* end "Output the page." */ + } + } text->next_line = line; /* Line after screen */ text->stale = NO; /* Display is up-to-date */ @@ -1387,17 +1377,17 @@ PRIVATE void display_page ARGS3( * Memory leak fixed 05-27-94 * Garrett Arch Blythe */ - auto char *cp_AnchorAddress = NULL; + auto char *cp_AnchorAddress = NULL; if (traversal) - cp_AnchorAddress = stub_HTAnchor_address(link_dest); + cp_AnchorAddress = stub_HTAnchor_address(link_dest); else { #ifndef DONT_TRACK_INTERNAL_LINKS if (Anchor_ptr->link_type == INTERNAL_LINK_ANCHOR) { link_dest_intl = HTAnchor_followTypedLink( (HTAnchor *)Anchor_ptr->anchor, LINK_INTERNAL); if (link_dest_intl && link_dest_intl != link_dest) { - - CTRACE(tfp, + if (TRACE) + fprintf(stderr, "display_page: unexpected typed link to %s!\n", link_dest_intl->parent->address); link_dest_intl = NULL; @@ -1428,7 +1418,7 @@ PRIVATE void display_page ARGS3( links[nlinks].target = empty_string; links[nlinks].form = NULL; - nlinks++; + nlinks++; display_flag = TRUE; } else if (Anchor_ptr->link_type == INPUT_ANCHOR @@ -1477,7 +1467,7 @@ PRIVATE void display_page ARGS3( links[nlinks].hightext2_offset = 0; nlinks++; - /* + /* * Bold the link after incrementing nlinks. */ highlight(OFF, (nlinks - 1), target); @@ -1488,8 +1478,9 @@ PRIVATE void display_page ARGS3( /* * Not showing anchor. */ - if (Anchor_ptr->hightext && *Anchor_ptr->hightext) - CTRACE(tfp, + if (TRACE && + Anchor_ptr->hightext && *Anchor_ptr->hightext) + fprintf(stderr, "\nGridText: Not showing link, hightext=%s\n", Anchor_ptr->hightext); } @@ -1507,12 +1498,14 @@ PRIVATE void display_page ARGS3( * to use half-page or two-line scrolling. - FM */ if (LYCursesON) { - HTAlert(MAXLINKS_REACHED); + _statusline(MAXLINKS_REACHED); + sleep(AlertSecs); } - CTRACE(tfp, "\ndisplay_page: MAXLINKS reached.\n"); + if (TRACE) + fprintf(stderr, "\ndisplay_page: MAXLINKS reached.\n"); break; } - } /* end of loop "Add the anchors to Lynx structures." */ + } /* * Free any un-reallocated links[] entries @@ -1540,7 +1533,7 @@ PRIVATE void display_page ARGS3( addstr("\n Document is empty"); } - if (HTCJK != NOCJK || text->T.output_utf8) { + if (HTCJK != NOCJK || text->T.output_utf8 || TRACE) { /* * For non-multibyte curses. */ @@ -1586,7 +1579,7 @@ PUBLIC void HText_beginAppend ARGS1( PRIVATE void split_line ARGS2( HText *, text, - unsigned, split) + int, split) { HTStyle * style = text->style; HTLine * temp; @@ -1608,18 +1601,15 @@ PRIVATE void split_line ARGS2( HTLine * previous = text->last_line; int ctrl_chars_on_previous_line = 0; char * cp; - /* can't wrap in middle of multibyte sequences, so allocate 2 extra */ - HTLine * line = (HTLine *)LY_CALLOC(1, LINE_SIZE(MAX_LINE)+2); + HTLine * line = (HTLine *)LY_CALLOC(1, LINE_SIZE(MAX_LINE)); if (line == NULL) outofmem(__FILE__, "split_line_1"); ctrl_chars_on_this_line = 0; /*reset since we are going to a new line*/ text->LastChar = ' '; -#ifdef DEBUG_APPCH - CTRACE(tfp,"GridText: split_line(%p,%d) called\n", text, split); - CTRACE(tfp," bold_on=%d, underline_on=%d\n", bold_on, underline_on); -#endif + if (TRACE) + fprintf(stderr,"GridText: split_line called\n"); text->Lines++; @@ -1706,8 +1696,8 @@ PRIVATE void split_line ARGS2( } } if (previous->numstyles > 0 && previous->styles[LastStyle].direction) { - - CTRACE(tfp, "%s\n%s%s\n", + if (TRACE) + fprintf(stderr, "%s\n%s%s\n", "........... Too many character styles on line:", "........... ", previous->data); } @@ -1722,7 +1712,7 @@ PRIVATE void split_line ARGS2( line->styles[0].horizpos = 0xffffffff; if (previous->numstyles == 0) previous->styles[0].horizpos = 0xffffffff; -#endif /*USE_COLOR_STYLE*/ +#endif previous->next = line; text->last_line = line; line->size = 0; @@ -1753,8 +1743,8 @@ PRIVATE void split_line ARGS2( */ if (split > 0) { /* Delete space at "split" splitting line */ char *p, *prevdata = previous->data, *linedata = line->data; - unsigned plen; - unsigned i; + unsigned int plen; + int i; /* * Split the line. - FM @@ -1781,42 +1771,38 @@ PRIVATE void split_line ARGS2( * Make sure our global flag is correct. - FM */ underline_on = NO; - if (split) { - for (i = (split-1); i != 0; i--) { - if (prevdata[i] == LY_UNDERLINE_END_CHAR) { - break; - } - if (prevdata[i] == LY_UNDERLINE_START_CHAR) { - underline_on = YES; - break; - } + for (i = (split-1); i >= 0; i--) { + if (prevdata[i] == LY_UNDERLINE_END_CHAR) { + break; + } + if (prevdata[i] == LY_UNDERLINE_START_CHAR) { + underline_on = YES; + break; } } /* * Act on the global flag if set above. - FM */ if (underline_on && *p != LY_UNDERLINE_END_CHAR) { - linedata[line->size++] = LY_UNDERLINE_START_CHAR; + linedata[line->size++] = LY_UNDERLINE_START_CHAR; linedata[line->size] = '\0'; ctrl_chars_on_this_line++; SpecialAttrChars++; } - if (plen) { - for (i = (plen - 1); i != 0; i--) { - if (p[i] == LY_UNDERLINE_START_CHAR) { - underline_on = YES; - break; - } - if (p[i] == LY_UNDERLINE_END_CHAR) { - underline_on = NO; - break; - } + for (i = (plen - 1); i >= 0; i--) { + if (p[i] == LY_UNDERLINE_START_CHAR) { + underline_on = YES; + break; } - for (i = (plen - 1); i != 0; i--) { - if (p[i] == LY_UNDERLINE_START_CHAR || - p[i] == LY_UNDERLINE_END_CHAR) { - ctrl_chars_on_this_line++; - } + if (p[i] == LY_UNDERLINE_END_CHAR) { + underline_on = NO; + break; + } + } + for (i = (plen - 1); i >= 0; i--) { + if (p[i] == LY_UNDERLINE_START_CHAR || + p[i] == LY_UNDERLINE_END_CHAR) { + ctrl_chars_on_this_line++; } } } @@ -1826,15 +1812,13 @@ PRIVATE void split_line ARGS2( * sure that our global flag is correct. - FM */ bold_on = NO; - if (split) { - for (i = (split - 1); i != 0; i--) { - if (prevdata[i] == LY_BOLD_END_CHAR) { - break; - } - if (prevdata[i] == LY_BOLD_START_CHAR) { - bold_on = YES; - break; - } + for (i = (split - 1); i >= 0; i--) { + if (prevdata[i] == LY_BOLD_END_CHAR) { + break; + } + if (prevdata[i] == LY_BOLD_START_CHAR) { + bold_on = YES; + break; } } /* @@ -1845,29 +1829,26 @@ PRIVATE void split_line ARGS2( linedata[line->size] = '\0'; ctrl_chars_on_this_line++; SpecialAttrChars++;; - } else - bold_on = OFF; - if (plen) { - for (i = (plen - 1); i != 0; i--) { - if (p[i] == LY_BOLD_START_CHAR) { - bold_on = YES; - break; - } - if (p[i] == LY_BOLD_END_CHAR) { - bold_on = NO; - break; - } + } + for (i = (plen - 1); i >= 0; i--) { + if (p[i] == LY_BOLD_START_CHAR) { + bold_on = YES; + break; } - for (i = (plen - 1); i != 0; i--) { - if (p[i] == LY_BOLD_START_CHAR || - p[i] == LY_BOLD_END_CHAR || - IS_UTF_EXTRA(p[i]) || - p[i] == LY_SOFT_HYPHEN) { - ctrl_chars_on_this_line++; - } - if (p[i] == LY_SOFT_HYPHEN && text->permissible_split < i) { - text->permissible_split = i + 1; - } + if (p[i] == LY_BOLD_END_CHAR) { + bold_on = NO; + break; + } + } + for (i = (plen - 1); i >= 0; i--) { + if (p[i] == LY_BOLD_START_CHAR || + p[i] == LY_BOLD_END_CHAR || + IS_UTF_EXTRA(p[i]) || + p[i] == LY_SOFT_HYPHEN) { + ctrl_chars_on_this_line++; + } + if (p[i] == LY_SOFT_HYPHEN && text->permissible_split < i) { + text->permissible_split = i + 1; } } @@ -1950,15 +1931,15 @@ PRIVATE void split_line ARGS2( if (split > 0) { for (a = text->first_anchor; a; a = a->next) { if (a->line_num == CurLine) { - if ((unsigned)a->line_pos >= split) { + if (a->line_pos >= split) { a->start += (1 + SpecialAttrChars - HeadTrim - TailTrim); a->line_pos -= (split - SpecialAttrChars + HeadTrim); a->line_num = text->Lines; } else if ((a->link_type & HYPERTEXT_ANCHOR) && - (unsigned)(a->line_pos + a->extent) >= split) { + (a->line_pos + a->extent) >= split) { a->extent -= (TailTrim + HeadTrim); if (a->extent < 0) { - a->extent = 0; + a->extent = 0; } } } @@ -1981,7 +1962,7 @@ PRIVATE void blank_lines ARGS2( while ((line != text->last_line) && (HText_TrueLineSize(line, text, IgnoreSpaces) == 0)) { if (newlines == 0) - break; + break; newlines--; /* Don't bother: already blank */ line = line->prev; } @@ -2024,8 +2005,8 @@ PUBLIC void HText_setStyle ARGS2( return; /* Safety */ after = text->style->spaceAfter; before = style->spaceBefore; - - CTRACE(tfp, "GridText: Change to style %s\n", style->name); + if (TRACE) + fprintf(stderr, "GridText: Change to style %s\n", style->name); blank_lines (text, ((after > before) ? after : before)); @@ -2043,49 +2024,6 @@ PUBLIC void HText_appendCharacter ARGS2( HTStyle * style; int indent; -#ifdef DEBUG_APPCH - if (TRACE) { - char * special = NULL; /* make trace a little more readable */ - switch(ch) { - case HT_NON_BREAK_SPACE: - special = "HT_NON_BREAK_SPACE"; - break; - case HT_EM_SPACE: - special = "HT_EM_SPACE"; - break; - case LY_UNDERLINE_START_CHAR: - special = "LY_UNDERLINE_START_CHAR"; - break; - case LY_UNDERLINE_END_CHAR: - special = "LY_UNDERLINE_END_CHAR"; - break; - case LY_BOLD_START_CHAR: - special = "LY_BOLD_START_CHAR"; - break; - case LY_BOLD_END_CHAR: - special = "LY_BOLD_END_CHAR"; - break; - case LY_SOFT_HYPHEN: - special = "LY_SOFT_HYPHEN"; - break; - case LY_SOFT_NEWLINE: - special = "LY_SOFT_NEWLINE"; - break; - default: - special = NULL; - break; - } - - if (special != NULL) { - CTRACE(tfp, "add(%s %d special char) %d/%d\n", special, ch, - HTisDocumentSource(), HTOutputFormat != WWW_SOURCE); - } else { - CTRACE(tfp, "add(%c) %d/%d\n", ch, - HTisDocumentSource(), HTOutputFormat != WWW_SOURCE); - } - } /* trace only */ -#endif /* DEBUG_APPCH */ - /* * Make sure we don't crash on NULLs. */ @@ -2129,11 +2067,19 @@ PUBLIC void HText_appendCharacter ARGS2( !text->T.transp && !text->T.output_utf8 && (unsigned char)ch < LYlowest_eightbit[current_char_set]) return; -#endif /* !USE_SLANG */ +#endif /* USE_SLANG */ if ((unsigned char)ch == 155 && HTCJK == NOCJK) { /* octal 233 */ if (!HTPassHighCtrlRaw && !text->T.transp && !text->T.output_utf8 && - (155 < LYlowest_eightbit[current_char_set])) { + (155 < LYlowest_eightbit[current_char_set]) && + strncmp(LYchar_set_names[current_char_set], + "DosLatin1 (cp850)", 17) && + strncmp(LYchar_set_names[current_char_set], + "DosLatinUS (cp437)", 18) && + strncmp(LYchar_set_names[current_char_set], + "Macintosh (8 bit)", 17) && + strncmp(LYchar_set_names[current_char_set], + "NeXT character set", 18)) { return; } } @@ -2206,7 +2152,7 @@ PUBLIC void HText_appendCharacter ARGS2( /* * Can split here. - FM */ - text->permissible_split = text->last_line->size; + text->permissible_split = (int)text->last_line->size; text->state = S_text; return; } else if (ch == 'I') { @@ -2214,7 +2160,7 @@ PUBLIC void HText_appendCharacter ARGS2( /* * Can split here. - FM */ - text->permissible_split = text->last_line->size; + text->permissible_split = (int)text->last_line->size; return; } else { text->state = S_text; @@ -2243,7 +2189,7 @@ PUBLIC void HText_appendCharacter ARGS2( text->kanji_buf = '\0'; return; } else { - text->kanji_buf = '\216'; + text->kanji_buf = '\x8E'; ch |= 0200; } break; @@ -2254,7 +2200,7 @@ PUBLIC void HText_appendCharacter ARGS2( /* * JIS X0201 Kana in SJIS support. - by ASATAKU */ - if ((text->kcode == SJIS) && + if ((text->kcode == SJIS) && ((unsigned char)ch >= 0xA1) && ((unsigned char)ch <= 0xDF)) { unsigned char c = (unsigned char)ch; @@ -2263,15 +2209,15 @@ PUBLIC void HText_appendCharacter ARGS2( (unsigned char *)&kb, (unsigned char *)&c); ch = (char)c; - text->kanji_buf = kb; - } else { + text->kanji_buf = (char)kb; + } else { text->kanji_buf = ch; /* * Can split here. - FM */ - text->permissible_split = text->last_line->size; + text->permissible_split = (int)text->last_line->size; return; - } + } } } else { goto check_IgnoreExcess; @@ -2282,7 +2228,6 @@ PUBLIC void HText_appendCharacter ARGS2( if (IsSpecialAttrChar(ch)) { #ifndef USE_COLOR_STYLE - if (line->size >= (MAX_LINE-1)) return; if (ch == LY_UNDERLINE_START_CHAR) { line->data[line->size++] = LY_UNDERLINE_START_CHAR; line->data[line->size] = '\0'; @@ -2309,11 +2254,6 @@ PUBLIC void HText_appendCharacter ARGS2( bold_on = OFF; ctrl_chars_on_this_line++; return; - } else if (ch == LY_SOFT_NEWLINE) { - line->data[line->size++] = LY_SOFT_NEWLINE; - line->data[line->size] = '\0'; - ctrl_chars_on_this_line++; - return; } else if (ch == LY_SOFT_HYPHEN) { int i; @@ -2322,7 +2262,7 @@ PUBLIC void HText_appendCharacter ARGS2( * on the line, or if it is preceded by a space or * hyphen. - FM */ - if (line->size < 1 || text->permissible_split >= line->size) + if (line->size < 1 || text->permissible_split >= (int)line->size) return; for (i = (text->permissible_split + 1); line->data[i]; i++) { @@ -2406,24 +2346,23 @@ PUBLIC void HText_appendCharacter ARGS2( line->data[--line->size] = '\0'; ctrl_chars_on_this_line--; } - here = ((int)(line->size + line->offset) + indent) + here = (((int)line->size + (int)line->offset) + indent) - ctrl_chars_on_this_line; /* Consider special chars GAB */ if (style->tabs) { /* Use tab table */ for (Tab = style->tabs; Tab->position <= here; - Tab++) { + Tab++) if (!Tab->position) { new_line(text); return; } - } target = Tab->position; } else if (text->in_line_1) { /* Use 2nd indent */ if (here >= (int)style->leftIndent) { - new_line(text); /* wrap */ + new_line(text); /* wrap */ return; } else { - target = (int)style->leftIndent; + target = (int)style->leftIndent; } } else { /* Default tabs align with left indent mod 8 */ #ifdef DEFAULT_TABS_8 @@ -2438,42 +2377,32 @@ PUBLIC void HText_appendCharacter ARGS2( if (target > (LYcols-1) - (int)style->rightIndent && HTOutputFormat != WWW_SOURCE) { new_line(text); + return; } else { /* * Can split here. - FM */ - text->permissible_split = line->size; + text->permissible_split = (int)line->size; if (line->size == 0) { - line->offset = line->offset + target - here; + line->offset = line->offset + target - here; } else { - for (; here<target; here++) { + for (; here<target; here++) { /* Put character into line */ line->data[line->size++] = ' '; line->data[line->size] = '\0'; - } + } } + return; } - return; + /*NOTREACHED*/ } /* if tab */ - else { - /* - * If we're displaying document source, wrap long lines to keep all of - * the source visible. - */ - int target = (int)(line->offset + line->size); - if ((target >= (LYcols-1) - style->rightIndent) && - HTisDocumentSource()) { - new_line(text); - line = text->last_line; - HText_appendCharacter (text, LY_SOFT_NEWLINE); - } - } + if (ch == ' ') { /* * Can split here. - FM */ - text->permissible_split = text->last_line->size; + text->permissible_split = (int)text->last_line->size; /* * There are some pages written in * different kanji codes. - TA @@ -2594,10 +2523,7 @@ check_IgnoreExcess: /* * Can split here. - FM */ - text->permissible_split = text->last_line->size; - } - if (ch == LY_SOFT_NEWLINE) { - ctrl_chars_on_this_line++; + text->permissible_split = (int)text->last_line->size; } } } @@ -2680,7 +2606,7 @@ PUBLIC int HText_beginAnchor ARGS3( BOOL, underline, HTChildAnchor *, anc) { - char marker[32]; + char marker[16]; TextAnchor * a = (TextAnchor *) calloc(1, sizeof(*a)); @@ -2754,7 +2680,7 @@ PUBLIC void HText_endAnchor ARGS2( } else { for (a = text->first_anchor; a; a = a->next) { if (a->number == number) { - break; + break; } } if (a == NULL) { @@ -2766,15 +2692,15 @@ PUBLIC void HText_endAnchor ARGS2( a = text->last_anchor; } } - - CTRACE(tfp, "HText_endAnchor: number:%d link_type:%d\n", + if (TRACE) + fprintf(stderr, "HText_endAnchor: number:%d link_type:%d\n", a->number, a->link_type); if (a->link_type == INPUT_ANCHOR) { /* * Shouldn't happen, but put test here anyway to be safe. - LE */ - - CTRACE(tfp, + if (TRACE) + fprintf(stderr, "HText_endAnchor: internal error: last anchor was input field!\n"); return; } @@ -2818,7 +2744,7 @@ PUBLIC void HText_endAnchor ARGS2( j = (last->size - i); while (j < last->size) { if (!IsSpecialAttrChar(last->data[j]) && - !isspace((unsigned char)last->data[j]) && + !isspace((unsigned char)last->data[j]) && last->data[j] != HT_NON_BREAK_SPACE && last->data[j] != HT_EM_SPACE) break; @@ -2854,20 +2780,20 @@ PUBLIC void HText_endAnchor ARGS2( while (i == 0 && a->extent > CurBlankExtent) { j = prev->size - a->extent + CurBlankExtent; if (j < 0) { - /* + /* * The anchor starts on a preceding line, * so check all of this line. - FM */ - j = 0; + j = 0; i = prev->size; } else { - /* + /* * The anchor starts on this line. - FM */ - i = a->extent - CurBlankExtent; + i = a->extent - CurBlankExtent; } while (j < prev->size) { - if (!IsSpecialAttrChar(prev->data[j]) && + if (!IsSpecialAttrChar(prev->data[j]) && !isspace((unsigned char)prev->data[j]) && prev->data[j] != HT_NON_BREAK_SPACE && prev->data[j] != HT_EM_SPACE) @@ -2958,15 +2884,15 @@ PUBLIC void HText_endAnchor ARGS2( j--; NumSize++; while (j >= 0 && isdigit((unsigned char)start->data[j])) { - j--; + j--; NumSize++; } while (j < 0) { - j++; + j++; NumSize--; } if (start->data[j] == '[') { - /* + /* * The numbered bracket is entirely * on this line. - FM */ @@ -2980,16 +2906,21 @@ PUBLIC void HText_endAnchor ARGS2( anc->start -= NumSize; anc->line_pos -= NumSize; } - start->size = j; + start->size = j; start->data[j++] = '\0'; while (j < k) start->data[j++] = '\0'; } else if (prev && prev->size > 1) { k = (i + 1); j = (prev->size - 1); - while ((j >= 0) && IsSpecialAttrChar(prev->data[j])) + while ((j >= 0) && + (prev->data[j] == LY_BOLD_START_CHAR || + prev->data[j] == LY_BOLD_END_CHAR || + prev->data[j] == LY_UNDERLINE_START_CHAR || + prev->data[j] == LY_UNDERLINE_END_CHAR || + prev->data[j] == LY_SOFT_HYPHEN)) j--; - i = (j + 1); + i = (j + 1); while (j >= 0 && isdigit((unsigned char)prev->data[j])) { j--; @@ -3020,9 +2951,9 @@ PUBLIC void HText_endAnchor ARGS2( j = 0; i = k; while (k < start->size) - start->data[j++] = start->data[k++]; + start->data[j++] = start->data[k++]; if (start != last) - text->chars -= i; + text->chars -= i; for (anc = a; anc; anc = anc->next) { anc->start -= i; anc->line_pos -= i; @@ -3030,7 +2961,7 @@ PUBLIC void HText_endAnchor ARGS2( start->size = j; start->data[j++] = '\0'; while (j < k) - start->data[j++] = '\0'; + start->data[j++] = '\0'; } else { /* * Shucks! We didn't find the @@ -3047,17 +2978,22 @@ PUBLIC void HText_endAnchor ARGS2( } } else if (prev && prev->size > 2) { j = (prev->size - 1); - while ((j >= 0) && IsSpecialAttrChar(prev->data[j])) - j--; + while ((j >= 0) && + (prev->data[j] == LY_BOLD_START_CHAR || + prev->data[j] == LY_BOLD_END_CHAR || + prev->data[j] == LY_UNDERLINE_START_CHAR || + prev->data[j] == LY_UNDERLINE_END_CHAR || + prev->data[j] == LY_SOFT_HYPHEN)) + j--; if (j < 0) - j = 0; + j = 0; i = (j + 1); if ((j > 2) && - (prev->data[j] == ']' && + (prev->data[j] == ']' && isdigit((unsigned char)prev->data[j - 1]))) { - j--; + j--; NumSize++; - k = (j + 1); + k = (j + 1); while (j >= 0 && isdigit((unsigned char)prev->data[j])) { j--; @@ -3097,7 +3033,7 @@ PUBLIC void HText_endAnchor ARGS2( * Shucks! We didn't find the * numbered bracket. - FM */ - a->show_anchor = YES; + a->show_anchor = YES; } } else { /* @@ -3126,7 +3062,7 @@ PUBLIC void HText_endAnchor ARGS2( a->extent = 0; if (text->hiddenlinkflag != HIDDENLINKS_MERGE) { a->number = 0; - text->last_anchor_number--; + text->last_anchor_number--; HText_AddHiddenLink(text, a); } } else { @@ -3196,12 +3132,15 @@ PRIVATE void remove_special_attr_chars ARGS1( PUBLIC void HText_endAppend ARGS1( HText *, text) { + int cur_line, cur_char, cur_shift, len; + TextAnchor *anchor_ptr; HTLine *line_ptr; + unsigned char ch; if (!text) return; - - CTRACE(tfp,"Gridtext: Entering HText_endAppend\n"); + if (TRACE) + fprintf(stderr,"Gridtext: Entering HText_endAppend\n"); /* * Create a blank line at the bottom. @@ -3222,6 +3161,9 @@ PUBLIC void HText_endAppend ARGS1( * Get the first line. */ line_ptr = text->last_line->next; + cur_char = line_ptr->size; + cur_line = 0; + cur_shift = 0; /* * Remove the blank lines at the end of document. @@ -3229,8 +3171,8 @@ PUBLIC void HText_endAppend ARGS1( while (text->last_line->data[0] == '\0' && text->Lines > 2) { HTLine *next_to_the_last_line = text->last_line->prev; - - CTRACE(tfp, "GridText: Removing bottom blank line: %s\n", + if (TRACE) + fprintf(stderr, "GridText: Removing bottom blank line: %s\n", text->last_line->data); /* * line_ptr points to the first line. @@ -3240,58 +3182,18 @@ PUBLIC void HText_endAppend ARGS1( FREE(text->last_line); text->last_line = next_to_the_last_line; text->Lines--; - CTRACE(tfp, "GridText: New bottom line: %s\n", +#ifdef NOTUSED_BAD_FOR_SCREEN + if (TRACE) { + fprintf(stderr, "GridText: New bottom line: %s\n", text->last_line->data); + } +#endif } /* * Fix up the anchor structure values and * create the hightext strings. - FM */ - HText_trimHightext(text, FALSE); -} - - -/* -** This function gets the hightext from the text by finding the char -** position, and brings the anchors in line with the text by adding the text -** offset to each of the anchors. -** -** `Forms input' fields cannot be displayed properly without this function -** to be invoked (detected in display_partial mode). -** -** (BOOLEAN value allow us to disable annoying repeated trace messages -** for display_partial mode). -*/ -PUBLIC void HText_trimHightext ARGS2( - HText *, text, - BOOLEAN, disable_trace) -{ - int cur_line, cur_char, cur_shift; - TextAnchor *anchor_ptr; - HTLine *line_ptr; - unsigned char ch; - - if (!text) - return; - - CTRACE(tfp,"Gridtext: Entering HText_trimHightext\n"); - - if (disable_trace) - CTRACE(tfp,"HText_trimHightext: trace disabled in display_partial mode\n"); - - /* - * Get the first line. - */ - line_ptr = text->last_line->next; - cur_char = line_ptr->size; - cur_line = 0; - cur_shift = 0; - - /* - * Fix up the anchor structure values and - * create the hightext strings. - FM - */ for (anchor_ptr = text->first_anchor; anchor_ptr; anchor_ptr=anchor_ptr->next) { re_parse: @@ -3312,9 +3214,8 @@ re_parse: } if (anchor_ptr->line_pos < 0) anchor_ptr->line_pos = 0; - - if (!disable_trace) - CTRACE(tfp, "Gridtext: Anchor found on line:%d col:%d\n", + if (TRACE) + fprintf(stderr, "Gridtext: Anchor found on line:%d col:%d\n", cur_line, anchor_ptr->line_pos); /* @@ -3324,7 +3225,7 @@ re_parse: if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) { ch = (unsigned char)line_ptr->data[anchor_ptr->line_pos]; while (isspace(ch) || - IsSpecialAttrChar(ch)) { + IsSpecialAttrChar(ch)) { anchor_ptr->line_pos++; anchor_ptr->extent--; cur_shift++; @@ -3334,23 +3235,29 @@ re_parse: if (anchor_ptr->extent < 0) { anchor_ptr->extent = 0; } - - if (!disable_trace) - CTRACE(tfp, "anchor text: '%s'\n", - line_ptr->data); +#ifdef NOTUSED_BAD_FOR_SCREEN + if (TRACE) + fprintf(stderr, "anchor text: '%s' pos: %d\n", + line_ptr->data, anchor_ptr->line_pos); +#endif /* * If the link begins with an end of line and we have more * lines, then start the highlighting on the next line. - FM */ - if ((unsigned)anchor_ptr->line_pos >= strlen(line_ptr->data) && + if (anchor_ptr->line_pos >= strlen(line_ptr->data) && cur_line < text->Lines) { anchor_ptr->start += (cur_shift + 1); cur_shift = 0; - CTRACE(tfp, "found anchor at end of line\n"); + if (TRACE) + fprintf(stderr, "found anchor at end of line\n"); goto re_parse; } cur_shift = 0; - +#ifdef NOTUSED_BAD_FOR_SCREEN + if (TRACE) + fprintf(stderr, "anchor text: '%s' pos: %d\n", + line_ptr->data, anchor_ptr->line_pos); +#endif /* * Copy the link name into the data structure. */ @@ -3367,7 +3274,7 @@ re_parse: * If true the anchor extends over two lines, * copy that into the data structure. */ - if ((unsigned)anchor_ptr->extent > strlen(anchor_ptr->hightext)) { + if (anchor_ptr->extent > strlen(anchor_ptr->hightext)) { HTLine *line_ptr2 = line_ptr->next; /* * Double check that we have a line pointer, @@ -3378,11 +3285,19 @@ re_parse: line_ptr2->data, (anchor_ptr->extent - strlen(anchor_ptr->hightext))); - anchor_ptr->hightext2offset = line_ptr2->offset; + anchor_ptr->hightext2offset = line_ptr2->offset; remove_special_attr_chars(anchor_ptr->hightext2); if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) { - LYTrimTrailing(anchor_ptr->hightext2); - if (anchor_ptr->hightext2[0] == '\0') { + if ((len = strlen(anchor_ptr->hightext2)) > 0) { + len--; + while (len >= 0 && + isspace((unsigned char) + anchor_ptr->hightext2[len])) { + anchor_ptr->hightext2[len] = '\0'; + len--; + } + } + if (len <= 0 && anchor_ptr->hightext2[0] == '\0') { FREE(anchor_ptr->hightext2); anchor_ptr->hightext2offset = 0; } @@ -3391,7 +3306,14 @@ re_parse: } remove_special_attr_chars(anchor_ptr->hightext); if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) { - LYTrimTrailing(anchor_ptr->hightext); + if ((len = strlen(anchor_ptr->hightext)) > 0) { + len--; + while (len >= 0 && + isspace((unsigned char)anchor_ptr->hightext[len])) { + anchor_ptr->hightext[len] = '\0'; + len--; + } + } } /* @@ -3412,10 +3334,10 @@ re_parse: */ anchor_ptr->line_pos += line_ptr->offset; anchor_ptr->line_num = cur_line; - - if (!disable_trace) - CTRACE(tfp, "GridText: add link on line %d col %d in HText_trimHightext\n", - cur_line, anchor_ptr->line_pos); + if (TRACE) + fprintf(stderr, + "GridText: adding link on line %d in HText_endAppend\n", + cur_line); /* * If this is the last anchor, we're done! @@ -3426,12 +3348,12 @@ re_parse: } -/* Dump diagnostics to tfp +/* Dump diagnostics to stderr */ PUBLIC void HText_dump ARGS1( HText *, text GCC_UNUSED) { - fprintf(tfp, "HText: Dump called\n"); + fprintf(stderr, "HText: Dump called\n"); } @@ -3487,7 +3409,7 @@ PUBLIC void HText_FormDescNumber ARGS2( for (a = HTMainText->first_anchor; a; a = a->next) { if (a->number == number) { if (!(a->input_field && a->input_field->type)) { - *desc = "unknown field or link"; + *desc = "unknown field or link"; return; } break; @@ -3630,7 +3552,7 @@ PUBLIC int HTGetLinkInfo ARGS6( */ return(NO); } - if (anchors_this_screen > 0 && + if (anchors_this_screen > 0 && anchors_this_screen <= nlinks && a->line_num >= HTMainText->top_of_screen && a->line_num < HTMainText->top_of_screen+(display_lines)) { @@ -3642,7 +3564,7 @@ PUBLIC int HTGetLinkInfo ARGS6( */ *go_line = HTMainText->top_of_screen; if (linknum) - *linknum = anchors_this_screen - 1; + *linknum = anchors_this_screen - 1; } else { /* * if the requested anchor is not within the currently @@ -3666,13 +3588,13 @@ PUBLIC int HTGetLinkInfo ARGS6( max_offset = display_lines - 1; *go_line = prev_anchor_line - max_offset; if (*go_line <= prev_prev_anchor_line) - *go_line = prev_prev_anchor_line + 1; + *go_line = prev_prev_anchor_line + 1; if (*go_line < 0) - *go_line = 0; + *go_line = 0; if (linknum) - *linknum = anchors_this_line - 1; - } - return(LINK_LINE_FOUND); + *linknum = anchors_this_line - 1; + } + return(LINK_LINE_FOUND); } else { *hightext= a->hightext; link_dest = HTAnchor_followMainLink((HTAnchor *)a->anchor); @@ -3686,8 +3608,9 @@ PUBLIC int HTGetLinkInfo ARGS6( link_dest_intl = HTAnchor_followTypedLink( (HTAnchor *)a->anchor, LINK_INTERNAL); if (link_dest_intl && link_dest_intl != link_dest) { - - CTRACE(tfp, "HTGetLinkInfo: unexpected typed link to %s!\n", + if (TRACE) + fprintf(stderr, + "HTGetLinkInfo: unexpected typed link to %s!\n", link_dest_intl->parent->address); link_dest_intl = NULL; } @@ -3809,17 +3732,17 @@ PUBLIC int HText_getNumOfLines NOARGS * HText_getTitle returns the title of the * current document. */ -PUBLIC CONST char * HText_getTitle NOARGS +PUBLIC char * HText_getTitle NOARGS { return(HTMainText ? - HTAnchor_title(HTMainText->node_anchor) : 0); + (char *) HTAnchor_title(HTMainText->node_anchor) : NULL); } #ifdef USE_HASH -PUBLIC CONST char *HText_getStyle NOARGS +PUBLIC char *HText_getStyle NOARGS { return(HTMainText ? - HTAnchor_style(HTMainText->node_anchor) : 0); + (char *) HTAnchor_style(HTMainText->node_anchor) : NULL); } #endif @@ -3828,10 +3751,10 @@ PUBLIC CONST char *HText_getStyle NOARGS * document (normally derived from a Content-Disposition header with * attachment; filename=name.suffix). - FM */ -PUBLIC CONST char * HText_getSugFname NOARGS +PUBLIC char * HText_getSugFname NOARGS { return(HTMainText ? - HTAnchor_SugFname(HTMainText->node_anchor) : 0); + (char *) HTAnchor_SugFname(HTMainText->node_anchor) : NULL); } /* @@ -3924,12 +3847,12 @@ PUBLIC void HTCheckFnameForCompression ARGS3( !strcasecomp(dot, ".gz") || !strcasecomp(dot, ".Z")) { if (!method) { - /* + /* * It has a suffix which signifies a gzipped * or compressed file for us, but the anchor * claims otherwise, so tweak the suffix. - FM */ - cp = (dot + 1); + cp = (dot + 1); *dot = '\0'; if (!strcasecomp(cp, "tgz")) { StrAllocCat(*fname, ".tar"); @@ -3942,7 +3865,7 @@ PUBLIC void HTCheckFnameForCompression ARGS3( if (!strcasecomp(cp, "-gz") || !strcasecomp(cp, "_gz")) { if (!method) { - /* + /* * It has a tail which signifies a gzipped * file for us, but the anchor claims otherwise, * so tweak the suffix. - FM @@ -3972,7 +3895,7 @@ PUBLIC void HTCheckFnameForCompression ARGS3( if (!strcasecomp(cp, "-Z") || !strcasecomp(cp, "_Z")) { if (!method) { - /* + /* * It has a tail which signifies a compressed * file for us, but the anchor claims otherwise, * so tweak the suffix. - FM @@ -4029,69 +3952,44 @@ PUBLIC void HTCheckFnameForCompression ARGS3( * HText_getLastModified returns the Last-Modified header * if available, for the current document. - FM */ -PUBLIC CONST char * HText_getLastModified NOARGS +PUBLIC char * HText_getLastModified NOARGS { return(HTMainText ? - HTAnchor_last_modified(HTMainText->node_anchor) : 0); + (char *) HTAnchor_last_modified(HTMainText->node_anchor) : NULL); } /* * HText_getDate returns the Date header * if available, for the current document. - FM */ -PUBLIC CONST char * HText_getDate NOARGS +PUBLIC char * HText_getDate NOARGS { return(HTMainText ? - HTAnchor_date(HTMainText->node_anchor) : 0); + (char *) HTAnchor_date(HTMainText->node_anchor) : NULL); } /* * HText_getServer returns the Server header * if available, for the current document. - FM */ -PUBLIC CONST char * HText_getServer NOARGS +PUBLIC char * HText_getServer NOARGS { return(HTMainText ? - HTAnchor_server(HTMainText->node_anchor) : 0); + (char *)HTAnchor_server(HTMainText->node_anchor) : NULL); } /* * HText_pageDisplay displays a screen of text - * starting from the line 'line_num'-1. - * This is the primary call for lynx. + * starting from the line 'line_num'-1 + * this is the primary call for lynx */ PUBLIC void HText_pageDisplay ARGS2( int, line_num, char *, target) { - CTRACE(tfp, "GridText: HText_pageDisplay at line %d started\n", line_num); - -#ifdef DISP_PARTIAL - if (display_partial && detected_forms_input_partial) { - /* - ** Garbage is reported from forms input fields in incremental mode. - ** So we start HText_trimHightext() to forget this side effect. - ** This function was split-out from HText_endAppend(). - ** It may not be the best solution but it works. - LP - ** (TRUE = to disable annoying repeated trace messages) - ** - ** Side effect is reported from multiply call of HText_trimHightext. - */ - HText_trimHightext(HTMainText, TRUE); - } - detected_forms_input_partial = FALSE; -#endif - display_page(HTMainText, line_num-1, target); -#ifdef DISP_PARTIAL - if (display_partial && debug_display_partial) - sleep(MessageSecs); -#endif - is_www_index = HTAnchor_isIndex(HTMainAnchor); - - CTRACE(tfp, "GridText: HText_pageDisplay finished\n"); } /* @@ -4168,8 +4066,7 @@ PUBLIC BOOL HText_canScrollDown NOARGS { HText * text = HTMainText; - return (text != 0) - && ((text->top_of_screen + display_lines) < text->Lines+1); + return ((text->top_of_screen + display_lines) < text->Lines+1); } /* Scroll actions @@ -4300,10 +4197,10 @@ PUBLIC BOOL HTFindPoundSelector ARGS1( if (a->anchor && a->anchor->tag) if (!strcmp(a->anchor->tag, selector)) { - www_search_result = a->line_num+1; - - CTRACE(tfp, - "HText: Selecting anchor [%d] at character %d, line %d\n", + www_search_result = a->line_num+1; + if (TRACE) + fprintf(stderr, + "HText: Selecting anchor [%d] at character %d, line %d\n", a->number, a->start, www_search_result); if (!strcmp(selector, LYToolbarName)) --www_search_result; @@ -4333,7 +4230,7 @@ PUBLIC BOOL HText_selectAnchor ARGS2( if (a->anchor == anchor) break; } if (!a) { - CTRACE(tfp, "HText: No such anchor in this text!\n"); + if (TRACE) fprintf(stderr, "HText: No such anchor in this text!\n"); return NO; } @@ -4344,14 +4241,14 @@ PUBLIC BOOL HText_selectAnchor ARGS2( { int l = line_for_char(text, a->start); - CTRACE(tfp, + if (TRACE) fprintf(stderr, "HText: Selecting anchor [%d] at character %d, line %d\n", a->number, a->start, l); if ( !text->stale && (l >= text->top_of_screen) && ( l < text->top_of_screen + display_lines+1)) - return YES; + return YES; www_search_result = l - (display_lines/3); /* put in global variable */ } @@ -4449,7 +4346,7 @@ PUBLIC HTAnchor * HText_referenceSelected ARGS1( PUBLIC int HText_getTopOfScreen NOARGS { HText * text = HTMainText; - return text != 0 ? text->top_of_screen : 0; + return text->top_of_screen; } PUBLIC int HText_getLines ARGS1( @@ -4526,7 +4423,7 @@ PUBLIC int do_www_search ARGS1( document *, doc) { char searchstring[256], temp[256], *cp, *tmpaddress = NULL; - int ch, recall; + int ch, recall, i; int QueryTotal; int QueryNum; BOOLEAN PreviousSearch = FALSE; @@ -4543,7 +4440,7 @@ PUBLIC int do_www_search ARGS1( strcpy(searchstring, ++cp); for (cp=searchstring; *cp; cp++) if (*cp == '+') - *cp = ' '; + *cp = ' '; HTUnEscape(searchstring); strcpy(temp, searchstring); /* @@ -4578,22 +4475,22 @@ get_query: *searchstring == '\0' || ch == UPARROW || ch == DNARROW) { if (recall && ch == UPARROW) { if (PreviousSearch) { - /* + /* * Use the second to last query in the list. - FM */ - QueryNum = 1; + QueryNum = 1; PreviousSearch = FALSE; } else { - /* + /* * Go back to the previous query in the list. - FM */ - QueryNum++; + QueryNum++; } if (QueryNum >= QueryTotal) - /* + /* * Roll around to the last query in the list. - FM */ - QueryNum = 0; + QueryNum = 0; if ((cp=(char *)HTList_objectAt(search_queries, QueryNum)) != NULL) { strcpy(searchstring, cp); @@ -4609,19 +4506,19 @@ get_query: } } else if (recall && ch == DNARROW) { if (PreviousSearch) { - /* + /* * Use the first query in the list. - FM */ - QueryNum = QueryTotal - 1; + QueryNum = QueryTotal - 1; PreviousSearch = FALSE; } else { - /* + /* * Advance to the next query in the list. - FM */ - QueryNum--; + QueryNum--; } if (QueryNum < 0) - /* + /* * Roll around to the first query in the list. - FM */ QueryNum = QueryTotal - 1; @@ -4643,25 +4540,37 @@ get_query: /* * Search cancelled. */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return(NULLFILE); } /* * Strip leaders and trailers. - FM */ - LYTrimLeading(searchstring); - if (!(*searchstring)) { - HTInfoMsg(CANCELLED); + cp = searchstring; + while (*cp && isspace((unsigned char)*cp)) + cp++; + if (!(*cp)) { + _statusline(CANCELLED); + sleep(InfoSecs); return(NULLFILE); } - LYTrimTrailing(searchstring); + if (cp > searchstring) { + for (i = 0; *cp; i++) + searchstring[i] = *cp++; + searchstring[i] = '\0'; + } + cp = searchstring + strlen(searchstring) - 1; + while ((cp > searchstring) && isspace((unsigned char)*cp)) + *cp-- = '\0'; /* * Don't resubmit the same query unintentionally. */ if (!LYforce_no_cache && 0 == strcmp(temp, searchstring)) { - HTUserMsg(USE_C_R_TO_RESUB_CUR_QUERY); + _statusline(USE_C_R_TO_RESUB_CUR_QUERY); + sleep(MessageSecs); return(NULLFILE); } @@ -4705,7 +4614,8 @@ get_query: StrAllocCopy(doc->address, cp_freeme); FREE(cp_freeme); - CTRACE(tfp,"\ndo_www_search: newfile: %s\n",doc->address); + if (TRACE) + fprintf(stderr,"\ndo_www_search: newfile: %s\n",doc->address); /* * Yah, the search succeeded. @@ -4734,7 +4644,6 @@ PUBLIC void print_wwwfile_to_fd ARGS2( int, is_reply) { register int i; - int first = TRUE; HTLine * line; #ifdef VMS extern BOOLEAN HadVMSInterrupt; @@ -4745,11 +4654,6 @@ PUBLIC void print_wwwfile_to_fd ARGS2( line = HTMainText->last_line->next; for (;; line = line->next) { - if (!first - && line->data[0] != LY_SOFT_NEWLINE) - fputc('\n',fp); - first = FALSE; - /* * Add news-style quotation if requested. - FM */ @@ -4757,7 +4661,7 @@ PUBLIC void print_wwwfile_to_fd ARGS2( fputc('>',fp); } - /* + /* * Add offset. */ for (i = 0; i < (int)line->offset; i++) { @@ -4769,13 +4673,14 @@ PUBLIC void print_wwwfile_to_fd ARGS2( */ for (i = 0; line->data[i] != '\0'; i++) { if (!IsSpecialAttrChar(line->data[i])) { - fputc(line->data[i], fp); + fputc(line->data[i],fp); } else if (line->data[i] == LY_SOFT_HYPHEN && line->data[i + 1] == '\0') { /* last char on line */ if (dump_output_immediately && LYRawMode && LYlowest_eightbit[current_char_set] <= 173 && - (LYCharSet_UC[current_char_set].enc == UCT_ENC_8859 || + (current_char_set == 0 || + LYCharSet_UC[current_char_set].enc == UCT_ENC_8859 || LYCharSet_UC[current_char_set].like8859 & UCT_R_8859SPECL)) { fputc(0xad, fp); /* the iso8859 byte for SHY */ @@ -4795,6 +4700,11 @@ PUBLIC void print_wwwfile_to_fd ARGS2( } } + /* + * Add the return. + */ + fputc('\n',fp); + if (line == HTMainText->last_line) break; @@ -4803,7 +4713,6 @@ PUBLIC void print_wwwfile_to_fd ARGS2( break; #endif /* VMS */ } - fputc('\n',fp); } @@ -4818,7 +4727,6 @@ PUBLIC void print_crawl_to_fd ARGS3( char *, thetitle) { register int i; - int first = TRUE; HTLine * line; #ifdef VMS extern BOOLEAN HadVMSInterrupt; @@ -4834,10 +4742,6 @@ PUBLIC void print_crawl_to_fd ARGS3( } for (;; line = line->next) { - if (!first - && line->data[0] != LY_SOFT_NEWLINE) - fputc('\n',fp); - first = FALSE; /* * Add offset. */ @@ -4851,26 +4755,31 @@ PUBLIC void print_crawl_to_fd ARGS3( for (i = 0; line->data[i] != '\0'; i++) { if (!IsSpecialAttrChar(line->data[i])) { fputc(line->data[i], fp); - } else if (line->data[i] == LY_SOFT_HYPHEN && - line->data[i + 1] == '\0') { /* last char on line */ - if (dump_output_immediately && - LYRawMode && - LYlowest_eightbit[current_char_set] <= 173 && - (LYCharSet_UC[current_char_set].enc == UCT_ENC_8859 || - LYCharSet_UC[current_char_set].like8859 & - UCT_R_8859SPECL)) { - fputc(0xad, fp); /* the iso8859 byte for SHY */ - } else { - fputc('-', fp); - } + } else if (line->data[i] == LY_SOFT_HYPHEN && + line->data[i + 1] == '\0') { /* last char on line */ + if (dump_output_immediately && + LYRawMode && + LYlowest_eightbit[current_char_set] <= 173 && + (current_char_set == 0 || + LYCharSet_UC[current_char_set].enc == UCT_ENC_8859 || + LYCharSet_UC[current_char_set].like8859 & + UCT_R_8859SPECL)) { + fputc(0xad, fp); /* the iso8859 byte for SHY */ + } else { + fputc('-', fp); + } } } + /* + * Add the return. + */ + fputc('\n',fp); + if (line == HTMainText->last_line) { break; } } - fputc('\n',fp); /* * Add the References list if appropriate @@ -5016,7 +4925,7 @@ PUBLIC void www_user_search ARGS3( if ((a->input_field != NULL && a->input_field->value != NULL) && a->input_field->type != F_HIDDEN_TYPE) { if (a->input_field->type == F_PASSWORD_TYPE) { - /* + /* * Check the actual, hidden password, and then * the displayed string. - FM */ @@ -5065,7 +4974,7 @@ PUBLIC void www_user_search ARGS3( /* * Search for checked or unchecked parens. - FM */ - if (a->input_field->num_value) { + if (a->input_field->num_value) { cp = checked_radio; } else { cp = unchecked_radio; @@ -5082,7 +4991,7 @@ PUBLIC void www_user_search ARGS3( * Search for checked or unchecked * square brackets. - FM */ - if (a->input_field->num_value) { + if (a->input_field->num_value) { cp = checked_box; } else { cp = unchecked_box; @@ -5095,7 +5004,7 @@ PUBLIC void www_user_search ARGS3( return; } } else { - /* + /* * Check the values intended for display. * May have been found already via the * hightext search, but make sure here @@ -5175,7 +5084,7 @@ PUBLIC void www_user_search ARGS3( if ((a->input_field != NULL && a->input_field->value != NULL) && a->input_field->type != F_HIDDEN_TYPE) { if (a->input_field->type == F_PASSWORD_TYPE) { - /* + /* * Check the actual, hidden password, and then * the displayed string. - FM */ @@ -5224,7 +5133,7 @@ PUBLIC void www_user_search ARGS3( /* * Search for checked or unchecked parens. - FM */ - if (a->input_field->num_value) { + if (a->input_field->num_value) { cp = checked_radio; } else { cp = unchecked_radio; @@ -5241,7 +5150,7 @@ PUBLIC void www_user_search ARGS3( * Search for checked or unchecked * square brackets. - FM */ - if (a->input_field->num_value) { + if (a->input_field->num_value) { cp = checked_box; } else { cp = unchecked_box; @@ -5254,7 +5163,7 @@ PUBLIC void www_user_search ARGS3( return; } } else { - /* + /* * Check the values intended for display. * May have been found already via the * hightext search, but make sure here @@ -5279,17 +5188,18 @@ PUBLIC void www_user_search ARGS3( } if (case_sensitive && LYno_attr_char_strstr(line->data, target)) { - tentative_result=count; + tentative_result=count; break; } else if (!case_sensitive && LYno_attr_char_case_strstr(line->data, target)) { - tentative_result = count; + tentative_result = count; break; } else if (count > start_line) { /* next line */ - HTUserMsg2(STRING_NOT_FOUND, target); - return; /* end */ + _user_message(STRING_NOT_FOUND, target); + sleep(MessageSecs); + return; /* end */ } else { - line = line->next; + line = line->next; count++; } } @@ -5330,14 +5240,14 @@ PUBLIC void user_message ARGS2( * HText_getOwner returns the owner of the * current document. */ -PUBLIC CONST char * HText_getOwner NOARGS +PUBLIC char * HText_getOwner NOARGS { return(HTMainText ? - HTAnchor_owner(HTMainText->node_anchor) : 0); + (char *)HTAnchor_owner(HTMainText->node_anchor) : NULL); } /* - * HText_setMainTextOwner sets the owner for the +* HText_setMainTextOwner sets the owner for the * current document. */ PUBLIC void HText_setMainTextOwner ARGS1( @@ -5354,30 +5264,30 @@ PUBLIC void HText_setMainTextOwner ARGS1( * current document, used as the subject for mailto comments * to the owner. */ -PUBLIC CONST char * HText_getRevTitle NOARGS +PUBLIC char * HText_getRevTitle NOARGS { return(HTMainText ? - HTAnchor_RevTitle(HTMainText->node_anchor) : 0); + (char *)HTAnchor_RevTitle(HTMainText->node_anchor) : NULL); } /* * HText_getContentBase returns the Content-Base header * of the current document. */ -PUBLIC CONST char * HText_getContentBase NOARGS +PUBLIC char * HText_getContentBase NOARGS { return(HTMainText ? - HTAnchor_content_base(HTMainText->node_anchor) : 0); + (char *)HTAnchor_content_base(HTMainText->node_anchor) : NULL); } /* * HText_getContentLocation returns the Content-Location header * of the current document. */ -PUBLIC CONST char * HText_getContentLocation NOARGS +PUBLIC char * HText_getContentLocation NOARGS { return(HTMainText ? - HTAnchor_content_location(HTMainText->node_anchor) : 0); + (char *)HTAnchor_content_location(HTMainText->node_anchor) : NULL); } PUBLIC void HTuncache_current_document NOARGS @@ -5393,24 +5303,28 @@ PUBLIC void HTuncache_current_document NOARGS FREE(htmain_anchor->UCStages); } } - CTRACE(tfp, "\rHTuncache.. freeing document for '%s'%s\n", + if (TRACE) { + fprintf(stderr, "\rHTuncache.. freeing document for '%s'%s\n", ((htmain_anchor && htmain_anchor->address) ? htmain_anchor->address : "unknown anchor"), ((htmain_anchor && htmain_anchor->post_data) ? " with POST data" : "")); + } HTList_removeObject(loaded_texts, HTMainText); HText_free(HTMainText); HTMainText = NULL; } else { - CTRACE(tfp, "HTuncache.. HTMainText already is NULL!\n"); + if (TRACE) { + fprintf(stderr, "HTuncache.. HTMainText already is NULL!\n"); + } } } PUBLIC int HTisDocumentSource NOARGS { - return (HTMainText != 0) ? HTMainText->source : FALSE; + return(HTMainText->source); } PUBLIC char * HTLoadedDocumentURL NOARGS @@ -5547,7 +5461,7 @@ PRIVATE int HText_TrueLineSize ARGS3( (!(text && text->T.output_utf8) || (unsigned char)line->data[i] < 128 || ((unsigned char)(line->data[i] & 0xc0) == 0xc0)) && - !isspace((unsigned char)line->data[i]) && + !isspace((unsigned char)line->data[i]) && (unsigned char)line->data[i] != HT_NON_BREAK_SPACE && (unsigned char)line->data[i] != HT_EM_SPACE) { true_size++; @@ -5659,7 +5573,7 @@ PUBLIC void HText_setTabID ARGS2( } else { while (NULL != (Tab = (HTTabID *)HTList_nextObject(cur))) { if (Tab->name && !strcmp(Tab->name, name)) - return; /* Already set. Keep the first value. */ + return; /* Already set. Keep the first value. */ last = cur; } if (last) @@ -5687,7 +5601,7 @@ PUBLIC int HText_getTabIDColumn ARGS2( if (text && name && *name && cur) { while (NULL != (Tab = (HTTabID *)HTList_nextObject(cur))) { if (Tab->name && !strcmp(Tab->name, name)) - break; + break; } if (Tab) column = Tab->column; @@ -5841,9 +5755,11 @@ PUBLIC void HText_beginForm ARGS5( * convert to lowercase and collapse spaces. - kw */ if (accept_cs != NULL) { + int i; StrAllocCopy(HTFormAcceptCharset, accept_cs); - LYRemoveBlanks(HTFormAcceptCharset); - LYLowerCase(HTFormAcceptCharset); + collapse_spaces(HTFormAcceptCharset); + for (i = 0; HTFormAcceptCharset[i]; i++) + HTFormAcceptCharset[i] = TOLOWER(HTFormAcceptCharset[i]); } /* @@ -5863,7 +5779,9 @@ PUBLIC void HText_beginForm ARGS5( PerFormInfo_free(HTCurrentForm); /* shouldn't happen here - kw */ HTCurrentForm = newform; - CTRACE(tfp, "BeginForm: action:%s Method:%d%s%s%s%s%s%s\n", + if (TRACE) + fprintf(stderr, + "BeginForm: action:%s Method:%d%s%s%s%s%s%s\n", HTFormAction, HTFormMethod, (HTFormTitle ? " Title:" : ""), (HTFormTitle ? HTFormTitle : ""), @@ -5887,7 +5805,7 @@ PUBLIC void HText_endForm ARGS1( */ while (a) { if (a->link_type == INPUT_ANCHOR && - a->input_field->number == HTFormNumber && + a->input_field->number == HTFormNumber && a->input_field->type == F_TEXT_TYPE) { /* * Got it. Make it submitting. - FM @@ -5906,7 +5824,7 @@ PUBLIC void HText_endForm ARGS1( break; } if (a == text->last_anchor) - break; + break; a = a->next; } } @@ -5928,7 +5846,8 @@ PUBLIC void HText_endForm ARGS1( HTList_appendObject(text->forms, HTCurrentForm); HTCurrentForm = NULL; } else { - CTRACE(tfp, "endForm: HTCurrentForm is missing!\n"); + if (TRACE) + fprintf(stderr, "endForm: HTCurrentForm is missing!\n"); } FREE(HTCurSelectGroup); @@ -5970,16 +5889,18 @@ PUBLIC void HText_beginSelect ARGS4( */ StrAllocCopy(HTCurSelectGroupSize, size); - CTRACE(tfp,"HText_beginSelect: name=%s type=%d size=%s\n", + if (TRACE) { + fprintf(stderr,"HText_beginSelect: name=%s type=%d size=%s\n", ((HTCurSelectGroup == NULL) ? "<NULL>" : HTCurSelectGroup), HTCurSelectGroupType, ((HTCurSelectGroupSize == NULL) ? "<NULL>" : HTCurSelectGroupSize)); - CTRACE(tfp,"HText_beginSelect: name_cs=%d \"%s\"\n", + fprintf(stderr,"HText_beginSelect: name_cs=%d \"%s\"\n", HTCurSelectGroupCharset, (HTCurSelectGroupCharset >= 0 ? LYCharSet_UC[HTCurSelectGroupCharset].MIMEname : "<UNKNOWN>")); + } } /* @@ -6004,7 +5925,8 @@ PUBLIC int HText_getOptionNum ARGS1( for (op = a->input_field->select_list; op; op = op->next) n++; - CTRACE(tfp, "HText_getOptionNum: Got number '%d'.\n", n); + if (TRACE) + fprintf(stderr, "HText_getOptionNum: Got number '%d'.\n", n); return(n); } @@ -6035,13 +5957,13 @@ PRIVATE char * HText_skipOptionNumPrefix ARGS1( if ((cp && *cp && *cp++ == '(') && *cp && isdigit(*cp++)) { while (*cp && isdigit(*cp)) - ++cp; + ++cp; if (*cp && *cp++ == ')') { int i = (cp - opname); while (i < 5) { if (*cp != '_') - break; + break; i++; cp++; } @@ -6049,7 +5971,7 @@ PRIVATE char * HText_skipOptionNumPrefix ARGS1( cp = opname; } } else { - cp = opname; + cp = opname; } } else { cp = opname; @@ -6081,12 +6003,16 @@ PUBLIC char * HText_setLastOptionValue ARGS7( if (!(text && text->last_anchor && text->last_anchor->link_type == INPUT_ANCHOR)) { - CTRACE(tfp, "HText_setLastOptionValue: invalid call! value:%s!\n", + if (TRACE) + fprintf(stderr, + "HText_setLastOptionValue: invalid call! value:%s!\n", (value ? value : "<NULL>")); return NULL; } - CTRACE(tfp, "Entering HText_setLastOptionValue: value:%s, checked:%s\n", + if (TRACE) + fprintf(stderr, + "Entering HText_setLastOptionValue: value:%s, checked:%s\n", value, (checked ? "on" : "off")); /* @@ -6164,17 +6090,21 @@ PUBLIC char * HText_setLastOptionValue ARGS7( * No option items yet. */ if (text->last_anchor->input_field->type != F_OPTION_LIST_TYPE) { - CTRACE(tfp, "HText_setLastOptionValue: last input_field not F_OPTION_LIST_TYPE (%d)\n", + if (TRACE) { + fprintf(stderr, + "HText_setLastOptionValue: last input_field not F_OPTION_LIST_TYPE (%d)\n", F_OPTION_LIST_TYPE); - CTRACE(tfp, " but %d, ignoring!\n", + fprintf(stderr, + " but %d, ignoring!\n", text->last_anchor->input_field->type); + } return NULL; } new_ptr = text->last_anchor->input_field->select_list = (OptionType *)calloc(1, sizeof(OptionType)); if (new_ptr == NULL) - outofmem(__FILE__, "HText_setLastOptionValue"); + outofmem(__FILE__, "HText_setLastOptionValue"); first_option = TRUE; } else { @@ -6187,7 +6117,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7( op_ptr->next = new_ptr = (OptionType *)calloc(1, sizeof(OptionType)); if (new_ptr == NULL) - outofmem(__FILE__, "HText_setLastOptionValue"); + outofmem(__FILE__, "HText_setLastOptionValue"); } new_ptr->name = NULL; @@ -6195,7 +6125,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7( new_ptr->next = NULL; for (i = 0, j = 0; cp[i]; i++) { if (cp[i] == HT_NON_BREAK_SPACE || - cp[i] == HT_EM_SPACE) { + cp[i] == HT_EM_SPACE) { cp[j++] = ' '; } else if (cp[i] != LY_SOFT_HYPHEN && !IsSpecialAttrChar((unsigned char)cp[i])) { @@ -6205,7 +6135,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7( cp[j] = '\0'; if (HTCJK != NOCJK) { if (cp && - (tmp = (unsigned char *)calloc(1, strlen(cp)+1))) { + (tmp = (unsigned char *)calloc(1, strlen(cp)+1))) { if (kanji_code == EUC) { TO_EUC((unsigned char *)cp, tmp); val_cs = current_char_set; @@ -6214,7 +6144,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7( val_cs = current_char_set; } else { for (i = 0, j = 0; cp[i]; i++) { - if (cp[i] != '\033') { + if (cp[i] != '\033') { tmp[j++] = cp[i]; } } @@ -6299,24 +6229,24 @@ PUBLIC char * HText_setLastOptionValue ARGS7( } if (TRACE) { - fprintf(tfp,"HText_setLastOptionValue:%s value=%s", + fprintf(stderr,"HText_setLastOptionValue:%s value=%s", (order == LAST_ORDER) ? " LAST_ORDER" : "", value); - fprintf(tfp," val_cs=%d \"%s\"", + fprintf(stderr," val_cs=%d \"%s\"", val_cs, (val_cs >= 0 ? LYCharSet_UC[val_cs].MIMEname : "<UNKNOWN>")); if (submit_value) { - fprintf(tfp, " (submit_val_cs %d \"%s\") submit_value%s=%s\n", + fprintf(stderr, " (submit_val_cs %d \"%s\") submit_value%s=%s\n", submit_val_cs, (submit_val_cs >= 0 ? LYCharSet_UC[submit_val_cs].MIMEname : "<UNKNOWN>"), (HTCurSelectGroupType == F_CHECKBOX_TYPE) ? - "(ignored)" : "", + "(ignored)" : "", submit_value); } else { - fprintf(tfp,"\n"); + fprintf(stderr,"\n"); } } return(ret_Value); @@ -6340,12 +6270,8 @@ PUBLIC int HText_beginInput ARGS3( unsigned char *tmp = NULL; int i, j; - CTRACE(tfp,"Entering HText_beginInput\n"); - -#ifdef DISP_PARTIAL - if (display_partial) - detected_forms_input_partial = TRUE; /* trimHightext temp fix */ -#endif + if (TRACE) + fprintf(stderr,"Entering HText_beginInput\n"); if (a == NULL || f == NULL) outofmem(__FILE__, "HText_beginInput"); @@ -6375,7 +6301,7 @@ PUBLIC int HText_beginInput ARGS3( TextAnchor * b = text->first_anchor; int i2 = 0; while (b) { - if (b->link_type == INPUT_ANCHOR && + if (b->link_type == INPUT_ANCHOR && b->input_field->type == F_RADIO_TYPE && b->input_field->number == HTFormNumber) { if (!strcmp(b->input_field->name, I->name)) { @@ -6437,7 +6363,7 @@ PUBLIC int HText_beginInput ARGS3( } else { for (i = 0, j = 0; IValue[i]; i++) { if (IValue[i] != '\033') { - tmp[j++] = IValue[i]; + tmp[j++] = IValue[i]; } } } @@ -6563,7 +6489,8 @@ PUBLIC int HText_beginInput ARGS3( /* * Error! NAME must be present. */ - CTRACE(tfp, + if (TRACE) + fprintf(stderr, "GridText: No name present in input field; not displaying\n"); FREE(a); FREE(f); @@ -6668,8 +6595,9 @@ PUBLIC int HText_beginInput ARGS3( */ if (I->accept_cs) { StrAllocCopy(f->accept_cs, I->accept_cs); - LYRemoveBlanks(f->accept_cs); - LYLowerCase(f->accept_cs); + collapse_spaces(f->accept_cs); + for (i = 0; f->accept_cs[i]; i++) + f->accept_cs[i] = TOLOWER(f->accept_cs[i]); } /* @@ -6743,9 +6671,9 @@ PUBLIC int HText_beginInput ARGS3( * account as well. - FM */ if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) - MaximumSize -= ((a->number/10) + 3); + MaximumSize -= ((a->number/10) + 3); if (f->size > MaximumSize) - f->size = MaximumSize; + f->size = MaximumSize; /* * Save value for submit/reset buttons so they @@ -6789,27 +6717,30 @@ PUBLIC int HText_beginInput ARGS3( text->forms = HTList_new(); } } else { - CTRACE(tfp, "beginInput: HTCurrentForm is missing!\n"); + if (TRACE) + fprintf(stderr, "beginInput: HTCurrentForm is missing!\n"); } - CTRACE(tfp, "Input link: name=%s\nvalue=%s\nsize=%d\n", + if (TRACE) { + fprintf(stderr,"Input link: name=%s\nvalue=%s\nsize=%d\n", f->name, ((f->value != NULL) ? f->value : ""), f->size); - CTRACE(tfp, "Input link: name_cs=%d \"%s\" (from %d \"%s\")\n", + fprintf(stderr,"Input link: name_cs=%d \"%s\" (from %d \"%s\")\n", f->name_cs, (f->name_cs >= 0 ? LYCharSet_UC[f->name_cs].MIMEname : "<UNKNOWN>"), I->name_cs, (I->name_cs >= 0 ? LYCharSet_UC[I->name_cs].MIMEname : "<UNKNOWN>")); - CTRACE(tfp, " value_cs=%d \"%s\" (from %d \"%s\")\n", + fprintf(stderr," value_cs=%d \"%s\" (from %d \"%s\")\n", f->value_cs, (f->value_cs >= 0 ? LYCharSet_UC[f->value_cs].MIMEname : "<UNKNOWN>"), I->value_cs, (I->value_cs >= 0 ? LYCharSet_UC[I->value_cs].MIMEname : "<UNKNOWN>")); + } /* * Return the SIZE of the input field. @@ -6957,10 +6888,14 @@ PUBLIC void HText_SubmitForm ARGS4( thisform = HTList_objectAt(HTMainText->forms, form_number - 1); /* Sanity check */ if (!thisform) { - CTRACE(tfp, "SubmitForm: form %d not in HTMainText's list!\n", + if (TRACE) + fprintf(stderr, + "SubmitForm: form %d not in HTMainText's list!\n", form_number); } else if (thisform->number != form_number) { - CTRACE(tfp, "SubmitForm: failed sanity check, %d!=%d !\n", + if (TRACE) + fprintf(stderr, + "SubmitForm: failed sanity check, %d!=%d !\n", thisform->number, form_number); thisform = NULL; } @@ -7050,12 +6985,13 @@ PUBLIC void HText_SubmitForm ARGS4( if (target_cs >= 0) { target_csname = HTMainText->node_anchor->charset; } else { - target_cs = UCLYhndl_for_unspec; /* always >= 0 */ - target_csname = LYCharSet_UC[target_cs].MIMEname; + target_cs = UCLYhndl_for_unspec; + if (target_cs >= 0) + target_csname = LYCharSet_UC[target_cs].MIMEname; } } if (target_cs < 0) { - target_cs = UCLYhndl_for_unspec; /* always >= 0 */ + target_cs = UCLYhndl_for_unspec; } /* @@ -7071,22 +7007,22 @@ PUBLIC void HText_SubmitForm ARGS4( char *p; char * val; - form_ptr = anchor_ptr->input_field; + form_ptr = anchor_ptr->input_field; val = form_ptr->cp_submit_value != NULL ? - form_ptr->cp_submit_value : form_ptr->value; + form_ptr->cp_submit_value : form_ptr->value; field_has_8bit = NO; field_has_special = NO; - len += (strlen(form_ptr->name) + (Boundary ? 100 : 10)); + len += (strlen(form_ptr->name) + (Boundary ? 100 : 10)); /* * Calculate by the option submit value if present. */ if (form_ptr->cp_submit_value != NULL) { len += (strlen(form_ptr->cp_submit_value) + 10); } else { - len += (strlen(form_ptr->value) + 10); + len += (strlen(form_ptr->value) + 10); } - len += 32; /* plus and ampersand + safety net */ + len += 32; /* plus and ampersand + safety net */ for (p = val; p && *p && !(field_has_8bit && field_has_special); @@ -7154,7 +7090,7 @@ PUBLIC void HText_SubmitForm ARGS4( } } else if (anchor_ptr->input_field->number > form_number) { - break; + break; } } @@ -7277,30 +7213,33 @@ PUBLIC void HText_SubmitForm ARGS4( textarea_lineno = 0; switch(form_ptr->type) { - case F_RESET_TYPE: + case F_RESET_TYPE: break; - case F_SUBMIT_TYPE: - case F_TEXT_SUBMIT_TYPE: - case F_IMAGE_SUBMIT_TYPE: + case F_SUBMIT_TYPE: + case F_TEXT_SUBMIT_TYPE: + case F_IMAGE_SUBMIT_TYPE: if (!(form_ptr->name && *form_ptr->name != '\0' && !strcmp(form_ptr->name, link_name))) { - CTRACE(tfp, + if (TRACE) { + fprintf(stderr, "SubmitForm: skipping submit field with "); - CTRACE(tfp, "name \"%s\" for link_name \"%s\", %s.\n", + fprintf(stderr, + "name \"%s\" for link_name \"%s\", %s.", form_ptr->name ? form_ptr->name : "???", link_name ? link_name : "???", (form_ptr->name && *form_ptr->name) ? "not current link" : "no field name"); + } break; } if (!(form_ptr->type == F_TEXT_SUBMIT_TYPE || (form_ptr->value && *form_ptr->value != '\0' && !strcmp(form_ptr->value, link_value)))) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "SubmitForm: skipping submit field with "); - fprintf(tfp, - "name \"%s\" for link_name \"%s\", %s!\n", + fprintf(stderr, + "name \"%s\" for link_name \"%s\", %s!", form_ptr->name ? form_ptr->name : "???", link_name ? link_name : "???", "values are different"); @@ -7308,11 +7247,11 @@ PUBLIC void HText_SubmitForm ARGS4( break; } /* fall through */ - case F_RADIO_TYPE: + case F_RADIO_TYPE: case F_CHECKBOX_TYPE: case F_TEXTAREA_TYPE: case F_PASSWORD_TYPE: - case F_TEXT_TYPE: + case F_TEXT_TYPE: case F_OPTION_LIST_TYPE: case F_HIDDEN_TYPE: /* @@ -7349,7 +7288,9 @@ PUBLIC void HText_SubmitForm ARGS4( success = LYUCTranslateBackFormData(&copied_val_used, form_ptr->value_cs, target_cs, PlainText); - CTRACE(tfp, "SubmitForm: field \"%s\" %d %s -> %d %s %s\n", + if (TRACE) { + fprintf(stderr, + "SubmitForm: field \"%s\" %d %s -> %d %s %s\n", form_ptr->name ? form_ptr->name : "", form_ptr->value_cs, form_ptr->value_cs >= 0 ? @@ -7358,14 +7299,18 @@ PUBLIC void HText_SubmitForm ARGS4( target_cs, target_csname ? target_csname : "???", success ? "OK" : "FAILED"); + } if (success) { val_used = copied_val_used; } } else { /* We can use the value directly. */ - CTRACE(tfp, "SubmitForm: field \"%s\" %d %s OK\n", + if (TRACE) { + fprintf(stderr, + "SubmitForm: field \"%s\" %d %s OK\n", form_ptr->name ? form_ptr->name : "", target_cs, target_csname ? target_csname : "???"); + } success = YES; } if (!success) { @@ -7439,7 +7384,9 @@ PUBLIC void HText_SubmitForm ARGS4( success = LYUCTranslateBackFormData(&copied_name_used, form_ptr->name_cs, target_cs, PlainText); - CTRACE(tfp, "SubmitForm: name \"%s\" %d %s -> %d %s %s\n", + if (TRACE) { + fprintf(stderr, + "SubmitForm: name \"%s\" %d %s -> %d %s %s\n", form_ptr->name ? form_ptr->name : "", form_ptr->name_cs, form_ptr->name_cs >= 0 ? @@ -7448,6 +7395,7 @@ PUBLIC void HText_SubmitForm ARGS4( target_cs, target_csname ? target_csname : "???", success ? "OK" : "FAILED"); + } if (success) { name_used = copied_name_used; } @@ -7461,10 +7409,13 @@ PUBLIC void HText_SubmitForm ARGS4( } } } else { /* We can use the name directly. */ - CTRACE(tfp, "SubmitForm: name \"%s\" %d %s OK\n", + if (TRACE) { + fprintf(stderr, + "SubmitForm: name \"%s\" %d %s OK\n", form_ptr->name ? form_ptr->name : "", target_cs, target_csname ? target_csname : "???"); + } success = YES; if (Boundary) { StrAllocCopy(copied_name_used, name_used); @@ -7498,7 +7449,8 @@ PUBLIC void HText_SubmitForm ARGS4( break; default: - CTRACE(tfp, "SubmitForm: What type is %d?\n", + if (TRACE) + fprintf(stderr, "SubmitForm: What type is %d?\n", form_ptr->type); } @@ -7833,9 +7785,9 @@ PUBLIC void HText_SubmitForm ARGS4( FREE(copied_name_used); FREE(copied_val_used); break; - } + } } else if (anchor_ptr->input_field->number > form_number) { - break; + break; } } @@ -7851,16 +7803,19 @@ PUBLIC void HText_SubmitForm ARGS4( FREE(previous_blanks); if (submit_item->submit_method == URL_MAIL_METHOD) { - HTUserMsg2("Submitting %s", submit_item->submit_action); - CTRACE(tfp, "\nGridText - mailto_address: %s\n", + _user_message("Submitting %s", submit_item->submit_action); + if (TRACE) { + fprintf(stderr, "\nGridText - mailto_address: %s\n", (submit_item->submit_action+7)); - CTRACE(tfp, "GridText - mailto_subject: %s\n", + fprintf(stderr, "GridText - mailto_subject: %s\n", ((submit_item->submit_title && *submit_item->submit_title) ? (submit_item->submit_title) : (HText_getTitle() ? - HText_getTitle() : ""))); - CTRACE(tfp,"GridText - mailto_content: %s\n",query); + HText_getTitle() : ""))); + fprintf(stderr,"GridText - mailto_content: %s\n",query); + } + sleep(MessageSecs); mailform((submit_item->submit_action+7), ((submit_item->submit_title && *submit_item->submit_title) ? @@ -7878,7 +7833,8 @@ PUBLIC void HText_SubmitForm ARGS4( if (submit_item->submit_method == URL_POST_METHOD || Boundary) { StrAllocCopy(doc->post_data, query); - CTRACE(tfp,"GridText - post_data: %s\n",doc->post_data); + if (TRACE) + fprintf(stderr,"GridText - post_data: %s\n",doc->post_data); StrAllocCopy(doc->address, submit_item->submit_action); FREE(query); return; @@ -7941,9 +7897,9 @@ PUBLIC void HText_ResetForm ARGS1( anchor_ptr->input_field->type == F_CHECKBOX_TYPE) { if (anchor_ptr->input_field->orig_value[0] == '0') - anchor_ptr->input_field->num_value = 0; + anchor_ptr->input_field->num_value = 0; else - anchor_ptr->input_field->num_value = 1; + anchor_ptr->input_field->num_value = 1; } else if (anchor_ptr->input_field->type == F_OPTION_LIST_TYPE) { @@ -7953,7 +7909,7 @@ PUBLIC void HText_ResetForm ARGS1( anchor_ptr->input_field->cp_submit_value = anchor_ptr->input_field->orig_submit_value; - } else { + } else { StrAllocCopy(anchor_ptr->input_field->value, anchor_ptr->input_field->orig_value); } @@ -7987,13 +7943,13 @@ PUBLIC void HText_activateRadioButton ARGS1( if (anchor_ptr->input_field->number == form_number) { /* if it has the same name and its on */ - if (!strcmp(anchor_ptr->input_field->name, form->name) && + if (!strcmp(anchor_ptr->input_field->name, form->name) && anchor_ptr->input_field->num_value) { anchor_ptr->input_field->num_value = 0; break; - } + } } else if (anchor_ptr->input_field->number > form_number) { - break; + break; } } @@ -8192,7 +8148,7 @@ PUBLIC void HText_setBreakPoint ARGS1( /* * Can split here. - FM */ - text->permissible_split = text->last_line->size; + text->permissible_split = (int)text->last_line->size; return; } diff --git a/src/GridText.h b/src/GridText.h index a99f66da..265cadd7 100644 --- a/src/GridText.h +++ b/src/GridText.h @@ -10,12 +10,6 @@ #include <HTForms.h> #endif /* HTFORMS_H */ -#ifndef HT_NON_BREAK_SPACE -#define HT_NON_BREAK_SPACE ((char)1) /* remember it */ -#endif /* !HT_NON_BREAK_SPACE */ -#ifndef HT_EM_SPACE -#define HT_EM_SPACE ((char)2) /* remember it */ -#endif /* !HT_EM_SPACE */ #define LY_UNDERLINE_START_CHAR '\003' #define LY_UNDERLINE_END_CHAR '\004' #define LY_BOLD_START_CHAR '\005' @@ -23,46 +17,7 @@ #ifndef LY_SOFT_HYPHEN #define LY_SOFT_HYPHEN ((char)7) #endif /* !LY_SOFT_HYPHEN */ -#define LY_SOFT_NEWLINE ((char)8) - -#define IsSpecialAttrChar(a) ((a > '\002') && (a <= '\010')) - -/* just for information: -US-ASCII control characters <32 which are not defined in Unicode standard -=00 U+0000 NULL -=01 U+0001 START OF HEADING -=02 U+0002 START OF TEXT -=03 U+0003 END OF TEXT -=04 U+0004 END OF TRANSMISSION -=05 U+0005 ENQUIRY -=06 U+0006 ACKNOWLEDGE -=07 U+0007 BELL -=08 U+0008 BACKSPACE -=09 U+0009 HORIZONTAL TABULATION -=0A U+000A LINE FEED -=0B U+000B VERTICAL TABULATION -=0C U+000C FORM FEED -=0D U+000D CARRIAGE RETURN -=0E U+000E SHIFT OUT -=0F U+000F SHIFT IN -=10 U+0010 DATA LINK ESCAPE -=11 U+0011 DEVICE CONTROL ONE -=12 U+0012 DEVICE CONTROL TWO -=13 U+0013 DEVICE CONTROL THREE -=14 U+0014 DEVICE CONTROL FOUR -=15 U+0015 NEGATIVE ACKNOWLEDGE -=16 U+0016 SYNCHRONOUS IDLE -=17 U+0017 END OF TRANSMISSION BLOCK -=18 U+0018 CANCEL -=19 U+0019 END OF MEDIUM -=1A U+001A SUBSTITUTE -=1B U+001B ESCAPE -=1C U+001C FILE SEPARATOR -=1D U+001D GROUP SEPARATOR -=1E U+001E RECORD SEPARATOR -=1F U+001F UNIT SEPARATOR -=7F U+007F DELETE -*/ +#define IsSpecialAttrChar(a) ((a > '\002') && (a < '\010')) extern int HTCurSelectGroupType; extern char * HTCurSelectGroupSize; @@ -83,6 +38,9 @@ extern HTParentAnchor * HTMainAnchor; /* Anchor for HTMainText */ #endif /* SHORT_NAMES */ extern int WWW_TraceFlag; +extern int HTCacheSize; + +extern BOOLEAN mustshow; #if defined(VMS) && defined(VAXC) && !defined(__DECC) extern int HTVirtualMemorySize; @@ -113,23 +71,23 @@ extern void HText_setIgnoreExcess PARAMS((HText *text, BOOL ignore)); extern int HText_sourceAnchors PARAMS((HText * text)); extern void HText_setStale PARAMS((HText * text)); extern void HText_refresh PARAMS((HText * text)); -extern CONST char * HText_getTitle NOPARAMS; -extern CONST char * HText_getSugFname NOPARAMS; +extern char * HText_getTitle NOPARAMS; +extern char * HText_getSugFname NOPARAMS; extern void HTCheckFnameForCompression PARAMS(( char ** fname, HTParentAnchor * anchor, BOOLEAN strip_ok)); -extern CONST char * HText_getLastModified NOPARAMS; -extern CONST char * HText_getDate NOPARAMS; -extern CONST char * HText_getServer NOPARAMS; -extern CONST char * HText_getOwner NOPARAMS; -extern CONST char * HText_getContentBase NOPARAMS; -extern CONST char * HText_getContentLocation NOPARAMS; -extern CONST char * HText_getRevTitle NOPARAMS; +extern char * HText_getLastModified NOPARAMS; +extern char * HText_getDate NOPARAMS; +extern char * HText_getServer NOPARAMS; +extern char * HText_getOwner NOPARAMS; +extern char * HText_getContentBase NOPARAMS; +extern char * HText_getContentLocation NOPARAMS; #ifdef USE_HASH -extern CONST char * HText_getStyle NOPARAMS; +extern char * HText_getStyle NOPARAMS; #endif extern void HText_setMainTextOwner PARAMS((CONST char * owner)); +extern char * HText_getRevTitle NOPARAMS; extern void print_wwwfile_to_fd PARAMS((FILE * fp, int is_reply)); extern BOOL HText_select PARAMS((HText *text)); extern BOOL HText_POSTReplyLoaded PARAMS((document *doc)); @@ -200,9 +158,6 @@ extern int HText_beginInput PARAMS(( HText * text, BOOL underline, InputFieldData *I)); -extern void HText_trimHightext PARAMS(( - HText * text, - BOOLEAN disable_trace)); extern void HText_SubmitForm PARAMS(( FormInfo * submit_item, document * doc, diff --git a/src/HTAlert.c b/src/HTAlert.c index c709361a..74d8d2b8 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -10,6 +10,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTAlert.h> #include <LYGlobalDefs.h> #include <LYCurses.h> @@ -21,58 +22,27 @@ #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + + /* Issue a message about a problem. HTAlert() ** -------------------------------- */ PUBLIC void HTAlert ARGS1( CONST char *, Msg) { - CTRACE(tfp, "\nAlert!: %s\n\n", Msg); - CTRACE_FLUSH(tfp); - _user_message("Alert!: %s", Msg); + if (TRACE) { + fprintf(stderr, "\nAlert!: %s", Msg); + fflush(stderr); + _user_message("Alert!: %s", Msg); + fprintf(stderr, "\n\n"); + fflush(stderr); + } else + _user_message("Alert!: %s", Msg); sleep(AlertSecs); } -/* Issue an informational message. HTInfoMsg() -** -------------------------------- -*/ -PUBLIC void HTInfoMsg ARGS1( - CONST char *, Msg) -{ - _statusline(Msg); - if (Msg && *Msg) { - CTRACE(tfp, "Info message: %s\n", Msg); - sleep(InfoSecs); - } -} - -/* Issue an important message. HTUserMsg() -** -------------------------------- -*/ -PUBLIC void HTUserMsg ARGS1( - CONST char *, Msg) -{ - _statusline(Msg); - if (Msg && *Msg) { - CTRACE(tfp, "User message: %s\n", Msg); - sleep(MessageSecs); - } -} - -PUBLIC void HTUserMsg2 ARGS2( - CONST char *, Msg2, - CONST char *, Arg) -{ - _user_message(Msg2, Arg); - if (Msg2 && *Msg2) { - CTRACE(tfp, "User message: "); - CTRACE(tfp, Msg2, Arg); - CTRACE(tfp, "\n"); - sleep(MessageSecs); - } -} - /* Issue a progress message. HTProgress() ** ------------------------- */ @@ -80,69 +50,9 @@ PUBLIC void HTProgress ARGS1( CONST char *, Msg) { if (TRACE) - fprintf(tfp, "%s\n", Msg); + fprintf(stderr, "%s\n", Msg); else - statusline(Msg); -} - -/* Issue a read-progress message. HTReadProgress() -** ------------------------------ -*/ -PUBLIC void HTReadProgress ARGS2( - long, bytes, - long, total) -{ - static long kb_units = 1024; - static time_t first, last; - static long bytes_last; - long transfer_rate, divisor; - char line[80]; - time_t now = time((time_t *)0); /* once per second */ - char *units = "bytes"; - - if (bytes == 0) { - first = last = now; - bytes_last = bytes; - } else if ((bytes > 0) && - (now != first)) - /* 1 sec delay for transfer_rate calculation :-( */ { - transfer_rate = (bytes) / (now - first); /* bytes/sec */ - - /* optimal refresh time: every 0.2 sec */ - if ((bytes - bytes_last) > (transfer_rate / 5)) { - - bytes_last += (transfer_rate / 5); /* until we got next second */ - - if (now != last) { - last = now; - bytes_last = bytes; - } - units = "bytes"; - divisor = 1; - if (LYshow_kb_rate - && (total >= kb_units || bytes >= kb_units)) { - units = "KB"; - divisor = kb_units; - bytes /= divisor; - if (total > 0) total /= divisor; - } - - if (total > 0) - sprintf (line, "Read %ld of %ld %s of data", bytes, total, units); - else - sprintf (line, "Read %ld %s of data", bytes, units); - if ((transfer_rate > 0) - && (!LYshow_kb_rate || (bytes * divisor >= kb_units))) - sprintf (line + strlen(line), ", %ld %s/sec.", transfer_rate / divisor, units); - else - sprintf (line + strlen(line), "."); - if (total < 0) { - if (total < -1) - strcat(line, " (Press 'z' to abort)"); - } - HTProgress(line); - } - } + statusline(Msg); } PRIVATE BOOL conf_cancelled = NO; /* used by HTConfirm only - kw */ @@ -170,9 +80,9 @@ PUBLIC BOOL HTConfirm ARGS1(CONST char *, Msg) #ifdef VMS extern BOOLEAN HadVMSInterrupt; #endif /* VMS */ - + _user_message("%s (y/n) ", Msg); - + while (1) { c = LYgetch(); #ifdef VMS @@ -205,11 +115,11 @@ PUBLIC char * HTPrompt ARGS2( Tmp[199] = '\0'; _statusline(Msg); - if (deflt) - strncpy(Tmp, deflt, 199); + if (deflt) + strncpy(Tmp, deflt, 199); if (!dump_output_immediately) - LYgetstr(Tmp, VISIBLE, sizeof(Tmp), NORECALL); + LYgetstr(Tmp, VISIBLE, sizeof(Tmp), NORECALL); StrAllocCopy(rep, Tmp); @@ -229,37 +139,37 @@ PUBLIC char * HTPromptPassword ARGS1( pw[0] = '\0'; if (!dump_output_immediately) { - _statusline(Msg ? Msg : PASSWORD_PROMPT); - LYgetstr(pw, HIDDEN, sizeof(pw), NORECALL); /* hidden */ - StrAllocCopy(result, pw); + _statusline(Msg ? Msg : PASSWORD_PROMPT); + LYgetstr(pw, HIDDEN, sizeof(pw), NORECALL); /* hidden */ + StrAllocCopy(result, pw); } else { - printf("\n%s\n", PASSWORD_REQUIRED); + printf("\n%s\n", PASSWORD_REQUIRED); StrAllocCopy(result, ""); } return result; } -/* Prompt both username and password. HTPromptUsernameAndPassword() -** ---------------------------------- +/* Prompt both username and password. HTPromptUsernameAndPassword() +** ---------------------------------- ** ** On entry, -** Msg is the prompting message. -** *username and -** *password are char pointers which contain default +** Msg is the prompting message. +** *username and +** *password are char pointers which contain default ** or zero-length strings; they are changed -** to point to result strings. -** IsProxy should be TRUE if this is for +** to point to result strings. +** IsProxy should be TRUE if this is for ** proxy authentication. ** -** If *username is not NULL, it is taken -** to point to a default value. -** Initial value of *password is -** completely discarded. +** If *username is not NULL, it is taken +** to point to a default value. +** Initial value of *password is +** completely discarded. ** ** On exit, -** *username and *password point to newly allocated -** strings -- original strings pointed to by them -** are NOT freed. +** *username and *password point to newly allocated +** strings -- original strings pointed to by them +** are NOT freed. ** */ PUBLIC void HTPromptUsernameAndPassword ARGS4( @@ -272,12 +182,12 @@ PUBLIC void HTPromptUsernameAndPassword ARGS4( authentication_info[0] && authentication_info[1]) || (IsProxy == TRUE && proxyauth_info[0] && proxyauth_info[1])) { - /* + /* ** The -auth or -pauth parameter gave us both the username ** and password to use for the first realm or proxy server, ** respectively, so just use them without any prompting. - FM */ - StrAllocCopy(*username, (IsProxy ? + StrAllocCopy(*username, (IsProxy ? proxyauth_info[0] : authentication_info[0])); if (IsProxy) { FREE(proxyauth_info[0]); @@ -292,15 +202,15 @@ PUBLIC void HTPromptUsernameAndPassword ARGS4( FREE(authentication_info[1]); } } else if (dump_output_immediately) { - /* + /* * We are not interactive and don't have both the * username and password from the command line, * but might have one or the other. - FM */ - if ((IsProxy == FALSE && authentication_info[0]) || + if ((IsProxy == FALSE && authentication_info[0]) || (IsProxy == TRUE && proxyauth_info[0])) { /* - ** Use the command line username. - FM + ** Use the command line username. - FM */ StrAllocCopy(*username, (IsProxy ? proxyauth_info[0] : authentication_info[0])); @@ -311,14 +221,14 @@ PUBLIC void HTPromptUsernameAndPassword ARGS4( } } else { /* - ** Default to "WWWuser". - FM + ** Default to "WWWuser". - FM */ - StrAllocCopy(*username, "WWWuser"); + StrAllocCopy(*username, "WWWuser"); } - if ((IsProxy == FALSE && authentication_info[1]) || + if ((IsProxy == FALSE && authentication_info[1]) || (IsProxy == TRUE && proxyauth_info[1])) { /* - ** Use the command line password. - FM + ** Use the command line password. - FM */ StrAllocCopy(*password, (IsProxy ? proxyauth_info[1] : authentication_info[1])); @@ -329,23 +239,23 @@ PUBLIC void HTPromptUsernameAndPassword ARGS4( } } else { /* - ** Default to a zero-length string. - FM + ** Default to a zero-length string. - FM */ StrAllocCopy(*password, ""); } printf("\n%s\n", USERNAME_PASSWORD_REQUIRED); } else { - /* + /* * We are interactive and don't have both the * username and password from the command line, * but might have one or the other. - FM */ - if ((IsProxy == FALSE && authentication_info[0]) || + if ((IsProxy == FALSE && authentication_info[0]) || (IsProxy == TRUE && proxyauth_info[0])) { /* - ** Offer the command line username in the - ** prompt for the first realm. - FM + ** Offer the command line username in the + ** prompt for the first realm. - FM */ StrAllocCopy(*username, (IsProxy ? proxyauth_info[0] : authentication_info[0])); @@ -363,10 +273,10 @@ PUBLIC void HTPromptUsernameAndPassword ARGS4( } else { *username = HTPrompt(USERNAME_PROMPT, *username); } - if ((IsProxy == FALSE && authentication_info[1]) || + if ((IsProxy == FALSE && authentication_info[1]) || (IsProxy == TRUE && proxyauth_info[1])) { /* - ** Use the command line password for the first realm. - FM + ** Use the command line password for the first realm. - FM */ StrAllocCopy(*password, (IsProxy ? proxyauth_info[1] : authentication_info[1])); @@ -377,13 +287,13 @@ PUBLIC void HTPromptUsernameAndPassword ARGS4( } } else if (*username != NULL && *username[0] != '\0') { /* - ** We have a non-zero length username, - ** so prompt for the password. - FM + ** We have a non-zero length username, + ** so prompt for the password. - FM */ *password = HTPromptPassword(PASSWORD_PROMPT); } else { /* - ** Return a zero-length password. - FM + ** Return a zero-length password. - FM */ StrAllocCopy(*password, ""); } @@ -404,9 +314,11 @@ PUBLIC void HTPromptUsernameAndPassword ARGS4( ** Returns FALSE on cancel, ** TRUE if the cookie should be set. */ -PUBLIC BOOL HTConfirmCookie ARGS4( - void *, dp, +PUBLIC BOOL HTConfirmCookie ARGS6( + void *, dp, CONST char *, server, + CONST char *, domain, + CONST char *, path, CONST char *, name, CONST char *, value) { @@ -419,70 +331,57 @@ PUBLIC BOOL HTConfirmCookie ARGS4( #endif /* VMS */ if ((de = (domain_entry *)dp) == NULL) - return FALSE; - -#ifdef ENHANCED_COOKIES - /* If the user has specified a list of domains to allow or deny - ** from the config file, then they'll already have de->bv set to - ** ACCEPT_ALWAYS or REJECT_ALWAYS so we can relax and let the - ** default cookie handling code cope with this fine. I hope. - */ -#endif + return FALSE; + /* - ** If the user has specified a constant action, don't prompt at all. + ** If the user has specified a constant action, don't prompt at all. */ - if (de->bv == ACCEPT_ALWAYS || de->bv == FROM_FILE) - return TRUE; + if (de->bv == ACCEPT_ALWAYS) + return TRUE; if (de->bv == REJECT_ALWAYS) - return FALSE; + return FALSE; if (dump_output_immediately) { - /* + /* ** Non-interactive, can't respond. Use the LYSetCookies value * based on its compilation or configuration setting, or on the ** command line toggle. - FM */ - return LYSetCookies; + return LYSetCookies; } /* - ** Figure out how much of the cookie we can show. - ** The '37' is the length of ADVANCED_COOKIE_CONFIRMATION, - ** minus the length of the %s directives (10 chars) + ** Figure out how much of the cookie we can show. + ** The '37' is the length of ADVANCED_COOKIE_CONFIRMATION, + ** minus the length of the %s directives (10 chars) */ if (de != NULL) { - if (de->bv == ACCEPT_ALWAYS) + if (de->bv == ACCEPT_ALWAYS) return TRUE; - if (de->bv == REJECT_ALWAYS) + if (de->bv == REJECT_ALWAYS) return FALSE; } space_free = (((LYcols - 1) - 37) - strlen(server)); if (space_free < 0) - space_free = 0; + space_free = 0; namelen = strlen(name); valuelen = strlen(value); if ((namelen + valuelen) > space_free) { - /* + /* ** Argh... there isn't enough space on our single line for ** the whole cookie. Reduce them both by a percentage. ** This should be smarter. */ - float percentage; - percentage = (float)space_free/(float)(namelen + valuelen); - namelen = (int)(percentage*(float)namelen); - valuelen = (int)(percentage*(float)valuelen); - } - if(!LYAcceptAllCookies) { - sprintf(message, ADVANCED_COOKIE_CONFIRMATION, - server, namelen, name, valuelen, value); - _statusline(message); + float percentage; + percentage = (float)space_free/(float)(namelen + valuelen); + namelen = (int)(percentage*(float)namelen); + valuelen = (int)(percentage*(float)valuelen); } + sprintf(message, ADVANCED_COOKIE_CONFIRMATION, + server, namelen, name, valuelen, value); + _statusline(message); while (1) { - if(!LYAcceptAllCookies) { - ch = LYgetch(); - } else { - ch = 'A'; - } + ch = LYgetch(); #ifdef VMS if (HadVMSInterrupt) { HadVMSInterrupt = FALSE; @@ -491,52 +390,56 @@ PUBLIC BOOL HTConfirmCookie ARGS4( #endif /* VMS */ switch(TOUPPER(ch)) { case 'A': - /* + /* ** Set to accept all cookies for this domain. */ de->bv = ACCEPT_ALWAYS; - HTUserMsg2(ALWAYS_ALLOWING_COOKIES, de->domain); + _user_message(ALWAYS_ALLOWING_COOKIES, de->domain); + sleep(MessageSecs); return TRUE; case 'N': case 7: /* Ctrl-G */ case 3: /* Ctrl-C */ - /* + /* ** Reject the cookie. */ - HTUserMsg(REJECTING_COOKIE); + _statusline(REJECTING_COOKIE); + sleep(MessageSecs); return FALSE; - case 'V': - /* + case 'V': + /* ** Set to reject all cookies from this domain. */ de->bv = REJECT_ALWAYS; - HTUserMsg2(NEVER_ALLOWING_COOKIES, de->domain); + _user_message(NEVER_ALLOWING_COOKIES, de->domain); + sleep(MessageSecs); return FALSE; case 'Y': - /* + /* ** Accept the cookie. */ - HTInfoMsg(ALLOWING_COOKIE); + _statusline(ALLOWING_COOKIE); + sleep(InfoSecs); return TRUE; default: - continue; + continue; } } } -/* Confirm redirection of POST. HTConfirmPostRedirect() +/* Confirm redirection of POST. HTConfirmPostRedirect() ** ---------------------------- ** ** On entry, -** Redirecting_url is the Location. +** Redirecting_url is the Location. ** server_status is the server status code. ** ** On exit, -** Returns 0 on cancel, +** Returns 0 on cancel, ** 1 for redirect of POST with content, ** 303 for redirect as GET without content */ @@ -548,11 +451,11 @@ PUBLIC int HTConfirmPostRedirect ARGS2( char StatusInfo[256]; char url[256]; int on_screen = 0; /* 0 - show menu - * 1 - show url + * 1 - show url * 2 - menu is already on screen */ if (server_status == 303 || - server_status == 302) { + server_status == 302) { /* * HTTP.c should not have called us for either of * these because we're treating 302 as historical, @@ -561,35 +464,34 @@ PUBLIC int HTConfirmPostRedirect ARGS2( return 303; } - if (dump_output_immediately) { - if (server_status == 301) { + if (dump_output_immediately) + if (server_status == 301) { /* - ** Treat 301 as historical, i.e., like 303 (GET - ** without content), when not interactive. - FM + ** Treat 301 as historical, i.e., like 303 (GET + ** without content), when not interactive. - FM */ - return 303; - } else { + return 303; + } else { /* - ** Treat anything else (e.g., 305, 306 or 307) as too - ** dangerous to redirect without confirmation, and thus - ** cancel when not interactive. - FM + ** Treat anything else (e.g., 305, 306 or 307) as too + ** dangerous to redirect without confirmation, and thus + ** cancel when not interactive. - FM */ return 0; } - } StatusInfo[254] = StatusInfo[255] = '\0'; url[254] = url[(LYcols < 250 ? LYcols-1 : 255)] = '\0'; if (user_mode == NOVICE_MODE) { - on_screen = 2; - move(LYlines-2, 0); - sprintf(StatusInfo, SERVER_ASKED_FOR_REDIRECTION, server_status); + on_screen = 2; + move(LYlines-2, 0); + sprintf(StatusInfo, SERVER_ASKED_FOR_REDIRECTION, server_status); addstr(StatusInfo); clrtoeol(); - move(LYlines-1, 0); + move(LYlines-1, 0); sprintf(url, "URL: %.*s", (LYcols < 250 ? LYcols-6 : 250), Redirecting_url); - addstr(url); + addstr(url); clrtoeol(); if (server_status == 301) { _statusline(PROCEED_GET_CANCEL); @@ -607,14 +509,14 @@ PUBLIC int HTConfirmPostRedirect ARGS2( StrAllocCat(show_POST_url, Redirecting_url); } while (1) { - int c; + int c; switch (on_screen) { case 0: _statusline(StatusInfo); break; case 1: - _statusline(show_POST_url); + _statusline(show_POST_url); } c = LYgetch(); switch (TOUPPER(c)) { @@ -623,22 +525,22 @@ PUBLIC int HTConfirmPostRedirect ARGS2( ** Proceed with 301 or 307 redirect of POST ** with same method and POST content. - FM */ - FREE(show_POST_url); - return 1; + FREE(show_POST_url); + return 1; - case 7: - case 'C': - /* + case 7: + case 'C': + /* ** Cancel request. */ - FREE(show_POST_url); + FREE(show_POST_url); return 0; case 'U': - /* + /* ** Show URL for intermediate or advanced mode. */ - if (user_mode != NOVICE_MODE) { + if (user_mode != NOVICE_MODE) { if (on_screen == 1) { on_screen = 0; } else { @@ -650,7 +552,7 @@ PUBLIC int HTConfirmPostRedirect ARGS2( case 'G': if (server_status == 301) { /* - ** Treat as 303 (GET without content). + ** Treat as 303 (GET without content). */ FREE(show_POST_url); return 303; @@ -658,7 +560,7 @@ PUBLIC int HTConfirmPostRedirect ARGS2( /* fall through to default */ default: - /* + /* ** Get another character. */ if (on_screen == 1) { diff --git a/src/HTAlert.h b/src/HTAlert.h index 334843db..b35267b6 100644 --- a/src/HTAlert.h +++ b/src/HTAlert.h @@ -1,3 +1,5 @@ +/* */ + /* Displaying messages and getting input for WWW Library ** ===================================================== ** @@ -5,10 +7,10 @@ ** Feb 93 Portablized etc TBL */ -#ifndef HTALERT_H -#define HTALERT_H 1 - +#ifndef HTUTILS_H #include <HTUtils.h> +#endif /* HTUTILS_H */ +#include <tcp.h> /* Display a message and get the input ** @@ -27,9 +29,6 @@ extern char * HTPrompt PARAMS((CONST char * Msg, CONST char * deflt)); ** The input is a list of parameters for printf. */ extern void HTAlert PARAMS((CONST char * Msg)); -extern void HTInfoMsg PARAMS((CONST char * Msg)); -extern void HTUserMsg PARAMS((CONST char * Msg)); -extern void HTUserMsg2 PARAMS((CONST char * Msg, CONST char * Arg)); /* Display a progress message for information (and diagnostics) only @@ -38,7 +37,7 @@ extern void HTUserMsg2 PARAMS((CONST char * Msg, CONST char * Arg)); ** The input is a list of parameters for printf. */ extern void HTProgress PARAMS((CONST char * Msg)); -extern void HTReadProgress PARAMS((long bytes, long total)); +extern BOOLEAN mustshow; #define _HTProgress(msg) mustshow = TRUE, HTProgress(msg) /* @@ -108,6 +107,8 @@ extern void HTPromptUsernameAndPassword PARAMS(( extern BOOL HTConfirmCookie PARAMS(( void * dp, CONST char * server, + CONST char * domain, + CONST char * path, CONST char * name, CONST char * value)); @@ -127,4 +128,6 @@ extern int HTConfirmPostRedirect PARAMS(( CONST char * Redirecting_url, int server_status)); -#endif /* HTALERT_H */ +/* + + */ diff --git a/src/HTFWriter.c b/src/HTFWriter.c index e446db19..9e91704b 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -9,6 +9,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <LYCurses.h> #include <HTFWriter.h> #include <HTSaveToFile.h> @@ -19,11 +20,18 @@ #include <HTFile.h> #include <HTPlain.h> #include <HTFile.h> +#ifdef VMS +#include <HTVMSUtils.h> +#endif /* VMS */ +#ifdef DOSPATH +#include <HTDOS.h> +#endif #include <LYStrings.h> #include <LYUtils.h> #include <LYGlobalDefs.h> #include <LYSignal.h> +#include <LYSystem.h> #include <GridText.h> #include <LYexit.h> #include <LYLeaks.h> @@ -50,6 +58,9 @@ PUBLIC HTStream* HTSaveToFile PARAMS(( HTParentAnchor * anchor, HTStream * sink)); +#define FREE(x) if (x) {free(x); x = NULL;} + + /* Stream Object ** ------------- */ @@ -65,7 +76,7 @@ struct _HTStream { HTParentAnchor * anchor; /* Original stream's anchor. */ HTStream * sink; /* Original stream's sink. */ #ifdef FNAMES_8_3 - BOOLEAN idash; /* remember position to become '.'*/ + int idash; /* remember position to become '.'*/ #endif }; @@ -124,7 +135,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) fflush(me->fp); if (me->end_command) { /* Temp file */ - LYCloseTempFP(me->fp); + fclose(me->fp); #ifdef VMS if (0 == strcmp(me->end_command, "SaveVMSBinaryFile")) { /* @@ -132,7 +143,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) * we want to convert to fixed records format. - FM */ #ifdef USE_COMMAND_FILE - LYSystem(FIXED_RECORD_COMMAND); + system(FIXED_RECORD_COMMAND); #else LYVMS_FixedLengthRecords(FIXED_RECORD_COMMAND); #endif /* USE_COMMAND_FILE */ @@ -140,6 +151,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) if (me->remove_command) { /* NEVER REMOVE THE FILE unless during an abort!*/ + /* system(me->remove_command); */ FREE(me->remove_command); } } else @@ -183,7 +195,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) * Uncompress it. - FM */ if (me->end_command && me->end_command[0]) - LYSystem(me->end_command); + system(me->end_command); fp = fopen(me->anchor->FileCache, "r"); } if (fp != NULL) { @@ -215,13 +227,11 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) */ if (skip_loadfile) { char *new_path = NULL; - char *the_dash = me->idash ? strrchr(path, '-') : 0; - if (the_dash != 0) { - unsigned off = (the_dash - path); + if (me->idash > 1 && path[me->idash] == '-') { StrAllocCopy(new_path, path); - new_path[off] = '.'; - if (strlen(new_path + off) > 4) - new_path[off + 4] = '\0'; + new_path[me->idash] = '.'; + if (strlen(new_path + me->idash) > 4) + new_path[me->idash + 4] = '\0'; if (rename(path, new_path) == 0) { FREE(path); path = new_path; @@ -231,7 +241,17 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) } } #endif /* FNAMES_8_3 */ - LYLocalFileToURL (&addr, path); + StrAllocCopy(addr, "file://localhost"); +#ifdef DOSPATH + StrAllocCat(addr, "/"); + StrAllocCat(addr, HTDOS_wwwName(path)); +#else +#ifdef VMS + StrAllocCat(addr, HTVMS_wwwName(path)); +#else + StrAllocCat(addr, path); +#endif /* VMS */ +#endif /* DOSPATH */ if (!use_gzread) { StrAllocCopy(me->anchor->FileCache, path); StrAllocCopy(me->anchor->content_encoding, "binary"); @@ -279,7 +299,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) * (or even the same!). We can skip this * needless duplication by using the * viewer_command which has already been - * determined when the HTCompressed stream was + * determind when the HTCompressed stream was * created. - kw */ FREE(me->end_command); @@ -300,10 +320,11 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) HTProgress(me->end_command); stop_curses(); } - LYSystem(me->end_command); + system(me->end_command); if (me->remove_command) { /* NEVER REMOVE THE FILE unless during an abort!!!*/ + /* system(me->remove_command); */ FREE(me->remove_command); } if (!dump_output_immediately) @@ -329,6 +350,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) } if (me->remove_command) { /* NEVER REMOVE THE FILE unless during an abort!!!*/ + /* system(me->remove_command); */ FREE(me->remove_command); } } else if (strcmp(me->end_command, "SaveToFile")) { @@ -343,10 +365,11 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) _HTProgress(me->end_command); stop_curses(); } - LYSystem(me->end_command); + system(me->end_command); if (me->remove_command) { /* NEVER REMOVE THE FILE unless during an abort!!!*/ + /* system(me->remove_command); */ FREE(me->remove_command); } if (!dump_output_immediately) @@ -358,6 +381,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) */ if (me->remove_command) { /* NEVER REMOVE THE FILE unless during an abort!!!*/ + /* system(me->remove_command); */ FREE(me->remove_command); } } @@ -394,14 +418,17 @@ PRIVATE void HTFWriter_abort ARGS2( HTStream *, me, HTError, e GCC_UNUSED) { - CTRACE(tfp,"HTFWriter_abort called\n"); - LYCloseTempFP(me->fp); + if (TRACE) + fprintf(stderr,"HTFWriter_abort called\n"); + + fclose(me->fp); FREE(me->viewer_command); if (me->end_command) { /* Temp file */ - CTRACE(tfp, "HTFWriter: Aborting: file not executed.\n"); + if (TRACE) + fprintf(stderr, "HTFWriter: Aborting: file not executed.\n"); FREE(me->end_command); if (me->remove_command) { - LYSystem(me->remove_command); + system(me->remove_command); FREE(me->remove_command); } } @@ -476,7 +503,9 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3( { char fnam[256]; CONST char *suffix; + char *cp; HTStream* me; + FILE *fp = NULL; if (traversal) { LYCancelledFetch = TRUE; @@ -490,7 +519,8 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3( return(NULL); } if (no_exec) { - HTAlert(EXECUTION_DISABLED); + _statusline(EXECUTION_DISABLED); + sleep(AlertSecs); return HTPlainPresent(pres, anchor, sink); } if (!local_exec) @@ -503,7 +533,8 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3( sprintf(buf, EXECUTION_DISABLED_FOR_FILE, key_for_func(LYK_OPTIONS)); - HTAlert(buf); + _statusline(buf); + sleep(AlertSecs); return HTPlainPresent(pres, anchor, sink); } } @@ -522,27 +553,61 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3( me->anchor = anchor; me->sink = sink; - if (LYCachedTemp(fnam, &(anchor->FileCache))) { - me->fp = LYNewBinFile (fnam); + if (anchor->FileCache) { + strcpy(fnam, anchor->FileCache); + FREE(anchor->FileCache); + if ((fp = fopen(fnam, "r")) != NULL) { + fclose(fp); + fp = NULL; + remove(fnam); + } } else { /* + * Lynx routine to create a temporary filename + */ +SaveAndExecute_tempname: + tempname (fnam, NEW_FILE); + /* * Check for a suffix. - * Save the file under a suitably suffixed name. */ - if (!strcasecomp(pres->rep->name, "text/html")) { - suffix = HTML_SUFFIX; - } else if (!strcasecomp(pres->rep->name, "text/plain")) { - suffix = ".txt"; - } else if (!strcasecomp(pres->rep->name, - "application/octet-stream")) { - suffix = ".bin"; - } else if ((suffix = HTFileSuffix(pres->rep, anchor->content_encoding)) == 0 - || *suffix != '.') { - suffix = HTML_SUFFIX; + if (((cp = strrchr(fnam, '.')) != NULL) && +#ifdef VMS + NULL == strchr(cp, ']') && +#endif /* VMS */ + NULL == strchr(cp, '/')) { + /* + * Save the file under a suitably suffixed name. + */ + *cp = '\0'; + if (!strcasecomp(pres->rep->name, "text/html")) { + strcat(fnam, HTML_SUFFIX); + } else if (!strcasecomp(pres->rep->name, "text/plain")) { + strcat(fnam, ".txt"); + } else if (!strcasecomp(pres->rep->name, + "application/octet-stream")) { + strcat(fnam, ".bin"); + } else if ((suffix = HTFileSuffix(pres->rep, anchor->content_encoding)) + && *suffix == '.') { + strcat(fnam, suffix); + /* + * It's not one of the suffixes checked for a + * spoof in tempname(), so check it now. - FM + */ + if (strcmp(suffix, HTML_SUFFIX) && + strcmp(suffix, ".txt") && + strcmp(suffix, ".bin") && + (fp = fopen(fnam, "r")) != NULL) { + fclose(fp); + fp = NULL; + goto SaveAndExecute_tempname; + } + } else { + *cp = '.'; + } } - me->fp = LYOpenTemp(fnam, suffix, "wb"); } + me->fp = LYNewBinFile (fnam); if (!me->fp) { HTAlert(CANNOT_OPEN_TEMP); FREE(me); @@ -602,8 +667,9 @@ PUBLIC HTStream* HTSaveToFile ARGS3( char fnam[256]; CONST char * suffix; char *cp; - int c = 0; + int c=0; BOOL IsBinary = TRUE; + FILE *fp = NULL; ret_obj = (HTStream*)calloc(sizeof(* ret_obj),1); if (ret_obj == NULL) @@ -628,7 +694,8 @@ PUBLIC HTStream* HTSaveToFile ARGS3( if (traversal || (no_download && !override_no_download && no_disk_save)) { if (!traversal) { - HTAlert(CANNOT_DISPLAY_FILE); + _statusline(CANNOT_DISPLAY_FILE); + sleep(AlertSecs); } LYCancelDownload = TRUE; if (traversal) @@ -674,32 +741,58 @@ PUBLIC HTStream* HTSaveToFile ARGS3( /* * Set up a 'D'ownload. */ - if (LYCachedTemp(fnam, &(anchor->FileCache))) { - ret_obj->fp = LYNewBinFile (fnam); + if (anchor->FileCache) { + strcpy(fnam, anchor->FileCache); + FREE(anchor->FileCache); + if ((fp = fopen(fnam, "r")) != NULL) { + fclose(fp); + fp = NULL; + remove(fnam); + } } else { /* + * Lynx routine to create a temporary filename + */ +SaveToFile_tempname: + tempname(fnam, NEW_FILE); + /* * Check for a suffix. - * Save the file under a suitably suffixed name. */ - if (!strcasecomp(pres->rep->name, "text/html")) { - suffix = HTML_SUFFIX; - } else if (!strcasecomp(pres->rep->name, "text/plain")) { - suffix = ".txt"; - } else if (!strcasecomp(pres->rep->name, + if (((cp=strrchr(fnam, '.')) != NULL) && +#ifdef VMS + NULL == strchr(cp, ']') && +#endif /* VMS */ + NULL == strchr(cp, '/')) { + /* + * Save the file under a suitably suffixed name. + */ + *cp = '\0'; + if (!strcasecomp(pres->rep->name, "text/html")) { + strcat(fnam, HTML_SUFFIX); + } else if (!strcasecomp(pres->rep->name, "text/plain")) { + strcat(fnam, ".txt"); + } else if (!strcasecomp(pres->rep->name, "application/octet-stream")) { - suffix = ".bin"; - } else if ((suffix = HTFileSuffix(pres->rep, - anchor->content_encoding)) == 0 - || *suffix != '.') { - suffix = HTML_SUFFIX; + strcat(fnam, ".bin"); + } else if ((suffix = HTFileSuffix(pres->rep, + anchor->content_encoding)) && *suffix == '.') { + strcat(fnam, suffix); + /* + * It's not one of the suffixes checked for a + * spoof in tempname(), so check it now. - FM + */ + if (strcmp(suffix, HTML_SUFFIX) && + strcmp(suffix, ".txt") && + strcmp(suffix, ".bin") && + (fp = fopen(fnam, "r")) != NULL) { + fclose(fp); + fp = NULL; + goto SaveToFile_tempname; + } + } else { + *cp = '.'; + } } - ret_obj->fp = LYOpenTemp(fnam, suffix, "wb"); - } - - if (!ret_obj->fp) { - HTAlert(CANNOT_OPEN_OUTPUT); - FREE(ret_obj); - return NULL; } if (0==strncasecomp(pres->rep->name, "text/", 5) || @@ -712,6 +805,13 @@ PUBLIC HTStream* HTSaveToFile ARGS3( */ IsBinary = FALSE; + ret_obj->fp = LYNewBinFile (fnam); + if (!ret_obj->fp) { + HTAlert(CANNOT_OPEN_OUTPUT); + FREE(ret_obj); + return NULL; + } + /* * Any "application/foo" or other non-"text/foo" types that * are actually text but not checked, above, will be treated @@ -719,7 +819,8 @@ PUBLIC HTStream* HTSaveToFile ARGS3( * Unix folks don't need to know this, but we'll show it to * them, too. - FM */ - HTUserMsg2("Content-type: %s", pres->rep->name); + user_message("Content-type: %s", pres->rep->name); + sleep(MessageSecs); StrAllocCopy(WWW_Download_File,fnam); @@ -745,7 +846,8 @@ PUBLIC HTStream* HTSaveToFile ARGS3( * sizeof (char),1); if (FIXED_RECORD_COMMAND == NULL) outofmem(__FILE__, "HTSaveToFile"); - sprintf(FIXED_RECORD_COMMAND, FIXED_RECORD_COMMAND_MASK, fnam); + sprintf(FIXED_RECORD_COMMAND, + FIXED_RECORD_COMMAND_MASK, fnam, "", "", "", "", "", ""); } else { #endif /* VMS */ ret_obj->end_command = (char *)calloc (sizeof(char)*12,1); @@ -770,8 +872,6 @@ Prepend_BASE: * Note that the markup will be technically invalid if a DOCTYPE * declaration, or HTML or HEAD tags, are present, and thus the * file may need editing for perfection. - FM - * - * Add timestamp (last reload). */ char *temp = NULL; @@ -781,19 +881,15 @@ Prepend_BASE: StrAllocCopy(temp, anchor->content_location); } if (temp) { - LYRemoveBlanks(temp); + collapse_spaces(temp); if (!is_url(temp)) { FREE(temp); } } fprintf(ret_obj->fp, - "<!-- X-URL: %s -->\n", anchor->address); - if (anchor->date && *anchor->date) - fprintf(ret_obj->fp, - "<!-- Date: %s -->\n", anchor->date); - fprintf(ret_obj->fp, - "<BASE HREF=\"%s\">\n\n", (temp ? temp : anchor->address)); + "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n", + anchor->address, (temp ? temp : anchor->address)); FREE(temp); } if (LYPrependCharsetToSource && @@ -812,8 +908,8 @@ Prepend_BASE: if (anchor->charset && *anchor->charset) { StrAllocCopy(temp, anchor->charset); - LYRemoveBlanks(temp); - fprintf(ret_obj->fp, + collapse_spaces(temp); + fprintf(ret_obj->fp, "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=%s\">\n\n", temp); } @@ -837,15 +933,15 @@ PUBLIC HTStream* HTCompressed ARGS3( int n, i; BOOL can_present = FALSE; char fnam[256]; - char temp[256]; CONST char *suffix; char *uncompress_mask = NULL; char *compress_suffix = ""; + char *cp; CONST char *middle; FILE *fp = NULL; /* - * Deal with any inappropriate invocations of this function, + * Deal with any inappropriate invokations of this function, * or a download request, in which case we won't bother to * uncompress the file. - FM */ @@ -924,9 +1020,6 @@ PUBLIC HTStream* HTCompressed ARGS3( me->output_format = pres->rep_out; me->anchor = anchor; me->sink = sink; -#ifdef FNAMES_8_3 - me->idash = FALSE; -#endif /* * Remove any old versions of the file. - FM @@ -942,45 +1035,61 @@ PUBLIC HTStream* HTCompressed ARGS3( /* * Get a new temporary filename and substitute a suitable suffix. - FM */ - middle = NULL; - if (!strcasecomp(anchor->content_type, "text/html")) { - middle = HTML_SUFFIX; - middle++; /* point to 'h' of .htm(l) - kw */ - } else if (!strcasecomp(anchor->content_type, "text/plain")) { - middle = "txt"; - } else if (!strcasecomp(anchor->content_type, - "application/octet-stream")) { - middle = "bin"; - } else if ((suffix = - HTFileSuffix(HTAtom_for(anchor->content_type), NULL)) && - *suffix == '.') { +Compressed_tempname: + tempname(fnam, NEW_FILE); + if ((cp = strrchr(fnam, '.')) != NULL) { + middle = NULL; + if (!strcasecomp(anchor->content_type, "text/html")) { + middle = HTML_SUFFIX; + middle++; /* point to 'h' of .htm(l) - kw */ + } else if (!strcasecomp(anchor->content_type, "text/plain")) { + middle = "txt"; + } else if (!strcasecomp(anchor->content_type, + "application/octet-stream")) { + middle = "bin"; + } else if ((suffix = + HTFileSuffix(HTAtom_for(anchor->content_type), NULL)) && + *suffix == '.') { #if defined(VMS) || defined(FNAMES_8_3) - if (strchr(suffix + 1, '.') == NULL) + if (strchr(suffix + 1, '.') == NULL) #endif - middle = suffix + 1; - } - - temp[0] = 0; /* construct the suffix */ - if (middle) { + middle = suffix + 1; + } + if (middle) { + *cp = '\0'; #ifdef FNAMES_8_3 - me->idash = TRUE; /* remember position of '-' - kw */ - strcat(temp, "-"); /* NAME-htm, NAME-txt, etc. - hack for DOS */ + me->idash = strlen(fnam); /* remember position of '-' - kw */ + strcat(fnam, "-"); /* NAME-htm, NAME-txt, etc. - hack for DOS */ #else - strcat(temp, "."); /* NAME.html, NAME-txt etc. */ + strcat(fnam, "."); /* NAME.html, NAME-txt etc. */ #endif /* FNAMES_8_3 */ - strcat(temp, middle); + strcat(fnam, middle); #ifdef VMS - strcat(temp, "-"); /* NAME.html-gz, NAME.txt-gz, NAME.txt-Z etc.*/ + strcat(fnam, "-"); /* NAME.html-gz, NAME.txt-gz, NAME.txt-Z etc.*/ #else - strcat(temp, "."); /* NAME-htm.gz (DOS), NAME.html.gz (UNIX)etc.*/ + strcat(fnam, "."); /* NAME-htm.gz (DOS), NAME.html.gz (UNIX)etc.*/ #endif /* VMS */ + } else { + *(cp + 1) = '\0'; + } + } else { + strcat(fnam, "."); + } + strcat(fnam, compress_suffix); + /* + * It's not one of the suffixes checked for a + * spoof in tempname(), so check it now. - FM + */ + if ((fp = fopen(fnam, "r")) != NULL) { + fclose(fp); + fp = NULL; + goto Compressed_tempname; } - strcat(temp, compress_suffix); /* * Open the file for receiving the compressed input stream. - FM */ - me->fp = LYOpenTemp (fnam, temp, "wb"); + me->fp = LYNewBinFile (fnam); if (!me->fp) { HTAlert(CANNOT_OPEN_TEMP); FREE(uncompress_mask); @@ -1138,7 +1247,7 @@ PUBLIC unsigned long LYVMS_FixedLengthRecords ARGS1(char *, filename) /* RMS supplies a user-mode channel (see FAB$L_FOP FAB$V_UFO doc) */ channel = (unsigned short) fab.fab$l_stv; - /* set up ACP interface structures */ + /* set up ACP interface strutures */ /* file information block, passed by descriptor; it's okay to start with an empty FIB after RMS has accessed the file for us */ fib_dsc.len = sizeof fib; diff --git a/src/HTForms.h b/src/HTForms.h index eb0784f2..c01d3df1 100644 --- a/src/HTForms.h +++ b/src/HTForms.h @@ -7,7 +7,7 @@ #endif /* LYSTRUCTS_H */ /* in LYForms.c */ -extern int change_form_link PARAMS((struct link *form_link, +extern int change_form_link PARAMS((struct link *form_link, int mode, document *newdoc, BOOLEAN *refresh_screen, char *link_name, char *link_value)); @@ -59,7 +59,7 @@ typedef struct _FormInfo { char * value; /* user entered string data */ char * orig_value;/* the original value */ int size; /* width on the screen */ - unsigned maxlength; /* max width of data */ + int maxlength; /* max width of data */ int group; /* a group associated with the link * this is used for select's */ @@ -130,6 +130,9 @@ typedef struct _PerFormInfo #define NORMAL_LYNX_MODE 1 #define FORMS_LYNX_MODE 2 +#define FORM_UP 1 +#define FORM_DOWN 2 + #define FIRST_ORDER 1 #define MIDDLE_ORDER 2 #define LAST_ORDER 3 diff --git a/src/HTInit.c b/src/HTInit.c index 6d46ee30..807df2fd 100644 --- a/src/HTInit.c +++ b/src/HTInit.c @@ -1,4 +1,4 @@ -/* Configuration-specific Initialization HTInit.c +/* Configuration-specific Initialialization HTInit.c ** ---------------------------------------- */ @@ -7,6 +7,7 @@ */ #include <HTUtils.h> +#include <tcp.h> /* Implements: */ @@ -22,20 +23,29 @@ #include <HTSaveToFile.h> /* LJM */ #include <userdefs.h> -#include <LYStrings.h> #include <LYUtils.h> #include <LYGlobalDefs.h> #include <LYSignal.h> +#include <LYSystem.h> #include <LYexit.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + +#ifdef VMS +#define DISPLAY "DECW$DISPLAY" +#else +#define DISPLAY "DISPLAY" +#endif /* VMS */ + PRIVATE int HTLoadTypesConfigFile PARAMS((char *fn)); PRIVATE int HTLoadExtensionsConfigFile PARAMS((char *fn)); PUBLIC void HTFormatInit NOARGS { FILE *fp = NULL; + char *cp = NULL; #ifdef NeXT HTSetPresentation("application/postscript", "open %s", 1.0, 2.0, 0.0, 0); @@ -44,7 +54,7 @@ PUBLIC void HTFormatInit NOARGS HTSetPresentation("audio/basic", "open %s", 1.0, 2.0, 0.0, 0); HTSetPresentation("*", "open %s", 1.0, 0.0, 0.0, 0); #else - if (LYgetXDisplay() != 0) { /* Must have X11 */ + if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { /* Must have X11 */ HTSetPresentation("application/postscript", "ghostview %s&", 1.0, 3.0, 0.0, 0); HTSetPresentation("image/gif", XLoadImageCommand, 1.0, 3.0, 0.0, 0); @@ -160,8 +170,13 @@ PUBLIC void HTFormatInit NOARGS /* These should override everything else. */ HTLoadTypesConfigFile(personal_type_map); } else { - char buffer[LY_MAXPATH]; - LYAddPathToHome(buffer, sizeof(buffer), personal_type_map); + char buffer[256]; +#ifdef VMS + sprintf(buffer, "sys$login:%s", personal_type_map); +#else + sprintf(buffer, "%s/%s", (Home_Dir() ? Home_Dir() : ""), + personal_type_map); +#endif HTLoadTypesConfigFile(buffer); } @@ -222,6 +237,7 @@ PRIVATE int ExitWithError PARAMS((char *txt)); PRIVATE int PassesTest PARAMS((struct MailcapEntry *mc)); #define LINE_BUF_SIZE 2048 +#define TMPFILE_NAME_SIZE 256 PRIVATE char *GetCommand ARGS2( char *, s, @@ -263,16 +279,27 @@ PRIVATE char *GetCommand ARGS2( PRIVATE char *Cleanse ARGS1( char *, s) { - LYTrimLeading(s); - LYTrimTrailing(s); - LYLowerCase(s); - return(s); + char *tmp, *news; + + /* strip leading white space */ + while (*s && isspace((unsigned char) *s)) + ++s; + news = s; + /* put in lower case */ + for (tmp=s; *tmp; ++tmp) { + *tmp = TOLOWER ((unsigned char)*tmp); + } + /* strip trailing white space */ + while ((tmp > news) && *--tmp && isspace((unsigned char) *tmp)) + *tmp = '\0'; + return(news); } PRIVATE int ProcessMailcapEntry ARGS2( FILE *, fp, struct MailcapEntry *, mc) { + int i, j; size_t rawentryalloc = 2000, len; char *rawentry, *s, *t, *LineBuf; @@ -308,7 +335,8 @@ PRIVATE int ProcessMailcapEntry ARGS2( FREE(LineBuf); - s = LYSkipBlanks(rawentry); + for (s = rawentry; *s && isspace((unsigned char) *s); ++s) + ; if (!*s) { /* totally blank entry -- quietly ignore */ FREE(rawentry); @@ -316,8 +344,11 @@ PRIVATE int ProcessMailcapEntry ARGS2( } s = strchr(rawentry, ';'); if (s == NULL) { - CTRACE(tfp, "ProcessMailcapEntry: Ignoring invalid mailcap entry: %s\n", - rawentry); + if (TRACE) { + fprintf(stderr, + "ProcessMailcapEntry: Ignoring invalid mailcap entry: %s\n", + rawentry); + } FREE(rawentry); return(0); } @@ -326,14 +357,20 @@ PRIVATE int ProcessMailcapEntry ARGS2( !strncasecomp(rawentry, "text/plain", 10)) { --s; *s = ';'; - CTRACE(tfp, "ProcessMailcapEntry: Ignoring mailcap entry: %s\n", - rawentry); + if (TRACE) { + fprintf(stderr, + "ProcessMailcapEntry: Ignoring mailcap entry: %s\n", + rawentry); + } FREE(rawentry); return(0); } - LYRemoveBlanks(rawentry); - LYLowerCase(rawentry); - + for (i = 0, j = 0; rawentry[i]; i++) { + if (rawentry[i] != ' ') { + rawentry[j++] = TOLOWER(rawentry[i]); + } + } + rawentry[j] = '\0'; mc->needsterminal = 0; mc->copiousoutput = 0; mc->needtofree = 1; @@ -350,7 +387,8 @@ PRIVATE int ProcessMailcapEntry ARGS2( if (!t) { goto assign_presentation; } - s = LYSkipBlanks(t); + s = t; + while (s && *s && isspace((unsigned char) *s)) ++s; while (s) { char *arg, *eq, *mallocd_string; @@ -369,7 +407,9 @@ PRIVATE int ProcessMailcapEntry ARGS2( } else if (eq && !strcmp(arg, "test")) { mc->testcommand = NULL; StrAllocCopy(mc->testcommand, eq); - CTRACE(tfp, "ProcessMailcapEntry: Found testcommand:%s\n", + if (TRACE) + fprintf(stderr, + "ProcessMailcapEntry: Found testcommand:%s\n", mc->testcommand); } else if (eq && !strcmp(arg, "description")) { mc->label = eq; @@ -389,21 +429,24 @@ PRIVATE int ProcessMailcapEntry ARGS2( if (mc->maxbytes < 0) mc->maxbytes = 0; } else if (strcmp(arg, "notes")) { /* IGNORE notes field */ - if (*arg) - CTRACE(tfp, "ProcessMailcapEntry: Ignoring mailcap flag '%s'.\n", - arg); + if (*arg && TRACE) + fprintf(stderr, + "ProcessMailcapEntry: Ignoring mailcap flag '%s'.\n", + arg); } } - FREE(mallocd_string); - s = t; + FREE(mallocd_string); + s = t; } assign_presentation: FREE(rawentry); if (PassesTest(mc)) { - CTRACE(tfp, "ProcessMailcapEntry Setting up conversion %s : %s\n", + if (TRACE) + fprintf(stderr, + "ProcessMailcapEntry Setting up conversion %s : %s\n", mc->contenttype, mc->command); HTSetPresentation(mc->contenttype, mc->command, mc->quality, 3.0, 0.0, mc->maxbytes); @@ -433,15 +476,22 @@ PRIVATE void BuildCommand ARGS5( break; case 'n': case 'F': - CTRACE(tfp, "BuildCommand: Bad mailcap \"test\" clause: %s\n", + if (TRACE) { + fprintf(stderr, + "BuildCommand: Bad mailcap \"test\" clause: %s\n", controlstring); + } case 's': if (TmpFileLen && TmpFileName) { if ((to - *pBuf) + TmpFileLen + 1 > Bufsize) { *to = '\0'; - CTRACE(tfp, "BuildCommand: Too long mailcap \"test\" clause,\n"); - CTRACE(tfp, " ignoring: %s%s...\n", + if (TRACE) { + fprintf(stderr, + "BuildCommand: Too long mailcap \"test\" clause,\n"); + fprintf(stderr, + " ignoring: %s%s...\n", *pBuf, TmpFileName); + } **pBuf = '\0'; return; } @@ -450,9 +500,11 @@ PRIVATE void BuildCommand ARGS5( } break; default: - CTRACE(tfp, + if (TRACE) { + fprintf(stderr, "BuildCommand: Ignoring unrecognized format code in mailcap file '%%%c'.\n", *from); + } break; } } else if (*from == '%') { @@ -462,9 +514,13 @@ PRIVATE void BuildCommand ARGS5( } if (to >= *pBuf + Bufsize) { (*pBuf)[Bufsize - 1] = '\0'; - CTRACE(tfp, "BuildCommand: Too long mailcap \"test\" clause,\n"); - CTRACE(tfp, " ignoring: %s...\n", + if (TRACE) { + fprintf(stderr, + "BuildCommand: Too long mailcap \"test\" clause,\n"); + fprintf(stderr, + " ignoring: %s...\n", *pBuf); + } **pBuf = '\0'; return; } @@ -476,7 +532,8 @@ PRIVATE int PassesTest ARGS1( struct MailcapEntry *, mc) { int result; - char *cmd, TmpFileName[LY_MAXPATH]; + char *cmd, TmpFileName[TMPFILE_NAME_SIZE]; + char *cp = NULL; /* * Make sure we have a command @@ -489,23 +546,31 @@ PRIVATE int PassesTest ARGS1( */ if (0 == strcasecomp(mc->testcommand, "test -n \"$DISPLAY\"")) { FREE(mc->testcommand); - CTRACE(tfp, "PassesTest: Testing for XWINDOWS environment.\n"); - if (LYgetXDisplay() != NULL) { - CTRACE(tfp, "PassesTest: Test passed!\n"); + if (TRACE) + fprintf(stderr, + "PassesTest: Testing for XWINDOWS environment.\n"); + if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { + if (TRACE) + fprintf(stderr,"PassesTest: Test passed!\n"); return(0 == 0); } else { - CTRACE(tfp, "PassesTest: Test failed!\n"); + if (TRACE) + fprintf(stderr,"PassesTest: Test failed!\n"); return(-1 == 0); } } if (0 == strcasecomp(mc->testcommand, "test -z \"$DISPLAY\"")) { FREE(mc->testcommand); - CTRACE(tfp, "PassesTest: Testing for NON_XWINDOWS environment.\n"); - if (LYgetXDisplay() == NULL) { - CTRACE(tfp,"PassesTest: Test passed!\n"); + if (TRACE) + fprintf(stderr, + "PassesTest: Testing for NON_XWINDOWS environment.\n"); + if (!((cp = getenv(DISPLAY)) != NULL && *cp != '\0')) { + if (TRACE) + fprintf(stderr,"PassesTest: Test passed!\n"); return(0 == 0); } else { - CTRACE(tfp,"PassesTest: Test failed!\n"); + if (TRACE) + fprintf(stderr,"PassesTest: Test failed!\n"); return(-1 == 0); } } @@ -515,8 +580,11 @@ PRIVATE int PassesTest ARGS1( */ if (0 == strcasecomp(mc->testcommand, "test -n \"$LYNX_VERSION\"")){ FREE(mc->testcommand); - CTRACE(tfp, "PassesTest: Testing for LYNX environment.\n"); - CTRACE(tfp, "PassesTest: Test passed!\n"); + if (TRACE) { + fprintf(stderr, + "PassesTest: Testing for LYNX environment.\n"); + fprintf(stderr,"PassesTest: Test passed!\n"); + } return(0 == 0); } else /* @@ -524,17 +592,18 @@ PRIVATE int PassesTest ARGS1( */ if (0 == strcasecomp(mc->testcommand, "test -z \"$LYNX_VERSION\"")) { FREE(mc->testcommand); - CTRACE(tfp, "PassesTest: Testing for non-LYNX environment.\n"); - CTRACE(tfp, "PassesTest: Test failed!\n"); + if (TRACE) { + fprintf(stderr, + "PassesTest: Testing for non-LYNX environment.\n"); + fprintf(stderr,"PassesTest: Test failed!\n"); + } return(-1 == 0); } /* * Build the command and execute it. */ - if (LYOpenTemp(TmpFileName, HTML_SUFFIX, "w") == 0) - ExitWithError(CANNOT_OPEN_TEMP); - LYCloseTemp(TmpFileName); + tempname(TmpFileName, NEW_FILE); cmd = (char *)malloc(1024); if (!cmd) ExitWithError("Out of memory"); @@ -542,10 +611,10 @@ PRIVATE int PassesTest ARGS1( mc->testcommand, TmpFileName, strlen(TmpFileName)); - CTRACE(tfp, "PassesTest: Executing test command: %s\n", cmd); - result = LYSystem(cmd); + if (TRACE) + fprintf(stderr,"PassesTest: Executing test command: %s\n", cmd); + result = system(cmd); FREE(cmd); - LYRemoveTemp(TmpFileName); /* * Free the test command as well since @@ -553,11 +622,10 @@ PRIVATE int PassesTest ARGS1( */ FREE(mc->testcommand); - if (result) { - CTRACE(tfp,"PassesTest: Test failed!\n"); - } else { - CTRACE(tfp,"PassesTest: Test passed!\n"); - } + if (TRACE && result) + fprintf(stderr,"PassesTest: Test failed!\n"); + else if (TRACE) + fprintf(stderr,"PassesTest: Test passed!\n"); return(result == 0); } @@ -568,10 +636,14 @@ PRIVATE int ProcessMailcapFile ARGS1( struct MailcapEntry mc; FILE *fp; - CTRACE(tfp, "ProcessMailcapFile: Loading file '%s'.\n", + if (TRACE) + fprintf(stderr, + "ProcessMailcapFile: Loading file '%s'.\n", file); if ((fp = fopen(file, "r")) == NULL) { - CTRACE(tfp, "ProcessMailcapFile: Could not open '%s'.\n", + if (TRACE) + fprintf(stderr, + "ProcessMailcapFile: Could not open '%s'.\n", file); return(-1 == 0); } @@ -587,7 +659,7 @@ PRIVATE int ExitWithError ARGS1( char *, txt) { if (txt) - fprintf(tfp, "metamail: %s\n", txt); + fprintf(stderr, "metamail: %s\n", txt); #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_DFL); #endif /* NOSIGHUP */ @@ -632,7 +704,9 @@ PUBLIC void HTFileInit NOARGS { FILE *fp; - CTRACE(tfp, "HTFileInit: Loading default (HTInit) extension maps.\n"); + if (TRACE) + fprintf(stderr, + "HTFileInit: Loading default (HTInit) extension maps.\n"); /* default suffix interpretation */ HTSetSuffix("*", "text/plain", "7bit", 1.0); @@ -640,7 +714,7 @@ PUBLIC void HTFileInit NOARGS #ifdef EXEC_SCRIPTS /* - * define these extensions for exec scripts. + * define these extentions for exec scripts. */ #ifndef VMS /* for csh exec links */ @@ -687,8 +761,6 @@ PUBLIC void HTFileInit NOARGS HTSetSuffix(".zip", "application/x-Zip File", "binary", 1.0); - HTSetSuffix(".bz2", "application/x-bzip2", "binary", 1.0); - HTSetSuffix(".uu", "application/x-UUencoded", "8bit", 1.0); HTSetSuffix(".hqx", "application/x-Binhex", "8bit", 1.0); @@ -835,7 +907,6 @@ PUBLIC void HTFileInit NOARGS HTSetSuffix(".ht3", "text/html", "8bit", 1.0); HTSetSuffix(".phtml", "text/html", "8bit", 1.0); HTSetSuffix(".shtml", "text/html", "8bit", 1.0); - HTSetSuffix(".sht", "text/html", "8bit", 1.0); HTSetSuffix(".htmlx", "text/html", "8bit", 1.0); HTSetSuffix(".htm", "text/html", "8bit", 1.0); HTSetSuffix(".html", "text/html", "8bit", 1.0); @@ -848,8 +919,13 @@ PUBLIC void HTFileInit NOARGS /* These should override everything else. */ HTLoadExtensionsConfigFile(personal_extension_map); } else { - char buffer[LY_MAXPATH]; - LYAddPathToHome(buffer, sizeof(buffer), personal_extension_map); + char buffer[256]; +#ifdef VMS + sprintf(buffer, "sys$login:%s", personal_extension_map); +#else + sprintf(buffer, "%s/%s", (Home_Dir() ? Home_Dir() : ""), + personal_extension_map); +#endif /* VMS */ /* These should override everything else. */ HTLoadExtensionsConfigFile(buffer); } @@ -925,13 +1001,17 @@ PRIVATE int HTLoadExtensionsConfigFile ARGS1( { char l[MAX_STRING_LEN],w[MAX_STRING_LEN],*ct; FILE *f; - int count = 0; + int x, count = 0; - CTRACE(tfp, "HTLoadExtensionsConfigFile: Loading file '%s'.\n", fn); + if (TRACE) + fprintf(stderr, + "HTLoadExtensionsConfigFile: Loading file '%s'.\n", fn); if ((f = fopen(fn,"r")) == NULL) { - CTRACE(tfp, "HTLoadExtensionsConfigFile: Could not open '%s'.\n", fn); - return count; + if (TRACE) + fprintf(stderr, + "HTLoadExtensionsConfigFile: Could not open '%s'.\n", fn); + return count; } while (!(HTGetLine(l,MAX_STRING_LEN,f))) { @@ -942,7 +1022,8 @@ PRIVATE int HTLoadExtensionsConfigFile ARGS1( if (!ct) outofmem(__FILE__, "HTLoadExtensionsConfigFile"); strcpy(ct,w); - LYLowerCase(ct); + for (x = 0; ct[x]; x++) + ct[x] = TOLOWER(ct[x]); while(l[0]) { HTGetWord(w, l, ' ', '\t'); @@ -951,10 +1032,15 @@ PRIVATE int HTLoadExtensionsConfigFile ARGS1( if (!ct) outofmem(__FILE__, "HTLoadExtensionsConfigFile"); - sprintf(ext, ".%s", w); - LYLowerCase(ext); + for (x = 0; w[x]; x++) + ext[x+1] = TOLOWER(w[x]); + ext[0] = '.'; + ext[strlen(w)+1] = '\0'; - CTRACE (tfp, "SETTING SUFFIX '%s' to '%s'.\n", ext, ct); + if (TRACE) { + fprintf (stderr, + "SETTING SUFFIX '%s' to '%s'.\n", ext, ct); + } if (strstr(ct, "tex") != NULL || strstr(ct, "postscript") != NULL || @@ -11,9 +11,8 @@ ** Being Overidden ** */ -#define DICKEY_TEST - #include <HTUtils.h> +#include <tcp.h> #define Lynx_HTML_Handler #include <HTChunk.h> @@ -41,7 +40,6 @@ #include <HTNestedList.h> #include <GridText.h> #include <LYSignal.h> -#include <LYStrings.h> #include <LYUtils.h> #include <LYMap.h> #include <LYList.h> @@ -49,6 +47,7 @@ #ifdef VMS #include <LYCurses.h> +#include <HTVMSUtils.h> #endif /* VMS */ #ifdef USE_COLOR_STYLE @@ -63,7 +62,7 @@ char Style_className[16384]; #include <LYexit.h> #include <LYLeaks.h> -#define STACKLEVEL(me) ((me->stack + MAX_NESTING - 1) - me->sp) +#define FREE(x) if (x) {free(x); x = NULL;} extern BOOL HTPassEightBitRaw; extern HTCJKlang HTCJK; @@ -82,7 +81,7 @@ PRIVATE HTStyleSheet * styleSheet; /* Application-wide */ /* Module-wide style cache */ -PRIVATE HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles */ +PUBLIC HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles */ /* and 3 header alignment styles */ /* and 3 div alignment styles */ PRIVATE HTStyle *default_style; @@ -100,15 +99,19 @@ PRIVATE void HTML_end_element PARAMS((HTStructured *me, int element_number, char **include)); +/* Forward declarations of routines +*/ +PRIVATE void get_styles NOPARAMS; +PRIVATE void change_paragraph_style PARAMS((HTStructured * me, + HTStyle * style)); + /* * If we have verbose_img set, display labels for images. */ -#define VERBOSE_IMG(value,src_type,string) \ - ((verbose_img) ? (newtitle = MakeNewTitle(value,src_type)): string) +#define VERBOSE_IMG(value,string) \ + ((verbose_img) ? (newtitle = MakeNewTitle(value)): string) -PRIVATE char* MakeNewTitle PARAMS((CONST char ** value, int src_type)); -PRIVATE char* MakeNewImageValue PARAMS((CONST char ** value)); -PRIVATE char* MakeNewMapValue PARAMS((const char ** value, const char* mapstr)); +PRIVATE char * MakeNewTitle(CONST char ** value); /* Set an internal flag that the next call to a stack-affecting method ** is only internal and the stack manipulation should be skipped. - kw @@ -176,18 +179,6 @@ PRIVATE void change_paragraph_style ARGS2(HTStructured *, me, HTStyle *,style) ** A C T I O N R O U T I N E S */ -/* FIXME: this should be amended to do the substitution only when not in a - * multibyte stream. - */ -#if EXP_JAPANESE_SPACES -#define FIX_JAPANESE_SPACES \ - (HTCJK == CHINESE || HTCJK == JAPANESE || HTCJK == TAIPEI) - /* don't replace '\n' with ' ' if Chinese or Japanese - HN - */ -#else -#define FIX_JAPANESE_SPACES 0 -#endif - /* Character handling ** ------------------ */ @@ -227,17 +218,10 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c) case HTML_TITLE: if (c == LY_SOFT_HYPHEN) return; - if (c != '\n' && c != '\t' && c != '\r') { + if (c != '\n' && c != '\t' && c != '\r') HTChunkPutc(&me->title, c); - } else if (FIX_JAPANESE_SPACES) { - if (c == '\t') { - HTChunkPutc(&me->title, ' '); - } else { - return; - } - } else { + else HTChunkPutc(&me->title, ' '); - } return; case HTML_STYLE: @@ -349,15 +333,13 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c) UPDATE_STYLE; } if (c == '\n') { - if (!FIX_JAPANESE_SPACES) { - if (me->in_word) { - if (HText_getLastChar(me->text) != ' ') { - me->inP = TRUE; - me->inLABEL = FALSE; - HText_appendCharacter(me->text, ' '); - } - me->in_word = NO; + if (me->in_word) { + if (HText_getLastChar(me->text) != ' ') { + me->inP = TRUE; + me->inLABEL = FALSE; + HText_appendCharacter(me->text, ' '); } + me->in_word = NO; } } else if (c == ' ' || c == '\t') { @@ -380,15 +362,15 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c) } /* end second switch */ if (c == '\n' || c == '\t') { - HText_setLastChar(me->text, ' '); /* set it to a generic separator */ + HText_setLastChar(me->text, ' '); /* set it to a generic seperater */ /* * \r's are ignored. In order to keep collapsing spaces * correctly we must default back to the previous - * separator if there was one + * seperater if there was one */ } else if (c == '\r' && HText_getLastChar(me->text) == ' ') { - HText_setLastChar(me->text, ' '); /* set it to a generic separator */ + HText_setLastChar(me->text, ' '); /* set it to a generic seperater */ } else { HText_setLastChar(me->text, c); } @@ -486,12 +468,10 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s) UPDATE_STYLE; } if (c == '\n') { - if (!FIX_JAPANESE_SPACES) { - if (me->in_word) { - if (HText_getLastChar(me->text) != ' ') - HText_appendCharacter(me->text, ' '); - me->in_word = NO; - } + if (me->in_word) { + if (HText_getLastChar(me->text) != ' ') + HText_appendCharacter(me->text, ' '); + me->in_word = NO; } } else if (c == ' ' || c == '\t') { @@ -507,15 +487,15 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s) /* set the Last Character */ if (c == '\n' || c == '\t') { - /* set it to a generic separator */ + /* set it to a generic seperater */ HText_setLastChar(me->text, ' '); } else if (c == '\r' && HText_getLastChar(me->text) == ' ') { /* * \r's are ignored. In order to keep collapsing * spaces correctly, we must default back to the - * previous separator, if there was one. So we - * set LastChar to a generic separator. + * previous seperator, if there was one. So we + * set LastChar to a generic seperater. */ HText_setLastChar(me->text, ' '); } else { @@ -636,7 +616,7 @@ PRIVATE void HTML_start_element ARGS6( char *I_value = NULL; char *I_name = NULL; char *temp = NULL; - int dest_char_set = UCLYhndl_for_unrec; + int dest_char_set = -1; HTParentAnchor *dest = NULL; /* An anchor's destination */ BOOL dest_ismap = FALSE; /* Is dest an image map script? */ BOOL UseBASE = TRUE; /* Resoved vs. BASE if present? */ @@ -691,30 +671,31 @@ PRIVATE void HTML_start_element ARGS6( if (TRACE) { - fprintf(tfp, "CSSTRIM:%s -> %d", myHash, hcode); + fprintf(stderr, "CSSTRIM:%s -> %d", myHash, hcode); if (hashStyles[hcode].code!=hcode) { char *rp=strrchr(myHash, '.'); - fprintf(tfp, " (undefined) %s\n", myHash); + fprintf(stderr, " (undefined) %s\n", myHash); if (rp) { int hcd; *rp='\0'; /* trim the class */ hcd = hash_code(myHash); - fprintf(tfp, "CSS:%s -> %d", myHash, hcd); + fprintf(stderr, "CSS:%s -> %d", myHash, hcd); if (hashStyles[hcd].code!=hcd) - fprintf(tfp, " (undefined) %s\n", myHash); + fprintf(stderr, " (undefined) %s\n", myHash); else - fprintf(tfp, " ca=%d\n", hashStyles[hcd].color); + fprintf(stderr, " ca=%d\n", hashStyles[hcd].color); } } else - fprintf(tfp, " ca=%d\n", hashStyles[hcode].color); + fprintf(stderr, " ca=%d\n", hashStyles[hcode].color); } if (displayStyles[element_number + STARTAT].color > -2) /* actually set */ { - CTRACE(tfp, "CSSTRIM: start_element: top <%s>\n", HTML_dtd.tags[element_number].name); + if (TRACE) + fprintf(stderr, "CSSTRIM: start_element: top <%s>\n", HTML_dtd.tags[element_number].name); HText_characterStyle(me->text, hcode, 1); } #endif /* USE_COLOR_STYLE */ @@ -737,8 +718,11 @@ PRIVATE void HTML_start_element ARGS6( char *related = NULL; StrAllocCopy(base, value[HTML_BASE_HREF]); - if (!(url_type = LYLegitimizeHREF(me, &base, TRUE, TRUE))) { - CTRACE(tfp, "HTML: BASE '%s' is not an absolute URL.\n", + if (!(url_type = LYLegitimizeHREF(me, (char**)&base, + TRUE, TRUE))) { + if (TRACE) + fprintf(stderr, + "HTML: BASE '%s' is not an absolute URL.\n", (base ? base : "")); if (me->inBadBASE == FALSE) HTAlert(BASE_NOT_ABSOLUTE); @@ -831,7 +815,7 @@ PRIVATE void HTML_start_element ARGS6( case HTML_META: if (present) - LYHandleMETA(me, present, value, include); + LYHandleMETA(me, present, value, (char **)&include); break; case HTML_TITLE: @@ -855,7 +839,7 @@ PRIVATE void HTML_start_element ARGS6( } } else { StrAllocCopy(href, value[HTML_LINK_HREF]); - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); } /* @@ -873,7 +857,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -898,13 +882,15 @@ PRIVATE void HTML_start_element ARGS6( PARSE_ALL); StrAllocCopy(href, temp); FREE(temp); - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, (me->inBASE ? me->base_href : me->node_anchor->address)); } HTAnchor_setOwner(me->node_anchor, href); - CTRACE(tfp, "HTML: DOC OWNER '%s' found\n", href); + if (TRACE) + fprintf(stderr, + "HTML: DOC OWNER '%s' found\n", href); FREE(href); /* @@ -936,7 +922,10 @@ PRIVATE void HTML_start_element ARGS6( */ if (!strcasecomp(value[HTML_LINK_REL], "StyleSheet") || !strcasecomp(value[HTML_LINK_REL], "Style")) { - CTRACE(tfp, "HTML: StyleSheet link found.\n"); + if (TRACE) { + fprintf(stderr, + "HTML: StyleSheet link found.\n"); + } #ifdef LINKEDSTYLES if (href && *href != '\0') { @@ -956,16 +945,18 @@ PRIVATE void HTML_start_element ARGS6( res = style_readFromFile(href); } } - CTRACE(tfp, "CSS: StyleSheet=%s %d\n", href, res); + if (TRACE) + fprintf(stderr, "CSS: StyleSheet=%s %d\n", href, res); if (res == 0) HTAnchor_setStyle (me->node_anchor, href); } - else { - CTRACE(tfp, + else + if (TRACE) + fprintf(stderr, " non-local StyleSheets not yet implemented.\n"); - } #else - CTRACE(tfp, + if (TRACE) + fprintf(stderr, " StyleSheets not yet implemented.\n"); #endif FREE(href); @@ -1021,8 +1012,11 @@ PRIVATE void HTML_start_element ARGS6( !strcasecomp(value[HTML_LINK_REL], "Bibliography")) { StrAllocCopy(title, value[HTML_LINK_REL]); } else { - CTRACE(tfp, "HTML: LINK with REL=\"%s\" ignored.\n", + if (TRACE) { + fprintf(stderr, + "HTML: LINK with REL=\"%s\" ignored.\n", value[HTML_LINK_REL]); + } FREE(href); break; } @@ -1040,8 +1034,11 @@ PRIVATE void HTML_start_element ARGS6( } else if (!strcasecomp(value[HTML_LINK_REL], "Index")) { StrAllocCopy(href, indexfile); } else { - CTRACE(tfp, "HTML: LINK with REL=\"%s\" and no HREF ignored.\n", + if (TRACE) { + fprintf(stderr, + "HTML: LINK with REL=\"%s\" and no HREF ignored.\n", value[HTML_LINK_REL]); + } break; } StrAllocCopy(title, value[HTML_LINK_REL]); @@ -1073,7 +1070,7 @@ PRIVATE void HTML_start_element ARGS6( * fingers. - FM */ SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } /* @@ -1096,13 +1093,12 @@ PRIVATE void HTML_start_element ARGS6( dest_char_set = UCGetLYhndl_byMIME(value[HTML_LINK_CHARSET]); if (dest_char_set < 0) dest_char_set = UCLYhndl_for_unrec; - if (dest_char_set < 0) /* recover if not defined :-( */ - dest_char_set = UCLYhndl_for_unspec; /* always >= 0 */ } - if (dest) + if (dest && dest_char_set >= 0) HTAnchor_setUCInfoStage(dest, dest_char_set, UCT_STAGE_PARSER, UCT_SETBY_LINK); + dest_char_set = -1; } UPDATE_STYLE; if (!HText_hasToolbar(me->text) && @@ -1126,7 +1122,8 @@ PRIVATE void HTML_start_element ARGS6( { char tmp[1024]; sprintf(tmp, "link.%s.%s.%s", value[HTML_LINK_CLASS], title, value[HTML_LINK_CLASS]); - CTRACE(tfp, "CSSTRIM:link=%s\n", tmp); + if (TRACE) + fprintf(stderr, "CSSTRIM:link=%s\n", tmp); HText_characterStyle(me->text, hash_code(tmp), 1); HTML_put_string(me, title); @@ -1163,7 +1160,8 @@ PRIVATE void HTML_start_element ARGS6( StrAllocCopy(isindex_href, value[HTML_ISINDEX_HREF]); else StrAllocCopy(isindex_href, value[HTML_ISINDEX_ACTION]); - url_type = LYLegitimizeHREF(me, &isindex_href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&isindex_href, + TRUE, TRUE); /* * Check whether a base tag is in effect. @@ -1259,7 +1257,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_FRAME_SRC] && *value[HTML_FRAME_SRC] != '\0') { StrAllocCopy(href, value[HTML_FRAME_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); /* * Check whether a base tag is in effect. - FM @@ -1276,14 +1274,14 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -1331,7 +1329,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_IFRAME_SRC] && *value[HTML_IFRAME_SRC] != '\0') { StrAllocCopy(href, value[HTML_IFRAME_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); /* * Check whether a base tag is in effect. - FM @@ -1348,13 +1346,13 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); if (me->inA) - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ NULL, /* Tag */ @@ -1414,8 +1412,8 @@ PRIVATE void HTML_start_element ARGS6( case HTML_DIV: if (me->Division_Level < (MAX_NESTING - 1)) { me->Division_Level++; - } else { - CTRACE(tfp, + } else if (TRACE) { + fprintf(stderr, "HTML: ****** Maximum nesting of %d divisions exceeded!\n", MAX_NESTING); } @@ -1543,20 +1541,13 @@ PRIVATE void HTML_start_element ARGS6( break; case HTML_P: - LYHandleP(me, present, value, include, TRUE); + LYHandleP(me, present, value, (char **)&include, TRUE); break; case HTML_BR: UPDATE_STYLE; CHECK_ID(HTML_GEN_ID); - /* Add a \r (new line) if these three conditions are true: - * 1. We are not collapsing BR's, and - * 2. The previous line has text on it, or - * 3. This line has text on it. - * Otherwise, don't do anything. -DH 980814, TD 980827 - */ - if ((LYCollapseBRs == FALSE && - HText_PreviousLineSize(me->text, FALSE)) || + if ((LYCollapseBRs == FALSE) || HText_LastLineSize(me->text, FALSE)) { HText_setLastChar(me->text, ' '); /* absorb white space */ HText_appendCharacter(me->text, '\r'); @@ -1684,7 +1675,9 @@ PRIVATE void HTML_start_element ARGS6( case HTML_TAB: if (!present) { /* Bad tag. Must have at least one attribute. - FM */ - CTRACE(tfp, "HTML: TAB tag has no attributes. Ignored.\n"); + if (TRACE) + fprintf(stderr, + "HTML: TAB tag has no attributes. Ignored.\n"); break; } UPDATE_STYLE; @@ -1697,7 +1690,9 @@ PRIVATE void HTML_start_element ARGS6( * the ALIGN and DP attributes implemented. - FM */ HTML_put_character(me, ' '); - CTRACE(tfp, "HTML: ALIGN not 'left'. Using space instead of TAB.\n"); + if (TRACE) + fprintf(stderr, + "HTML: ALIGN not 'left'. Using space instead of TAB.\n"); } else if (!LYoverride_default_alignment(me) && me->current_default_alignment != HT_LEFT) { @@ -1708,7 +1703,9 @@ PRIVATE void HTML_start_element ARGS6( * that the alignment be HT_LEFT. - FM */ HTML_put_character(me, ' '); - CTRACE(tfp, "HTML: Not HT_LEFT. Using space instead of TAB.\n"); + if (TRACE) + fprintf(stderr, + "HTML: Not HT_LEFT. Using space instead of TAB.\n"); } else if ((present[HTML_TAB_TO] && value[HTML_TAB_TO] && *value[HTML_TAB_TO]) || @@ -1747,7 +1744,9 @@ PRIVATE void HTML_start_element ARGS6( if (target < column || target > HText_getMaximumColumn(me->text)) { HTML_put_character(me, ' '); - CTRACE(tfp, "HTML: Column out of bounds. Using space instead of TAB.\n"); + if (TRACE) + fprintf(stderr, + "HTML: Column out of bounds. Using space instead of TAB.\n"); } else { for (i = column; i < target; i++) HText_appendCharacter(me->text, ' '); @@ -1790,7 +1789,7 @@ PRIVATE void HTML_start_element ARGS6( */ #ifdef NOTUSED_FOTEMODS if (me->inFONT == TRUE) - HTML_end_element(me, HTML_FONT, &include); + HTML_end_element(me, HTML_FONT, (char **)&include); #endif /* NOTUSED_FOTEMODS */ /* @@ -1816,15 +1815,18 @@ PRIVATE void HTML_start_element ARGS6( * Can't display both underline and bold at same time. */ if (me->inBoldA == TRUE || me->inBoldH == TRUE) { - CTRACE(tfp, "Underline Level is %d\n", me->Underline_Level); + if (TRACE) + fprintf(stderr,"Underline Level is %d\n", me->Underline_Level); break; } if (me->inUnderline == FALSE) { HText_appendCharacter(me->text, LY_UNDERLINE_START_CHAR); me->inUnderline = TRUE; - CTRACE(tfp,"Beginning underline\n"); + if (TRACE) + fprintf(stderr,"Beginning underline\n"); } else { - CTRACE(tfp,"Underline Level is %d\n", me->Underline_Level); + if (TRACE) + fprintf(stderr,"Underline Level is %d\n", me->Underline_Level); } break; @@ -1930,14 +1932,16 @@ PRIVATE void HTML_start_element ARGS6( (!strcasecomp(value[HTML_NOTE_CLASS], "CAUTION") || !strcasecomp(value[HTML_NOTE_CLASS], "WARNING"))) { StrAllocCopy(note, value[HTML_NOTE_CLASS]); - LYUpperCase(note); + for (i = 0; note[i] != '\0'; i++) + note[i] = TOUPPER(note[i]); StrAllocCat(note, ":"); } else if (present && present[HTML_NOTE_ROLE] && value[HTML_NOTE_ROLE] && (!strcasecomp(value[HTML_NOTE_ROLE], "CAUTION") || !strcasecomp(value[HTML_NOTE_ROLE], "WARNING"))) { StrAllocCopy(note, value[HTML_NOTE_ROLE]); - LYUpperCase(note); + for (i = 0; note[i] != '\0'; i++) + note[i] = TOUPPER(note[i]); StrAllocCat(note, ":"); } else { StrAllocCopy(note, "NOTE:"); @@ -2393,7 +2397,7 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } /* * Set to know we are in an anchor. @@ -2440,7 +2444,7 @@ PRIVATE void HTML_start_element ARGS6( } else { StrAllocCopy(href, value[HTML_A_HREF]); } - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); /* * Deal with our ftp gateway kludge. - FM @@ -2448,8 +2452,8 @@ PRIVATE void HTML_start_element ARGS6( if (!url_type && !strncmp(href, "/foo/..", 7) && (!strncmp(me->node_anchor->address, "ftp:", 4) || !strncmp(me->node_anchor->address, "file:", 5))) { - for (i = 0; (href[i] = href[i+7]) != 0; i++) - ; + for (i = 0; href[i]; i++) + href[i] = href[i+7]; } /* @@ -2472,7 +2476,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -2492,7 +2496,9 @@ PRIVATE void HTML_start_element ARGS6( ** Found TYPE="internal link" but not in a valid context ** where we have written it. - kw */ - CTRACE(tfp, "HTML: Found invalid HREF=\"%s\" TYPE=\"%s\"!\n", + if (TRACE) + fprintf(stderr, + "HTML: Found invalid HREF=\"%s\" TYPE=\"%s\"!\n", href, temp); FREE(temp); } @@ -2533,8 +2539,6 @@ PRIVATE void HTML_start_element ARGS6( dest_char_set = UCGetLYhndl_byMIME(temp); if (dest_char_set < 0) { dest_char_set = UCLYhndl_for_unrec; - if (dest_char_set < 0) /* recover if not defined :-( */ - dest_char_set = UCLYhndl_for_unspec; /* always >= 0 */ } } if (title != NULL || dest_ismap == TRUE || dest_char_set >= 0) { @@ -2546,7 +2550,7 @@ PRIVATE void HTML_start_element ARGS6( HTAnchor_setTitle(dest, title); if (dest && dest_ismap) dest->isISMAPScript = TRUE; - if (dest) { + if (dest && dest_char_set >= 0) { /* ** Load the anchor's chartrans structures. ** This should be done more intelligently @@ -2563,6 +2567,7 @@ PRIVATE void HTML_start_element ARGS6( FREE(temp); dest = NULL; dest_ismap = FALSE; + dest_char_set = -1; FREE(title); } me->CurrentANum = HText_beginAnchor(me->text, @@ -2577,7 +2582,7 @@ PRIVATE void HTML_start_element ARGS6( */ if (href == NULL && me->inBoldA == FALSE) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, &include); + HTML_end_element(me, HTML_A, (char **)&include); } #endif /* NOTUSED_FOTEMODS */ FREE(href); @@ -2596,12 +2601,16 @@ PRIVATE void HTML_start_element ARGS6( )) != NULL) { if (dest->isISMAPScript == TRUE) { dest_ismap = TRUE; - CTRACE(tfp, "HTML: '%s' is an ISMAP script\n", + if (TRACE) + fprintf(stderr, + "HTML: '%s' is an ISMAP script\n", dest->address); } else if (present && present[HTML_IMG_ISMAP]) { dest_ismap = TRUE; dest->isISMAPScript = TRUE; - CTRACE(tfp, "HTML: Designating '%s' as an ISMAP script\n", + if (TRACE) + fprintf(stderr, + "HTML: Designating '%s' as an ISMAP script\n", dest->address); } } @@ -2617,7 +2626,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_IMG_USEMAP] && *value[HTML_IMG_USEMAP]) { StrAllocCopy(map_href, value[HTML_IMG_USEMAP]); CHECK_FOR_INTERN(map_href); - url_type = LYLegitimizeHREF(me, &map_href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&map_href, TRUE, TRUE); /* * If map_href ended up zero-length or otherwise doesn't * have a hash, it can't be valid, so ignore it. - FM @@ -2665,7 +2674,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&map_href, + LYFillLocalFileURL((char **)&map_href, ((UseBASE && me->inBASE) ? me->base_href : me->node_anchor->address)); UseBASE = TRUE; @@ -2734,16 +2743,16 @@ PRIVATE void HTML_start_element ARGS6( LYTrimTail(alt_string); if (*alt_string == '\0') { if (map_href) { - StrAllocCopy(alt_string, (title ? title : - MakeNewMapValue(value,"USEMAP"))); + StrAllocCopy(alt_string, (title ? + title : "[USEMAP]")); } else if (dest_ismap) { - StrAllocCopy(alt_string, (title ? title : - MakeNewMapValue(value,"ISMAP"))); + StrAllocCopy(alt_string, (title ? + title : "[ISMAP]")); } else if (me->inA == TRUE && dest) { StrAllocCopy(alt_string, (title ? title : - VERBOSE_IMG(value, HTML_IMG_SRC, "[LINK]"))); + VERBOSE_IMG(value, "[LINK]"))); } else { StrAllocCopy(alt_string, @@ -2751,24 +2760,24 @@ PRIVATE void HTML_start_element ARGS6( ((present && present[HTML_IMG_ISOBJECT]) ? "(OBJECT)" : - VERBOSE_IMG(value, HTML_IMG_SRC, "[INLINE]")))); + VERBOSE_IMG(value, "[INLINE]")))); } } } } else if (map_href) { - StrAllocCopy(alt_string, (title ? title : - MakeNewMapValue(value,"USEMAP"))); + StrAllocCopy(alt_string, (title ? + title : "[USEMAP]")); } else if ((dest_ismap == TRUE) || (me->inA && present && present[HTML_IMG_ISMAP])) { - StrAllocCopy(alt_string, (title ? title : - MakeNewMapValue(value,"ISMAP"))); + StrAllocCopy(alt_string, (title ? + title : "[ISMAP]")); } else if (me->inA == TRUE && dest) { StrAllocCopy(alt_string, (title ? title : - VERBOSE_IMG(value, HTML_IMG_SRC, "[LINK]"))); + VERBOSE_IMG(value, "[LINK]"))); } else { if (pseudo_inline_alts || clickable_images) @@ -2776,19 +2785,22 @@ PRIVATE void HTML_start_element ARGS6( ((present && present[HTML_IMG_ISOBJECT]) ? "(OBJECT)" : - VERBOSE_IMG(value, HTML_IMG_SRC, "[INLINE]")))); + VERBOSE_IMG(value, "[INLINE]")))); else StrAllocCopy(alt_string, (title ? title : "")); } if (*alt_string == '\0' && map_href) { - StrAllocCopy(alt_string, MakeNewMapValue(value,"USEMAP")); + StrAllocCopy(alt_string, "[USEMAP]"); } - CTRACE(tfp, "HTML IMG: USEMAP=%d ISMAP=%d ANCHOR=%d PARA=%d\n", + if (TRACE) { + fprintf(stderr, + "HTML IMG: USEMAP=%d ISMAP=%d ANCHOR=%d PARA=%d\n", map_href ? 1 : 0, (dest_ismap == TRUE) ? 1 : 0, me->inA, me->inP); + } /* * Check for an ID attribute. - FM @@ -2809,7 +2821,7 @@ PRIVATE void HTML_start_element ARGS6( present && present[HTML_IMG_SRC] && value[HTML_IMG_SRC] && *value[HTML_IMG_SRC] != '\0') { StrAllocCopy(href, value[HTML_IMG_SRC]); - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); /* * Check whether a base tag is in effect. - FM @@ -2826,7 +2838,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -2844,7 +2856,7 @@ PRIVATE void HTML_start_element ARGS6( if (dest_ismap) { HTML_put_character(me, ' '); me->in_word = NO; - HTML_put_string(me, MakeNewMapValue(value,"ISMAP")); + HTML_put_string(me, "[ISMAP]"); } else if (dest) { HTML_put_character(me, ' '); me->in_word = NO; @@ -2905,7 +2917,7 @@ PRIVATE void HTML_start_element ARGS6( present[HTML_IMG_ISOBJECT]) ? ((map_href || dest_ismap) ? "(IMAGE)" : "(OBJECT)") : - VERBOSE_IMG(value, HTML_IMG_SRC, "[IMAGE]"))); + VERBOSE_IMG(value, "[IMAGE]"))); if (id_string && !map_href) { if ((ID_A = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -2960,7 +2972,7 @@ PRIVATE void HTML_start_element ARGS6( ((present && present[HTML_IMG_ISOBJECT]) ? "(IMAGE)" : - VERBOSE_IMG(value, HTML_IMG_SRC, "[IMAGE]"))); + VERBOSE_IMG(value, "[IMAGE]"))); } else { HTML_put_character(me, ' '); /* space char may be ignored */ me->in_word = NO; @@ -3012,7 +3024,7 @@ PRIVATE void HTML_start_element ARGS6( if (dest_ismap) { HTML_put_character(me, ' ');/* space char may be ignored */ me->in_word = NO; - HTML_put_string(me, MakeNewMapValue(value,"ISMAP")); + HTML_put_string(me, "[ISMAP]"); } else if (dest) { HTML_put_character(me, ' ');/* space char may be ignored */ me->in_word = NO; @@ -3151,7 +3163,7 @@ PRIVATE void HTML_start_element ARGS6( */ StrAllocCopy(href, value[HTML_AREA_HREF]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); /* * Check whether a BASE tag is in effect, and use it @@ -3173,7 +3185,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((((me->inBASE && *href != '\0') && !(*href == '#' && LYSeekFragAREAinCur == TRUE))) @@ -3256,7 +3268,7 @@ PRIVATE void HTML_start_element ARGS6( me->inFIG = TRUE; if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } if (!present || (present && !present[HTML_FIG_ISOBJECT])) { @@ -3275,7 +3287,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_FIG_SRC] && *value[HTML_FIG_SRC] != '\0') { StrAllocCopy(href, value[HTML_FIG_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); if (*href) { /* * Check whether a base tag is in effect. - FM @@ -3292,7 +3304,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -3435,7 +3447,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_OVERLAY_SRC] && *value[HTML_OVERLAY_SRC] != '\0') { StrAllocCopy(href, value[HTML_OVERLAY_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); if (*href) { /* * Check whether a base tag is in effect. - FM @@ -3452,14 +3464,14 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -3548,20 +3560,21 @@ PRIVATE void HTML_start_element ARGS6( if (present[HTML_APPLET_CODEBASE] && value[HTML_APPLET_CODEBASE] && *value[HTML_APPLET_CODEBASE]) { StrAllocCopy(base, value[HTML_APPLET_CODEBASE]); - LYRemoveBlanks(base); + collapse_spaces(base); TRANSLATE_AND_UNESCAPE_TO_STD(&base); /* * Force it to be a directory. - FM */ if (*base == '\0') StrAllocCopy(base, "/"); - LYAddHtmlSep(&base); - url_type = LYLegitimizeHREF(me, &base, TRUE, FALSE); + if (base[strlen(base)-1] != '/') + StrAllocCat(base, "/"); + url_type = LYLegitimizeHREF(me, (char**)&base, TRUE, FALSE); /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&base, + LYFillLocalFileURL((char **)&base, (me->inBASE ? me->base_href : me->node_anchor->address)); @@ -3587,7 +3600,7 @@ PRIVATE void HTML_start_element ARGS6( } StrAllocCopy(code, value[HTML_APPLET_CODE]); - url_type = LYLegitimizeHREF(me, &code, TRUE, FALSE); + url_type = LYLegitimizeHREF(me, (char**)&code, TRUE, FALSE); href = HTParse(code, base, PARSE_ALL); FREE(base); FREE(code); @@ -3640,7 +3653,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_BGSOUND_SRC] && *value[HTML_BGSOUND_SRC] != '\0') { StrAllocCopy(href, value[HTML_BGSOUND_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); if (*href == '\0') { FREE(href); break; @@ -3661,7 +3674,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -3754,7 +3767,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_EMBED_SRC] && *value[HTML_EMBED_SRC] != '\0') { StrAllocCopy(href, value[HTML_EMBED_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); if (*href != '\0') { /* * Check whether a base tag is in effect. - FM @@ -3771,7 +3784,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -3898,9 +3911,12 @@ PRIVATE void HTML_start_element ARGS6( * that one now. - FM */ if (me->inFORM) { - CTRACE(tfp, "HTML: Missing FORM end tag. Faking it!\n"); + if (TRACE) { + fprintf(stderr, + "HTML: Missing FORM end tag. Faking it!\n"); + } SET_SKIP_STACK(HTML_FORM); - HTML_end_element(me, HTML_FORM, include); + HTML_end_element(me, HTML_FORM, (char **)&include); } /* @@ -3918,7 +3934,7 @@ PRIVATE void HTML_start_element ARGS6( * Prepare to do housekeeping on the reference. - FM */ StrAllocCopy(action, value[HTML_FORM_ACTION]); - url_type = LYLegitimizeHREF(me, &action, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&action, TRUE, TRUE); /* * Check whether a base tag is in effect. Note that @@ -3979,7 +3995,11 @@ PRIVATE void HTML_start_element ARGS6( if (present && present[HTML_FORM_ENCTYPE] && value[HTML_FORM_ENCTYPE] && *value[HTML_FORM_ENCTYPE]) { StrAllocCopy(enctype, value[HTML_FORM_ENCTYPE]); - LYLowerCase(enctype); + /* + * Force the enctype value to all lower case. - FM + */ + for (cp = enctype; *cp; cp++) + *cp = TOLOWER(*cp); } if (present) { @@ -4073,11 +4093,12 @@ PRIVATE void HTML_start_element ARGS6( */ if (!me->inFORM) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: BUTTON tag not within FORM tag\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } /* * We'll process it, since the chances of a crash are @@ -4227,7 +4248,6 @@ PRIVATE void HTML_start_element ARGS6( int chars; BOOL UseALTasVALUE = FALSE; BOOL HaveSRClink = FALSE; - char* ImageSrc = NULL; BOOL IsSubmitOrReset = FALSE; /* init */ @@ -4280,7 +4300,8 @@ PRIVATE void HTML_start_element ARGS6( if (me->inFORM) HText_DisableCurrentForm(); #endif /* NOTDEFINED */ - CTRACE(tfp, "HTML: Ignoring TYPE=\"range\"\n"); + if (TRACE) + fprintf(stderr, "HTML: Ignoring TYPE=\"range\"\n"); break; } else if (!strcasecomp(I.type, "file")) { @@ -4302,7 +4323,8 @@ PRIVATE void HTML_start_element ARGS6( if (me->inFORM) HText_DisableCurrentForm(); #endif /* NOTDEFINED */ - CTRACE(tfp, "HTML: Ignoring TYPE=\"file\"\n"); + if (TRACE) + fprintf(stderr, "HTML: Ignoring TYPE=\"file\"\n"); break; } else if (!strcasecomp(I.type, "button")) { @@ -4319,11 +4341,12 @@ PRIVATE void HTML_start_element ARGS6( */ if (!me->inFORM) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: INPUT tag not within FORM tag\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } /* * We'll process it, since the chances of a crash are @@ -4338,11 +4361,12 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inTEXTAREA) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: Missing TEXTAREA end tag.\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } } @@ -4350,11 +4374,13 @@ PRIVATE void HTML_start_element ARGS6( * Check for an unclosed SELECT, try to close it if found. */ if (me->inSELECT) { - CTRACE(tfp, "HTML: Missing SELECT end tag, faking it...\n"); + if (TRACE) { + fprintf(stderr, "HTML: Missing SELECT end tag, faking it...\n"); + } if (me->sp->tag_number != HTML_SELECT) { SET_SKIP_STACK(HTML_SELECT); } - HTML_end_element(me, HTML_SELECT, include); + HTML_end_element(me, HTML_SELECT, (char **)&include); } /* @@ -4384,12 +4410,7 @@ PRIVATE void HTML_start_element ARGS6( */ UseALTasVALUE = TRUE; } - if (verbose_img && !clickable_images && - present && present[HTML_INPUT_SRC] && - value[HTML_INPUT_SRC] && *value[HTML_INPUT_SRC] && - I.type && !strcasecomp(I.type, "image")) { - ImageSrc = MakeNewImageValue(value); - } else if (clickable_images == TRUE && + if (clickable_images == TRUE && present && present[HTML_INPUT_SRC] && value[HTML_INPUT_SRC] && *value[HTML_INPUT_SRC] && I.type && !strcasecomp(I.type, "image")) { @@ -4400,7 +4421,7 @@ PRIVATE void HTML_start_element ARGS6( * SRC's value a link if it's still not zero-length * legitiimizing it. - FM */ - url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); if (*href) { /* * Check whether a base tag is in effect. - FM @@ -4417,7 +4438,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL(&href, + LYFillLocalFileURL((char **)&href, ((*href != '#' && me->inBASE) ? me->base_href : @@ -4425,7 +4446,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -4435,7 +4456,7 @@ PRIVATE void HTML_start_element ARGS6( HText_beginAnchor(me->text, me->inUnderline, me->CurrentA); if (me->inBoldH == FALSE) HText_appendCharacter(me->text, LY_BOLD_START_CHAR); - HTML_put_string(me, VERBOSE_IMG(value,HTML_INPUT_SRC,"[IMAGE]")); + HTML_put_string(me, VERBOSE_IMG(value, "[IMAGE]")); if (me->inBoldH == FALSE) HText_appendCharacter(me->text, LY_BOLD_END_CHAR); HText_endAnchor(me->text, 0); @@ -4458,7 +4479,7 @@ PRIVATE void HTML_start_element ARGS6( if (I.type && !strcasecomp(I.type, "hidden")) { me->HiddenValue = TRUE; - current_char_set = LATIN1; /* Default ISO-Latin1 */ + current_char_set = 0; /* Default ISO-Latin1 */ LYUseDefaultRawMode = TRUE; HTMLSetCharacterHandling(current_char_set); } @@ -4516,11 +4537,6 @@ PRIVATE void HTML_start_element ARGS6( */ StrAllocCopy(I_value, "Submit"); I.value = I_value; - } else if ( ImageSrc ) { - /* [IMAGE]-Submit with verbose images and not clickable images. - * Use ImageSrc if no other alt or value is supplied. --LE - */ - I.value = ImageSrc; } if (present && present[HTML_INPUT_CHECKED]) I.checked = YES; @@ -4698,11 +4714,12 @@ PRIVATE void HTML_start_element ARGS6( */ if (!me->inFORM) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: TEXTAREA start tag not within FORM tag\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } /* * Too likely to cause a crash, so we'll ignore it. - FM @@ -4788,16 +4805,17 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inSELECT) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: SELECT start tag in SELECT element. Faking SELECT end tag. *****\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } if (me->sp->tag_number != HTML_SELECT) { SET_SKIP_STACK(HTML_SELECT); } - HTML_end_element(me, HTML_SELECT, include); + HTML_end_element(me, HTML_SELECT, (char **)&include); } /* @@ -4805,7 +4823,7 @@ PRIVATE void HTML_start_element ARGS6( */ LYHandleSELECT(me, present, (CONST char **)value, - include, + (char **)&include, TRUE); break; @@ -4821,11 +4839,12 @@ PRIVATE void HTML_start_element ARGS6( */ if (!me->inSELECT) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: OPTION tag not within SELECT tag\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } /* @@ -5021,11 +5040,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, include); + HTML_end_element(me, HTML_U, (char **)&include); } me->inTABLE = TRUE; if (!strcmp(me->sp->style->name, "Preformatted")) { @@ -5035,8 +5054,8 @@ PRIVATE void HTML_start_element ARGS6( } if (me->Division_Level < (MAX_NESTING - 1)) { me->Division_Level++; - } else { - CTRACE(tfp, + } else if (TRACE) { + fprintf(stderr, "HTML: ****** Maximum nesting of %d divisions/tables exceeded!\n", MAX_NESTING); } @@ -5075,11 +5094,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, include); + HTML_end_element(me, HTML_U, (char **)&include); } UPDATE_STYLE; if (HText_LastLineSize(me->text, FALSE)) { @@ -5127,11 +5146,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, include); + HTML_end_element(me, HTML_U, (char **)&include); } UPDATE_STYLE; CHECK_ID(HTML_TR_ID); @@ -5144,11 +5163,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, include); + HTML_end_element(me, HTML_U, (char **)&include); } UPDATE_STYLE; CHECK_ID(HTML_COL_ID); @@ -5157,11 +5176,11 @@ PRIVATE void HTML_start_element ARGS6( case HTML_TH: if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, include); + HTML_end_element(me, HTML_U, (char **)&include); } UPDATE_STYLE; CHECK_ID(HTML_TD_ID); @@ -5175,11 +5194,11 @@ PRIVATE void HTML_start_element ARGS6( case HTML_TD: if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, include); + HTML_end_element(me, HTML_A, (char **)&include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, include); + HTML_end_element(me, HTML_U, (char **)&include); } UPDATE_STYLE; CHECK_ID(HTML_TD_ID); @@ -5204,12 +5223,11 @@ PRIVATE void HTML_start_element ARGS6( } /* end switch */ -#if defined(DICKEY_TEST) - if (HTML_dtd.tags[ElementNumber].contents != SGML_EMPTY) -#endif - { + if (HTML_dtd.tags[ElementNumber].contents != SGML_EMPTY) { if (me->skip_stack > 0) { - CTRACE(tfp, "HTML:begin_element: internal call (level %d), leaving on stack - %s\n", + if (TRACE) + fprintf(stderr, + "HTML:begin_element: internal call (level %d), leaving on stack - %s\n", me->skip_stack, me->sp->style->name); me->skip_stack--; return; @@ -5217,7 +5235,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->sp == me->stack) { if (me->stack_overrun == FALSE) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "HTML: ****** Maximum nesting of %d tags exceeded!\n", MAX_NESTING); @@ -5229,19 +5247,21 @@ PRIVATE void HTML_start_element ARGS6( return; } - CTRACE(tfp,"HTML:begin_element[%d]: adding style to stack - %s\n", - (int) STACKLEVEL(me), - me->new_style->name); (me->sp)--; me->sp[0].style = me->new_style; /* Stack new style */ me->sp[0].tag_number = ElementNumber; + + if (TRACE) + fprintf(stderr,"HTML:begin_element: adding style to stack - %s\n", + me->new_style->name); } -#if defined(DICKEY_TEST) && defined(USE_COLOR_STYLE) +#if defined(USE_COLOR_STYLE) /* end empty tags straight away */ if (HTML_dtd.tags[ElementNumber].contents == SGML_EMPTY) { - CTRACE(tfp, "STYLE:begin_element:ending EMPTY element style\n"); + if (TRACE) + fprintf(stderr, "STYLE:begin_element:ending EMPTY element style\n"); #if !defined(USE_HASH) HText_characterStyle(me->text, element_number+STARTAT, STACK_OFF); #else @@ -5268,12 +5288,14 @@ PRIVATE void HTML_start_element ARGS6( #if defined(PREVAIL) start=strrchr(Style_className, '.'); if (start) - strcpy(prevailing_class, (start+1)); + strcpy(prevailing_class, (char*)(start+1)); else strcpy(prevailing_class, ""); #endif - CTRACE(tfp, "CSS:%s (trimmed %s, SGML_EMPTY)\n", Style_className, tmp); + + if (TRACE) + fprintf(stderr, "CSS:%s (trimmed %s, SGML_EMPTY)\n", Style_className, tmp); } } #endif /* USE_COLOR_STYLE */ @@ -5305,7 +5327,7 @@ PRIVATE void HTML_end_element ARGS3( #ifdef CAREFUL /* parser assumed to produce good nesting */ if (element_number != me->sp[0].tag_number && HTML_dtd.tags[element_number].contents != SGML_EMPTY) { - CTRACE(tfp, + fprintf(stderr, "HTMLText: end of element %s when expecting end of %s\n", HTML_dtd.tags[element_number].name, HTML_dtd.tags[me->sp->tag_number].name); @@ -5349,7 +5371,9 @@ PRIVATE void HTML_end_element ARGS3( BreakFlag = TRUE; } if (me->skip_stack > 0) { - CTRACE(tfp, "HTML:end_element: Internal call (level %d), leaving on stack - %s\n", + if (TRACE) + fprintf(stderr, + "HTML:end_element: Internal call (level %d), leaving on stack - %s\n", me->skip_stack, me->sp->style->name); me->skip_stack--; } else if (me->stack_overrun == TRUE && @@ -5395,11 +5419,13 @@ PRIVATE void HTML_end_element ARGS3( return; } else if (me->sp < (me->stack + MAX_NESTING - 1)) { (me->sp)++; - CTRACE(tfp, "HTML:end_element[%d]: Popped style off stack - %s\n", - (int) STACKLEVEL(me), + if (TRACE) + fprintf(stderr, + "HTML:end_element: Popped style off stack - %s\n", me->sp->style->name); } else { - CTRACE(tfp, + if (TRACE) + fprintf(stderr, "Stack underflow error! Tried to pop off more styles than exist in stack\n"); } } @@ -5411,10 +5437,11 @@ PRIVATE void HTML_end_element ARGS3( */ if (me->inTEXTAREA && element_number != HTML_TEXTAREA) { if (TRACE) { - fprintf(tfp, "Bad HTML: Missing TEXTAREA end tag\n"); + fprintf(stderr, "Bad HTML: Missing TEXTAREA end tag\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } } @@ -5428,9 +5455,9 @@ PRIVATE void HTML_end_element ARGS3( switch(element_number) { case HTML_HTML: - if (me->inA || me->inSELECT || me->inTEXTAREA) { + if (me->inA || me->inSELECT || me->inTEXTAREA) if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: %s%s%s%s%s not closed before HTML end tag *****\n", me->inSELECT ? "SELECT" : "", (me->inSELECT && me->inTEXTAREA) ? ", " : "", @@ -5438,10 +5465,10 @@ PRIVATE void HTML_end_element ARGS3( ((me->inSELECT || me->inTEXTAREA) && me->inA) ? ", " : "", me->inA ? "A" : ""); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } - } break; case HTML_HEAD: @@ -5488,7 +5515,7 @@ PRIVATE void HTML_end_element ARGS3( ((MBM_A_subdescript[i] && *MBM_A_subdescript[i]) ? MBM_A_subdescript[i] : "(none)")); - LYEntify(&temp, TRUE); + LYEntify((char **)&temp, TRUE); StrAllocCat(*include, temp); StrAllocCat(*include, "<BR><EM> Filepath:</EM> "); @@ -5496,7 +5523,7 @@ PRIVATE void HTML_end_element ARGS3( ((MBM_A_subbookmark[i] && *MBM_A_subbookmark[i]) ? MBM_A_subbookmark[i] : "(unknown)")); - LYEntify(&temp, TRUE); + LYEntify((char **)&temp, TRUE); StrAllocCat(*include, temp); FREE(temp); StrAllocCat(*include, "</H2>"); @@ -5513,8 +5540,10 @@ PRIVATE void HTML_end_element ARGS3( * we'll just ignore. - FM */ HTChunkTerminate(&me->style_block); - CTRACE(tfp, "HTML: STYLE content =\n%s\n", + if (TRACE) { + fprintf(stderr, "HTML: STYLE content =\n%s\n", me->style_block.data); + } HTChunkClear(&me->style_block); break; @@ -5524,15 +5553,17 @@ PRIVATE void HTML_end_element ARGS3( * we'll just ignore. - FM */ HTChunkTerminate(&me->script); - CTRACE(tfp, "HTML: SCRIPT content =\n%s\n", + if (TRACE) { + fprintf(stderr, "HTML: SCRIPT content =\n%s\n", me->script.data); + } HTChunkClear(&me->script); break; case HTML_BODY: - if (me->inA || me->inSELECT || me->inTEXTAREA) { + if (me->inA || me->inSELECT || me->inTEXTAREA) if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: %s%s%s%s%s not closed before BODY end tag *****\n", me->inSELECT ? "SELECT" : "", (me->inSELECT && me->inTEXTAREA) ? ", " : "", @@ -5540,10 +5571,10 @@ PRIVATE void HTML_end_element ARGS3( ((me->inSELECT || me->inTEXTAREA) && me->inA) ? ", " : "", me->inA ? "A" : ""); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } - } break; case HTML_FRAMESET: @@ -5625,7 +5656,7 @@ PRIVATE void HTML_end_element ARGS3( case HTML_P: LYHandleP(me, (CONST BOOL*)0, (CONST char **)0, - include, + (char **)&include, FALSE); break; @@ -5656,9 +5687,11 @@ PRIVATE void HTML_end_element ARGS3( if (me->inUnderline && me->Underline_Level < 1) { HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR); me->inUnderline = FALSE; - CTRACE(tfp, "Ending underline\n"); + if (TRACE) + fprintf(stderr,"Ending underline\n"); } else { - CTRACE(tfp, "Underline Level is %d\n", me->Underline_Level); + if (TRACE) + fprintf(stderr,"Underline Level is %d\n", me->Underline_Level); } break; @@ -5754,8 +5787,11 @@ PRIVATE void HTML_end_element ARGS3( case HTML_MENU: case HTML_DIR: me->List_Nesting_Level--; - CTRACE(tfp, "HTML_end_element: Reducing List Nesting Level to %d\n", + if (TRACE) { + fprintf(stderr, + "HTML_end_element: Reducing List Nesting Level to %d\n", me->List_Nesting_Level); + } change_paragraph_style(me, me->sp->style); /* Often won't really change */ UPDATE_STYLE; if (me->List_Nesting_Level >= 0) @@ -5879,7 +5915,8 @@ PRIVATE void HTML_end_element ARGS3( * pass a dummy start tag to the SGML parser so that it * will resume the accumulation of OBJECT content. - FM */ - CTRACE(tfp, "HTML: Nested OBJECT tags. Recycling.\n"); + if (TRACE) + fprintf(stderr, "HTML: Nested OBJECT tags. Recycling.\n"); if (*include == NULL) { StrAllocCopy(*include, "<OBJECT>"); } else { @@ -5898,12 +5935,13 @@ PRIVATE void HTML_end_element ARGS3( * we have bad HTML or otherwise misparsed. - FM */ if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: Unmatched OBJECT start and end tags. Discarding content:\n%s\n", me->object.data); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } goto End_Object; } @@ -5913,7 +5951,8 @@ PRIVATE void HTML_end_element ARGS3( * assuming we weren't tripped up by comments * or quoted attributes. - FM */ - CTRACE(tfp, "HTML:OBJECT content:\n%s\n", me->object.data); + if (TRACE) + fprintf(stderr, "HTML:OBJECT content:\n%s\n", me->object.data); /* * OBJECTs with DECLARE should be saved but @@ -5926,7 +5965,8 @@ PRIVATE void HTML_end_element ARGS3( if (me->object_declare == TRUE) { if (me->object_id && *me->object_id) LYHandleID(me, me->object_id); - CTRACE(tfp, "HTML: DECLAREd OBJECT. Ignoring!\n"); + if (TRACE) + fprintf(stderr, "HTML: DECLAREd OBJECT. Ignoring!\n"); goto End_Object; } @@ -5939,7 +5979,8 @@ PRIVATE void HTML_end_element ARGS3( if (me->object_name != NULL) { if (me->object_id && *me->object_id) LYHandleID(me, me->object_id); - CTRACE(tfp, "HTML: NAMEd OBJECT. Ignoring!\n"); + if (TRACE) + fprintf(stderr, "HTML: NAMEd OBJECT. Ignoring!\n"); goto End_Object; } @@ -5965,19 +6006,22 @@ PRIVATE void HTML_end_element ARGS3( } StrAllocCat(data, "</OBJECT>"); StrAllocCat(*include, data); - CTRACE(tfp, "HTML: Recycling nested OBJECT%s.\n", + if (TRACE) + fprintf(stderr, "HTML: Recycling nested OBJECT%s.\n", (e > 1) ? "s" : ""); FREE(data); goto End_Object; } else { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: Unmatched OBJECT start and end tags. Discarding content.\n"); + goto End_Object; } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); + goto End_Object; } - goto End_Object; } } @@ -5985,7 +6029,9 @@ PRIVATE void HTML_end_element ARGS3( * If it's content has SHAPES, convert it to FIG. - FM */ if (me->object_shapes == TRUE) { - CTRACE(tfp, "HTML: OBJECT has SHAPES. Converting to FIG.\n"); + if (TRACE) + fprintf(stderr, + "HTML: OBJECT has SHAPES. Converting to FIG.\n"); StrAllocCat(*include, "<FIG ISOBJECT IMAGEMAP"); if (me->object_ismap == TRUE) StrAllocCat(*include, " IMAGEMAP"); @@ -6013,7 +6059,9 @@ PRIVATE void HTML_end_element ARGS3( * convert it to IMG. - FM */ if (me->object_usemap != NULL) { - CTRACE(tfp, "HTML: OBJECT has USEMAP. Converting to IMG.\n"); + if (TRACE) + fprintf(stderr, + "HTML: OBJECT has USEMAP. Converting to IMG.\n"); StrAllocCat(*include, "<IMG ISOBJECT"); if (me->object_id != NULL) { @@ -6170,10 +6218,11 @@ End_Object: */ if (!me->inFORM) { if (TRACE) { - fprintf(tfp, "Bad HTML: Unmatched FORM end tag\n"); + fprintf(stderr, "Bad HTML: Unmatched FORM end tag\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } } @@ -6190,16 +6239,17 @@ End_Object: */ if (me->inSELECT) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: Open SELECT at FORM end. Faking SELECT end tag. *****\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } if (me->sp->tag_number != HTML_SELECT) { SET_SKIP_STACK(HTML_SELECT); } - HTML_end_element(me, HTML_SELECT, include); + HTML_end_element(me, HTML_SELECT, (char **)&include); } /* @@ -6248,10 +6298,11 @@ End_Object: */ if (!me->inTEXTAREA) { if (TRACE) { - fprintf(tfp, "Bad HTML: Unmatched TEXTAREA end tag\n"); + fprintf(stderr, "Bad HTML: Unmatched TEXTAREA end tag\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } break; } @@ -6427,10 +6478,11 @@ End_Object: */ if (!me->inSELECT) { if (TRACE) { - fprintf(tfp, "Bad HTML: Unmatched SELECT end tag *****\n"); + fprintf(stderr, "Bad HTML: Unmatched SELECT end tag *****\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } break; } @@ -6450,11 +6502,12 @@ End_Object: */ if (!me->inFORM) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: SELECT end tag not within FORM element *****\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } /* * Hopefully won't crash, so we'll ignore it. - kw @@ -6631,15 +6684,15 @@ End_Object: */ if (end) *end='\0'; - hcode = hash_code(lookfrom && *lookfrom ? lookfrom : &tmp[1]); - CTRACE(tfp, "CSS:%s (trimmed %s, END_ELEMENT)\n", Style_className, tmp); + hcode=hash_code(lookfrom && *lookfrom ? lookfrom : &tmp[1]); + if (TRACE) + fprintf(stderr, "CSS:%s (trimmed %s, END_ELEMENT)\n", Style_className, tmp); } -#if defined(DICKEY_TEST) if (HTML_dtd.tags[element_number].contents != SGML_EMPTY) -#endif { - CTRACE(tfp, "STYLE:end_element: ending non-EMPTY style\n"); + if (TRACE) + fprintf(stderr, "STYLE:end_element: ending non-EMPTY style\n"); #if !defined(USE_HASH) HText_characterStyle(me->text, element_number+STARTAT, STACK_OFF); #else @@ -6650,7 +6703,7 @@ End_Object: { char *dot=strrchr(Style_className,'.'); LYstrncpy(prevailing_class, - dot ? (dot+1) : "", + dot ? (char*)(dot+1) : "", (TEMPSTRINGSIZE - 1)); } #endif @@ -6726,18 +6779,19 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR); me->inUnderline = FALSE; me->Underline_Level = 0; - CTRACE(tfp,"HTML_free: Ending underline\n"); + if (TRACE) + fprintf(stderr,"HTML_free: Ending underline\n"); } if (me->inA) { - HTML_end_element(me, HTML_A, &include); + HTML_end_element(me, HTML_A, (char **)&include); me->inA = FALSE; } if (me->inFONT) { - HTML_end_element(me, HTML_FONT, &include); + HTML_end_element(me, HTML_FONT, (char **)&include); me->inFONT = FALSE; } if (me->inFORM) { - HTML_end_element(me, HTML_FORM, &include); + HTML_end_element(me, HTML_FORM, (char **)&include); me->inFORM = FALSE; } if (me->option.size > 0) { @@ -6747,18 +6801,20 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) * have gone very wrong. - kw */ if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: SELECT or OPTION not ended properly *****\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } HTChunkTerminate(&me->option); /* * Output the left-over data as text, maybe it was invalid * markup meant to be shown somewhere. - kw */ - CTRACE(tfp, "HTML_free: ***** leftover option data: %s\n", + if (TRACE) + fprintf(stderr, "HTML_free: ***** leftover option data: %s\n", me->option.data); HTML_put_string(me, me->option.data); HTChunkClear(&me->option); @@ -6770,18 +6826,20 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) * have gone very wrong. - kw */ if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: TEXTAREA not used properly *****\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } HTChunkTerminate(&me->textarea); /* * Output the left-over data as text, maybe it was invalid * markup meant to be shown somewhere. - kw */ - CTRACE(tfp, "HTML_free: ***** leftover textarea data: %s\n", + if (TRACE) + fprintf(stderr, "HTML_free: ***** leftover textarea data: %s\n", me->textarea.data); HTML_put_string(me, me->textarea.data); HTChunkClear(&me->textarea); @@ -6794,14 +6852,14 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) if (!dump_output_immediately && HText_sourceAnchors(me->text) < 1 && HText_HiddenLinkCount(me->text) > 0) { - HTML_start_element(me, HTML_P, 0, 0, -1, &include); + HTML_start_element(me, HTML_P, 0, 0, -1, (char **)&include); HTML_put_character(me, '['); - HTML_start_element(me, HTML_EM, 0, 0, -1, &include); + HTML_start_element(me, HTML_EM, 0, 0, -1, (char **)&include); HTML_put_string(me, "Document has only hidden links. Use the 'l'ist command."); - HTML_end_element(me, HTML_EM, &include); + HTML_end_element(me, HTML_EM, (char **)&include); HTML_put_character(me, ']'); - HTML_end_element(me, HTML_P, &include); + HTML_end_element(me, HTML_P, (char **)&include); } /* @@ -6816,15 +6874,16 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) * have gone very wrong. - kw */ if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: SELECT or OPTION not ended properly *****\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } if (TRACE) { HTChunkTerminate(&me->option); - fprintf(tfp, "HTML_free: ***** leftover option data: %s\n", + fprintf(stderr, "HTML_free: ***** leftover option data: %s\n", me->option.data); } HTChunkClear(&me->option); @@ -6836,15 +6895,16 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) * have gone very wrong. - kw */ if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: TEXTAREA not used properly *****\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } if (TRACE) { HTChunkTerminate(&me->textarea); - fprintf(tfp, "HTML_free: ***** leftover textarea data: %s\n", + fprintf(stderr, "HTML_free: ***** leftover textarea data: %s\n", me->textarea.data); } HTChunkClear(&me->textarea); @@ -6887,15 +6947,15 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) me->Underline_Level = 0; } if (me->inA) { - HTML_end_element(me, HTML_A, &include); + HTML_end_element(me, HTML_A, (char **)&include); me->inA = FALSE; } if (me->inFONT) { - HTML_end_element(me, HTML_FONT, &include); + HTML_end_element(me, HTML_FONT, (char **)&include); me->inFONT = FALSE; } if (me->inFORM) { - HTML_end_element(me, HTML_FORM, &include); + HTML_end_element(me, HTML_FORM, (char **)&include); me->inFORM = FALSE; } @@ -6912,10 +6972,10 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) * have gone very wrong. - kw */ if (TRACE) { - fprintf(tfp, + fprintf(stderr, "HTML_abort: SELECT or OPTION not ended properly *****\n"); HTChunkTerminate(&me->option); - fprintf(tfp, "HTML_abort: ***** leftover option data: %s\n", + fprintf(stderr, "HTML_abort: ***** leftover option data: %s\n", me->option.data); } HTChunkClear(&me->option); @@ -6927,10 +6987,10 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) * have gone very wrong. - kw */ if (TRACE) { - fprintf(tfp, + fprintf(stderr, "HTML_abort: TEXTAREA not used properly *****\n"); HTChunkTerminate(&me->textarea); - fprintf(tfp, "HTML_abort: ***** leftover textarea data: %s\n", + fprintf(stderr, "HTML_abort: ***** leftover textarea data: %s\n", me->textarea.data); } HTChunkClear(&me->textarea); @@ -6967,7 +7027,6 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) */ PRIVATE void get_styles NOARGS { - styleSheet = DefaultStyle(); default_style = HTStyleNamed(styleSheet, "Normal"); styles[HTML_H1] = HTStyleNamed(styleSheet, "Heading1"); @@ -7034,17 +7093,6 @@ PRIVATE void get_styles NOARGS styles[HTML_LISTING] = HTStyleNamed(styleSheet, "Listing"); } -/* - * If we're called from another module, make sure we've initialized styles - * array first. - */ -PUBLIC HTStyle *LYstyles ARGS1(int, style_number) -{ - if (styles[style_number] == 0) - get_styles(); - return styles[style_number]; -} - /* P U B L I C */ @@ -7106,6 +7154,7 @@ PUBLIC HTStructured* HTML_new ARGS3( * array is not necessarily the same as it was from 'get_styles()'. So * we reinitialize the whole thing. */ + styleSheet = DefaultStyle(); get_styles(); me->isa = &HTMLPresentation; @@ -7266,16 +7315,16 @@ PUBLIC HTStructured* HTML_new ARGS3( LYUCcharset *p_in = HTAnchor_getUCInfoStage(me->node_anchor, UCT_STAGE_MIME); if (p_in->enc == UCT_ENC_CJK && HTCJK == NOCJK) { - HTAnchor_resetUCInfoStage(me->node_anchor, LATIN1, + HTAnchor_resetUCInfoStage(me->node_anchor, 0, UCT_STAGE_MIME, UCT_SETBY_DEFAULT); - HTAnchor_setUCInfoStage(me->node_anchor, LATIN1, + HTAnchor_setUCInfoStage(me->node_anchor, 0, UCT_STAGE_MIME, UCT_SETBY_DEFAULT); - HTAnchor_resetUCInfoStage(me->node_anchor, LATIN1, + HTAnchor_resetUCInfoStage(me->node_anchor, 0, UCT_STAGE_PARSER, UCT_SETBY_DEFAULT); - HTAnchor_setUCInfoStage(me->node_anchor, LATIN1, + HTAnchor_setUCInfoStage(me->node_anchor, 0, UCT_STAGE_PARSER, UCT_SETBY_DEFAULT); } @@ -7460,54 +7509,19 @@ PUBLIC int HTLoadError ARGS3( return -number; } -PRIVATE char * MakeNewTitle ARGS2(CONST char **, value, int, src_type) -{ - char *ptr; - char *newtitle = NULL; - StrAllocCopy(newtitle, "["); - ptr = strrchr(value[src_type], '/'); - if (!ptr) { - StrAllocCat(newtitle, value[src_type]); - } else { - StrAllocCat(newtitle, ptr + 1); - } - StrAllocCat(newtitle, "]"); - return newtitle; -} - -PRIVATE char * MakeNewImageValue ARGS1(CONST char **, value) +PRIVATE char * MakeNewTitle(CONST char ** value) { char *ptr; char *newtitle = NULL; StrAllocCopy(newtitle, "["); - ptr = strrchr(value[HTML_INPUT_SRC], '/'); + ptr = strrchr(value[HTML_IMG_SRC], '/'); if (!ptr) { - StrAllocCat(newtitle, value[HTML_INPUT_SRC]); + StrAllocCat(newtitle, value[HTML_IMG_SRC]); } else { StrAllocCat(newtitle, ptr + 1); } - StrAllocCat(newtitle, "]-Submit"); - return newtitle; -} - -PRIVATE char * MakeNewMapValue ARGS2(const char **, value, const char*, mapstr) -{ - char *ptr; - char *newtitle = NULL; - - StrAllocCopy(newtitle, "["); - StrAllocCat(newtitle,mapstr); /* ISMAP or USEMAP */ - if ( verbose_img ) { - StrAllocCat(newtitle,":"); - ptr = strrchr(value[HTML_IMG_SRC], '/'); - if (!ptr) { - StrAllocCat(newtitle, value[HTML_IMG_SRC]); - } else { - StrAllocCat(newtitle, ptr + 1); - } - } StrAllocCat(newtitle, "]"); return newtitle; } @@ -207,7 +207,9 @@ struct _HTStructured { int tag_charset; /* charset for attribute values etc. */ }; -extern HTStyle *LYstyles PARAMS((int style_number)); +extern HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles */ + /* and 3 header alignment styles */ + /* and 3 div alignment styles */ /* * Semi-Private functions. - FM diff --git a/src/HTSaveToFile.h b/src/HTSaveToFile.h index 4374f7a4..a13ad78a 100644 --- a/src/HTSaveToFile.h +++ b/src/HTSaveToFile.h @@ -1,10 +1,6 @@ #ifndef HTSAVETOFILE_H #define HTSAVETOFILE_H -#include <HTUtils.h> -#include <HTStream.h> -#include <HTFormat.h> - extern HTStream * HTSaveToFile PARAMS(( HTPresentation * pres, HTParentAnchor * anchor, diff --git a/src/LYBookmark.c b/src/LYBookmark.c index dc635da3..5ce5c754 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -1,23 +1,30 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTAlert.h> #include <LYUtils.h> #include <LYStrings.h> #include <LYBookmark.h> #include <LYGlobalDefs.h> #include <LYSignal.h> +#include <LYSystem.h> #include <LYKeymap.h> -#include <LYCharUtils.h> /* need for META charset */ -#include <LYCharSets.h> /* need for LYHaveCJKCharacterSet */ +#include <LYCharUtils.h> #include <LYCurses.h> #include <GridText.h> +#ifdef DOSPATH +#include <HTDOS.h> +#endif #ifdef VMS +#include <HTVMSUtils.h> #include <nam.h> -extern BOOLEAN HadVMSInterrupt; /* Flag from cleanup_sig() AST */ +extern BOOLEAN HadVMSInterrupt; /* Flag from cleanup_sig() AST */ #endif /* VMS */ #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + PUBLIC char *MBM_A_subbookmark[MBM_V_MAXFILES+1]; PUBLIC char *MBM_A_subdescript[MBM_V_MAXFILES+1]; @@ -40,32 +47,34 @@ PRIVATE char * convert_mosaic_bookmark_file PARAMS((char *filename_buffer)); PUBLIC char * get_bookmark_filename ARGS1( char **, URL) { + char URL_buffer[256]; static char filename_buffer[256]; char string_buffer[256]; FILE *fp; int MBM_tmp; /* - * Multi_Bookmarks support. - FMG & FM - * Let user select a bookmark file. + * Multi_Bookmarks support. - FMG & FM + * Let user select a bookmark file. */ MBM_tmp = select_multi_bookmarks(); if (MBM_tmp == -2) - /* + /* * Zero-length pointer flags a cancel. - FM - */ - return(""); + */ + return(""); if (MBM_tmp == -1) { sprintf(string_buffer, BOOKMARK_FILE_NOT_DEFINED, key_for_func(LYK_OPTIONS)); - HTAlert(string_buffer); + _statusline(string_buffer); + sleep(AlertSecs); /* * Space flags an undefined selection. - FMG */ return(" "); } else { - /* + /* * Save the filepath as a global. The system path will be * loaded into to the (static) filename_buffer as the return * value, the URL will be allocated into *URL, and we also @@ -77,27 +86,28 @@ PUBLIC char * get_bookmark_filename ARGS1( } /* - * Seek it in the home path. - FM + * Seek it in the home path. - FM */ filename_buffer[255] = '\0'; LYAddPathToHome(filename_buffer, sizeof(filename_buffer), BookmarkPage); - CTRACE(tfp, "\nget_bookmark_filename: SEEKING %s\n AS %s\n\n", + if (TRACE) + fprintf(stderr, "\nget_bookmark_filename: SEEKING %s\n AS %s\n\n", BookmarkPage, filename_buffer); if ((fp = fopen(filename_buffer,"r")) != NULL) { goto success; } /* - * Failure. + * Failure. */ return(NULL); success: /* - * We now have the file open. - * Check if it is a mosaic hotlist. + * We now have the file open. + * Check if it is a mosaic hotlist. */ if (fgets(string_buffer, 255, fp) && !strncmp(string_buffer, "ncsa-xmosaic-hotlist-format-1", 29)) { @@ -108,13 +118,34 @@ success: is_mosaic_hotlist = TRUE; fclose(fp); newname = convert_mosaic_bookmark_file(filename_buffer); - LYLocalFileToURL(URL, newname); +#ifdef DOSPATH + sprintf(URL_buffer, "file://localhost/%s", + HTDOS_wwwName((char *)newname)); +#else +#ifdef VMS + sprintf(URL_buffer,"file://localhost%s", + HTVMS_wwwName((char *)newname)); +#else + sprintf(URL_buffer,"file://localhost%s", newname); +#endif /* VMS */ +#endif /* DOSPATH */ } else { fclose(fp); is_mosaic_hotlist = FALSE; - LYLocalFileToURL(URL, filename_buffer); +#ifdef DOSPATH + sprintf(URL_buffer,"file://localhost/%s", + HTDOS_wwwName((char *)filename_buffer)); +#else +#ifdef VMS + sprintf(URL_buffer,"file://localhost%s", + HTVMS_wwwName((char *)filename_buffer)); +#else + sprintf(URL_buffer,"file://localhost%s", filename_buffer); +#endif /* VMS */ +#endif /* DOSPATH */ } + StrAllocCopy(*URL, URL_buffer); return(filename_buffer); /* bookmark file exists */ } /* big end */ @@ -124,17 +155,26 @@ success: * file for handling as a Lynx bookmark file. - FM */ PRIVATE char * convert_mosaic_bookmark_file ARGS1( - char *, filename_buffer) + char *, filename_buffer) { static char newfile[256]; + static BOOLEAN first = TRUE; FILE *fp, *nfp; char buf[BUFSIZ]; int line = -2; char *endline; - LYRemoveTemp(newfile); - if ((nfp = LYOpenTemp(newfile, HTML_SUFFIX, "w")) == NULL) { - LYMBM_statusline(NO_TEMP_FOR_HOTLIST); + if (first) { + tempname(newfile, NEW_FILE); + first = FALSE; +#ifdef VMS + } else { + remove(newfile); /* Remove duplicates on VMS. */ +#endif /* VMS */ + } + + if ((nfp = fopen(newfile, "w")) == NULL) { + LYMBM_statusline(NO_TEMP_FOR_HOTLIST); sleep(AlertSecs); return (""); } @@ -157,23 +197,20 @@ PRIVATE char * convert_mosaic_bookmark_file ARGS1( if((line % 2) == 0) { /* even lines */ if(*buf != '\0') { strtok(buf," "); /* kill everything after the space */ - fprintf(nfp,"<LI><a href=\"%s\">",buf); /* the URL */ + fprintf(nfp,"<LI><a href=\"%s\">",buf); /* the URL */ } } else { /* odd lines */ - fprintf(nfp,"%s</a>\n",buf); /* the title */ + fprintf(nfp,"%s</a>\n",buf); /* the title */ } - } + } /* else - ignore the line (this gets rid of first two lines) */ line++; } - LYCloseTempFP(nfp); + fclose(nfp); fclose(fp); return(newfile); } -PRIVATE BOOLEAN have8bit PARAMS((char *Title)); -PRIVATE char* title_convert8bit PARAMS((char *Title)); - /* * Adds a link to a bookmark file, creating the file * if it doesn't already exist, and making sure that @@ -182,8 +219,8 @@ PRIVATE char* title_convert8bit PARAMS((char *Title)); * to that file. - FM */ PUBLIC void save_bookmark_link ARGS2( - char *, address, - char *, title) + char *, address, + char *, title) { FILE *fp; BOOLEAN first_time = FALSE; @@ -199,32 +236,32 @@ PUBLIC void save_bookmark_link ARGS2( HText *text; /* - * Make sure we were passed something to save. - FM + * Make sure we were passed something to save. - FM */ if (!(address && *address)) { - HTAlert(MALFORMED_ADDRESS); + HTAlert(MALFORMED_ADDRESS); return; } /* - * Offer a choice of bookmark files, - * or get the default. - FMG + * Offer a choice of bookmark files, + * or get the default. - FMG */ filename = get_bookmark_filename(&bookmark_URL); /* - * If filename is NULL, must create a new file. If - * filename is a space, an invalid bookmark file was - * selected, or if zero-length, the user cancelled. - * Ignore request in both cases. Otherwise, make - * a copy before anything might change the static - * get_bookmark_filename() buffer. - FM + * If filename is NULL, must create a new file. If + * filename is a space, an invalid bookmark file was + * selected, or if zero-length, the user cancelled. + * Ignore request in both cases. Otherwise, make + * a copy before anything might change the static + * get_bookmark_filename() buffer. - FM */ if (filename == NULL) { - first_time = TRUE; + first_time = TRUE; filename_buffer[0] = '\0'; } else { - if (*filename == '\0' || !strcmp(filename," ")) { + if (*filename == '\0' || !strcmp(filename," ")) { FREE(bookmark_URL); return; } @@ -232,22 +269,22 @@ PUBLIC void save_bookmark_link ARGS2( } /* - * If BookmarkPage is NULL, something went - * wrong, so ignore the request. - FM + * If BookmarkPage is NULL, something went + * wrong, so ignore the request. - FM */ if (BookmarkPage == NULL) { - FREE(bookmark_URL); + FREE(bookmark_URL); return; } /* - * If the link will be added to the same - * bookmark file, get confirmation. - FM + * If the link will be added to the same + * bookmark file, get confirmation. - FM */ if (LYMultiBookmarks == TRUE && - strstr(HTLoadedDocumentURL(), - (*BookmarkPage == '.' ? - (BookmarkPage+1) : BookmarkPage)) != NULL) { + strstr(HTLoadedDocumentURL(), + (*BookmarkPage == '.' ? + (BookmarkPage+1) : BookmarkPage)) != NULL) { LYMBM_statusline(MULTIBOOKMARKS_SELF); c = LYgetch(); if (TOUPPER(c) != 'L') { @@ -257,7 +294,7 @@ PUBLIC void save_bookmark_link ARGS2( } /* - * Allow user to change the title. - FM + * Allow user to change the title. - FM */ string_buffer[255] = '\0'; LYstrncpy(string_buffer, title, 255); @@ -272,34 +309,30 @@ PUBLIC void save_bookmark_link ARGS2( } /* - * Create the Title with any left-angle-brackets - * converted to < entities and any ampersands - * converted to & entities. - FM - * - * Convert 8-bit letters to &#xUUUU to avoid dependencies - * from display character set which may need changing. - * Do NOT convert any 8-bit chars if we have CJK display. - LP + * Create the Title with any left-angle-brackets + * converted to < entities and any ampersands + * converted to & entities. - FM */ StrAllocCopy(Title, string_buffer); LYEntify(&Title, TRUE); - if (UCSaveBookmarksInUnicode && - have8bit(Title) && (!LYHaveCJKCharacterSet)) - StrAllocCopy(Title, title_convert8bit(Title)); /* - * Create the bookmark file, if it doesn't exist already, - * Otherwise, open the pre-existing bookmark file. - FM + * Create the bookmark file, if it doesn't exist already, + * Otherwise, open the pre-existing bookmark file. - FM */ - SetDefaultMode(O_TEXT); +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_TEXT; +#endif /* __DJGPP__ or _WINDOWS */ if (first_time) { - /* + /* * Seek it in the home path. - FM */ LYAddPathToHome(filename_buffer, sizeof(filename_buffer), BookmarkPage); } - CTRACE(tfp, "\nsave_bookmark_link: SEEKING %s\n AS %s\n\n", + if (TRACE) + fprintf(stderr, "\nsave_bookmark_link: SEEKING %s\n AS %s\n\n", BookmarkPage, filename_buffer); if ((fp = fopen(filename_buffer, (first_time ? "w" : "a+"))) == NULL) { LYMBM_statusline(BOOKMARK_OPEN_FAILED); @@ -309,14 +342,13 @@ PUBLIC void save_bookmark_link ARGS2( } /* - * Convert all ampersands in the address to & entities. - FM + * Convert all ampersands in the address to & entities. - FM */ StrAllocCopy(Address, address); LYEntify(&Address, FALSE); /* - * If we created a new bookmark file, write the headers. - FM - * Once and forever... + * If we created a new bookmark file, write the headers. - FM */ if (first_time) { fprintf(fp,"<head>\n"); @@ -327,18 +359,13 @@ PUBLIC void save_bookmark_link ARGS2( the 'R' key but may have been remapped by you or your system\n\ administrator.<br>\n\ This file also may be edited with a standard text editor to delete\n\ - outdated or invalid links, or to change their order.\n\n\ -<!--\n\ -Note: if you edit this file manually\n\ - you should not change the format within the lines\n\ - or add other HTML markup.\n\ - Make sure any bookmark link saved as a single line\n\ --->\n\n\ + outdated or invalid links, or to change their order, but you should\n\ + not change the format within the lines or add other HTML markup.\n\n\ <p>\n<ol>\n"); } /* - * Add the bookmark link, in Mosaic hotlist or Lynx format. - FM + * Add the bookmark link, in Mosaic hotlist or Lynx format. - FM */ if (is_mosaic_hotlist) { time_t NowTime = time(NULL); @@ -352,16 +379,18 @@ Note: if you edit this file manually\n\ } fclose(fp); - SetDefaultMode(O_BINARY); +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_BINARY; +#endif /* __DJGPP__ or _WINDOWS */ /* - * If this is a cached bookmark file, set nocache for - * it so we'll see the new bookmark link when that - * cache is retrieved. - FM + * If this is a cached bookmark file, set nocache for + * it so we'll see the new bookmark link when that + * cache is retrieved. - FM */ if (!first_time && nhist > 0 && bookmark_URL) { - for (i = 0; i < nhist; i++) { + for (i = 0; i < nhist; i++) { if (history[i].bookmark && - !strcmp(history[i].address, bookmark_URL)) { + !strcmp(history[i].address, bookmark_URL)) { WWWDoc.address = history[i].address; WWWDoc.post_data = NULL; WWWDoc.post_content_type = NULL; @@ -370,7 +399,7 @@ Note: if you edit this file manually\n\ WWWDoc.safe = FALSE; if (((tmpanchor = HTAnchor_parent( HTAnchor_findAddress(&WWWDoc) - )) != NULL) && + )) != NULL) && (text = (HText *)HTAnchor_document(tmpanchor)) != NULL) { HText_setNoCache(text); } @@ -380,7 +409,7 @@ Note: if you edit this file manually\n\ } /* - * Clean up and report success. + * Clean up and report success. */ FREE(Title); FREE(Address); @@ -388,7 +417,7 @@ Note: if you edit this file manually\n\ LYMBM_statusline(OPERATION_DONE); sleep(MessageSecs); } - + /* * Remove a link from a bookmark file. The calling * function is expected to have used get_filename_link(), @@ -398,7 +427,7 @@ Note: if you edit this file manually\n\ */ PUBLIC void remove_bookmark_link ARGS2( int, cur, - char *, cur_bookmark_page) + char *, cur_bookmark_page) { FILE *fp, *nfp; char buf[BUFSIZ]; @@ -412,39 +441,54 @@ PUBLIC void remove_bookmark_link ARGS2( struct stat stat_buf; mode_t mode; #endif /* VMS */ - char homepath[256]; - CTRACE(tfp, "remove_bookmark_link: deleting link number: %d\n", cur); + if (TRACE) + fprintf(stderr, "remove_bookmark_link: deleting link number: %d\n", + cur); if (!cur_bookmark_page) return; LYAddPathToHome(filename_buffer, sizeof(filename_buffer), cur_bookmark_page); - CTRACE(tfp, "\nremove_bookmark_link: SEEKING %s\n AS %s\n\n", + if (TRACE) + fprintf(stderr, "\nremove_bookmark_link: SEEKING %s\n AS %s\n\n", cur_bookmark_page, filename_buffer); if ((fp = fopen(filename_buffer, "r")) == NULL) { - HTAlert(BOOKMARK_OPEN_FAILED_FOR_DEL); + _statusline(BOOKMARK_OPEN_FAILED_FOR_DEL); + sleep(AlertSecs); return; } - LYAddPathToHome(homepath, sizeof(homepath), ""); - if ((nfp = LYOpenScratch(newfile, homepath)) == 0) { +#ifdef VMS + sprintf(newfile, "%s-%d", filename_buffer, getpid()); +#else + tempname(newfile, NEW_FILE); +#endif /* VMS */ + if ((nfp = LYNewTxtFile(newfile)) == NULL) { fclose(fp); - HTAlert(BOOKSCRA_OPEN_FAILED_FOR_DEL); +#ifdef VMS + _statusline(BOOKSCRA_OPEN_FAILED_FOR_DEL); +#else + _statusline(BOOKTEMP_OPEN_FAILED_FOR_DEL); +#endif /* VMS */ + sleep(AlertSecs); return; } #ifdef UNIX /* - * Explicitly preserve bookmark file mode on Unix. - DSL + * Explicitly preserve bookmark file mode on Unix. - DSL */ if (stat(filename_buffer, &stat_buf) == 0) { - mode = ((stat_buf.st_mode & 0777) | 0600); /* make it writable */ + mode = ((stat_buf.st_mode & 0777) | HIDE_CHMOD); + (void) fclose(nfp); + nfp = NULL; (void) chmod(newfile, mode); - if ((nfp = LYReopenTemp(newfile)) == NULL) { + if ((nfp = fopen(newfile, "a")) == NULL) { (void) fclose(fp); - HTAlert(BOOKTEMP_REOPEN_FAIL_FOR_DEL); + _statusline(BOOKTEMP_REOPEN_FAIL_FOR_DEL); + sleep(AlertSecs); return; } } @@ -453,12 +497,12 @@ PUBLIC void remove_bookmark_link ARGS2( if (is_mosaic_hotlist) { int del_line = cur*2; /* two lines per entry */ n = -3; /* skip past cookie and name lines */ - while (fgets(buf, sizeof(buf), fp) != NULL) { + while (fgets(buf, sizeof(buf), fp) != NULL) { n++; - if (n == del_line || n == del_line+1) + if (n == del_line || n == del_line+1) continue; /* remove two lines */ - if (fputs(buf, nfp) == EOF) - goto failure; + if (fputs(buf, nfp) == EOF) + goto failure; } } else { @@ -466,64 +510,59 @@ PUBLIC void remove_bookmark_link ARGS2( BOOLEAN retain; int seen; - n = -1; - while (fgets(buf, sizeof(buf), fp) != NULL) { + n = -1; + while (fgets(buf, sizeof(buf), fp) != NULL) { retain = TRUE; seen = 0; cp = buf; - while (n < cur && (cp = LYstrstr(cp, "<a href="))) { + while (n < cur && (cp = LYstrstr(cp, "<a href="))) { seen++; - if (++n == cur) { + if (++n == cur) { if (seen != 1 || !LYstrstr(buf, "</a>") || LYstrstr((cp + 1), "<a href=")) { - HTAlert(BOOKMARK_LINK_NOT_ONE_LINE); + _statusline(BOOKMARK_LINK_NOT_ONE_LINE); + sleep(AlertSecs); goto failure; } - CTRACE(tfp, "remove_bookmark_link: skipping link %d\n", n); - retain = FALSE; + if (TRACE) + fprintf(stderr, + "remove_bookmark_link: skipping link %d\n", n); + retain = FALSE; } cp += 8; - } - if (retain && fputs(buf, nfp) == EOF) - goto failure; - } + } + if (retain && fputs(buf, nfp) == EOF) + goto failure; + } } - CTRACE(tfp, "remove_bookmark_link: files: %s %s\n", + if (TRACE) + fprintf(stderr, "remove_bookmark_link: files: %s %s\n", newfile, filename_buffer); fclose(fp); fp = NULL; - LYCloseTempFP(nfp); + fclose(nfp); nfp = NULL; #ifdef DOSPATH remove(filename_buffer); #endif /* DOSPATH */ - -#ifdef UNIX - /* - * By copying onto the bookmark file, rather than renaming it, we - * can preserve the original ownership of the file, provided that - * it is writable by the current process. - * Changed to copy 1998-04-26 -- gil - */ - { char buffer[3072]; - - sprintf(buffer, "%s %s %s && %s %s", - COPY_PATH, newfile, filename_buffer, - RM_PATH, newfile); - - CTRACE(tfp, "remove_bookmark_link: %s\n", buffer); - if( LYSystem( buffer ) ) { - HTAlert(BOOKTEMP_COPY_FAIL); - } else { - return; - } - } -#else /* !UNIX */ if (rename(newfile, filename_buffer) != -1) { - HTSYS_purge(filename_buffer); - return; +#ifdef VMS + char VMSfilename[256]; + /* + * Purge lower version of file. + */ + sprintf(VMSfilename, "%s;-1", filename_buffer); + while (remove(VMSfilename) == 0) + ; + /* + * Reset version number. + */ + sprintf(VMSfilename, "%s;1", filename_buffer); + rename(filename_buffer, VMSfilename); +#endif /* VMS */ + return; } else { #ifndef VMS /* @@ -532,34 +571,35 @@ PUBLIC void remove_bookmark_link ARGS2( * Used to be ODD_RENAME */ #ifdef _WINDOWS - if (errno == ENOTSAM) + if (errno == ENOTSAM) { #else - if (errno == EXDEV) -#endif /* WINDOWS */ - { + if (errno == EXDEV) { +#endif /* WINDOWS */ char buffer[2048]; sprintf(buffer, "%s %s %s", MV_PATH, newfile, filename_buffer); - LYSystem(buffer); + system(buffer); return; } #endif /* !VMS */ #ifdef VMS - HTAlert(ERROR_RENAMING_SCRA); + _statusline(ERROR_RENAMING_SCRA); #else - HTAlert(ERROR_RENAMING_TEMP); + _statusline(ERROR_RENAMING_TEMP); #endif /* VMS */ if (TRACE) perror("renaming the file"); + sleep(AlertSecs); } -#endif /* UNIX */ - + failure: - HTAlert(BOOKMARK_DEL_FAILED); - LYCloseTempFP(nfp); + _statusline(BOOKMARK_DEL_FAILED); + sleep(AlertSecs); + if (nfp != NULL) + fclose(nfp); if (fp != NULL) - fclose(fp); - LYRemoveTemp(newfile); + fclose(fp); + remove(newfile); } /* @@ -570,19 +610,19 @@ PUBLIC int select_multi_bookmarks NOARGS int c; /* - * If not enabled, pick the "default" (0). + * If not enabled, pick the "default" (0). */ if (LYMultiBookmarks == FALSE || LYHaveSubBookmarks() == FALSE) { if (MBM_A_subbookmark[0]) /* If it exists! */ - return(0); + return(0); else - return(-1); + return(-1); } /* - * For ADVANCED users, we can just mess with the status line to save - * the 2 redraws of the screen, if LYMBMAdvnced is TRUE. '=' will - * still show the screen and let them do it the "long" way. + * For ADVANCED users, we can just mess with the status line to save + * the 2 redraws of the screen, if LYMBMAdvnced is TRUE. '=' will + * still show the screen and let them do it the "long" way. */ if (LYMBMAdvanced && user_mode == ADVANCED_MODE) { LYMBM_statusline(MULTIBOOKMARKS_SELECT); @@ -592,18 +632,18 @@ get_advanced_choice: if (HadVMSInterrupt) { HadVMSInterrupt = FALSE; c = 7; - } + } #endif /* VMS */ if (LYisNonAlnumKeyname(c, LYK_PREV_DOC) || c == 7 || c == 3) { /* - * Treat left-arrow, ^G, or ^C as cancel. + * Treat left-arrow, ^G, or ^C as cancel. */ return(-2); } if (LYisNonAlnumKeyname(c, LYK_REFRESH)) { /* - * Refresh the screen. + * Refresh the screen. */ lynx_force_repaint(); refresh(); @@ -611,19 +651,19 @@ get_advanced_choice: } if (LYisNonAlnumKeyname(c, LYK_ACTIVATE)) { /* - * Assume default bookmark file on ENTER or right-arrow. + * Assume default bookmark file on ENTER or right-arrow. */ return (MBM_A_subbookmark[0] ? 0 : -1); } switch (c) { case '=': - /* + /* * Get the choice via the menu. */ return(select_menu_multi_bookmarks()); default: - /* + /* * Convert to an array index, act on it if valid. * Otherwise, get another keystroke. */ @@ -637,7 +677,7 @@ get_advanced_choice: */ return (MBM_A_subbookmark[c] ? c : -1); } else { - /* + /* * Get the choice via the menu. */ return(select_menu_multi_bookmarks()); @@ -655,51 +695,52 @@ PUBLIC int select_menu_multi_bookmarks NOARGS char shead_buffer[256]; /* - * If not enabled, pick the "default" (0). + * If not enabled, pick the "default" (0). */ if (LYMultiBookmarks == FALSE) return(0); /* - * Filip M. Gieszczykiewicz (filipg@paranoia.com) & FM - * --------------------------------------------------- - * LYMultiBookmarks - TRUE when multi_support enabled. + * Filip M. Gieszczykiewicz (filipg@paranoia.com) & FM + * --------------------------------------------------- + * LYMultiBookmarks - TRUE when multi_support enabled. * - * MBM_A_subbookmark[n] - Hold values of the respective - * "multi_bookmarkn" in the lynxrc file. + * MBM_A_subbookmark[n] - Hold values of the respective + * "multi_bookmarkn" in the lynxrc file. * - * MBM_A_subdescript[n] - Hold description entries in the - * lynxrc file. + * MBM_A_subdescript[n] - Hold description entries in the + * lynxrc file. * - * Note: MBM_A_subbookmark[0] is defined to be same value as - * "bookmark_file" in the lynxrc file and/or the startup - * "bookmark_page". + * Note: MBM_A_subbookmark[0] is defined to be same value as + * "bookmark_file" in the lynxrc file and/or the startup + * "bookmark_page". * - * We make the display of bookmarks depend on rows we have - * available. + * We make the display of bookmarks depend on rows we have + * available. * - * We load BookmarkPage with the valid MBM_A_subbookmark[n] - * via get_bookmark_filename(). Otherwise, that function - * returns a zero-length string to indicate a cancel, a - * single space to indicate an invalid choice, or NULL to - * indicate an inaccessible file. + * We load BookmarkPage with the valid MBM_A_subbookmark[n] + * via get_bookmark_filename(). Otherwise, that function + * returns a zero-length string to indicate a cancel, a + * single space to indicate an invalid choice, or NULL to + * indicate an inaccessible file. */ MBM_allow=(LYlines-7); /* We need 7 for header and footer */ /* - * Screen big enough? + * Screen big enough? */ if (MBM_allow <= 0) { - /* + /* * Too small. */ - HTAlert(MULTIBOOKMARKS_SMALL); + _statusline(MULTIBOOKMARKS_SMALL); + sleep(AlertSecs); return (-2); } /* - * Load the bad choice message buffer. + * Load the bad choice message buffer. */ sprintf(string_buffer, - BOOKMARK_FILE_NOT_DEFINED, + BOOKMARK_FILE_NOT_DEFINED, key_for_func(LYK_OPTIONS)); MBM_screens = (MBM_V_MAXFILES/MBM_allow)+1; /* int rounds off low. */ @@ -718,21 +759,21 @@ draw_bookmark_choices: MBM_to = MBM_V_MAXFILES; /* - * Display menu of bookmarks. NOTE that we avoid printw()'s - * to increase the chances that any non-ASCII or multibyte/CJK - * characters will be handled properly. - FM + * Display menu of bookmarks. NOTE that we avoid printw()'s + * to increase the chances that any non-ASCII or multibyte/CJK + * characters will be handled properly. - FM */ clear(); move(1, 5); lynx_start_h1_color (); if (MBM_screens > 1) { - sprintf(shead_buffer, + sprintf(shead_buffer, MULTIBOOKMARKS_SHEAD_MASK, MBM_current, MBM_screens); addstr(shead_buffer); } else { - addstr(MULTIBOOKMARKS_SHEAD); + addstr(MULTIBOOKMARKS_SHEAD); } - + lynx_stop_h1_color (); MBM_tmp_count = 0; @@ -751,7 +792,7 @@ draw_bookmark_choices: } /* - * Don't need to show it if it all fits on one screen! + * Don't need to show it if it all fits on one screen! */ if (MBM_screens > 1) { move(LYlines-2, 0); @@ -804,20 +845,20 @@ get_bookmark_choice: } /* - * Next range, if available. + * Next range, if available. */ if ((c == ']' || LYisNonAlnumKeyname(c, LYK_NEXT_PAGE)) && - MBM_screens > 1) { + MBM_screens > 1) { if (++MBM_current > MBM_screens) MBM_current = 1; goto draw_bookmark_choices; } /* - * Previous range, if available. + * Previous range, if available. */ if ((c == '[' || LYisNonAlnumKeyname(c, LYK_PREV_PAGE)) && - MBM_screens > 1) { + MBM_screens > 1) { if (--MBM_current <= 0) MBM_current = MBM_screens; goto draw_bookmark_choices; @@ -825,12 +866,12 @@ get_bookmark_choice: c = TOUPPER(c) - 'A'; /* - * See if we have a bookmark like that. + * See if we have a bookmark like that. */ if (c < 0 || c > MBM_V_MAXFILES) { goto get_bookmark_choice; } else if (!MBM_A_subbookmark[c]) { - LYMBM_statusline(string_buffer); + LYMBM_statusline(string_buffer); sleep(AlertSecs); LYMBM_statusline(MULTIBOOKMARKS_SAVE); goto get_bookmark_choice; @@ -849,7 +890,7 @@ PUBLIC BOOLEAN LYHaveSubBookmarks NOARGS int i; for (i = 1; i < MBM_V_MAXFILES; i++) { - if (MBM_A_subbookmark[i] != NULL && *MBM_A_subbookmark[i] != '\0') + if (MBM_A_subbookmark[i] != NULL && *MBM_A_subbookmark[i] != '\0') return(TRUE); } @@ -864,94 +905,14 @@ PUBLIC BOOLEAN LYHaveSubBookmarks NOARGS * _statusline() so that any multibyte/CJK characters in the * string will be handled properly. - FM */ -PUBLIC void LYMBM_statusline ARGS1( - char *, text) + PUBLIC void LYMBM_statusline ARGS1( + char *, text) { if (LYMultiBookmarks == TRUE && user_mode == NOVICE_MODE) { LYStatusLine = (LYlines - 1); - _statusline(text); + _statusline(text); LYStatusLine = -1; } else { - _statusline(text); - } -} - -/* - * Check whether string have 8 bit chars. - */ -PRIVATE BOOLEAN have8bit ARGS1(char *, Title) -{ - CONST char *p = Title; - - for ( ; *p; p++) { - if ((unsigned char)*p > 127) - return(TRUE); - } - return(FALSE); /* if we came here */ -} - -/* - * Ok, title have 8-bit characters and they are in display charset. - * Bookmarks is a permanent file. To avoid dependencies from display - * character set which may be changed with time - * we store 8-bit characters as numeric character reference (NCR), - * so where the character encoded as unicode number in form of &#xUUUU; - * - * To make bookmarks more readable for human (&#xUUUU certainly not) - * we add a comment with '7-bit approximation' from the converted string. - * This is a valid HTML and bookmarks code. - * - * We do not want use META charset tag in bookmarks file: - * it will never be changed later :-( - * NCR's translation is part of I18N and HTML4.0 - * supported starting with Lynx 2.7.2, - * Netscape 4.0 and MSIE 4.0. - * Older versions fail. - * - */ -PRIVATE char* title_convert8bit ARGS1(char *, Title) -{ - CONST char *p = Title; - char temp[256]; - char *q = temp; - char *comment = NULL; - char *ncr = NULL; - char *buf = NULL; - - for ( ; *p; p++) { - LYstrncpy(q, p, 1); - if ((unsigned char)*q <= 127) { - StrAllocCat(comment, q); - StrAllocCat(ncr, q); - } else { - int charset_in, charset_out, uck; - long unicode; - char replace_buf [10], replace_buf2 [10]; - - charset_in = current_char_set; - charset_out = UCGetLYhndl_byMIME("us-ascii"); - - uck = UCTransCharStr(replace_buf, sizeof(replace_buf), *q, - charset_in, charset_out, YES); - if (uck >0) - StrAllocCat(comment, replace_buf); - - unicode = UCTransToUni( *q, charset_in); - - StrAllocCat(ncr, "&#"); - sprintf(replace_buf2, "%ld", unicode); - StrAllocCat(ncr, replace_buf2); - StrAllocCat(ncr, ";"); - } + _statusline(text); } - - /* - * valid bookmark should be a single line (no linebreaks!). - */ - StrAllocCat(buf, "<!-- "); - StrAllocCat(buf, comment); - StrAllocCat(buf, " -->"); - StrAllocCat(buf, ncr); - - return(buf); } diff --git a/src/LYCgi.c b/src/LYCgi.c index 5e7ea902..9a6ab780 100644 --- a/src/LYCgi.c +++ b/src/LYCgi.c @@ -24,6 +24,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTTP.h> #include <HTParse.h> #include <HTTCP.h> @@ -40,15 +41,14 @@ #include <LYGetFile.h> #include <LYBookmark.h> #include <GridText.h> +#include <ctype.h> #include <LYCgi.h> #include <LYSignal.h> #include <LYLocal.h> #include <LYLeaks.h> -#ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif +#define FREE(x) if (x) {free(x); x = NULL;} struct _HTStream { @@ -122,7 +122,7 @@ PRIVATE int LYLoadCGI ARGS4( HTFormat, format_out, HTStream*, sink) { - int status = 0; + int status; #ifdef LYNXCGI_LINKS #ifndef VMS char *cp; @@ -190,7 +190,9 @@ PRIVATE int LYLoadCGI ARGS4( /* Found PATH_INFO data. Strip it off of pgm and into path_info. */ StrAllocCopy(path_info, pgm+strlen(pgm_buff)); strcpy(pgm, pgm_buff); - CTRACE(tfp, "LYNXCGI: stat() of %s succeeded, path_info=\"%s\".\n", + if (TRACE) + fprintf(stderr, + "LYNXCGI: stat() of %s succeeded, path_info=\"%s\".\n", pgm_buff, path_info); } FREE(pgm_buff); @@ -221,8 +223,11 @@ PRIVATE int LYLoadCGI ARGS4( * to confusing to know just what file is loaded. - kw */ if (path_info) { - CTRACE(tfp, "%s is not a file and %s not an executable, giving up.\n", + if (TRACE) { + fprintf(stderr, + "%s is not a file and %s not an executable, giving up.\n", orig_pgm, pgm); + } FREE(path_info); FREE(pgm); FREE(orig_pgm); @@ -230,9 +235,13 @@ PRIVATE int LYLoadCGI ARGS4( return(status); } - LYLocalFileToURL (&new_arg, orig_pgm); + StrAllocCopy(new_arg, "file://localhost"); + StrAllocCat(new_arg, orig_pgm); - CTRACE(tfp, "%s is not an executable file, passing the buck.\n", arg); + if (TRACE) { + fprintf(stderr, + "%s is not an executable file, passing the buck.\n", arg); + } status = HTLoadFile(new_arg, anAnchor, format_out, sink); FREE(new_arg); @@ -252,7 +261,8 @@ PRIVATE int LYLoadCGI ARGS4( status = HT_NOT_LOADED; } else if (no_lynxcgi) { - HTUserMsg(CGI_DISABLED); + _statusline(CGI_DISABLED); + sleep(MessageSecs); status = HT_NOT_LOADED; } else if (no_bookmark_exec && @@ -267,7 +277,8 @@ PRIVATE int LYLoadCGI ARGS4( * no_bookmark_exec is TRUE an we are not now coming from a * bookmark page. - kw */ - HTUserMsg(BOOKMARK_EXEC_DISABLED); + _statusline(BOOKMARK_EXEC_DISABLED); + sleep(MessageSecs); status = HT_NOT_LOADED; } else if (anAnchor != HTMainAnchor && @@ -313,7 +324,8 @@ PRIVATE int LYLoadCGI ARGS4( if (!target || target == NULL) { sprintf(buf, CANNOT_CONVERT_I_TO_O, HTAtom_name(format_in), HTAtom_name(format_out)); - HTAlert(buf); + _statusline(buf); + sleep(AlertSecs); status = HT_NOT_LOADED; } else if (anAnchor->post_data && pipe(fd1) < 0) { @@ -360,10 +372,13 @@ PRIVATE int LYLoadCGI ARGS4( close(fd1[0]); /* We have form data to push across the pipe */ - CTRACE(tfp, "LYNXCGI: Doing post, content-type '%s'\n", + if (TRACE) { + fprintf(stderr, "LYNXCGI: Doing post, content-type '%s'\n", anAnchor->post_content_type); - CTRACE(tfp, "LYNXCGI: Writing:\n%s----------------------------------\n", + fprintf(stderr, + "LYNXCGI: Writing:\n%s----------------------------------\n", anAnchor->post_data); + } remaining = strlen(anAnchor->post_data); while ((written = write(fd1[1], anAnchor->post_data + total_written, @@ -382,24 +397,36 @@ PRIVATE int LYLoadCGI ARGS4( } break; } - CTRACE(tfp, "LYNXCGI: Wrote %d bytes of POST data.\n", + if (TRACE) { + fprintf(stderr, + "LYNXCGI: Wrote %d bytes of POST data.\n", written); + } total_written += written; remaining -= written; if (remaining == 0) break; } if (remaining != 0) { - CTRACE(tfp, "LYNXCGI: %d bytes remain unwritten!\n", + if (TRACE) + fprintf(stderr, + "LYNXCGI: %d bytes remain unwritten!\n", remaining); } close(fd1[1]); } - HTReadProgress(total_chars = 0, 0); + total_chars = 0; while((chars = read(fd2[0], buf, sizeof(buf))) > 0) { - HTReadProgress(total_chars += chars, 0); - CTRACE(tfp, "LYNXCGI: Rx: %.*s\n", chars, buf); + char line[40]; + + total_chars += chars; + sprintf (line, "Read %d bytes of data.", total_chars); + HTProgress(line); + if (TRACE) { + fprintf(stderr, "LYNXCGI: Rx: %.*s\n", chars, buf); + } + (*target->isa->put_block)(target, buf, chars); } #if !HAVE_WAITPID @@ -426,7 +453,7 @@ PRIVATE int LYLoadCGI ARGS4( char post_len[32]; int argv_cnt = 3; /* name, one arg and terminator */ char **cur_argv = NULL; - char buf2[BUFSIZ]; + char buf[BUFSIZ]; /* Set up output pipe */ close(fd2[0]); @@ -434,10 +461,10 @@ PRIVATE int LYLoadCGI ARGS4( dup2(fd2[1], fileno(stderr)); close(fd2[1]); - sprintf(buf2, "HTTP_ACCEPT_LANGUAGE=%.*s", - (int)(sizeof(buf2) - 22), language); - buf2[(sizeof(buf2) - 1)] = '\0'; - add_environment_value(buf2); + sprintf(buf, "HTTP_ACCEPT_LANGUAGE=%.*s", + (int)(sizeof(buf) - 22), language); + buf[(sizeof(buf) - 1)] = '\0'; + add_environment_value(buf); if (pref_charset) { cp = NULL; @@ -544,7 +571,9 @@ PRIVATE int LYLoadCGI ARGS4( if (LYCgiDocumentRoot != NULL && path_info != NULL ) { /* Construct and add PATH_TRANSLATED to env */ StrAllocCopy(document_root, LYCgiDocumentRoot); - LYTrimHtmlSep(document_root); + if (document_root[strlen(document_root) - 1] == '/') { + document_root[strlen(document_root) - 1] = '\0'; + } path_translated = document_root; StrAllocCat(path_translated, path_info); cp = NULL; @@ -616,7 +645,8 @@ PRIVATE int LYLoadCGI ARGS4( status = HT_LOADED; #endif /* VMS */ #else /* LYNXCGI_LINKS */ - HTUserMsg(CGI_NOT_COMPILED); + _statusline(CGI_NOT_COMPILED); + sleep(MessageSecs); status = HT_NOT_LOADED; #endif /* LYNXCGI_LINKS */ return(status); diff --git a/src/LYCgi.h b/src/LYCgi.h index b0e1cd63..56a8d15d 100644 --- a/src/LYCgi.h +++ b/src/LYCgi.h @@ -1,8 +1,7 @@ + #ifndef LYCGI_H #define LYCGI_H -#include <HTUtils.h> - extern void add_lynxcgi_environment PARAMS((CONST char *variable_name)); #endif /* LYGETFILE_H */ diff --git a/src/LYCharSets.c b/src/LYCharSets.c index 031e6126..0e7474bb 100644 --- a/src/LYCharSets.c +++ b/src/LYCharSets.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTCJK.h> #include <HTMLDTD.h> @@ -25,11 +26,7 @@ PUBLIC BOOLEAN LYHaveCJKCharacterSet = FALSE; PUBLIC BOOLEAN DisplayCharsetMatchLocale = TRUE; extern void UCInit NOARGS; extern int UCInitialized; -PUBLIC int LYNumCharsets = 0; /* Will be initialized later by UC_Register. */ -PUBLIC int current_char_set = -1; /* will be intitialized later in LYMain.c */ -PUBLIC CONST char** p_entity_values = NULL; /* Pointer, for HTML_put_entity()*/ - /* obsolete and probably not used(???) */ - /* will be initialized in HTMLUseCharacterSet */ +PUBLIC int LYNumCharsets = 0; /* Will be initialized later by UC_Register. */ /* * INSTRUCTIONS for adding new character sets which do not have @@ -60,7 +57,7 @@ PUBLIC CONST char** p_entity_values = NULL; /* Pointer, for HTML_put_entity()*/ ** ** This MUST match exactly the table referred to in the DTD! */ -PRIVATE CONST char * ISO_Latin1[] = { +PRIVATE char * ISO_Latin1[] = { "\306", /* capital AE diphthong (ligature) (Æ) - AElig */ "\301", /* capital A, acute accent (Á) - Aacute */ "\302", /* capital A, circumflex accent (Â) - Acirc */ @@ -179,7 +176,7 @@ PRIVATE CONST char * ISO_Latin1[] = { ** ** This MUST match exactly the table referred to in the DTD! */ -PUBLIC CONST char * SevenBitApproximations[] = { +PUBLIC char * SevenBitApproximations[] = { "AE", /* capital AE diphthong (ligature) (Æ) - AElig */ "A", /* capital A, acute accent (Á) - Aacute */ "A", /* capital A, circumflex accent (Â) - Acirc */ @@ -326,7 +323,7 @@ PUBLIC CONST char * SevenBitApproximations[] = { /* * Add the array name to LYCharSets */ -PUBLIC CONST char ** LYCharSets[MAXCHARSETS]={ +PUBLIC char ** LYCharSets[MAXCHARSETS]={ ISO_Latin1, /* ISO Latin 1 */ SevenBitApproximations, /* DosLatin1 (cp850) */ SevenBitApproximations, /* WinLatin1 (cp1252) */ @@ -335,8 +332,8 @@ PUBLIC CONST char ** LYCharSets[MAXCHARSETS]={ SevenBitApproximations, /* Macintosh (8 bit) */ SevenBitApproximations, /* NeXT character set */ SevenBitApproximations, /* Chinese */ - SevenBitApproximations, /* Japanese (EUC-JP) */ - SevenBitApproximations, /* Japanese (Shift_JIS) */ + SevenBitApproximations, /* Japanese (EUC) */ + SevenBitApproximations, /* Japanese (SJIS) */ SevenBitApproximations, /* Korean */ SevenBitApproximations, /* Taipei (Big5) */ SevenBitApproximations, /* Vietnamese (VISCII) */ @@ -349,21 +346,21 @@ PUBLIC CONST char ** LYCharSets[MAXCHARSETS]={ * The order of LYCharSets and LYchar_set_names MUST be the same */ PUBLIC CONST char * LYchar_set_names[MAXCHARSETSP]={ - "Western (ISO-8859-1)", - "Western (cp850)", - "Western (windows-1252)", - "IBM PC US codepage (cp437)", - "DEC Multinational", - "Macintosh (8 bit)", - "NeXT character set", - "Chinese", - "Japanese (EUC-JP)", - "Japanese (Shift_JIS)", - "Korean", - "Taipei (Big5)", - "Vietnamese (VISCII)", - "7 bit approximations (US-ASCII)", - "Transparent", + "ISO Latin 1 ", + "DosLatin1 (cp850) ", + "WinLatin1 (cp1252) ", + "DosLatinUS (cp437) ", + "DEC Multinational ", + "Macintosh (8 bit) ", + "NeXT character set ", + "Chinese ", + "Japanese (EUC) ", + "Japanese (SJIS) ", + "Korean ", + "Taipei (Big5) ", + "Vietnamese (VISCII) ", + "7 bit approximations", + "Transparent ", (char *) 0 }; @@ -455,6 +452,15 @@ PUBLIC int LYlowest_eightbit[MAXCHARSETS]={ 128 /* Transparent (???) */ }; +/* + * The default character set. + * -------------------------- + * Use lynx.cfg and/or user + * 'o'ptions (.lynxrc) to + * set a different default. + */ +PUBLIC char** p_entity_values = ISO_Latin1; /* Pointer to translation */ +PUBLIC int current_char_set = 0; /* Index for translation */ /* * Function to set the handling of selected character sets @@ -462,20 +468,24 @@ PUBLIC int LYlowest_eightbit[MAXCHARSETS]={ */ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i) { - int chndl = safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset); - + int chndl = -2; if (LYCharSet_UC[i].enc != UCT_ENC_CJK) { + chndl = 0; + + if (UCAssume_MIMEcharset) + chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); HTCJK = NOCJK; kanji_code = NOKANJI; - if (i == chndl) - LYRawMode = LYUseDefaultRawMode; - else - LYRawMode = (!LYUseDefaultRawMode); HTPassEightBitNum = ((LYCharSet_UC[i].codepoints & UCT_CP_SUPERSETOF_LAT1) || (LYCharSet_UC[i].like8859 & UCT_R_HIGH8BIT)); + if (i == (chndl < 0 ? 0 : chndl)) { + LYRawMode = LYUseDefaultRawMode ? TRUE : FALSE; + } else { + LYRawMode = LYUseDefaultRawMode ? FALSE : TRUE; + } if (LYRawMode) { HTPassEightBitRaw = (LYlowest_eightbit[i] <= 160); } else { @@ -489,51 +499,76 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i) HTPassHighCtrlNum = FALSE; - } else { /* CJK encoding: */ - CONST char *mime = LYCharSet_UC[i].MIMEname; - - if (!strcmp(mime, "euc-cn")) { - HTCJK = CHINESE; - kanji_code = EUC; - } else if (!strcmp(mime, "euc-jp")) { - HTCJK = JAPANESE; - kanji_code = EUC; - } else if (!strcmp(mime, "shift_jis")) { - HTCJK = JAPANESE; - kanji_code = SJIS; - } else if (!strcmp(mime, "euc-kr")) { - HTCJK = KOREAN; - kanji_code = EUC; - } else if (!strcmp(mime, "big5")) { - HTCJK = TAIPEI; - kanji_code = EUC; - } + } else if (!strncmp(LYchar_set_names[i], "Chinese", 7)) { + HTCJK = LYUseDefaultRawMode ? CHINESE : NOCJK; + LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; + kanji_code = EUC; + HTPassEightBitRaw = FALSE; + HTPassEightBitNum = FALSE; + HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; + HTPassHighCtrlNum = FALSE; + + } else if (!strncmp(LYchar_set_names[i], "Japanese (EUC)", 14)) { + HTCJK = LYUseDefaultRawMode ? JAPANESE : NOCJK; + LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; + kanji_code = EUC; + HTPassEightBitRaw = FALSE; + HTPassEightBitNum = FALSE; + HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; + HTPassHighCtrlNum = FALSE; + + } else if (!strncmp(LYchar_set_names[i], "Japanese (SJIS)", 15)) { + HTCJK = LYUseDefaultRawMode ? JAPANESE : NOCJK; + LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; + kanji_code = SJIS; + HTPassEightBitRaw = FALSE; + HTPassEightBitNum = FALSE; + HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; + HTPassHighCtrlNum = FALSE; - /* for any CJK: */ - if (!LYUseDefaultRawMode) - HTCJK = NOCJK; + } else if (!strncmp(LYchar_set_names[i], "Korean", 6)) { + HTCJK = LYUseDefaultRawMode ? KOREAN : NOCJK; LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; + kanji_code = EUC; HTPassEightBitRaw = FALSE; HTPassEightBitNum = FALSE; HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; HTPassHighCtrlNum = FALSE; + + } else if (!strncmp(LYchar_set_names[i], "Taipei (Big5)", 13)) { + HTCJK = LYUseDefaultRawMode ? TAIPEI : NOCJK; + LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; + kanji_code = EUC; + HTPassEightBitRaw = FALSE; + HTPassEightBitNum = FALSE; + HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; + HTPassHighCtrlNum = FALSE; + + } else { + HTCJK = NOCJK; + kanji_code = NOKANJI; + HTPassEightBitRaw = LYUseDefaultRawMode ? FALSE : TRUE; + LYRawMode = HTPassEightBitRaw; + HTPassEightBitNum = FALSE; + HTPassHighCtrlRaw = FALSE; + HTPassHighCtrlNum = FALSE; } - /* - * Comment for coding below: - * UCLYhndl_for_unspec is "current" state with LYRawMode, - * but UCAssume_MIMEcharset is independent from LYRawMode: - * holds the history and may be changed from 'O'ptions menu only. - LP - */ if (LYRawMode) { - UCLYhndl_for_unspec = i; /* UCAssume_MIMEcharset not changed! */ + UCLYhndl_for_unspec = i; } else { - if (chndl != i && + if (chndl == -2) { + chndl = 0; + + if (UCAssume_MIMEcharset) + chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); + } + if (chndl != i && chndl >= 0 && (LYCharSet_UC[i].enc != UCT_ENC_CJK || LYCharSet_UC[chndl].enc != UCT_ENC_CJK)) { - UCLYhndl_for_unspec = chndl; /* fall to UCAssume_MIMEcharset */ + UCLYhndl_for_unspec = chndl; } else { - UCLYhndl_for_unspec = LATIN1; /* UCAssume_MIMEcharset not changed! */ + UCLYhndl_for_unspec = 0; } } @@ -554,45 +589,21 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i) } /* - * Function to set HTCJK based on "in" and "out" charsets. - */ -PUBLIC void Set_HTCJK ARGS2( - CONST char *, inMIMEname, - CONST char *, outMIMEname) -{ - if (LYRawMode) { - if ((!strcmp(inMIMEname, "euc-jp") || - !strcmp(inMIMEname, "shift_jis")) && - (!strcmp(outMIMEname, "euc-jp") || - !strcmp(outMIMEname, "shift_jis"))) { - HTCJK = JAPANESE; - } else if (!strcmp(inMIMEname, "euc-cn") && - !strcmp(outMIMEname, "euc-cn")) { - HTCJK = CHINESE; - } else if (!strcmp(inMIMEname, "big5") && - !strcmp(outMIMEname, "big5")) { - HTCJK = TAIPEI; - } else if (!strcmp(inMIMEname, "euc-kr") && - !strcmp(outMIMEname, "euc-kr")) { - HTCJK = KOREAN; - } else { - HTCJK = NOCJK; - } - } else { - HTCJK = NOCJK; - } -} - -/* * Function to set the LYDefaultRawMode value * based on the selected character set. - FM - * - * Currently unused: the default value so obvious - * that LYUseDefaultRawMode utilized directly by someone's mistake. - LP */ -PRIVATE void HTMLSetRawModeDefault ARGS1(int,i) +PUBLIC void HTMLSetRawModeDefault ARGS1(int,i) { - LYDefaultRawMode = (LYCharSet_UC[i].enc == UCT_ENC_CJK); + if (!strncmp(LYchar_set_names[i], "ISO Latin 1", 11) || + !strncmp(LYchar_set_names[i], "Chinese", 7) || + !strncmp(LYchar_set_names[i], "Japanese (EUC)", 14) || + !strncmp(LYchar_set_names[i], "Japanese (SJIS)", 15) || + !strncmp(LYchar_set_names[i], "Korean", 6) || + !strncmp(LYchar_set_names[i], "Taipei (Big5)", 13)) { + LYDefaultRawMode = TRUE; + } else { + LYDefaultRawMode = FALSE; + } return; } @@ -606,15 +617,32 @@ PUBLIC void HTMLSetUseDefaultRawMode ARGS2( BOOLEAN, modeflag) { if (LYCharSet_UC[i].enc != UCT_ENC_CJK) { + int chndl = 0; - int chndl = safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset); + if (UCAssume_MIMEcharset) + chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); if (i == chndl) LYUseDefaultRawMode = modeflag; else LYUseDefaultRawMode = (!modeflag); - } else /* CJK encoding: */ - LYUseDefaultRawMode = modeflag; - + } else if (!strncmp(LYchar_set_names[i], "ISO Latin 1", 11) || + !strncmp(LYchar_set_names[i], "Chinese", 7) || + !strncmp(LYchar_set_names[i], "Japanese (EUC)", 14) || + !strncmp(LYchar_set_names[i], "Japanese (SJIS)", 15) || + !strncmp(LYchar_set_names[i], "Korean", 6) || + !strncmp(LYchar_set_names[i], "Taipei (Big5)", 13)) { + if (modeflag == TRUE) { + LYUseDefaultRawMode = TRUE; + } else { + LYUseDefaultRawMode = FALSE; + } + } else { + if (modeflag == FALSE) { + LYUseDefaultRawMode = TRUE; + } else { + LYUseDefaultRawMode = FALSE; + } + } return; } @@ -622,9 +650,17 @@ PUBLIC void HTMLSetUseDefaultRawMode ARGS2( * Function to set the LYHaveCJKCharacterSet value * based on the selected character set. - FM */ -PRIVATE void HTMLSetHaveCJKCharacterSet ARGS1(int,i) +PUBLIC void HTMLSetHaveCJKCharacterSet ARGS1(int,i) { - LYHaveCJKCharacterSet = (LYCharSet_UC[i].enc == UCT_ENC_CJK); + if (!strncmp(LYchar_set_names[i], "Chinese", 7) || + !strncmp(LYchar_set_names[i], "Japanese (EUC)", 14) || + !strncmp(LYchar_set_names[i], "Japanese (SJIS)", 15) || + !strncmp(LYchar_set_names[i], "Korean", 6) || + !strncmp(LYchar_set_names[i], "Taipei (Big5)", 13)) { + LYHaveCJKCharacterSet = TRUE; + } else { + LYHaveCJKCharacterSet = FALSE; + } return; } @@ -636,142 +672,41 @@ PRIVATE void HTMLSetHaveCJKCharacterSet ARGS1(int,i) */ PRIVATE void HTMLSetDisplayCharsetMatchLocale ARGS1(int,i) { - BOOLEAN match; - - if (LYHaveCJKCharacterSet) { + if (strncasecomp(LYCharSet_UC[i].MIMEname, "cp", 2) || + strncasecomp(LYCharSet_UC[i].MIMEname, "windows", 7)) { /* - ** We have no intention to pass CJK via UCTransChar if that happened. - ** Let someone from CJK correct this if necessary. + ** Assume dos/windows displays usually on remote terminal, + ** so rarely match locale. + ** (in fact, MS Windows codepoints locale are never seen on UNIX). */ - DisplayCharsetMatchLocale = TRUE; /* old-style */ - return; - - } else if (strncasecomp(LYCharSet_UC[i].MIMEname, "cp", 2) || - strncasecomp(LYCharSet_UC[i].MIMEname, "windows", 7)) { - /* - ** Assume dos/windows displays usually on remote terminal, hence it - ** rarely matches locale. (In fact, MS Windows codepoints locale are - ** never seen on UNIX). - */ - match = FALSE; + DisplayCharsetMatchLocale = FALSE; } else { - match = TRUE; /* guess, but see below */ + DisplayCharsetMatchLocale = TRUE; + } #if !defined(LOCALE) - match = FALSE; -#else - if (UCForce8bitTOUPPER) { - /* - ** Force disable locale (from lynx.cfg) - */ - match = FALSE; - } + DisplayCharsetMatchLocale = FALSE; +#endif +#if defined(EXP_8BIT_TOUPPER) + /* + ** Force disable locale, + ** but we have no intention to pass CJK via UCTransChar if that happened. + ** Let someone from CJK correct this if necessary. + */ + if (!LYHaveCJKCharacterSet) + DisplayCharsetMatchLocale = FALSE; #endif - } - DisplayCharsetMatchLocale = match; return; } - -/* - * lynx 2.8/2.7.2(and more early) compatibility code: - * "human-readable" charset names changes with time - * so we map that history names to MIME here - * to get old lynx.cfg and (especially) .lynxrc always recognized. - * Please update this table when you change "fullname" of any present charset. - */ -typedef struct _names_pairs { - CONST char * fullname; - CONST char * MIMEname; -} names_pairs; - -PRIVATE CONST names_pairs OLD_charset_names[] = { - {"ISO Latin 1", "iso-8859-1"}, - {"ISO Latin 2", "iso-8859-2"}, - {"WinLatin1 (cp1252)", "windows-1252"}, - {"DEC Multinational", "dec-mcs"}, - {"Macintosh (8 bit)", "macintosh"}, - {"NeXT character set", "next"}, - {"KOI8-R Cyrillic", "koi8-r"}, - {"Chinese", "euc-cn"}, - {"Japanese (EUC)", "euc-jp"}, - {"Japanese (SJIS)", "shift_jis"}, - {"Korean", "euc-kr"}, - {"Taipei (Big5)", "big5"}, - {"Vietnamese (VISCII)", "viscii"}, - {"7 bit approximations","us-ascii"}, - {"Transparent", "x-transparent"}, - {"DosLatinUS (cp437)", "cp437"}, - {"IBM PC character set","cp437"}, - {"DosLatin1 (cp850)", "cp850"}, - {"IBM PC codepage 850", "cp850"}, - {"DosLatin2 (cp852)", "cp852"}, - {"PC Latin2 CP 852", "cp852"}, - {"DosCyrillic (cp866)", "cp866"}, - {"DosArabic (cp864)", "cp864"}, - {"DosGreek (cp737)", "cp737"}, - {"DosBaltRim (cp775)", "cp775"}, - {"DosGreek2 (cp869)", "cp869"}, - {"DosHebrew (cp862)", "cp862"}, - {"WinLatin2 (cp1250)", "windows-1250"}, - {"WinCyrillic (cp1251)","windows-1251"}, - {"WinGreek (cp1253)", "windows-1253"}, - {"WinHebrew (cp1255)", "windows-1255"}, - {"WinArabic (cp1256)", "windows-1256"}, - {"WinBaltRim (cp1257)", "windows-1257"}, - {"ISO Latin 3", "iso-8859-3"}, - {"ISO Latin 4", "iso-8859-4"}, - {"ISO 8859-5 Cyrillic", "iso-8859-5"}, - {"ISO 8859-6 Arabic", "iso-8859-6"}, - {"ISO 8859-7 Greek", "iso-8859-7"}, - {"ISO 8859-8 Hebrew", "iso-8859-8"}, - {"ISO 8859-9 (Latin 5)","iso-8859-9"}, - {"ISO 8859-10", "iso-8859-10"}, - {"UNICODE UTF 8", "utf-8"}, - {"RFC 1345 w/o Intro", "mnemonic+ascii+0"}, - {"RFC 1345 Mnemonic", "mnemonic"}, - {NULL, NULL}, /* terminated with NULL */ -}; - -/* - * lynx 2.8/2.7.2 compatibility code: - * read "character_set" parameter from lynx.cfg and .lynxrc - * in both MIME name and "human-readable" name (old and new style). - * Returns -1 if not recognized. - */ -PUBLIC int UCGetLYhndl_byAnyName ARGS1 (char *, value) -{ - int i; - - LYTrimTrailing(value); - if (value == NULL) return -1; - - /* search by name */ - for (i = 0; (i < MAXCHARSETS && LYchar_set_names[i]); i++) { - if (!strcmp(value, LYchar_set_names[i])) { - return i; /* OK */ - } - } - - /* search by old name from 2.8/2.7.2 version */ - for (i = 0; (OLD_charset_names[i].fullname); i++) { - if (!strcmp(value, OLD_charset_names[i].fullname)) { - return UCGetLYhndl_byMIME(OLD_charset_names[i].MIMEname); /* OK */ - } - } - - return UCGetLYhndl_byMIME(value); /* by MIME */ -} - - /* * Entity names -- Ordered by ISO Latin 1 value. * --------------------------------------------- * For conversions of DECIMAL escaped entities. * Must be in order of ascending value. */ -PRIVATE CONST char * LYEntityNames[] = { +PUBLIC CONST char * LYEntityNames[] = { /* NAME DECIMAL VALUE */ "nbsp", /* 160, non breaking space */ "iexcl", /* 161, inverted exclamation mark */ @@ -893,7 +828,7 @@ PUBLIC CONST char * HTMLGetEntityName ARGS1( * in the ISO_Latin1 and UC_entity_info unicode_entities arrays. * It returns 0 if not found. - FM * - * unicode_entities[] handles all the names from old style entities[] too. + * unicode_entities[] now handles all the names from old style entities[] too. * Lynx now calls unicode_entities[] only through this function: * HTMLGetEntityUCValue(). Note, we need not check for special characters * here in function or even before it, we should check them *after* @@ -908,6 +843,7 @@ PUBLIC UCode_t HTMLGetEntityUCValue ARGS1( UCode_t value = 0; size_t i, high, low; int diff = 0; +/* CONST char ** entities = HTML_dtd.entity_names; */ CONST UC_entity_info * unicode_entities = HTML_dtd.unicode_entity_info; /* @@ -916,6 +852,72 @@ PUBLIC UCode_t HTMLGetEntityUCValue ARGS1( if (!(name && *name)) return(value); + +#ifdef NOTDEFINED +/* +** unicode_entities[] now handles all names from entities[], so disable latter. +** Let us keep this some sort of comment until we remove +** all calls to old-style entities[] from the code. - LP +*/ + + /* + * Handle names that have control characters + * or strings in ISO_Latin1[]. - FM + */ + if (!strcmp(name, "nbsp")) { + return(160); + } + if (!strcmp(name, "shy")) { + return(173); + } + if (!strcmp(name, "ensp")) { + return(8194); + } + if (!strcmp(name, "emsp")) { + return(8195); + } + if (!strcmp(name, "thinsp")) { + return(8201); + } + if (!strcmp(name, "ndash") || + !strcmp(name, "endash")) { + return(8211); + } + if (!strcmp(name, "mdash") || + !strcmp(name, "emdash")) { + return(8212); + } + if (!strcmp(name, "trade")) { + return(8482); + } + + /* + * Now try ISO_Latin1[]. - FM + */ + for (low = 0, high = HTML_dtd.number_of_entities; + high > low; + diff < 0 ? (low = i+1) : (high = i)) { + /* + ** Binary search. + */ + i = (low + (high-low)/2); + diff = strcmp(entities[i], name); + if (diff == 0) { + if (strlen(ISO_Latin1[i]) == 1) { + value = (unsigned char)(ISO_Latin1[i][0]); + } + break; + } + } + if (value > 0) { + return(value); + } + + /* + * Not yet found... - FM + */ +#endif /* NOTDEFINED */ + /* * Try UC_entity_info unicode_entities[]. */ @@ -940,11 +942,10 @@ PUBLIC UCode_t HTMLGetEntityUCValue ARGS1( * Function to select a character set and then set the * character handling and LYHaveCJKCharacterSet flag. - FM */ -PUBLIC void HTMLUseCharacterSet ARGS1(int, i) +PUBLIC void HTMLUseCharacterSet ARGS1(int,i) { - HTMLSetRawModeDefault(i); p_entity_values = LYCharSets[i]; - HTMLSetCharacterHandling(i); /* set LYRawMode and CJK attributes */ + HTMLSetCharacterHandling(i); HTMLSetHaveCJKCharacterSet(i); HTMLSetDisplayCharsetMatchLocale(i); return; @@ -958,5 +959,17 @@ PUBLIC int LYCharSetsDeclared NOPARAMS { UCInit(); + if (UCAssume_MIMEcharset && *UCAssume_MIMEcharset) { + UCLYhndl_for_unspec = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); + } else { + UCLYhndl_for_unspec = 0; + } + if (UCAssume_localMIMEcharset && *UCAssume_localMIMEcharset) + UCLYhndl_HTFile_for_unspec = + UCGetLYhndl_byMIME(UCAssume_localMIMEcharset); + if (UCAssume_unrecMIMEcharset && *UCAssume_unrecMIMEcharset) + UCLYhndl_for_unrec = + UCGetLYhndl_byMIME(UCAssume_unrecMIMEcharset); + return UCInitialized; } diff --git a/src/LYCharSets.h b/src/LYCharSets.h index b5a889f7..ff68dd9b 100644 --- a/src/LYCharSets.h +++ b/src/LYCharSets.h @@ -1,20 +1,19 @@ + #ifndef LYCHARSETS_H #define LYCHARSETS_H -#include <HTUtils.h> -#include <UCDefs.h> - #ifndef UCMAP_H #include <UCMap.h> #endif /* !UCMAP_H */ extern BOOLEAN LYHaveCJKCharacterSet; -extern BOOLEAN DisplayCharsetMatchLocale; +extern BOOLEAN DisplayCharsetMatchLocale; /* - * currently active character set (internal handler) + * LYchar_set_name[current_char_set] points to the currently active set. */ extern int current_char_set; +extern CONST char * LYchar_set_names[]; /* * Initializer, calls initialization function for the @@ -23,20 +22,20 @@ extern int current_char_set; extern int LYCharSetsDeclared NOPARAMS; -extern CONST char ** LYCharSets[]; -extern CONST char * SevenBitApproximations[]; -extern CONST char ** p_entity_values; -extern CONST char * LYchar_set_names[]; /* Full name, not MIME */ +extern char ** LYCharSets[]; +extern char * SevenBitApproximations[]; +extern char ** p_entity_values; extern int LYlowest_eightbit[]; extern int LYNumCharsets; extern LYUCcharset LYCharSet_UC[]; -extern int UCGetLYhndl_byAnyName PARAMS((char *value)); extern void HTMLSetCharacterHandling PARAMS((int i)); +extern void HTMLSetRawModeDefault PARAMS((int i)); extern void HTMLSetUseDefaultRawMode PARAMS((int i, BOOLEAN modeflag)); +extern void HTMLSetHaveCJKCharacterSet PARAMS((int i)); extern void HTMLUseCharacterSet PARAMS((int i)); extern UCode_t HTMLGetEntityUCValue PARAMS((CONST char *name)); -extern void Set_HTCJK PARAMS((CONST char *inMIMEname, CONST char *outMIMEname)); +extern CONST char * LYEntityNames[]; extern CONST char * HTMLGetEntityName PARAMS((UCode_t code)); /* ** HTMLGetEntityName calls LYEntityNames for iso-8859-1 entity diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index dd62a239..e860ce47 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -3,6 +3,7 @@ ** ========================================================================== */ #include <HTUtils.h> +#include <tcp.h> #include <SGML.h> #define Lynx_HTML_Handler @@ -30,16 +31,24 @@ #include <HTNestedList.h> #include <GridText.h> #include <LYSignal.h> -#include <LYStrings.h> #include <LYUtils.h> #include <LYMap.h> #include <LYBookmark.h> #include <LYCurses.h> #include <LYCookie.h> +#ifdef VMS +#include <HTVMSUtils.h> +#endif /* VMS */ +#ifdef DOSPATH +#include <HTDOS.h> +#endif + #include <LYexit.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + extern BOOL HTPassEightBitRaw; extern BOOL HTPassEightBitNum; extern BOOL HTPassHighCtrlRaw; @@ -305,7 +314,7 @@ PUBLIC char *LYFindEndOfComment ARGS1( */ PUBLIC void LYFillLocalFileURL ARGS2( char **, href, - CONST char *, base) + char *, base) { char * temp = NULL; @@ -326,24 +335,15 @@ PUBLIC void LYFillLocalFileURL ARGS2( StrAllocCat(*href, "localhost"); } else if (!strncmp(*href, "file:///", 8)) { StrAllocCopy(temp, (*href+7)); - LYLocalFileToURL (href, temp); - } else if (!strncmp(*href, "file:/", 6) && !LYIsHtmlSep(*(*href+6))) { + StrAllocCopy(*href, "file://localhost"); + StrAllocCat(*href, temp); + } else if (!strncmp(*href, "file:/", 6) && *(*href+6) != '/') { StrAllocCopy(temp, (*href+5)); - LYLocalFileToURL (href, temp); + StrAllocCopy(*href, "file://localhost"); + StrAllocCat(*href, temp); } } -#if defined(DOSPATH) || defined(__EMX__) - if (*(*href+1) == ':') { - /* - * If it's a local DOS path beginning with drive letter, - * add file://localhost/ prefix and go ahead. - */ - StrAllocCopy(temp, *href); - LYLocalFileToURL (href, temp); - } -#endif /* DOSPATH */ - /* * No path in a file://localhost URL means a * directory listing for the current default. - FM @@ -359,9 +359,14 @@ PUBLIC void LYFillLocalFileURL ARGS2( #else getwd (curdir); #endif /* NO_GETCWD */ - temp2 = wwwName(curdir); +#ifdef DOSPATH + temp2 = HTDOS_wwwName(curdir); +#else + temp2 = curdir; +#endif /* DOSPATH */ #endif /* VMS */ - LYAddHtmlSep(href); + if (temp2[0] != '/') + StrAllocCat(*href, "/"); /* * Check for pathological cases - current dir has chars which * MUST BE URL-escaped - kw @@ -412,7 +417,7 @@ PUBLIC void LYFillLocalFileURL ARGS2( ** Currently this function is used for temporary files like "Lynx Info Page" ** and for one permanent - bookmarks (so it may be a problem if you change ** the display charset later: new bookmark entries may be mistranslated). -** - LP +** - LP */ PUBLIC void LYAddMETAcharsetToFD ARGS2( FILE *, fd, @@ -905,8 +910,11 @@ PUBLIC void LYExpandString ARGS2( ** The chartrans procedure failed, so we don't ** do anything, and hope for the best. - FM */ - CTRACE(tfp, "LYExpandString: Bad in (%d) or out (%d) handle(s).\n", + if (TRACE) { + fprintf(stderr, + "LYExpandString: Bad in (%d) or out (%d) handle(s).\n", me->inUCLYhndl, me->outUCLYhndl); + } return; } @@ -1049,7 +1057,7 @@ PUBLIC void LYExpandString ARGS2( saved_char_in = c; #endif /* NOTDEFINED */ if (me->T.trans_to_uni && - (code >= LYlowest_eightbit[me->inUCLYhndl] || + (code >= 127 || (code < 32 && code != 0 && me->T.trans_C0_to_uni))) { /* @@ -1255,7 +1263,7 @@ PUBLIC void LYExpandString ARGS2( ** back translate for our character set. - FM */ if (code > 160 && code < 256 && - me->outUCLYhndl != LATIN1 && + me->outUCLYhndl != 0 && (!(HTPassEightBitRaw || (me->T.do_8bitraw && !me->T.trans_from_uni)))) { value = (code - 160); @@ -1319,7 +1327,10 @@ PUBLIC void LYExpandString ARGS2( */ if (code == 8204 || code == 8205 || code == 8206 || code == 8207) { - CTRACE(tfp, "LYExpandString: Ignoring '%ld'.\n", code); + if (TRACE) { + fprintf(stderr, + "LYExpandString: Ignoring '%ld'.\n", code); + } if (me->T.decode_utf8 && *utf_buf) { utf_buf[0] == '\0'; utf_buf_p = utf_buf; @@ -1504,11 +1515,11 @@ PRIVATE char * UCPutUtf8ToBuffer ARGS3(char *, q, UCode_t, code, BOOL, terminate } /* as in HTParse.c, saves some calls - kw */ -PRIVATE CONST char *hex = "0123456789ABCDEF"; +PRIVATE char *hex = "0123456789ABCDEF"; /* - * Any raw 8-bit or multibyte characters already have been - * handled in relation to the display character set + * Any raw 8-bit or multibyte characters already have been + * handled in relation to the display character set * in SGML_character(), including named and numeric entities. * ** This function used for translations HTML special fields inside tags @@ -1571,20 +1582,6 @@ PRIVATE CONST char *hex = "0123456789ABCDEF"; ** if string translated or translation unnecessary, ** NULL otherwise ** (in which case something probably went wrong.) -** -** -** In general, this somehow ugly function (KW) -** cover three functions from v.2.7.2 (FM): -** extern void LYExpandString PARAMS(( -** HTStructured * me, -** char ** str)); -** extern void LYUnEscapeEntities PARAMS(( -** HTStructured * me, -** char ** str)); -** extern void LYUnEscapeToLatinOne PARAMS(( -** HTStructured * me, -** char ** str, -** BOOLEAN isURL)); */ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( @@ -1991,141 +1988,6 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( break; } else { code = lcode; - if ((code == 1) || - (code > 127 && code < 156)) { - /* - ** Assume these are Microsoft code points, inflicted on - ** us by FrontPage. - FM - ** - ** MS FrontPage uses syntax like ™ in 128-159 - ** range and doesn't follow Unicode standards for this - ** area. Windows-1252 codepoints are assumed here. - */ - switch (code) { - case 1: - /* - ** WHITE SMILING FACE - */ - code = 0x263a; - break; - case 128: - /* - ** EURO currency sign - */ - code = 0x20ac; - break; - case 130: - /* - ** SINGLE LOW-9 QUOTATION MARK (sbquo) - */ - code = 0x201a; - break; - case 132: - /* - ** DOUBLE LOW-9 QUOTATION MARK (bdquo) - */ - code = 0x201e; - break; - case 133: - /* - ** HORIZONTAL ELLIPSIS (hellip) - */ - code = 0x2026; - break; - case 134: - /* - ** DAGGER (dagger) - */ - code = 0x2020; - break; - case 135: - /* - ** DOUBLE DAGGER (Dagger) - */ - code = 0x2021; - break; - case 137: - /* - ** PER MILLE SIGN (permil) - */ - code = 0x2030; - break; - case 139: - /* - ** SINGLE LEFT-POINTING ANGLE QUOTATION MARK - ** (lsaquo) - */ - code = 0x2039; - break; - case 145: - /* - ** LEFT SINGLE QUOTATION MARK (lsquo) - */ - code = 0x2018; - break; - case 146: - /* - ** RIGHT SINGLE QUOTATION MARK (rsquo) - */ - code = 0x2019; - break; - case 147: - /* - ** LEFT DOUBLE QUOTATION MARK (ldquo) - */ - code = 0x201c; - break; - case 148: - /* - ** RIGHT DOUBLE QUOTATION MARK (rdquo) - */ - code = 0x201d; - break; - case 149: - /* - ** BULLET (bull) - */ - code = 0x2022; - break; - case 150: - /* - ** EN DASH (ndash) - */ - code = 0x2013; - break; - case 151: - /* - ** EM DASH (mdash) - */ - code = 0x2014; - break; - case 152: - /* - ** SMALL TILDE (tilde) - */ - code = 0x02dc; - break; - case 153: - /* - ** TRADE MARK SIGN (trade) - */ - code = 0x2122; - break; - case 155: - /* - ** SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - ** (rsaquo) - */ - code = 0x203a; - break; - default: - /* - ** Do not attempt a conversion - ** to valid Unicode values. - */ - break; - } - } state = S_check_uni; } break; @@ -2254,7 +2116,10 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( */ } else if (code == 8204 || code == 8205 || code == 8206 || code == 8207) { - CTRACE(tfp, "LYUCFullyTranslateString: Ignoring '%ld'.\n", code); + if (TRACE) { + fprintf(stderr, + "LYUCFullyTranslateString: Ignoring '%ld'.\n", code); + } replace_buf[0] = '\0'; state = S_got_outstring; break; @@ -2277,7 +2142,9 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( */ } else if (code < 161 || (code < 256 && - (HTPassEightBitNum || cs_to == LATIN1))) { + (HTPassEightBitNum || + !strncmp(LYchar_set_names[cs_to], + "ISO Latin 1", 11)))) { /* ** No conversion needed. */ @@ -2346,15 +2213,8 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( case S_check_name: /* ** Seek the Unicode value for the named entity. - ** - ** !!!! We manually recover the case of '=' terminator which - ** is commonly found on query to CGI-scripts - ** enclosed as href= URLs like "somepath/?x=1&yz=2" - ** Without this dirty fix, submission of such URLs was broken - ** if &yz string happened to be a recognized entity name. - LP */ - if ( ((code = HTMLGetEntityUCValue(name)) > 0) && - !((cpe == '=') && (stype == st_URL)) ) { + if ((code = HTMLGetEntityUCValue(name)) > 0) { state = S_check_uni; break; } @@ -2396,7 +2256,6 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( if (code >= 127 || (code < 32 && (code != 9 && code != 10 && code != 0))) { state = S_put_urlstring; - break; } } REPLACE_STRING(replace_buf); @@ -2513,12 +2372,12 @@ PUBLIC void LYHandleMETA ARGS4( HTStructured *, me, CONST BOOL*, present, CONST char **, value, - char **, include GCC_UNUSED) + char **, include) { char *http_equiv = NULL, *name = NULL, *content = NULL; char *href = NULL, *id_string = NULL, *temp = NULL; char *cp, *cp0, *cp1 = NULL; - int url_type = 0; + int url_type = 0, i; if (!me || !present) return; @@ -2571,10 +2430,13 @@ PUBLIC void LYHandleMETA ARGS4( FREE(content); } } - CTRACE(tfp, "LYHandleMETA: HTTP-EQUIV=\"%s\" NAME=\"%s\" CONTENT=\"%s\"\n", + if (TRACE) { + fprintf(stderr, + "LYHandleMETA: HTTP-EQUIV=\"%s\" NAME=\"%s\" CONTENT=\"%s\"\n", (http_equiv ? http_equiv : "NULL"), (name ? name : "NULL"), (content ? content : "NULL")); + } /* * Make sure we have META name/value pairs to handle. - FM @@ -2606,7 +2468,8 @@ PUBLIC void LYHandleMETA ARGS4( */ if ((!me->node_anchor->cache_control) && !strcasecomp((http_equiv ? http_equiv : ""), "Cache-Control")) { - LYLowerCase(content); + for (i = 0; content[i]; i++) + content[i] = TOLOWER(content[i]); StrAllocCopy(me->node_anchor->cache_control, content); if (me->node_anchor->no_cache == FALSE) { cp0 = content; @@ -2704,12 +2567,15 @@ PUBLIC void LYHandleMETA ARGS4( } else if (!(me->node_anchor->charset && *me->node_anchor->charset) && !strcasecomp((http_equiv ? http_equiv : ""), "Content-Type")) { LYUCcharset * p_in = NULL; - LYUCcharset * p_out = NULL; LYUCFullyTranslateString(&content, me->tag_charset, me->tag_charset, NO, NO, YES, st_other); LYTrimHead(content); LYTrimTail(content); - LYLowerCase(content); + /* + * Force the Content-type value to all lower case. - FM + */ + for (cp = content; *cp; cp++) + *cp = TOLOWER(*cp); if ((cp = strstr(content, "text/html;")) != NULL && (cp1 = strstr(content, "charset")) != NULL && @@ -2742,8 +2608,6 @@ PUBLIC void LYHandleMETA ARGS4( * Got something but we don't recognize it. */ chndl = UCLYhndl_for_unrec; - if (chndl < 0) /* UCLYhndl_for_unrec not defined :-( */ - chndl = UCLYhndl_for_unspec; /* always >= 0 */ if (UCCanTranslateFromTo(chndl, current_char_set)) { chartrans_ok = YES; HTAnchor_setUCInfoStage(me->node_anchor, chndl, @@ -2752,12 +2616,13 @@ PUBLIC void LYHandleMETA ARGS4( } } if (chartrans_ok) { + LYUCcharset * p_out = + HTAnchor_setUCInfoStage(me->node_anchor, + current_char_set, + UCT_STAGE_HTEXT, + UCT_SETBY_DEFAULT); p_in = HTAnchor_getUCInfoStage(me->node_anchor, UCT_STAGE_PARSER); - p_out = HTAnchor_setUCInfoStage(me->node_anchor, - current_char_set, - UCT_STAGE_HTEXT, - UCT_SETBY_DEFAULT); if (!p_out) { /* * Try again. @@ -2789,30 +2654,37 @@ PUBLIC void LYHandleMETA ARGS4( HTPassEightBitRaw = TRUE; } } else if (p_out->enc == UCT_ENC_CJK) { - Set_HTCJK(p_in->MIMEname, p_out->MIMEname); + if (LYRawMode) { + if ((!strcmp(p_in->MIMEname, "euc-jp") || + !strcmp(p_in->MIMEname, "shift_jis")) && + (!strcmp(p_out->MIMEname, "euc-jp") || + !strcmp(p_out->MIMEname, "shift_jis"))) { + HTCJK = JAPANESE; + } else if (!strcmp(p_in->MIMEname, "euc-cn") && + !strcmp(p_out->MIMEname, "euc-cn")) { + HTCJK = CHINESE; + } else if (!strcmp(p_in->MIMEname, "big-5") && + !strcmp(p_out->MIMEname, "big-5")) { + HTCJK = TAIPEI; + } else if (!strcmp(p_in->MIMEname, "euc-kr") && + !strcmp(p_out->MIMEname, "euc-kr")) { + HTCJK = KOREAN; + } else { + HTCJK = NOCJK; + } + } else { + HTCJK = NOCJK; + } } LYGetChartransInfo(me); - /* - ** Update the chartrans info homologously to - ** a Content-Type MIME header with a charset - ** parameter. - FM - */ - if (me->UCLYhndl != chndl) { - HTAnchor_setUCInfoStage(me->node_anchor, chndl, - UCT_STAGE_MIME, - UCT_SETBY_STRUCTURED); - HTAnchor_setUCInfoStage(me->node_anchor, chndl, - UCT_STAGE_PARSER, - UCT_SETBY_STRUCTURED); - me->inUCLYhndl = HTAnchor_getUCLYhndl(me->node_anchor, - UCT_STAGE_PARSER); - me->inUCI = HTAnchor_getUCInfoStage(me->node_anchor, - UCT_STAGE_PARSER); - } - UCSetTransParams(&me->T, - me->inUCLYhndl, me->inUCI, - me->outUCLYhndl, me->outUCI); - } else { + /* + * Fall through to old behavior. + */ + } else if (!strncmp(cp1, "us-ascii", 8) || + !strncmp(cp1, "iso-8859-1", 10)) { + StrAllocCopy(me->node_anchor->charset, "iso-8859-1"); + HTCJK = NOCJK; + /* * Hope it's a match, for now. - FM */ @@ -2825,11 +2697,46 @@ PUBLIC void LYHandleMETA ARGS4( HTPassEightBitRaw = TRUE; HTAlert(me->node_anchor->charset); + } else if (!strncmp(cp1, "euc-jp", 6) && HTCJK == JAPANESE) { + StrAllocCopy(me->node_anchor->charset, "euc-jp"); + + } else if (!strncmp(cp1, "shift_jis", 9) && HTCJK == JAPANESE) { + StrAllocCopy(me->node_anchor->charset, "shift_jis"); + + } else if (!strncmp(cp1, "iso-2022-jp", 11) && + HTCJK == JAPANESE) { + StrAllocCopy(me->node_anchor->charset, "iso-2022-jp"); + + } else if (!strncmp(cp1, "iso-2022-jp-2", 13) && + HTCJK == JAPANESE) { + StrAllocCopy(me->node_anchor->charset, "iso-2022-jp-2"); + + } else if (!strncmp(cp1, "euc-kr", 6) && HTCJK == KOREAN) { + StrAllocCopy(me->node_anchor->charset, "euc-kr"); + + } else if (!strncmp(cp1, "iso-2022-kr", 11) && HTCJK == KOREAN) { + StrAllocCopy(me->node_anchor->charset, "iso-2022-kr"); + + } else if ((!strncmp(cp1, "big5", 4) || + !strncmp(cp1, "cn-big5", 7)) && + HTCJK == TAIPEI) { + StrAllocCopy(me->node_anchor->charset, "big5"); + + } else if (!strncmp(cp1, "euc-cn", 6) && HTCJK == CHINESE) { + StrAllocCopy(me->node_anchor->charset, "euc-cn"); + + } else if ((!strncmp(cp1, "gb2312", 6) || + !strncmp(cp1, "cn-gb", 5)) && + HTCJK == CHINESE) { + StrAllocCopy(me->node_anchor->charset, "gb2312"); + + } else if (!strncmp(cp1, "iso-2022-cn", 11) && HTCJK == CHINESE) { + StrAllocCopy(me->node_anchor->charset, "iso-2022-cn"); } FREE(cp3); - if (me->node_anchor->charset) { - CTRACE(tfp, + if (TRACE && me->node_anchor->charset) { + fprintf(stderr, "LYHandleMETA: New charset: %s\n", me->node_anchor->charset); } @@ -2848,7 +2755,9 @@ PUBLIC void LYHandleMETA ARGS4( /* * Look for the Seconds field. - FM */ - cp = LYSkipBlanks(content); + cp = content; + while (*cp && isspace((unsigned char)*cp)) + cp++; if (*cp && isdigit(*cp)) { cp1 = cp; while (*cp1 && isdigit(*cp1)) @@ -3059,7 +2968,7 @@ PUBLIC void LYHandleP ARGS5( HTStructured *, me, CONST BOOL*, present, CONST char **, value, - char **, include GCC_UNUSED, + char **, include, BOOL, start) { if (TRUE) { @@ -3121,7 +3030,7 @@ PUBLIC void LYHandleP ARGS5( me->in_word = NO; if (LYoverride_default_alignment(me)) { - me->sp->style->alignment = LYstyles(me->sp[0].tag_number)->alignment; + me->sp->style->alignment = styles[me->sp[0].tag_number]->alignment; } else if (me->List_Nesting_Level >= 0 || ((me->Division_Level < 0) && (!strcmp(me->sp->style->name, "Normal") || @@ -3167,7 +3076,7 @@ PUBLIC void LYHandleSELECT ARGS5( HTStructured *, me, CONST BOOL*, present, CONST char **, value, - char **, include GCC_UNUSED, + char **, include, BOOL, start) { int i; @@ -3187,11 +3096,12 @@ PUBLIC void LYHandleSELECT ARGS5( */ if (!me->inFORM) { if (TRACE) { - fprintf(tfp, + fprintf(stderr, "Bad HTML: SELECT start tag not within FORM tag\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } /* @@ -3210,10 +3120,11 @@ PUBLIC void LYHandleSELECT ARGS5( */ if (me->inTEXTAREA) { if (TRACE) { - fprintf(tfp, "Bad HTML: Missing TEXTAREA end tag\n"); + fprintf(stderr, "Bad HTML: Missing TEXTAREA end tag\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } } @@ -3243,8 +3154,11 @@ PUBLIC void LYHandleSELECT ARGS5( /* * Let the size be determined by the number of OPTIONs. - FM */ - CTRACE(tfp, "LYHandleSELECT: Ignoring SIZE=\"%s\" for SELECT.\n", - value[HTML_SELECT_SIZE]); + if (TRACE) { + fprintf(stderr, + "LYHandleSELECT: Ignoring SIZE=\"%s\" for SELECT.\n", + (char *)value[HTML_SELECT_SIZE]); + } #endif /* NOTDEFINED */ } @@ -3294,10 +3208,11 @@ PUBLIC void LYHandleSELECT ARGS5( */ if (!me->inSELECT) { if (TRACE) { - fprintf(tfp, "Bad HTML: Unmatched SELECT end tag\n"); + fprintf(stderr, "Bad HTML: Unmatched SELECT end tag\n"); } else if (!me->inBadHTML) { - HTUserMsg(BAD_HTML_USE_TRACE); + _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; + sleep(MessageSecs); } return; } @@ -3432,7 +3347,7 @@ PUBLIC int LYLegitimizeHREF ARGS4( *pound = '\0'; convert_to_spaces(fragment, FALSE); } - LYRemoveBlanks(*href); + collapse_spaces(*href); if (fragment != NULL) { StrAllocCat(*href, fragment); FREE(fragment); @@ -3476,8 +3391,7 @@ PUBLIC int LYLegitimizeHREF ARGS4( * it, such that the bad partial reference might get corrected * by the document provider. - FM */ - char *temp = NULL, *path = NULL, *cp; - CONST char *str = ""; + char *temp = NULL, *path = NULL, *str = "", *cp; if (((temp = HTParse(*href, (me->inBASE ? @@ -3487,25 +3401,26 @@ PUBLIC int LYLegitimizeHREF ARGS4( PARSE_PATH+PARSE_PUNCTUATION)) != NULL && !strncmp(path, "/..", 3)) { cp = (path + 3); - if (LYIsHtmlSep(*cp) || *cp == '\0') { + if (*cp == '/' || *cp == '\0') { if ((me->inBASE ? me->base_href[4] : me->node_anchor->address[4]) == 's') { str = "s"; } if (TRACE) { - fprintf(tfp, + fprintf(stderr, "LYLegitimizeHREF: Bad value '%s' for http%s URL.\n", *href, str); - fprintf(tfp, + fprintf(stderr, " Stripping lead dots.\n"); } else if (!me->inBadHREF) { - HTUserMsg(BAD_PARTIAL_REFERENCE); + _statusline(BAD_PARTIAL_REFERENCE); me->inBadHREF = TRUE; + sleep(AlertSecs); } } if (*cp == '\0') { StrAllocCopy(*href, "/"); - } else if (LYIsHtmlSep(*cp)) { + } else if (*cp == '/') { while (!strncmp(cp, "/..", 3)) { if (*(cp + 3) == '/') { cp += 3; @@ -3551,7 +3466,7 @@ PUBLIC void LYCheckForContentBase ARGS1( if (*me->node_anchor->content_base == '\0') return; StrAllocCopy(cp, me->node_anchor->content_base); - LYRemoveBlanks(cp); + collapse_spaces(cp); } else if (me->node_anchor->content_location != NULL) { /* * We didn't have a Content-Base value, but do @@ -3561,7 +3476,7 @@ PUBLIC void LYCheckForContentBase ARGS1( if (*me->node_anchor->content_location == '\0') return; StrAllocCopy(cp, me->node_anchor->content_location); - LYRemoveBlanks(cp); + collapse_spaces(cp); if (!is_url(cp)) { FREE(cp); return; @@ -3685,6 +3600,7 @@ PUBLIC BOOLEAN LYoverride_default_alignment ARGS1( case HTML_ADDRESS: me->sp->style->alignment = HT_LEFT; return YES; + break; default: break; diff --git a/src/LYCharUtils.h b/src/LYCharUtils.h index dc5a6c7f..fb079332 100644 --- a/src/LYCharUtils.h +++ b/src/LYCharUtils.h @@ -38,10 +38,10 @@ extern char *LYFindEndOfComment PARAMS(( char * str)); extern void LYFillLocalFileURL PARAMS(( char ** href, - CONST char * base)); + char * base)); extern void LYAddMETAcharsetToFD PARAMS(( - FILE * fd, - int disp_chndl)); + FILE * fd, + int disp_chndl)); #ifdef Lynx_HTML_Handler extern int OL_CONTINUE; /* flag for whether CONTINUE is set */ diff --git a/src/LYClean.c b/src/LYClean.c index 113cc7cf..69b2cdbf 100644 --- a/src/LYClean.c +++ b/src/LYClean.c @@ -1,18 +1,19 @@ #include <HTUtils.h> +#include <tcp.h> #include <LYCurses.h> #include <LYUtils.h> #include <LYSignal.h> #include <LYClean.h> -#include <LYMainLoop.h> #include <LYGlobalDefs.h> #include <LYStrings.h> #include <LYTraversal.h> -#include <LYCookie.h> #include <UCAuto.h> #include <LYexit.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + #ifdef VMS BOOLEAN HadVMSInterrupt = FALSE; #endif /* VMS */ @@ -132,11 +133,15 @@ PUBLIC void cleanup_sig ARGS1( /* * Called by Interrupt handler or at quit time. - * Erases the temporary files that lynx created. + * Erases the temporary files that lynx created + * temporary files are removed by tempname + * which created them. */ PUBLIC void cleanup_files NOARGS { - LYCleanupTemp(); + char filename[256]; + + tempname(filename, REMOVE_FILES); FREE(lynx_temp_space); } @@ -179,18 +184,6 @@ PUBLIC void cleanup NOARGS #endif /* LINUX */ #endif /* EXP_CHARTRANS_AUTOSWITCH */ -#ifdef EXP_PERSISTENT_COOKIES - /* - * This can go right here for now. We need to work up a better place - * to save cookies for the next release, preferably whenever a new - * persistent cookie is received or used. Some sort of protocol to - * handle two processes writing to the cookie file needs to be worked - * out as well. - */ - if (persistent_cookies) - LYStoreCookies (LYCookieFile); -#endif - cleanup_files(); for (i = 0; i < nhist; i++) { FREE(history[i].title); @@ -205,5 +198,13 @@ PUBLIC void cleanup NOARGS DidCleanup = TRUE; #endif /* VMS */ - LYCloseTracelog(); + fflush(stdout); + fflush(stderr); + if (LYTraceLogFP != NULL) { + fclose(LYTraceLogFP); + LYTraceLogFP = NULL; +#if !defined(VMS) || (defined(VMS) && !defined(VAXC) && !defined(UCX)) + *stderr = LYOrigStderr; +#endif /* !VMS || (VMS && !VAXC && !UCX) */ + } } diff --git a/src/LYClean.h b/src/LYClean.h index f19d08e3..e9502010 100644 --- a/src/LYClean.h +++ b/src/LYClean.h @@ -1,16 +1,18 @@ #ifndef LYCLEAN_H #define LYCLEAN_H -#include <HTUtils.h> - #ifdef VMS extern BOOLEAN HadVMSInterrupt; #endif extern void cleanup_sig PARAMS((int sig)); +extern BOOLEAN setup PARAMS((char *terminal)); extern void cleanup NOPARAMS; extern void cleanup_files NOPARAMS; extern void set_alarm PARAMS((int sig)); extern void reset_alarm NOPARAMS; +#define NEW_FILE 0 +#define REMOVE_FILES 1 + #endif /* LYCLEAN_H */ diff --git a/src/LYCookie.c b/src/LYCookie.c index 2e115499..bde4a81d 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -17,10 +17,12 @@ ** - FM 1997-08-02 ** ** TO DO: (roughly in order of decreasing priority) + * A means to specify "always allow" and "never allow" domains via + a configuration file is needed. * Hex escaping isn't considered at all. Any semi-colons, commas, or spaces actually in cookie names or values (i.e., not serving as punctuation for the overall Set-Cookie value) should be hex - escaped if not quoted, but presumably the server is expecting + escaped if not quoted, but presumeably the server is expecting them to be hex escaped in our Cookie request header as well, so in theory we need not unescape them. We'll see how this works out in practice. @@ -38,10 +40,12 @@ of use. * If a cookie has the secure flag set, we presently treat only SSL connections as secure. This may need to be expanded for other - secure communication protocols that become standardized. + secure communication protocols that become standarized. + * Cookies could be optionally stored in a file from session to session. */ #include <HTUtils.h> +#include <tcp.h> #include <HTAccess.h> #include <HTParse.h> #include <HTAlert.h> @@ -53,6 +57,7 @@ #include <LYGlobalDefs.h> #include <LYEdit.h> #include <LYStrings.h> +#include <LYSystem.h> #include <GridText.h> #include <LYUtils.h> #include <LYCharUtils.h> @@ -60,9 +65,7 @@ #include <LYLeaks.h> -#define max_cookies_domain 50 -#define max_cookies_global 500 -#define max_cookies_buffer 4096 +#define FREE(x) if (x) {free(x); x = NULL;} /* ** The first level of the cookie list is a list indexed by the domain @@ -70,7 +73,7 @@ ** list. Thus, finding the cookies that apply to a given URL is a ** two-level scan; first we check each domain to see if it applies, ** and if so, then we check the paths of all the cookies on that -** list. We keep a running total of cookies as we add or delete +** list. We keep a running total of cookies as we add or delete ** them */ PRIVATE HTList *domain_list = NULL; @@ -92,7 +95,6 @@ struct _cookie { int flags; /* Various flags */ time_t expires;/* The time when this cookie expires */ BOOL quoted; /* Was a value quoted in the Set-Cookie header? */ - BOOL from_file; /* Was this cookie loaded from the file jar? - RP */ }; typedef struct _cookie cookie; @@ -101,8 +103,6 @@ typedef struct _cookie cookie; #define COOKIE_FLAG_EXPIRES_SET 4 /* If set, an expiry date was set */ #define COOKIE_FLAG_DOMAIN_SET 8 /* If set, an non-default domain was set */ #define COOKIE_FLAG_PATH_SET 16 /* If set, an non-default path was set */ -#define COOKIE_FLAG_PERSISTENT 32 /* If set, this cookie was persistent */ - struct _HTStream { HTStreamClass * isa; @@ -285,7 +285,9 @@ PRIVATE void store_cookie ARGS3( * not a prefix of the request-URI. */ if (strncmp(co->path, path, co->pathlen) != 0) { - CTRACE(tfp, "store_cookie: Rejecting because '%s' is not a prefix of '%s'.\n", + if (TRACE) + fprintf(stderr, + "store_cookie: Rejecting because '%s' is not a prefix of '%s'.\n", co->path, path); freeCookie(co); co = NULL; @@ -300,7 +302,9 @@ PRIVATE void store_cookie ARGS3( * The hostname does not contain a dot. */ if (strchr(hostname, '.') == NULL) { - CTRACE(tfp, "store_cookie: Rejecting because '%s' has no dot.\n", + if (TRACE) + fprintf(stderr, + "store_cookie: Rejecting because '%s' has no dot.\n", hostname); freeCookie(co); co = NULL; @@ -315,7 +319,9 @@ PRIVATE void store_cookie ARGS3( * value otherwise qualified. - FM */ if (co->domain[0] != '.' || co->domain[1] == '\0') { - CTRACE(tfp, "store_cookie: Rejecting domain '%s'.\n", + if (TRACE) + fprintf(stderr, + "store_cookie: Rejecting domain '%s'.\n", co->domain); freeCookie(co); co = NULL; @@ -323,7 +329,9 @@ PRIVATE void store_cookie ARGS3( } ptr = strchr((co->domain + 1), '.'); if (ptr == NULL || ptr[1] == '\0') { - CTRACE(tfp, "store_cookie: Rejecting domain '%s'.\n", + if (TRACE) + fprintf(stderr, + "store_cookie: Rejecting domain '%s'.\n", co->domain); freeCookie(co); co = NULL; @@ -335,7 +343,9 @@ PRIVATE void store_cookie ARGS3( * not domain-match the Domain attribute. */ if (!host_matches(hostname, co->domain)) { - CTRACE(tfp, "store_cookie: Rejecting domain '%s' for host '%s'.\n", + if (TRACE) + fprintf(stderr, + "store_cookie: Rejecting domain '%s' for host '%s'.\n", co->domain, hostname); freeCookie(co); co = NULL; @@ -355,22 +365,21 @@ PRIVATE void store_cookie ARGS3( strlen(INVALID_COOKIE_DOMAIN_CONFIRMATION) + 1)); - if (msg == 0) - outofmem(__FILE__, "store_cookie"); - if (!LYAcceptAllCookies) { - sprintf(msg, - INVALID_COOKIE_DOMAIN_CONFIRMATION, - co->domain, - hostname); - if (!HTConfirm(msg)) { - CTRACE(tfp, "store_cookie: Rejecting domain '%s' for host '%s'.\n", - co->domain, - hostname); - freeCookie(co); - co = NULL; - FREE(msg); - return; + sprintf(msg, + INVALID_COOKIE_DOMAIN_CONFIRMATION, + co->domain, + hostname); + if (!HTConfirm(msg)) { + if (TRACE) { + fprintf(stderr, + "store_cookie: Rejecting domain '%s' for host '%s'.\n", + co->domain, + hostname); } + freeCookie(co); + co = NULL; + FREE(msg); + return; } FREE(msg); } @@ -409,22 +418,7 @@ PRIVATE void store_cookie ARGS3( de = (domain_entry *)calloc(1, sizeof(domain_entry)); if (de == NULL) outofmem(__FILE__, "store_cookie"); -#ifdef EXP_PERSISTENT_COOKIES - /* - * Ok, this is a problem. The first cookie for a domain - * effectively sets the policy for that whole domain - for - * something like Netlink, where there are lots of websites - * under www.netlink.co.uk, this isn't sensible. However, - * taking this sort of decision down to cookie level also - * isn't sensible. Perhaps something based on the domain - * and the path in conjunction makes more sense? - RP - */ - if (persistent_cookies - && (co->flags & COOKIE_FLAG_PERSISTENT)) - de->bv = FROM_FILE; - else -#endif - de->bv = QUERY_USER; + de->bv = QUERY_USER; cookie_list = de->cookie_list = HTList_new(); StrAllocCopy(de->domain, co->domain); HTList_addObject(domain_list, de); @@ -479,16 +473,20 @@ PRIVATE void store_cookie ARGS3( /* * Don't add the cookie if we're over the domain's limit. - FM */ - } else if (HTList_count(cookie_list) > max_cookies_domain) { - CTRACE(tfp, "store_cookie: Domain's cookie limit exceeded! Rejecting cookie.\n"); + } else if (HTList_count(cookie_list) > 50) { + if (TRACE) + fprintf(stderr, + "store_cookie: Domain's cookie limit exceeded! Rejecting cookie.\n"); freeCookie(co); co = NULL; /* * Don't add the cookie if we're over the total cookie limit. - FM */ - } else if (total_cookies > max_cookies_global) { - CTRACE(tfp, "store_cookie: Total cookie limit exceeded! Rejecting cookie.\n"); + } else if (total_cookies > 500) { + if (TRACE) + fprintf(stderr, + "store_cookie: Total cookie limit exceeded! Rejecting cookie.\n"); freeCookie(co); co = NULL; @@ -505,25 +503,9 @@ PRIVATE void store_cookie ARGS3( * Get confirmation if we need it, and add cookie * if confirmed or 'allow' is set to always. - FM */ - } else if (HTConfirmCookie(de, hostname, co->name, co->value)) { - -#ifdef EXP_PERSISTENT_COOKIES - /* - * If the cookie domain came from persistent cookie file, - * we want to add new cookies to the end of the cookie list - * to maintain their order for servers that need cookies in - * a particular order. This is a hack. - */ - if (persistent_cookies) { - if ((de->bv = FROM_FILE) != 0) { - HTList_appendObject(cookie_list, co); - } else { - HTList_insertObjectAt(cookie_list, co, pos); - } - } -#else + } else if (HTConfirmCookie(de, hostname, + co->domain, co->path, co->name, co->value)) { HTList_insertObjectAt(cookie_list, co, pos); -#endif /* EXP_PERSISTENT_COOKIES */ total_cookies++; } else { freeCookie(co); @@ -554,12 +536,12 @@ PRIVATE char * scan_cookie_sublist ARGS6( co = (cookie *)hl->object; next = hl->next; - if (co) { - CTRACE(tfp, "Checking cookie %lx %s=%s\n", + if (TRACE && co) { + fprintf(stderr, "Checking cookie %lx %s=%s\n", (long)hl, (co->name ? co->name : "(no name)"), (co->value ? co->value : "(no value)")); - CTRACE(tfp, "%s %s %d %s %s %d%s\n", + fprintf(stderr, "%s %s %d %s %s %d%s\n", hostname, (co->domain ? co->domain : "(no domain)"), host_matches(hostname, co->domain), @@ -629,27 +611,10 @@ PRIVATE char * scan_cookie_sublist ARGS6( /* * Check if we should fold the header. - FM */ - - /* - * Section 2.2 of RFC1945 says: - * - * HTTP/1.0 headers may be folded onto multiple lines - * if each continuation line begins with a space or - * horizontal tab. All linear whitespace, including - * folding, has the same semantics as SP. - * [...] - * However, folding of header lines is not expected by - * some applications, and should not be generated by - * HTTP/1.0 applications. - * - * This code was causing problems. Let's not use it. -BJP - */ - - /* if (len > 800) { */ - /* StrAllocCat(header, crlftab); */ - /* len = 0; */ - /* } */ - + if (len > 800) { + StrAllocCat(header, crlftab); + len = 0; + } } /* * Include the cookie name=value pair. @@ -753,12 +718,14 @@ PRIVATE void LYProcessSetCookies ARGS6( * adding each cookie to the CombinedCookies list. - FM */ p = (SetCookie2 ? SetCookie2 : ""); - if (SetCookie && *p) { - CTRACE(tfp, "LYProcessSetCookies: Using Set-Cookie2 header.\n"); + if (TRACE && SetCookie && *p) { + fprintf(stderr, "LYProcessSetCookies: Using Set-Cookie2 header.\n"); } - while (NumCookies <= max_cookies_domain && *p) { + while (NumCookies <= 50 && *p) { attr_start = attr_end = value_start = value_end = NULL; - p = LYSkipCBlanks(p); + while (*p != '\0' && isspace((unsigned char)*p)) { + p++; + } /* * Get the attribute name. */ @@ -767,7 +734,9 @@ PRIVATE void LYProcessSetCookies ARGS6( *p != '=' && *p != ';' && *p != ',') p++; attr_end = p; - p = LYSkipCBlanks(p); + while (*p != '\0' && isspace((unsigned char)*p)) { + p++; + } /* * Check for an '=' delimiter, or an 'expires' name followed @@ -787,7 +756,9 @@ PRIVATE void LYProcessSetCookies ARGS6( if (*p == '=') { p++; } - p = LYSkipCBlanks(p); + while (*p != '\0' && isspace((unsigned char)*p)) { + p++; + } /* * Hack alert! We must handle Netscape-style cookies with * "Expires=Mon, 01-Jan-96 13:45:35 GMT" or @@ -849,16 +820,20 @@ PRIVATE void LYProcessSetCookies ARGS6( while (isdigit((unsigned char)*p)) p++; value_end = p; - p = LYSkipCBlanks(p); + while (isspace((unsigned char)*p)) + p++; if (*p == '\0' || *p == ';') break; if (*p == ',') { - cp = LYSkipCBlanks(p + 1); + cp = (p + 1); + while (*cp != '\0' && isspace((unsigned char)*cp)) + cp++; if (*cp != '\0' && isdigit((unsigned char)*cp)) { cp1 = cp; while (isdigit((unsigned char)*cp1)) cp1++; - cp1 = LYSkipCBlanks(cp1); + while (*cp != '\0' && isspace((unsigned char)*cp)) + cp1++; if (*cp1 == '\0' || *cp1 == ',' || *cp1 == ';') { p = cp; continue; @@ -933,8 +908,8 @@ PRIVATE void LYProcessSetCookies ARGS6( if (value_end > value_start) { int value_len = (value_end - value_start); - if (value_len > max_cookies_buffer) { - value_len = max_cookies_buffer; + if (value_len > 4096) { + value_len = 4096; } value = (char *)calloc(1, value_len + 1); if (value == NULL) @@ -1001,7 +976,9 @@ PRIVATE void LYProcessSetCookies ARGS6( url_type == HTTPS_URL_TYPE)) { length += strlen(cur_cookie->commentURL); } else { - CTRACE(tfp, "LYProcessSetCookies: Rejecting commentURL value '%s'\n", + if (TRACE) + fprintf(stderr, + "LYProcessSetCookies: Rejecting commentURL value '%s'\n", cur_cookie->commentURL); FREE(cur_cookie->commentURL); } @@ -1030,9 +1007,11 @@ PRIVATE void LYProcessSetCookies ARGS6( isdigit((unsigned char)*ptr)) ptr++; if (*ptr != '\0') { - CTRACE(tfp, + if (TRACE) { + fprintf(stderr, "LYProcessSetCookies: Adding lead dot for domain value '%s'\n", value); + } StrAllocCopy(cur_cookie->domain, "."); StrAllocCat(cur_cookie->domain, value); } else { @@ -1115,7 +1094,9 @@ PRIVATE void LYProcessSetCookies ARGS6( cur_cookie->expires = (time_t)0; } else { cur_cookie->expires = (time(NULL) + temp); - CTRACE(tfp, "LYSetCookie: expires %ld, %s", + if (TRACE) + fprintf(stderr, + "LYSetCookie: expires %ld, %s", (long) cur_cookie->expires, ctime(&cur_cookie->expires)); } @@ -1138,7 +1119,9 @@ PRIVATE void LYProcessSetCookies ARGS6( cur_cookie->flags |= COOKIE_FLAG_EXPIRES_SET; cur_cookie->expires = LYmktime(value, FALSE); if (cur_cookie->expires > 0) { - CTRACE(tfp, "LYSetCookie: expires %ld, %s", + if (TRACE) + fprintf(stderr, + "LYSetCookie: expires %ld, %s", (long) cur_cookie->expires, ctime(&cur_cookie->expires)); } @@ -1159,7 +1142,7 @@ PRIVATE void LYProcessSetCookies ARGS6( * If we've started a cookie, and it's not too big, * save it in the CombinedCookies list. - FM */ - if (length <= max_cookies_buffer && cur_cookie != NULL) { + if (length <= 4096 && cur_cookie != NULL) { /* * Assume version 1 if not set to that or higher. - FM */ @@ -1168,14 +1151,16 @@ PRIVATE void LYProcessSetCookies ARGS6( } HTList_appendObject(CombinedCookies, cur_cookie); } else if (cur_cookie != NULL) { - CTRACE(tfp, + if (TRACE) { + fprintf(stderr, "LYProcessSetCookies: Rejecting Set-Cookie2: %s=%s\n", (cur_cookie->name ? cur_cookie->name : "[no name]"), (cur_cookie->value ? cur_cookie->value : "[no value]")); - CTRACE(tfp, - " due to excessive length!\n"); + fprintf(stderr, + " due to excessive length!\n"); + } freeCookie(cur_cookie); cur_cookie = NULL; } @@ -1205,24 +1190,23 @@ PRIVATE void LYProcessSetCookies ARGS6( * Add any final SetCookie2 cookie to the CombinedCookie list * if we are within the length limit. - FM */ - if (NumCookies <= max_cookies_domain - && length <= max_cookies_buffer - && cur_cookie != NULL) { + if (NumCookies <= 50 && length <= 4096 && cur_cookie != NULL) { if (cur_cookie->version < 1) { cur_cookie->version = 1; } HTList_appendObject(CombinedCookies, cur_cookie); } else if (cur_cookie != NULL) { - CTRACE(tfp, "LYProcessSetCookies: Rejecting Set-Cookie2: %s=%s\n", + if (TRACE) { + fprintf(stderr, + "LYProcessSetCookies: Rejecting Set-Cookie2: %s=%s\n", (cur_cookie->name ? cur_cookie->name : "[no name]"), (cur_cookie->value ? cur_cookie->value : "[no value]")); - CTRACE(tfp, " due to excessive %s%s%s\n", - (length > max_cookies_buffer ? "length" : ""), - (length > max_cookies_buffer && - NumCookies > max_cookies_domain - ? " and " - : ""), - (NumCookies > max_cookies_domain ? "number!\n" : "!\n")); + fprintf(stderr, + " due to excessive %s%s%s\n", + (length > 4096 ? "length" : ""), + (length > 4096 && NumCookies > 50 ? " and " : ""), + (NumCookies > 50 ? "number!\n" : "!\n")); + } freeCookie(cur_cookie); cur_cookie = NULL; } @@ -1235,12 +1219,14 @@ PRIVATE void LYProcessSetCookies ARGS6( NumCookies = 0; cur_cookie = NULL; p = ((SetCookie && !(SetCookie2 && *SetCookie2)) ? SetCookie : ""); - if (SetCookie2 && *p) { - CTRACE(tfp, "LYProcessSetCookies: Using Set-Cookie header.\n"); + if (TRACE && SetCookie2 && *p) { + fprintf(stderr, "LYProcessSetCookies: Using Set-Cookie header.\n"); } - while (NumCookies <= max_cookies_domain && *p) { + while (NumCookies <= 50 && *p) { attr_start = attr_end = value_start = value_end = NULL; - p = LYSkipCBlanks(p); + while (*p != '\0' && isspace((unsigned char)*p)) { + p++; + } /* * Get the attribute name. */ @@ -1249,7 +1235,9 @@ PRIVATE void LYProcessSetCookies ARGS6( *p != '=' && *p != ';' && *p != ',') p++; attr_end = p; - p = LYSkipCBlanks(p); + while (*p != '\0' && isspace((unsigned char)*p)) { + p++; + } /* * Check for an '=' delimiter, or an 'expires' name followed @@ -1265,7 +1253,9 @@ PRIVATE void LYProcessSetCookies ARGS6( if (*p == '=') { p++; } - p = LYSkipCBlanks(p); + while (*p != '\0' && isspace((unsigned char)*p)) { + p++; + } /* * Hack alert! We must handle Netscape-style cookies with * "Expires=Mon, 01-Jan-96 13:45:35 GMT" or @@ -1327,16 +1317,20 @@ PRIVATE void LYProcessSetCookies ARGS6( while (isdigit((unsigned char)*p)) p++; value_end = p; - p = LYSkipCBlanks(p); + while (isspace((unsigned char)*p)) + p++; if (*p == '\0' || *p == ';') break; if (*p == ',') { - cp = LYSkipCBlanks(p + 1); + cp = (p + 1); + while (*cp != '\0' && isspace((unsigned char)*cp)) + cp++; if (*cp != '\0' && isdigit((unsigned char)*cp)) { cp1 = cp; while (isdigit((unsigned char)*cp1)) cp1++; - cp1 = LYSkipCBlanks(cp1); + while (*cp != '\0' && isspace((unsigned char)*cp)) + cp1++; if (*cp1 == '\0' || *cp1 == ',' || *cp1 == ';') { p = cp; continue; @@ -1412,8 +1406,8 @@ PRIVATE void LYProcessSetCookies ARGS6( if (value_end > value_start) { int value_len = (value_end - value_start); - if (value_len > max_cookies_buffer) { - value_len = max_cookies_buffer; + if (value_len > 4096) { + value_len = 4096; } value = (char *)calloc(1, value_len + 1); if (value == NULL) @@ -1480,7 +1474,9 @@ PRIVATE void LYProcessSetCookies ARGS6( url_type == HTTPS_URL_TYPE)) { length += strlen(cur_cookie->commentURL); } else { - CTRACE(tfp, "LYProcessSetCookies: Rejecting commentURL value '%s'\n", + if (TRACE) + fprintf(stderr, + "LYProcessSetCookies: Rejecting commentURL value '%s'\n", cur_cookie->commentURL); FREE(cur_cookie->commentURL); } @@ -1509,9 +1505,11 @@ PRIVATE void LYProcessSetCookies ARGS6( isdigit((unsigned char)*ptr)) ptr++; if (*ptr != '\0') { - CTRACE(tfp, + if (TRACE) { + fprintf(stderr, "LYProcessSetCookies: Adding lead dot for domain value '%s'\n", value); + } StrAllocCopy(cur_cookie->domain, "."); StrAllocCat(cur_cookie->domain, value); } else { @@ -1625,7 +1623,7 @@ PRIVATE void LYProcessSetCookies ARGS6( * If we've started a cookie, and it's not too big, * save it in the CombinedCookies list. - FM */ - if (length <= max_cookies_buffer && cur_cookie != NULL) { + if (length <= 4096 && cur_cookie != NULL) { /* * If we had a Set-Cookie2 header, make sure * the version is at least 1, and mark it for @@ -1639,12 +1637,16 @@ PRIVATE void LYProcessSetCookies ARGS6( } HTList_appendObject(CombinedCookies, cur_cookie); } else if (cur_cookie != NULL) { - CTRACE(tfp, "LYProcessSetCookies: Rejecting Set-Cookie: %s=%s\n", + if (TRACE) { + fprintf(stderr, + "LYProcessSetCookies: Rejecting Set-Cookie: %s=%s\n", (cur_cookie->name ? cur_cookie->name : "[no name]"), (cur_cookie->value ? cur_cookie->value : "[no value]")); - CTRACE(tfp, " due to excessive length!\n"); + fprintf(stderr, + " due to excessive length!\n"); + } freeCookie(cur_cookie); cur_cookie = NULL; } @@ -1673,7 +1675,7 @@ PRIVATE void LYProcessSetCookies ARGS6( /* * Handle the final Set-Cookie cookie if within length limit. - FM */ - if (NumCookies <= max_cookies_domain && length <= max_cookies_buffer && cur_cookie != NULL) { + if (NumCookies <= 50 && length <= 4096 && cur_cookie != NULL) { if (SetCookie2 != NULL) { if (cur_cookie->version < 1) { cur_cookie->version = 1; @@ -1682,13 +1684,17 @@ PRIVATE void LYProcessSetCookies ARGS6( } HTList_appendObject(CombinedCookies, cur_cookie); } else if (cur_cookie != NULL) { - CTRACE(tfp, "LYProcessSetCookies: Rejecting Set-Cookie: %s=%s\n", + if (TRACE) { + fprintf(stderr, + "LYProcessSetCookies: Rejecting Set-Cookie: %s=%s\n", (cur_cookie->name ? cur_cookie->name : "[no name]"), (cur_cookie->value ? cur_cookie->value : "[no value]")); - CTRACE(tfp, " due to excessive %s%s%s\n", - (length > max_cookies_buffer ? "length" : ""), - (length > max_cookies_buffer && NumCookies > max_cookies_domain ? " and " : ""), - (NumCookies > max_cookies_domain ? "number!\n" : "!\n")); + fprintf(stderr, + " due to excessive %s%s%s\n", + (length > 4096 ? "length" : ""), + (length > 4096 && NumCookies > 50 ? " and " : ""), + (NumCookies > 50 ? "number!\n" : "!\n")); + } freeCookie(cur_cookie); cur_cookie = NULL; } @@ -1699,19 +1705,24 @@ PRIVATE void LYProcessSetCookies ARGS6( */ cl = CombinedCookies; while (NULL != (co = (cookie *)HTList_nextObject(cl))) { - CTRACE(tfp, "LYProcessSetCookie: attr=value pair: '%s=%s'\n", + if (TRACE) { + fprintf(stderr, "LYProcessSetCookie: attr=value pair: '%s=%s'\n", (co->name ? co->name : "[no name]"), (co->value ? co->value : "[no value]")); - if (co->expires > 0) { - CTRACE(tfp, " expires: %ld, %s\n", - (long)co->expires, - ctime(&co->expires)); + if (co->expires > 0) { + fprintf(stderr, " expires: %ld, %s\n", + (long)co->expires, + ctime(&co->expires)); + } } if (!strncasecomp(address, "https:", 6) && LYForceSSLCookiesSecure == TRUE && !(co->flags & COOKIE_FLAG_SECURE)) { co->flags |= COOKIE_FLAG_SECURE; - CTRACE(tfp, " Forced the 'secure' flag on.\n"); + if (TRACE) { + fprintf(stderr, + " Forced the 'secure' flag on.\n"); + } } store_cookie(co, hostname, path); } @@ -1769,19 +1780,23 @@ PUBLIC void LYSetCookie ARGS3( */ BadHeaders = TRUE; } - CTRACE(tfp, "LYSetCookie called with host '%s', path '%s',\n", + if (TRACE) { + fprintf(stderr, + "LYSetCookie called with host '%s', path '%s',\n", (hostname ? hostname : ""), (path ? path : "")); - if (SetCookie) { - CTRACE(tfp, " and Set-Cookie: '%s'\n", - (SetCookie ? SetCookie : "")); - } - if (SetCookie2) { - CTRACE(tfp, " and Set-Cookie2: '%s'\n", - (SetCookie2 ? SetCookie2 : "")); - } - if (LYSetCookies == FALSE || BadHeaders == TRUE) { - CTRACE(tfp, " Ignoring this Set-Cookie/Set-Cookie2 request.\n"); + if (SetCookie) { + fprintf(stderr, " and Set-Cookie: '%s'\n", + (SetCookie ? SetCookie : "")); + } + if (SetCookie2) { + fprintf(stderr, " and Set-Cookie2: '%s'\n", + (SetCookie2 ? SetCookie2 : "")); + } + if (LYSetCookies == FALSE || BadHeaders == TRUE) { + fprintf(stderr, + " Ignoring this Set-Cookie/Set-Cookie2 request.\n"); + } } /* @@ -1816,10 +1831,13 @@ PUBLIC char * LYCookie ARGS4( HTList *hl = domain_list, *next = NULL; domain_entry *de; - CTRACE(tfp, "LYCookie: Searching for '%s:%d', '%s'.\n", + if (TRACE) { + fprintf(stderr, + "LYCookie: Searching for '%s:%d', '%s'.\n", (hostname ? hostname : "(null)"), port, (path ? path : "(null)")); + } /* * Search the cookie_list elements in the domain_list @@ -1870,183 +1888,6 @@ PUBLIC char * LYCookie ARGS4( return(NULL); } -#ifdef EXP_PERSISTENT_COOKIES -/* rjp - experiment cookie loading */ -PUBLIC void LYLoadCookies ARGS1 ( - CONST char *, cookie_file) -{ - FILE *cookie_handle; - char buf[max_cookies_buffer+10]; /* should be long enough for a cookie line */ - static char domain[256], path[LY_MAXPATH], name[256], value[4100]; - static char what[8], secure[8], expires_a[16]; - static struct { - char *s; - size_t n; - } tok_values[] = { - { domain, sizeof(domain) }, - { what, sizeof(what) }, - { path, sizeof(path) }, - { secure, sizeof(secure) }, - { expires_a, sizeof(expires_a) }, - { name, sizeof(name) }, - { value, sizeof(value) }, - { NULL, 0 } - }; - time_t expires; - - cookie_handle = fopen(cookie_file, "r+"); - if (!cookie_handle) - return; - - while (!feof(cookie_handle)) { - cookie *moo; - unsigned i = 0; - int tok_loop; - char *tok_out, *tok_ptr; - char *j; - - j = fgets(buf, sizeof(buf)-1, cookie_handle); - - if((j == NULL) || (buf[0] == '\0' || buf[0] == '\n')) { - continue; - } - - - /* - * Strip out the newline that fgets() puts at the end of a - * cookie. - */ - - while(buf[i] != '\n' && i < sizeof(buf)) { - i++; - } - buf[i] = '\0'; - - /* - * Tokenise the cookie line into its component parts - - * this only works for Netscape style cookie files at the - * moment. It may be worth investigating an alternative - * format for Lynx because the Netscape format isn't all - * that useful, or future-proof. - RP - * - * 'fixed' by using strsep instead of strtok. No idea - * what kind of platform problems this might introduce. - RP - */ - tok_ptr = buf; - tok_out = LYstrsep(&tok_ptr, "\t"); - for (tok_loop = 0; tok_out && tok_values[tok_loop].s; tok_loop++) { - CTRACE(tfp, ">%d:%p:%p:[%s]:%s\n", - tok_loop, tok_values[tok_loop].s, tok_out, tok_out, buf); - LYstrncpy(tok_values[tok_loop].s, tok_out, tok_values[tok_loop].n); - /* - * It looks like strtok ignores a leading delimiter, - * which makes things a bit more interesting. Something - * like "FALSE\t\tFALSE\t" translates to FALSE,FALSE - * instead of FALSE,,FALSE. - RP - */ - tok_out = LYstrsep(&tok_ptr, "\t"); - } - expires = atol(expires_a); - CTRACE(tfp, "COOKIE: expires %s\n", ctime(&expires)); - - /* - * This fails when the path is blank - * - * sscanf(buf, "%s\t%s\t%s\t%s\t%d\t%s\t%[ -~]", - * domain, what, path, secure, &expires, name, value); - */ - - CTRACE(tfp, "%s\t%s\t%s\t%s\t%ld\t%s\t%s\tREADCOOKIE\n", - domain, what, path, secure, (long) expires, name, value); - moo = newCookie(); - StrAllocCopy(moo->domain, domain); - StrAllocCopy(moo->path, path); - StrAllocCopy(moo->name, name); - StrAllocCopy(moo->value, value); - moo->pathlen = strlen(moo->path); - moo->flags |= COOKIE_FLAG_PERSISTENT; - moo->expires = expires; - /* - * I don't like using this to store the cookies because it's - * designed to store cookies that have been received from an - * HTTP request, not from a persistent cookie jar. Hence the - * mucking about with the COOKIE_FLAG_PERSISTENT above. - RP - */ - store_cookie(moo, domain, path); - } - fclose (cookie_handle); -} - -/* rjp - experimental persistent cookie support */ -PUBLIC void LYStoreCookies ARGS1 ( - CONST char *, cookie_file) -{ - char buf[1024]; - HTList *dl, *cl; - domain_entry *de; - cookie *co; - FILE *cookie_handle; -#ifdef VMS - extern BOOLEAN HadVMSInterrupt; -#endif /* VMS */ - time_t now = time(NULL); /* system specific? - RP */ - - /* - * Check whether we have something to do. - FM - */ - if (HTList_isEmpty(domain_list)) { - /* No cookies, so don't bother updating the file */ - return; - } - - cookie_handle = fopen(cookie_file, "w+"); - for (dl = domain_list; dl != NULL; dl = dl->next) { - de = dl->object; - if (de == NULL) - /* - * Fote says the first object is NULL. Go with that. - */ - continue; - - switch (de->bv) { - case (ACCEPT_ALWAYS): - sprintf(buf, COOKIES_ALWAYS_ALLOWED); - break; - case (REJECT_ALWAYS): - sprintf(buf, COOKIES_NEVER_ALLOWED); - break; - case (QUERY_USER): - sprintf(buf, COOKIES_ALLOWED_VIA_PROMPT); - break; - case (FROM_FILE): - sprintf(buf, "(From Cookie Jar)"); - break; - } - - /* - * Show the domain's cookies. - FM - */ - for (cl = de->cookie_list; cl != NULL; cl = cl->next) { - /* - * First object is always NULL. - FM - */ - if ((co = (cookie *)cl->object) == NULL) - continue; - - CTRACE(tfp, "COOKIE: %ld cf %ld\n", (long) now, (long) co->expires); - fprintf(cookie_handle, "%s\t%s\t%s\t%s\t%ld\t%s\t%s\n", - de->domain, - "FALSE", co->path, - co->flags & COOKIE_FLAG_SECURE ? "TRUE" : "FALSE", - (long) co->expires, co->name, co->value); - } - } - fclose(cookie_handle); - - HTSYS_purge(cookie_file); -} -#endif - /* LYHandleCookies - F.Macrides (macrides@sci.wfeb.edu) ** --------------- ** @@ -2203,8 +2044,9 @@ PRIVATE int LYHandleCookies ARGS4 ( * from this domain. - FM */ de->bv = QUERY_USER; - HTUserMsg2(ALWAYS_ALLOWING_COOKIES, + _user_message(ALWAYS_ALLOWING_COOKIES, de->domain); + sleep(MessageSecs); return(HT_NO_DATA); case 'C': @@ -2213,7 +2055,8 @@ PRIVATE int LYHandleCookies ARGS4 ( /* * Cancelled. - FM */ - HTUserMsg(CANCELLED); + _statusline(CANCELLED); + sleep(MessageSecs); return(HT_NO_DATA); case 'D': @@ -2274,12 +2117,13 @@ Delete_all_cookies_in_domain: case 'P': /* - * Set to prompt for cookie acceptance + * Set to prompt for cookie acceptence * from this domain. - FM */ de->bv = QUERY_USER; - HTUserMsg2(PROMPTING_TO_ALLOW_COOKIES, - de->domain); + _user_message(PROMTING_TO_ALLOW_COOKIES, + de->domain); + sleep(MessageSecs); return(HT_NO_DATA); case 'V': @@ -2288,8 +2132,9 @@ Delete_all_cookies_in_domain: * from this domain. - FM */ de->bv = REJECT_ALWAYS; - HTUserMsg2(NEVER_ALLOWING_COOKIES, - de->domain); + _user_message(NEVER_ALLOWING_COOKIES, + de->domain); + sleep(MessageSecs); if ((!HTList_isEmpty(de->cookie_list)) && HTConfirm(DELETE_ALL_COOKIES_IN_DOMAIN)) goto Delete_all_cookies_in_domain; @@ -2341,9 +2186,10 @@ Delete_all_cookies_in_domain: sprintf(buf, "<HEAD>\n<TITLE>%s</title>\n</HEAD>\n<BODY>\n", COOKIE_JAR_TITLE); (*target->isa->put_block)(target, buf, strlen(buf)); - sprintf(buf, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", - LYNX_NAME, LYNX_VERSION, - helpfilepath, COOKIE_JAR_HELP, COOKIE_JAR_TITLE); + + sprintf(buf, "<H1>%s</H1>\n", REACHED_COOKIE_JAR_PAGE); + (*target->isa->put_block)(target, buf, strlen(buf)); + sprintf(buf, "<H2>%s Version %s</H2>\n", LYNX_NAME, LYNX_VERSION); (*target->isa->put_block)(target, buf, strlen(buf)); sprintf(buf, "<NOTE>%s\n", ACTIVATE_TO_GOBBLE); @@ -2364,8 +2210,8 @@ Delete_all_cookies_in_domain: /* * Show the domain link and 'allow' setting. - FM */ - sprintf(buf, "<DT>%s<DD><A HREF=\"LYNXCOOKIE://%s/\">Domain=%s</A>\n", - de->domain, de->domain, de->domain); + sprintf(buf, "<DT><A HREF=\"LYNXCOOKIE://%s/\">Domain=%s</A>\n", + de->domain, de->domain); (*target->isa->put_block)(target, buf, strlen(buf)); switch (de->bv) { case (ACCEPT_ALWAYS): @@ -2376,14 +2222,9 @@ Delete_all_cookies_in_domain: break; case (QUERY_USER): sprintf(buf, COOKIES_ALLOWED_VIA_PROMPT); - break; - case (FROM_FILE): - sprintf(buf, COOKIES_READ_FROM_FILE); - break; + break; } (*target->isa->put_block)(target, buf, strlen(buf)); - sprintf(buf, "\n"); - (*target->isa->put_block)(target, buf, strlen(buf)); /* * Show the domain's cookies. - FM @@ -2496,162 +2337,6 @@ Delete_all_cookies_in_domain: return(HT_LOADED); } - -/* cookie_add_acceptlist -** --------------------- -** -** Is passed a comma-delimited string of domains to add to the -** "always accept" list for cookies. The domains need to be identical -** to the form from which the cookie is received, with or without a -** leading ".". - BJP -*/ - -PUBLIC void cookie_add_acceptlist ARGS1( - char *, acceptstr) -{ - domain_entry *de = NULL; - domain_entry *de2 = NULL; - HTList *hl; - char **str = (char **)calloc(1, sizeof(acceptstr)); - char *astr = NULL; - char *strsmall = NULL; - int isexisting = FALSE; - - /* - * Is this the first cookie we're handling? If so, initialize - * domain_list. - */ - - if (domain_list == NULL) { - atexit(LYCookieJar_free); - domain_list = HTList_new(); - total_cookies = 0; - } - - StrAllocCopy(astr, acceptstr); - - *str = astr; - - for(; (strsmall = LYstrsep(str, ","));) { - if(strsmall == NULL) - break; - - /* - * Check the list of existing cookies to see if this is a - * re-setting of an already existing cookie -- if so, just - * change the behavior, if not, create a new domain entry. - */ - - for (hl = domain_list; hl != NULL; hl = hl->next) { - de2 = (domain_entry *)hl->object; - if ((de2 != NULL && de2->domain != NULL) && - !strcmp(strsmall, de2->domain)) { - isexisting = TRUE; - break; - } else { - isexisting = FALSE; - } - } - - if(!isexisting) { - de = (domain_entry *)calloc(1, sizeof(domain_entry)); - - if (de == NULL) - outofmem(__FILE__, "cookie_add_acceptlist"); - - de->bv = ACCEPT_ALWAYS; - - StrAllocCopy(de->domain, strsmall); - de->cookie_list = HTList_new(); - HTList_addObject(domain_list, de); - } else { - de2->bv = ACCEPT_ALWAYS; - } - } - - FREE(str); - FREE(strsmall); - FREE(astr); -} - - -/* cookie_add_rejectlist -** --------------------- -** -** Is passed a comma-delimited string of domains to add to the -** "always reject" list for cookies. The domains need to be identical -** to the form from which the cookie is received, with or without a -** leading ".". - BJP -*/ - -PUBLIC void cookie_add_rejectlist ARGS1( - char *, rejectstr) -{ - domain_entry *de = NULL; - domain_entry *de2 = NULL; - HTList *hl; - char **str = (char **)calloc(1, sizeof(rejectstr)); - char *rstr = NULL; - char *strsmall = NULL; - int isexisting = FALSE; - - /* - * Is this the first cookie we're handling? If so, initialize - * domain_list. - */ - - if (domain_list == NULL) { - atexit(LYCookieJar_free); - domain_list = HTList_new(); - total_cookies = 0; - } - - StrAllocCopy(rstr, rejectstr); - - *str = rstr; - - for(; (strsmall = LYstrsep(str, ","));) { - if(strsmall == NULL) - break; - - /* - * Check the list of existing cookies to see if this is a - * re-setting of an already existing cookie -- if so, just - * change the behavior, if not, create a new domain entry. - */ - - for (hl = domain_list; hl != NULL; hl = hl->next) { - de2 = (domain_entry *)hl->object; - if ((de2 != NULL && de2->domain != NULL) && - !strcmp(strsmall, de2->domain)) { - isexisting = TRUE; - break; - } else { - isexisting = FALSE; - } - } - - if(!isexisting) { - de = (domain_entry *)calloc(1, sizeof(domain_entry)); - - if (de == NULL) - outofmem(__FILE__, "cookie_add_rejectlist"); - - de->bv = REJECT_ALWAYS; - - StrAllocCopy(de->domain, strsmall); - de->cookie_list = HTList_new(); - HTList_addObject(domain_list, de); - } else { - de2->bv = REJECT_ALWAYS; - } - } - - FREE(str); - FREE(strsmall); - FREE(rstr); -} - #ifdef GLOBALDEF_IS_MACRO #define _LYCOOKIE_C_GLOBALDEF_1_INIT { "LYNXCOOKIE",LYHandleCookies,0} GLOBALDEF (HTProtocol,LYLynxCookies,_LYCOOKIE_C_GLOBALDEF_1_INIT); diff --git a/src/LYCookie.h b/src/LYCookie.h index 2e4a3ecf..9900a017 100644 --- a/src/LYCookie.h +++ b/src/LYCookie.h @@ -1,9 +1,7 @@ + #ifndef LYCOOKIES_H #define LYCOOKIES_H -#include <HTUtils.h> -#include <HTList.h> - extern void LYSetCookie PARAMS(( CONST char * SetCookie, CONST char * SetCookie2, @@ -13,16 +11,8 @@ extern char *LYCookie PARAMS(( CONST char * partialpath, int port, BOOL secure)); -extern void LYStoreCookies PARAMS(( - CONST char * cookie_file)); -extern void LYLoadCookies PARAMS(( - CONST char * cookie_file)); -extern void cookie_add_acceptlist PARAMS(( - char * acceptdomains)); -extern void cookie_add_rejectlist PARAMS(( - char * rejectdomains)); -typedef enum {ACCEPT_ALWAYS, REJECT_ALWAYS, QUERY_USER, FROM_FILE} behaviour; +typedef enum {ACCEPT_ALWAYS, REJECT_ALWAYS, QUERY_USER} behaviour; struct _domain_entry { char * domain; /* Domain for which these cookies are valid */ diff --git a/src/LYCurses.c b/src/LYCurses.c index 0e3e0ea9..00458ff9 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -1,5 +1,5 @@ #include <HTUtils.h> -#include <HTAlert.h> +#include <tcp.h> #include <LYCurses.h> #include <LYStyle.h> #include <LYUtils.h> @@ -15,6 +15,14 @@ #include <LYexit.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + +#ifdef VMS +#define DISPLAY "DECW$DISPLAY" +#else +#define DISPLAY "DISPLAY" +#endif /* VMS */ + #if defined(VMS) && defined(__GNUC__) #include <gnu_hacks.h> #undef LINES @@ -149,7 +157,7 @@ PRIVATE void sl_suspend ARGS1( SLang_init_tty(3, 0, 1); #endif /* SLANG_VERSION > 9929 */ signal(SIGTSTP, sl_suspend); -#if !defined(_WINDOWS) && !defined(__DJGPP__) +#ifndef _WINDOWS SLtty_set_suspend_state(1); #endif if (sig == SIGTSTP) @@ -208,7 +216,7 @@ PUBLIC void VMSbox ARGS3( */ PUBLIC void LYbox ARGS2( WINDOW *, win, - BOOLEAN, formfield GCC_UNUSED) + BOOLEAN, formfield) { /* * If the terminal is in UTF-8 mode, it probably cannot understand @@ -275,7 +283,8 @@ PUBLIC void setStyle ARGS4(int,style,int,color,int,cattr,int,mono) PUBLIC void setHashStyle ARGS5(int,style,int,color,int,cattr,int,mono,char*,element) { bucket* ds=&hashStyles[style]; - CTRACE(tfp, "CSS(SET): <%s> hash=%d, ca=%d, ma=%d\n", element, style, color, mono); + if (TRACE) + fprintf(stderr, "CSS(SET): <%s> hash=%d, ca=%d, ma=%d\n", element, style, color, mono); ds->color=color; ds->cattr=cattr; ds->mono=mono; @@ -290,7 +299,8 @@ PUBLIC void setHashStyle ARGS5(int,style,int,color,int,cattr,int,mono,char*,elem */ PRIVATE int LYAttrset ARGS3(WINDOW*,win,int,color,int,mono) { - CTRACE(tfp, "CSS:LYAttrset (%#x, %#x)\n", color, mono); + if (TRACE) + fprintf(stderr, "CSS:LYAttrset (%d, %d)\n", color, mono); if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON && color > -1) { wattrset(win,color); @@ -305,20 +315,19 @@ PRIVATE int LYAttrset ARGS3(WINDOW*,win,int,color,int,mono) return A_NORMAL; } -PUBLIC void curses_w_style ARGS3( - WINDOW*, win, - int, style, - int, dir) +PUBLIC void curses_w_style ARGS4(WINDOW*,win,int,style,int,dir,int,previous) { int YP,XP; bucket* ds=&hashStyles[style]; if (!ds->name) { - CTRACE(tfp, "CSS.CS:Style %d not configured\n",style); + if (TRACE) + fprintf(stderr, "CSS.CS:Style %d not configured\n",style); return; } - CTRACE(tfp, "CSS.CS:<%s%s> (%d)\n",(dir?"":"/"),ds->name,ds->code); + if (TRACE) + fprintf(stderr, "CSS.CS:<%s%s> (%d)\n",(dir?"":"/"),ds->name,ds->code); getyx (win, YP, XP); @@ -341,7 +350,8 @@ PUBLIC void curses_w_style ARGS3( case STACK_ON: /* remember the current attributes */ if (last_ptr > 127) { - CTRACE(tfp,"........... %s (0x%x) %s\r\n", + if (TRACE) + fprintf(stderr,"........... %s (0x%x) %s\r\n", "attribute cache FULL, dropping last", last_styles[last_ptr], "in LynxChangStyle(curses_w_style)"); @@ -351,7 +361,8 @@ PUBLIC void curses_w_style ARGS3( /* don't cache style changes for active links */ if (style != s_alink) { - CTRACE(tfp, "CACHED: <%s> @(%d,%d)\n", ds->name, YP, XP); + if (TRACE) + fprintf(stderr, "CACHED: <%s> @(%d,%d)\n", ds->name, YP, XP); if (win==stdscr) cached_styles[YP][XP]=style; LYAttrset(win, ds->color, ds->mono); } @@ -365,7 +376,8 @@ PUBLIC void curses_w_style ARGS3( /* don't cache style changes for active links */ if (style != s_alink) { - CTRACE(tfp, "CACHED: <%s> @(%d,%d)\n", ds->name, YP, XP); + if (TRACE) + fprintf(stderr, "CACHED: <%s> @(%d,%d)\n", ds->name, YP, XP); if (win==stdscr) cached_styles[YP][XP]=style; LYAttrset(win, ds->color, ds->mono); } @@ -386,15 +398,16 @@ PUBLIC void wcurses_css ARGS3(WINDOW *,win,char*,name,int,dir) while (try_again) { int tmpHash=hash_code(name); - CTRACE(tfp, "CSSTRIM:trying to set [%s] style - ", name); + if (TRACE) + fprintf(stderr, "CSSTRIM:trying to set [%s] style - ", name); if (tmpHash==NOSTYLE) { char *class=strrchr(name, '.'); - CTRACE(tfp, "undefined, trimming at %p\n", class); + if (TRACE) fprintf(stderr, "undefined, trimming at %p\n", class); if (class) *class='\0'; else try_again=0; } else { - CTRACE(tfp, "ok (%d)\n", hash_code(name)); - curses_w_style(win, hash_code(name), dir); + if (TRACE) fprintf(stderr, "ok (%d)\n", hash_code(name)); + curses_w_style(win, hash_code(name), dir, 0); try_again=0; } } @@ -402,14 +415,12 @@ PUBLIC void wcurses_css ARGS3(WINDOW *,win,char*,name,int,dir) PUBLIC void curses_css ARGS2(char *,name,int,dir) { - wcurses_css(stdscr, name, dir); + wcurses_css(stdscr, name, dir); } -PUBLIC void curses_style ARGS2( - int, style, - int, dir) +PUBLIC void curses_style ARGS3(int,style,int,dir,int,previous) { - curses_w_style(stdscr, style, dir); + curses_w_style(stdscr, style, dir, previous); } #ifdef NOT_USED @@ -463,15 +474,24 @@ PRIVATE void LYsetWAttr ARGS1(WINDOW *, win) int code = 0; int attr = A_NORMAL; int offs = 1; - static int NoColorVideo = -1; + static int have_underline = -1; + static int no_color_video = -1; -#ifdef UNIX - if (NoColorVideo < 0) { - NoColorVideo = tigetnum("ncv"); + if (have_underline < 0) { +#ifndef DOSPATH + have_underline = tigetstr("smul") != 0; +#else + have_underline = 1; +#endif /* DOSPATH */ } - if (NoColorVideo < 0) - NoColorVideo = 0; -#endif /* UNIX */ + +#if ( !defined(__DJGPP__) && !defined(_WINDOWS) ) + if (no_color_video < 0) { + no_color_video = tigetnum("ncv"); + } + if (no_color_video < 0) + no_color_video = 0; +#endif /* !__DJGPP__ and !_WINDOWS */ if (Current_Attr & A_BOLD) code |= 1; @@ -482,14 +502,14 @@ PRIVATE void LYsetWAttr ARGS1(WINDOW *, win) attr = lynx_color_cfg[code].attr; /* - * no_color_video isn't implemented (97/4/14) in ncurses 4.1, but may - * be in SVr4 (which would make this redundant for the latter). + * FIXME: no_color_video isn't implemented (97/4/14) in ncurses 4.x, + * but may be in SVr4 (which would make this redundant for the latter). */ - if ((Current_Attr & A_BOLD) && !(NoColorVideo & 33)) { + if ((Current_Attr & A_BOLD) && !(no_color_video & 33)) { attr |= A_BOLD; } - if ((Current_Attr == A_UNDERLINE) && !(NoColorVideo & 2)) { + if ((Current_Attr == A_UNDERLINE) && !(no_color_video & 2)) { attr |= A_UNDERLINE; } @@ -535,7 +555,6 @@ PUBLIC int lynx_chg_color ARGS3( int, bg ) { - if (fg == ERR_COLOR || bg == ERR_COLOR) return -1; if (color >= 0 && color < 8) { lynx_color_cfg[color].fg = (fg > 7) ? (fg & 7) : fg; lynx_color_cfg[color].bg = (bg > 7) ? (bg & 7) : bg; @@ -604,35 +623,34 @@ PUBLIC void lynx_setup_colors NOARGS */ PUBLIC void start_curses NOARGS { - static BOOLEAN first_time = TRUE; - - if(first_time) - { - initscr(); /* start curses */ - first_time = FALSE; - cbreak(); - keypad(stdscr, TRUE); - fflush(stdin); - fflush(stdout); - if (has_colors()) { - lynx_has_color = TRUE; - start_color(); - } - lynx_init_colors(); - lynx_called_initscr = TRUE; - - /* Inform pdcurses that we're interested in knowing when mouse buttons - * are clicked. Maybe someday pdcurses will support it. - */ - if (LYUseMouse) - lynx_enable_mouse (1); + static BOOLEAN first_time = TRUE; + + if(first_time) + { + initscr(); /* start curses */ + first_time = FALSE; + cbreak(); + keypad(stdscr, TRUE); + fflush(stdin); + fflush(stdout); + if (has_colors()) { + lynx_has_color = TRUE; + start_color(); + } + lynx_init_colors(); + lynx_called_initscr = TRUE; + + /* Inform pdcurses that we're interested in knowing when mouse + buttons are clicked. Maybe someday pdcurses will support it. + */ + if (LYUseMouse) + lynx_enable_mouse (1); - } else - sock_init(); + } else sock_init(); - LYCursesON = TRUE; - clear(); - noecho(); + LYCursesON = TRUE; + clear(); + noecho(); } #else PUBLIC void start_curses NOARGS @@ -645,10 +663,6 @@ PUBLIC void start_curses NOARGS if (slinit == 0) { SLtt_get_terminfo(); -#if defined(__DJGPP__) && !defined(DJGPP_KEYHANDLER) - SLkp_init (); -#endif /* __DJGPP__ && !DJGPP_KEYHANDLER */ - #ifdef UNIX #if SLANG_VERSION >= 9935 SLang_TT_Read_FD = fileno(stdin); @@ -685,7 +699,6 @@ PUBLIC void start_curses NOARGS } size_change(0); -#if defined(VMS) || defined(UNIX) SLtt_add_color_attribute(4, SLTT_ULINE_MASK); SLtt_add_color_attribute(5, SLTT_ULINE_MASK); /* @@ -697,12 +710,7 @@ PUBLIC void start_curses NOARGS } else { SLtt_Blink_Mode = 0; } -#endif /* VMS || UNIX */ } -#ifdef __DJGPP__ - else sock_init(); -#endif /* __DJGPP__ */ - slinit = 1; Current_Attr = 0; #ifndef VMS @@ -715,12 +723,12 @@ PUBLIC void start_curses NOARGS SLsmg_init_smg(); SLsmg_Display_Eight_Bit = LYlowest_eightbit[current_char_set]; if (SLsmg_Display_Eight_Bit > 191) - SLsmg_Display_Eight_Bit = 191; /* may print ctrl chars otherwise - kw */ + SLsmg_Display_Eight_Bit = 191; /* may print ctrl chars otherwise - kw */ scrollok(0,0); SLsmg_Backspace_Moves = 1; #ifndef VMS -#if !defined(_WINDOWS) && !defined(__DJGPP__) - SLtty_set_suspend_state(1); +#ifndef _WINDOWS + SLtty_set_suspend_state(1); #endif /* !_WINDOWS */ #ifdef SIGTSTP if (!no_suspend) @@ -735,7 +743,7 @@ PUBLIC void start_curses NOARGS #ifdef VMS /* - * If we are VMS then do initscr() everytime start_curses() + * If we are VMS then do initsrc() everytime start_curses() * is called! */ initscr(); /* start curses */ @@ -748,7 +756,7 @@ PUBLIC void start_curses NOARGS * and one time only! */ if (initscr() == NULL) { /* start curses */ - fprintf(tfp, + fprintf(stderr, "Terminal initialisation failed - unknown terminal type?\n"); #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_DFL); @@ -764,10 +772,6 @@ PUBLIC void start_curses NOARGS #if defined(SIGWINCH) && defined(NCURSES_VERSION) size_change(0); #endif /* SIGWINCH */ -#if defined(USE_KEYMAPS) && defined(NCURSES_VERSION) - if (-1 == lynx_initialize_keymaps ()) - exit (-1); -#endif /* * This is a workaround for a bug in SVr4 curses, observed on Solaris @@ -781,9 +785,9 @@ PUBLIC void start_curses NOARGS { int n; for (n = 0; n < 128; n++) - if (ALT_CHAR_SET[n] & 0x80) { - ALT_CHAR_SET[n] &= 0xff; - ALT_CHAR_SET[n] |= A_ALTCHARSET; + if (acs_map[n] & 0x80) { + acs_map[n] &= 0xff; + acs_map[n] |= A_ALTCHARSET; } } #endif @@ -849,50 +853,29 @@ PUBLIC void start_curses NOARGS PUBLIC void lynx_enable_mouse ARGS1(int,state) { - -#ifdef __BORLANDC__ -/* modify lynx_enable_mouse() for pdcurses configuration so that mouse support - is disabled unless -use_mouse is specified. This is ifdef'd with - __BORLANDC__ for the time being (WB). -*/ - HANDLE hConIn = INVALID_HANDLE_VALUE; - hConIn = GetStdHandle(STD_INPUT_HANDLE); - if (LYUseMouse == 0) - { - SetConsoleMode(hConIn, ENABLE_WINDOW_INPUT); - FlushConsoleInputBuffer(hConIn); - return; - } -#endif - - if (LYUseMouse == 0) - return; + if (LYUseMouse == 0) + return; #ifdef USE_SLANG_MOUSE - SLtt_set_mouse_mode (state, 0); - SLtt_flush_output (); + SLtt_set_mouse_mode (state, 0); + SLtt_flush_output (); #else - #ifdef NCURSES_MOUSE_VERSION -#if defined(__BORLANDC__) && defined(__PDCURSES__) - if (state) - { - SetConsoleMode(hConIn, ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT); - FlushConsoleInputBuffer(hConIn); - } + /* Inform ncurses that we're interested in knowing when mouse + button 1 is clicked */ +#ifndef _WINDOWS + if (state) + mousemask(BUTTON1_CLICKED | BUTTON3_CLICKED, NULL); + else + mousemask(0, NULL); #else - /* Inform ncurses that we're interested in knowing when mouse - * button 1 is clicked */ - if (state) - mousemask(BUTTON1_CLICKED | BUTTON3_CLICKED, NULL); - else - mousemask(0, NULL); -#endif /* __BORLANDC__ and __PDCURSES__ */ + if (state) mouse_set(BUTTON1_CLICKED && BUTTON2_CLICKED && BUTTON3_CLICKED); +#endif /* !_WINDOWS */ #endif /* NCURSES_MOUSE_VERSION */ #if defined(DJGPP) && !defined(USE_SLANG) - if (state) - mouse_set(BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED); + if (state) + mouse_set(BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED); #endif #endif /* NOT USE_SLANG_MOUSE */ } @@ -924,8 +907,8 @@ PUBLIC void stop_curses NOARGS #if defined(SIGTSTP) && defined(USE_SLANG) #ifndef VMS - if (!no_suspend) - signal(SIGTSTP, SIG_DFL); + if (!no_suspend) + signal(SIGTSTP, SIG_DFL); #endif /* !VMS */ #endif /* SIGTSTP && USE_SLANG */ @@ -943,7 +926,7 @@ PUBLIC BOOLEAN setup ARGS1( { int c; int status; - char *dummy = 0, *cp, term[81]; + char *dummy, *cp, term[81]; #ifdef USE_SLANG extern void longname(); #endif /* USE_SLANG */ @@ -952,10 +935,10 @@ PUBLIC BOOLEAN setup ARGS1( * If the display was not set by a command line option then * see if it is available from the environment. */ - if ((cp = LYgetXDisplay()) != 0) { - StrAllocCopy(x_display, cp); + if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { + StrAllocCopy(display, cp); } else { - FREE(x_display); + FREE(display); } /* @@ -981,7 +964,9 @@ PUBLIC BOOLEAN setup ARGS1( #endif /* SIGTSTP */ exit(status); } - LYLowerCase(term); + for (cp = term; *cp != '\0'; cp++) + if (isupper(*cp)) + *cp = TOLOWER(*cp); printf("Terminal = %s\n", term); sleep(InfoSecs); @@ -1049,10 +1034,10 @@ PUBLIC BOOLEAN setup ARGS1( * If the display was not set by a command line option then * see if it is available from the environment . */ - if ((cp = LYgetXDisplay()) != NULL) { - StrAllocCopy(x_display, cp); + if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { + StrAllocCopy(display, cp); } else { - FREE(x_display); + FREE(display); } if (terminal != NULL) { @@ -1240,6 +1225,7 @@ PUBLIC void LYstopTargetEmphasis NOARGS #include <descrip.h> #include <iodef.h> #include <ssdef.h> +#include <stdlib.h> #include <msgdef.h> #include <ttdef.h> #include <tt2def.h> @@ -1326,7 +1312,8 @@ PUBLIC void VMSexit NOARGS (void) getchar(); } } else if (LYCursesON) { - HTAlert(MEMORY_EXHAUSTED_ABORT); + _statusline(MEMORY_EXHAUSTED_ABORT); + sleep(AlertSecs); } cleanup(); } @@ -1531,7 +1518,7 @@ again: * and VMSsignal() is just a "helper", also not a full emulation. */ -PUBLIC void VMSsignal (sig,func) +PUBLIC void *VMSsignal (sig,func) int sig; void (*func)(); { @@ -1590,7 +1577,7 @@ void (*func)(); * Exception-handler routines for regulating interrupts and enabling * Control-T during spawns. Includes TRUSTED flag for versions of VMS * which require it in captive accounts. This code should be used - * instead of the VAXC or DECC system(), by including LYUtils.h in + * instead of the VAXC or DECC system(), by including LYSystem.h in * modules which have system() calls. It helps ensure that we return * to Lynx instead of breaking out to DCL if a user issues interrupts * or generates an ACCVIO during spawns. @@ -1599,12 +1586,13 @@ void (*func)(); PRIVATE unsigned int DCLspawn_exception ARGS2( void *, sigarr, void *, mecharr) +{ #else PRIVATE int DCLspawn_exception ARGS2( void *, sigarr, void *, mecharr) -#endif /* __DECC */ { +#endif /* __DECC */ int status; status = lib$sig_to_ret(sigarr, mecharr); @@ -1630,11 +1618,10 @@ PRIVATE int spawn_DCLprocess ARGS1( #ifdef __ALPHA /** OpenVMS/AXP lacked the TRUSTED flag before v6.1 **/ if (VersionVMS[1] > '6' || (VersionVMS[1] == '6' && VersionVMS[2] == '.' && - VersionVMS[3] >= '1')) + VersionVMS[3] >= '1')) { #else - if (VersionVMS[1] >= '6') + if (VersionVMS[1] >= '6') { #endif /* __ALPHA */ - { /* * Include TRUSTED flag. */ @@ -1716,9 +1703,7 @@ PUBLIC void lynx_start_link_color ARGS2( /* start_bold(); */ start_reverse(); #if defined(USE_SLANG) -#ifndef __DJGPP__ if (SLtt_Use_Ansi_Colors) -#endif /* !__DJGPP__ */ start_underline (); #endif /* USE_SLANG */ #if defined(FANCY_CURSES) && defined(COLOR_CURSES) @@ -1738,7 +1723,7 @@ PUBLIC void lynx_start_link_color ARGS2( PUBLIC void lynx_stop_link_color ARGS2( int, flag, - int, pending GCC_UNUSED) + int, pending) { #ifdef USE_COLOR_STYLE LynxChangeStyle(flag == ON ? s_alink : s_a, ABS_OFF, 0); @@ -1746,9 +1731,7 @@ PUBLIC void lynx_stop_link_color ARGS2( if (flag) { stop_reverse(); #if defined(USE_SLANG) -#ifndef __DJGPP__ if (SLtt_Use_Ansi_Colors) -#endif /* !__DJGPP__ */ stop_underline (); #endif /* USE_SLANG */ #if defined(FANCY_CURSES) && defined(COLOR_CURSES) diff --git a/src/LYCurses.h b/src/LYCurses.h index 1a857341..9704e532 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -1,7 +1,6 @@ #ifndef LYCURSES_H #define LYCURSES_H -#include <HTUtils.h> #include <userdefs.h> /* @@ -99,11 +98,6 @@ extern void LYsubwindow PARAMS((WINDOW * param)); # endif /* NCURSES */ -#if defined(NCURSES_VERSION) && defined(HAVE_DEFINE_KEY) -#include <term.h> -#define USE_KEYMAPS 1 -#endif - #else # if defined(VMS) && defined(__GNUC__) # include <LYGCurses.h> @@ -162,25 +156,24 @@ extern void LYstartTargetEmphasis NOPARAMS; extern void LYstopTargetEmphasis NOPARAMS; #ifdef VMS -extern int DCLsystem (char *command); extern void VMSexit(); extern int ttopen(); extern int ttclose(); extern int ttgetc(); -extern void VMSsignal PARAMS((int sig, void (*func)())); +extern void *VMSsignal PARAMS((int sig, void (*func)())); #endif /* VMS */ #if defined(USE_COLOR_STYLE) extern void curses_css PARAMS((char * name, int dir)); -extern void curses_style PARAMS((int style, int dir)); -extern void curses_w_style PARAMS((WINDOW* win, int style, int dir)); +extern void curses_style PARAMS((int style, int dir, int previous)); +extern void curses_w_style PARAMS((WINDOW* win, int style, int dir, int previous)); extern void setHashStyle PARAMS((int style, int color, int cattr, int mono, char* element)); extern void setStyle PARAMS((int style, int color, int cattr, int mono)); extern void wcurses_css PARAMS((WINDOW * win, char* name, int dir)); -#define LynxChangeStyle(style,dir,previous) curses_style(style,dir) +#define LynxChangeStyle curses_style #else extern int slang_style PARAMS((int style, int dir, int previous)); -#define LynxChangeStyle(style,dir,previous) slang_style(style,dir,previous) +#define LynxChangeStyle slang_style #endif /* USE_COLOR_STYLE */ #if USE_COLOR_TABLE @@ -191,19 +184,13 @@ extern unsigned int Lynx_Color_Flags; #endif #ifdef USE_SLANG - #if !defined(VMS) && !defined(DJGPP) #define USE_SLANG_MOUSE 1 -#endif - -#if !defined(__DJGPP__) -#define USE_KEYMAPS 1 -#endif +#endif /* USE_SLANG */ #define SL_LYNX_USE_COLOR 1 #define SL_LYNX_USE_BLINK 2 #define SL_LYNX_OVERRIDE_COLOR 4 - #define start_bold() LYaddAttr(1) #define start_reverse() LYaddAttr(2) #define start_underline() LYaddAttr(4) @@ -301,7 +288,9 @@ extern void VTHome NOPARAMS; */ #if USE_COLOR_TABLE extern void LYaddWAttr PARAMS((WINDOW *win, int a)); +extern void LYaddAttr PARAMS((int a)); extern void LYsubWAttr PARAMS((WINDOW *win, int a)); +extern void LYsubAttr PARAMS((int a)); extern void LYaddWAttr PARAMS((WINDOW *win, int a)); extern void LYsubWAttr PARAMS((WINDOW *win, int a)); extern void lynx_set_color PARAMS((int a)); @@ -389,24 +378,4 @@ extern void lynx_start_radio_color NOPARAMS; extern void lynx_stop_radio_color NOPARAMS; extern void lynx_stop_all_colors NOPARAMS; -/* - * To prevent corrupting binary data on DOS, MS-WINDOWS or OS/2 we open files - * and stdout in BINARY mode by default. Where necessary we should open and - * (close!) TEXT mode. - * - * Note: EMX has no corresponding variable like _fmode on DOS, but it does - * have setmode. - */ -#if defined(_WINDOWS) || defined(DJGPP) || defined(__EMX__) -#define SetOutputMode(mode) setmode(fileno(stdout), mode) -#else -#define SetOutputMode(mode) /* nothing */ -#endif - -#if defined(_WINDOWS) || defined(DJGPP) -#define SetDefaultMode(mode) _fmode = mode -#else -#define SetDefaultMode(mode) /* nothing */ -#endif - #endif /* LYCURSES_H */ diff --git a/src/LYDownload.c b/src/LYDownload.c index 884e436c..6e37de62 100644 --- a/src/LYDownload.c +++ b/src/LYDownload.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTParse.h> #include <HTList.h> #include <HTAlert.h> @@ -10,10 +11,19 @@ #include <LYClean.h> #include <LYGetFile.h> #include <LYDownload.h> +#include <LYSystem.h> +#ifdef VMS +#include <HTVMSUtils.h> +#endif /* VMS */ +#ifdef DOSPATH +#include <HTDOS.h> +#endif #include <LYexit.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* * LYDownload takes a URL and downloads it using a user selected * download program @@ -27,7 +37,7 @@ PUBLIC BOOLEAN LYDidRename = FALSE; #endif /* VMS */ -PRIVATE char LYValidDownloadFile[LY_MAXPATH] = "\0"; +PRIVATE char LYValidDownloadFile[256] = "\0"; PUBLIC void LYDownload ARGS1( char *, line) @@ -39,7 +49,7 @@ PUBLIC void LYDownload ARGS1( char command[512]; char *cp, *cp1; lynx_html_item_type *download_command = 0; - int c; + int c, len; FILE *fp; int ch, recall; int FnameTotal; @@ -75,7 +85,6 @@ PUBLIC void LYDownload ARGS1( * Go past "SugFile=". */ sug_file += 8; - HTUnEscape(sug_file); } if ((file = (char *)strstr(Line, "File=")) == NULL) @@ -95,7 +104,6 @@ PUBLIC void LYDownload ARGS1( } #ifdef DIRED_SUPPORT - /* FIXME: use HTLocalName */ if (!strncmp(file, "file://localhost", 16)) file += 16; else if (!strncmp(file, "file:", 5)) @@ -207,7 +215,12 @@ check_recall: } if (no_dotfiles || !show_dotfiles) { - if (*LYPathLeaf(buffer) == '.') { + if (*buffer == '.' || +#ifdef VMS + ((cp = strrchr(buffer, ':')) && *(cp+1) == '.') || + ((cp = strrchr(buffer, ']')) && *(cp+1) == '.') || +#endif /* VMS */ + ((cp = strrchr(buffer, '/')) && *(cp+1) == '.')) { HTAlert(FILENAME_CANNOT_BE_DOT); _statusline(NEW_FILENAME_PROMPT); FirstRecall = TRUE; @@ -231,8 +244,17 @@ check_recall: if ((cp = strchr(buffer, '~'))) { *(cp++) = '\0'; strcpy(command, buffer); - LYTrimPathSep(command); - strcat(command, wwwName(Home_Dir())); + if ((len = strlen(command)) > 0 && command[len-1] == '/') + command[len-1] = '\0'; +#ifdef DOSPATH + strcat(command, HTDOS_wwwName((char *)Home_Dir())); +#else +#ifdef VMS + strcat(command, HTVMS_wwwName((char *)Home_Dir())); +#else + strcat(command, Home_Dir()); +#endif /* VMS */ +#endif /* DOSPATH */ strcat(command, cp); strcpy(buffer, command); } @@ -249,25 +271,17 @@ check_recall: strcpy(buffer, command); } #else - -#ifndef __EMX__ - if (!LYIsPathSep(*buffer)) { -#if defined(__DJGPP__) || defined(_WINDOWS) - if (strchr(buffer, ':') != NULL) - cp = NULL; - else -#endif /* __DJGPP__ || _WINDOWS */ + if (*buffer != '/') cp = getenv("PWD"); - } else -#endif /* __EMX__*/ cp = NULL; - - LYTrimPathSep(cp); - if (cp) { sprintf(command, "%s/%s", cp, buffer); - strcpy(buffer, HTSYS_name(command)); +#ifdef DOSPATH + strcpy(buffer, HTDOS_name(command)); +#else + strcpy(buffer, command); +#endif } #endif /* VMS */ @@ -308,8 +322,6 @@ check_recall: /* * See if we can write to it. */ - CTRACE(tfp, "LYDownload: filename is %s", buffer); - if ((fp = fopen(buffer, "w")) != NULL) { fclose(fp); remove(buffer); @@ -322,21 +334,29 @@ check_recall: } SecondS = TRUE; - HTInfoMsg(SAVING); + _statusline(SAVING); + sleep(InfoSecs); #ifdef VMS /* * Try rename() first. - FM */ - CTRACE(tfp, "command: rename(%s, %s)\n", file, buffer); + if (TRACE) + fprintf(stderr, "command: rename(%s, %s)\n", file, buffer); if (rename(file, buffer)) { /* * Failed. Use spawned COPY_COMMAND. - FM */ - CTRACE(tfp, " FAILED!\n"); + if (TRACE) + fprintf(stderr, " FAILED!\n"); sprintf(command, COPY_COMMAND, file, buffer); - CTRACE(tfp, "command: %s\n", command); + if (TRACE) + fprintf(stderr, "command: %s\n", command); + fflush(stderr); + fflush(stdout); stop_curses(); - LYSystem(command); + system(command); + fflush(stdout); + fflush(stderr); start_curses(); } else { /* @@ -348,8 +368,6 @@ check_recall: } chmod(buffer, HIDE_CHMOD); #else /* Unix: */ - -#if !( defined(__EMX__) || defined(__DJGPP__) ) /* * Prevent spoofing of the shell. */ @@ -358,15 +376,14 @@ check_recall: sprintf(command, "%s %s %s", COPY_PATH, cp, cp1); FREE(cp); FREE(cp1); -#else - /* DJGPP: no " or space possible in 8+3 dos filenames. */ - /* (but EMX probably allows spaces which should be quoted, */ - /* like Win32 LFN does...) */ - sprintf(command, "%s %s %s", COPY_PATH, file, buffer); -#endif /* __EMX__ */ - CTRACE(tfp, "command: %s\n", command); + if (TRACE) + fprintf(stderr, "command: %s\n", command); + fflush(stderr); + fflush(stdout); stop_curses(); - LYSystem(command); + system(command); + fflush(stdout); + fflush(stderr); start_curses(); #if defined(UNIX) LYRelaxFilePermissions(buffer); @@ -479,7 +496,12 @@ check_recall: } if (no_dotfiles || !show_dotfiles) { - if (*LYPathLeaf(buffer) == '.') { + if (*buffer == '.' || +#ifdef VMS + ((cp = strrchr(buffer, ':')) && *(cp+1) == '.') || + ((cp = strrchr(buffer, ']')) && *(cp+1) == '.') || +#endif /* VMS */ + ((cp = strrchr(buffer, '/')) && *(cp+1) == '.')) { HTAlert(FILENAME_CANNOT_BE_DOT); _statusline(NEW_FILENAME_PROMPT); goto again; @@ -524,13 +546,19 @@ check_recall: #endif /* VMS */ } else { - HTAlert(MISCONF_DOWNLOAD_COMMAND); + _statusline(MISCONF_DOWNLOAD_COMMAND); + sleep(AlertSecs); goto failed; } - CTRACE(tfp, "command: %s\n", command); + if (TRACE) + fprintf(stderr, "command: %s\n", command); stop_curses(); - LYSystem(command); + fflush(stderr); + fflush(stdout); + system(command); + fflush(stderr); + fflush(stdout); start_curses(); /* don't remove(file); */ } @@ -554,19 +582,21 @@ check_recall: return; failed: - HTAlert(CANNOT_DOWNLOAD_FILE); + _statusline(CANNOT_DOWNLOAD_FILE); + sleep(AlertSecs); FREE(Line); return; cancelled: - HTInfoMsg(CANCELLING); + _statusline(CANCELLING); + sleep(InfoSecs); FREE(Line); return; } /* * LYdownload_options writes out the current download choices to - * a file so that the user can select downloaders in the same way that + * a file so that the user can select printers in the same way that * they select all other links. Download links look like: * LYNXDOWNLOAD://Method=<#>/File=<STRING>/SugFile=<STRING> */ @@ -574,49 +604,56 @@ PUBLIC int LYdownload_options ARGS2( char **, newfile, char *, data_file) { - static char tempfile[LY_MAXPATH]; - char *downloaded_url = NULL; + static char tempfile[256]; + static BOOLEAN first = TRUE; + static char download_filename[256]; char *sug_filename = NULL; FILE *fp0; lynx_html_item_type *cur_download; int count; + if (first) { + tempname(tempfile, NEW_FILE); + first = FALSE; +#if defined (VMS) || defined (DOSPATH) + sprintf(download_filename, "file://localhost/%s", tempfile); +#else + sprintf(download_filename, "file://localhost%s", tempfile); +#endif /* VMS */ +#ifdef VMS + } else { + remove(tempfile); /* Remove duplicates on VMS. */ +#endif /* VMS */ + } + /* * Get a suggested filename. */ - StrAllocCopy(downloaded_url, *newfile); StrAllocCopy(sug_filename, *newfile); change_sug_filename(sug_filename); - LYRemoveTemp(tempfile); - if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(-1); } - LYLocalFileToURL(newfile, tempfile); LYstrncpy(LYValidDownloadFile, data_file, (sizeof(LYValidDownloadFile) - 1)); + StrAllocCopy(*newfile, download_filename); LYforce_no_cache = TRUE; /* don't cache this doc */ + fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n", + DOWNLOAD_OPTIONS_TITLE); - BeginInternalPage(fp0, DOWNLOAD_OPTIONS_TITLE, DOWNLOAD_OPTIONS_HELP); + fprintf(fp0,"<h1>Download Options (%s Version %s)</h1><pre>\n", + LYNX_NAME, LYNX_VERSION); - fprintf(fp0, "<pre>\n"); - fprintf(fp0, "\ - <em>Downloaded link:</em> %s\n", - downloaded_url); + fprintf(fp0, " You have the following download choices.\n"); + fprintf(fp0, " Please select one:\n\n"); - fprintf(fp0, "\ - <em>Suggested file name:</em> %s\n", - sug_filename); - - fprintf(fp0, "\n%s options:\n", - (user_mode == NOVICE_MODE) ? "Standard download" : "Download"); - - if (!no_disk_save && !child_lynx) { + if(!no_disk_save && !child_lynx) #ifdef DIRED_SUPPORT /* * Disable save to disk option for local files. @@ -626,12 +663,11 @@ PUBLIC int LYdownload_options ARGS2( fprintf(fp0," \ <a href=\"LYNXDOWNLOAD://Method=-1/File=%s/SugFile=%s%s\">Save to disk</a>\n", data_file, (lynx_save_space ? lynx_save_space : ""), sug_filename); - } else { - fprintf(fp0," <em>Save to disk disabled.</em>\n"); - } - - if (user_mode == NOVICE_MODE) - fprintf(fp0, "\nLocal additions:\n"); +#ifdef DIRED_SUPPORT + else {} +#endif /* DIRED_SUPPORT */ + else + fprintf(fp0," Save to disk disabled.\n"); if (downloaders != NULL) { for (count = 0, cur_download = downloaders; cur_download != NULL; @@ -645,11 +681,13 @@ PUBLIC int LYdownload_options ARGS2( fprintf(fp0,"</a>\n"); } } + } else { + fprintf(fp0, "\n\ +No other download methods have been defined yet. You may define\n\ +an unlimited number of download methods using the lynx.cfg file.\n"); } - - fprintf(fp0, "</pre>\n"); - EndInternalPage(fp0); - LYCloseTempFP(fp0); + fprintf(fp0, "</pre>\n</body>\n"); + fclose(fp0); /* * Free off temp copy. diff --git a/src/LYDownload.h b/src/LYDownload.h index aeed2b19..8ea5b9fa 100644 --- a/src/LYDownload.h +++ b/src/LYDownload.h @@ -9,5 +9,7 @@ extern void LYDownload PARAMS((char *line)); extern int LYdownload_options PARAMS((char **newfile, char *data_file)); +#define DOWNLOAD_OPTIONS_TITLE "Lynx Download Options" + #endif /* LYDOWNLOAD_H */ diff --git a/src/LYEdit.c b/src/LYEdit.c index b05a5575..ae8a6eda 100644 --- a/src/LYEdit.c +++ b/src/LYEdit.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTParse.h> #include <HTAlert.h> #include <LYCurses.h> @@ -8,13 +9,19 @@ #include <LYGlobalDefs.h> #include <LYEdit.h> #include <LYStrings.h> -#include <LYUtils.h> +#include <LYSystem.h> #ifdef VMS #include <unixio.h> +#include <HTVMSUtils.h> #endif /* VMS */ +#ifdef DOSPATH +#include <HTDOS.h> +#endif #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* * In edit mode invoke either emacs, vi, pico, jove, jed sedt or the * default editor to display and edit the current file. @@ -36,7 +43,8 @@ PUBLIC int edit_current_file ARGS3( * If its a remote file then we can't edit it. */ if (!LYisLocalFile(newfile)) { - HTUserMsg(CANNOT_EDIT_REMOTE_FILES); + _statusline(CANNOT_EDIT_REMOTE_FILES); + sleep(MessageSecs); return FALSE; } @@ -53,7 +61,7 @@ PUBLIC int edit_current_file ARGS3( * * On VMS, only try the path. */ -#if !defined (VMS) && !defined (DOSPATH) && !defined (__EMX__) +#if !defined (VMS) && !defined (DOSPATH) colon = strchr(newfile, ':'); StrAllocCopy(filename, (colon + 1)); HTUnEscape(filename); @@ -62,16 +70,23 @@ PUBLIC int edit_current_file ARGS3( #endif /* !VMS */ filename = HTParse(newfile, "", PARSE_PATH+PARSE_PUNCTUATION); HTUnEscape(filename); -#if defined (DOSPATH) || defined (__EMX__) +#ifdef DOSPATH if (strlen(filename)>1) filename++; #endif - if ((fp = fopen(HTSYS_name(filename), "r")) == NULL) - { +#ifdef DOSPATH + if ((fp = fopen(HTDOS_name(filename),"r")) == NULL) { +#else +#ifdef VMS + if ((fp = fopen(HTVMS_name("", filename), "r")) == NULL) { +#else + if ((fp = fopen(filename, "r")) == NULL) { +#endif /* VMS */ +#endif /* DOSPATH */ HTAlert(COULD_NOT_ACCESS_FILE); FREE(filename); goto failure; } -#if !defined (VMS) && !defined (DOSPATH) && !defined (__EMX__) +#if !defined (VMS) && !defined (DOSPATH) } #endif /* !VMS */ fclose(fp); @@ -80,9 +95,17 @@ PUBLIC int edit_current_file ARGS3( /* * Don't allow editing if user lacks append access. */ - if ((fp = fopen(HTSYS_name(filename), "a")) == NULL) - { - HTUserMsg(NOAUTH_TO_EDIT_FILE); +#ifdef DOSPATH + if ((fp = fopen(HTDOS_name("", filename), "a")) == NULL) { +#else +#ifdef VMS + if ((fp = fopen(HTVMS_name("", filename), "a")) == NULL) { +#else + if ((fp = fopen(filename, "a")) == NULL) { +#endif /* VMS */ +#endif /* DOSPATH */ + _statusline(NOAUTH_TO_EDIT_FILE); + sleep(MessageSecs); goto failure; } fclose(fp); @@ -115,25 +138,38 @@ PUBLIC int edit_current_file ARGS3( sprintf(command, "%s +%d \"%s\"", editor, (lineno + (nlinks ? links[cur].ly : 0)), - HTSYS_name(filename)); +#ifdef DOSPATH + HTDOS_name(filename)); +#else + filename); +#endif /* DOSPATH */ else #ifdef __DJGPP__ sprintf(command, "%s %s", editor, HTDOS_name(filename)); #else - sprintf(command, "%s \"%s\"", editor, HTSYS_name(filename)); + sprintf(command, "%s \"%s\"", editor, +#ifdef DOSPATH + HTDOS_name(filename)); +#else + filename); +#endif /* DOSPATH */ #endif /* __DJGPP__ */ #endif /* VMS */ - CTRACE(tfp, "LYEdit: %s\n", command); - CTRACE_SLEEP(MessageSecs); -#ifndef __EMX__ + if (TRACE) { + fprintf(stderr, "LYEdit: %s\n", command); + sleep(MessageSecs); + } FREE(filename); -#endif /* * Invoke the editor. - FM */ + fflush(stderr); + fflush(stdout); stop_curses(); - LYSystem(command); + system(command); + fflush(stdout); + fflush(stderr); start_curses(); /* diff --git a/src/LYEdit.h b/src/LYEdit.h index f8ee515d..08c07625 100644 --- a/src/LYEdit.h +++ b/src/LYEdit.h @@ -1,8 +1,7 @@ + #ifndef LYEDIT_H #define LYEDIT_H -#include <HTUtils.h> - extern int edit_current_file PARAMS((char *newfile, int cur, int lineno)); #endif /* LYEDIT_H */ diff --git a/src/LYEditmap.c b/src/LYEditmap.c index cf8cc312..290a47d1 100644 --- a/src/LYEditmap.c +++ b/src/LYEditmap.c @@ -3,6 +3,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <LYStrings.h> PUBLIC int current_lineedit = 0; /* Index into LYLineEditors[] */ diff --git a/src/LYExtern.c b/src/LYExtern.c index 652fb3e2..5d4d9db8 100644 --- a/src/LYExtern.c +++ b/src/LYExtern.c @@ -15,15 +15,17 @@ See lynx.cfg for other info. */ -#include <LYUtils.h> -#include <HTAlert.h> +#include <tcp.h> #include <LYGlobalDefs.h> +#include <LYUtils.h> #include <LYExtern.h> #include <LYCurses.h> #include <LYLeaks.h> #ifdef USE_EXTERNALS +#define FREE(x) if (x) {free(x); x = NULL;} + void run_external ARGS1(char *, c) { char command[1024]; @@ -35,14 +37,18 @@ void run_external ARGS1(char *, c) externals2=externals2->next) { - if (externals2->command != 0 - && !strncasecomp(externals2->name,c,strlen(externals2->name))) +#ifdef _WINDOWS + if (!strnicmp(externals2->name,c,strlen(externals2->name))) +#else + if (!strncasecomp(externals2->name,c,strlen(externals2->name))) +#endif { char *cp; if(no_externals && !externals2->always_enabled) { - HTUserMsg(EXTERNALS_DISABLED); + statusline(EXTERNALS_DISABLED); + sleep(MessageSecs); return; } @@ -52,9 +58,9 @@ void run_external ARGS1(char *, c) * Prevent spoofing of the shell. * Dunno how this needs to be modified for VMS or DOS. - kw */ -#if defined(VMS) || defined(DOSPATH) || defined(__EMX__) +#if defined(VMS) || defined(DOSPATH) sprintf(command, externals2->command, c); -#else /* Unix: */ +#else /* Unix or DOS/Win: */ cp = quote_pathname(c); sprintf(command, externals2->command, cp); FREE(cp); @@ -63,10 +69,22 @@ void run_external ARGS1(char *, c) if (*command != '\0') { - HTUserMsg(command); + statusline(command); + sleep(MessageSecs); stop_curses(); - LYSystem(command); + fflush(stdout); +#ifdef __DJGPP__ + __djgpp_set_ctrl_c(0); + _go32_want_ctrl_break(1); +#endif /* __DJGPP__ */ + system(command); +#ifdef __DJGPP__ + __djgpp_set_ctrl_c(1); + _go32_want_ctrl_break(0); +#endif /* __DJGPP__ */ + + fflush(stdout); start_curses(); } diff --git a/src/LYForms.c b/src/LYForms.c index ff64cb2d..7a66897b 100644 --- a/src/LYForms.c +++ b/src/LYForms.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTCJK.h> #include <HTTP.h> #include <HTAlert.h> @@ -33,8 +34,9 @@ PRIVATE int popup_options PARAMS(( int i_length, int disabled)); -PUBLIC int change_form_link ARGS5( +PUBLIC int change_form_link ARGS6( struct link *, form_link, + int, mode, document *, newdoc, BOOLEAN *, refresh_screen, char *, link_name, @@ -137,7 +139,9 @@ PUBLIC int change_form_link ARGS5( * only one down at a time! */ if (form->num_value) { - HTUserMsg(NEED_CHECKED_RADIO_BUTTON); + _statusline(NEED_CHECKED_RADIO_BUTTON); + sleep(MessageSecs); + } else { int i; /* @@ -198,7 +202,8 @@ PUBLIC int change_form_link ARGS5( if (c == '\r' || c == '\n') { form_link->hightext = form->value; if (!form->submit_action || *form->submit_action == '\0') { - HTUserMsg(NO_FORM_ACTION); + _statusline(NO_FORM_ACTION); + sleep(MessageSecs); c = DO_NOTHING; break; } else if (form->submit_method == URL_MAIL_METHOD && no_mail) { @@ -299,7 +304,8 @@ PRIVATE int form_getstr ARGS1( /* * If we can edit it, report that we are using the tail. - FM */ - HTUserMsg(FORM_VALUE_TOO_LONG); + _statusline(FORM_VALUE_TOO_LONG); + sleep(MessageSecs); switch(form->type) { case F_PASSWORD_TYPE: statusline(FORM_LINK_PASSWORD_MESSAGE); @@ -382,7 +388,7 @@ again: case PGDOWN: #ifdef NOTDEFINED case HOME: - case END_KEY: + case END: case FIND_KEY: case SELECT_KEY: #endif /* NOTDEFINED */ @@ -449,7 +455,8 @@ breakfor: */ form->value[(strlen(form->value) - strlen(value))] = '\0'; StrAllocCat(form->value, MyEdit.buffer); - HTUserMsg(FORM_TAIL_COMBINED_WITH_HEAD); + _statusline(FORM_TAIL_COMBINED_WITH_HEAD); + sleep(MessageSecs); } /* @@ -501,7 +508,8 @@ PRIVATE int get_popup_option_number ARGS1( * Get the number, possibly with a suffix, from the user. */ if (LYgetstr(temp, VISIBLE, sizeof(temp), NORECALL) < 0 || *temp == 0) { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); *c = '\0'; return(0); } @@ -804,8 +812,8 @@ redraw: SLsmg_gotorc((LYlines - 1), (LYcols - 1)); SLsmg_refresh(); #else - wmove(form_window, ((i + 1) - window_offset), 2); wstart_reverse(form_window); + wmove(form_window, ((i + 1) - window_offset), 2); paddstr(form_window, width, opt_ptr->name); wstop_reverse(form_window); /* @@ -864,7 +872,8 @@ redraw: */ if (number <= 1) { if (window_offset == 0) { - HTUserMsg(ALREADY_AT_OPTION_BEGIN); + _statusline(ALREADY_AT_OPTION_BEGIN); + sleep(MessageSecs); if (disabled) { _statusline(FORM_LINK_OPTION_LIST_UNM_MSG); } else { @@ -888,7 +897,8 @@ redraw: */ if (number >= npages) { if (window_offset >= ((num_options - length) + 1)) { - HTUserMsg(ALREADY_AT_OPTION_END); + _statusline(ALREADY_AT_OPTION_END); + sleep(MessageSecs); if (disabled) { _statusline(FORM_LINK_OPTION_LIST_UNM_MSG); } else { @@ -915,7 +925,8 @@ redraw: */ if (((number - 1) * length) == window_offset) { sprintf(buffer, ALREADY_AT_OPTION_PAGE, number); - HTUserMsg(buffer); + _statusline(buffer); + sleep(MessageSecs); if (disabled) { _statusline(FORM_LINK_OPTION_LIST_UNM_MSG); } else { @@ -965,7 +976,8 @@ redraw: */ sprintf(buffer, OPTION_ALREADY_CURRENT, (number + 1)); - HTUserMsg(buffer); + _statusline(buffer); + sleep(MessageSecs); if (disabled) { _statusline(FORM_LINK_OPTION_LIST_UNM_MSG); } else { @@ -1003,7 +1015,8 @@ redraw: /* * Not in range. - FM */ - HTUserMsg(BAD_OPTION_NUM_ENTERED); + _statusline(BAD_OPTION_NUM_ENTERED); + sleep(MessageSecs); } } @@ -1238,7 +1251,8 @@ redraw: /* * User cancelled the search via ^G. - FM */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); goto restore_popup_statusline; } } @@ -1249,7 +1263,8 @@ check_recall: /* * No entry. Simply break. - FM */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); goto restore_popup_statusline; } @@ -1302,7 +1317,8 @@ check_recall: /* * User cancelled the search via ^G. - FM */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); goto restore_popup_statusline; } goto check_recall; @@ -1358,7 +1374,8 @@ check_recall: /* * User cancelled the search via ^G. - FM */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); goto restore_popup_statusline; } goto check_recall; @@ -1404,7 +1421,8 @@ check_recall: * If we started at the beginning, it can't be present. - FM */ if (cur_selection == 0) { - HTUserMsg2(STRING_NOT_FOUND, prev_target_buffer); + _user_message(STRING_NOT_FOUND, prev_target_buffer); + sleep(MessageSecs); goto restore_popup_statusline; } @@ -1442,7 +1460,8 @@ check_recall: /* * Didn't find it in the preceding options either. - FM */ - HTUserMsg2(STRING_NOT_FOUND, prev_target_buffer); + _user_message(STRING_NOT_FOUND, prev_target_buffer); + sleep(MessageSecs); restore_popup_statusline: /* diff --git a/src/LYGetFile.c b/src/LYGetFile.c index 21717afd..037e4c99 100644 --- a/src/LYGetFile.c +++ b/src/LYGetFile.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTTP.h> #include <HTAnchor.h> /* Anchor class */ #include <HTAccess.h> @@ -13,17 +14,23 @@ #include <LYSignal.h> #include <LYGetFile.h> #include <LYPrint.h> -#include <LYOptions.h> #include <LYHistory.h> #include <LYStrings.h> #include <LYClean.h> #include <LYDownload.h> #include <LYNews.h> #include <LYMail.h> +#include <LYSystem.h> #include <LYKeymap.h> #include <LYBookmark.h> #include <LYMap.h> #include <LYList.h> +#ifdef VMS +#include <HTVMSUtils.h> +#endif /* VMS */ +#ifdef DOSPATH +#include <HTDOS.h> +#endif #ifdef DIRED_SUPPORT #include <LYLocal.h> #endif /* DIRED_SUPPORT */ @@ -37,12 +44,49 @@ #endif /* SYSLOG_REQUESTED_URLS */ #endif /* !VMS */ +#define FREE(x) if (x) {free(x); x = NULL;} + PRIVATE int fix_http_urls PARAMS((document *doc)); extern char * WWW_Download_File; #ifdef VMS extern BOOLEAN LYDidRename; #endif /* VMS */ +#if 0 /* UNUSED */ +#ifdef DIRED_SUPPORT +PRIVATE char * LYSanctify ARGS1( + char *, href) +{ + int i; + char *p, *cp, *tp; + char address_buffer[1024]; + + i = (strlen(href) - 1); + while (i && href[i] == '/') href[i--] = '\0'; + + if ((cp = (char *)strchr(href,'~')) != NULL) { + if (!strncmp(href, "file://localhost/", 17)) + tp = (href + 17); + else + tp = (href + 5); + if ((cp - tp) && *(cp-1) != '/') + return href; + LYstrncpy(address_buffer, href, (cp - href)); + if (address_buffer[(strlen(address_buffer) - 1)] == '/') + address_buffer[(strlen(address_buffer) - 1)] = '\0'; + p = (char *)Home_Dir(); + strcat(address_buffer, p); + if (strlen(++cp)) + strcat(address_buffer, cp); + if (strcmp(href, address_buffer)) + StrAllocCopy(href, address_buffer); + } + return href; +} +#endif /* DIRED_SUPPORT */ +#endif + + PUBLIC BOOLEAN getfile ARGS1( document *, doc) { @@ -55,7 +99,9 @@ PUBLIC BOOLEAN getfile ARGS1( * Reset LYCancelDownload to prevent unwanted delayed effect. - KW */ if (LYCancelDownload) { - CTRACE(tfp, "getfile: resetting LYCancelDownload to FALSE\n"); + if (TRACE) + fprintf(stderr, + "getfile: resetting LYCancelDownload to FALSE\n"); LYCancelDownload = FALSE; } @@ -85,7 +131,9 @@ Try_Redirected_URL: */ redirect_post_content = FALSE; - CTRACE(tfp,"getfile: getting %s\n\n",doc->address); + if (TRACE) { + fprintf(stderr,"getfile: getting %s\n\n",doc->address); + } /* * Protect against denial of service attacks @@ -157,7 +205,8 @@ Try_Redirected_URL: (lynxjumpfile != NULL && 0==strncasecomp(WWWDoc.address, lynxjumpfile, strlen(lynxjumpfile))))) { - HTUserMsg(NOT_HTTP_URL_OR_ACTION); + _statusline(NOT_HTTP_URL_OR_ACTION); + sleep(MessageSecs); return(NULLFILE); } } @@ -176,7 +225,6 @@ Try_Redirected_URL: url_type == LYNXIMGMAP_URL_TYPE || url_type == LYNXCOOKIE_URL_TYPE || url_type == LYNXPRINT_URL_TYPE || - url_type == LYNXOPTIONS_URL_TYPE || url_type == LYNXDOWNLOAD_URL_TYPE || url_type == MAILTO_URL_TYPE || url_type == NEWSPOST_URL_TYPE || @@ -197,7 +245,8 @@ Try_Redirected_URL: (lynxjumpfile != NULL && 0==strncasecomp(WWWDoc.address, lynxjumpfile, strlen(lynxjumpfile))))) { - HTUserMsg(NOT_IN_STARTING_REALM); + _statusline(NOT_IN_STARTING_REALM); + sleep(MessageSecs); return(NULLFILE); } } @@ -209,12 +258,13 @@ Try_Redirected_URL: url_type != GOPHER_URL_TYPE && url_type != CSO_URL_TYPE && url_type != PROXY_URL_TYPE && - url_type != LYNXOPTIONS_URL_TYPE && !(url_type == FILE_URL_TYPE && *(LYlist_temp_url()) && !strncmp(WWWDoc.address, LYlist_temp_url(), strlen(LYlist_temp_url())))) { - CTRACE(tfp, "getfile: dropping post_data!\n"); + if (TRACE) + fprintf(stderr, + "getfile: dropping post_data!\n"); HTAlert("POST not supported for this URL - ignoring POST data!"); FREE(doc->post_data); FREE(doc->post_content_type); @@ -239,19 +289,14 @@ Try_Redirected_URL: } else if (url_type == LYNXPRINT_URL_TYPE) { return(printfile(doc)); -#ifndef NO_OPTION_FORMS - } else if (url_type == LYNXOPTIONS_URL_TYPE) { - /* forms-based options menu */ - return(postoptions(doc)); -#endif - } else if (url_type == NEWSPOST_URL_TYPE || url_type == NEWSREPLY_URL_TYPE || url_type == SNEWSPOST_URL_TYPE || url_type == SNEWSREPLY_URL_TYPE) { if (no_newspost) { - HTUserMsg(NEWSPOSTING_DISABLED); + _statusline(NEWSPOSTING_DISABLED); + sleep(MessageSecs); return(NULLFILE); } else { HTLoadAbsolute(&WWWDoc); @@ -279,7 +324,8 @@ Try_Redirected_URL: } else if (url_type == LYNXDIRED_URL_TYPE) { #ifdef DIRED_SUPPORT if (no_dired_support) { - HTUserMsg(DIRED_DISABLED); + _statusline(DIRED_DISABLED); + sleep(MessageSecs); return(NULLFILE); } else { local_dired(doc); @@ -295,7 +341,8 @@ Try_Redirected_URL: return(NORMAL); } #else - HTUserMsg(DIRED_DISABLED); + _statusline(DIRED_DISABLED); + sleep(MessageSecs); return(NULLFILE); #endif /* DIRED_SUPPORT */ @@ -340,10 +387,12 @@ Try_Redirected_URL: if (no_exec && !exec_ok(HTLoadedDocumentURL(), doc->address+9, ALWAYS_EXEC_PATH)) { - HTUserMsg(EXECUTION_DISABLED); + statusline(EXECUTION_DISABLED); + sleep(MessageSecs); } else if (no_bookmark_exec && HTLoadedDocumentBookmark()) { - HTUserMsg(BOOKMARK_EXEC_DISABLED); + statusline(BOOKMARK_EXEC_DISABLED); + sleep(MessageSecs); } else if (local_exec || (local_exec_on_local_files && exec_ok(HTLoadedDocumentURL(), doc->address+9, EXEC_PATH))) { @@ -364,7 +413,15 @@ Try_Redirected_URL: if ((cp = strchr(doc->address, '~'))) { strncpy(addressbuf, doc->address, cp-doc->address); addressbuf[cp - doc->address] = '\0'; - p = wwwName(Home_Dir()); +#ifdef DOSPATH + p = HTDOS_wwwName((char *)Home_Dir()); +#else +#ifdef VMS + p = HTVMS_wwwName((char *)Home_Dir()); +#else + p = (char *)Home_Dir(); +#endif /* VMS */ +#endif /* DOSPATH */ strcat(addressbuf, p); strcat(addressbuf, cp+1); p = addressbuf; @@ -372,15 +429,16 @@ Try_Redirected_URL: /* * Show URL before executing it. */ - HTInfoMsg(doc->address); + statusline(doc->address); + sleep(InfoSecs); stop_curses(); /* * Run the command. */ if (strstr(p,"//") == p+9) - LYSystem(p+11); + system(p+11); else - LYSystem(p+9); + system(p+9); if (url_type != LYNXPROG_URL_TYPE) { /* * Make sure user gets to see screen output. @@ -407,16 +465,19 @@ Try_Redirected_URL: sprintf(buf, EXECUTION_DISABLED_FOR_FILE, key_for_func(LYK_OPTIONS)); - HTAlert(buf); + _statusline(buf); + sleep(AlertSecs); } #else /* no exec_links */ - HTUserMsg(EXECUTION_NOT_COMPILED); + _statusline(EXECUTION_NOT_COMPILED); + sleep(MessageSecs); #endif /* EXEC_LINKS */ return(NULLFILE); } else if (url_type == MAILTO_URL_TYPE) { if (no_mail) { - HTUserMsg(MAIL_DISABLED); + _statusline(MAIL_DISABLED); + sleep(MessageSecs); } else { HTParentAnchor *tmpanchor; CONST char *title; @@ -450,7 +511,8 @@ Try_Redirected_URL: url_type != LYNXCGI_URL_TYPE && !(LYisLocalHost(doc->address) || LYisLocalAlias(doc->address))) { - HTUserMsg(ACCESS_ONLY_LOCALHOST); + statusline(ACCESS_ONLY_LOCALHOST); + sleep(MessageSecs); return(NULLFILE); /* @@ -460,9 +522,11 @@ Try_Redirected_URL: url_type == TN3270_URL_TYPE || url_type == TELNET_GOPHER_URL_TYPE) { if (!telnet_ok) { - HTUserMsg(TELNET_DISABLED); + _statusline(TELNET_DISABLED); + sleep(MessageSecs); } else if (no_telnet_port && strchr(doc->address+7, ':')) { - HTUserMsg(TELNET_PORT_SPECS_DISABLED); + statusline(TELNET_PORT_SPECS_DISABLED); + sleep(MessageSecs); } else { stop_curses(); HTLoadAbsolute(&WWWDoc); @@ -476,12 +540,14 @@ Try_Redirected_URL: * Disable www news access if not news_ok. */ } else if (url_type == NEWS_URL_TYPE && !news_ok) { - HTUserMsg(NEWS_DISABLED); + _statusline(NEWS_DISABLED); + sleep(MessageSecs); return(NULLFILE); } else if (url_type == RLOGIN_URL_TYPE) { if (!rlogin_ok) { - HTUserMsg(RLOGIN_DISABLED); + statusline(RLOGIN_DISABLED); + sleep(MessageSecs); } else { stop_curses(); HTLoadAbsolute(&WWWDoc); @@ -542,7 +608,8 @@ Try_Redirected_URL: } else { if (url_type == FTP_URL_TYPE && !ftp_ok) { - HTUserMsg(FTP_DISABLED); + statusline(FTP_DISABLED); + sleep(MessageSecs); return(NULLFILE); } @@ -554,7 +621,9 @@ Try_Redirected_URL: if ((cp=strchr(doc->address+9, '/')) != NULL && 0==strncmp(++cp, "hGET%20/", 8)) { StrAllocCopy(tmp, "http://"); - CTRACE(tfp, "getfile: URL '%s'\n", + if (TRACE) + fprintf(stderr, + "getfile: URL '%s'\n", doc->address); *cp = '\0'; StrAllocCat(tmp, doc->address+9); @@ -568,8 +637,9 @@ Try_Redirected_URL: if (strlen(cp+7) > 1) StrAllocCat(tmp, cp+8); StrAllocCopy(doc->address, tmp); - CTRACE(tfp, " changed to '%s'\n", - doc->address); + if (TRACE) + fprintf(stderr, " changed to '%s'\n", + doc->address); FREE(tmp); url_type = HTTP_URL_TYPE; } @@ -600,27 +670,42 @@ Try_Redirected_URL: char *cp1 = strstr(doc->address, "/~"); char *cp2; - CTRACE(tfp, "getfile: URL '%s'\n", - doc->address); + if (TRACE) + fprintf(stderr, "getfile: URL '%s'\n", + doc->address); *cp1 = '\0'; cp1 += 2; StrAllocCopy(temp, doc->address); - LYAddHtmlSep(&temp); - StrAllocCat(temp, wwwName(Home_Dir())); +#ifdef DOSPATH + StrAllocCat(temp, "/"); + StrAllocCat(temp, HTDOS_wwwName((char *)Home_Dir())); +#else +#ifdef VMS + StrAllocCat(temp, + HTVMS_wwwName((char *)Home_Dir())); +#else + StrAllocCat(temp, Home_Dir()); +#endif /* VMS */ +#endif /* DOSPATH */ if ((cp2 = strchr(cp1, '/')) != NULL) { LYTrimRelFromAbsPath(cp2); StrAllocCat(temp, cp2); } StrAllocCopy(doc->address, temp); FREE(temp); - CTRACE(tfp, " changed to '%s'\n", - doc->address); + if (TRACE) + fprintf(stderr, " changed to '%s'\n", + doc->address); WWWDoc.address = doc->address; } FREE(cp); } - CTRACE_SLEEP(MessageSecs); + if (TRACE && LYTraceLogFP == NULL) + sleep(MessageSecs); user_message(WWW_WAIT_MESSAGE, doc->address); +#ifdef NOTDEFINED + sleep(InfoSecs); +#endif /* NOTDEFINED */ if (TRACE) { #ifdef USE_SLANG if (LYCursesON) { @@ -628,7 +713,7 @@ Try_Redirected_URL: refresh(); } #endif /* USE_SLANG */ - fprintf(tfp,"\n"); + fprintf(stderr,"\n"); } if ((LYNoRefererHeader == FALSE && LYNoRefererForThis == FALSE) && @@ -690,7 +775,6 @@ Try_Redirected_URL: url_type == LYNXDIRED_URL_TYPE || #endif /* DIRED_SUPPORT */ url_type == LYNXPRINT_URL_TYPE || - url_type == LYNXOPTIONS_URL_TYPE || url_type == LYNXHIST_URL_TYPE || url_type == LYNXCOOKIE_URL_TYPE || (LYValidate && @@ -756,16 +840,20 @@ Try_Redirected_URL: * be positioned at the top of that document, * so there's no harm done. - FM */ - CTRACE(tfp, + if (TRACE) { + fprintf(stderr, "getfile: Adding fragment '%s' to redirection URL.\n", pound); + } StrAllocCat(use_this_url_instead, pound); } - CTRACE_SLEEP(MessageSecs); + if (TRACE && LYTraceLogFP == NULL) + sleep(MessageSecs); _user_message(WWW_USING_MESSAGE, use_this_url_instead); sleep(InfoSecs); - CTRACE(tfp, "\n"); + if (TRACE) + fprintf(stderr, "\n"); StrAllocCopy(doc->address, use_this_url_instead); FREE(use_this_url_instead); @@ -817,7 +905,7 @@ Try_Redirected_URL: HTMLSetCharacterHandling(current_char_set); /* * Check for a suggested filename from - * the Content-Disposition header. - FM + * the Content-Dispostion header. - FM */ if (((tmpanchor = HTAnchor_parent( HTAnchor_findAddress(&WWWDoc) @@ -898,9 +986,12 @@ Try_Redirected_URL: } } } else { - CTRACE_SLEEP(MessageSecs); - HTUserMsg2(WWW_BAD_ADDR_MESSAGE, doc->address); - CTRACE(tfp,"\n"); + if (TRACE && LYTraceLogFP == NULL) + sleep(MessageSecs); + _user_message(WWW_BAD_ADDR_MESSAGE, doc->address); + if (TRACE) + fprintf(stderr,"\n"); + sleep(MessageSecs); return(NULLFILE); } } @@ -939,7 +1030,8 @@ PUBLIC int follow_link_number ARGS4( * Get the number, possibly with a letter suffix, from the user. */ if (LYgetstr(temp, VISIBLE, sizeof(temp), NORECALL) < 0 || *temp == 0) { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return(DO_NOTHING); } *num = atoi(temp); @@ -1127,7 +1219,7 @@ PUBLIC void add_trusted ARGS2( */ PUBLIC BOOLEAN exec_ok ARGS3( CONST char *, source, - CONST char *, linktext, + CONST char *, link, int, type) { struct trust *tp; @@ -1158,7 +1250,7 @@ PUBLIC BOOLEAN exec_ok ARGS3( /* * Security: reject on relative path. */ - if ((cp = strchr(linktext, '[')) != NULL) { + if ((cp = strchr(link, '[')) != NULL) { char *cp1; if (((cp1 = strchr(cp, '-')) != NULL) && strchr(cp1, ']') != NULL) { @@ -1175,7 +1267,7 @@ PUBLIC BOOLEAN exec_ok ARGS3( /* * Security: reject on relative path. */ - if (strstr(linktext, "../") != NULL) { + if (strstr(link, "../") != NULL) { HTAlert(RELPATH_IN_EXEC_LINK); return FALSE; } @@ -1183,7 +1275,7 @@ PUBLIC BOOLEAN exec_ok ARGS3( /* * Security: reject on strange character. */ - for (cp = linktext; *cp != '\0'; cp++) { + for (cp = link; *cp != '\0'; cp++) { if (!isalnum(*cp) && *cp != '_' && *cp != '-' && *cp != ' ' && *cp != ':' && *cp != '.' && *cp != '/' && @@ -1204,9 +1296,9 @@ PUBLIC BOOLEAN exec_ok ARGS3( check_tp_for_entry: while (tp) { if (tp->type == Type) { - char CONST *command = linktext; + char CONST *command = link; - if (strstr(command,"//") == linktext) { + if (strstr(command,"//") == link) { command += 2; } #ifdef VMS @@ -1241,7 +1333,7 @@ PRIVATE int fix_http_urls ARGS1( * If it's an ftp URL with a trailing slash, trim it off. */ if (!strncmp(doc->address, "ftp", 3) && - LYIsHtmlSep(doc->address[strlen(doc->address)-1])) { + doc->address[strlen(doc->address)-1] == '/') { char * proxy; char *path = HTParse(doc->address, "", PARSE_PATH|PARSE_PUNCTUATION); @@ -1249,7 +1341,7 @@ PRIVATE int fix_http_urls ARGS1( * If the path is a lone slash, we're done. - FM */ if (path) { - if (LYIsHtmlSep(path[0]) && path[1] == '\0') { + if (path[0] == '/' && path[1] == '\0') { FREE(path); return 0; } @@ -1266,24 +1358,32 @@ PRIVATE int fix_http_urls ARGS1( /* * If we get to here, trim the trailing slash. - FM */ - CTRACE(tfp, "fix_http_urls: URL '%s'\n", doc->address); - LYTrimHtmlSep(doc->address); - CTRACE(tfp, " changed to '%s'\n", doc->address); - CTRACE_SLEEP(MessageSecs); + if (TRACE) + fprintf(stderr, "fix_http_urls: URL '%s'\n", doc->address); + doc->address[strlen(doc->address)-1] = '\0'; + if (TRACE) { + fprintf(stderr, " changed to '%s'\n", doc->address); + if (!LYTraceLogFP) + sleep(MessageSecs); + } } /* * If there isn't a slash besides the two at the beginning, append one. */ if ((slash = strrchr(doc->address, '/')) != NULL) { - if (!LYIsHtmlSep(*(slash-1)) || *(slash-2) != ':') { + if (*(slash-1) != '/' || *(slash-2) != ':') { return(0); } } - CTRACE(tfp, "fix_http_urls: URL '%s'\n", doc->address); - LYAddHtmlSep(&(doc->address)); - CTRACE(tfp, " changed to '%s'\n",doc->address); - CTRACE_SLEEP(MessageSecs); + if (TRACE) + fprintf(stderr, "fix_http_urls: URL '%s'\n", doc->address); + StrAllocCat(doc->address, "/"); + if (TRACE) { + fprintf(stderr, " changed to '%s'\n",doc->address); + if (!LYTraceLogFP) + sleep(MessageSecs); + } return(1); } diff --git a/src/LYGetFile.h b/src/LYGetFile.h index 93239e83..8ddfb999 100644 --- a/src/LYGetFile.h +++ b/src/LYGetFile.h @@ -1,8 +1,7 @@ + #ifndef LYGETFILE_H #define LYGETFILE_H -#include <LYStructs.h> - #define NOT_FOUND 0 #define NORMAL 1 #define NULLFILE 3 diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index c326615d..8d447861 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -15,22 +15,6 @@ #include <LYStructs.h> #endif /* LYSTRUCTS_H */ -#ifdef HAVE_CONFIG_H -#include <LYHelp.h> -#else -#define COOKIE_JAR_HELP "Lynx_users_guide.html#Cookies" -#define CURRENT_KEYMAP_HELP "keystrokes/keystroke_help.html" -#define DIRED_MENU_HELP "keystrokes/dired_help.html" -#define DOWNLOAD_OPTIONS_HELP "Lynx_users_guide.html#RemoteSource" -#define HISTORY_PAGE_HELP "keystrokes/history_help.html" -#define LIST_PAGE_HELP "keystrokes/follow_help.html" -#define LYNXCFG_HELP "lynx.cfg" -#define OPTIONS_HELP "keystrokes/option_help.html" -#define PRINT_OPTIONS_HELP "keystrokes/print_help.html" -#define UPLOAD_OPTIONS_HELP "Lynx_users_guide.html#DirEd" -#define VISITED_LINKS_HELP "keystrokes/visited_help.html" -#endif /* LYHELP_H */ - #ifdef SOCKS extern BOOLEAN socks_flag; #endif /* SOCKS */ @@ -45,6 +29,22 @@ extern BOOLEAN UseFixedRecords; /* convert binary files to FIXED 512 records */ #endif /* VMS */ #ifndef VMS +extern char *NNTPSERVER_putenv_cmd; +extern char *http_proxy_putenv_cmd; +extern char *https_proxy_putenv_cmd; +extern char *ftp_proxy_putenv_cmd; +extern char *gopher_proxy_putenv_cmd; +extern char *cso_proxy_putenv_cmd; +extern char *news_proxy_putenv_cmd; +extern char *newspost_proxy_putenv_cmd; +extern char *newsreply_proxy_putenv_cmd; +extern char *snews_proxy_putenv_cmd; +extern char *snewspost_proxy_putenv_cmd; +extern char *snewsreply_proxy_putenv_cmd; +extern char *nntp_proxy_putenv_cmd; +extern char *wais_proxy_putenv_cmd; +extern char *finger_proxy_putenv_cmd; +extern char *no_proxy_putenv_cmd; extern char *list_format; #endif /* !VMS */ @@ -55,7 +55,7 @@ extern char *LYCSwingPath; #ifdef DIRED_SUPPORT extern BOOLEAN lynx_edit_mode; extern BOOLEAN no_dired_support; -extern int dir_list_style; +extern BOOLEAN dir_list_style; extern HTList *tagged; #define FILES_FIRST 1 #define MIXED_STYLE 2 @@ -111,13 +111,8 @@ extern int LYShowColor; /* Show color or monochrome? */ extern int LYChosenShowColor; /* extended color/monochrome choice */ extern int LYrcShowColor; /* ... as read or last written */ -#if !defined(NO_OPTION_FORMS) && !defined(NO_OPTION_MENU) -extern BOOLEAN LYUseFormsOptions; /* use Forms-based options menu */ -#else -#define LYUseFormsOptions FALSE /* simplify ifdef'ing in LYMainLoop.c */ -#endif extern BOOLEAN LYShowCursor; /* Show the cursor or hide it? */ -extern BOOLEAN verbose_img; /* display filenames of images? */ +extern BOOLEAN verbose_img; /* display filenames of images? */ extern BOOLEAN LYUseDefShoCur; /* Command line -show_cursor toggle */ extern BOOLEAN LYCursesON; /* start_curses()->TRUE, stop_curses()->FALSE */ extern BOOLEAN LYUserSpecifiedURL; /* URL from a goto or document? */ @@ -141,14 +136,13 @@ extern char *helpfilepath; extern char *lynxjumpfile; extern char *lynxlistfile; extern char *lynxlinksfile; -extern char *x_display; +extern char *display; extern char *language; extern char *pref_charset; /* Lynx's preferred character set - MM */ extern BOOLEAN LYNewsPosting; /* News posting supported if TRUE */ extern char *LynxSigFile; /* Signature file, in or off home */ extern char *system_mail; extern char *system_mail_flags; -extern char *lynx_cfg_file; /* location of active lynx.cfg file */ extern char *lynx_temp_space; extern char *lynx_save_space; extern BOOLEAN LYforce_HTML_mode; @@ -156,8 +150,7 @@ extern BOOLEAN LYforce_no_cache; extern BOOLEAN LYoverride_no_cache; /* don't need fresh copy, from history */ extern BOOLEAN LYinternal_flag; /* don't need fresh copy, was internal link */ extern BOOLEAN LYresubmit_posts; -extern BOOLEAN LYshow_kb_rate; /* show KB/sec in HTReadProgress */ -extern int user_mode; /* novice or advanced */ +extern BOOLEAN user_mode; /* novice or advanced */ extern BOOLEAN is_www_index; extern BOOLEAN dump_output_immediately; extern int dump_output_width; @@ -170,19 +163,20 @@ extern BOOLEAN telnet_ok; extern BOOLEAN news_ok; extern BOOLEAN ftp_ok; extern BOOLEAN rlogin_ok; -extern BOOLEAN system_editor; /* True if locked-down editor */ -extern BOOLEAN child_lynx; /* TRUE to exit with an arrow */ +extern BOOLEAN no_print; /* TRUE to disable printing */ +extern BOOLEAN system_editor; /* True if locked-down editor */ +extern BOOLEAN child_lynx; /* TRUE to exit with an arrow */ extern BOOLEAN error_logging; /* TRUE to mail error messages */ extern BOOLEAN check_mail; /* TRUE to report unread/new mail messages */ extern BOOLEAN vi_keys; /* TRUE to turn on vi-like key movement */ extern BOOLEAN emacs_keys; /* TRUE to turn on emacs-like key movement */ -extern int keypad_mode; /* is set to either NUMBERS_AS_ARROWS * +extern BOOLEAN keypad_mode; /* is set to either NUMBERS_AS_ARROWS * * or LINKS_ARE_NUMBERED */ extern BOOLEAN case_sensitive; /* TRUE to turn on case sensitive search */ extern BOOLEAN no_inside_telnet; /* this and following are restrictions */ extern BOOLEAN no_outside_telnet; extern BOOLEAN no_telnet_port; -extern BOOLEAN no_inside_news; +extern BOOLEAN no_inside_news; extern BOOLEAN no_outside_news; extern BOOLEAN no_inside_ftp; extern BOOLEAN no_outside_ftp; @@ -195,8 +189,8 @@ extern BOOLEAN no_bookmark; extern BOOLEAN no_multibook; extern BOOLEAN no_bookmark_exec; extern BOOLEAN no_option_save; +extern BOOLEAN no_print; extern BOOLEAN no_download; -extern BOOLEAN no_print; /* TRUE to disable printing */ extern BOOLEAN no_disk_save; extern BOOLEAN no_exec; extern BOOLEAN no_lynxcgi; @@ -251,21 +245,12 @@ extern BOOLEAN historical_comments; extern BOOLEAN minimal_comments; extern BOOLEAN soft_dquotes; extern BOOLEAN LYCancelDownload; -extern BOOLEAN LYRestricted; extern BOOLEAN LYValidate; extern BOOLEAN LYPermitURL; extern BOOLEAN enable_scrollback; /* Clear screen before displaying new page */ extern BOOLEAN keep_mime_headers; /* Include mime headers and * * force source dump */ extern BOOLEAN no_url_redirection; /* Don't follow URL redirections */ -#ifdef DISP_PARTIAL -extern BOOLEAN display_partial; /* Display document during download */ -extern int Newline_partial; /* -//- "current" newline position */ -extern int NumOfLines_partial; /* -//- "current" number of lines */ -extern int partial_threshold; -extern BOOLEAN debug_display_partial; /* show with MessageSecs delay */ -extern BOOLEAN detected_forms_input_partial; /* trimHightext temp fix */ -#endif extern char *form_post_data; /* User data for post form */ extern char *form_get_data; /* User data for get form */ extern char *http_error_file; /* Place HTTP status code in this file */ @@ -295,44 +280,36 @@ extern BOOLEAN LYNoFromHeader; /* Never send From header? */ extern BOOLEAN LYListNewsNumbers; extern BOOLEAN LYUseMouse; extern BOOLEAN LYListNewsDates; - extern BOOLEAN LYRawMode; extern BOOLEAN LYDefaultRawMode; extern BOOLEAN LYUseDefaultRawMode; extern char *UCAssume_MIMEcharset; -extern BOOLEAN UCSaveBookmarksInUnicode; /* in titles, chars >127 save as &#xUUUU */ -extern BOOLEAN UCForce8bitTOUPPER; /* disable locale case-conversion for >127 */ -extern int outgoing_mail_charset; /* translate outgoing mail to this charset */ - +extern char *UCAssume_localMIMEcharset; +extern char *UCAssume_unrecMIMEcharset; extern BOOLEAN LYisConfiguredForX; extern char *URLDomainPrefixes; extern char *URLDomainSuffixes; extern BOOLEAN startfile_ok; extern BOOLEAN LYSelectPopups; /* Cast popups to radio buttons? */ extern BOOLEAN LYUseDefSelPop; /* Command line -popup toggle */ -extern BOOLEAN LYMultiBookmarks; /* Multi bookmark support on? */ +extern int LYMultiBookmarks; /* Multi bookmark support on? */ extern BOOLEAN LYMBMBlocked; /* Force MBM support off? */ extern BOOLEAN LYMBMAdvanced; /* MBM statusline for ADVANCED? */ extern int LYStatusLine; /* Line for statusline() or -1 */ extern BOOLEAN LYCollapseBRs; /* Collapse serial BRs? */ extern BOOLEAN LYSetCookies; /* Process Set-Cookie headers? */ -extern BOOLEAN LYAcceptAllCookies; /* accept ALL cookies? */ -extern char *LYCookieAcceptDomains; /* domains to accept all cookies */ -extern char *LYCookieRejectDomains; /* domains to reject all cookies */ -#ifdef EXP_PERSISTENT_COOKIES -extern BOOLEAN persistent_cookies; -extern char *LYCookieFile; /* file to store cookies in */ -#endif /* EXP_PERSISTENT_COOKIES */ extern char *XLoadImageCommand; /* Default image viewer for X */ #ifdef USE_EXTERNALS -extern BOOLEAN no_externals; /* don't allow the use of externals */ +extern BOOLEAN no_externals; /* don't allow the use of externals */ #endif extern BOOLEAN LYNoISMAPifUSEMAP; /* Omit ISMAP link if MAP present? */ extern int LYHiddenLinks; -extern BOOL New_DTD; +extern BOOL New_DTD; -#define MBM_V_MAXFILES 25 /* Max number of sub-bookmark files */ +#define BOOKMARK_TITLE "Bookmark file" +#define MOSAIC_BOOKMARK_TITLE "Converted Mosaic Hotlist" +#define MBM_V_MAXFILES 25 /* Max number of sub-bookmark files */ /* * Arrays that holds the names of sub-bookmark files * and their descriptions. @@ -342,6 +319,7 @@ extern char *MBM_A_subdescript[MBM_V_MAXFILES+1]; extern FILE *LYTraceLogFP; /* Pointer for TRACE log */ extern char *LYTraceLogPath; /* Path for TRACE log */ extern BOOLEAN LYUseTraceLog; /* Use a TRACE log? */ +extern FILE LYOrigStderr; /* Original stderr pointer */ extern BOOLEAN LYSeekFragMAPinCur; extern BOOLEAN LYSeekFragAREAinCur; extern BOOLEAN LYStripDotDotURLs; /* Try to fix ../ in some URLs? */ @@ -352,6 +330,10 @@ extern BOOLEAN LYPrependBaseToSource; extern BOOLEAN LYPrependCharsetToSource; extern BOOLEAN LYQuitDefaultYes; +#ifdef RAWDOSKEYHACK +extern BOOLEAN raw_dos_key_hack; /* Turn on and off DOS key hack */ +#endif /* RAWDOSKEYHACK */ + #ifndef VMS extern BOOLEAN LYNoCore; #endif /* !VMS */ diff --git a/src/LYHash.h b/src/LYHash.h index c76ae994..00f8066c 100644 --- a/src/LYHash.h +++ b/src/LYHash.h @@ -1,8 +1,6 @@ #if !defined(_LYHASH_H_) #define _LYHASH_H_ 1 -#include <HTUtils.h> - struct _hashbucket { char *name; /* name of this item */ int code; /* code of this item */ diff --git a/src/LYHistory.c b/src/LYHistory.c index 20126cc9..433114b4 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTTP.h> #include <HTAlert.h> #include <HText.h> @@ -7,7 +8,6 @@ #include <LYHistory.h> #include <LYPrint.h> #include <LYDownload.h> -#include <LYOptions.h> #include <LYKeymap.h> #include <LYList.h> #include <LYShowInfo.h> @@ -22,10 +22,12 @@ #include <LYexit.h> #include <LYLeaks.h> + +#define FREE(x) if (x) {free(x); x = NULL;} -PUBLIC HTList * Visited_Links = NULL; /* List of safe popped docs. */ +PUBLIC HTList * Visited_Links = NULL; /* List of safe popped docs. */ -/* +/* * Utility for freeing the list of visited links. - FM */ PRIVATE void Visited_Links_free NOARGS @@ -34,7 +36,7 @@ PRIVATE void Visited_Links_free NOARGS HTList *cur = Visited_Links; if (!cur) - return; + return; while (NULL != (vl = (VisitedLink *)HTList_nextObject(cur))) { FREE(vl->address); @@ -46,7 +48,7 @@ PRIVATE void Visited_Links_free NOARGS return; } -/* +/* * Utility for listing visited links, making any repeated * links the most current in the list. - FM */ @@ -58,17 +60,16 @@ PUBLIC void LYAddVisitedLink ARGS1( HTList *cur; if (!(doc->address && *doc->address)) - return; + return; /* - * Exclude POST or HEAD replies, and bookmark, menu - * or list files. - FM + * Exclude POST or HEAD replies, and bookmark, menu + * or list files. - FM */ if (doc->post_data || doc->isHEAD || doc->bookmark || !strcmp((doc->title ? doc->title : ""), HISTORY_PAGE_TITLE) || !strcmp((doc->title ? doc->title : ""), PRINT_OPTIONS_TITLE) || !strcmp((doc->title ? doc->title : ""), DOWNLOAD_OPTIONS_TITLE) || - !strcmp((doc->title ? doc->title : ""), OPTIONS_TITLE) || #ifdef DIRED_SUPPORT !strcmp((doc->title ? doc->title : ""), DIRED_MENU_TITLE) || !strcmp((doc->title ? doc->title : ""), UPLOAD_OPTIONS_TITLE) || @@ -84,12 +85,12 @@ PUBLIC void LYAddVisitedLink ARGS1( } if ((new = (VisitedLink *)calloc(1, sizeof(*new))) == NULL) - outofmem(__FILE__, "HTAddVisitedLink"); + outofmem(__FILE__, "HTAddVisitedLink"); StrAllocCopy(new->address, doc->address); StrAllocCopy(new->title, (doc->title ? doc->title : "(no title)")); if (!Visited_Links) { - Visited_Links = HTList_new(); + Visited_Links = HTList_new(); atexit(Visited_Links_free); HTList_addObject(Visited_Links, new); return; @@ -100,7 +101,7 @@ PUBLIC void LYAddVisitedLink ARGS1( if (!strcmp((old->address ? old->address : ""), (new->address ? new->address : "")) && !strcmp((old->title ? new->title : ""), - (new->title ? new->title : ""))) { + (new->title ? new->title : ""))) { FREE(old->address); FREE(old->title); HTList_removeObject(Visited_Links, old); @@ -114,26 +115,6 @@ PUBLIC void LYAddVisitedLink ARGS1( } /* - * Returns true if this is a page that we would push onto the stack if not - * forced. - */ -PUBLIC BOOLEAN LYwouldPush ARGS1( - char *, title) -{ - return (!strcmp(title, HISTORY_PAGE_TITLE) - || !strcmp(title, PRINT_OPTIONS_TITLE) - || !strcmp(title, DOWNLOAD_OPTIONS_TITLE) -#ifdef DIRED_SUPPORT - || !strcmp(title, DIRED_MENU_TITLE) - || !strcmp(title, UPLOAD_OPTIONS_TITLE) - || !strcmp(title, PERMIT_OPTIONS_TITLE) -#endif /* DIRED_SUPPORT */ - ) - ? FALSE - : TRUE; -} - -/* * Push the current filename, link and line number onto the history list. */ PUBLIC void LYpush ARGS2( @@ -141,54 +122,98 @@ PUBLIC void LYpush ARGS2( BOOLEAN, force_push) { /* - * Don't push NULL file names. + * Don't push NULL file names. */ if (*doc->address == '\0') return; /* - * Check whether this is a document we - * don't push unless forced. - FM + * Check whether this is a document we + * don't push unless forced. - FM */ if (!force_push) { /* * Don't push the history, printer, or download lists. */ - if (!LYwouldPush(doc->title)) { + if (!strcmp(doc->title, HISTORY_PAGE_TITLE) || + !strcmp(doc->title, PRINT_OPTIONS_TITLE) || + !strcmp(doc->title, DOWNLOAD_OPTIONS_TITLE)) { if (!LYforce_no_cache) LYoverride_no_cache = TRUE; return; } + +#ifdef DIRED_SUPPORT + /* + * Don't push DIRED menu, upload or permit lists. + */ + if (!strcmp(doc->title, DIRED_MENU_TITLE) || + !strcmp(doc->title, UPLOAD_OPTIONS_TITLE) || + !strcmp(doc->title, PERMIT_OPTIONS_TITLE)) { + if (!LYforce_no_cache) + LYoverride_no_cache = TRUE; + return; + } +#endif /* DIRED_SUPPORT */ } /* - * If file is identical to one before it, don't push it. + * If file is identical to one before it, don't push it. */ if (nhist> 1 && - STREQ(history[nhist-1].address, doc->address) && - !strcmp(history[nhist-1].post_data ? + STREQ(history[nhist-1].address, doc->address) && + !strcmp(history[nhist-1].post_data ? history[nhist-1].post_data : "", - doc->post_data ? + doc->post_data ? doc->post_data : "") && - !strcmp(history[nhist-1].bookmark ? + !strcmp(history[nhist-1].bookmark ? history[nhist-1].bookmark : "", - doc->bookmark ? + doc->bookmark ? doc->bookmark : "") && history[nhist-1].isHEAD == doc->isHEAD) { if (history[nhist-1].internal_link == doc->internal_link) { /* But it is nice to have the last position remembered! - kw */ history[nhist-1].link = doc->link; - history[nhist-1].line = doc->line; - return; + history[nhist-1].page = doc->line; + return; } } + +#ifdef NOTDEFINED +/* +** The following segment not used any more - What's it good for, +** anyway?? Doing a pop when a push is requested is confusing, +** also to the user. Moreover, the way it was done seems to cause +** a memory leak. - KW +*/ /* + * If file is identical to one two before it, don't push it. + */ + if (nhist > 2 && + STREQ(history[nhist-2].address, doc->address) && + !strcmp(history[nhist-2].post_data ? + history[nhist-2].post_data : "", + doc->post_data ? + doc->post_data : "") && + !strcmp(history[nhist-2].bookmark ? + history[nhist-2].bookmark : "", + doc->bookmark ? + doc->bookmark : "") && + history[nhist-2].isHEAD == doc->isHEAD) { + /* + * Pop one off the stack. + */ + nhist--; + return; + } +#endif /* NOTDEFINED */ + /* - * OK, push it if we have stack space. + * OK, push it if we have stack space. */ if (nhist < MAXHIST) { history[nhist].link = doc->link; - history[nhist].line = doc->line; + history[nhist].page = doc->line; history[nhist].title = NULL; StrAllocCopy(history[nhist].title, doc->title); history[nhist].address = NULL; @@ -205,7 +230,7 @@ PUBLIC void LYpush ARGS2( history[nhist].internal_link = FALSE; /* by default */ history[nhist].intern_seq_start = -1; /* by default */ if (doc->internal_link) { - /* Now some tricky stuff: if the caller thinks that the doc + /* Now some tricky stuff: if the caller thinks that the doc to push was the result of following an internal (fragment) link, we check whether we believe it. It is only accepted as valid if the immediately preceding @@ -278,24 +303,37 @@ PUBLIC void LYpush ARGS2( history[nhist].intern_seq_start = history[nhist-1].intern_seq_start >= 0 ? history[nhist-1].intern_seq_start : nhist-1; - CTRACE(tfp, "\nLYpush: pushed as internal link, OK\n"); + if (TRACE) { + fprintf(stderr, + "\nLYpush: pushed as internal link, OK\n"); + } } } } if (!history[nhist].internal_link) { - CTRACE(tfp, "\nLYpush: push as internal link requested, %s\n", + if (TRACE) { + fprintf(stderr, + "\nLYpush: push as internal link requested, %s\n", "but didn't check out!"); + } } } - CTRACE(tfp, "\nLYpush[%d]: address:%s\n title:%s\n", - nhist, doc->address, doc->title); nhist++; - } else { - if (LYCursesON) { - HTAlert(MAXHIST_REACHED); + if (TRACE) { + fprintf(stderr, + "\nLYpush: address:%s\n title:%s\n", + doc->address, doc->title); } - CTRACE(tfp, "\nLYpush: MAXHIST reached for:\n address:%s\n title:%s\n", + } else { + if (LYCursesON) { + _statusline(MAXHIST_REACHED); + sleep(AlertSecs); + } + if (TRACE) { + fprintf(stderr, + "\nLYpush: MAXHIST reached for:\n address:%s\n title:%s\n", doc->address, doc->title); + } } } @@ -308,11 +346,11 @@ PUBLIC void LYpop ARGS1( if (nhist > 0) { nhist--; doc->link = history[nhist].link; - doc->line = history[nhist].line; + doc->line = history[nhist].page; FREE(doc->title); doc->title = history[nhist].title; /* will be freed later */ FREE(doc->address); - doc->address = history[nhist].address; /* will be freed later */ + doc->address = history[nhist].address; /* will be freed later */ FREE(doc->post_data); doc->post_data = history[nhist].post_data; FREE(doc->post_content_type); @@ -322,13 +360,11 @@ PUBLIC void LYpop ARGS1( doc->isHEAD = history[nhist].isHEAD; doc->safe = history[nhist].safe; doc->internal_link = history[nhist].internal_link; -#ifdef DISP_PARTIAL - /* assume we pop the 'doc' to show it soon... */ - Newline_partial = doc->line; /* reinitialize */ - NumOfLines_partial = -1; /* initialize to -1 */ -#endif /* DISP_PARTIAL */ - CTRACE(tfp, "LYpop[%d]: address:%s\n title:%s\n", - nhist, doc->address, doc->title); + if (TRACE) { + fprintf(stderr, + "LYpop: address:%s\n title:%s\n", + doc->address, doc->title); + } } } @@ -343,7 +379,7 @@ PUBLIC void LYpop_num ARGS2( { if (number >= 0 && nhist > number) { doc->link = history[number].link; - doc->line = history[number].line; + doc->line = history[number].page; StrAllocCopy(doc->title, history[number].title); StrAllocCopy(doc->address, history[number].address); StrAllocCopy(doc->post_data, history[number].post_data); @@ -352,11 +388,6 @@ PUBLIC void LYpop_num ARGS2( doc->isHEAD = history[number].isHEAD; doc->safe = history[number].safe; doc->internal_link = history[number].internal_link; /* ?? */ -#ifdef DISP_PARTIAL - /* assume we pop the 'doc' to show it soon... */ - Newline_partial = doc->line; /* reinitialize */ - NumOfLines_partial = -1; /* initialize to -1 */ -#endif /* DISP_PARTIAL */ } } @@ -366,25 +397,45 @@ PUBLIC void LYpop_num ARGS2( PUBLIC int showhistory ARGS1( char **, newfile) { - static char tempfile[LY_MAXPATH]; + static char tempfile[256]; + static BOOLEAN first = TRUE; + static char hist_filename[256]; char *Title = NULL; int x = 0; FILE *fp0; - LYRemoveTemp(tempfile); - if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) { + if (first) { + tempname(tempfile, NEW_FILE); + /* + * Make the file a URL now. + */ +#if defined (VMS) || defined (DOSPATH) + sprintf(hist_filename,"file://localhost/%s", tempfile); +#else + sprintf(hist_filename,"file://localhost%s", tempfile); +#endif /* VMS */ + first = FALSE; +#ifdef VMS + } else { + remove(tempfile); /* Remove duplicates on VMS. */ +#endif /* VMS */ + } + + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(-1); } - LYLocalFileToURL(newfile, tempfile); - + StrAllocCopy(*newfile, hist_filename); LYforce_HTML_mode = TRUE; /* force this file to be HTML */ LYforce_no_cache = TRUE; /* force this file to be new */ - BeginInternalPage(fp0, HISTORY_PAGE_TITLE, HISTORY_PAGE_HELP); - - fprintf(fp0, "<pre>\n"); + fprintf(fp0, "<head>\n"); + LYAddMETAcharsetToFD(fp0, -1); + fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n", + HISTORY_PAGE_TITLE); + fprintf(fp0, "<h1>You have reached the History Page</h1>\n"); + fprintf(fp0, "<h2>%s Version %s</h2>\n<pre>", LYNX_NAME, LYNX_VERSION); fprintf(fp0, "<em>You selected:</em>\n"); for (x = nhist-1; x >= 0; x--) { /* @@ -399,7 +450,7 @@ PUBLIC int showhistory ARGS1( } fprintf(fp0, "%s<em>%d</em>. <tab id=t%d><a href=\"LYNXHIST:%d\">%s</a>\n", - (x > 99 ? "" : x < 10 ? " " : " "), + (x > 99 ? "" : x < 10 ? " " : " "), x, x, x, Title); if (history[x].address != NULL) { StrAllocCopy(Title, history[x].address); @@ -415,15 +466,15 @@ PUBLIC int showhistory ARGS1( } fprintf(fp0, "<tab to=t%d>%s\n", x, Title); } - fprintf(fp0,"</pre>\n"); - EndInternalPage(fp0); - LYCloseTempFP(fp0); + fprintf(fp0,"</pre>\n</body>\n"); + + fclose(fp0); FREE(Title); return(0); } -/* +/* * This function makes the history page seem like any other type of * file since more info is needed than can be provided by the normal * link structure. We saved out the history number to a special URL. @@ -439,11 +490,11 @@ PUBLIC BOOLEAN historytarget ARGS1( BOOLEAN treat_as_intern = FALSE; if ((!newdoc || !newdoc->address) || - strlen(newdoc->address) < 10 || !isdigit(*(newdoc->address+9))) + strlen(newdoc->address) < 10 || !isdigit(*(newdoc->address+9))) return(FALSE); if ((number = atoi(newdoc->address+9)) > nhist || number < 0) - return(FALSE); + return(FALSE); LYpop_num(number, newdoc); if (((newdoc->internal_link && @@ -462,20 +513,20 @@ PUBLIC BOOLEAN historytarget ARGS1( newdoc->internal_link = FALSE; } /* - * If we have POST content, and have LYresubmit_posts set - * or have no_cache set or do not still have the text cached, - * ask the user whether to resubmit the form. - FM + * If we have POST content, and have LYresubmit_posts set + * or have no_cache set or do not still have the text cached, + * ask the user whether to resubmit the form. - FM */ if (newdoc->post_data != NULL) { WWWDoc.address = newdoc->address; - WWWDoc.post_data = newdoc->post_data; - WWWDoc.post_content_type = newdoc->post_content_type; - WWWDoc.bookmark = newdoc->bookmark; + WWWDoc.post_data = newdoc->post_data; + WWWDoc.post_content_type = newdoc->post_content_type; + WWWDoc.bookmark = newdoc->bookmark; WWWDoc.isHEAD = newdoc->isHEAD; WWWDoc.safe = newdoc->safe; tmpanchor = HTAnchor_parent(HTAnchor_findAddress(&WWWDoc)); text = (HText *)HTAnchor_document(tmpanchor); - if (((((LYresubmit_posts == TRUE) || + if (((((LYresubmit_posts == TRUE) || (LYforce_no_cache == TRUE && LYoverride_no_cache == FALSE)) && !(treat_as_intern && !reloading)) || @@ -488,7 +539,8 @@ PUBLIC BOOLEAN historytarget ARGS1( LYforce_no_cache = FALSE; LYoverride_no_cache = TRUE; } else { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return(FALSE); } } @@ -505,7 +557,9 @@ PUBLIC BOOLEAN historytarget ARGS1( PUBLIC int LYShowVisitedLinks ARGS1( char **, newfile) { - static char tempfile[LY_MAXPATH]; + static char tempfile[256]; + static BOOLEAN first = TRUE; + static char vl_filename[256]; char *Title = NULL; char *Address = NULL; int x; @@ -514,23 +568,41 @@ PUBLIC int LYShowVisitedLinks ARGS1( HTList *cur = Visited_Links; if (!cur) - return(-1); + return(-1); + + if (first) { + tempname(tempfile, NEW_FILE); + /* + * Make the file a URL now. + */ +#if defined (VMS) || defined (DOSPATH) + sprintf(vl_filename,"file://localhost/%s", tempfile); +#else + sprintf(vl_filename,"file://localhost%s", tempfile); +#endif /* VMS */ + first = FALSE; +#ifdef VMS + } else { + remove(tempfile); /* Remove duplicates on VMS. */ +#endif /* VMS */ + } - LYRemoveTemp(tempfile); - if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(-1); } - LYLocalFileToURL(newfile, tempfile); - + StrAllocCopy(*newfile, vl_filename); LYforce_HTML_mode = TRUE; /* force this file to be HTML */ LYforce_no_cache = TRUE; /* force this file to be new */ - BeginInternalPage(fp0, VISITED_LINKS_TITLE, VISITED_LINKS_HELP); - - fprintf(fp0, "<pre>\n"); - fprintf(fp0, + fprintf(fp0, "<head>\n"); + LYAddMETAcharsetToFD(fp0, -1); + fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n", + VISITED_LINKS_TITLE); + fprintf(fp0, "<h1>You have reached the Visited Links Page</h1>\n"); + fprintf(fp0, "<h2>%s Version %s</h2>\n<pre>", LYNX_NAME, LYNX_VERSION); + fprintf(fp0, "<em>You visited (POSTs, bookmark, menu and list files excluded):</em>\n"); x = HTList_count(Visited_Links); while (NULL != (vl = (VisitedLink *)HTList_nextObject(cur))) { @@ -565,10 +637,10 @@ PUBLIC int LYShowVisitedLinks ARGS1( fprintf(fp0, "<tab to=t%d>%s\n", x, ((Address != NULL) ? Address : "(no address)")); } - fprintf(fp0,"</pre>\n"); - EndInternalPage(fp0); - LYCloseTempFP(fp0); + fprintf(fp0,"</pre>\n</body>\n"); + + fclose(fp0); FREE(Title); FREE(Address); return(0); diff --git a/src/LYHistory.h b/src/LYHistory.h index 7593a2ca..3e5bf72b 100644 --- a/src/LYHistory.h +++ b/src/LYHistory.h @@ -1,3 +1,4 @@ + #ifndef LYHISTORY_H #define LYHISTORY_H @@ -5,13 +6,15 @@ #include <LYStructs.h> #endif /* LYSTRUCTS_H */ -extern BOOLEAN LYwouldPush PARAMS((char *title)); -extern BOOLEAN historytarget PARAMS((document *newdoc)); -extern int LYShowVisitedLinks PARAMS((char **newfile)); -extern int showhistory PARAMS((char **newfile)); extern void LYAddVisitedLink PARAMS((document *doc)); +extern void LYpush PARAMS((document *doc, BOOLEAN force_push)); extern void LYpop PARAMS((document *doc)); extern void LYpop_num PARAMS((int number, document *doc)); -extern void LYpush PARAMS((document *doc, BOOLEAN force_push)); +extern int showhistory PARAMS((char **newfile)); +extern BOOLEAN historytarget PARAMS((document *newdoc)); +extern int LYShowVisitedLinks PARAMS((char **newfile)); + +#define HISTORY_PAGE_TITLE "Lynx History Page" +#define VISITED_LINKS_TITLE "Lynx Visited Links Page" #endif /* LYHISTORY_H */ diff --git a/src/LYJump.c b/src/LYJump.c index 9e4f1884..3f7910eb 100644 --- a/src/LYJump.c +++ b/src/LYJump.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTAlert.h> #include <LYUtils.h> #include <LYStrings.h> @@ -14,6 +15,8 @@ #include <fab.h> #endif /* VMS */ +#define FREE(x) if (x) {free(x); x = NULL;} + struct JumpTable *JThead = NULL; PRIVATE int LYCompare PARAMS ((CONST void *e1, CONST void *e2)); @@ -225,7 +228,8 @@ PUBLIC char *LYJump ARGS1(int, key) /* * User cancelled the Jump via ^G. - FM */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return NULL; } @@ -233,7 +237,8 @@ check_recall: bp = buf; if (toupper(key) == 'G' && strncmp(buf, "o ", 2) == 0) bp++; - bp = LYSkipBlanks(bp); + while (isspace(*bp)) + bp++; if (*bp == '\0' && !(recall && (ch == UPARROW || ch == DNARROW))) { /* @@ -241,7 +246,8 @@ check_recall: */ *buf = '\0'; StrAllocCopy(jtp->shortcut, buf); - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return NULL; } #ifdef PERMIT_GOTO_FROM_JUMP @@ -252,7 +258,8 @@ check_recall: if (no_goto) { *buf = '\0'; StrAllocCopy(jtp->shortcut, buf); - HTUserMsg(RANDOM_URL_DISALLOWED); + _statusline(RANDOM_URL_DISALLOWED); + sleep(MessageSecs); return NULL; } StrAllocCopy(temp, "Go "); @@ -298,7 +305,8 @@ check_recall: /* * User cancelled the jump via ^G. */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return NULL; } goto check_recall; @@ -338,7 +346,8 @@ check_recall: /* * User cancelled the jump via ^G. */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return NULL; } goto check_recall; @@ -394,11 +403,10 @@ PRIVATE unsigned LYRead_Jumpfile ARGS1(struct JumpTable *,jtp) return 0; } } else - if ((fd=open(jtp->file, O_RDONLY, "mbc=32")) < 0) + if ((fd=open(jtp->file, O_RDONLY, "mbc=32")) < 0) { #else - if ((fd=open(jtp->file, O_RDONLY)) < 0) + if ((fd=open(jtp->file, O_RDONLY)) < 0) { #endif /* VMS */ - { HTAlert(CANNOT_OPEN_JUMP_FILE); FREE(mp); return 0; diff --git a/src/LYJump.h b/src/LYJump.h index 3a82b075..5da8f885 100644 --- a/src/LYJump.h +++ b/src/LYJump.h @@ -1,8 +1,7 @@ + #ifndef LYJUMP_H #define LYJUMP_H -#include <HTList.h> - typedef struct _JumpDatum { char *key; char *url; diff --git a/src/LYKeymap.c b/src/LYKeymap.c index 17674b03..1ae0e763 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <LYUtils.h> #include <LYKeymap.h> #include <LYGlobalDefs.h> @@ -10,7 +11,7 @@ PRIVATE CONST DocAddress keymap_anchor = {"LYNXKEYMAP", NULL, NULL}; -struct _HTStream +struct _HTStream { HTStreamClass * isa; }; @@ -18,7 +19,7 @@ struct _HTStream /* the character gets 1 added to it before lookup, * so that EOF maps to 0 */ -unsigned short keymap[] = { +char keymap[] = { 0, /* EOF */ @@ -38,6 +39,10 @@ LYK_REFRESH, LYK_ACTIVATE, LYK_DOWN_TWO, 0, LYK_UP_TWO, 0, LYK_RELOAD, 0, /* ^P */ /* XON */ /* ^R */ /* XOFF */ +#ifdef NOT_USED +LYK_TRACE_TOGGLE, 0, LYK_VERSION, LYK_REFRESH, +/* ^T */ /* ^U */ /* ^V */ /* ^W */ +#endif /* NOT_USED */ LYK_TRACE_TOGGLE, 0, LYK_SWITCH_DTD, LYK_REFRESH, /* ^T */ /* ^U */ /* ^V */ /* ^W */ @@ -79,15 +84,15 @@ LYK_UP_LINK, LYK_INFO, LYK_DOWN_LINK, LYK_HELP, LYK_RAW_TOGGLE, LYK_ADD_BOOKMARK, LYK_PREV_PAGE, LYK_COMMENT, /* @ */ /* A */ /* B */ /* C */ -LYK_DOWNLOAD, LYK_ELGOTO, -/* D */ /* E */ +LYK_DOWNLOAD, LYK_ELGOTO, +/* D */ /* E */ #if defined(DIRED_SUPPORT) || defined(VMS) LYK_DIRED_MENU, #else -0, +0, #endif /* DIRED_SUPPORT || VMS */ -/* F */ +/* F */ LYK_ECGOTO, /* G */ @@ -101,9 +106,20 @@ LYK_LIST, LYK_MAIN_MENU, LYK_NEXT, LYK_OPTIONS, LYK_PRINT, LYK_ABORT, LYK_DEL_BOOKMARK, LYK_INDEX_SEARCH, /* P */ /* Q */ /* R */ /* S */ -LYK_TAG_LINK, LYK_PREV_DOC, LYK_VLINKS, 0, -/* T */ /* U */ /* V */ /* W */ +#ifdef DIRED_SUPPORT +LYK_TAG_LINK, +#else +0, +#endif /* DIRED_SUPPORT */ +/* T */ + + LYK_PREV_DOC, LYK_VLINKS, 0, + /* U */ /* V */ /* W */ +#ifdef NOT_USED +LYK_FORM_UP, 0, LYK_FORM_DOWN, LYK_INLINE_TOGGLE, +/* X */ /* Y */ /* Z */ /* [ */ +#endif /* NOT_USED */ LYK_NOCACHE, 0, LYK_INTERRUPT, LYK_INLINE_TOGGLE, /* X */ /* Y */ /* Z */ /* [ */ @@ -113,15 +129,15 @@ LYK_SOURCE, LYK_HEAD, 0, LYK_CLEAR_AUTH, LYK_MINIMAL, LYK_ADD_BOOKMARK, LYK_PREV_PAGE, LYK_COMMENT, /* ` */ /* a */ /* b */ /* c */ -LYK_DOWNLOAD, LYK_EDIT, -/* d */ /* e */ +LYK_DOWNLOAD, LYK_EDIT, +/* d */ /* e */ #if defined(DIRED_SUPPORT) || defined(VMS) LYK_DIRED_MENU, #else -0, +0, #endif /* DIRED_SUPPORT || VMS */ -/* f */ +/* f */ LYK_GOTO, /* g */ @@ -135,9 +151,20 @@ LYK_LIST, LYK_MAIN_MENU, LYK_NEXT, LYK_OPTIONS, LYK_PRINT, LYK_QUIT, LYK_DEL_BOOKMARK, LYK_INDEX_SEARCH, /* p */ /* q */ /* r */ /* s */ -LYK_TAG_LINK, LYK_PREV_DOC, LYK_VIEW_BOOKMARK, 0, -/* t */ /* u */ /* v */ /* w */ +#ifdef DIRED_SUPPORT +LYK_TAG_LINK, +#else +0, +#endif /* DIRED_SUPPORT */ +/* t */ + + LYK_PREV_DOC, LYK_VIEW_BOOKMARK, 0, + /* u */ /* v */ /* w */ +#ifdef NOT_USED +LYK_FORM_UP, 0, LYK_FORM_DOWN, 0, +/* x */ /* y */ /* z */ /* { */ +#endif /* NOT_USED */ LYK_NOCACHE, 0, LYK_INTERRUPT, 0, /* x */ /* y */ /* z */ /* { */ @@ -187,22 +214,6 @@ LYK_PREV_LINK, LYK_NEXT_LINK, LYK_ACTIVATE, LYK_PREV_DOC, LYK_NEXT_PAGE, LYK_PREV_PAGE, LYK_HOME, LYK_END, /* PGDOWN */ /* PGUP */ /* HOME */ /* END */ -#if defined(__DJGPP__) || defined(_WINDOWS) -#ifdef USE_SLANG -LYK_END, LYK_HOME, LYK_PREV_PAGE, 0, -/* END */ /* HOME */ /* PGUP */ /* B2 Key */ - -LYK_END, LYK_NEXT_PAGE, 0, -/* END */ /* PGDOWN */ - -#else - 0, LYK_HELP, 0, 0, -/* F0 */ /* F1 */ /* F2 */ /* F3 */ - - 0, 0, 0, - -#endif /* USE_SLANG */ -#else LYK_HELP, LYK_ACTIVATE, LYK_HOME, LYK_END, /* F1*/ /* Do key */ /* Find key */ /* Select key */ @@ -211,135 +222,6 @@ LYK_UP_TWO, LYK_DOWN_TWO, LYK_DO_NOTHING, /* DO_NOTHING*/ -#endif /* __DJGPP__ || _WINDOWS */ -/* 10F..18F */ - - 0, -#if defined(USE_SLANG) && !defined(DJGPP_KEYHANDLER) - LYK_HISTORY, LYK_ACTIVATE, 0, 0, - /* Backspace */ /* Enter */ -#else - 0, 0, 0, 0, -#endif /* USE_SLANG */ - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, -#ifdef DJGPP_KEYHANDLER - 0, LYK_ABORT, 0, 0, - /* ALT_X */ - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, LYK_HELP, - /* F1 */ -#else - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, -#endif /* DJGPP_KEYHANDLER */ - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, -/* 190..20F */ - - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - LYK_ABORT, 0, 0, 0, - /* ALT_X */ - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, LYK_ACTIVATE, - /* KP_ENTER */ - 0, 0, 0, LYK_IMAGE_TOGGLE, - /* KP_* */ - LYK_PREV_PAGE, LYK_NEXT_PAGE, 0, 0, - /* KP_- */ /* KP_+ */ - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, -#if defined(USE_SLANG) && !defined(DJGPP_KEYHANDLER) - 0, LYK_HELP, 0, 0, - /* F1 */ -#else - 0, 0, 0, 0, -#endif /* USE_SLANG */ - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, -/* 210..28F */ - - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - /* 290...293 */ - 0, 0, 0, 0, }; #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) @@ -349,7 +231,7 @@ LYK_DO_NOTHING, * allowed at compile time. */ -unsigned short key_override[TABLESIZE(keymap)] = { +char override[] = { 0, /* EOF */ @@ -505,8 +387,8 @@ LYK_DO_NOTHING, #endif /* DIRED_SUPPORT && OK_OVERRIDE */ struct rmap { - CONST char *name; - CONST char *doc; + char *name; + char *doc; }; PRIVATE struct rmap revmap[] = { { "UNMAPPED", NULL }, @@ -599,10 +481,15 @@ PRIVATE struct rmap revmap[] = { { "INSTALL", "install file or tagged files into a system area" }, #endif /* DIRED_SUPPORT */ #endif /* VMS */ +#ifdef NOT_USED +{ "VERSION", "report version of lynx"}, +{ "FORM_UP", "toggle a checkbox" }, +{ "FORM_DOWN", "toggle a checkbox" }, +#endif /* NOT_USED */ { NULL, "" } }; -PRIVATE CONST char *funckey[] = { +PRIVATE char *funckey[] = { "Up Arrow", "Down Arrow", "Right Arrow", @@ -639,44 +526,27 @@ PRIVATE char *pretty ARGS1 (int, c) sprintf(buf, "%c", c); else if (c < ' ') sprintf(buf, "^%c", c|0100); - else if (c >= 0400 && (c - 0400) < (int) TABLESIZE(funckey)) - sprintf(buf, "%s", funckey[c-0400]); else - return 0; - + sprintf(buf, "%s", funckey[c-0400]); + return buf; } -PRIVATE BOOL format_binding ARGS3( - char *, buf, - unsigned short *, table, - int, i) -{ - unsigned the_key = table[i]; - char *formatted; - - if (the_key != 0 - && the_key < TABLESIZE(revmap) - && revmap[the_key].name != 0 - && revmap[the_key].doc != 0 - && (formatted = pretty(i-1)) != 0) { - sprintf(buf, "%-12s%-14s%s\n", formatted, - revmap[the_key].name, - revmap[the_key].doc); - return TRUE; - } - return FALSE; -} - PRIVATE void print_binding ARGS3(HTStream *, target, char *, buf, int, i) { #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) if (prev_lynx_edit_mode && !no_dired_support && - format_binding(buf, key_override, i)) { + override[i] && revmap[(unsigned char)override[i]].doc) { + sprintf(buf, "%-12s%-14s%s\n", pretty(i-1), + revmap[(unsigned char)override[i]].name, + revmap[(unsigned char)override[i]].doc); (*target->isa->put_block)(target, buf, strlen(buf)); } else #endif /* DIRED_SUPPORT && OK_OVERRIDE */ - if (format_binding(buf, keymap, i)) { + if (keymap[i] && revmap[(unsigned char)keymap[i]].doc) { + sprintf(buf, "%-12s%-14s%s\n", pretty(i-1), + revmap[(unsigned char)keymap[i]].name, + revmap[(unsigned char)keymap[i]].doc); (*target->isa->put_block)(target, buf, strlen(buf)); } } @@ -707,11 +577,9 @@ PRIVATE int LYLoadKeymap ARGS4 ( sprintf(buf, "<head>\n<title>%s</title>\n</head>\n<body>\n", CURRENT_KEYMAP_TITLE); (*target->isa->put_block)(target, buf, strlen(buf)); - sprintf(buf, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", - LYNX_NAME, LYNX_VERSION, - helpfilepath, CURRENT_KEYMAP_HELP, CURRENT_KEYMAP_TITLE); - (*target->isa->put_block)(target, buf, strlen(buf)); - sprintf(buf, "<pre>\n"); + + sprintf(buf, "<h1>%s (%s Version %s)</h1>\n<pre>", + CURRENT_KEYMAP_TITLE, LYNX_NAME, LYNX_VERSION); (*target->isa->put_block)(target, buf, strlen(buf)); for (i = 'a'+1; i <= 'z'+1; i++) { @@ -721,12 +589,12 @@ PRIVATE int LYLoadKeymap ARGS4 ( i-' '); /* uppercase mapping is different */ } } - for (i = 1; i < (int) TABLESIZE(keymap); i++) { + for (i = 1; i < (int) sizeof(keymap); i++) { /* * LYK_PIPE not implemented yet. */ - if ((i > (int) TABLESIZE(keymap) || i <= ' ' || !isalpha(i-1)) && - strcmp(revmap[keymap[i]].name, "PIPE")) { + if ((i > 127 || i <= ' ' || !isalpha(i-1)) && + strcmp(revmap[(unsigned char)keymap[i]].name, "PIPE")) { print_binding(target, buf, i); } } @@ -778,8 +646,8 @@ PUBLIC int remap ARGS2(char *,key, char *,func) PUBLIC void set_vms_keys NOARGS { keymap[26+1] = LYK_ABORT; /* control-Z */ - keymap['$'+1] = LYK_SHELL; -} + keymap['$'+1] = LYK_SHELL; +} static char saved_vi_keys[4]; static BOOLEAN did_vi_keys; @@ -895,40 +763,27 @@ PUBLIC void reset_numbers_as_arrows NOARGS did_number_keys = FALSE; } -PUBLIC int lookup_keymap ARGS1( - int, func) -{ - size_t i; - - for (i = 1; i < TABLESIZE(keymap); i++) { - if (LYisNonAlnumKeyname(i, func)) { - return i; - } - } - return -1; -} - PUBLIC char *key_for_func ARGS1 ( int, func) { - static char buf[512]; - int i; - char *formatted; - - buf[0] = '\0'; - if ((i = LYReverseKeymap(func)) >= 0) { - if (*buf) - strcat(buf, " or "); - formatted = pretty(i); - strcat(buf, formatted != 0 ? formatted : "?"); - } - return buf; + static char buf[512]; + size_t i; + + buf[0] = '\0'; + for (i = 1; i < sizeof(keymap); i++) { + if (keymap[i] == func) { + if (*buf) + strcat(buf, " or "); + strcat(buf, pretty(i-1)); + } + } + return buf; } /* * This function returns TRUE if the ch is non-alphanumeric * and maps to key_name (LYK_foo in the keymap[] array). - FM - */ + */ PUBLIC BOOL LYisNonAlnumKeyname ARGS2( int, ch, int, key_name) @@ -941,6 +796,7 @@ PUBLIC BOOL LYisNonAlnumKeyname ARGS2( return(keymap[ch+1] == key_name); } +#ifdef NOTUSED_FOTEMODS /* * This function returns the (int)ch mapped to the * LYK_foo value passed to it as an argument. - FM @@ -950,11 +806,12 @@ PUBLIC int LYReverseKeymap ARGS1( { int i; - for (i = 1; i < (int) TABLESIZE(keymap); i++) { + for (i = 1; i < sizeof(keymap); i++) { if (keymap[i] == key_name) { return(i - 1); } } - return(-1); + return(0); } +#endif diff --git a/src/LYKeymap.h b/src/LYKeymap.h index e8ccad06..77feb48f 100644 --- a/src/LYKeymap.h +++ b/src/LYKeymap.h @@ -1,28 +1,27 @@ #ifndef LYKEYMAP_H #define LYKEYMAP_H -#include <HTUtils.h> - -extern BOOLEAN LYisNonAlnumKeyname PARAMS((int ch, int key_name)); -extern char *key_for_func PARAMS((int func)); -extern int LYReverseKeymap PARAMS((int key_name)); -extern int lookup_keymap PARAMS((int code)); extern int remap PARAMS((char *key, char *func)); -extern void print_keymap PARAMS((char **newfile)); -extern void reset_emacs_keys NOPARAMS; -extern void reset_numbers_as_arrows NOPARAMS; +extern void set_vms_keys NOPARAMS; +extern void set_vi_keys NOPARAMS; extern void reset_vi_keys NOPARAMS; extern void set_emacs_keys NOPARAMS; +extern void reset_emacs_keys NOPARAMS; extern void set_numbers_as_arrows NOPARAMS; -extern void set_vi_keys NOPARAMS; -extern void set_vms_keys NOPARAMS; +extern void reset_numbers_as_arrows NOPARAMS; +extern void print_keymap PARAMS((char **newfile)); +extern char *key_for_func PARAMS((int func)); +extern BOOLEAN LYisNonAlnumKeyname PARAMS((int ch, int key_name)); +extern int LYReverseKeymap PARAMS((int key_name)); -extern unsigned short keymap[]; /* main keymap matrix */ +extern char keymap[]; /* main keymap matrix */ #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) -extern unsigned short key_override[]; +extern char override[]; #endif +#define CURRENT_KEYMAP_TITLE "Current Key Map" + #define LYK_1 1 #define LYK_2 2 #define LYK_3 3 @@ -117,14 +116,6 @@ extern unsigned short key_override[]; #define LYK_INSTALL (LYK_DIRED_MENU+6) #endif /* DIRED_SUPPORT */ -#ifndef LYK_DIRED_MENU -#define LYK_DIRED_MENU 0 -#endif - -#ifndef LYK_TAG_LINK -#define LYK_TAG_LINK 0 -#endif - #ifdef NOT_USED #define LYK_VERSION 81 #define LYK_FORM_UP 82 diff --git a/src/LYLeaks.c b/src/LYLeaks.c index 87afc0bb..29845d30 100644 --- a/src/LYLeaks.c +++ b/src/LYLeaks.c @@ -10,9 +10,14 @@ #define NO_MEMORY_TRACKING #include <HTUtils.h> +#include <tcp.h> #include <LYexit.h> #include <LYLeaks.h> #include <LYUtils.h> +#include <ctype.h> +/*#include <stdio.h> included by HTUtils.h -- FM */ + +#define FREE(x) if (x) {free(x); x = NULL;} PRIVATE AllocationList *ALp_RunTimeAllocations = NULL; @@ -155,8 +160,22 @@ PUBLIC void LYLeaks NOARGS fprintf(Fp_leakagesink, "\nTotal memory leakage this run:\t%u\n", (unsigned)st_total); fclose(Fp_leakagesink); - - HTSYS_purge(LEAKAGE_SINK); +#ifdef VMS + { + char VMSfilename[256]; + /* + * Purge lower versions of the file. + */ + sprintf(VMSfilename, "%s;-1", LEAKAGE_SINK); + while (remove(VMSfilename) == 0) + ; + /* + * Reset version number. + */ + sprintf(VMSfilename, "%s;1", LEAKAGE_SINK); + rename(LEAKAGE_SINK, VMSfilename); + } +#endif /* VMS */ } /* diff --git a/src/LYList.c b/src/LYList.c index 7f669db9..5622f4ba 100644 --- a/src/LYList.c +++ b/src/LYList.c @@ -6,7 +6,7 @@ */ #include <HTUtils.h> -#include <HTAlert.h> +#include <tcp.h> #include <LYUtils.h> #include <GridText.h> #include <LYList.h> @@ -22,6 +22,8 @@ #include <LYexit.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* showlist - F.Macrides (macrides@sci.wfeb.edu) ** -------- ** Create a temporary text/html file with a list of links to @@ -32,7 +34,7 @@ ** Clear: we only get addresses. */ -static char *list_filename = 0; +static char list_filename[256] = "\0"; /* * Returns the name of the file used for the List Page, if one has @@ -41,7 +43,7 @@ static char *list_filename = 0; */ PUBLIC char * LYlist_temp_url NOARGS { - return list_filename ? list_filename : ""; + return list_filename; } PUBLIC int showlist ARGS2( @@ -51,6 +53,7 @@ PUBLIC int showlist ARGS2( int cnt; int refs, hidden_links; static char tempfile[256]; + static BOOLEAN first = TRUE; FILE *fp0; char *Address = NULL, *Title = NULL, *cp = NULL; BOOLEAN intern_w_post = FALSE; @@ -60,32 +63,67 @@ PUBLIC int showlist ARGS2( hidden_links = HText_HiddenLinkCount(HTMainText); if (refs <= 0 && hidden_links > 0 && LYHiddenLinks != HIDDENLINKS_SEPARATE) { - HTUserMsg(NO_VISIBLE_REFS_FROM_DOC); + _statusline(NO_VISIBLE_REFS_FROM_DOC); + sleep(MessageSecs); return(-1); } if (refs <= 0 && hidden_links <= 0) { - HTUserMsg(NO_REFS_FROM_DOC); + _statusline(NO_REFS_FROM_DOC); + sleep(MessageSecs); return(-1); } - LYRemoveTemp(tempfile); - if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) { - HTUserMsg(CANNOT_OPEN_TEMP); - return(-1); + if (first) { + tempname(tempfile, NEW_FILE); + /* + * Make the file a URL now. + */ +#if defined (VMS) || defined (DOSPATH) + sprintf(list_filename, "file://localhost/%s", tempfile); +#else + sprintf(list_filename, "file://localhost%s", tempfile); +#endif /* VMS */ + first = FALSE; +#ifdef VMS + } else { + remove(tempfile); /* Remove duplicates on VMS. */ +#endif /* VMS */ } - LYLocalFileToURL(&list_filename, tempfile); + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { + _statusline(CANNOT_OPEN_TEMP); + sleep(MessageSecs); + return(-1); + } StrAllocCopy(newdoc->address, list_filename); LYforce_HTML_mode = TRUE; /* force this file to be HTML */ LYforce_no_cache = TRUE; /* force this file to be new */ - BeginInternalPage(fp0, LIST_PAGE_TITLE, LIST_PAGE_HELP); + fprintf(fp0, "<head>\n"); + LYAddMETAcharsetToFD(fp0, -1); + if (strchr(HTLoadedDocumentURL(), '"') == NULL) { + /* + * Insert a BASE tag so there is some way to relate the List Page + * file to its underlying document after we are done. It won't + * be actually used for resolving relative URLs. - kw + */ + StrAllocCopy(Address, HTLoadedDocumentURL()); + LYEntify(&Address, FALSE); + fprintf(fp0, "<base href=\"%s\">\n", Address); + FREE(Address); + } + fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n", + LIST_PAGE_TITLE); + fprintf(fp0, "<h1>You have reached the List Page</h1>\n"); + fprintf(fp0, "<h2>%s Version %s</h2>\n", LYNX_NAME, LYNX_VERSION); StrAllocCopy(Address, HTLoadedDocumentURL()); LYEntify(&Address, FALSE); - fprintf(fp0, "References in %s<p>\n", - ((Address != NULL && *Address != '\0') ? Address : "this document:")); + fprintf(fp0, + " References in %s<p>\n", + ((Address != NULL && *Address != '\0') ? + Address : "this document:")); FREE(Address); if (refs > 0) { fprintf(fp0, "<%s compact>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ? @@ -141,8 +179,8 @@ PUBLIC int showlist ARGS2( /* * Set flag to note that we had at least one internal link, * if the document from which we are generating the list - * has associated POST data; after an extra check that the - * link destination really has the same POST data so that + * has assosiated POST data; after an extra check that the + * link destination really has hthe same POST data so that * we can believe it is an internal link. */ intern_w_post = TRUE; @@ -196,16 +234,14 @@ PUBLIC int showlist ARGS2( FREE(Address); } - fprintf(fp0,"\n</%s>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ? - "ol" : "ul")); - EndInternalPage(fp0); - LYCloseTempFP(fp0); + fprintf(fp0,"\n</%s>\n</body>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ? + "ol" : "ul")); /* * Make necessary changes to newdoc before returning to caller. * If the intern_w_post flag is set, we keep the POST data in * newdoc that have been passed in. They should be the same as - * in the loaded document for which we generated the list. + * in the loaded locument for which we generated the list. * In that case the file we have written will be associated with * the same POST data when it is loaded after we are done here, * so that following one of the links we have marked as "internal @@ -221,6 +257,7 @@ PUBLIC int showlist ARGS2( } newdoc->isHEAD = FALSE; newdoc->safe = FALSE; + fclose(fp0); return(0); } @@ -267,7 +304,7 @@ PUBLIC void printlist ARGS2( if (child == 0) { /* * child should not be 0 unless form field numbering is on - * and cnt is the number of a form input field. + * and cnt is the number of a form intput field. * HText_FormDescNumber() will set desc to a description * of what type of input field this is. We'll create a * within-document link to ensure that the link numbers on diff --git a/src/LYList.h b/src/LYList.h index 4288107b..4a717284 100644 --- a/src/LYList.h +++ b/src/LYList.h @@ -1,10 +1,11 @@ + #ifndef LYLIST_H #define LYLIST_H -#include <LYStructs.h> - extern char * LYlist_temp_url NOPARAMS; extern int showlist PARAMS((document *newdoc, BOOLEAN titles)); extern void printlist PARAMS((FILE *fp, BOOLEAN titles)); +#define LIST_PAGE_TITLE "Lynx List Page" + #endif /* LYLIST_H */ diff --git a/src/LYLocal.c b/src/LYLocal.c index 5750d7ae..320ca0cd 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -29,7 +29,7 @@ */ #include <HTUtils.h> -#include <HTFile.h> +#include <tcp.h> #include <HTAlert.h> #include <HTParse.h> #include <LYCurses.h> @@ -42,12 +42,14 @@ #include <LYHistory.h> #include <LYUpload.h> #include <LYLocal.h> +#include <LYSystem.h> #ifndef VMS #ifndef _WINDOWS #ifdef HAVE_SYS_WAIT_H #include <sys/wait.h> #endif +#include <errno.h> #include <grp.h> #endif /*_WINDOWS */ #endif /* VMS */ @@ -70,14 +72,17 @@ #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + + PRIVATE int LYExecv PARAMS(( char * path, char ** argv, char * msg)); #ifdef DIRED_SUPPORT -PUBLIC char LYPermitFileURL[LY_MAXPATH] = "\0"; -PUBLIC char LYDiredFileURL[LY_MAXPATH] = "\0"; +PUBLIC char LYPermitFileURL[256] = "\0"; +PUBLIC char LYDiredFileURL[256] = "\0"; PRIVATE char *filename PARAMS(( char * prompt, @@ -92,7 +97,7 @@ PRIVATE BOOLEAN permit_location PARAMS(( #endif /* OK_PERMIT */ PRIVATE char *render_item PARAMS(( - CONST char * s, + char * s, char * path, char * dir, char * buf, @@ -236,61 +241,6 @@ struct dired_menu { NULL, NULL, NULL } }; -PRIVATE BOOLEAN ok_stat ARGS2(char *, name, struct stat*, sb) -{ - char tmpbuf[LY_MAXPATH+80]; - - CTRACE(tfp, "testing ok_stat(%s)\n", name); - if (stat(name, sb) < 0) { - sprintf(tmpbuf, "Unable to get status of '%s'.", name); - HTAlert(tmpbuf); - return FALSE; - } - return TRUE; -} - -#ifdef HAVE_LSTAT -PRIVATE BOOLEAN ok_lstat ARGS2(char *, name, struct stat*, sb) -{ - char tmpbuf[LY_MAXPATH+80]; - - CTRACE(tfp, "testing ok_lstat(%s)\n", name); - if (lstat(name, sb) < 0) { - sprintf(tmpbuf, "Unable to get status of '%s'.", name); - HTAlert(tmpbuf); - return FALSE; - } - return TRUE; -} -#else -#define ok_lstat(name,sb) ok_stat(name,sb) -#endif - -PRIVATE BOOLEAN ok_file_or_dir ARGS1(struct stat*, sb) -{ - if (!S_ISDIR(sb->st_mode) - && !S_ISREG(sb->st_mode)) { - HTAlert("The selected item is not a file or a directory! Request ignored."); - return FALSE; - } - return TRUE; -} - -PRIVATE BOOLEAN ok_localname ARGS2(char*, dst, char*, src) -{ - char *s = HTfullURL_toFile(strip_trailing_slash(src)); - struct stat dir_info; - - if (!ok_stat(s, &dir_info) - || !ok_file_or_dir(&dir_info)) { - free(s); - return FALSE; - } - strcpy(dst, s); - free(s); - return TRUE; -} - /* * Remove all tagged files and directories. */ @@ -301,7 +251,7 @@ PRIVATE BOOLEAN remove_tagged NOARGS char tmpbuf[1024]; char *testpath = NULL; struct stat dir_info; - int count; + int count, i; HTList *tag; char *args[5]; @@ -315,17 +265,27 @@ PRIVATE BOOLEAN remove_tagged NOARGS count = 0; tag = tagged; while (ans == 'Y' && (cp = (char *)HTList_nextObject(tag)) != NULL) { - if (is_url(cp) == FILE_URL_TYPE) { /* unnecessary check */ - tp = HTfullURL_toFile(cp); + if (is_url(cp) == FILE_URL_TYPE) { /* unecessary check */ + tp = cp; + if (!strncmp(tp, "file://localhost", 16)) { + tp += 16; + } else if (!strncmp(tp, "file:", 5)) { + tp += 5; + } StrAllocCopy(testpath, tp); - free(tp); - - LYTrimPathSep(testpath); + HTUnEscape(testpath); + if ((i = strlen(testpath)) && testpath[i-1] == '/') + testpath[(i - 1)] = '\0'; /* * Check the current status of the path to be deleted. */ - if (!ok_stat(testpath, &dir_info)) { + if (stat(testpath,&dir_info) == -1) { + sprintf(tmpbuf, + "System error - failed to get status of '%s'.", + testpath); + _statusline(tmpbuf); + sleep(AlertSecs); return count; } else { args[0] = "rm"; @@ -400,20 +360,25 @@ PRIVATE BOOLEAN modify_tagged ARGS1( if (!cp) /* Last resort, should never happen. */ cp = "/"; } - + if (!strncmp(cp, "file://localhost", 16)) { + cp += 16; + } else if (!strncmp(cp, "file:", 5)) { + cp += 5; + } if (testpath == NULL) { /* * Get the directory containing the file or subdir. */ - cp = HTfullURL_toFile(strip_trailing_slash(cp)); + cp = strip_trailing_slash(cp); savepath = HTParse(".", cp, PARSE_PATH+PARSE_PUNCTUATION); } else { - cp = HTfullURL_toFile(cp); StrAllocCopy(savepath, cp); } - free(cp); - - if (!ok_stat(savepath, &dir_info)) { + HTUnEscape(savepath); + if (stat(savepath, &dir_info) == -1) { + sprintf(tmpbuf, "Unable to get status of '%s'.", savepath); + _statusline(tmpbuf); + sleep(AlertSecs); FREE(savepath); return 0; } @@ -435,7 +400,8 @@ PRIVATE BOOLEAN modify_tagged ARGS1( StrAllocCat(cp1, (tmpbuf + 1)); if (strlen(cp1) > (sizeof(tmpbuf) - 1)) { sprintf(tmpbuf, "%s", "Path too long"); - HTAlert(tmpbuf); + _statusline(tmpbuf); + sleep(AlertSecs); FREE(savepath); FREE(cp1); return 0; @@ -447,8 +413,9 @@ PRIVATE BOOLEAN modify_tagged ARGS1( /* * If path is relative, prefix it with current location. */ - if (!LYIsPathSep(tmpbuf[0])) { - LYAddPathSep(&savepath); + if (tmpbuf[0] != '/') { + if (savepath[(strlen(savepath) - 1)] != '/') + StrAllocCat(savepath,"/"); StrAllocCat(savepath,tmpbuf); } else { StrAllocCopy(savepath,tmpbuf); @@ -457,7 +424,10 @@ PRIVATE BOOLEAN modify_tagged ARGS1( /* * stat() the target location to determine type and ownership. */ - if (!ok_stat(savepath, &dir_info)) { + if (stat(savepath, &dir_info) == -1) { + sprintf(tmpbuf,"Unable to get status of '%s'.",savepath); + _statusline(tmpbuf); + sleep(AlertSecs); FREE(savepath); return 0; } @@ -466,7 +436,9 @@ PRIVATE BOOLEAN modify_tagged ARGS1( * Make sure the source and target locations are not the same place. */ if (dev == dir_info.st_dev && inode == dir_info.st_ino) { - HTAlert("Source and destination are the same location - request ignored!"); + _statusline( + "Source and destination are the same location - request ignored!"); + sleep(AlertSecs); FREE(savepath); return 0; } @@ -475,7 +447,7 @@ PRIVATE BOOLEAN 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. */ - if (S_ISDIR(dir_info.st_mode)) { + if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { if (dir_info.st_uid == owner) { count = 0; tag = tagged; @@ -484,9 +456,13 @@ PRIVATE BOOLEAN modify_tagged ARGS1( * Move all tagged items to the target location. */ while ((cp = (char *)HTList_nextObject(tag)) != NULL) { - cp = HTfullURL_toFile(cp); + if (!strncmp(cp, "file://localhost", 16)) { + cp += 16; + } else if (!strncmp(cp, "file:", 5)) { + cp += 5; + } StrAllocCopy(srcpath, cp); - free(cp); + HTUnEscape(srcpath); sprintf(tmpbuf, "move %s to %s", srcpath, savepath); args[0] = "mv"; @@ -505,13 +481,17 @@ PRIVATE BOOLEAN modify_tagged ARGS1( clear_tags(); return count; } else { - HTAlert("Destination has different owner! Request denied."); + _statusline( + "Destination has different owner! Request denied."); + sleep(AlertSecs); FREE(srcpath); FREE(savepath); return 0; } } else { - HTAlert("Destination is not a valid directory! Request denied."); + _statusline( + "Destination is not a valid directory! Request denied."); + sleep(AlertSecs); FREE(savepath); return 0; } @@ -537,16 +517,22 @@ PRIVATE BOOLEAN modify_name ARGS1( */ testpath = strip_trailing_slash(testpath); - if (ok_stat(testpath, &dir_info)) { + if (stat(testpath, &dir_info) == -1) { + sprintf(tmpbuf, "Unable to get status of '%s'.", testpath); + _statusline(tmpbuf); + sleep(AlertSecs); + } else { /* * Change the name of the file or directory. */ - if (S_ISDIR(dir_info.st_mode)) { + if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { cp = "Enter new name for directory: "; - } else if (S_ISREG(dir_info.st_mode)) { + } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { cp = "Enter new name for file: "; } else { - HTAlert("The selected item is not a file or a directory! Request ignored."); + _statusline( + "The selected item is not a file or a directory! Request ignored."); + sleep(AlertSecs); return 0; } if (filename(cp, tmpbuf, sizeof(tmpbuf)) == NULL) @@ -556,7 +542,8 @@ PRIVATE BOOLEAN modify_name ARGS1( * Do not allow the user to also change the location at this time. */ if (strchr(tmpbuf, '/') != NULL) { - HTAlert("Illegal character \"/\" found! Request ignored."); + _statusline("Illegal character \"/\" found! Request ignored."); + sleep(AlertSecs); } else if (strlen(tmpbuf) && (cp = strrchr(testpath, '/')) != NULL) { strcpy(savepath,testpath); @@ -571,7 +558,8 @@ PRIVATE BOOLEAN modify_name ARGS1( if (errno != ENOENT) { sprintf(tmpbuf, "Unable to determine status of '%s'.", newpath); - HTAlert(tmpbuf); + _statusline(tmpbuf); + sleep(AlertSecs); } else { sprintf(tmpbuf, "move %s to %s", savepath, newpath); args[0] = "mv"; @@ -582,12 +570,18 @@ PRIVATE BOOLEAN modify_name ARGS1( return (-1); return 1; } - } else if (S_ISDIR(dir_info.st_mode)) { - HTAlert("There is already a directory with that name! Request ignored."); - } else if (S_ISREG(dir_info.st_mode)) { - HTAlert("There is already a file with that name! Request ignored."); + } else if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { + _statusline( + "There is already a directory with that name! Request ignored."); + sleep(AlertSecs); + } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { + _statusline( + "There is already a file with that name! Request ignored."); + sleep(AlertSecs); } else { - HTAlert("The specified name is already in use! Request ignored."); + _statusline( + "The specified name is already in use! Request ignored."); + sleep(AlertSecs); } } } @@ -616,19 +610,24 @@ PRIVATE BOOLEAN modify_location ARGS1( */ testpath = strip_trailing_slash(testpath); - if (!ok_stat(testpath, &dir_info)) { + if (stat(testpath, &dir_info) == -1) { + sprintf(tmpbuf, "Unable to get status of '%s'.", testpath); + _statusline(tmpbuf); + sleep(AlertSecs); return 0; } /* * Change the location of the file or directory. */ - if (S_ISDIR(dir_info.st_mode)) { + if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { cp = "Enter new location for directory: "; - } else if (S_ISREG(dir_info.st_mode)) { + } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { cp = "Enter new location for file: "; } else { - HTAlert("The specified item is not a file or a directory - request ignored."); + _statusline( + "The specified item is not a file or a directory - request ignored."); + sleep(AlertSecs); return 0; } if (filename(cp, tmpbuf, sizeof(tmpbuf)) == NULL) @@ -640,18 +639,18 @@ PRIVATE BOOLEAN modify_location ARGS1( /* * Allow ~/ references to the home directory. */ - if (!strncmp(tmpbuf, "~/", 2) - || !strcmp(tmpbuf,"~")) { + if (!strncmp(tmpbuf,"~/",2)) { strcpy(newpath, Home_Dir()); strcat(newpath, (tmpbuf + 1)); strcpy(tmpbuf, newpath); } - if (!LYIsPathSep(tmpbuf[0])) { + if (tmpbuf[0] != '/') { if ((cp = strrchr(newpath,'/')) != NULL) { *++cp = '\0'; strcat(newpath,tmpbuf); } else { - HTAlert("Unexpected failure - unable to find trailing \"/\""); + _statusline("Unexpected failure - unable to find trailing \"/\""); + sleep(AlertSecs); return 0; } } else { @@ -665,11 +664,16 @@ PRIVATE BOOLEAN modify_location ARGS1( mode = dir_info.st_mode; inode = dir_info.st_ino; owner = dir_info.st_uid; - if (!ok_stat(newpath, &dir_info)) { + if (stat(newpath, &dir_info) == -1) { + sprintf(tmpbuf,"Unable to get status of '%s'.",newpath); + _statusline(tmpbuf); + sleep(AlertSecs); return 0; } - if (!S_ISDIR(dir_info.st_mode)) { - HTAlert("Destination is not a valid directory! Request denied."); + if ((dir_info.st_mode & S_IFMT) != S_IFDIR) { + _statusline( + "Destination is not a valid directory! Request denied."); + sleep(AlertSecs); return 0; } @@ -677,7 +681,9 @@ PRIVATE BOOLEAN modify_location ARGS1( * Make sure the source and target are not the same location. */ if (dev == dir_info.st_dev && inode == dir_info.st_ino) { - HTAlert("Source and destination are the same location! Request ignored!"); + _statusline( + "Source and destination are the same location! Request ignored!"); + sleep(AlertSecs); return 0; } if (dir_info.st_uid == owner) { @@ -690,7 +696,8 @@ PRIVATE BOOLEAN modify_location ARGS1( return (-1); return 1; } else { - HTAlert("Destination has different owner! Request denied."); + _statusline("Destination has different owner! Request denied."); + sleep(AlertSecs); return 0; } } @@ -710,10 +717,14 @@ PUBLIC BOOLEAN local_modify ARGS2( int count; if (!HTList_isEmpty(tagged)) { - cp = HTpartURL_toFile(doc->address); + cp = doc->address; + if (!strncmp(cp, "file://localhost", 16)) { + cp += 16; + } else if (!strncmp(cp, "file:", 5)) { + cp += 5; + } strcpy(testpath, cp); - free(cp); - + HTUnEscapeSome(testpath, "/"); count = modify_tagged(testpath); if (doc->link > (nlinks-count - 1)) @@ -742,9 +753,14 @@ PUBLIC BOOLEAN local_modify ARGS2( ans = TOUPPER(c); if (strchr("NLP", ans) != NULL) { - cp = HTfullURL_toFile(links[doc->link].lname); + cp = links[doc->link].lname; + if (!strncmp(cp, "file://localhost", 16)) { + cp += 16; + } else if(!strncmp(cp, "file:", 5)) { + cp += 5; + } strcpy(testpath, cp); - free(cp); + HTUnEscape(testpath); if (ans == 'N') { return(modify_name(testpath)); @@ -762,7 +778,8 @@ PUBLIC BOOLEAN local_modify ARGS2( /* * Code for changing ownership needed here. */ - HTAlert("This feature not yet implemented!"); + _statusline("This feature not yet implemented!"); + sleep(AlertSecs); } } return 0; @@ -790,10 +807,13 @@ PRIVATE BOOLEAN create_file ARGS1( } if (strstr(tmpbuf, "//") != NULL) { - HTAlert("Illegal redirection \"//\" found! Request ignored."); + _statusline("Illegal redirection \"//\" found! Request ignored."); + sleep(AlertSecs); } else if (strlen(tmpbuf) && strchr(bad_chars, tmpbuf[0]) == NULL) { strcpy(testpath,current_location); - LYAddPathSep0(testpath); + if (testpath[(strlen(testpath) - 1)] != '/') { + strcat(testpath,"/"); + } /* * Append the target filename to the current location. @@ -807,7 +827,8 @@ PRIVATE BOOLEAN create_file ARGS1( if (errno != ENOENT) { sprintf(tmpbuf, "Unable to determine status of '%s'.", testpath); - HTAlert(tmpbuf); + _statusline(tmpbuf); + sleep(AlertSecs); return 0; } sprintf(tmpbuf,"create %s",testpath); @@ -817,12 +838,18 @@ PRIVATE BOOLEAN create_file ARGS1( if (LYExecv(TOUCH_PATH, args, tmpbuf) <= 0) return (-1); return 1; - } else if (S_ISDIR(dir_info.st_mode)) { - HTAlert("There is already a directory with that name! Request ignored."); - } else if (S_ISREG(dir_info.st_mode)) { - HTAlert("There is already a file with that name! Request ignored."); + } else if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { + _statusline( + "There is already a directory with that name! Request ignored."); + sleep(AlertSecs); + } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { + _statusline( + "There is already a file with that name! Request ignored."); + sleep(AlertSecs); } else { - HTAlert("The specified name is already in use! Request ignored."); + _statusline( + "The specified name is already in use! Request ignored."); + sleep(AlertSecs); } } return 0; @@ -850,11 +877,13 @@ PRIVATE BOOLEAN create_directory ARGS1( } if (strstr(tmpbuf, "//") != NULL) { - HTAlert("Illegal redirection \"//\" found! Request ignored."); + _statusline("Illegal redirection \"//\" found! Request ignored."); + sleep(AlertSecs); } else if (strlen(tmpbuf) && strchr(bad_chars, tmpbuf[0]) == NULL) { strcpy(testpath,current_location); - LYAddPathSep0(testpath); - + if (testpath[(strlen(testpath) - 1)] != '/') { + strcat(testpath,"/"); + } strcat(testpath, tmpbuf); /* @@ -864,7 +893,8 @@ PRIVATE BOOLEAN create_directory ARGS1( if (errno != ENOENT) { sprintf(tmpbuf, "Unable to determine status of '%s'.", testpath); - HTAlert(tmpbuf); + _statusline(tmpbuf); + sleep(AlertSecs); return 0; } sprintf(tmpbuf,"make directory %s",testpath); @@ -874,12 +904,18 @@ PRIVATE BOOLEAN create_directory ARGS1( if (LYExecv(MKDIR_PATH, args, tmpbuf) <= 0) return (-1); return 1; - } else if (S_ISDIR(dir_info.st_mode)) { - HTAlert("There is already a directory with that name! Request ignored."); - } else if (S_ISREG(dir_info.st_mode)) { - HTAlert("There is already a file with that name! Request ignored."); + } else if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { + _statusline( + "There is already a directory with that name! Request ignored."); + sleep(AlertSecs); + } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { + _statusline( + "There is already a file with that name! Request ignored."); + sleep(AlertSecs); } else { - HTAlert("The specified name is already in use! Request ignored."); + _statusline( + "The specified name is already in use! Request ignored."); + sleep(AlertSecs); } } return 0; @@ -899,9 +935,14 @@ PUBLIC BOOLEAN local_create ARGS1( c = LYgetch(); ans = TOUPPER(c); - cp = HTfullURL_toFile(doc->address); + cp = doc->address; + if (!strncmp(cp, "file://localhost", 16)) { + cp += 16; + } else if (!strncmp(cp, "file:", 5)) { + cp += 5; + } strcpy(testpath,cp); - free(cp); + HTUnEscape(testpath); if (ans == 'F') { return(create_file(testpath)); @@ -924,7 +965,15 @@ PRIVATE BOOLEAN remove_single ARGS1( struct stat dir_info; char *args[5]; - if (!ok_lstat(testpath, &dir_info)) { + /* + * lstat() first in case its a symbolic link. + */ + if (lstat(testpath, &dir_info) == -1 && + stat(testpath, &dir_info) == -1) { + sprintf(tmpbuf, + "System error - failed to get status of '%s'.", testpath); + _statusline(tmpbuf); + sleep(AlertSecs); return 0; } @@ -936,7 +985,7 @@ PRIVATE BOOLEAN remove_single ARGS1( } else { cp = testpath; } - if (S_ISDIR(dir_info.st_mode)) { + if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { if (strlen(cp) < 37) { sprintf(tmpbuf, "Remove '%s' and all of its contents (y or n): ", cp); @@ -944,14 +993,14 @@ PRIVATE BOOLEAN remove_single ARGS1( sprintf(tmpbuf, "Remove directory and all of its contents (y or n): "); } - } else if (S_ISREG(dir_info.st_mode)) { + } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { if (strlen(cp) < 60) { sprintf(tmpbuf, "Remove file '%s' (y or n): ", cp); } else { sprintf(tmpbuf, "Remove file (y or n): "); } #ifdef S_IFLNK - } else if (S_ISLNK(dir_info.st_mode)) { + } else if ((dir_info.st_mode & S_IFMT) == S_IFLNK) { if (strlen(cp) < 50) { sprintf(tmpbuf, "Remove symbolic link '%s' (y or n): ", cp); } else { @@ -960,7 +1009,8 @@ PRIVATE BOOLEAN remove_single ARGS1( #endif } else { sprintf(tmpbuf, "Unable to determine status of '%s'.", testpath); - HTAlert(tmpbuf); + _statusline(tmpbuf); + sleep(AlertSecs); return 0; } _statusline(tmpbuf); @@ -1001,13 +1051,16 @@ PUBLIC BOOLEAN local_remove ARGS1( } cp = links[doc->link].lname; if (is_url(cp) == FILE_URL_TYPE) { - tp = HTfullURL_toFile(cp); + tp = cp; + if (!strncmp(tp, "file://localhost", 16)) { + tp += 16; + } else if (!strncmp(tp, "file:", 5)) { + tp += 5; + } strcpy(testpath, tp); - free(tp); - + HTUnEscape(testpath); if ((i = strlen(testpath)) && testpath[i - 1] == '/') testpath[(i - 1)] = '\0'; - if (remove_single(testpath)) { if (doc->link == (nlinks - 1)) --doc->link; @@ -1023,8 +1076,8 @@ PUBLIC BOOLEAN local_remove ARGS1( * Makes the code a bit cleaner. */ static struct { - CONST char *string_mode; /* Key for value below */ - long permit_bits; /* Value for chmod/whatever */ + char *string_mode; /* Key for value below */ + long permit_bits; /* Value for chmod/whatever */ } permissions[] = { {"IRUSR", S_IRUSR}, {"IWUSR", S_IWUSR}, @@ -1039,7 +1092,11 @@ static struct { use shell access for that. */ }; -PRIVATE char LYValidPermitFile[LY_MAXPATH] = "\0"; +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode&0xF000) == 0x4000) +#endif /* !S_ISDIR */ + +PRIVATE char LYValidPermitFile[256] = "\0"; /* * Handle DIRED permissions. @@ -1050,13 +1107,14 @@ PRIVATE BOOLEAN permit_location ARGS3( char **, newpath) { #ifndef UNIX - HTAlert("Sorry, don't know how to permit non-UNIX files yet."); + _statusline("Sorry, don't know how to permit non-UNIX files yet."); + sleep(AlertSecs); return(0); #else - static char tempfile[LY_MAXPATH] = "\0"; + static char tempfile[256] = "\0"; + static BOOLEAN first = TRUE; char *cp; char tmpbuf[LINESIZE]; - char tmpdst[LY_MAXPATH]; struct stat dir_info; if (srcpath) { @@ -1064,35 +1122,62 @@ PRIVATE BOOLEAN permit_location ARGS3( * Create form. */ FILE *fp0; - char local_src[LY_MAXPATH]; char * user_filename; struct group * grp; char * group_name; - cp = HTfullURL_toFile(strip_trailing_slash(srcpath)); - strcpy(local_src, cp); - free(cp); - /* * A couple of sanity tests. */ - if (!ok_lstat(local_src, &dir_info) - || !ok_file_or_dir(&dir_info)) + srcpath = strip_trailing_slash(srcpath); + if (strncmp(srcpath, "file://localhost", 16) == 0) + srcpath += 16; + if (lstat(srcpath, &dir_info) == -1) { + sprintf(tmpbuf, "Unable to get status of '%s'.", srcpath); + _statusline(tmpbuf); + sleep(AlertSecs); return 0; + } else if ((dir_info.st_mode & S_IFMT) != S_IFDIR && + (dir_info.st_mode & S_IFMT) != S_IFREG) { + _statusline( + "The specified item is not a file nor a directory - request ignored."); + sleep(AlertSecs); + return(0); + } - user_filename = LYPathLeaf(local_src); + user_filename = srcpath; + cp = strrchr(srcpath, '/'); + if (cp != NULL) { + user_filename = (cp + 1); + } - LYRemoveTemp(tempfile); - if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) { - HTAlert("Unable to open permit options file"); - return(0); + if (first) { + /* + * Get an unused tempfile name. - FM + */ + tempname(tempfile, NEW_FILE); } /* - * Make the tempfile a URL. + * Open the tempfile for writing and set its + * protection in case this wasn't done via an + * external umask. - FM */ - LYLocalFileToURL(newpath, tempfile); - strcpy(LYPermitFileURL, *newpath); + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { + _statusline("Unable to open permit options file"); + sleep(AlertSecs); + return(0); + } + + if (first) { + /* + * Make the tempfile a URL. + */ + strcpy(LYPermitFileURL, "file://localhost"); + strcat(LYPermitFileURL, tempfile); + first = FALSE; + } + StrAllocCopy(*newpath, LYPermitFileURL); grp = getgrgid(dir_info.st_gid); if (grp == NULL) { @@ -1102,7 +1187,7 @@ PRIVATE BOOLEAN permit_location ARGS3( } LYstrncpy(LYValidPermitFile, - local_src, + srcpath, (sizeof(LYValidPermitFile) - 1)); fprintf(fp0, "<Html><Head>\n<Title>%s</Title>\n</Head>\n<Body>\n", @@ -1169,10 +1254,10 @@ PRIVATE BOOLEAN permit_location ARGS3( fprintf(fp0, "<Br>\n<Li><Input Type=\"submit\" Value=\"Submit\"> \ form to permit %s %s.\n</Ol>\n</Form>\n", - S_ISDIR(dir_info.st_mode) ? "directory" : "file", + (dir_info.st_mode & S_IFMT) == S_IFDIR ? "directory" : "file", user_filename); fprintf(fp0, "</Body></Html>"); - LYCloseTempFP(fp0); + fclose(fp0); LYforce_no_cache = TRUE; return(PERMIT_FORM_RESULT); /* Special flag for LYMainLoop */ @@ -1192,7 +1277,8 @@ form to permit %s %s.\n</Ol>\n</Form>\n", HTAlert(INVALID_PERMIT_URL); else fprintf(stderr, "%s\n", INVALID_PERMIT_URL); - CTRACE(tfp, "permit_location: called for <%s>.\n", + if (TRACE) + fprintf(stderr, "permit_location: called for <%s>.\n", (destpath ? destpath : "NULL URL pointer")); return 0; @@ -1207,12 +1293,7 @@ form to permit %s %s.\n</Ol>\n</Form>\n", *cp++ = '\0'; /* Null terminate file name and start working on the masks. */ - if ((destpath = HTfullURL_toFile(destpath)) == 0) - return(0); - - strcpy(tmpdst, destpath); /* operate only on filename */ - free(destpath); - destpath = tmpdst; + HTUnEscape(destpath); /* Will now operate only on filename part. */ /* * Make sure that the file string is the one from @@ -1223,7 +1304,8 @@ form to permit %s %s.\n</Ol>\n</Form>\n", HTAlert(INVALID_PERMIT_URL); else fprintf(stderr, "%s\n", INVALID_PERMIT_URL); - CTRACE(tfp, "permit_location: called for file '%s'.\n", + if (TRACE) + fprintf(stderr, "permit_location: called for file '%s'.\n", destpath); return 0; } @@ -1232,8 +1314,16 @@ form to permit %s %s.\n</Ol>\n</Form>\n", * A couple of sanity tests. */ destpath = strip_trailing_slash(destpath); - if (!ok_stat(destpath, &dir_info) - || !ok_file_or_dir(&dir_info)) { + if (stat(destpath, &dir_info) == -1) { + sprintf(tmpbuf, "Unable to get status of '%s'.", destpath); + _statusline(tmpbuf); + sleep(AlertSecs); + return 0; + } else if ((dir_info.st_mode & S_IFMT) != S_IFDIR && + (dir_info.st_mode & S_IFMT) != S_IFREG) { + _statusline( + "The specified item is not a file nor a directory - request ignored."); + sleep(AlertSecs); return 0; } @@ -1266,11 +1356,13 @@ form to permit %s %s.\n</Ol>\n</Form>\n", } } if (permissions[i].string_mode == NULL) { - HTAlert("Invalid mode format."); + _statusline("Invalid mode format."); + sleep(AlertSecs); return 0; } } else { - HTAlert("Invalid syntax format."); + _statusline("Invalid syntax format."); + sleep(AlertSecs); return 0; } @@ -1369,7 +1461,8 @@ PUBLIC int local_dired ARGS1( char buffer[512]; line_url = doc->address; - CTRACE(tfp, "local_dired: called for <%s>.\n", + if (TRACE) + fprintf(stderr, "local_dired: called for <%s>.\n", (line_url ? line_url : "NULL URL pointer")); HTUnEscapeSome(line_url, "/"); /* don't mess too much with *doc */ @@ -1433,7 +1526,8 @@ PUBLIC int local_dired ARGS1( if (LYUpload(line_url)) LYforce_no_cache = TRUE; } else { - LYTrimPathSep(line); + if (line[(strlen(line) - 1)] == '/') + line[strlen(line)-1] = '\0'; if ((cp = strrchr(line, '/')) == NULL) { FREE(line); return 0; @@ -1453,7 +1547,9 @@ PUBLIC int local_dired ARGS1( } else if (!strncmp(line, "LYNXDIRED://UUDECODE", 20)) { tp = quote_pathname(line + 20); sprintf(buffer,"%s %s", UUDECODE_PATH, tp); - HTAlert("Warning! UUDecoded file will exist in the directory you started Lynx."); + _statusline( + "Warning! UUDecoded file will exist in the directory you started Lynx."); + sleep(AlertSecs); FREE(tp); #endif /* OK_UUDECODE && !ARCHIVE_ONLY */ @@ -1568,7 +1664,8 @@ PUBLIC int local_dired ARGS1( _statusline(tmpbuf); stop_curses(); printf("%s\n", tmpbuf); - LYSystem(buffer); + fflush(stdout); + system(buffer); #ifdef VMS extern BOOLEAN HadVMSInterrupt HadVMSInterrupt = FALSE; @@ -1590,61 +1687,114 @@ PUBLIC int dired_options ARGS2( document *, doc, char **, newfile) { - static char tempfile[LY_MAXPATH]; + static char tempfile[256]; + static BOOLEAN first = TRUE; char path[512], dir[512]; /* much too large */ + char tmpbuf[LINESIZE]; lynx_html_item_type *nxt; struct stat dir_info; FILE *fp0; char *cp = NULL; - char *dir_url; - char *path_url; + char *dir_url = NULL; /* Will hold URL-escaped path of + directory from where DIRED_MENU was + invoked (NOT its full URL). */ + char *path_url = NULL; /* Will hold URL-escaped path of file + (or directory) which was selected + when DIRED_MENU was invoked (NOT + its full URL). */ BOOLEAN nothing_tagged; int count; struct dired_menu *mp; char buf[2048]; - LYRemoveTemp(tempfile); - if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) { - HTAlert("Unable to open file management menu file."); - return(0); + + if (first) { + /* + * Get an unused tempfile name. - FM + */ + tempname(tempfile, NEW_FILE); } /* - * Make the tempfile a URL. + * Open the tempfile for writing and set its + * protection in case this wasn't done via an + * external umask. - FM */ - LYLocalFileToURL(newfile, tempfile); - strcpy(LYDiredFileURL, *newfile); + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { + _statusline("Unable to open file management menu file."); + sleep(AlertSecs); + return(0); + } - cp = HTpartURL_toFile(doc->address); + if (first) { + /* + * Make the tempfile a URL. + */ + strcpy(LYDiredFileURL, "file://localhost"); + strcat(LYDiredFileURL, tempfile); + first = FALSE; + } + StrAllocCopy(*newfile, LYDiredFileURL); + + cp = doc->address; + if (!strncmp(cp, "file://localhost", 16)) { + cp += 16; + } else if (!strncmp(cp, "file:", 5)) { + cp += 5; + } strcpy(dir, cp); - LYTrimPathSep(dir); + StrAllocCopy(dir_url, cp); + if (dir_url[(strlen(dir_url) - 1)] == '/') + dir_url[(strlen(dir_url) - 1)] = '\0'; + HTUnEscape(dir); + if (dir[(strlen(dir) - 1)] == '/') + dir[(strlen(dir) - 1)] = '\0'; if (doc->link > -1 && doc->link < (nlinks+1)) { - cp = HTfullURL_toFile(links[doc->link].lname); + cp = links[doc->link].lname; + if (!strncmp(cp, "file://localhost", 16)) { + cp += 16; + } else if (!strncmp(cp, "file:", 5)) { + cp += 5; + } strcpy(path, cp); - LYTrimPathSep(path); - free(cp); - - if (!ok_lstat(path, &dir_info)) { - LYCloseTempFP(fp0); + StrAllocCopy(path_url, cp); + if (*path_url && path_url[1] && path_url[(strlen(path_url) - 1)] == '/') + path_url[(strlen(path_url) - 1)] = '\0'; + HTUnEscape(path); + if (*path && path[1] && path[(strlen(path) - 1)] == '/') + path[(strlen(path) - 1)] = '\0'; + + if (lstat(path, &dir_info) == -1 && stat(path, &dir_info) == -1) { + sprintf(tmpbuf, "Unable to get status of '%s'.", path); + _statusline(tmpbuf); + sleep(AlertSecs); + FREE(dir_url); + FREE(path_url); return 0; } } else { path[0] = '\0'; + StrAllocCopy(path_url, path); } nothing_tagged = (HTList_isEmpty(tagged)); - BeginInternalPage(fp0, DIRED_MENU_TITLE, DIRED_MENU_HELP); + fprintf(fp0, + "<head>\n<title>%s</title></head>\n<body>\n", DIRED_MENU_TITLE); - fprintf(fp0, "<em>Current directory:</em> %s<br>\n", dir); + fprintf(fp0, + "\n<h1>File Management Options (%s Version %s)</h1>", + LYNX_NAME, LYNX_VERSION); + + fprintf(fp0, "Current directory is %s<br>\n", dir); if (nothing_tagged) { if (strlen(path)) { - fprintf(fp0, "<em>Current selection:</em> %s<p>\n", path); + fprintf(fp0, "Current selection is %s<p>\n", path); } else { - fprintf(fp0, "<em>Current selection:</em> Nothing currently selected.<p>\n"); + fprintf(fp0, "Nothing currently selected.<p>\n"); } } else { /* @@ -1657,18 +1807,19 @@ PUBLIC int dired_options ARGS2( char *cd = NULL; int i, m; #define NUM_TAGS_TO_WRITE 10 - fprintf(fp0, "<em>Current selection:</em> %d tagged item%s", + fprintf(fp0, "Current selection is %d tagged item%s", n, ((n == 1) ? ":" : "s:")); StrAllocCopy(cd, doc->address); HTUnEscapeSome(cd, "/"); - LYAddHtmlSep(&cd); + if (*cd && cd[(strlen(cd) - 1)] != '/') + StrAllocCat(cd, "/"); m = (n < NUM_TAGS_TO_WRITE) ? n : NUM_TAGS_TO_WRITE; for (i = 1; i <= m; i++) { cp1 = HTRelative(HTList_objectAt(tagged, i-1), (*cd ? cd : "file://localhost")); HTUnEscape(cp1); LYEntify(&cp1, TRUE); /* _should_ do this everywhere... */ - fprintf(fp0, "%s<br>\n %s", + fprintf(fp0, "%s <br>\n %s", (i == 1 ? "" : " ,"), cp1); FREE(cp1); } @@ -1695,30 +1846,26 @@ PUBLIC int dired_options ARGS2( if (mp->cond == DE_TAG && nothing_tagged) continue; if (mp->cond == DE_DIR && - (!*path || !S_ISDIR(dir_info.st_mode))) + (!*path || (dir_info.st_mode & S_IFMT) != S_IFDIR)) continue; if (mp->cond == DE_FILE && - (!*path || !S_ISREG(dir_info.st_mode))) + (!*path || (dir_info.st_mode & S_IFMT) != S_IFREG)) continue; #ifdef S_IFLNK if (mp->cond == DE_SYMLINK && - (!*path || !S_ISLNK(dir_info.st_mode))) + (!*path || (dir_info.st_mode & S_IFMT) != S_IFLNK)) continue; #endif if (*mp->sfx && (strlen(path) < strlen(mp->sfx) || strcmp(mp->sfx, &path[(strlen(path) - strlen(mp->sfx))]) != 0)) continue; - dir_url = HTEscape(dir, URL_PATH); - path_url = HTEscape(path, URL_PATH); fprintf(fp0, "<a href=\"%s", - render_item(mp->href, path_url, dir_url, buf,sizeof(buf), YES)); + render_item(mp->href, path_url, dir_url, buf,2048, YES)); fprintf(fp0, "\">%s</a> ", - render_item(mp->link, path, dir, buf,sizeof(buf), NO)); + render_item(mp->link, path, dir, buf,2048, NO)); fprintf(fp0, "%s<br>\n", - render_item(mp->rest, path, dir, buf,sizeof(buf), NO)); - FREE(dir_url); - FREE(path_url); + render_item(mp->rest, path, dir, buf,2048, NO)); } if (uploaders != NULL) { @@ -1732,8 +1879,11 @@ PUBLIC int dired_options ARGS2( } } - EndInternalPage(fp0); - LYCloseTempFP(fp0); + fprintf(fp0, "</body>\n"); + fclose(fp0); + + FREE(dir_url); + FREE(path_url); LYforce_no_cache = TRUE; @@ -1746,7 +1896,7 @@ PUBLIC int dired_options ARGS2( PRIVATE char *filename ARGS3( char *, prompt, char *, buf, - size_t, bufsize) + size_t, bufsize) { char *cp; @@ -1755,7 +1905,8 @@ PRIVATE char *filename ARGS3( *buf = '\0'; LYgetstr(buf, VISIBLE, bufsize, NORECALL); if (strstr(buf, "../") != NULL) { - HTAlert("Illegal filename; request ignored."); + _statusline("Illegal filename; request ignored."); + sleep(AlertSecs); return NULL; } @@ -1766,7 +1917,8 @@ PRIVATE char *filename ARGS3( else cp = buf; if (*cp == '.') { - HTAlert("Illegal filename; request ignored."); + _statusline("Illegal filename; request ignored."); + sleep(AlertSecs); return NULL; } } @@ -1794,24 +1946,45 @@ PUBLIC BOOLEAN local_install ARGS3( * Determine the status of the selected item. */ if (srcpath) { - if (!ok_localname(savepath, srcpath)) + srcpath = strip_trailing_slash(srcpath); + if (strncmp(srcpath, "file://localhost", 16) == 0) + srcpath += 16; + if (stat(srcpath, &dir_info) == -1) { + sprintf(tmpbuf, "Unable to get status of '%s'.", srcpath); + _statusline(tmpbuf); + sleep(AlertSecs); return 0; - + } else if ((dir_info.st_mode & S_IFMT) != S_IFDIR && + (dir_info.st_mode & S_IFMT) != S_IFREG) { + _statusline( + "The selected item is not a file or a directory! Request ignored."); + sleep(AlertSecs); + return 0; + } + strcpy(savepath, srcpath); LYforce_no_cache = TRUE; - LYLocalFileToURL(newpath, Home_Dir()); - StrAllocCat(*newpath, "/.installdirs.html"); + strcpy(tmpbuf, "file://localhost"); + strcat(tmpbuf, Home_Dir()); + strcat(tmpbuf, "/.installdirs.html"); + StrAllocCopy(*newpath, tmpbuf); return 0; } destpath = strip_trailing_slash(destpath); - if (!ok_stat(destpath, &dir_info)) { + if (stat(destpath,&dir_info) == -1) { + sprintf(tmpbuf,"Unable to get status of '%s'.",destpath); + _statusline(tmpbuf); + sleep(AlertSecs); return 0; - } else if (!S_ISDIR(dir_info.st_mode)) { - HTAlert("The selected item is not a directory! Request ignored."); + } else if ((dir_info.st_mode & S_IFMT) != S_IFDIR) { + _statusline( + "The selected item is not a directory! Request ignored."); + sleep(AlertSecs); return 0; - } else if (0 /*directory not writable*/) { - HTAlert("Install in the selected directory not permitted."); + } else if (0 /*directory not writeable*/) { + _statusline("Install in the selected directory not permitted."); + sleep(AlertSecs); return 0; } @@ -1834,17 +2007,18 @@ PUBLIC BOOLEAN local_install ARGS3( } else { char *name; while ((name = (char *)HTList_nextObject(tag))) { - int err; - args[src] = HTfullURL_toFile(name); - err = (LYExecv(INSTALL_PATH, args, tmpbuf) <= 0); - free(args[src]); - if (err) + args[src] = name; + if (strncmp("file://localhost", args[src], 16) == 0) + args[src] = (name + 16); + + if (LYExecv(INSTALL_PATH, args, tmpbuf) <= 0) return ((count == 0) ? -1 : count); count++; } clear_tags(); } - HTInfoMsg("Installation complete"); + statusline("Installation complete"); + sleep(InfoSecs); return count; } @@ -1927,7 +2101,7 @@ PUBLIC void add_menu_item ARGS1( * Create URL for DIRED HREF value. */ PRIVATE char * render_item ARGS6( - CONST char *, s, + char *, s, char *, path, char *, dir, char *, buf, @@ -1948,18 +2122,25 @@ PRIVATE char * render_item ARGS6( switch (*s) { case '%': *BP_INC = '%'; +#ifdef NOTDEFINED + /* + * These chars come from lynx.cfg or the default, let's + * just assume there won't be any improper %'s there that + * would need escaping. + */ + if(url_syntax) { + *BP_INC = '2'; + *BP_INC = '5'; + } +#endif /* NOTDEFINED */ break; case 'p': cp = path; - if (!LYIsHtmlSep(*cp)) - *BP_INC = '/'; while (*cp) *BP_INC = *cp++; break; case 'd': cp = dir; - if (!LYIsHtmlSep(*cp)) - *BP_INC = '/'; while (*cp) *BP_INC = *cp++; break; @@ -1998,6 +2179,12 @@ PRIVATE char * render_item ARGS6( break; default: *BP_INC = '%'; +#ifdef NOTDEFINED + if (url_syntax) { + *BP_INC = '2'; + *BP_INC = '5'; + } +#endif /* NOTDEFINED */ *BP_INC =*s; break; } @@ -2013,7 +2200,8 @@ PRIVATE char * render_item ARGS6( } if (overrun & url_syntax) { sprintf(buf,"Temporary URL or list would be too long."); - HTAlert(buf); + _statusline(buf); + sleep(AlertSecs); bp = buf; /* set to start, will return empty string as URL */ } *bp = '\0'; @@ -2030,7 +2218,9 @@ PRIVATE int LYExecv ARGS3( char *, msg) { #if defined(VMS) || defined(_WINDOWS) - CTRACE(tfp, "LYExecv: Called inappropriately!\n"); + if (TRACE) { + fprintf(stderr, "LYExecv: Called inappropriately!\n"); + } return(0); #else int rc; @@ -2042,13 +2232,6 @@ PRIVATE int LYExecv ARGS3( int wstatus; #endif - if (TRACE) { - int n; - CTRACE(tfp, "LYExecv path='%s'\n", path); - for (n = 0; argv[n] != 0; n++) - CTRACE(tfp, "argv[%d] = '%s'\n", n, argv[n]); - } - rc = 1; /* It will work */ tmpbuf[0] = '\0'; /* empty buffer for alert messages */ stop_curses(); @@ -2095,7 +2278,8 @@ PRIVATE int LYExecv ARGS3( } start_curses(); if (tmpbuf[0]) { - HTAlert(tmpbuf); + _statusline(tmpbuf); + sleep(AlertSecs); } return(rc); diff --git a/src/LYLocal.h b/src/LYLocal.h index 029718d1..47fff5c0 100644 --- a/src/LYLocal.h +++ b/src/LYLocal.h @@ -6,6 +6,11 @@ #ifdef VMS #include <types.h> #include <stat.h> +#else +#if 0 /* already included in tcp.h */ +#include <sys/types.h> +#include <sys/stat.h> +#endif #endif /* VMS */ #ifndef S_IRWXU @@ -60,6 +65,9 @@ extern void showtags PARAMS((HTList *tag)); extern int local_dired PARAMS((document *doc)); extern int dired_options PARAMS ((document *doc, char ** newfile)); +#define DIRED_MENU_TITLE "File Management Options" +#define PERMIT_OPTIONS_TITLE "File Permission Options" + extern void add_menu_item PARAMS((char *str)); #endif /* DIRED_SUPPORT */ diff --git a/src/LYMail.c b/src/LYMail.c index 62e9a8d7..f3a69290 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -1,14 +1,5 @@ -/* - * This file checked for sprintf() buffer overruns on 1998/05/06 by Bela - * Lubkin <filbo@armory.com>. Please don't introduce any new ones... - * - * See comments marked "- BL" for two still-possible overruns in the VMS - * code. - * - * Not yet checked for any other sort of buffer overrun. - */ - #include <HTUtils.h> +#include <tcp.h> #include <HTParse.h> #include <LYGlobalDefs.h> #include <HTAlert.h> @@ -18,44 +9,26 @@ #include <LYClean.h> #include <LYStrings.h> #include <GridText.h> +#include <LYSystem.h> #include <LYMail.h> #include <LYCharSets.h> /* to get current charset for mail header */ #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + BOOLEAN term_letter; /* Global variable for async i/o. */ PRIVATE void terminate_letter PARAMS((int sig)); PRIVATE void remove_tildes PARAMS((char *string)); -/* HTUnEscape with control-code nuking */ -PRIVATE void SafeHTUnEscape ARGS1( - char *, string) -{ - int i; - int flg = FALSE; - - HTUnEscape(string); - for (i=0; string[i] != '\0'; i++) - { - /* FIXME: this is explicitly 7-bit ASCII */ - if (string[i] < ' ' || string[i] >= 127) - { - string[i] = '?'; - flg = TRUE; - } - } - if (flg) - HTAlert(MAILTO_SQUASH_CTL); -} - /* ** mailform() sends form content to the mailto address(es). - FM */ PUBLIC void mailform ARGS4( - CONST char *, mailto_address, - CONST char *, mailto_subject, - CONST char *, mailto_content, - CONST char *, mailto_type) + char *, mailto_address, + char *, mailto_subject, + char *, mailto_content, + char *, mailto_type) { FILE *fd; char *address = NULL; @@ -115,7 +88,7 @@ PUBLIC void mailform ARGS4( *cp1 = '\0'; } if (*cp) { - SafeHTUnEscape(subject); + HTUnEscape(subject); LYstrncpy(subject, cp, 70); } if (cp1) { @@ -222,7 +195,7 @@ PUBLIC void mailform ARGS4( } if (keywords != NULL) { if (*keywords != '\0') { - SafeHTUnEscape(keywords); + HTUnEscape(keywords); } else { FREE(keywords); } @@ -275,9 +248,9 @@ PUBLIC void mailform ARGS4( /* * Unescape the address and ccaddr fields. - FM */ - SafeHTUnEscape(address); + HTUnEscape(address); if (ccaddr != NULL) { - SafeHTUnEscape(ccaddr); + HTUnEscape(ccaddr); } /* @@ -296,7 +269,8 @@ PUBLIC void mailform ARGS4( /* * User cancelled via ^G. - FM */ - HTInfoMsg(FORM_MAILTO_CANCELLED); + _statusline(FORM_MAILTO_CANCELLED); + sleep(InfoSecs); FREE(address); FREE(ccaddr); FREE(keywords); @@ -316,7 +290,8 @@ PUBLIC void mailform ARGS4( /* * User cancelled via ^G. - FM */ - HTInfoMsg(FORM_MAILTO_CANCELLED); + _statusline(FORM_MAILTO_CANCELLED); + sleep(InfoSecs); FREE(address); FREE(ccaddr); FREE(keywords); @@ -332,7 +307,14 @@ PUBLIC void mailform ARGS4( } #if defined(VMS) || defined(DOSPATH) - if ((fd = LYOpenTemp(my_tmpfile, ".txt", "w")) == NULL) { + tempname(my_tmpfile, NEW_FILE); + if (((cp = strrchr(my_tmpfile, '.')) != NULL) && + NULL == strchr(cp, ']') && + NULL == strchr(cp, '/')) { + *cp = '\0'; + strcat(my_tmpfile, ".txt"); + } + if ((fd = LYNewTxtFile(my_tmpfile)) == NULL) { HTAlert(FORM_MAILTO_FAILED); FREE(address); FREE(ccaddr); @@ -340,9 +322,15 @@ PUBLIC void mailform ARGS4( return; } if (isPMDF) { - if ((hfd = LYOpenTemp(hdrfile, ".txt", "w")) == NULL) { + tempname(hdrfile, NEW_FILE); + if (((cp = strrchr(hdrfile, '.')) != NULL) && + NULL == strchr(cp, ']') && + NULL == strchr(cp, '/')) { + *cp = '\0'; + strcat(hdrfile, ".txt"); + } + if ((hfd = LYNewTxtFile(hdrfile)) == NULL) { HTAlert(FORM_MAILTO_FAILED); - LYCloseTempFP(fd); FREE(address); FREE(ccaddr); FREE(keywords); @@ -414,33 +402,33 @@ PUBLIC void mailform ARGS4( i = 0; len = strlen(mailto_content); while (len > 78) { - strncpy(cmd, &mailto_content[i], 78); + strncpy(cmd, (char *)&mailto_content[i], 78); cmd[78] = '\0'; fprintf(fd, "%s\n", cmd); i += 78; - len = strlen(&mailto_content[i]); + len = strlen((char *)&mailto_content[i]); } - fprintf(fd, "%s\n", &mailto_content[i]); + fprintf(fd, "%s\n", (char *)&mailto_content[i]); mailto_content = (cp+1); } i = 0; len = strlen(mailto_content); while (len > 78) { - strncpy(cmd, &mailto_content[i], 78); + strncpy(cmd, (char *)&mailto_content[i], 78); cmd[78] = '\0'; fprintf(fd, "%s\n", cmd); i += 78; - len = strlen(&mailto_content[i]); + len = strlen((char *)&mailto_content[i]); } if (len) - fprintf(fd, "%s\n", &mailto_content[i]); + fprintf(fd, "%s\n", (char *)&mailto_content[i]); #ifdef UNIX pclose(fd); sleep(MessageSecs); #endif /* UNIX */ #if defined(VMS) || defined(DOSPATH) - LYCloseTempFP(fd); + fclose(fd); #ifdef VMS /* * Set the mail command. - FM @@ -454,7 +442,7 @@ PUBLIC void mailform ARGS4( fprintf(hfd, "Keywords: %s\n", keywords); } fprintf(hfd, "Subject: %s\n\n", subject); - LYCloseTempFP(hfd); + fclose(hfd); /* * Now set up the command. - FM */ @@ -470,8 +458,6 @@ PUBLIC void mailform ARGS4( * command, and ignore any keywords to minimize risk * of them making the line too long or having problem * characters. - FM - * - * Possibly still a problem if user supplies long subject. - BL */ sprintf(cmd, "%s %s%s/subject=\"%s\" %s ", @@ -499,12 +485,8 @@ PUBLIC void mailform ARGS4( * 4 letters is arbitrarily the smallest possible mail * address, at least for lynx. That way extra spaces * won't confuse the mailer and give a blank address. - * - * ignore addresses so long that they would overflow the - * temporary buffer (i.e. about 500 chars). - BL */ - if (strlen(address_ptr1) > 3 && - strlen(address_ptr1) + strlen(mail_adrs) < sizeof(cmd)) { + if (strlen(address_ptr1) > 3) { if (!first) { StrAllocCat(command, ","); } @@ -532,12 +514,8 @@ PUBLIC void mailform ARGS4( * 4 letters is arbitrarily the smallest possible mail * address, at least for lynx. That way extra spaces * won't confuse the mailer and give a blank address. - * - * ignore addresses so long that they would overflow the - * temporary buffer (i.e. about 500 chars). - BL */ - if (strlen(address_ptr1) > 3 && - strlen(address_ptr1) + strlen(mail_adrs) < sizeof(cmd)) { + if (strlen(address_ptr1) > 3) { StrAllocCat(command, ","); sprintf(cmd, mail_adrs, address_ptr1); if (isPMDF) { @@ -551,25 +529,20 @@ PUBLIC void mailform ARGS4( stop_curses(); printf("Sending form content:\n\n$ %s\n\nPlease wait...", command); - LYSystem(command); + system(command); FREE(command); sleep(AlertSecs); start_curses(); - LYRemoveTemp(my_tmpfile); - LYRemoveTemp(hdrfile); + remove(my_tmpfile); + remove(hdrfile); #else /* DOSPATH */ - StrAllocCopy(command, system_mail); - StrAllocCat(command, " -t \""); - StrAllocCat(command, address); - StrAllocCat(command, "\" -F "); - StrAllocCat(command, my_tmpfile); + sprintf(cmd, "%s -t \"%s\" -F %s", system_mail, address, my_tmpfile); stop_curses(); - printf("Sending form content:\n\n$ %s\n\nPlease wait...", command); - LYSystem(command); - FREE(command); + printf("Sending form content:\n\n$ %s\n\nPlease wait...", cmd); + system(cmd); sleep(MessageSecs); start_curses(); - LYRemoveTemp(my_tmpfile); + remove(my_tmpfile); #endif #endif /* VMS */ @@ -602,11 +575,6 @@ PUBLIC void mailmsg ARGS4( char hdrfile[256]; FILE *hfd; - CTRACE(tfp, "mailmsg(%d, \"%s\", \"%s\", \"%s\")\n", cur, - owner_address?owner_address:"<nil>", - filename?filename:"<nil>", - linkname?linkname:"<nil>"); - if (!strncasecomp(system_mail, "PMDF SEND", 9)) { isPMDF = TRUE; } @@ -678,13 +646,16 @@ PUBLIC void mailmsg ARGS4( /* * Unescape the address field. - FM */ - SafeHTUnEscape(address); + HTUnEscape(address); if (address[(strlen(address) - 1)] == ',') address[(strlen(address) - 1)] = '\0'; if (*address == '\0') { FREE(address); - CTRACE(tfp, "mailmsg: No address in '%s'.\n", + if (TRACE) { + fprintf(stderr, + "mailmsg: No address in '%s'.\n", owner_address); + } return; } @@ -692,8 +663,11 @@ PUBLIC void mailmsg ARGS4( sprintf(cmd, "%s %s", system_mail, system_mail_flags); if ((fd = popen(cmd, "w")) == NULL) { FREE(address); - CTRACE(tfp, "mailmsg: '%s' failed.\n", + if (TRACE) { + fprintf(stderr, + "mailmsg: '%s' failed.\n", cmd); + } return; } @@ -706,16 +680,36 @@ PUBLIC void mailmsg ARGS4( fprintf(fd, "X-Mailer: Lynx, Version %s\n\n", LYNX_VERSION); #endif /* UNIX */ #if defined(VMS) || defined(DOSPATH) - if ((fd = LYOpenTemp(my_tmpfile, ".txt", "w")) == NULL) { - CTRACE(tfp, "mailmsg: Could not fopen '%s'.\n", + tempname(my_tmpfile, NEW_FILE); + if (((cp = strrchr(my_tmpfile, '.')) != NULL) && + NULL == strchr(cp, ']') && + NULL == strchr(cp, '/')) { + *cp = '\0'; + strcat(my_tmpfile, ".txt"); + } + if ((fd = LYNewTxtFile(my_tmpfile)) == NULL) { + if (TRACE) { + fprintf(stderr, + "mailmsg: Could not fopen '%s'.\n", my_tmpfile); + } FREE(address); return; } if (isPMDF) { - if ((hfd = LYOpenTemp(hdrfile, ".txt", "w")) == NULL) { - CTRACE(tfp, "mailmsg: Could not fopen '%s'.\n", + tempname(hdrfile, NEW_FILE); + if (((cp = strrchr(hdrfile, '.')) != NULL) && + NULL == strchr(cp, ']') && + NULL == strchr(cp, '/')) { + *cp = '\0'; + strcat(hdrfile, ".txt"); + } + if ((hfd = LYNewTxtFile(hdrfile)) == NULL) { + if (TRACE) { + fprintf(stderr, + "mailmsg: Could not fopen '%s'.\n", hdrfile); + } FREE(address); return; } @@ -749,7 +743,7 @@ PUBLIC void mailmsg ARGS4( pclose(fd); #endif /* UNIX */ #if defined(VMS) || defined(DOSPATH) - LYCloseTempFP(fd); + fclose(fd); #ifdef VMS if (isPMDF) { /* @@ -757,7 +751,7 @@ PUBLIC void mailmsg ARGS4( * header file and close it. - FM */ fprintf(hfd, "Subject: Lynx Error in %.56s\n\n", filename); - LYCloseTempFP(hfd); + fclose(hfd); /* * Now set up the command. - FM */ @@ -788,16 +782,7 @@ PUBLIC void mailmsg ARGS4( } else address_ptr2 = NULL; - /* - * 4 letters is arbitrarily the smallest possible mail - * address, at least for lynx. That way extra spaces - * won't confuse the mailer and give a blank address. - * - * ignore addresses so long that they would overflow the - * temporary buffer (i.e. about 500 chars). - BL - */ - if (strlen(address) > 3 && - strlen(address) + strlen(mail_adrs) < sizeof(cmd)) { + if (strlen(address) > 3) { if (!first) { StrAllocCat(command, ","); } @@ -808,21 +793,16 @@ PUBLIC void mailmsg ARGS4( address_ptr1 = address_ptr2; } while (address_ptr1 != NULL); - LYSystem(command); + system(command); FREE(command); - LYRemoveTemp(my_tmpfile); + remove(my_tmpfile); if (isPMDF) { - LYRemoveTemp(hdrfile); + remove(hdrfile); } #else /* DOSPATH */ - StrAllocCopy(command, system_mail); - StrAllocCat(command, " -t \""); - StrAllocCat(command, address); - StrAllocCat(command, "\" -F "); - StrAllocCat(command, my_tmpfile); - LYSystem(command); - FREE(command); - LYRemoveTemp(my_tmpfile); + sprintf(cmd, "%s -t \"%s\" -F %s", system_mail, address, my_tmpfile); + system(cmd); + remove(my_tmpfile); #endif #endif /* VMS */ @@ -880,25 +860,16 @@ PUBLIC void reply_by_mail ARGS3( #ifdef DOSPATH char tmpfile2[256]; #endif -#if defined(DOSPATH) || defined(VMS) - char *command = NULL; -#endif -#ifndef NO_ANONYMOUS_EMAIL static char *personal_name = NULL; -#endif char subject[80]; #ifdef VMS char *address_ptr1 = NULL, *address_ptr2 = NULL; + char *command = NULL; BOOLEAN first = TRUE; BOOLEAN isPMDF = FALSE; char hdrfile[256]; FILE *hfd; - CTRACE(tfp, "reply_by_mail(\"%s\", \"%s\", \"%s\")\n", - mail_address?mail_address:"<nil>", - filename?filename:"<nil>", - title?title:"<nil>"); - if (!strncasecomp(system_mail, "PMDF SEND", 9)) { isPMDF = TRUE; } @@ -917,13 +888,29 @@ PUBLIC void reply_by_mail ARGS3( return; } - if ((fd = LYOpenTemp(my_tmpfile, ".txt", "w")) == NULL) { + tempname(my_tmpfile, NEW_FILE); + if (((cp = strrchr(my_tmpfile, '.')) != NULL) && +#ifdef VMS + NULL == strchr(cp, ']') && +#endif /* VMS */ + NULL == strchr(cp, '/')) { + *cp = '\0'; + strcat(my_tmpfile, ".txt"); + } + if ((fd = LYNewTxtFile(my_tmpfile)) == NULL) { HTAlert(MAILTO_URL_TEMPOPEN_FAILED); return; } #ifdef VMS if (isPMDF) { - if ((hfd = LYOpenTemp(hdrfile, ".txt", "w")) == NULL) { + tempname(hdrfile, NEW_FILE); + if (((cp = strrchr(hdrfile, '.')) != NULL) && + NULL == strchr(cp, ']') && + NULL == strchr(cp, '/')) { + *cp = '\0'; + strcat(hdrfile, ".txt"); + } + if ((hfd = LYNewTxtFile(hdrfile)) == NULL) { HTAlert(MAILTO_URL_TEMPOPEN_FAILED); return; } @@ -956,7 +943,7 @@ PUBLIC void reply_by_mail ARGS3( if (*cp) { strncpy(subject, cp, 70); subject[70] = '\0'; - SafeHTUnEscape(subject); + HTUnEscape(subject); } if (cp1) { *cp1 = '&'; @@ -1063,7 +1050,7 @@ PUBLIC void reply_by_mail ARGS3( } if (keywords != NULL) { if (*keywords != '\0') { - SafeHTUnEscape(keywords); + HTUnEscape(keywords); } else { FREE(keywords); } @@ -1160,8 +1147,8 @@ PUBLIC void reply_by_mail ARGS3( FREE(ccaddr); FREE(keywords); FREE(body); - LYCloseTempFP(fd); /* Close the tmpfile. */ - LYRemoveTemp(my_tmpfile); /* Delete the tmpfile. */ + fclose(fd); /* Close the tmpfile. */ + remove(my_tmpfile); /* Delete the tmpfile. */ HTAlert(NO_ADDRESS_IN_MAILTO_URL); return; } @@ -1186,9 +1173,9 @@ PUBLIC void reply_by_mail ARGS3( /* * Unescape the address and ccaddr fields. - FM */ - SafeHTUnEscape(address); + HTUnEscape(address); if (ccaddr != NULL) { - SafeHTUnEscape(ccaddr); + HTUnEscape(ccaddr); } /* @@ -1229,9 +1216,8 @@ PUBLIC void reply_by_mail ARGS3( * Put the To: line in the header. */ #ifndef DOSPATH - StrAllocCopy(header, "To: "); - StrAllocCat(header, address); - StrAllocCat(header, "\n"); + sprintf(buf, "To: %s\n", address); + StrAllocCopy(header, buf); #endif /* @@ -1261,15 +1247,11 @@ PUBLIC void reply_by_mail ARGS3( /* * Put the X-URL and X-Mailer lines in the header. */ - StrAllocCat(header, "X-URL: "); - if (filename && *filename) { - StrAllocCat(header, filename); - } - else { - StrAllocCat(header, "mailto:"); - StrAllocCat(header, address); - } - StrAllocCat(header, "\n"); + sprintf(buf, + "X-URL: %s%s\n", + (filename && *filename) ? filename : "mailto:", + (filename && *filename) ? "" : address); + StrAllocCat(header, buf); sprintf(buf, "X-Mailer: Lynx, Version %s\n", LYNX_VERSION); StrAllocCat(header, buf); #endif /* VMS */ @@ -1354,8 +1336,9 @@ PUBLIC void reply_by_mail ARGS3( if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 || term_letter) { addstr("\n"); - HTInfoMsg(COMMENT_REQUEST_CANCELLED); - LYCloseTempFP(fd); /* Close the tmpfile. */ + _statusline(COMMENT_REQUEST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the tmpfile. */ scrollok(stdscr,FALSE); /* Stop scrolling. */ goto cleanup; } @@ -1368,9 +1351,8 @@ PUBLIC void reply_by_mail ARGS3( fprintf((isPMDF ? hfd : fd), "X-Personal_name: %s\n",user_input); #else - StrAllocCat(header, "X-Personal_name: "); - StrAllocCat(header, user_input); - StrAllocCat(header, "\n"); + sprintf(buf, "X-Personal_name: %s\n", user_input); + StrAllocCat(header, buf); #endif /* VMS */ } @@ -1396,8 +1378,9 @@ PUBLIC void reply_by_mail ARGS3( if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 || term_letter) { addstr("\n"); - HTInfoMsg(COMMENT_REQUEST_CANCELLED); - LYCloseTempFP(fd); /* Close the tmpfile. */ + _statusline(COMMENT_REQUEST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the tmpfile. */ scrollok(stdscr,FALSE); /* Stop scrolling. */ goto cleanup; } @@ -1414,9 +1397,8 @@ PUBLIC void reply_by_mail ARGS3( fprintf(fd, "\n"); } #else - StrAllocCat(header, "From: "); - StrAllocCat(header, user_input); - StrAllocCat(header, "\n"); + sprintf(buf, "From: %s\n", user_input); + StrAllocCat(header, buf); #endif /* VMS */ #endif /* !NO_ANONYMOUS_EMAIL */ #ifdef VMS @@ -1442,8 +1424,9 @@ PUBLIC void reply_by_mail ARGS3( if (LYgetstr(user_input, VISIBLE, 71, NORECALL) < 0 || term_letter) { addstr("\n"); - HTInfoMsg(COMMENT_REQUEST_CANCELLED); - LYCloseTempFP(fd); /* Close the tmpfile. */ + _statusline(COMMENT_REQUEST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the tmpfile. */ scrollok(stdscr,FALSE); /* Stop scrolling. */ goto cleanup; } @@ -1452,9 +1435,8 @@ PUBLIC void reply_by_mail ARGS3( #ifdef VMS sprintf(subject, "%.70s", user_input); #else - StrAllocCat(header, "Subject: "); - StrAllocCat(header, user_input); - StrAllocCat(header, "\n"); + sprintf(buf, "Subject: %s\n", user_input); + StrAllocCat(header, buf); #endif /* VMS */ /* @@ -1475,15 +1457,16 @@ PUBLIC void reply_by_mail ARGS3( if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 || term_letter) { addstr("\n"); - HTInfoMsg(COMMENT_REQUEST_CANCELLED); - LYCloseTempFP(fd); /* Close the tmpfile. */ + _statusline(COMMENT_REQUEST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the tmpfile. */ scrollok(stdscr, FALSE); /* Stop scrolling. */ goto cleanup; } addstr("\n"); } remove_tildes(user_input); - +#if defined (VMS) || defined (DOSPATH) if (*user_input) { cp = user_input; while (*cp == ',' || isspace((unsigned char)*cp)) @@ -1497,12 +1480,11 @@ PUBLIC void reply_by_mail ARGS3( } } } - +#endif #ifdef DOSPATH if (*address) { - StrAllocCat(header, "To: "); - StrAllocCat(header, address); - StrAllocCat(header, "\n"); + sprintf(buf, "To: %s\n", address); + StrAllocCat(header, buf); } #endif @@ -1530,7 +1512,6 @@ PUBLIC void reply_by_mail ARGS3( */ sprintf(buf, "\n"); StrAllocCat(header, buf); - CTRACE(tfp,"**header==\n%s",header); #endif /* !VMS */ if (!no_editor && editor && *editor != '\0') { @@ -1570,7 +1551,7 @@ PUBLIC void reply_by_mail ARGS3( print_wwwfile_to_fd(fd, 1); } } - LYCloseTempFP(fd); /* Close the tmpfile. */ + fclose(fd); /* Close the tmpfile. */ scrollok(stdscr,FALSE); /* Stop scrolling. */ if (term_letter || c == 7 || c == 3) @@ -1585,9 +1566,10 @@ PUBLIC void reply_by_mail ARGS3( sprintf(user_input, "%s%s %s", editor, editor_arg, my_tmpfile); _statusline(SPAWNING_EDITOR_FOR_MAIL); stop_curses(); - if (LYSystem(user_input)) { + if (system(user_input)) { start_curses(); - HTAlert(ERROR_SPAWNING_EDITOR); + _statusline(ERROR_SPAWNING_EDITOR); + sleep(AlertSecs); } else { start_curses(); } @@ -1611,16 +1593,16 @@ PUBLIC void reply_by_mail ARGS3( if (term_letter || c == 7 || c == 3) { addstr(CANCELLED); sleep(InfoSecs); - LYCloseTempFP(fd); /* Close the tmpfile. */ + fclose(fd); /* Close the tmpfile. */ scrollok(stdscr, FALSE); /* Stop scrolling. */ goto cleanup; } i = (LYlines - 2); } *cp++ = '\0'; - fprintf(fd, "%s\n", cp1); - addstr(cp1); - addstr("\n"); + sprintf(cmd, "%s\n", cp1); + fprintf(fd, cmd); + addstr(cmd); cp1 = cp; i--; } @@ -1629,7 +1611,7 @@ PUBLIC void reply_by_mail ARGS3( i--; } refresh(); - LYCloseTempFP(fd); /* Close the tmpfile. */ + fclose(fd); /* Close the tmpfile. */ scrollok(stdscr,FALSE); /* Stop scrolling. */ } else { @@ -1644,8 +1626,9 @@ PUBLIC void reply_by_mail ARGS3( *user_input = '\0'; if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 || term_letter || STREQ(user_input, ".")) { - HTInfoMsg(COMMENT_REQUEST_CANCELLED); - LYCloseTempFP(fd); /* Close the tmpfile. */ + _statusline(COMMENT_REQUEST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the tmpfile. */ scrollok(stdscr,FALSE); /* Stop scrolling. */ goto cleanup; } @@ -1657,15 +1640,16 @@ PUBLIC void reply_by_mail ARGS3( *user_input = '\0'; if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0) { - HTInfoMsg(COMMENT_REQUEST_CANCELLED); - LYCloseTempFP(fd); /* Close the tmpfile. */ + _statusline(COMMENT_REQUEST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the tmpfile. */ scrollok(stdscr,FALSE); /* Stop scrolling. */ goto cleanup; } } fprintf(fd, "\n"); /* Terminate the message. */ - LYCloseTempFP(fd); /* Close the tmpfile. */ + fclose(fd); /* Close the tmpfile. */ scrollok(stdscr,FALSE); /* Stop scrolling. */ } @@ -1727,7 +1711,7 @@ PUBLIC void reply_by_mail ARGS3( fprintf(hfd, "Keywords: %s\n", keywords); } fprintf(hfd, "Subject: %s\n\n", subject); - LYCloseTempFP(hfd); + fclose(hfd); /* * Now set up the command. - FM */ @@ -1743,8 +1727,6 @@ PUBLIC void reply_by_mail ARGS3( * command, and ignore any keywords to minimize risk * of them making the line too long or having problem * characters. - FM - * - * Possibly still a problem if user supplies long subject. - BL */ sprintf(cmd, "%s %s%s/subject=\"%s\" %s ", @@ -1772,12 +1754,8 @@ PUBLIC void reply_by_mail ARGS3( * 4 letters is arbitrarily the smallest possible mail * address, at least for lynx. That way extra spaces * won't confuse the mailer and give a blank address. - * - * ignore addresses so long that they would overflow the - * temporary buffer (i.e. about 500 chars). - BL */ - if (strlen(address_ptr1) > 3 && - strlen(address_ptr1) + strlen(mail_adrs) < sizeof(cmd)) { + if (strlen(address_ptr1) > 3) { if (!first) { StrAllocCat(command, ","); } @@ -1805,12 +1783,8 @@ PUBLIC void reply_by_mail ARGS3( * 4 letters is arbitrarily the smallest possible mail * address, at least for lynx. That way extra spaces * won't confuse the mailer and give a blank address. - * - * ignore addresses so long that they would overflow the - * temporary buffer (i.e. about 500 chars). - BL */ - if (strlen(address_ptr1) > 3 && - strlen(address_ptr1) + strlen(mail_adrs) < sizeof(cmd)) { + if (strlen(address_ptr1) > 3) { StrAllocCat(command, ","); sprintf(cmd, mail_adrs, address_ptr1); if (isPMDF) { @@ -1824,7 +1798,7 @@ PUBLIC void reply_by_mail ARGS3( stop_curses(); printf("Sending your comment:\n\n$ %s\n\nPlease wait...", command); - LYSystem(command); + system(command); FREE(command); sleep(AlertSecs); start_curses(); @@ -1836,7 +1810,13 @@ PUBLIC void reply_by_mail ARGS3( _statusline(SENDING_YOUR_MSG); sprintf(cmd, "%s %s", system_mail, system_mail_flags); #ifdef DOSPATH - if ((fp = LYOpenTemp(tmpfile2, ".txt", "w")) == NULL) { + tempname(tmpfile2, NEW_FILE); + if (((cp = strrchr(tmpfile2, '.')) != NULL) && + NULL == strchr(cp, '/')) { + *cp = '\0'; + strcat(tmpfile2, ".txt"); + } + if ((fp = LYNewTxtFile(tmpfile2)) == NULL) { HTAlert(MAILTO_URL_TEMPOPEN_FAILED); return; } @@ -1844,13 +1824,15 @@ PUBLIC void reply_by_mail ARGS3( signal(SIGINT, SIG_IGN); fp = popen(cmd, "w"); if (fp == NULL) { - HTInfoMsg(COMMENT_REQUEST_CANCELLED); + _statusline(COMMENT_REQUEST_CANCELLED); + sleep(InfoSecs); goto cleanup; } #endif /* DOSPATH */ fd = fopen(my_tmpfile, "r"); if (fd == NULL) { - HTInfoMsg(COMMENT_REQUEST_CANCELLED); + _statusline(COMMENT_REQUEST_CANCELLED); + sleep(InfoSecs); pclose(fp); goto cleanup; } @@ -1858,25 +1840,21 @@ PUBLIC void reply_by_mail ARGS3( while ((n = fread(buf, 1, sizeof(buf), fd)) != 0) fwrite(buf, 1, n, fp); #ifdef DOSPATH - StrAllocCopy(command, system_mail); - StrAllocCat(command, " -t \""); - StrAllocCat(command, address); - StrAllocCat(command, "\" -F "); - StrAllocCat(command, tmpfile2); - LYCloseTempFP(fp); /* Close the tmpfile. */ - stop_curses(); - printf("Sending your comment:\n\n$ %s\n\nPlease wait...", command); - LYSystem(command); - FREE(command); - sleep(MessageSecs); - start_curses(); - LYRemoveTemp(tmpfile2); /* Delete the tmpfile. */ + sprintf(cmd, "%s -t \"%s\" -F %s", system_mail, address, tmpfile2); + fclose(fp); /* Close the tmpfile. */ + stop_curses(); + printf("Sending your comment:\n\n$ %s\n\nPlease wait...", cmd); + system(cmd); + sleep(MessageSecs); + start_curses(); + remove(tmpfile2); /* Delete the tmpfile. */ #else pclose(fp); #endif - LYCloseTempFP(fd); /* Close the tmpfile. */ + fclose(fd); /* Close the tmpfile. */ - CTRACE(tfp, "%s\n", cmd); + if (TRACE) + printf("%s\n", cmd); #endif /* VMS */ /* @@ -1894,11 +1872,14 @@ cleandown: term_letter = FALSE; #ifdef VMS FREE(command); + while (remove(my_tmpfile) == 0) + ; /* Delete the tmpfile(s). */ if (isPMDF) { - LYRemoveTemp(hdrfile); + remove(hdrfile); /* Delete the hdrfile. */ } +#else + remove(my_tmpfile); /* Delete the tmpfile. */ #endif /* VMS */ - LYRemoveTemp(my_tmpfile); FREE(address); FREE(ccaddr); FREE(keywords); diff --git a/src/LYMail.h b/src/LYMail.h index 3304228a..8de71866 100644 --- a/src/LYMail.h +++ b/src/LYMail.h @@ -9,10 +9,10 @@ extern BOOLEAN term_letter; extern void mailform PARAMS(( - CONST char * mailto_address, - CONST char * mailto_subject, - CONST char * mailto_content, - CONST char * mailto_type)); + char * mailto_address, + char * mailto_subject, + char * mailto_content, + char * mailto_type)); extern void mailmsg PARAMS(( int cur, char * owner_address, diff --git a/src/LYMain.c b/src/LYMain.c index 7b192d4f..707c0469 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTTP.h> #include <HTParse.h> #include <HTAccess.h> @@ -6,6 +7,9 @@ #include <HTFile.h> #include <UCMap.h> #include <UCDefs.h> +#ifdef VMS +#include <HTVMSUtils.h> +#endif /* VMS */ #include <HTInit.h> #include <LYCurses.h> #include <LYStyle.h> @@ -26,14 +30,8 @@ #include <LYJump.h> #include <LYMainLoop.h> #include <LYBookmark.h> -#include <LYCookie.h> - -#ifdef __DJGPP__ -#include <dos.h> -#endif /* __DJGPP__ */ - -#ifdef __EMX__ -#include <io.h> +#ifdef DOSPATH +#include <HTDOS.h> #endif #ifndef VMS @@ -49,11 +47,13 @@ #include <LYexit.h> #include <LYLeaks.h> -#ifdef FNAMES_8_3 -#define COOKIE_FILE "cookies" -#else -#define COOKIE_FILE ".lynx_cookies" -#endif /* FNAMES_8_3 */ +#define FREE(x) if (x) {free(x); x = NULL;} + +#ifdef VMS +#define DISPLAY "DECW$DISPLAY" +#else +#define DISPLAY "DISPLAY" +#endif /* VMS */ /* ahhhhhhhhhh!! Global variables :-< */ #ifdef SOCKS @@ -76,7 +76,23 @@ PUBLIC BOOLEAN UseFixedRecords = USE_FIXED_RECORDS; #ifndef VMS PUBLIC char *lynx_version_putenv_command = NULL; -PUBLIC char *list_format = NULL; /* LONG_LIST formatting mask */ +PUBLIC char *NNTPSERVER_putenv_cmd = NULL; /* lynx.cfg defined NNTPSERVER */ +PUBLIC char *http_proxy_putenv_cmd = NULL; /* lynx.cfg defined http_proxy */ +PUBLIC char *https_proxy_putenv_cmd = NULL; /* lynx.cfg defined https_proxy */ +PUBLIC char *ftp_proxy_putenv_cmd = NULL; /* lynx.cfg defined ftp_proxy */ +PUBLIC char *gopher_proxy_putenv_cmd = NULL; /* lynx.cfg defined gopher_proxy */ +PUBLIC char *cso_proxy_putenv_cmd = NULL; /* lynx.cfg defined cso_proxy */ +PUBLIC char *news_proxy_putenv_cmd = NULL; /* lynx.cfg defined news_proxy */ +PUBLIC char *newspost_proxy_putenv_cmd = NULL; +PUBLIC char *newsreply_proxy_putenv_cmd = NULL; +PUBLIC char *snews_proxy_putenv_cmd = NULL; /* lynx.cfg defined snews_proxy */ +PUBLIC char *snewspost_proxy_putenv_cmd = NULL; +PUBLIC char *snewsreply_proxy_putenv_cmd = NULL; +PUBLIC char *nntp_proxy_putenv_cmd = NULL; /* lynx.cfg defined nntp_proxy */ +PUBLIC char *wais_proxy_putenv_cmd = NULL; /* lynx.cfg defined wais_proxy */ +PUBLIC char *finger_proxy_putenv_cmd = NULL; /* lynx.cfg defined finger_proxy */ +PUBLIC char *no_proxy_putenv_cmd = NULL; /* lynx.cfg defined no_proxy */ +PUBLIC char *list_format=NULL; /* LONG_LIST formatting mask */ #ifdef SYSLOG_REQUESTED_URLS PUBLIC char *syslog_txt = NULL; /* syslog arb text for session */ #endif /* SYSLOG_REQUESTED_URLS */ @@ -89,7 +105,7 @@ 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 BOOLEAN dir_list_style = MIXED_STYLE; PUBLIC HTList *tagged = NULL; #ifdef OK_OVERRIDE PUBLIC BOOLEAN prev_lynx_edit_mode = FALSE; @@ -147,23 +163,19 @@ PUBLIC int port_syntax = 1; PUBLIC int LYShowColor = SHOW_COLOR_UNKNOWN; /* to show or not to show */ PUBLIC int LYChosenShowColor = SHOW_COLOR_UNKNOWN; /* whether to show and save */ PUBLIC int LYrcShowColor = SHOW_COLOR_UNKNOWN; /* ... as last read or written */ -#if !defined(NO_OPTION_FORMS) && !defined(NO_OPTION_MENU) -PUBLIC BOOLEAN LYUseFormsOptions = TRUE; /* use forms-based options menu */ -#endif PUBLIC BOOLEAN LYShowCursor = SHOW_CURSOR; /* to show or not to show */ -PUBLIC BOOLEAN verbose_img = VERBOSE_IMAGES; /* show filenames or not */ +PUBLIC BOOLEAN verbose_img = VERBOSE_IMAGES; /* show filenames or not */ PUBLIC BOOLEAN LYUseDefShoCur = TRUE; /* Command line -show_cursor toggle */ PUBLIC BOOLEAN LYforce_no_cache = FALSE; PUBLIC BOOLEAN LYoverride_no_cache = FALSE;/*override no-cache b/c history etc*/ PUBLIC BOOLEAN LYinternal_flag = FALSE; /* override no-cache b/c internal link*/ PUBLIC BOOLEAN LYresubmit_posts = ALWAYS_RESUBMIT_POSTS; -PUBLIC BOOLEAN LYshow_kb_rate = TRUE; PUBLIC BOOLEAN LYUserSpecifiedURL = TRUE;/* always TRUE the first time */ PUBLIC BOOLEAN LYJumpFileURL = FALSE; /* always FALSE the first time */ PUBLIC BOOLEAN jump_buffer = JUMPBUFFER; /* TRUE if offering default shortcut */ PUBLIC BOOLEAN goto_buffer = GOTOBUFFER; /* TRUE if offering default goto URL */ PUBLIC BOOLEAN recent_sizechange = FALSE;/* the window size changed recently? */ -PUBLIC int user_mode = NOVICE_MODE; +PUBLIC BOOLEAN user_mode = NOVICE_MODE; PUBLIC BOOLEAN dump_output_immediately = FALSE; PUBLIC BOOLEAN is_www_index = FALSE; PUBLIC BOOLEAN lynx_mode = NORMAL_LYNX_MODE; @@ -175,7 +187,6 @@ PUBLIC BOOLEAN nolist = FALSE; PUBLIC BOOLEAN historical_comments = FALSE; PUBLIC BOOLEAN minimal_comments = FALSE; PUBLIC BOOLEAN soft_dquotes = FALSE; -PUBLIC BOOLEAN LYRestricted = FALSE; PUBLIC BOOLEAN LYValidate = FALSE; PUBLIC BOOLEAN LYPermitURL = FALSE; PUBLIC BOOLEAN child_lynx = FALSE; @@ -183,7 +194,7 @@ PUBLIC BOOLEAN error_logging = MAIL_SYSTEM_ERROR_LOGGING; PUBLIC BOOLEAN check_mail = CHECKMAIL; PUBLIC BOOLEAN vi_keys = VI_KEYS_ALWAYS_ON; PUBLIC BOOLEAN emacs_keys = EMACS_KEYS_ALWAYS_ON; -PUBLIC int keypad_mode = DEFAULT_KEYPAD_MODE; +PUBLIC BOOLEAN keypad_mode = DEFAULT_KEYPAD_MODE; PUBLIC BOOLEAN case_sensitive = CASE_SENSITIVE_ALWAYS_ON; PUBLIC BOOLEAN telnet_ok = TRUE; PUBLIC BOOLEAN news_ok = TRUE; @@ -193,6 +204,9 @@ PUBLIC BOOLEAN system_editor = FALSE; #ifdef USE_EXTERNALS PUBLIC BOOLEAN no_externals = FALSE; #endif +#ifdef RAWDOSKEYHACK +PUBLIC BOOLEAN raw_dos_key_hack = TRUE; +#endif /* RAWDOSKEYHACK */ PUBLIC BOOLEAN no_inside_telnet = FALSE; PUBLIC BOOLEAN no_outside_telnet = FALSE; PUBLIC BOOLEAN no_telnet_port = FALSE; @@ -261,9 +275,8 @@ PUBLIC char *lynxlistfile = NULL; /* the current list file URL */ PUBLIC char *lynxlinksfile = NULL; /* the current visited links file URL */ PUBLIC char *startrealm = NULL; /* the startfile realm */ PUBLIC char *indexfile = NULL; /* an index file if there is one */ -PUBLIC int outgoing_mail_charset = -1; /* translate mail to this charset */ PUBLIC char *personal_mail_address = NULL; /* the users mail address */ -PUBLIC char *x_display = NULL; /* display environment variable */ +PUBLIC char *display = NULL; /* display environment variable */ PUBLIC char *personal_type_map = NULL; /* .mailcap */ PUBLIC char *global_type_map = NULL; /* global mailcap */ PUBLIC char *global_extension_map = NULL; /* global mime.types */ @@ -274,7 +287,6 @@ PUBLIC BOOLEAN LYNewsPosting = NEWS_POSTING; /* News posting supported? */ PUBLIC char *LynxSigFile = NULL; /* Signature file, in or off home */ PUBLIC char *system_mail = NULL; /* The path for sending mail */ PUBLIC char *system_mail_flags = NULL; /* Flags for sending mail */ -PUBLIC char *lynx_cfg_file = NULL; /* location of active lynx.cfg */ PUBLIC char *lynx_temp_space = NULL; /* The prefix for temporary file paths */ PUBLIC char *lynx_save_space = NULL; /* The prefix for save to disk paths */ PUBLIC char *LYHostName = NULL; /* treat as a local host name */ @@ -304,8 +316,8 @@ PUBLIC BOOLEAN LYRawMode; PUBLIC BOOLEAN LYDefaultRawMode; PUBLIC BOOLEAN LYUseDefaultRawMode = TRUE; PUBLIC char *UCAssume_MIMEcharset = NULL; -PUBLIC BOOLEAN UCSaveBookmarksInUnicode = FALSE; -PUBLIC BOOLEAN UCForce8bitTOUPPER = FALSE; /* override locale for case-conversion? */ +PUBLIC char *UCAssume_localMIMEcharset = NULL; +PUBLIC char *UCAssume_unrecMIMEcharset = NULL; PUBLIC int LYlines = 24; PUBLIC int LYcols = 80; PUBLIC int dump_output_width = 0; @@ -332,19 +344,12 @@ PUBLIC char *URLDomainSuffixes = NULL; PUBLIC BOOLEAN startfile_ok = FALSE; PUBLIC BOOLEAN LYSelectPopups = USE_SELECT_POPUPS; PUBLIC BOOLEAN LYUseDefSelPop = TRUE; /* Command line -popup toggle */ -PUBLIC BOOLEAN LYMultiBookmarks = MULTI_BOOKMARK_SUPPORT; +PUBLIC int LYMultiBookmarks = MULTI_BOOKMARK_SUPPORT; PUBLIC BOOLEAN LYMBMBlocked = BLOCK_MULTI_BOOKMARKS; PUBLIC BOOLEAN LYMBMAdvanced = TRUE; PUBLIC int LYStatusLine = -1; /* Line for statusline() if > -1 */ PUBLIC BOOLEAN LYCollapseBRs = COLLAPSE_BR_TAGS; /* Collapse serial BRs? */ PUBLIC BOOLEAN LYSetCookies = SET_COOKIES; /* Process Set-Cookie headers? */ -PUBLIC BOOLEAN LYAcceptAllCookies = ACCEPT_ALL_COOKIES; /* take all cookies? */ -PUBLIC char *LYCookieAcceptDomains = NULL; /* domains to accept all cookies */ -PUBLIC char *LYCookieRejectDomains = NULL; /* domains to reject all cookies */ -#ifdef EXP_PERSISTENT_COOKIES -BOOLEAN persistent_cookies = TRUE; -PUBLIC char *LYCookieFile = NULL; /* default cookie file */ -#endif /* EXP_PERSISTENT_COOKIES */ PUBLIC char *XLoadImageCommand = NULL; /* Default image viewer for X */ PUBLIC BOOLEAN LYNoISMAPifUSEMAP = FALSE; /* Omit ISMAP link if MAP present? */ PUBLIC int LYHiddenLinks = HIDDENLINKS_SEPARATE; /* Show hidden links? */ @@ -353,6 +358,7 @@ PUBLIC BOOL New_DTD = YES; PUBLIC FILE *LYTraceLogFP = NULL; /* Pointer for TRACE log */ PUBLIC char *LYTraceLogPath = NULL; /* Path for TRACE log */ PUBLIC BOOLEAN LYUseTraceLog = USE_TRACE_LOG; /* Use a TRACE log? */ +PUBLIC FILE LYOrigStderr; /* Original stderr pointer */ PUBLIC BOOLEAN LYSeekFragMAPinCur = TRUE; PUBLIC BOOLEAN LYSeekFragAREAinCur = TRUE; @@ -364,13 +370,6 @@ PUBLIC BOOLEAN LYPrependBaseToSource = TRUE; PUBLIC BOOLEAN LYPrependCharsetToSource = FALSE; PUBLIC BOOLEAN LYQuitDefaultYes = QUIT_DEFAULT_YES; -#ifdef DISP_PARTIAL -PUBLIC BOOLEAN display_partial = TRUE; /* Display document during download */ -PUBLIC BOOLEAN debug_display_partial = FALSE; /* Show with MessageSecs delay */ -PUBLIC BOOLEAN detected_forms_input_partial = FALSE; /* trimHightext temp fix */ -PUBLIC int partial_threshold = -1; /* # of lines to be d/l'ed until we repaint */ -#endif - /* These are declared in cutil.h for current freeWAIS libraries. - FM */ #ifdef DECLARE_WAIS_LOGFILES PUBLIC char *log_file_name = NULL; /* for WAIS log file name in libWWW */ @@ -380,6 +379,7 @@ PUBLIC FILE *logfile = NULL; /* for WAIS log file output in libWWW */ extern int HTNewsChunkSize; /* Number of news articles per chunk (HTNews.c) */ extern int HTNewsMaxChunk; /* Max news articles before chunking (HTNews.c) */ +PRIVATE BOOLEAN anon_restrictions_set = FALSE; PRIVATE BOOLEAN stack_dump = FALSE; PRIVATE char *terminal = NULL; PRIVATE char *pgm; @@ -387,9 +387,7 @@ PRIVATE BOOLEAN number_links = FALSE; PRIVATE BOOLEAN LYPrependBase = FALSE; PRIVATE HTList *LYStdinArgs = NULL; -PRIVATE void parse_arg PARAMS((char **arg, int *i)); -PRIVATE void print_help_and_exit PARAMS((int exit_status)); - +PRIVATE void parse_arg PARAMS((char **arg, int *i, int argc)); #ifndef VMS PUBLIC BOOLEAN LYNoCore = NO_FORCED_CORE_DUMP; PRIVATE void FatalProblem PARAMS((int sig)); @@ -400,25 +398,9 @@ PRIVATE void FatalProblem PARAMS((int sig)); #endif #ifdef __DJGPP__ -PRIVATE int LY_set_ctrl_break(int setting) -{ - (void)signal(SIGINT, (setting ? SIG_DFL : SIG_IGN)); - setcbrk(setting); -} - -PRIVATE int LY_get_ctrl_break(void) -{ - typedef union REGS Regs; - extern Regs regs; - regs.h.ah = 0x33; - regs.h.al = 0x00; - int86(0x21, ®s, ®s); - return ((int) regs.h.dl); -} - -PRIVATE void reset_break(void) +void reset_break() { - LY_set_ctrl_break(init_ctrl_break[0]); + PDC_set_ctrl_break(init_ctrl_break[0]); } #endif /* __DJGPP__ */ @@ -434,7 +416,23 @@ PRIVATE void free_lynx_globals NOARGS #ifdef LYNXCGI_LINKS /* WebSter Mods -jkt */ FREE(LYCgiDocumentRoot); #endif /* LYNXCGI_LINKS */ - free_lynx_cfg(); + FREE(lynx_version_putenv_command); + FREE(NNTPSERVER_putenv_cmd); + FREE(http_proxy_putenv_cmd); + FREE(https_proxy_putenv_cmd); + FREE(ftp_proxy_putenv_cmd); + FREE(gopher_proxy_putenv_cmd); + FREE(cso_proxy_putenv_cmd); + FREE(news_proxy_putenv_cmd); + FREE(newspost_proxy_putenv_cmd); + FREE(newsreply_proxy_putenv_cmd); + FREE(snews_proxy_putenv_cmd); + FREE(snewspost_proxy_putenv_cmd); + FREE(snewsreply_proxy_putenv_cmd); + FREE(nntp_proxy_putenv_cmd); + FREE(wais_proxy_putenv_cmd); + FREE(finger_proxy_putenv_cmd); + FREE(no_proxy_putenv_cmd); #endif /* !VMS */ #ifdef VMS @@ -451,7 +449,7 @@ PRIVATE void free_lynx_globals NOARGS FREE(jumpfile); #endif /* JUMPFILE */ FREE(indexfile); - FREE(x_display); + FREE(display); FREE(global_type_map); FREE(personal_type_map); FREE(global_extension_map); @@ -490,6 +488,8 @@ PRIVATE void free_lynx_globals NOARGS FREE(lynx_lss_file); #endif FREE(UCAssume_MIMEcharset); + FREE(UCAssume_unrecMIMEcharset); + FREE(UCAssume_localMIMEcharset); for (i = 0; i < nlinks; i++) { FREE(links[i].lname); } @@ -517,23 +517,6 @@ PRIVATE void LYStdinArgs_free NOARGS return; } -PRIVATE void exit_immediately ARGS1( - int, code) -{ -#ifndef NOSIGHUP - (void) signal(SIGHUP, SIG_DFL); -#endif /* NOSIGHUP */ - (void) signal(SIGTERM, SIG_DFL); -#ifndef VMS - (void) signal(SIGINT, SIG_DFL); -#endif /* !VMS */ -#ifdef SIGTSTP - if (no_suspend) - (void) signal(SIGTSTP, SIG_DFL); -#endif /* SIGTSTP */ - exit(code); -} - /* * Wow! Someone wants to start up Lynx. */ @@ -543,6 +526,8 @@ PUBLIC int main ARGS2( { int i; /* indexing variable */ int status = 0; /* exit status */ + int len; + char *lynx_cfg_file = NULL; char *temp = NULL; char *cp; FILE *fp; @@ -568,27 +553,26 @@ PUBLIC int main ARGS2( #endif /* _WINDOWS */ #ifdef __DJGPP__ - if (LY_get_ctrl_break() == 0) { - LY_set_ctrl_break(TRUE); - init_ctrl_break[0] = 0; - } else { - init_ctrl_break[0] = 1; - } +if (PDC_get_ctrl_break() == 0) { + PDC_set_ctrl_break(TRUE); + init_ctrl_break[0] = 0;} +else {init_ctrl_break[0] = 1;} atexit(reset_break); sock_init(); #endif - /* - * To prevent corrupting binary data on DOS, MS-WINDOWS or OS/2 - * we open files and stdout in BINARY mode by default. - * Where necessary we should open and (close!) TEXT mode. - * (use LYNewTxtFile/LYAppendToTxtFile to open text files for writing) - */ - SetDefaultMode(O_BINARY); - SetOutputMode(O_BINARY); +#if defined(_WINDOWS) || defined(DJGPP) + /* + * To prevent corrupting binary data with _WINDOWS and DJGPP + * we open files and stdout in BINARY mode by default. + * Where necessary we should open and (close!) TEXT mode. + */ + _fmode = O_BINARY; + setmode( fileno( stdout ), O_BINARY ); +#endif #ifdef DOSPATH - if (getenv("TERM")==NULL) putenv("TERM=vt100"); + terminal = "vt100"; #endif LYShowColor = (SHOW_COLOR ? SHOW_COLOR_ON : SHOW_COLOR_OFF); @@ -605,7 +589,7 @@ PUBLIC int main ARGS2( */ for (i = 1; i < argc; i++) { if (strncmp(argv[i], "-help", 5) == 0) { - parse_arg(&argv[i], &i); + parse_arg(&argv[i], &i, argc); } } @@ -697,34 +681,36 @@ PUBLIC int main ARGS2( StrAllocCat(lynx_version_putenv_command, LYNX_VERSION); putenv(lynx_version_putenv_command); #endif /* VMS */ - if ((cp = getenv("LYNX_TEMP_SPACE")) != NULL) StrAllocCopy(lynx_temp_space, cp); -#if defined (UNIX) - else if ((cp = getenv("TMPDIR")) != NULL) + else +#ifdef DOSPATH + if ((cp = getenv("TEMP")) != NULL) StrAllocCopy(lynx_temp_space, cp); -#endif -#if defined (DOSPATH) || defined (__EMX__) - else if ((cp = getenv("TEMP")) != NULL) - StrAllocCopy(lynx_temp_space, HTDOS_name(cp)); else if ((cp = getenv("TMP")) != NULL) - StrAllocCopy(lynx_temp_space, HTDOS_name(cp)); -#endif + StrAllocCopy(lynx_temp_space, cp); else -#ifdef TEMP_SPACE - StrAllocCopy(lynx_temp_space, TEMP_SPACE); + { + printf("You MUST define a valid TMP or TEMP area!\n"); + exit(-1); + } #else - { - printf("You MUST define a valid TMP or TEMP area!\n"); - exit(-1); - } + StrAllocCopy(lynx_temp_space, TEMP_SPACE); #endif - if ((cp = strchr(lynx_temp_space, '~'))) { *(cp++) = '\0'; StrAllocCopy(temp, lynx_temp_space); - LYTrimPathSep(temp); - StrAllocCat(temp, wwwName(Home_Dir())); + if (((len = strlen(temp)) > 0) && temp[len-1] == '/') + temp[len-1] = '\0'; +#ifdef DOSPATH + StrAllocCat(temp, HTDOS_wwwName((char *)Home_Dir())); +#else +#ifdef VMS + StrAllocCat(temp, HTVMS_wwwName((char *)Home_Dir())); +#else + StrAllocCat(temp, Home_Dir()); +#endif /* VMS */ +#endif /* DOSPATH */ StrAllocCat(temp, cp); StrAllocCopy(lynx_temp_space, temp); FREE(temp); @@ -744,12 +730,14 @@ PUBLIC int main ARGS2( } } #ifdef VMS - LYLowerCase(lynx_temp_space); + for (i = 0; lynx_temp_space[i]; i++) + lynx_temp_space[i] = TOLOWER(lynx_temp_space[i]); if (strchr(lynx_temp_space, '/') != NULL) { - if (strlen(lynx_temp_space) == 1) { + if ((len = strlen(lynx_temp_space)) == 1) { StrAllocCopy(lynx_temp_space, "sys$scratch:"); } else { - LYAddPathSep(&lynx_temp_space); + if (lynx_temp_space[len-1] != '/') + StrAllocCat(lynx_temp_space, "/"); StrAllocCopy(temp, HTVMS_name("", lynx_temp_space)); StrAllocCopy(lynx_temp_space, temp); FREE(temp); @@ -760,7 +748,17 @@ PUBLIC int main ARGS2( StrAllocCat(lynx_temp_space, ":"); } #else - LYAddPathSep(&lynx_temp_space); +#if !defined(__DJGPP__) && !defined(_WINDOWS) + if (((len = strlen(lynx_temp_space)) > 1) && + lynx_temp_space[len-1] != '/') { + StrAllocCat(lynx_temp_space, "/"); + } +#else + if (((len = strlen(lynx_temp_space)) > 1) && + lynx_temp_space[len-1] != '\\') { + StrAllocCat(lynx_temp_space, "\\"); + } +#endif /* !__DJGPP__ && !_WINDOWS */ #endif /* VMS */ #ifdef VMS StrAllocCopy(mail_adrs, MAIL_ADRS); @@ -777,6 +775,19 @@ PUBLIC int main ARGS2( StrAllocCopy(URLDomainPrefixes, URL_DOMAIN_PREFIXES); StrAllocCopy(URLDomainSuffixes, URL_DOMAIN_SUFFIXES); StrAllocCopy(XLoadImageCommand, XLOADIMAGE_COMMAND); + /* + * Set up the compilation default character set. - FM + */ + for (i = 0; LYchar_set_names[i]; i++) { + if (!strncmp(CHARACTER_SET, LYchar_set_names[i], + strlen(CHARACTER_SET))) { + current_char_set=i; + break; + } + } + if (!LYchar_set_names[i]) + current_char_set = i = 0; + HTMLSetRawModeDefault(i); /* * Disable news posting if the compilation-based @@ -805,7 +816,7 @@ PUBLIC int main ARGS2( } else if (strncmp(argv[i], "-anonymous", 10) == 0) { if (!LYValidate) parse_restrictions("default"); - LYRestricted = TRUE; + anon_restrictions_set = TRUE; } else if (strcmp(argv[i], "-validate") == 0) { /* * Follow only http URLs. @@ -831,7 +842,8 @@ PUBLIC int main ARGS2( StrAllocCopy(lynx_lss_file, argv[i+1]); i++; } - CTRACE(tfp, "LYMain found -lss flag, lss file is %s\n", + if (TRACE) + fprintf(stderr, "LYMain found -lss flag, lss file is %s\n", lynx_lss_file ? lynx_lss_file : "<NONE>"); #endif } @@ -877,9 +889,9 @@ PUBLIC int main ARGS2( LYUseTraceLog = TRUE; } } else if (strncmp(buf, "-anonymous", 10) == 0) { - if (!LYValidate && !LYRestricted) + if (!LYValidate && !anon_restrictions_set) parse_restrictions("default"); - LYRestricted = TRUE; + anon_restrictions_set = TRUE; } else if (strcmp(buf, "-validate") == 0) { /* * Follow only http URLs. @@ -893,8 +905,11 @@ PUBLIC int main ARGS2( if ((cp = strchr(buf,'=')) != NULL) { StrAllocCopy(lynx_cfg_file, cp+1); } else { - cp = LYSkipNonBlanks(buf); - cp = LYSkipBlanks(cp); + cp = buf; + while (*cp && !isspace((unsigned char)*cp)) + cp++; + while (*cp && isspace((unsigned char)*cp)) + cp++; if (*cp) StrAllocCopy(lynx_cfg_file, cp); } @@ -903,12 +918,16 @@ PUBLIC int main ARGS2( if ((cp = strchr(buf,'=')) != NULL) { StrAllocCopy(lynx_lss_file, cp+1); } else { - cp = LYSkipNonBlanks(buf); - cp = LYSkipBlanks(cp); + cp = buf; + while (*cp && !isspace((unsigned char)*cp)) + cp++; + while (*cp && isspace((unsigned char)*cp)) + cp++; if (*cp) - StrAllocCopy(lynx_lss_file, cp); + StrAllocCopy(lynx_cfg_file, cp); } - CTRACE(tfp, "LYMain found -lss flag, lss file is %s\n", + if (TRACE) + fprintf(stderr, "LYMain found -lss flag, lss file is %s\n", lynx_lss_file ? lynx_lss_file : "<NONE>"); #endif } else if (strcmp(buf, "-get_data") == 0) { @@ -1021,29 +1040,33 @@ PUBLIC int main ARGS2( * set the default restrictions for that account and disallow * a TRACE log NOW. - FM */ - if (!LYValidate && !LYRestricted && + if (!LYValidate && !anon_restrictions_set && strlen((char *)ANONYMOUS_USER) > 0 && #if defined (VMS) || defined (NOUSERS) !strcasecomp(((char *)getenv("USER")==NULL ? " " : getenv("USER")), - ANONYMOUS_USER)) + ANONYMOUS_USER)) { #else #if HAVE_CUSERID - STREQ((char *)cuserid((char *) NULL), ANONYMOUS_USER)) + STREQ((char *)cuserid((char *) NULL), ANONYMOUS_USER)) { #else - STREQ(((char *)getlogin()==NULL ? " " : getlogin()), ANONYMOUS_USER)) + STREQ(((char *)getlogin()==NULL ? " " : getlogin()), ANONYMOUS_USER)) { #endif /* HAVE_CUSERID */ #endif /* VMS */ - { parse_restrictions("default"); - LYRestricted = TRUE; + anon_restrictions_set = TRUE; LYUseTraceLog = FALSE; } /* * Set up the TRACE log path, and logging if appropriate. - FM */ - LYAddPathToHome(LYTraceLogPath = malloc(LY_MAXPATH), LY_MAXPATH, "Lynx.trace"); - +#ifdef VMS + StrAllocCopy(LYTraceLogPath, "sys$login:Lynx.trace"); +#else + StrAllocCopy(LYTraceLogPath, (Home_Dir() ? Home_Dir() : "")); + StrAllocCat(LYTraceLogPath, "/Lynx.trace"); +#endif /* VMS */ + LYOrigStderr = *stderr; if (TRACE && LYUseTraceLog) { /* * If we can't open it for writing, give up. @@ -1057,8 +1080,9 @@ PUBLIC int main ARGS2( exit(-1); } #ifdef VMS - LYCloseTracelog(); - HTSYS_remove(LYTraceLogPath); + fclose(LYTraceLogFP); + while (remove(LYTraceLogPath) == 0) + ; if ((LYTraceLogFP = LYNewTxtFile(LYTraceLogPath)) == NULL) { WWW_TraceFlag = FALSE; printf("%s\n", TRACELOG_OPEN_FAILED); @@ -1067,15 +1091,16 @@ PUBLIC int main ARGS2( #endif /* VMS */ fflush(stdout); fflush(stderr); - fprintf(tfp, "\t\t%s\n\n", LYNX_TRACELOG_TITLE); + *stderr = *LYTraceLogFP; + fprintf(stderr, "\t\t%s\n\n", LYNX_TRACELOG_TITLE); } /* * If TRACE is on, indicate whether the * anonymous restrictions are set. - FM */ - if (LYRestricted) { - CTRACE(tfp, "LYMain: Anonymous restrictions set.\n"); + if (TRACE && anon_restrictions_set) { + fprintf(stderr, "LYMain: Anonymous restrictions set.\n"); } /* @@ -1091,7 +1116,8 @@ PUBLIC int main ARGS2( } else { sprintf(temp, "JUMPFILE:%s", jumpfile); if (!LYJumpInit(temp)) { - CTRACE(tfp, "Failed to register %s\n", temp); + if (TRACE) + fprintf(stderr, "Failed to register %s\n", temp); } FREE(temp); } @@ -1120,7 +1146,7 @@ PUBLIC int main ARGS2( */ #ifndef _WINDOWS /* avoid the whole ~ thing for now */ /* I think this should only be performed if lynx_cfg_file starts with ~/ */ - if ((lynx_cfg_file[0] == '~') && LYIsPathSep(lynx_cfg_file[1])) + if ((lynx_cfg_file[0] == '~') && (lynx_cfg_file[1] == '/')) { #ifdef VMS StrAllocCopy(temp, HTVMS_wwwName((char *)Home_Dir())); @@ -1144,11 +1170,6 @@ PUBLIC int main ARGS2( } fclose(fp); -#if defined(USE_KEYMAPS) && defined(USE_SLANG) - if (-1 == lynx_initialize_keymaps ()) - exit (-1); -#endif - /* * Make sure we have the character sets declared. * This will initialize the CHARTRANS handling. - KW @@ -1157,22 +1178,6 @@ PUBLIC int main ARGS2( fprintf(stderr, "\nLynx character sets not declared.\n\n"); exit(-1); } - /* - * (**) in Lynx, UCLYhndl_HTFile_for_unspec and UCLYhndl_for_unrec may be - * valid or not, but current_char_set and UCLYhndl_for_unspec SHOULD - * ALWAYS be a valid charset. Initialized here and may be changed later - * from lynx.cfg/command_line/options_menu. - LP (**) - */ - /* - * Set up the compilation default character set. - FM - */ - current_char_set = safeUCGetLYhndl_byMIME(CHARACTER_SET); - /* - * Set up HTTP default for unlabeled charset (iso-8859-1). - */ - UCLYhndl_for_unspec = LATIN1; - StrAllocCopy(UCAssume_MIMEcharset, - LYCharSet_UC[UCLYhndl_for_unspec].MIMEname); #if defined(USE_HASH) /* @@ -1198,7 +1203,8 @@ PUBLIC int main ARGS2( if ((cp = strchr(lynx_lss_file, '~'))) { *(cp++) = '\0'; StrAllocCopy(temp, lynx_lss_file); - LYTrimPathSep(temp); + if ((len=strlen(temp)) > 0 && temp[len-1] == '/') + temp[len-1] = '\0'; #ifdef VMS StrAllocCat(temp, HTVMS_wwwName((char *)Home_Dir())); #else @@ -1213,7 +1219,7 @@ PUBLIC int main ARGS2( * inform the user and exit. */ if ((fp = fopen(lynx_lss_file, "r")) == NULL) { - fprintf(stderr, "\nLynx file %s is not available.\n\n", + fprintf(stderr, "\nLynxile file %s is not available.\n\n", lynx_lss_file); } else @@ -1246,15 +1252,19 @@ PUBLIC int main ARGS2( StrAllocCopy(LynxSigFile, filename); LYAddPathToHome(filename, sizeof(filename), LynxSigFile); StrAllocCopy(LynxSigFile, filename); - CTRACE(tfp, "LYNX_SIG_FILE set to '%s'\n", LynxSigFile); + if (TRACE) + fprintf(stderr, "LYNX_SIG_FILE set to '%s'\n", LynxSigFile); } else { - CTRACE(tfp, "LYNX_SIG_FILE '%s' is bad. Ignoring.\n", LYNX_SIG_FILE); + if (TRACE) + fprintf(stderr, "LYNX_SIG_FILE '%s' is bad. Ignoring.\n", + LYNX_SIG_FILE); } /* * Process the configuration file. */ - read_cfg(lynx_cfg_file, "main program", 1, (FILE *)0); + read_cfg(lynx_cfg_file, "main program", 1); + FREE(lynx_cfg_file); HTSwitchDTD(New_DTD); @@ -1276,19 +1286,30 @@ PUBLIC int main ARGS2( if ((cp = strchr(lynx_save_space, '~')) != NULL) { *(cp++) = '\0'; StrAllocCopy(temp, lynx_save_space); - LYTrimPathSep(temp); - StrAllocCat(temp, wwwName(Home_Dir())); + if (((len = strlen(temp)) > 0) && temp[len-1] == '/') + temp[len-1] = '\0'; +#ifdef DOSPATH + StrAllocCat(temp, HTDOS_wwwName((char *)Home_Dir())); +#else +#ifdef VMS + StrAllocCat(temp, HTVMS_wwwName((char *)Home_Dir())); +#else + StrAllocCat(temp, Home_Dir()); +#endif /* VMS */ +#endif /* DOSPATH */ StrAllocCat(temp, cp); StrAllocCopy(lynx_save_space, temp); FREE(temp); } #ifdef VMS - LYLowerCase(lynx_save_space); + for (i = 0; lynx_save_space[i]; i++) + lynx_save_space[i] = TOLOWER(lynx_save_space[i]); if (strchr(lynx_save_space, '/') != NULL) { - if (strlen(lynx_save_space) == 1) { + if ((len = strlen(lynx_save_space)) == 1) { StrAllocCopy(lynx_save_space, "sys$login:"); } else { - LYAddPathSep(&lynx_save_space); + if (lynx_save_space[len-1] != '/') + StrAllocCat(lynx_save_space, "/"); StrAllocCopy(temp, HTVMS_name("", lynx_save_space)); StrAllocCopy(lynx_save_space, temp); FREE(temp); @@ -1299,7 +1320,12 @@ PUBLIC int main ARGS2( StrAllocCat(lynx_save_space, ":"); } #else - LYAddPathSep(&lynx_save_space); + { + if (((len = strlen(lynx_save_space)) > 1) && + lynx_save_space[len-1] != '/') { + StrAllocCat(lynx_save_space, "/"); + } + } #endif /* VMS */ } @@ -1346,7 +1372,7 @@ PUBLIC int main ARGS2( * Process any command line arguments not already handled. - FM */ for (i = 1; i < argc; i++) { - parse_arg(&argv[i], &i); + parse_arg(&argv[i], &i, argc); } /* @@ -1359,7 +1385,7 @@ PUBLIC int main ARGS2( my_args[1] = NULL; while (NULL != (my_args[0] = (char *)HTList_nextObject(cur))) { - parse_arg(my_args, (int *)0); + parse_arg(my_args, NULL, -1); } LYStdinArgs_free(); } @@ -1501,75 +1527,6 @@ PUBLIC int main ARGS2( */ HTMLUseCharacterSet(current_char_set); -#ifdef EXP_PERSISTENT_COOKIES - /* - * Sod it, this looks like a reasonable place to load the - * cookies file, probably. - RP - */ - if (persistent_cookies) { - if(LYCookieFile == NULL) { - LYAddPathToHome(LYCookieFile = malloc(LY_MAXPATH), LY_MAXPATH, COOKIE_FILE); - } else { - if ((cp = strchr(LYCookieFile, '~'))) { - temp = NULL; - *(cp++) = '\0'; - StrAllocCopy(temp, cp); - LYTrimPathSep(temp); - StrAllocCopy(LYCookieFile, wwwName(Home_Dir())); - StrAllocCat(LYCookieFile, temp); - FREE(temp); - } - } - LYLoadCookies(LYCookieFile); - } -#endif - -#ifdef SIGTSTP - /* - * Block Control-Z suspending if requested. - FM - */ - if (no_suspend) - (void) signal(SIGTSTP,SIG_IGN); -#endif /* SIGTSTP */ - - /* - * Check for a valid HEAD request. - FM - */ - if (HEAD_request && LYCanDoHEAD(startfile) != TRUE) { - fprintf(stderr, - "The '-head' switch is for http HEAD requests and cannot be used for\n'%s'.\n", - startfile); - exit_immediately(-1); - } - - /* - * Check for a valid MIME headers request. - FM - */ - if (keep_mime_headers && LYCanDoHEAD(startfile) != TRUE) { - fprintf(stderr, - "The '-mime_header' switch is for http URLs and cannot be used for\n'%s'.\n", - startfile); - exit_immediately(-1); - } - - /* - * Check for a valid traversal request. - FM - */ - if (traversal && strncmp(startfile, "http", 4)) { - fprintf(stderr, - "The '-traversal' switch is for http URLs and cannot be used for\n'%s'.\n", - startfile); - exit_immediately(-1); - } - - /* - * Finish setting up for an INTERACTIVE session. - * Done here so that URL guessing in LYEnsureAbsoluteURL() can be - * interruptible (terminal is in raw mode, select() works). -BL - */ - if (!dump_output_immediately) { - setup(terminal); - } /* * If startfile is a file URL and the host is defaulted, * force in "//localhost", and if it's not an absolute URL, @@ -1609,27 +1566,105 @@ PUBLIC int main ARGS2( ftp_ok = !no_inside_ftp && !no_outside_ftp && ftp_ok; rlogin_ok = !no_inside_rlogin && !no_outside_rlogin && rlogin_ok; #else - CTRACE(tfp,"LYMain.c: User in Local domain\n"); + if (TRACE) + fprintf(stderr,"LYMain.c: User in Local domain\n"); telnet_ok = !no_inside_telnet && telnet_ok; news_ok = !no_inside_news && news_ok; ftp_ok = !no_inside_ftp && ftp_ok; rlogin_ok = !no_inside_rlogin && rlogin_ok; #endif /* !HAVE_UTMP || VMS */ } else { - CTRACE(tfp,"LYMain.c: User in REMOTE domain\n"); + if (TRACE) + fprintf(stderr,"LYMain.c: User in REMOTE domain\n"); telnet_ok = !no_outside_telnet && telnet_ok; news_ok = !no_outside_news && news_ok; ftp_ok = !no_outside_ftp && ftp_ok; rlogin_ok = !no_outside_rlogin && rlogin_ok; } +#ifdef SIGTSTP + /* + * Block Control-Z suspending if requested. - FM + */ + if (no_suspend) + (void) signal(SIGTSTP,SIG_IGN); +#endif /* SIGTSTP */ + + /* + * Check for a valid HEAD request. - FM + */ + if (HEAD_request && LYCanDoHEAD(startfile) != TRUE) { + fprintf(stderr, + "The '-head' switch is for http HEAD requests and cannot be used for\n'%s'.\n", + startfile); +#ifndef NOSIGHUP + (void) signal(SIGHUP, SIG_DFL); +#endif /* NOSIGHUP */ + (void) signal(SIGTERM, SIG_DFL); +#ifndef VMS + (void) signal(SIGINT, SIG_DFL); +#endif /* !VMS */ +#ifdef SIGTSTP + if (no_suspend) + (void) signal(SIGTSTP,SIG_DFL); +#endif /* SIGTSTP */ + exit(-1); + } + + /* + * Check for a valid MIME headers request. - FM + */ + if (keep_mime_headers && LYCanDoHEAD(startfile) != TRUE) { + fprintf(stderr, + "The '-mime_header' switch is for http URLs and cannot be used for\n'%s'.\n", + startfile); +#ifndef NOSIGHUP + (void) signal(SIGHUP, SIG_DFL); +#endif /* NOSIGHUP */ + (void) signal(SIGTERM, SIG_DFL); +#ifndef VMS + (void) signal(SIGINT, SIG_DFL); +#endif /* !VMS */ +#ifdef SIGTSTP + if (no_suspend) + (void) signal(SIGTSTP,SIG_DFL); +#endif /* SIGTSTP */ + exit(-1); + } + + /* + * Check for a valid traversal request. - FM + */ + if (traversal && strncmp(startfile, "http", 4)) { + fprintf(stderr, + "The '-traversal' switch is for http URLs and cannot be used for\n'%s'.\n", + startfile); +#ifndef NOSIGHUP + (void) signal(SIGHUP, SIG_DFL); +#endif /* NOSIGHUP */ + (void) signal(SIGTERM, SIG_DFL); +#ifndef VMS + (void) signal(SIGINT, SIG_DFL); +#endif /* !VMS */ +#ifdef SIGTSTP + if (no_suspend) + (void) signal(SIGTSTP,SIG_DFL); +#endif /* SIGTSTP */ + exit(-1); + } + /* * Set up our help and about file base paths. - FM */ StrAllocCopy(helpfilepath, helpfile); - if ((cp = LYPathLeaf(helpfilepath)) != helpfilepath) - *cp = '\0'; - LYAddHtmlSep(&helpfilepath); + if ((cp=strrchr(helpfilepath, '/')) != NULL) + *cp = '\0'; + /* + * Remove code to merge the historical about_lynx + * directory into lynx_help. - HN + */ + StrAllocCat(helpfilepath, "/"); + /* * Make sure our bookmark default strings @@ -1663,7 +1698,7 @@ PUBLIC int main ARGS2( keypad_mode = LINKS_ARE_NUMBERED; } } - if (x_display != NULL && *x_display != '\0') { + if (display != NULL && *display != '\0') { LYisConfiguredForX = TRUE; } if (dump_output_width > 0) { @@ -1674,21 +1709,33 @@ PUBLIC int main ARGS2( (keypad_mode == LINKS_ARE_NUMBERED || keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED)) printlist(stdout,FALSE); - exit_immediately(status); +#ifndef NOSIGHUP + (void) signal(SIGHUP, SIG_DFL); +#endif /* NOSIGHUP */ + (void) signal(SIGTERM, SIG_DFL); +#ifndef VMS + (void) signal(SIGINT, SIG_DFL); +#endif /* !VMS */ +#ifdef SIGTSTP + if (no_suspend) + (void) signal(SIGTSTP,SIG_DFL); +#endif /* SIGTSTP */ } else { /* - * Start an INTERACTIVE session. - FM + * Finish setting up and start an + * INTERACTIVE session. - FM */ - if (x_display != NULL && *x_display != '\0') { - LYisConfiguredForX = TRUE; + if (setup(terminal)) { + if (display != NULL && *display != '\0') { + LYisConfiguredForX = TRUE; + } + ena_csi((LYlowest_eightbit[current_char_set] > 155)); + status = mainloop(); + cleanup(); } - ena_csi((LYlowest_eightbit[current_char_set] > 155)); - status = mainloop(); - cleanup(); - exit(status); } - return(status); /* though redundant, for compiler-warnings */ + exit(status); } /* @@ -1716,579 +1763,682 @@ PUBLIC void LYRegisterLynxProtocols NOARGS HTRegisterProtocol(&LYLynxCookies); } -/* There are different ways of setting arguments on the command line, and - * there are different types of arguments. These include: - * - * -set_some_variable ==> some_variable = TRUE - * -toggle_some_variable ==> some_variable = !some_variable - * -some_variable=value ==> some_variable = value - * - * Others are complicated and require a function call. - */ - -struct parse_args_type; -typedef int (*ParseFunc) PARAMS((struct parse_args_type *, char **, char *)); - -typedef union { - BOOLEAN * set_value; - int * int_value; - char ** str_value; - ParseFunc fun_value; -} ParseUnion; - -#undef PARSE_DEBUG - /* - * Storing the four types of data in separate fields costs about 1K of data. - * However, this provides usable type-checking. The initial version of the - * parse_args_type used 'long' for all types, and dumped core when processing - * "lynx -help". (The compiler was unable to detect some minor errors). + * Parse one argument, optionally picking up the next entry in argv (if + * appropriate). */ -#ifdef PARSE_DEBUG -#define ParseData BOOLEAN *set_value; int *int_value; char **str_value; ParseFunc fun_value -#define PARSE_SET(n,t,v,h) {n,t, v, 0, 0, 0, h} -#define PARSE_INT(n,t,v,h) {n,t, 0, &v, 0, 0, h} -#define PARSE_STR(n,t,v,h) {n,t, 0, 0, v, 0, h} -#define PARSE_FUN(n,t,v,h) {n,t, 0, 0, 0, v, h} -#else -#define ParseData long value -#define PARSE_SET(n,t,v,h) {n,t, (long) (v), h} -#define PARSE_INT(n,t,v,h) {n,t, (long)&(v), h} -#define PARSE_STR(n,t,v,h) {n,t, (long) (v), h} -#define PARSE_FUN(n,t,v,h) {n,t, (long) (v), h} -#endif -typedef struct parse_args_type +PRIVATE char * scan3D ARGS2( + char **, argv, + int *, i) { - CONST char *name; - int type; -#define IGNORE_ARG 0x000 -#define TOGGLE_ARG 0x001 -#define SET_ARG 0x002 -#define UNSET_ARG 0x003 -#define FUNCTION_ARG 0x004 -#define LYSTRING_ARG 0x005 -#define INT_ARG 0x006 -#define STRING_ARG 0x007 -#define ARG_TYPE_MASK 0x0FF -#define NEED_NEXT_ARG 0x100 - -#define NEED_INT_ARG (NEED_NEXT_ARG | INT_ARG) -#define NEED_LYSTRING_ARG (NEED_NEXT_ARG | LYSTRING_ARG) -#define NEED_STRING_ARG (NEED_NEXT_ARG | STRING_ARG) -#define NEED_FUNCTION_ARG (NEED_NEXT_ARG | FUNCTION_ARG) - - /* If the NEED_NEXT_ARG flags is set, and the option was not specified - * with an '=' character, then use the next argument in the argv list. - */ - - ParseData; - CONST char *help_string; + char *result; + + if ((result=strchr(argv[0],'=')) != NULL) + return result+1; + if (argv[1] && i) + (*i)++; /* Let master know we've stolen an argument */ + return argv[1]; } -Parse_Args_Type; -/* -auth, -pauth */ -static int parse_authentication ARGS2( - char *, next_arg, - char **, result) +PRIVATE void parse_arg ARGS3( + char **, argv, + int *, i, + int, argc) { + char *cp; +#ifndef VMS + static char display_putenv_command[142]; +#endif /* !VMS */ +#define nextarg ((cp=scan3D(&argv[0], i))!=NULL) + /* - * Authentication information for protected documents. + * Check for a command line startfile. - FM */ - char *auth_info = 0; + if (argv[0][0] != '-') { + StrAllocCopy(startfile, argv[0]); + LYTrimHead(startfile); + if (!strncasecomp(startfile, "lynxexec:", 9) || + !strncasecomp(startfile, "lynxprog:", 9)) { + /* + * The original implementations of these schemes expected + * white space without hex escaping, and did not check + * for hex escaping, so we'll continue to support that, + * until that code is redone in conformance with SGML + * principles. - FM + */ + HTUnEscapeSome(startfile, " \r\n\t"); + convert_to_spaces(startfile, TRUE); + } + return; + } - if (next_arg != 0) { - StrAllocCopy(auth_info, next_arg); - memset(next_arg, ' ', strlen(next_arg)); /* Let's not show too much */ + /* + * Skip any lone "-" arguments, because we've loaded + * the stdin input into an HTList structure for + * special handling. - FM + */ + if (strcmp(argv[0], "-") == 0) { + return; } - if (auth_info != 0) { - char *cp; + switch (TOLOWER(argv[0][1])) { + + case 'a': + if (strncmp(argv[0], "-anonymous", 10) == 0) { + /* + * Should already have been set, so we don't + * override or replace any additional + * restrictions from the command line. - FM + */ + if (!anon_restrictions_set) + parse_restrictions("default"); + anon_restrictions_set = TRUE; + + } else if ((strncmp(argv[0], "-assume_charset", 15) == 0) || + (strncmp(argv[0], "-assume_local_charset", 21) == 0) || + (strncmp(argv[0], "-assume_unrec_charset", 21) == 0)) { + BOOL local_flag = (argv[0][8] == 'l'); + BOOL unrec_flag = (argv[0][8] == 'u'); + + if (nextarg) { + int j; - if ((cp = strchr(auth_info, ':')) != 0) { /* Pw */ - *cp++ = '\0'; /* Terminate ID */ - HTUnEscape(cp); - StrAllocCopy(result[1], cp); + for (j = 0; cp[j]; j++) + cp[j] = TOLOWER(cp[j]); + if (local_flag) { + StrAllocCopy(UCAssume_localMIMEcharset, cp); + if (UCAssume_localMIMEcharset && *UCAssume_localMIMEcharset) + UCLYhndl_HTFile_for_unspec = + UCGetLYhndl_byMIME(UCAssume_localMIMEcharset); + } else if (unrec_flag) { + StrAllocCopy(UCAssume_unrecMIMEcharset, cp); + if (UCAssume_unrecMIMEcharset && *UCAssume_unrecMIMEcharset) + UCLYhndl_for_unrec = + UCGetLYhndl_byMIME(UCAssume_unrecMIMEcharset); + } else { + StrAllocCopy(UCAssume_MIMEcharset, cp); + if (UCAssume_MIMEcharset && *UCAssume_MIMEcharset) + UCLYhndl_for_unspec = + UCGetLYhndl_byMIME(UCAssume_MIMEcharset); + } + } else { + if (local_flag) + UCLYhndl_HTFile_for_unspec = 0; + else if (unrec_flag) + UCLYhndl_for_unrec = 0; + else + UCLYhndl_for_unspec = 0; } - if (*auth_info) { /* Id */ - HTUnEscape(auth_info); - StrAllocCopy(result[0], auth_info); + + } else if (strncmp(argv[0], "-auth", 5) == 0) { + /* + * Authentication information for protected documents. + */ + char *auth_info = NULL; + + if (nextarg) { + StrAllocCopy(auth_info, cp); + memset(cp, ' ', strlen(cp)); /* Let's not show too much */ } - FREE(auth_info); + if (auth_info != NULL) { + if ((cp = strchr(auth_info, ':')) != NULL) { /* Pw */ + *cp++ = '\0'; /* Terminate ID */ + if (*cp) { + HTUnEscape(cp); + StrAllocCopy(authentication_info[1], cp); + } + } + if (*auth_info) { /* Id */ + HTUnEscape(auth_info); + StrAllocCopy(authentication_info[0], auth_info); + } + FREE(auth_info); + } + + } else { + goto Output_Error_and_Help_List; } - return 0; -} + break; -/* -anonymous */ -static int anonymous_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - /* - * Should already have been set, so we don't - * override or replace any additional - * restrictions from the command line. - FM - */ - if (!LYRestricted) - parse_restrictions("default"); - LYRestricted = TRUE; - return 0; -} + case 'b': + if (strcmp(argv[0], "-base") == 0) { + /* + * Treat -source equivalently to an interactive + * download with LYPrefixBaseToSource configured + * to TRUE, so that a BASE tag is prepended for + * text/html content types. We normally treat + * the module-wide global LYPrefixBaseToSource + * flag as FALSE with -source, but force it TRUE, + * later, if LYPrependBase is set TRUE here. - FM + */ + LYPrependBase = TRUE; + if (HTOutputFormat == HTAtom_for("www/dump")) { + HTOutputFormat = HTAtom_for("www/download"); + } -/* -assume_charset */ -static int assume_charset_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - UCLYhndl_for_unspec = safeUCGetLYhndl_byMIME(next_arg); - StrAllocCopy(UCAssume_MIMEcharset, - LYCharSet_UC[UCLYhndl_for_unspec].MIMEname); -/* this may be a memory for bogus typo - - StrAllocCopy(UCAssume_MIMEcharset, next_arg); - LYLowerCase(UCAssume_MIMEcharset); */ - - return 0; -} + } else if (strcmp(argv[0], "-book") == 0) { + /* + * Use bookmarks as startfile. + */ + bookmark_start = TRUE; -/* -assume_local_charset */ -static int assume_local_charset_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - UCLYhndl_HTFile_for_unspec = safeUCGetLYhndl_byMIME(next_arg); - return 0; -} + } else if (strcmp(argv[0], "-buried_news") == 0) { + /* + * Toggle scans for buried news references. + */ + if (scan_for_buried_news_references) + scan_for_buried_news_references = FALSE; + else + scan_for_buried_news_references = TRUE; -/* -assume_unrec_charset */ -static int assume_unrec_charset_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - UCLYhndl_for_unrec = safeUCGetLYhndl_byMIME(next_arg); - return 0; -} +#ifdef USE_SLANG + } else if (strncmp(argv[0], "-blink", 6) == 0) { + Lynx_Color_Flags |= SL_LYNX_USE_BLINK; +#endif /* USE_SLANG */ -/* -auth */ -static int auth_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - parse_authentication(next_arg, authentication_info); - return 0; -} + } else { + goto Output_Error_and_Help_List; + } + break; -/* -base */ -static int base_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - /* - * Treat -source equivalently to an interactive download with - * LYPrefixBaseToSource configured to TRUE, so that a BASE tag is - * prepended for text/html content types. We normally treat the - * module-wide global LYPrefixBaseToSource flag as FALSE with - * -source, but force it TRUE, later, if LYPrependBase is set - * TRUE here. - FM - */ - LYPrependBase = TRUE; - if (HTOutputFormat == HTAtom_for("www/dump")) - HTOutputFormat = HTAtom_for("www/download"); + case 'c': + if (strncmp(argv[0], "-cache", 6) == 0) { + if (nextarg) + HTCacheSize = atoi(cp); + /* + * Limit size. + */ + if (HTCacheSize < 2) HTCacheSize = 2; - return 0; -} + } else if (strncmp(argv[0], "-case", 5) == 0) { + case_sensitive = TRUE; -#ifdef USE_SLANG -/* -blink */ -static int blink_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - Lynx_Color_Flags |= SL_LYNX_USE_BLINK; - return 0; -} -#endif + } else if (strncmp(argv[0], "-cfg", 4) == 0) { + /* + * Already read the alternate configuration file + * so just check whether we need to increment i + */ + if (nextarg) + ; /* do nothing */ -/* -cache */ -static int cache_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - if (next_arg != 0) - HTCacheSize = atoi(next_arg); - /* - * Limit size. - */ - if (HTCacheSize < 2) HTCacheSize = 2; + } else if (strncmp(argv[0], "-child", 6) == 0) { + child_lynx = TRUE; + no_disk_save = TRUE; - return 0; -} +#ifdef USE_SLANG + } else if (strncmp(argv[0], "-color", 6) == 0) { + Lynx_Color_Flags |= SL_LYNX_USE_COLOR; + if (LYShowColor != SHOW_COLOR_ALWAYS) { + LYShowColor = SHOW_COLOR_ON; + } +#endif /* USE_SLANG */ -/* -child */ -static int child_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - child_lynx = TRUE; - no_disk_save = TRUE; - return 0; -} + } else if (strncmp(argv[0], "-crawl", 6) == 0) { + crawl = TRUE; + LYcols = 80; -#ifdef USE_SLANG -/* -color */ -static int color_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - Lynx_Color_Flags |= SL_LYNX_USE_COLOR; + } else if (strncmp(argv[0], "-cookies", 8) == 0) { + if (LYSetCookies) + LYSetCookies = FALSE; + else + LYSetCookies = TRUE; - if (LYShowColor != SHOW_COLOR_ALWAYS) - LYShowColor = SHOW_COLOR_ON; +#ifndef VMS + } else if (strncmp(argv[0], "-core", 5) == 0) { + if (LYNoCore) + LYNoCore = FALSE; + else + LYNoCore = TRUE; +#endif /* !VMS */ - return 0; -} -#endif + } else { + goto Output_Error_and_Help_List; + } + break; -/* -crawl */ -static int crawl_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - crawl = TRUE; - LYcols = 80; - return 0; -} + case 'd': + if (strncmp(argv[0], "-display", 8) == 0) { + if (nextarg) { +#ifdef VMS + int j; + for (j = 0; cp[j]; j++) + cp[j] = TOUPPER(cp[j]); + Define_VMSLogical(DISPLAY, cp ? cp : ""); +#else + sprintf(display_putenv_command, "DISPLAY=%s", cp ? cp : ""); + putenv(display_putenv_command); +#endif /* VMS */ + if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { + StrAllocCopy(display, cp); + } + } -/* -display */ -static int display_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - if (next_arg != 0) { - LYsetXDisplay(next_arg); - if ((next_arg = LYgetXDisplay()) != 0) - StrAllocCopy(x_display, next_arg); + } else if (strncmp(argv[0], "-dump", 5) == 0) { + dump_output_immediately = TRUE; + LYcols=80; + + } else { + goto Output_Error_and_Help_List; } + break; - return 0; -} + case 'e': + if (strncmp(argv[0], "-editor", 7) == 0) { + if (nextarg) + StrAllocCopy(editor,cp); + system_editor = TRUE; -/* -dump */ -static int dump_output_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - dump_output_immediately = TRUE; - LYcols = 80; - return 0; -} + } else if (strncmp(argv[0], "-emacskeys", 10) == 0) { + emacs_keys = TRUE; -/* -editor */ -static int editor_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - if (next_arg != 0) - StrAllocCopy(editor, next_arg); - system_editor = TRUE; - return 0; -} + } else if (strncmp(argv[0], "-enable_scrollback", 18) == 0) { + if (enable_scrollback) + enable_scrollback = FALSE; + else + enable_scrollback = TRUE; -/* -error_file */ -static int error_file_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - /* - * Output return (success/failure) code - * of an HTTP transaction. - */ - if (next_arg != 0) - http_error_file = next_arg; - return 0; -} + } else if (strncmp(argv[0], "-error_file", 11) == 0) { + /* + * Output return (success/failure) code + * of an HTTP transaction. + */ + if (nextarg) + http_error_file = cp; #if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) -/* -exec */ -static int exec_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ + } else if (strncmp(argv[0], "-exec", 5) == 0) { #ifndef NEVER_ALLOW_REMOTE_EXEC - local_exec = TRUE; + local_exec = TRUE; #else - local_exec_on_local_files = TRUE; + local_exec_on_local_files = TRUE; #endif /* NEVER_ALLOW_REMOTE_EXEC */ - return 0; -} -#endif +#endif /* EXEC_LINKS || EXEC_SCRIPTS */ -/* -get_data */ -static int get_data_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - /* - * User data for GET form. - */ - char **get_data; - char buf[1024]; + } else { + goto Output_Error_and_Help_List; + } + break; - /* - * On Unix, conflicts with curses when interactive - * so let's force a dump. - CL - * - * On VMS, mods have been made in LYCurses.c to deal with - * potential conflicts, so don't force the dump here. - FM - */ -#ifndef VMS - dump_output_immediately = TRUE; - LYcols = 80; + case 'f': + if (strncmp(argv[0], "-force_html", 11) == 0) { + LYforce_HTML_mode = TRUE; + + } else if (strncmp(argv[0], "-fileversions", 13) == 0) { +#ifdef VMS + HTVMSFileVersions = TRUE; +#else + break;; #endif /* VMS */ - StrAllocCopy(form_get_data, "?"); /* Prime the pump */ - get_data = &form_get_data; + } else if (strncmp(argv[0], "-force_secure", 13) == 0) { + if (LYForceSSLCookiesSecure) + LYForceSSLCookiesSecure = FALSE; + else + LYForceSSLCookiesSecure = TRUE; - /* - * Build GET data for later. Stop reading when we see a line - * with "---" as its first three characters. - */ - while (fgets(buf, sizeof(buf), stdin) && - strncmp(buf, "---", 3) != 0) { - int j; + } else if (strncmp(argv[0], "-from", 5) == 0) { + if (LYNoFromHeader) + LYNoFromHeader = FALSE; + else + LYNoFromHeader = TRUE; - for (j = strlen(buf) - 1; j >= 0 && /* Strip line terminators */ - (buf[j] == CR || buf[j] == LF); j--) - buf[j] = '\0'; + } else if (strncmp(argv[0], "-ftp", 4) == 0) { + ftp_ok = FALSE; - StrAllocCat(*get_data, buf); + } else { + goto Output_Error_and_Help_List; } + break; - return 0; -} + case 'g': + if (strcmp(argv[0], "-get_data") == 0) { + /* + * User data for GET form. + */ + char **get_data; + char buf[1024]; -/* -help */ -static int help_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - print_help_and_exit (0); - return 0; -} + /* + * On Unix, conflicts with curses when interactive + * so let's force a dump. - CL + * + * On VMS, mods have been made in LYCurses.c to deal with + * potential conflicts, so don't force the dump here. - FM + */ +#ifndef VMS + dump_output_immediately = TRUE; + LYcols = 80; +#endif /* VMS */ -/* -hiddenlinks */ -static int hiddenlinks_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - if (next_arg != 0) { - if (strncasecomp(next_arg, "merge", 1) == 0) + StrAllocCopy(form_get_data, "?"); /* Prime the pump */ + get_data = &form_get_data; + + /* + * Build GET data for later. Stop reading when we see a line + * with "---" as its first three characters. + */ + while (fgets(buf, sizeof(buf), stdin) && + strncmp(buf, "---", 3) != 0) { + int j; + + for (j = strlen(buf) - 1; j >= 0 && /* Strip line terminators */ + (buf[j] == CR || buf[j] == LF); j--) { + buf[j] = '\0'; + } + StrAllocCat(*get_data, buf); + } + + } else { + goto Output_Error_and_Help_List; + } + break; + + case 'h': + if (strcmp(argv[0], "-help") == 0) { + goto Output_Help_List; + + } else if (strcmp(argv[0], "-head") == 0) { + /* + * Return mime headers. + */ + HEAD_request = TRUE; + + } else if (strncmp(argv[0], "-hiddenlinks", 7) == 0) { + if (nextarg) { + if (strncasecomp(cp, "merge", 1) == 0) + LYHiddenLinks = HIDDENLINKS_MERGE; + else if (strncasecomp(cp, "listonly", 1) == 0) + LYHiddenLinks = HIDDENLINKS_SEPARATE; + else if (strncasecomp(cp, "ignore", 1) == 0) + LYHiddenLinks = HIDDENLINKS_IGNORE; + else + goto Output_Error_and_Help_List; + } else LYHiddenLinks = HIDDENLINKS_MERGE; - else if (strncasecomp(next_arg, "listonly", 1) == 0) - LYHiddenLinks = HIDDENLINKS_SEPARATE; - else if (strncasecomp(next_arg, "ignore", 1) == 0) - LYHiddenLinks = HIDDENLINKS_IGNORE; + + } else if (strncmp(argv[0], "-historical", 11) == 0) { + if (historical_comments) + historical_comments = FALSE; else - print_help_and_exit (-1); + historical_comments = TRUE; + + } else if (strncmp(argv[0], "-homepage", 9) == 0) { + if (nextarg) { + StrAllocCopy(homepage, cp); + LYTrimHead(homepage); + if (!strncasecomp(homepage, "lynxexec:", 9) || + !strncasecomp(homepage, "lynxprog:", 9)) { + /* + * The original implementations of these schemes expected + * white space without hex escaping, and did not check + * for hex escaping, so we'll continue to support that, + * until that code is redone in conformance with SGML + * principles. - FM + */ + HTUnEscapeSome(homepage, " \r\n\t"); + convert_to_spaces(homepage, TRUE); + } + } } else { - LYHiddenLinks = HIDDENLINKS_MERGE; + goto Output_Error_and_Help_List; } + break; - return 0; -} + case 'i': + if (strncmp(argv[0], "-image_links", 12) == 0) { + if (clickable_images) + clickable_images = FALSE; + else + clickable_images = TRUE; -/* -homepage */ -static int homepage_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - if (next_arg != 0) { - StrAllocCopy(homepage, next_arg); - LYTrimHead(homepage); - if (!strncasecomp(homepage, "lynxexec:", 9) || - !strncasecomp(homepage, "lynxprog:", 9)) { - /* - * The original implementations of these schemes expected - * white space without hex escaping, and did not check - * for hex escaping, so we'll continue to support that, - * until that code is redone in conformance with SGML - * principles. - FM - */ - HTUnEscapeSome(homepage, " \r\n\t"); - convert_to_spaces(homepage, TRUE); - } + } else if (strncmp(argv[0], "-index", 6) == 0) { + if (nextarg) + StrAllocCopy(indexfile, cp); + + } else if (strncmp(argv[0], "-ismap", 6) == 0) { + if (LYNoISMAPifUSEMAP) + LYNoISMAPifUSEMAP = FALSE; + else + LYNoISMAPifUSEMAP = TRUE; + + } else { + goto Output_Error_and_Help_List; } - return 0; -} + break; -/* -mime_header */ -static int mime_header_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - /* - * Include mime headers and force source dump. - */ - keep_mime_headers = TRUE; - dump_output_immediately = TRUE; - HTOutputFormat = (LYPrependBase ? - HTAtom_for("www/download") : HTAtom_for("www/dump")); - LYcols = 999; - return 0; -} + case 'l': + if (strncmp(argv[0], "-link", 5) == 0) { + if (nextarg) + ccount = atoi(cp); -/* -newschunksize */ -static int newschunksize_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - if (next_arg != 0) { - HTNewsChunkSize = atoi(next_arg); + } else if (strncmp(argv[0], "-localhost", 10) == 0) { + local_host_only = TRUE; + +#if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) + } else if (strncmp(argv[0], "-locexec", 8) == 0) { + local_exec_on_local_files = TRUE; +#endif /* EXEC_LINKS || EXEC_SCRIPTS */ + +#if defined(USE_HASH) + } else if (strncmp(argv[0], "-lss", 4) == 0) { /* - * If the new HTNewsChunkSize exceeds the maximum, - * increase HTNewsMaxChunk to this size. - FM + * Already read the alternate lynx-style file + * so just check whether we need to increment i */ - if (HTNewsChunkSize > HTNewsMaxChunk) - HTNewsMaxChunk = HTNewsChunkSize; + if (nextarg) + ; /* do nothing */ +#endif + + } else { + goto Output_Error_and_Help_List; } - return 0; -} + break; -/* -newsmaxchunk */ -static int newsmaxchunk_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - if (next_arg) { - HTNewsMaxChunk = atoi(next_arg); + case 'm': + if (strcmp(argv[0], "-mime_header") == 0) { /* - * If HTNewsChunkSize exceeds the new maximum, - * reduce HTNewsChunkSize to this maximum. - FM + * Include mime headers and force source dump. */ - if (HTNewsChunkSize > HTNewsMaxChunk) - HTNewsChunkSize = HTNewsMaxChunk; + keep_mime_headers = TRUE; + dump_output_immediately = TRUE; + HTOutputFormat = (LYPrependBase ? + HTAtom_for("www/download") : HTAtom_for("www/dump")); + LYcols=999; + + } else if (strncmp(argv[0], "-minimal", 8) == 0) { + if (minimal_comments) + minimal_comments = FALSE; + else + minimal_comments = TRUE; + + } else { + goto Output_Error_and_Help_List; } - return 0; -} + break; -/* -nobrowse */ -static int nobrowse_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - HTDirAccess = HT_DIR_FORBID; - return 0; -} + case 'n': + if (strncmp(argv[0], "-newschunksize", 14) == 0) { + if (nextarg) { + HTNewsChunkSize = atoi(cp); + /* + * If the new HTNewsChunkSize exceeds the maximum, + * increase HTNewsMaxChunk to this size. - FM + */ + if (HTNewsChunkSize > HTNewsMaxChunk) { + HTNewsMaxChunk = HTNewsChunkSize; + } + } -/* -nocolor */ -static int nocolor_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - LYShowColor = SHOW_COLOR_NEVER; + } else if (strncmp(argv[0], "-newsmaxchunk", 13) == 0) { + if (nextarg) { + HTNewsMaxChunk = atoi(cp); + /* + * If HTNewsChunkSize exceeds the new maximum, + * reduce HTNewsChunkSize to this maximum. - FM + */ + if (HTNewsChunkSize > HTNewsMaxChunk) { + HTNewsChunkSize = HTNewsMaxChunk; + } + } + + } else if (strncmp(argv[0], "-nobrowse", 9) == 0) { + HTDirAccess = HT_DIR_FORBID; + + } else if (strncmp(argv[0], "-nocc", 5) == 0) { + LYNoCc = TRUE; + + } else if (strncmp(argv[0], "-nocolor", 8) == 0) { + LYShowColor = SHOW_COLOR_NEVER; #ifdef USE_SLANG - Lynx_Color_Flags &= ~SL_LYNX_USE_COLOR; - Lynx_Color_Flags |= SL_LYNX_OVERRIDE_COLOR; + Lynx_Color_Flags &= ~SL_LYNX_USE_COLOR; + Lynx_Color_Flags |= SL_LYNX_OVERRIDE_COLOR; #endif - return 0; -} -/* -nopause */ -static int nopause_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - InfoSecs = 0; - MessageSecs = 0; - AlertSecs = 0; - return 0; -} +#if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) + } else if (strncmp(argv[0], "-noexec", 7) == 0) { + local_exec = FALSE; +#endif /* EXEC_LINKS || EXEC_SCRIPTS */ -/* -pauth */ -static int pauth_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - parse_authentication(next_arg, proxyauth_info); - return 0; -} + } else if (strncmp(argv[0], "-nofilereferer", 14) == 0) { + no_filereferer = TRUE; -/* -post_data */ -static int post_data_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - /* - * User data for POST form. - */ - char **post_data; - char buf[1024]; + } else if (strncmp(argv[0], "-nolist", 7) == 0) { + nolist = TRUE; - /* - * On Unix, conflicts with curses when interactive so let's force a dump. - * - CL - * - * On VMS, mods have been made in LYCurses.c to deal with potential - * conflicts, so don't force a dump here. - FM - */ + } else if (strncmp(argv[0], "-nolog", 6) == 0) { + error_logging = FALSE; + + } else if (strcmp(argv[0], "-nopause") == 0) { /* No statusline pauses */ + InfoSecs = 0; + MessageSecs = 0; + AlertSecs = 0; + + } else if (strncmp(argv[0], "-noprint", 8) == 0) { + no_print = TRUE; + + } else if (strcmp(argv[0], "-noredir") == 0) { + /* + * Don't follow URL redirections. + */ + no_url_redirection = TRUE; + + } else if (strncmp(argv[0], "-noreferer", 10) == 0) { + LYNoRefererHeader = TRUE; + +#ifdef SOCKS + } else if (strncmp(argv[0], "-nosocks", 8) == 0) { + socks_flag = FALSE; +#endif /* SOCKS */ + + } else if (strncmp(argv[0], "-nostatus", 9) == 0) { + no_statusline = TRUE; + + } else if (strncmp(argv[0], "-number_links", 13) == 0) { + number_links = TRUE; + + } else { + goto Output_Error_and_Help_List; + } + break; + + case 'p': + if (strncmp(argv[0], "-pauth", 6) == 0) { + /* + * Authentication information for protected proxy server. - AJL + */ + char *pauth_info = NULL; + + if (nextarg) { + StrAllocCopy(pauth_info, cp); + memset(cp, ' ', strlen(cp)); /* Let's not show too much */ + } + if (pauth_info != NULL) { + if ((cp = strchr(pauth_info, ':')) != NULL) { /* Pw */ + *cp++ = '\0'; /* Terminate ID */ + if (*cp) { + HTUnEscape(cp); + StrAllocCopy(proxyauth_info[1], cp); + } + } + if (*pauth_info) { /* Id */ + HTUnEscape(pauth_info); + StrAllocCopy(proxyauth_info[0], pauth_info); + } + FREE(pauth_info); + } + + } else if (strncmp(argv[0], "-popup", 6) == 0) { + LYUseDefSelPop = FALSE; + + } else if (strcmp(argv[0], "-post_data") == 0) { + /* + * User data for POST form. + */ + char **post_data; + char buf[1024]; + + /* + * On Unix, conflicts with curses when interactive + * so let's force a dump. - CL + * + * On VMS, mods have been made in LYCurses.c to deal with + * potential conflicts, so don't force a dump here. - FM + */ #ifndef VMS - dump_output_immediately = TRUE; - LYcols = 80; + dump_output_immediately = TRUE; + LYcols = 80; #endif /* VMS */ - post_data = &form_post_data; + post_data = &form_post_data; - /* - * Build post data for later. Stop reading when we see a line with "---" - * as its first three characters. - */ - while (fgets(buf, sizeof(buf), stdin) && - strncmp(buf, "---", 3) != 0) { - int j; + /* + * Build post data for later. Stop reading when we see a line + * with "---" as its first three characters. + */ + while (fgets(buf, sizeof(buf), stdin) && + strncmp(buf, "---", 3) != 0) { + int j; - for (j = strlen(buf) - 1; j >= 0 && /* Strip line terminators */ - (buf[j] == CR || buf[j] == LF); j--) { - buf[j] = '\0'; + for (j = strlen(buf) - 1; j >= 0 && /* Strip line terminators */ + (buf[j] == CR || buf[j] == LF); j--) { + buf[j] = '\0'; + } + StrAllocCat(*post_data, buf); } - StrAllocCat(*post_data, buf); + + } else if (strncmp(argv[0], "-preparsed", 9) == 0) { + LYPreparsedSource = TRUE; + + } else if (strncmp(argv[0], "-print", 6) == 0) { + no_print=FALSE; + + } else if (strncmp(argv[0], "-pseudo_inlines", 15) == 0) { + if (pseudo_inline_alts) + pseudo_inline_alts = FALSE; + else + pseudo_inline_alts = TRUE; + + } else { + goto Output_Error_and_Help_List; } - return 0; -} + break; -/* -restrictions */ -static int restrictions_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - static CONST char *Usage[] = { + case 'r': + if (strncmp(argv[0], "-raw", 4) == 0) { + LYUseDefaultRawMode = FALSE; + + } else if (strncmp(argv[0], "-realm", 6) == 0) { + check_realm = TRUE; + + } else if (strncmp(argv[0], "-reload", 7) == 0) { + reloading = TRUE; + + } else if (strncmp(argv[0], "-restrictions", 13) == 0) { + if ((cp=strchr(argv[0],'=')) != NULL) + parse_restrictions(cp+1); + else { + static CONST char *Usage[] = { "" ," USAGE: lynx -restrictions=[option][,option][,option]" ," List of Options:" @@ -2364,788 +2514,317 @@ static int restrictions_fun ARGS3( ," suspend disallow Control-Z suspends with escape to shell" ," telnet_port disallow specifying a port in telnet G)oto's" ," useragent disallow modifications of the User-Agent header" - }; - size_t n; - - if (next_arg != 0) { - parse_restrictions(next_arg); - } else { - SetOutputMode( O_TEXT ); - for (n = 0; n < sizeof(Usage)/sizeof(Usage[0]); n++) - printf("%s\n", Usage[n]); - SetOutputMode( O_BINARY ); - exit(0); - } - return 0; -} + }; + size_t n; + for (n = 0; n < sizeof(Usage)/sizeof(Usage[0]); n++) + printf("%s\n", Usage[n]); + exit(0); + } -/* -selective */ -static int selective_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - HTDirAccess = HT_DIR_SELECTIVE; - return 0; -} + } else if (strncmp(argv[0], "-resubmit_posts", 15) == 0) { + if (LYresubmit_posts) + LYresubmit_posts = FALSE; + else + LYresubmit_posts = TRUE; -/* -source */ -static int source_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - dump_output_immediately = TRUE; - HTOutputFormat = (LYPrependBase ? - HTAtom_for("www/download") : HTAtom_for("www/dump")); - LYcols = 999; - return 0; -} + } else if (strncmp(argv[0], "-rlogin", 7) == 0) { + rlogin_ok = FALSE; -/* -tagsoup */ -static int tagsoup_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - HTSwitchDTD(New_DTD = NO); - return 0; -} + } else { + goto Output_Error_and_Help_List; + } + break; -/* -traversal */ -static int traversal_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - traversal = TRUE; -#ifdef USE_SLANG - LYcols = 80; -#else - LYcols = 999; -#endif /* USE_SLANG */ + case 's': + if (strncmp(argv[0], "-selective", 10) == 0) { + HTDirAccess = HT_DIR_SELECTIVE; - return 0; -} + } else if (strncmp(argv[0], "-show_cursor", 12) == 0) { + LYUseDefShoCur = FALSE; -/* -version */ -static int version_fun ARGS3( - Parse_Args_Type *, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg GCC_UNUSED) -{ - SetOutputMode( O_TEXT ); - - printf("\n%s Version %s (%.*s)\n", - LYNX_NAME, LYNX_VERSION, - LYNX_DATE_LEN, - LYNX_RELEASE ? LYNX_RELEASE_DATE : &LYNX_DATE[LYNX_DATE_OFF] - ); - printf( - "Copyrights held by the University of Kansas, CERN, and other contributors.\n" - ); - printf("Distributed under the GNU General Public License.\n"); - printf( - "See http://lynx.browser.org/ and the online help for more information.\n\n" - ); - - SetOutputMode( O_BINARY ); + } else if (strncmp(argv[0], "-soft_dquotes", 13) == 0) { + if (soft_dquotes) + soft_dquotes = FALSE; + else + soft_dquotes = TRUE; - exit(0); - /* NOT REACHED */ - return 0; -} + } else if (strncmp(argv[0], "-source", 7) == 0) { + dump_output_immediately = TRUE; + HTOutputFormat = (LYPrependBase ? + HTAtom_for("www/download") : HTAtom_for("www/dump")); + LYcols=999; -/* -width */ -static int width_fun ARGS3( - Parse_Args_Type*, p GCC_UNUSED, - char **, argv GCC_UNUSED, - char *, next_arg) -{ - if (next_arg != 0) { - int w = atoi(next_arg); - if (w > 0) - dump_output_width = ((w < 999) ? w : 999); - } + } else if (strncmp(argv[0], "-stack_dump", 11) == 0) { + stack_dump = TRUE; - return 0; -} + } else if (strncmp(argv[0], "-startfile_ok", 13) == 0) { + startfile_ok = TRUE; -/* NOTE: This table is sorted by name; the lookup relies on that. */ -static Parse_Args_Type Arg_Table [] = -{ - PARSE_SET( - "accept_all_cookies", SET_ARG, &LYAcceptAllCookies, - "\naccepts all cookies" - ), - PARSE_FUN( - "anonymous", FUNCTION_ARG, anonymous_fun, - "used to specify the anonymous account" - ), - PARSE_FUN( - "assume_charset", NEED_FUNCTION_ARG, assume_charset_fun, - "=MIMEname\ncharset for documents that don't specify it" - ), - PARSE_FUN( - "assume_local_charset", NEED_FUNCTION_ARG,assume_local_charset_fun, - "=MIMEname\ncharset assumed for local files" - ), - PARSE_FUN( - "assume_unrec_charset", NEED_FUNCTION_ARG,assume_unrec_charset_fun, - "=MIMEname\nuse this instead of unrecognized charsets" - ), - PARSE_FUN( - "auth", NEED_FUNCTION_ARG, auth_fun, - "=id:pw\nauthentication information for protected documents" - ), - PARSE_FUN( - "base", FUNCTION_ARG, base_fun, - "prepend a request URL comment and BASE tag to text/html\noutputs for -source dumps" - ), -#ifdef USE_SLANG - PARSE_FUN( - "blink", FUNCTION_ARG, blink_fun, - "force high intensity bg colors in color mode" - ), -#endif - PARSE_SET( - "book", SET_ARG, &bookmark_start, - "use the bookmark page as the startfile" - ), - PARSE_SET( - "buried_news", TOGGLE_ARG, &scan_for_buried_news_references, - "toggles scanning of news articles for buried references" - ), - PARSE_FUN( - "cache", NEED_FUNCTION_ARG, cache_fun, - "=NUMBER\nNUMBER of documents cached in memory" - ), - PARSE_SET( - "case", SET_ARG, &case_sensitive, - "enable case sensitive user searching" - ), - PARSE_STR( - "cfg", IGNORE_ARG|NEED_NEXT_ARG, 0, - "=FILENAME\nspecifies a lynx.cfg file other than the default" - ), - PARSE_FUN( - "child", FUNCTION_ARG, child_fun, - "exit on left-arrow in startfile, and disable save to disk" - ), -#ifdef USE_SLANG - PARSE_FUN( - "color", FUNCTION_ARG, color_fun, - "force color mode on with standard bg colors" - ), -#endif - PARSE_SET( - "cookies", TOGGLE_ARG, &LYSetCookies, - "toggles handling of Set-Cookie headers" - ), -#ifdef EXP_PERSISTENT_COOKIES - PARSE_STR( - "cookie_file", LYSTRING_ARG, &LYCookieFile, - "=FILENAME\nspecifies a file to use to store cookies" - ), -#endif /* EXP_PERSISTENT_COOKIES */ -#ifndef VMS - PARSE_SET( - "core", TOGGLE_ARG, &LYNoCore, - "toggles forced core dumps on fatal errors" - ), -#endif - PARSE_FUN( - "crawl", FUNCTION_ARG, crawl_fun, - "with -traversal, output each page to a file\n\ -with -dump, format output as with -traversal, but to stdout" - ), -#ifdef DISP_PARTIAL - PARSE_SET( - "debug_partial", TOGGLE_ARG, &debug_display_partial, - "incremental display stages with MessageSecs delay" - ), -#endif - PARSE_FUN( - "display", NEED_FUNCTION_ARG, display_fun, - "=DISPLAY\nset the display variable for X exec'ed programs" - ), - PARSE_FUN( - "dump", FUNCTION_ARG, dump_output_fun, - "dump the first file to stdout and exit" - ), - PARSE_FUN( - "editor", NEED_FUNCTION_ARG, editor_fun, - "=EDITOR\nenable edit mode with specified editor" - ), - PARSE_SET( - "emacskeys", SET_ARG, &emacs_keys, - "enable emacs-like key movement" - ), - PARSE_SET( - "enable_scrollback", TOGGLE_ARG, &enable_scrollback, - "\ntoggles compatibility with comm programs' scrollback\n\ -keys (may be incompatible with some curses packages)" - ), - PARSE_FUN( - "error_file", NEED_FUNCTION_ARG, error_file_fun, - "=FILE\nwrite the HTTP status code here" - ), -#if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) -#ifndef NEVER_ALLOW_REMOTE_EXEC - PARSE_FUN( - "exec", FUNCTION_ARG, exec_fun, - "enable local program execution" - ), -#endif - PARSE_SET( - "locexec", SET_ARG, &local_exec_on_local_files, - "enable local program execution from local files only" - ), - PARSE_SET( - "noexec", UNSET_ARG, &local_exec, - "disable local program execution (DEFAULT)" - ), -#endif /* EXEC_LINKS || EXEC_SCRIPTS */ -#ifdef VMS - PARSE_SET( - "fileversions", SET_ARG, &HTVMSFileVersions, - "include all versions of files in local VMS directory\nlistings" - ), -#endif - PARSE_SET( - "force_html", SET_ARG, &LYforce_HTML_mode, - "forces the first document to be interpreted as HTML" - ), - PARSE_SET( - "force_secure", TOGGLE_ARG, &LYForceSSLCookiesSecure, - "toggles forcing of the secure flag for SSL cookies" - ), - PARSE_SET( - "from", TOGGLE_ARG, &LYNoFromHeader, - "toggle transmissions of From headers" - ), -#if !defined(NO_OPTION_FORMS) && !defined(NO_OPTION_MENU) - PARSE_SET( - "forms_options", TOGGLE_ARG, &LYUseFormsOptions, - "toggles forms-based vs old-style options menu" - ), -#endif - PARSE_SET( - "ftp", UNSET_ARG, &ftp_ok, - "disable ftp access" - ), - PARSE_FUN( - "get_data", FUNCTION_ARG, get_data_fun, - "user data for get forms, read from stdin,\nterminated by '---' on a line" - ), - PARSE_SET( - "head", SET_ARG, &HEAD_request, - "send a HEAD request" - ), - PARSE_FUN( - "help", FUNCTION_ARG, help_fun, - "print this usage message" - ), - PARSE_FUN( - "hiddenlinks", NEED_FUNCTION_ARG, hiddenlinks_fun, - "=[option]\nhidden links: options are merge, listonly, or ignore" - ), - PARSE_SET( - "historical", TOGGLE_ARG, &historical_comments, - "toggles use of '>' or '-->' as a terminator for comments" - ), - PARSE_FUN( - "homepage", NEED_FUNCTION_ARG, homepage_fun, - "=URL\nset homepage separate from start page" - ), - PARSE_SET( - "image_links", TOGGLE_ARG, &clickable_images, - "toggles inclusion of links for all images" - ), - PARSE_STR( - "index", NEED_LYSTRING_ARG, &indexfile, - "=URL\nset the default index file to URL" - ), - PARSE_SET( - "ismap", TOGGLE_ARG, &LYNoISMAPifUSEMAP, - "toggles inclusion of ISMAP links when client-side\nMAPs are present" - ), - PARSE_INT( - "link", NEED_INT_ARG, ccount, - "=NUMBER\nstarting count for lnk#.dat files produced by -crawl" - ), - PARSE_SET( - "localhost", SET_ARG, &local_host_only, - "disable URLs that point to remote hosts" - ), -#if defined(USE_HASH) - PARSE_STR( - "lss", IGNORE_ARG|NEED_NEXT_ARG, 0, - "=FILENAME\nspecifies a lynx.lss file other than the default" - ), -#endif - PARSE_FUN( - "mime_header", FUNCTION_ARG, mime_header_fun, - "include mime headers and force source dump" - ), - PARSE_SET( - "minimal", TOGGLE_ARG, &minimal_comments, - "toggles minimal versus valid comment parsing" - ), - PARSE_FUN( - "newschunksize", NEED_FUNCTION_ARG, newschunksize_fun, - "=NUMBER\nnumber of articles in chunked news listings" - ), - PARSE_FUN( - "newsmaxchunk", NEED_FUNCTION_ARG, newsmaxchunk_fun, - "=NUMBER\nmaximum news articles in listings before chunking" - ), - PARSE_FUN( - "nobrowse", FUNCTION_ARG, nobrowse_fun, - "disable directory browsing" - ), - PARSE_SET( - "nocc", SET_ARG, &LYNoCc, - "disable Cc: prompts for self copies of mailings" - ), - PARSE_FUN( - "nocolor", FUNCTION_ARG, nocolor_fun, - "turn off color support" - ), - PARSE_SET( - "nofilereferer", SET_ARG, &no_filereferer, - "disable transmissions of Referer headers for file URLs" - ), - PARSE_SET( - "nolist", SET_ARG, &nolist, - "disable the link list feature in dumps" - ), - PARSE_SET( - "nolog", UNSET_ARG, &error_logging, - "disable mailing of error messages to document owners" - ), - PARSE_FUN( - "nopause", FUNCTION_ARG, nopause_fun, - "disable forced pauses for statusline messages" - ), - PARSE_SET( - "noprint", SET_ARG, &no_print, - "disable print functions" - ), - PARSE_SET( - "noredir", SET_ARG, &no_url_redirection, - "don't follow Location: redirection" - ), - PARSE_SET( - "noreferer", SET_ARG, &LYNoRefererHeader, - "disable transmissions of Referer headers" - ), -#ifdef SOCKS - PARSE_SET( - "nosocks", UNSET_ARG, &socks_flag, - "don't use SOCKS proxy for this session" - ), -#endif - PARSE_SET( - "nostatus", SET_ARG, &no_statusline, - "disable the miscellaneous information messages" - ), - PARSE_SET( - "number_links", SET_ARG, &number_links, - "force numbering of links" - ), -#ifdef DISP_PARTIAL - PARSE_SET( - "partial", TOGGLE_ARG, &display_partial, - "display partial pages while downloading" - ), - PARSE_INT( - "partial_thres", IGNORE_ARG|INT_ARG, partial_threshold, - "[=NUMBER]\nnumber of lines to render before repainting display\n\ -with partial-display logic" - ), -#endif - PARSE_FUN( - "pauth", NEED_FUNCTION_ARG, pauth_fun, - "=id:pw\nauthentication information for protected proxy server" - ), - PARSE_SET( - "popup", UNSET_ARG, &LYUseDefSelPop, - "toggles handling of single-choice SELECT options via\npopup windows or as lists of radio buttons" - ), - PARSE_FUN( - "post_data", FUNCTION_ARG, post_data_fun, - "user data for post forms, read from stdin,\nterminated by '---' on a line" - ), - PARSE_SET( - "preparsed", SET_ARG, &LYPreparsedSource, - "show parsed text/html with -source and in source view" - ), - PARSE_SET( - "print", UNSET_ARG, &no_print, - "enable print functions (DEFAULT)" - ), - PARSE_SET( - "pseudo_inlines", TOGGLE_ARG, &pseudo_inline_alts, - "toggles pseudo-ALTs for inlines with no ALT string" - ), - PARSE_SET( - "raw", UNSET_ARG, &LYUseDefaultRawMode, - "toggles default setting of 8-bit character translations\nor CJK mode for the startup character set" - ), - PARSE_SET( - "realm", SET_ARG, &check_realm, - "restricts access to URLs in the starting realm" - ), - PARSE_SET( - "reload", SET_ARG, &reloading, - "flushes the cache on a proxy server\n(only the first document affected)" - ), - PARSE_FUN( - "restrictions", FUNCTION_ARG, restrictions_fun, - "=[options]\nuse -restrictions to see list" - ), - PARSE_SET( - "resubmit_posts", TOGGLE_ARG, &LYresubmit_posts, - "toggles forced resubmissions (no-cache) of forms with\n\ -method POST when the documents they returned are sought\n\ -with the PREV_DOC command or from the History List" - ), - PARSE_SET( - "rlogin", UNSET_ARG, &rlogin_ok, - "disable rlogins" - ), - PARSE_FUN( - "selective", FUNCTION_ARG, selective_fun, - "require .www_browsable files to browse directories" - ), - PARSE_SET( - "show_cursor", TOGGLE_ARG, &LYUseDefShoCur, - "toggles hiding of the cursor in the lower right corner" - ), - PARSE_SET( - "soft_dquotes", TOGGLE_ARG, &soft_dquotes, - "toggles emulation of the old Netscape and Mosaic bug which\n\ -treated '>' as a co-terminator for double-quotes and tags" - ), - PARSE_FUN( - "source", FUNCTION_ARG, source_fun, - "dump the source of the first file to stdout and exit" - ), - PARSE_SET( - "stack_dump", SET_ARG, &stack_dump, - "disable SIGINT cleanup handler" - ), - PARSE_SET( - "startfile_ok", SET_ARG, &startfile_ok, - "allow non-http startfile and homepage with -validate" - ), #ifndef VMS #ifdef SYSLOG_REQUESTED_URLS - PARSE_STR( - "syslog", NEED_LYSTRING_ARG, &syslog_txt, - "=text\ninformation for syslog call" - ), -#endif -#endif - PARSE_FUN( - "tagsoup", FUNCTION_ARG, tagsoup_fun, - "use TagSoup rather than SortaSGML parser" - ), - PARSE_SET( - "telnet", UNSET_ARG, &telnet_ok, - "disable telnets" - ), - PARSE_STR( - "term", NEED_STRING_ARG, &terminal, - "=TERM\nset terminal type to TERM" - ), - PARSE_SET( - "tlog", IGNORE_ARG, 0, - "toggles use of a Lynx Trace Log for the current session" - ), - PARSE_SET( - "trace", IGNORE_ARG, 0, - "turns on Lynx trace mode" - ), - PARSE_FUN( - "traversal", FUNCTION_ARG, traversal_fun, - "traverse all http links derived from startfile" - ), - PARSE_SET( - "underscore", TOGGLE_ARG, &use_underscore, - "toggles use of _underline_ format in dumps" - ), -#if defined(NCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE) - PARSE_SET( - "use_mouse", SET_ARG, &LYUseMouse, - "turn on xterm mouse support" - ), -#endif - PARSE_STR( - "useragent", NEED_LYSTRING_ARG, &LYUserAgent, - "=Name\nset alternate Lynx User-Agent header" - ), - PARSE_SET( - "validate", IGNORE_ARG, 0, - "accept only http URLs (for validation)" - ), - PARSE_SET( - "verbose", TOGGLE_ARG, &verbose_img, - "toggles [LINK], [IMAGE] and [INLINE] comments \nwith filenames of these images" - ), - PARSE_FUN( - "version", FUNCTION_ARG, version_fun, - "print Lynx version information" - ), - PARSE_SET( - "vikeys", SET_ARG, &vi_keys, - "enable vi-like key movement" - ), - PARSE_FUN( - "width", NEED_FUNCTION_ARG, width_fun, - "=NUMBER\nscreen width for formatting of dumps (default is 80)" - ), - {NULL} -}; - -static void print_help_strings ARGS2( - CONST char *, name, - CONST char *, help) -{ - int pad; - int c; - int first; - int field_width = 21; - - pad = field_width - (5 + (int) strlen (name)); - - fprintf (stdout, " -%s", name); + } else if (strncmp(argv[0], "-syslog", 7) == 0) { + if (nextarg) + StrAllocCopy(syslog_txt, cp); +#endif /* SYSLOG_REQUESTED_URLS */ +#endif /* !VMS */ - if (*help != '=') { - pad--; - while (pad > 0) { - fputc (' ', stdout); - pad--; - } - fputc (' ', stdout); /* at least one space */ - first = 0; } else { - first = pad; + goto Output_Error_and_Help_List; } + break; - if (strchr (help, '\n') == 0) { - fprintf (stdout, "%s\n", help); - } else { - while ((c = *help) != 0) { - if (c == '\n') { - if ((pad = --first) < 0) { - pad = field_width; - } else { - c = ' '; - } - fputc (c, stdout); - while (pad--) - fputc (' ', stdout); - } else { - fputc (c, stdout); - } - help++; - first--; - } - fputc ('\n', stdout); - } -} + case 't': + if (strncmp(argv[0], "-telnet", 7) == 0) { + telnet_ok = FALSE; -static void print_help_and_exit ARGS1(int, exit_status) -{ - Parse_Args_Type *p; + } else if (strncmp(argv[0], "-term", 5) == 0) { + if (nextarg) + terminal = cp; - if (pgm == NULL) pgm = "lynx"; + } else if (strncmp(argv[0], "-tlog", 5) == 0) { + /* + * Already handled. - FM + */ + break; - SetOutputMode( O_TEXT ); + } else if (strncmp(argv[0], "-trace", 6) == 0) { + /* + * Already handled. - FM + */ + break; - fprintf (stdout, "USAGE: %s [options] [file]\n", pgm); - fprintf (stdout, "Options are:\n"); - print_help_strings("", -"receive the arguments from stdin (enclose\n\ -in double-quotes (\"-\") on VMS)"); + } else if (strncmp(argv[0], "-traversal", 10) == 0) { + traversal = TRUE; +#ifdef USE_SLANG + LYcols=80; +#else + LYcols=999; +#endif /* USE_SLANG */ - for (p = Arg_Table; p->name != 0; p++) - print_help_strings(p->name, p->help_string); + } else { + goto Output_Error_and_Help_List; + } + break; - SetOutputMode( O_BINARY ); + case 'u': + if (strncmp(argv[0], "-underscore", 11) == 0) { + if (use_underscore) + use_underscore = FALSE; + else + use_underscore = TRUE; - exit (exit_status); -} + } else if (strncmp(argv[0], "-useragent", 10) == 0) { + /* + * Set alternate Lynx User-Agent header. + */ + if (nextarg) + StrAllocCopy(LYUserAgent, cp); -/* - * This function performs a string comparison on two strings a and b. a is - * assumed to be an ordinary null terminated string, but b may be terminated - * by an '=', '+' or '-' character. If terminated by '=', *c will be pointed - * to the character following the '='. If terminated by '+' or '-', *c will - * be pointed to that character. (+/- added for toggle processing - BL.) - * If a and b match, it returns 1. Otherwise 0 is returned. - */ -static int arg_eqs_parse ARGS3( - CONST char *, a, - char *, b, - char **, c) -{ - *c = NULL; - while (1) { - if ((*a != *b) - || (*a == 0) - || (*b == 0)) { - if (*a == 0) { - switch (*b) { - case '=': - *c = b + 1; - return 1; - case '-': /* FALLTHRU */ - case '+': - *c = b; - return 1; - case 0: - return 1; - default: - return 0; - } - } else { - return 0; - } - } - a++; - b++; - } -} +#if defined(NCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE) + } else if (strncmp(argv[0], "-use_mouse", 9) == 0) { + LYUseMouse = TRUE; +#endif + } else { + goto Output_Error_and_Help_List; + } + break; -#define is_true(s) (*s == '1' || *s == '+' || !strcmp(s, "on")) -#define is_false(s) (*s == '0' || *s == '-' || !strcmp(s, "off")) + case 'v': + if (strcmp(argv[0], "-validate") == 0) { + /* + * Follow only http URLs. + * Already handled. - FM + */ + break; + + } else if (strncmp(argv[0], "-version", 8) == 0) { + printf("\n%s Version %s (1998)\n", LYNX_NAME, LYNX_VERSION); + printf( + "Copyrights held by the University of Kansas, CERN, and other contributors.\n" + ); + printf("Distributed under the GNU General Public License.\n"); + printf( + "See http://lynx.browser.org/ and the online help for more information.\n\n" + ); + exit(0); -PRIVATE void parse_arg ARGS2( - char **, argv, - int *, i) -{ - Parse_Args_Type *p; - char *arg_name; + } else if (strncmp(argv[0], "-vikeys", 7) == 0) { + vi_keys = TRUE; - arg_name = argv[0]; + } else { + goto Output_Error_and_Help_List; + } + break; - /* - * Check for a command line startfile. - FM - */ - if (*arg_name != '-') { - StrAllocCopy(startfile, arg_name); - LYTrimHead(startfile); - if (!strncasecomp(startfile, "lynxexec:", 9) || - !strncasecomp(startfile, "lynxprog:", 9)) { - /* - * The original implementations of these schemes expected - * white space without hex escaping, and did not check - * for hex escaping, so we'll continue to support that, - * until that code is redone in conformance with SGML - * principles. - FM - */ - HTUnEscapeSome(startfile, " \r\n\t"); - convert_to_spaces(startfile, TRUE); + case 'w': + if (strncmp(argv[0], "-width", 2) == 0) { + if (nextarg) { + int w = atoi(cp); + if (w > 0) { + dump_output_width = ((w < 999) ? w : 999); + break; + } } - return; + dump_output_width = 80; + } else { + goto Output_Error_and_Help_List; } + break; - /* lose the first '-' character */ - arg_name++; - - /* - * Skip any lone "-" arguments, because we've loaded - * the stdin input into an HTList structure for - * special handling. - FM - */ - if (*arg_name == 0) - return; - - p = Arg_Table; - while (p->name != 0) { -#ifdef PARSE_DEBUG - Parse_Args_Type *q = p; + default: +Output_Error_and_Help_List: +#ifdef VMS + printf(" LYNX: Invalid Option: %s\n", argv[0]); #else - ParseUnion *q = (ParseUnion *)(&(p->value)); +#ifdef UNIX + if (strncmp(argv[0], "-help", 5) != 0) + fprintf(stderr, "%s: Invalid Option: %s\n", pgm, argv[0]); + else +#endif /* UNIX */ + printf("%s: Invalid Option: %s\n", pgm, argv[0]); +#endif /* VMS */ +Output_Help_List: +#ifdef VMS + printf("USAGE: lynx [options] [file]\n"); +#else + printf("USAGE: %s [options] [file]\n",pgm); +#endif /* VMS */ + { + static CONST char *Options[] = { + "Options are:" +," - receive the arguments from stdin (enclose" +," in double-quotes (\"-\") on VMS)" +," -anonymous used to specify the anonymous account" +," -assume_charset=MIMEname charset for documents that don't specify it" +," -assume_local_charset=MIMEname charset assumed for local files" +," -assume_unrec_charset=MIMEname use this instead of unrecognized charsets" +," -auth=id:pw authentication information for protected documents" +," -base prepend a request URL comment and BASE tag to text/html" +," outputs for -source dumps" +," -book use the bookmark page as the startfile" +," -buried_news toggles scanning of news articles for buried references" +," -cache=NUMBER NUMBER of documents cached in memory" +," -case enable case sensitive user searching" +," -cfg=FILENAME specifies a lynx.cfg file other than the default" +," -child exit on left-arrow in startfile, and disable save to disk" +#ifdef USE_SLANG +," -color force color mode on with standard bg colors" +," -blink force high intensity bg colors in color mode" +#endif /* USE_SLANG */ +," -cookies toggles handling of Set-Cookie headers" +#ifndef VMS +," -core toggles forced core dumps on fatal errors" +#endif /* !VMS */ +," -crawl with -traversal, output each page to a file" +," with -dump, format output as with -traversal, but to stdout" +," -display=DISPLAY set the display variable for X execed programs" +," -dump dump the first file to stdout and exit" +," -editor=EDITOR enable edit mode with specified editor" +," -emacskeys enable emacs-like key movement" +," -enable_scrollback toggles compatibility with comm programs' scrollback" +," keys (may be incompatible with some curses packages)" +," -error_file=FILE write the HTTP status code here" +#if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) +#ifndef NEVER_ALLOW_REMOTE_EXEC +," -exec enable local program execution" +#endif /* !NEVER_ALLOW_REMOTE_EXEC */ +," -locexec enable local program execution from local files only" +," -noexec disable local program execution (DEFAULT)" +#endif /* EXEC_LINKS || EXEC_SCRIPTS */ +," -fileversions include all versions of files in local VMS directory" +," listings" +," -force_html forces the first document to be interpreted as HTML" +," -force_secure toggles forcing of the secure flag for SSL cookies" +," -from toggle transmissions of From headers" +," -ftp disable ftp access" +," -get_data user data for get forms, read from stdin," +," terminated by '---' on a line" +," -head send a HEAD request" +," -help print this usage message" +," -hiddenlinks=[option] hidden links: options are merge, listonly, or ignore" +," -historical toggles use of '>' or '-->' as a terminator for comments" +," -homepage=URL set homepage separate from start page" +," -image_links toggles inclusion of links for all images" +," -index=URL set the default index file to URL" +," -ismap toggles inclusion of ISMAP links when client-side" +," MAPs are present" +," -link=NUMBER starting count for lnk#.dat files produced by -crawl" +," -localhost disable URLs that point to remote hosts" +#if defined(USE_HASH) +," -lss=FILENAME specifies a lynx.css file other than the default" #endif - ParseFunc fun; - char *next_arg = NULL; - - if ((p->name[0] != *arg_name) - || (0 == arg_eqs_parse (p->name, arg_name, &next_arg))) { - p++; - continue; - } - - if ((p->type & NEED_NEXT_ARG) && (next_arg == 0)) { - next_arg = argv[1]; - if ((i != 0) && (next_arg != 0)) - (*i)++; - } - - switch (p->type & ARG_TYPE_MASK) { - case TOGGLE_ARG: /* FALLTHRU */ - case SET_ARG: /* FALLTHRU */ - case UNSET_ARG: - if (q->set_value != 0) { - if (next_arg == 0) { - switch (p->type & ARG_TYPE_MASK) { - case TOGGLE_ARG: - *(q->set_value) = !(*(q->set_value)); - break; - case SET_ARG: - *(q->set_value) = TRUE; - break; - case UNSET_ARG: - *(q->set_value) = FALSE; - break; - } - } else if (is_true(next_arg)) { - *(q->set_value) = TRUE; - } else if (is_false(next_arg)) { - *(q->set_value) = FALSE; - } - /* deliberately ignore anything else - BL */ - } - break; - - case FUNCTION_ARG: - fun = q->fun_value; - if (0 != fun) { - if (-1 == (*fun) (p, argv, next_arg)) { - } - } - break; - - case LYSTRING_ARG: - if ((q->str_value != 0) && (next_arg != 0)) - StrAllocCopy(*(q->str_value), next_arg); - break; - - case INT_ARG: - if ((q->int_value != 0) && (next_arg != 0)) - *(q->int_value) = atoi (next_arg); - break; - - case STRING_ARG: - if ((q->str_value != 0) && (next_arg != 0)) - *(q->str_value) = next_arg; - break; - - case IGNORE_ARG: - break; - } - - return; - } - - if (pgm == 0) pgm = "LYNX"; +," -mime_header include mime headers and force source dump" +," -minimal toggles minimal versus valid comment parsing" +," -newschunksize=NUMBER number of articles in chunked news listings" +," -newsmaxchunk=NUMBER maximum news articles in listings before chunking" +," -nobrowse disable directory browsing" +," -nocc disable Cc: prompts for self copies of mailings" +," -nofilereferer disable transmissions of Referer headers for file URLs" +," -nolist disable the link list feature in dumps" +," -nolog disable mailing of error messages to document owners" +," -nopause disable forced pauses for statusline messages" +," -noprint disable print functions" +," -noredir don't follow Location: redirection" +," -noreferer disable transmissions of Referer headers" +#ifdef SOCKS +," -nosocks don't use SOCKS proxy for this session" +#endif /* SOCKS */ +," -nostatus disable the miscellaneous information messages" +," -number_links force numbering of links" +," -pauth=id:pw authentication information for protected proxy server" +," -popup toggles handling of single-choice SELECT options via" +," popup windows or as lists of radio buttons" +," -post_data user data for post forms, read from stdin," +," terminated by '---' on a line" +," -preparsed show parsed text/html with -source and in source view" +," -print enable print functions (DEFAULT)" +," -pseudo_inlines toggles pseudo-ALTs for inlines with no ALT string" +," -raw toggles default setting of 8-bit character translations" +," or CJK mode for the startup character set" +," -realm restricts access to URLs in the starting realm" +," -reload flushes the cache on a proxy server" +," (only the first document affected)" +," -restrictions=[options] use -restrictions to see list" +," -resubmit_posts toggles forced resubmissions (no-cache) of forms with" +," method POST when the documents they returned are sought" +," with the PREV_DOC command or from the History List" +," -rlogin disable rlogins" +," -selective require .www_browsable files to browse directories" +," -show_cursor toggles hiding of the cursor in the lower right corner" +," -soft_dquotes toggles emulation of the old Netscape and Mosaic bug which" +," treated '>' as a co-terminator for double-quotes and tags" +," -source dump the source of the first file to stdout and exit" +," -startfile_ok allow non-http startfile and homepage with -validate" +#ifndef VMS +#ifdef SYSLOG_REQUESTED_URLS +," -syslog=text information for syslog call" +#endif /* SYSLOG_REQUESTED_URLS */ +#endif /* !VMS */ +," -telnet disable telnets" +," -term=TERM set terminal type to TERM" +," -tlog toggles use of a Lynx Trace Log for the current session" +," -trace turns on Lynx trace mode" +," -traversal traverse all http links derived from startfile" +," -underscore toggles use of _underline_ format in dumps" +," -useragent=Name set alternate Lynx User-Agent header" +#if defined(NCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE) +," -use_mouse enable use of the mouse" +#endif +," -validate accept only http URLs (for validation)" +," -version print Lynx version information" +," -vikeys enable vi-like key movement" +," -width=NUMBER screen width for formatting of dumps (default is 80)" + }; + size_t n; + for (n = 0; n < sizeof(Options)/sizeof(Options[0]); n++) + printf("%s\n", Options[n]); + } + if (strncmp(argv[0], "-help", 5) != 0) + exit(-1); + exit(0); + break; - fprintf (stderr, "%s: Invalid Option: %s\n", pgm, argv[0]); - print_help_and_exit (-1); + } /* end of switch. */ } #ifndef VMS diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 87a751bd..fa1ba6a1 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTAccess.h> #include <HTParse.h> #include <HTList.h> @@ -27,6 +28,7 @@ #include <LYEdit.h> #include <LYShowInfo.h> #include <LYBookmark.h> +#include <LYSystem.h> #include <LYKeymap.h> #include <LYJump.h> #include <LYDownload.h> @@ -37,14 +39,17 @@ #include <LYCharUtils.h> #include <LYCookie.h> #include <LYMainLoop.h> +#ifdef DOSPATH +#include <HTDOS.h> +#endif #ifdef USE_EXTERNALS #include <LYExtern.h> #endif -#ifdef __EMX__ -#include <io.h> -#endif +#ifdef VMS +#include <HTVMSUtils.h> +#endif /* VMS */ #ifdef DIRED_SUPPORT #include <LYLocal.h> @@ -79,15 +84,12 @@ PRIVATE int sametext ARGS2( } #endif /* FASTTAB */ +#define FREE(x) if (x) {free(x); x = NULL;} + PUBLIC HTList * Goto_URLs = NULL; /* List of Goto URLs */ PUBLIC char * LYRequestTitle = NULL; /* newdoc.title in calls to getfile() */ -#ifdef DISP_PARTIAL -PUBLIC int Newline_partial = 0; /* required for display_partial mode */ -PUBLIC int NumOfLines_partial = -1; /* required for display_partial mode */ -#endif - PRIVATE document newdoc; PRIVATE document curdoc; PRIVATE char *traversal_host = NULL; @@ -127,45 +129,6 @@ PRIVATE void free_mainloop_variables NOARGS return; } -PUBLIC FILE *TraceFP NOARGS -{ - if (LYTraceLogFP != 0) { - return LYTraceLogFP; - } - return stderr; -} - -PRIVATE void TracelogOpenFailed NOARGS -{ - WWW_TraceFlag = FALSE; - HTUserMsg(TRACELOG_OPEN_FAILED); -} - -PUBLIC void LYCloseTracelog NOARGS -{ - if (LYTraceLogFP != 0) { - fflush(stdout); - fflush(stderr); - fclose(LYTraceLogFP); - LYTraceLogFP = 0; - } -} - -PRIVATE BOOLEAN LYReopenTracelog ARGS1(BOOLEAN *, trace_flag_ptr) -{ - CTRACE(tfp, "\nTurning off TRACE for fetch of log.\n"); - LYCloseTracelog(); - if ((LYTraceLogFP = LYAppendToTxtFile(LYTraceLogPath)) == NULL) { - TracelogOpenFailed(); - return FALSE; - } - if (TRACE) { - WWW_TraceFlag = FALSE; - *trace_flag_ptr = TRUE; - } - return TRUE; -} - /* * Here's where we do all the work. * mainloop is basically just a big switch dependent on the users input. @@ -197,22 +160,15 @@ int mainloop NOARGS BOOLEAN rlink_allowed; BOOLEAN vi_keys_flag = vi_keys; BOOLEAN emacs_keys_flag = emacs_keys; - BOOLEAN LYRawMode_flag = LYRawMode; -#ifndef NO_OPTION_MENU - BOOLEAN LYSelectPopups_flag = LYSelectPopups; - BOOLEAN verbose_img_flag = verbose_img; BOOLEAN keypad_mode_flag = keypad_mode; - BOOLEAN show_dotfiles_flag = show_dotfiles; BOOLEAN user_mode_flag = user_mode; - int CurrentAssumeCharSet_flag = UCLYhndl_for_unspec; + BOOLEAN HTfileSortMethod_flag = HTfileSortMethod; int CurrentCharSet_flag = current_char_set; - int HTfileSortMethod_flag = HTfileSortMethod; -#endif + BOOLEAN show_dotfiles_flag = show_dotfiles; + BOOLEAN LYRawMode_flag = LYRawMode; + BOOLEAN LYSelectPopups_flag = LYSelectPopups; BOOLEAN trace_mode_flag = FALSE; BOOLEAN forced_HTML_mode = LYforce_HTML_mode; -#ifdef DISP_PARTIAL - BOOLEAN display_partial_flag = display_partial; -#endif char cfile[128]; FILE *cfp; char *cp, *toolbar; @@ -284,7 +240,8 @@ initialize: refresh(); } #endif /* USE_SLANG */ - CTRACE(tfp,"Entering mainloop, startfile=%s\n",startfile); + if (TRACE) + fprintf(stderr,"Entering mainloop, startfile=%s\n",startfile); if (form_post_data) { StrAllocCopy(newdoc.post_data, form_post_data); @@ -296,11 +253,13 @@ initialize: if (bookmark_start) { if (LYValidate) { - HTAlert(BOOKMARKS_DISABLED); + _statusline(BOOKMARKS_DISABLED); + sleep(AlertSecs); bookmark_start = FALSE; goto initialize; } else if (traversal) { - HTAlert(BOOKMARKS_NOT_TRAVERSED); + _statusline(BOOKMARKS_NOT_TRAVERSED); + sleep(AlertSecs); traversal = FALSE; crawl = FALSE; bookmark_start = FALSE; @@ -319,9 +278,11 @@ initialize: FREE(newdoc.post_content_type); newdoc.isHEAD = FALSE; newdoc.safe = FALSE; - CTRACE(tfp, "Using bookmarks=%s\n", newdoc.address); + if (TRACE) + fprintf(stderr, "Using bookmarks=%s\n", newdoc.address); } else { - HTUserMsg(BOOKMARKS_NOT_OPEN); + _statusline(BOOKMARKS_NOT_OPEN); + sleep(MessageSecs); bookmark_start = FALSE; goto initialize; } @@ -369,8 +330,7 @@ try_again: * elements to the curdoc structure elements * under case NORMAL. - FM */ - if (strncmp(newdoc.address, "LYNXDOWNLOAD:", 13)) - { + if (strncmp(newdoc.address, "LYNXDOWNLOAD:", 13)) { LYpush(&curdoc, ForcePush); } } else if (!newdoc.address) { @@ -472,11 +432,26 @@ try_again: WWWDoc.safe = newdoc.safe; tmpanchor = HTAnchor_parent(HTAnchor_findAddress(&WWWDoc)); if ((HText *)HTAnchor_document(tmpanchor) == NULL) { - if (!LYReopenTracelog(&trace_mode_flag)) { + if (TRACE) + fprintf(stderr, + "\nTurning off TRACE for fetch of log.\n"); + fflush(stdout); + fflush(stderr); + fclose(LYTraceLogFP); + *stderr = LYOrigStderr; + if ((LYTraceLogFP = LYAppendToTxtFile(LYTraceLogPath)) == NULL) { + WWW_TraceFlag = FALSE; + _statusline(TRACELOG_OPEN_FAILED); + sleep(MessageSecs); old_c = 0; cmd = LYK_PREV_DOC; goto new_cmd; } + *stderr = *LYTraceLogFP; + if (TRACE) { + WWW_TraceFlag = FALSE; + trace_mode_flag = TRUE; + } } } @@ -491,29 +466,6 @@ try_again: LYPermitURL = TRUE; } -#ifdef DISP_PARTIAL - display_partial = display_partial_flag; /* restore */ - Newline_partial = newdoc.line; /* initialize */ - NumOfLines_partial = -1; /* initialize to -1 */ - /* -1 restrict HTDisplayPartial() */ - /* until HText_new() start new HTMainText */ - /* and set the flag to 0 */ - if (display_partial) { - /* - * Disable display_partial if requested URL has #fragment - * and we are not popped from the history stack - * so can't calculate correct newline position for fragment. - * Otherwise user got the new document from the first page - * and be moved to #fragment later after download - * completed, but only if s/he did not mess screen up by - * scrolling before... So fall down to old behavior here. - */ - if (!LYCursesON || - (Newline_partial == 1 && strchr(newdoc.address, '#'))) - display_partial = FALSE; - } -#endif /* DISP_PARTIAL */ - #ifndef DONT_TRACK_INTERNAL_LINKS if (try_internal) { if (newdoc.address && @@ -578,7 +530,7 @@ try_again: if (trace_mode_flag == TRUE) { WWW_TraceFlag = TRUE; trace_mode_flag = FALSE; - fprintf(tfp, "Turning TRACE back on.\n\n"); + fprintf(stderr, "Turning TRACE back on.\n\n"); } if (error_logging && first_file && owner_address && !LYCancelledFetch) { @@ -640,14 +592,8 @@ try_again: startfile); else #endif /* UNIX */ - { - - SetOutputMode( O_TEXT ); printf("\nlynx: Can't access startfile %s\n", startfile); - SetOutputMode( O_BINARY ); - } - if (!dump_output_immediately) { #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_DFL); @@ -675,7 +621,7 @@ try_again: if (trace_mode_flag == TRUE) { WWW_TraceFlag = TRUE; trace_mode_flag = FALSE; - fprintf(tfp, "Turning TRACE back on.\n\n"); + fprintf(stderr, "Turning TRACE back on.\n\n"); } FREE(newdoc.address); /* to pop last doc */ FREE(newdoc.bookmark); @@ -744,13 +690,9 @@ try_again: } else #endif /* UNIX */ { - SetOutputMode( O_TEXT ); - printf( "\nlynx: Start file could not be found or is not text/html or text/plain\n"); printf(" Exiting...\n"); - - SetOutputMode( O_BINARY ); } if (!dump_output_immediately) { #ifndef NOSIGHUP @@ -815,9 +757,10 @@ try_again: } cmd = LYK_PREV_DOC; goto new_cmd; - } + } override_LYresubmit_posts = TRUE; goto try_again; + break; case NORMAL: /* @@ -828,7 +771,7 @@ try_again: if (trace_mode_flag == TRUE) { WWW_TraceFlag = TRUE; trace_mode_flag = FALSE; - fprintf(tfp, "Turning TRACE back on.\n\n"); + fprintf(stderr, "Turning TRACE back on.\n\n"); } *prev_target = '\0'; /* Reset for this document. - FM */ @@ -845,7 +788,15 @@ try_again: BOOKMARK_TITLE))) && (temp = HTParse(newdoc.address, "", PARSE_PATH+PARSE_PUNCTUATION)) != NULL) { - cp = wwwName(Home_Dir()); +#ifdef DOSPATH + cp = HTDOS_wwwName((char *)Home_Dir()); +#else +#ifdef VMS + cp = HTVMS_wwwName((char *)Home_Dir()); +#else + cp = (char *)Home_Dir(); +#endif /* VMS */ +#endif /* DOSPATH */ len = strlen(cp); #ifdef VMS if (!strncasecomp(temp, cp, len) && @@ -892,7 +843,8 @@ try_again: if (i <= MBM_V_MAXFILES) { FREE(temp); if (LYValidate) { - HTAlert(BOOKMARKS_DISABLED); + _statusline(BOOKMARKS_DISABLED); + sleep(AlertSecs); return(-1); } if ((temp = HTParse(newdoc.address, "", @@ -900,8 +852,17 @@ try_again: StrAllocCopy(newdoc.address, temp); HTuncache_current_document(); FREE(curdoc.address); +#ifdef DOSPATH StrAllocCat(newdoc.address, - wwwName(Home_Dir())); + HTDOS_wwwName((char *)Home_Dir())); +#else +#ifdef VMS + StrAllocCat(newdoc.address, + HTVMS_wwwName((char *)Home_Dir())); +#else + StrAllocCat(newdoc.address, Home_Dir()); +#endif /* VMS */ +#endif /* DOSPATH */ StrAllocCat(newdoc.address, "/"); StrAllocCat(newdoc.address, (strncmp(BookmarkPage, "./", 2) ? @@ -922,7 +883,9 @@ try_again: if (!strcmp(homepage, startfile)) StrAllocCopy(homepage, newdoc.address); StrAllocCopy(startfile, newdoc.address); - CTRACE(tfp, "Reloading as bookmarks=%s\n", + if (TRACE) + fprintf(stderr, + "Reloading as bookmarks=%s\n", newdoc.address); goto try_again; } @@ -976,22 +939,6 @@ try_again: * before, or it is 1 if this is a new file. */ Newline = newdoc.line; -#ifdef DISP_PARTIAL - if (display_partial) { - /* - * Override newdoc.line with a new value if user - * scrolled the document while downloading. - */ - if (Newline_partial != newdoc.line - && NumOfLines_partial > 0) - Newline = Newline_partial; - - /* - * End of incremental rendering stage here. - */ - display_partial = FALSE; - } -#endif /* DISP_PARTIAL */ /* * If we are going to a target line or @@ -1045,7 +992,7 @@ try_again: } else if (!dump_output_immediately) { StrAllocCopy(curdoc.title, newdoc.title); } - owner_address = (char *)HText_getOwner(); + owner_address = HText_getOwner(); curdoc.safe = HTLoadedDocumentIsSafe(); if (!dump_output_immediately) { LYAddVisitedLink(&curdoc); @@ -1129,7 +1076,9 @@ try_again: FREE(temp); if (!(temp = HTParse(curdoc.address, "", PARSE_PATH+PARSE_PUNCTUATION))) { - LYAddHtmlSep(&startrealm); + if (startrealm[strlen(startrealm)-1] != '/') { + StrAllocCat(startrealm, "/"); + } } else { if (forced_HTML_mode && !dump_output_immediately && @@ -1162,7 +1111,9 @@ try_again: } } FREE(temp); - CTRACE(tfp, "Starting realm is '%s'\n\n", startrealm); + if (TRACE) { + fprintf(stderr, "Starting realm is '%s'\n\n", startrealm); + } if (traversal) { /* * Set up the crawl output stuff. @@ -1187,11 +1138,16 @@ try_again: StrAllocCopy(traversal_host, "None"); } else { StrAllocCopy(traversal_host, temp); - LYAddHtmlSep(&traversal_host); + if (traversal_host[strlen(traversal_host)-1] != '/') { + StrAllocCat(traversal_host, "/"); + } } FREE(temp); } - CTRACE(tfp, "Traversal host is '%s'\n\n", traversal_host); + if (TRACE) { + fprintf(stderr, + "Traversal host is '%s'\n\n", traversal_host); + } } if (startfile) { /* @@ -1309,8 +1265,8 @@ try_again: /* * Report unread or new mail, if appropriate. */ - if (check_mail && !no_mail) - LYCheckMail(); + if (check_mail && !no_mail && LYCheckMail()) + sleep(MessageSecs); /* * If help is not on the screen, @@ -1347,7 +1303,7 @@ try_again: (links[curdoc.link].type & WWW_LINK_TYPE))) { #endif /* NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES */ #endif /* INDICATE_FORMS_MODE_FOR_ALL_LINKS_ON_PAGE */ - if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) { + if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) switch(links[curdoc.link].form->type) { case F_PASSWORD_TYPE: if (links[curdoc.link].form->disabled == YES) @@ -1420,15 +1376,14 @@ try_again: statusline(FORM_LINK_TEXT_MESSAGE); break; } - } else { + else statusline(NORMAL_LINK_MESSAGE); - } /* * Let them know if it's an index -- very rare. */ if (is_www_index) { - move(LYlines-1, LYcols-8); + move(LYlines-1,LYcols-8); start_reverse(); addstr("-index-"); stop_reverse(); @@ -1445,18 +1400,17 @@ try_again: } if (!cp) cp = links[curdoc.link].lname; - if (more) { + if (more) if (is_www_index) _user_message("-more- -index- %s", cp); else _user_message("-more- %s",cp); - } else { + else if (is_www_index) _user_message("-index- %s",cp); else statusline(cp); - } } else if (is_www_index && more) { char buf[128]; @@ -1552,7 +1506,7 @@ try_again: addstr(FORM_NOVICELINE_TWO); } c = change_form_link(&links[curdoc.link], - &newdoc, &refresh_screen, + FORM_UP, &newdoc, &refresh_screen, links[curdoc.link].form->name, links[curdoc.link].form->value); @@ -1705,8 +1659,8 @@ new_keyboard_input: cmd = keymap[c+1]; /* add 1 to map EOF to 0 */ #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) - if (lynx_edit_mode && key_override[c+1] && !no_dired_support) - cmd = key_override[c+1]; + if (lynx_edit_mode && override[c+1] && !no_dired_support) + cmd = override[c+1]; #endif /* DIRED_SUPPORT && OK_OVERRIDE */ real_cmd = cmd; @@ -1822,7 +1776,8 @@ new_cmd: /* StrAllocCopy(newdoc.address, curdoc.address); StrAllocCopy(newdoc.title, curdoc.title); newdoc.internal_link = curdoc.internal_link; - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); if (nlinks > 0) HText_pageDisplay(curdoc.line, prev_target); break; @@ -1840,7 +1795,8 @@ new_cmd: /* FREE(newdoc.post_data); FREE(newdoc.post_content_type); newdoc.internal_link = FALSE; - HTAlert(DISCARDING_POST_DATA); + _statusline(DISCARDING_POST_DATA); + sleep(AlertSecs); } } } @@ -1899,7 +1855,8 @@ new_cmd: /* StrAllocCopy(temp, user_input_buffer); sprintf(user_input_buffer, LINK_ALREADY_CURRENT, number); - HTUserMsg(user_input_buffer); + _statusline(user_input_buffer); + sleep(MessageSecs); strcpy(user_input_buffer, temp); FREE(temp); } else { @@ -1931,23 +1888,26 @@ new_cmd: /* * users (like me 8-). - FM */ if (Newline <= 1) { - HTInfoMsg(ALREADY_AT_BEGIN); + _statusline(ALREADY_AT_BEGIN); } else if (!more) { - HTInfoMsg(ALREADY_AT_END); + _statusline(ALREADY_AT_END); } else { StrAllocCopy(temp, user_input_buffer); sprintf(user_input_buffer, ALREADY_AT_PAGE, number); - HTUserMsg(user_input_buffer); + _statusline(user_input_buffer); + sleep(MessageSecs); strcpy(user_input_buffer, temp); FREE(temp); } + sleep(MessageSecs); } break; case PRINT_ERROR: old_c = real_c; - HTUserMsg(BAD_LINK_NUM_ENTERED); + _statusline(BAD_LINK_NUM_ENTERED); + sleep(MessageSecs); break; } break; @@ -1962,7 +1922,8 @@ new_cmd: /* curdoc.safe != TRUE) && confirm_post_resub(curdoc.address, curdoc.title, 1, 1) == FALSE) { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); break; } @@ -1986,7 +1947,8 @@ new_cmd: /* if ((curdoc.post_data != NULL && curdoc.safe != TRUE) && HTConfirm(CONFIRM_POST_RESUBMISSION) == FALSE) { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); break; } @@ -2017,10 +1979,13 @@ new_cmd: /* * page, lynx_mode won't have this setting and we won't * know that this warning should be issued. - FM */ - HTAlert(RELOADING_FORM); + _statusline(RELOADING_FORM); + sleep(AlertSecs); } - newdoc.line = curdoc.line; - newdoc.link = curdoc.link; + newdoc.line = ((curdoc.line > 0) ? + curdoc.line : 1); + newdoc.link = ((curdoc.link > -1) ? + curdoc.link : 0); #endif /* NO_ASSUME_SAME_DOC */ FREE(curdoc.address); /* so it doesn't get pushed */ #ifdef VMS @@ -2038,7 +2003,7 @@ new_cmd: /* reloading = TRUE; break; - case LYK_HISTORICAL: /* toggle 'historical' comments parsing */ + case LYK_HISTORICAL: /* * Check if this is a reply from a POST, and if so, * seek confirmation of reload if the safe element @@ -2048,28 +2013,28 @@ new_cmd: /* curdoc.safe != TRUE) && confirm_post_resub(curdoc.address, NULL, 0, 0) == FALSE) { - HTInfoMsg(WILL_NOT_RELOAD_DOC); + _statusline(WILL_NOT_RELOAD_DOC); + sleep(InfoSecs); } else { HTuncache_current_document(); StrAllocCopy(newdoc.address, curdoc.address); FREE(curdoc.address); - newdoc.line = curdoc.line; - newdoc.link = curdoc.link; } if (historical_comments) historical_comments = FALSE; else historical_comments = TRUE; if (minimal_comments) { - HTAlert(historical_comments ? + _statusline(historical_comments ? HISTORICAL_ON_MINIMAL_OFF : HISTORICAL_OFF_MINIMAL_ON); } else { - HTAlert(historical_comments ? + _statusline(historical_comments ? HISTORICAL_ON_VALID_OFF : HISTORICAL_OFF_VALID_ON); } + sleep(AlertSecs); break; - case LYK_MINIMAL: /* toggle 'minimal' comments parsing */ + case LYK_MINIMAL: if (!historical_comments) { /* * Check if this is a reply from a POST, and if so, @@ -2080,13 +2045,12 @@ new_cmd: /* curdoc.safe != TRUE) && confirm_post_resub(curdoc.address, NULL, 0, 0) == FALSE) { - HTInfoMsg(WILL_NOT_RELOAD_DOC); + _statusline(WILL_NOT_RELOAD_DOC); + sleep(InfoSecs); } else { HTuncache_current_document(); StrAllocCopy(newdoc.address, curdoc.address); FREE(curdoc.address); - newdoc.line = curdoc.line; - newdoc.link = curdoc.link; } } if (minimal_comments) @@ -2094,12 +2058,13 @@ new_cmd: /* else minimal_comments = TRUE; if (!historical_comments) { - HTAlert(minimal_comments ? + _statusline(minimal_comments ? MINIMAL_ON_IN_EFFECT : MINIMAL_OFF_VALID_ON); } else { - HTAlert(minimal_comments ? + _statusline(minimal_comments ? MINIMAL_ON_BUT_HISTORICAL : MINIMAL_OFF_HISTORICAL_ON); } + sleep(AlertSecs); break; case LYK_SOFT_DQUOTES: @@ -2112,20 +2077,20 @@ new_cmd: /* curdoc.safe != TRUE) && confirm_post_resub(curdoc.address, NULL, 1, 1) == FALSE) { - HTInfoMsg(WILL_NOT_RELOAD_DOC); + _statusline(WILL_NOT_RELOAD_DOC); + sleep(InfoSecs); } else { HTuncache_current_document(); StrAllocCopy(newdoc.address, curdoc.address); FREE(curdoc.address); - newdoc.line = curdoc.line; - newdoc.link = curdoc.link; } if (soft_dquotes) soft_dquotes = FALSE; else soft_dquotes = TRUE; - HTUserMsg(soft_dquotes ? + _statusline(soft_dquotes ? SOFT_DOUBLE_QUOTE_ON : SOFT_DOUBLE_QUOTE_OFF); + sleep(MessageSecs); break; case LYK_SWITCH_DTD: @@ -2138,7 +2103,8 @@ new_cmd: /* curdoc.safe != TRUE) && confirm_post_resub(curdoc.address, NULL, 1, 1) == FALSE) { - HTInfoMsg(WILL_NOT_RELOAD_DOC); + _statusline(WILL_NOT_RELOAD_DOC); + sleep(InfoSecs); } else { /* * If currently viewing preparsed source, switching @@ -2153,18 +2119,19 @@ new_cmd: /* FREE(curdoc.address); } #ifdef NO_ASSUME_SAME_DOC - newdoc.line = 1; - newdoc.link = 0; + newdoc.line=1; + newdoc.link=0; #else - newdoc.line = curdoc.line; - newdoc.link = curdoc.link; + newdoc.line = ((curdoc.line > 0) ? curdoc.line : 1); + newdoc.link = ((curdoc.link > -1) ? curdoc.link : 0); #endif /* NO_ASSUME_SAME_DOC */ if (New_DTD) New_DTD = NO; else New_DTD = YES; HTSwitchDTD(New_DTD); - HTUserMsg(New_DTD ? USING_DTD_1 : USING_DTD_0); + _statusline(New_DTD ? USING_DTD_1 : USING_DTD_0); + sleep(MessageSecs); break; #ifdef NOT_DONE_YET @@ -2185,17 +2152,20 @@ new_cmd: /* c != 7) { return(0); } else { - HTInfoMsg(NO_CANCEL); + statusline(NO_CANCEL); + sleep(InfoSecs); } } else if (TOUPPER(c) == 'Y') { return(0); } else { - HTInfoMsg(NO_CANCEL); + statusline(NO_CANCEL); + sleep(InfoSecs); } break; case LYK_ABORT: /* don't ask the user about quitting */ return(0); + break; case LYK_NEXT_PAGE: /* next page */ if (more) { @@ -2205,7 +2175,8 @@ new_cmd: /* curdoc.link = nlinks-1; /* put on last link */ } else if (old_c != real_c) { old_c = real_c; - HTInfoMsg(ALREADY_AT_END); + _statusline(ALREADY_AT_END); + sleep(MessageSecs); } break; @@ -2217,7 +2188,8 @@ new_cmd: /* curdoc.link = 0; /* put on first link */ } else if (old_c != real_c) { old_c = real_c; - HTInfoMsg(ALREADY_AT_BEGIN); + _statusline(ALREADY_AT_BEGIN); + sleep(MessageSecs); } break; @@ -2236,7 +2208,8 @@ new_cmd: /* } } else if (old_c != real_c) { old_c = real_c; - HTInfoMsg(ALREADY_AT_BEGIN); + _statusline(ALREADY_AT_BEGIN); + sleep(MessageSecs); } break; @@ -2251,7 +2224,8 @@ new_cmd: /* } } else if (old_c != real_c) { old_c = real_c; - HTInfoMsg(ALREADY_AT_END); + _statusline(ALREADY_AT_END); + sleep(MessageSecs); } break; @@ -2273,7 +2247,8 @@ new_cmd: /* } } else if (old_c != real_c) { old_c = real_c; - HTInfoMsg(ALREADY_AT_BEGIN); + _statusline(ALREADY_AT_BEGIN); + sleep(MessageSecs); } break; @@ -2288,7 +2263,8 @@ new_cmd: /* } } else if (old_c != real_c) { old_c = real_c; - HTInfoMsg(ALREADY_AT_END); + _statusline(ALREADY_AT_END); + sleep(MessageSecs); } break; @@ -2308,7 +2284,7 @@ new_cmd: /* case LYK_END: if (more) { - Newline = lines_in_file - display_lines + 3; /* go to end of file */ + Newline = MAXINT; /* go to end of file */ arrowup = TRUE; /* position on last link */ } else { cmd = LYK_NEXT_PAGE; @@ -2354,7 +2330,8 @@ new_cmd: /* } else if (old_c != real_c) { old_c = real_c; - HTInfoMsg(ALREADY_AT_BEGIN); + _statusline(ALREADY_AT_BEGIN); + sleep(MessageSecs); } break; @@ -2396,7 +2373,8 @@ new_cmd: /* } else if (old_c != real_c) { old_c = real_c; - HTInfoMsg(ALREADY_AT_END); + _statusline(ALREADY_AT_END); + sleep(MessageSecs); } break; @@ -2425,7 +2403,8 @@ new_cmd: /* #else } else if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_LINKS_ABOVE); + _statusline(NO_LINKS_ABOVE); + sleep(MessageSecs); #endif /* NOTDEFINED */ } @@ -2455,7 +2434,8 @@ new_cmd: /* } else if (old_c != real_c) { old_c = real_c; - HTInfoMsg(ALREADY_AT_BEGIN); + _statusline(ALREADY_AT_BEGIN); + sleep(MessageSecs); } break; @@ -2481,7 +2461,8 @@ new_cmd: /* Newline += (display_lines); } else if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_LINKS_BELOW); + _statusline(NO_LINKS_BELOW); + sleep(MessageSecs); break; } #ifdef NOTDEFINED @@ -2498,7 +2479,8 @@ new_cmd: /* } else if (old_c != real_c) { old_c = real_c; - HTInfoMsg(ALREADY_AT_END); + _statusline(ALREADY_AT_END); + sleep(MessageSecs); } break; @@ -2648,12 +2630,14 @@ new_cmd: /* goto new_cmd; } if (nhist == 1) { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); old_c = 0; cmd = LYK_DO_NOTHING; goto new_cmd; } else { - HTUserMsg2(WWW_SKIP_MESSAGE, WWWDoc.address); + _user_message(WWW_SKIP_MESSAGE, WWWDoc.address); + sleep(MessageSecs); do { LYpop(&curdoc); } while (nhist > 1 && !are_different( @@ -2691,7 +2675,8 @@ new_cmd: /* } else if (old_c != real_c) { old_c = real_c; - HTUserMsg(ALREADY_AT_FIRST); + _statusline(ALREADY_AT_FIRST); + sleep(MessageSecs); } break; @@ -2703,7 +2688,8 @@ new_cmd: /* if (old_c == real_c) break; old_c = real_c; - HTUserMsg(NOT_ON_SUBMIT_OR_LINK); + _statusline(NOT_ON_SUBMIT_OR_LINK); + sleep(MessageSecs); break; } else { LYforce_no_cache = TRUE; @@ -2742,7 +2728,8 @@ new_cmd: /* if (!links[curdoc.link].form->submit_action || *links[curdoc.link].form->submit_action == '\0') { - HTUserMsg(NO_FORM_ACTION); + _statusline(NO_FORM_ACTION); + sleep(MessageSecs); HTOutputFormat = WWW_PRESENT; LYforce_no_cache = FALSE; reloading = FALSE; @@ -2821,8 +2808,11 @@ new_cmd: /* links[curdoc.link].form->submit_action, "lynxprog:", 9)) { HTAlert(SPECIAL_ACTION_DISALLOWED); - CTRACE(tfp, "LYMainLoop: Rejected '%s'\n", + if (TRACE) { + fprintf(stderr, + "LYMainLoop: Rejected '%s'\n", links[curdoc.link].form->submit_action); + } HTOutputFormat = WWW_PRESENT; LYforce_no_cache = FALSE; reloading = FALSE; @@ -2857,7 +2847,7 @@ new_cmd: /* links[curdoc.link].hightext); } c = change_form_link(&links[curdoc.link], - &newdoc, &refresh_screen, + FORM_UP, &newdoc, &refresh_screen, links[curdoc.link].form->name, links[curdoc.link].form->value); if (HTOutputFormat == HTAtom_for("www/download") && @@ -2865,7 +2855,8 @@ new_cmd: /* newdoc.safe == FALSE) { if ((HText_POSTReplyLoaded(&newdoc) == TRUE) && HTConfirm(CONFIRM_POST_RESUBMISSION) == FALSE) { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); HTOutputFormat = WWW_PRESENT; LYforce_no_cache = FALSE; StrAllocCopy(newdoc.address, curdoc.address); @@ -3021,7 +3012,8 @@ new_cmd: /* StrAllocCopy(newdoc.address, curdoc.address); StrAllocCopy(newdoc.title, curdoc.title); newdoc.internal_link = curdoc.internal_link; - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); break; } else if (LYresubmit_posts && cmd != LYK_NOCACHE) { @@ -3039,7 +3031,8 @@ new_cmd: /* FREE(newdoc.post_data); FREE(newdoc.post_content_type); newdoc.internal_link = FALSE; - HTAlert(DISCARDING_POST_DATA); + _statusline(DISCARDING_POST_DATA); + sleep(AlertSecs); } } } @@ -3116,7 +3109,8 @@ new_cmd: /* */ if (old_c != real_c) { old_c = real_c; - HTUserMsg(GOTO_DISALLOWED); + _statusline(GOTO_DISALLOWED); + sleep(MessageSecs); } break; } @@ -3131,7 +3125,8 @@ new_cmd: /* */ if (old_c != real_c) { old_c = real_c; - HTUserMsg(NOT_ON_SUBMIT_OR_LINK); + _statusline(NOT_ON_SUBMIT_OR_LINK); + sleep(MessageSecs); } break; } @@ -3143,7 +3138,8 @@ new_cmd: /* */ if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_FORM_ACTION); + _statusline(NO_FORM_ACTION); + sleep(MessageSecs); } break; } @@ -3164,7 +3160,8 @@ new_cmd: /* */ if (old_c != real_c) { old_c = real_c; - HTUserMsg(EDIT_FM_MENU_URLS_DISALLOWED); + _statusline(EDIT_FM_MENU_URLS_DISALLOWED); + sleep(MessageSecs); } break; } @@ -3205,7 +3202,7 @@ new_cmd: /* HTUnEscapeSome(user_input_buffer, " \r\n\t"); convert_to_spaces(user_input_buffer, TRUE); } else { - LYRemoveBlanks(user_input_buffer); + collapse_spaces(user_input_buffer); } if (user_input_buffer[0] != '\0') { goto check_goto_URL; @@ -3215,7 +3212,8 @@ new_cmd: /* * User cancelled via ^G, a full deletion, * or not modifying the URL. - FM */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); strcpy(user_input_buffer, temp); FREE(temp); break; @@ -3227,7 +3225,8 @@ new_cmd: /* */ if (old_c != real_c) { old_c = real_c; - HTUserMsg(GOTO_DISALLOWED); + _statusline(GOTO_DISALLOWED); + sleep(MessageSecs); } break; } @@ -3246,7 +3245,8 @@ new_cmd: /* */ if (old_c != real_c) { old_c = real_c; - HTUserMsg(EDIT_FM_MENU_URLS_DISALLOWED); + _statusline(EDIT_FM_MENU_URLS_DISALLOWED); + sleep(MessageSecs); } break; } @@ -3289,7 +3289,7 @@ new_cmd: /* HTUnEscapeSome(user_input_buffer, " \r\n\t"); convert_to_spaces(user_input_buffer, TRUE); } else { - LYRemoveBlanks(user_input_buffer); + collapse_spaces(user_input_buffer); } if (user_input_buffer[0] != '\0') { goto check_goto_URL; @@ -3299,7 +3299,8 @@ new_cmd: /* * User cancelled via ^G, a full deletion, * or not modifying the URL. - FM */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); strcpy(user_input_buffer, temp); FREE(temp); break; @@ -3308,7 +3309,8 @@ new_cmd: /* if (no_goto && !LYValidate) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(GOTO_DISALLOWED); + _statusline(GOTO_DISALLOWED); + sleep(MessageSecs); } break; } @@ -3340,7 +3342,8 @@ new_cmd: /* */ strcpy(user_input_buffer, temp); FREE(temp); - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); break; } @@ -3361,13 +3364,14 @@ check_recall: HTUnEscapeSome(user_input_buffer, " \r\n\t"); convert_to_spaces(user_input_buffer, TRUE); } else { - LYRemoveBlanks(user_input_buffer); + collapse_spaces(user_input_buffer); } if (*user_input_buffer == '\0' && !(recall && (ch == UPARROW || ch == DNARROW))) { strcpy(user_input_buffer, temp); FREE(temp); - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); break; } if (recall && ch == UPARROW) { @@ -3409,7 +3413,8 @@ check_recall: */ strcpy(user_input_buffer, temp); FREE(temp); - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); break; } goto check_recall; @@ -3453,7 +3458,8 @@ check_recall: */ strcpy(user_input_buffer, temp); FREE(temp); - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); break; } goto check_recall; @@ -3472,7 +3478,8 @@ check_goto_URL: FREE(temp); if ((no_file_url || no_goto_file) && !strncmp(user_input_buffer,"file:",5)) { - HTUserMsg(GOTO_FILE_DISALLOWED); + _statusline(GOTO_FILE_DISALLOWED); + sleep(MessageSecs); } else if ((no_shell || no_goto_lynxexec #ifdef EXEC_LINKS @@ -3480,7 +3487,8 @@ check_goto_URL: #endif /* EXEC_LINKS */ ) && !strncmp(user_input_buffer, "lynxexec:",9)) { - HTUserMsg(GOTO_EXEC_DISALLOWED); + _statusline(GOTO_EXEC_DISALLOWED); + sleep(MessageSecs); } else if ((no_shell || no_goto_lynxprog #ifdef EXEC_LINKS @@ -3488,79 +3496,96 @@ check_goto_URL: #endif /* EXEC_LINKS */ ) && !strncmp(user_input_buffer, "lynxprog:",9)) { - HTUserMsg(GOTO_PROG_DISALLOWED); + _statusline(GOTO_PROG_DISALLOWED); + sleep(MessageSecs); } else if ((no_shell || no_goto_lynxcgi) && !strncmp(user_input_buffer, "lynxcgi:", 8)) { - HTUserMsg(GOTO_CGI_DISALLOWED); + _statusline(GOTO_CGI_DISALLOWED); + sleep(MessageSecs); } else if (LYValidate && strncmp(user_input_buffer, "http:", 5) && strncmp(user_input_buffer, "https:", 6)) { - HTUserMsg(GOTO_NON_HTTP_DISALLOWED); + _statusline(GOTO_NON_HTTP_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_cso && !strncmp(user_input_buffer, "cso:", 4)) { - HTUserMsg(GOTO_CSO_DISALLOWED); + _statusline(GOTO_CSO_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_finger && !strncmp(user_input_buffer, "finger:", 7)) { - HTUserMsg(GOTO_FINGER_DISALLOWED); + _statusline(GOTO_FINGER_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_ftp && !strncmp(user_input_buffer, "ftp:", 4)) { - HTUserMsg(GOTO_FTP_DISALLOWED); + _statusline(GOTO_FTP_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_gopher && !strncmp(user_input_buffer, "gopher:", 7)) { - HTUserMsg(GOTO_GOPHER_DISALLOWED); + _statusline(GOTO_GOPHER_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_http && !strncmp(user_input_buffer, "http:", 5)) { - HTUserMsg(GOTO_HTTP_DISALLOWED); + _statusline(GOTO_HTTP_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_https && !strncmp(user_input_buffer, "https:", 6)) { - HTUserMsg(GOTO_HTTPS_DISALLOWED); + _statusline(GOTO_HTTPS_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_mailto && !strncmp(user_input_buffer, "mailto:", 7)) { - HTUserMsg(GOTO_MAILTO_DISALLOWED); + _statusline(GOTO_MAILTO_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_news && !strncmp(user_input_buffer, "news:", 5)) { - HTUserMsg(GOTO_NEWS_DISALLOWED); + _statusline(GOTO_NEWS_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_nntp && !strncmp(user_input_buffer, "nntp:", 5)) { - HTUserMsg(GOTO_NNTP_DISALLOWED); + _statusline(GOTO_NNTP_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_rlogin && !strncmp(user_input_buffer, "rlogin:", 7)) { - HTUserMsg(GOTO_RLOGIN_DISALLOWED); + _statusline(GOTO_RLOGIN_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_snews && !strncmp(user_input_buffer, "snews:", 6)) { - HTUserMsg(GOTO_SNEWS_DISALLOWED); + _statusline(GOTO_SNEWS_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_telnet && !strncmp(user_input_buffer, "telnet:", 7)) { - HTUserMsg(GOTO_TELNET_DISALLOWED); + _statusline(GOTO_TELNET_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_tn3270 && !strncmp(user_input_buffer, "tn3270:", 7)) { - HTUserMsg(GOTO_TN3270_DISALLOWED); + _statusline(GOTO_TN3270_DISALLOWED); + sleep(MessageSecs); } else if (no_goto_wais && !strncmp(user_input_buffer, "wais:", 5)) { - HTUserMsg(GOTO_WAIS_DISALLOWED); + _statusline(GOTO_WAIS_DISALLOWED); + sleep(MessageSecs); } else if (!strncmp(user_input_buffer, "LYNXCOOKIE:", 11) || !strncmp(user_input_buffer, "LYNXDIRED:", 10) || !strncmp(user_input_buffer, "LYNXDOWNLOAD:", 13) || - !strncmp(user_input_buffer, "LYNXOPTIONS:", 12) || !strncmp(user_input_buffer, "LYNXPRINT:", 10)) { - HTUserMsg(GOTO_SPECIAL_DISALLOWED); + _statusline(GOTO_SPECIAL_DISALLOWED); + sleep(MessageSecs); } else { StrAllocCopy(newdoc.address, user_input_buffer); @@ -3618,7 +3643,8 @@ check_goto_URL: if (indexfile[0]=='\0') { /* no defined index */ if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_INDEX_FILE); + _statusline(NO_INDEX_FILE); + sleep(MessageSecs); } } else { @@ -3640,7 +3666,7 @@ check_goto_URL: if (lynx_mode == FORMS_LYNX_MODE) { if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) { c = change_form_link(&links[curdoc.link], - &newdoc, &refresh_screen, + FORM_UP, &newdoc, &refresh_screen, links[curdoc.link].form->name, links[curdoc.link].form->value); /* @@ -3665,7 +3691,7 @@ check_goto_URL: if (lynx_mode==FORMS_LYNX_MODE) { if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) { c = change_form_link(&links[curdoc.link], - &newdoc,&refresh_screen, + FORM_DOWN,&newdoc,&refresh_screen, links[curdoc.link].form->name, links[curdoc.link].form->value); goto new_keyboard_input; @@ -3708,7 +3734,8 @@ check_goto_URL: } else { if (old_c != real_c) { old_c = real_c; - HTUserMsg(IN_MAIN_SCREEN); + _statusline(IN_MAIN_SCREEN); + sleep(MessageSecs); } } break; @@ -3717,10 +3744,7 @@ check_goto_URL: #ifdef DIRED_SUPPORT c = dir_list_style; #endif /* DIRED_SUPPORT */ -#ifndef NO_OPTION_MENU -if (!LYUseFormsOptions) { - - LYoptions(); /* do the old-style options stuff */ + options(); /* do the options stuff */ if (keypad_mode_flag != keypad_mode || (user_mode_flag != user_mode && @@ -3734,8 +3758,6 @@ if (!LYUseFormsOptions) { (!strncmp(curdoc.address, "file:", 5) || !strncmp(curdoc.address, "ftp:", 4))) || CurrentCharSet_flag != current_char_set || - CurrentAssumeCharSet_flag != UCLYhndl_for_unspec || - verbose_img_flag != verbose_img || LYRawMode_flag != LYRawMode || LYSelectPopups_flag != LYSelectPopups || ((strcmp(CurrentUserAgent, (LYUserAgent ? @@ -3755,7 +3777,9 @@ if (!LYUseFormsOptions) { curdoc.safe != TRUE) && confirm_post_resub(curdoc.address, curdoc.title, 2, 1) == FALSE) { - HTInfoMsg(WILL_NOT_RELOAD_DOC); + _statusline(WILL_NOT_RELOAD_DOC); + sleep(InfoSecs); + } else { StrAllocCopy(newdoc.address, curdoc.address); if (((strcmp(CurrentUserAgent, (LYUserAgent ? @@ -3780,7 +3804,8 @@ if (!LYUseFormsOptions) { reloading = TRUE; } if (lynx_mode == FORMS_LYNX_MODE) { - HTAlert(RELOADING_FORM); + _statusline(RELOADING_FORM); + sleep(AlertSecs); } if (HTisDocumentSource()) { HTOutputFormat = WWW_SOURCE; @@ -3791,8 +3816,10 @@ if (!LYUseFormsOptions) { newdoc.line = 1; newdoc.link = 0; #else - newdoc.line = curdoc.line; - newdoc.link = curdoc.link; + newdoc.line = ((curdoc.line > 0) ? + curdoc.line : 1); + newdoc.link = ((curdoc.link > -1) ? + curdoc.link : 0); #endif /* NO_ASSUME_SAME_DOC */ LYforce_no_cache = TRUE; FREE(curdoc.address); /* So it doesn't get pushed. */ @@ -3802,9 +3829,7 @@ if (!LYUseFormsOptions) { user_mode_flag = user_mode; HTfileSortMethod_flag = HTfileSortMethod; CurrentCharSet_flag = current_char_set; - CurrentAssumeCharSet_flag = UCLYhndl_for_unspec; show_dotfiles_flag = show_dotfiles; - verbose_img_flag = verbose_img; LYRawMode_flag = LYRawMode; LYSelectPopups_flag = LYSelectPopups; StrAllocCopy(CurrentUserAgent, (LYUserAgent ? @@ -3815,42 +3840,6 @@ if (!LYUseFormsOptions) { pref_charset : "")); refresh_screen = TRUE; /* to repaint screen */ break; -} /* end if !LYUseFormsOptions */ -#endif /* !NO_OPTION_MENU */ -#ifndef NO_OPTION_FORMS - /* - * FIXME: Blatantly stolen from LYK_PRINT below. - * how much is really valid here? I don't know the - * innards well enough. MRC - */ - /* - * Don't do if already viewing options page. - */ - if (strcmp((curdoc.title ? curdoc.title : ""), - OPTIONS_TITLE)) { - - if (gen_options(&newdoc.address) < 0) - break; - StrAllocCopy(newdoc.title, OPTIONS_TITLE); - FREE(newdoc.post_data); - FREE(newdoc.post_content_type); - FREE(newdoc.bookmark); - newdoc.isHEAD = FALSE; - newdoc.safe = FALSE; - if (check_realm) - LYPermitURL = TRUE; - refresh_screen = TRUE; /* redisplay */ - - /* - * FIXME: this is a temporary solution until we find the - * correct place for this command to reload the document - * before the 'options menu' only when (few) important options - * were changed. - */ - HTuncache_current_document(); - } -#endif /* !NO_OPTION_FORMS */ - break; case LYK_INDEX_SEARCH: /* search for a user string */ if (is_www_index) { @@ -3924,7 +3913,8 @@ if (!LYUseFormsOptions) { } } else if (old_c != real_c) { old_c = real_c; - HTUserMsg(NOT_ISINDEX); + _statusline(NOT_ISINDEX); + sleep(MessageSecs); } break; @@ -4001,12 +3991,14 @@ if (!LYUseFormsOptions) { strncasecomp(curdoc.address, "http", 4)) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_OWNER); + _statusline(NO_OWNER); + sleep(MessageSecs); } } else if (no_mail) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(MAIL_DISALLOWED); + _statusline(MAIL_DISALLOWED); + sleep(MessageSecs); } } else { _statusline(CONFIRM_COMMENT); @@ -4062,17 +4054,17 @@ if (!LYUseFormsOptions) { /* * The owner_address is a mailto: URL. */ - CONST char *kp = HText_getRevTitle(); + cp = HText_getRevTitle(); if (strchr(owner_address,':')!=NULL) /* * Send a reply. The address is after the colon. */ reply_by_mail(strchr(owner_address,':')+1, curdoc.address, - (kp ? kp : "")); + (cp ? cp : "")); else reply_by_mail(owner_address, curdoc.address, - (kp ? kp : "")); + (cp ? cp : "")); refresh_screen = TRUE; /* to force a showpage */ } @@ -4175,7 +4167,8 @@ if (!LYUseFormsOptions) { if (no_editor) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(EDIT_DISABLED); + _statusline(EDIT_DISABLED); + sleep(MessageSecs); } break; } @@ -4190,15 +4183,23 @@ if (!LYUseFormsOptions) { if (nlinks > 0) { cp = links[curdoc.link].lname; if (is_url(cp) == FILE_URL_TYPE) { - cp = HTfullURL_toFile(cp); - StrAllocCopy(tp, cp); - free(cp); - + if (!strncmp(cp, "file://localhost", 16)) { + /* + * This is the only case that should occur. - kw + */ + StrAllocCopy(tp, cp + 16); + } else if (!strncmp(cp, "file:", 5)) { + StrAllocCopy(tp, cp + 5); + } else { + StrAllocCopy(tp, cp); + } + HTUnEscape(tp); if (stat(tp, &dir_info) == -1) { - HTAlert(NO_STATUS); + _statusline(NO_STATUS); + sleep(AlertSecs); } else { - if (S_ISREG(dir_info.st_mode)) { - StrAllocCopy(tp, links[curdoc.link].lname); + if (((dir_info.st_mode) & S_IFMT) == S_IFREG) { + StrAllocCopy(tp, cp); HTUnEscapeSome(tp, "/"); if (edit_current_file(tp, curdoc.link, Newline)) { @@ -4217,8 +4218,10 @@ if (!LYUseFormsOptions) { * Seek old position, * which probably changed. */ - newdoc.line = curdoc.line; - newdoc.link = curdoc.link; + newdoc.line = + ((curdoc.line > 0) ? curdoc.line : 1); + newdoc.link = + ((curdoc.link > -1) ? curdoc.link : 0); #endif /* NO_SEEK_OLD_POSITION */ clear(); /* clear the screen */ } @@ -4253,7 +4256,8 @@ if (!LYUseFormsOptions) { } else { if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_EDITOR); + _statusline(NO_EDITOR); + sleep(MessageSecs); } } break; @@ -4311,8 +4315,8 @@ if (!LYUseFormsOptions) { */ if (strcmp((curdoc.title ? curdoc.title : ""), SHOWINFO_TITLE)) { - if (showinfo(&curdoc, lines_in_file, - &newdoc, owner_address) < 0) + if (!showinfo(&curdoc, lines_in_file, + &newdoc, owner_address)) break; StrAllocCopy(newdoc.title, SHOWINFO_TITLE); FREE(newdoc.post_data); @@ -4337,7 +4341,8 @@ if (!LYUseFormsOptions) { if (LYValidate) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(PRINT_DISABLED); + _statusline(PRINT_DISABLED); + sleep(MessageSecs); } break; } @@ -4348,8 +4353,7 @@ if (!LYUseFormsOptions) { if (strcmp((curdoc.title ? curdoc.title : ""), PRINT_OPTIONS_TITLE)) { - if (print_options(&newdoc.address, - &curdoc.address, lines_in_file) < 0) + if (print_options(&newdoc.address, lines_in_file) < 0) break; StrAllocCopy(newdoc.title, PRINT_OPTIONS_TITLE); FREE(newdoc.post_data); @@ -4357,7 +4361,7 @@ if (!LYUseFormsOptions) { FREE(newdoc.bookmark); newdoc.isHEAD = FALSE; newdoc.safe = FALSE; - ForcePush = TRUE; /* see LYpush() and print_options() */ + ForcePush = TRUE; if (check_realm) LYPermitURL = TRUE; refresh_screen = TRUE; /* redisplay */ @@ -4411,7 +4415,8 @@ if (!LYUseFormsOptions) { * Print visited links page to file. */ if (LYShowVisitedLinks(&newdoc.address) < 0) { - HTUserMsg(VISITED_LINKS_EMPTY); + _statusline(VISITED_LINKS_EMPTY); + sleep(MessageSecs); break; } StrAllocCopy(newdoc.title, VISITED_LINKS_TITLE); @@ -4432,7 +4437,8 @@ if (!LYUseFormsOptions) { if (!HText_hasToolbar(HTMainText)) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_TOOLBAR); + _statusline(NO_TOOLBAR); + sleep(MessageSecs); } } else if (old_c != real_c) { old_c = real_c; @@ -4469,7 +4475,8 @@ if (!LYUseFormsOptions) { HTDirAccess == HT_DIR_SELECTIVE) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(DFM_NOT_AVAILABLE); + _statusline(DFM_NOT_AVAILABLE); + sleep(MessageSecs); } break; } @@ -4495,7 +4502,8 @@ if (!LYUseFormsOptions) { cp = HTParse(curdoc.address, "", PARSE_PATH|PARSE_PUNCTUATION); HTUnEscape(cp); if (HTStat(cp, &stat_info) == -1) { - CTRACE(tfp, "mainloop: Can't stat %s\n", cp); + if (TRACE) + fprintf(stderr, "mainloop: Can't stat %s\n", cp); FREE(cp); temp = (char *)calloc(1, (strlen(LYCSwingPath) + 4)); if (temp == NULL) @@ -4505,12 +4513,13 @@ if (!LYUseFormsOptions) { } else { char *VMSdir = NULL; - if (S_ISDIR(stat_info.st_mode)) { + if (((stat_info.st_mode) & S_IFMT) == S_IFDIR) { /* * We're viewing a local directory. Make * that the CSwing argument. - FM */ - LYAddPathSep(&cp); + if (cp[(strlen(cp) - 1)] != '/') + StrAllocCat(cp, "/"); StrAllocCopy(VMSdir, HTVMS_name("", cp)); FREE(cp); } else { @@ -4564,7 +4573,7 @@ if (!LYUseFormsOptions) { refresh_screen = TRUE; /* redisplay */ } stop_curses(); - LYSystem(temp); + system(temp); start_curses(); FREE(temp); break; @@ -4585,11 +4594,8 @@ if (!LYUseFormsOptions) { #ifdef USE_EXTERNALS case LYK_EXTERN: /* use external program on url */ - if ((nlinks > 0) && (links[curdoc.link].lname != NULL)) - { - run_external(links[curdoc.link].lname); - refresh_screen = TRUE; - } + run_external(links[curdoc.link].lname); + refresh_screen = TRUE; break; #endif /* USE_EXTERNALS */ @@ -4597,7 +4603,8 @@ if (!LYUseFormsOptions) { if (LYValidate) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(BOOKMARKS_DISABLED); + _statusline(BOOKMARKS_DISABLED); + sleep(MessageSecs); } break; } @@ -4636,8 +4643,6 @@ if (!LYUseFormsOptions) { strncmp(links[curdoc.link].lname, "LYNXCOOKIE:", 11) && strncmp(links[curdoc.link].lname, - "LYNXOPTIONS:", 12) && - strncmp(links[curdoc.link].lname, "LYNXLIST:", 9)))) { if (nlinks > 0) { if (curdoc.post_data == NULL && @@ -4678,7 +4683,8 @@ if (!LYUseFormsOptions) { /* * Internal link, and document has POST content. */ - HTUserMsg(NOBOOK_POST_FORM); + _statusline(NOBOOK_POST_FORM); + sleep(MessageSecs); break; } else { /* @@ -4697,7 +4703,8 @@ if (!LYUseFormsOptions) { /* * Internal link, and document has POST content. */ - HTUserMsg(NOBOOK_POST_FORM); + _statusline(NOBOOK_POST_FORM); + sleep(MessageSecs); break; } /* @@ -4708,7 +4715,8 @@ if (!LYUseFormsOptions) { links[curdoc.link].hightext); refresh_screen = TRUE; /* MultiBookmark support */ } else { - HTUserMsg(NOBOOK_FORM_FIELD); + _statusline(NOBOOK_FORM_FIELD); + sleep(MessageSecs); break; } } else { @@ -4718,14 +4726,16 @@ if (!LYUseFormsOptions) { /* * No links, and document has POST content. - FM */ - HTUserMsg(NOBOOK_POST_FORM); + _statusline(NOBOOK_POST_FORM); + sleep(MessageSecs); break; } else if (curdoc.bookmark != NULL) { /* * It's a bookmark file from which all * of the links were deleted. - FM */ - HTUserMsg(BOOKMARKS_NOLINKS); + _statusline(BOOKMARKS_NOLINKS); + sleep(MessageSecs); break; } else { _statusline(BOOK_D_OR_CANCEL); @@ -4752,7 +4762,8 @@ check_add_bookmark_to_self: } else { if (old_c != real_c) { old_c = real_c; - HTUserMsg(NOBOOK_HSML); + _statusline(NOBOOK_HSML); + sleep(MessageSecs); } } break; @@ -4761,7 +4772,8 @@ check_add_bookmark_to_self: if (LYValidate) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(BOOKMARKS_DISABLED); + _statusline(BOOKMARKS_DISABLED); + sleep(MessageSecs); } break; } @@ -4801,13 +4813,48 @@ check_add_bookmark_to_self: if (!no_shell) { stop_curses(); printf(SPAWNING_MSG); - LYSystem(LYSysShell()); + fflush(stdout); + fflush(stderr); + if (LYTraceLogFP) + /* + * Set stderr back to its original value + * during the shell escape. - FM + */ + *stderr = LYOrigStderr; +#ifdef DOSPATH +#ifdef __DJGPP__ + __djgpp_set_ctrl_c(0); + _go32_want_ctrl_break(1); +#endif /* __DJGPP__ */ + if (getenv("SHELL") != NULL) { + system(getenv("SHELL")); + } else { + system(getenv("COMSPEC") == NULL ? "command.com" : getenv("COMSPEC")); + } +#ifdef __DJGPP__ + __djgpp_set_ctrl_c(1); + _go32_want_ctrl_break(0); +#endif /* __DJGPP__ */ +#else +#ifdef VMS + system(""); +#else + system("exec $SHELL"); +#endif /* VMS */ +#endif /* DOSPATH */ + if (LYTraceLogFP) + /* + * Set stderr back to the log file on + * return from the shell escape. - FM + */ + *stderr = *LYTraceLogFP; start_curses(); refresh_screen = TRUE; /* for an HText_pageDisplay() */ } else { if (old_c != real_c) { old_c = real_c; - HTUserMsg(SPAWNING_DISABLED); + _statusline(SPAWNING_DISABLED); + sleep(MessageSecs); } } break; @@ -4820,7 +4867,8 @@ check_add_bookmark_to_self: (no_download && !override_no_download && no_disk_save)) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(DOWNLOAD_DISABLED); + _statusline(DOWNLOAD_DISABLED); + sleep(MessageSecs); } break; } @@ -4840,7 +4888,8 @@ check_add_bookmark_to_self: URL_MAIL_METHOD) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_DOWNLOAD_MAILTO_ACTION); + _statusline(NO_DOWNLOAD_MAILTO_ACTION); + sleep(MessageSecs); } break; } @@ -4851,21 +4900,24 @@ check_add_bookmark_to_self: } if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_DOWNLOAD_INPUT); + _statusline(NO_DOWNLOAD_INPUT); + sleep(MessageSecs); } } else if (!strcmp((curdoc.title ? curdoc.title : ""), COOKIE_JAR_TITLE)) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_DOWNLOAD_COOKIES); + _statusline(NO_DOWNLOAD_COOKIES); + sleep(MessageSecs); } } else if (!strcmp((curdoc.title ? curdoc.title : ""), PRINT_OPTIONS_TITLE)) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_DOWNLOAD_PRINT_OP); + _statusline(NO_DOWNLOAD_PRINT_OP); + sleep(MessageSecs); } #ifdef DIRED_SUPPORT @@ -4874,7 +4926,8 @@ check_add_bookmark_to_self: UPLOAD_OPTIONS_TITLE)) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_DOWNLOAD_UPLOAD_OP); + _statusline(NO_DOWNLOAD_UPLOAD_OP); + sleep(MessageSecs); } } else if (!strcmp(curdoc.address, LYPermitFileURL) || @@ -4882,7 +4935,8 @@ check_add_bookmark_to_self: PERMIT_OPTIONS_TITLE)) { if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_DOWNLOAD_PERMIT_OP); + _statusline(NO_DOWNLOAD_PERMIT_OP); + sleep(MessageSecs); } } else if (lynx_edit_mode && !no_dired_support) { @@ -4906,12 +4960,10 @@ check_add_bookmark_to_self: if ((history[number].post_data != NULL && history[number].safe != TRUE) && HTConfirm(CONFIRM_POST_RESUBMISSION) == FALSE) { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); break; } - /* - * OK, we download from history page, restore URL from stack. - */ StrAllocCopy(newdoc.address, history[number].address); StrAllocCopy(newdoc.title, links[curdoc.link].hightext); StrAllocCopy(newdoc.bookmark, history[number].bookmark); @@ -4949,31 +5001,11 @@ check_add_bookmark_to_self: !strncmp(links[curdoc.link].lname, "LYNXPRINT:", 10) || !strncmp(links[curdoc.link].lname, - "LYNXOPTIONS:", 12) || - !strncmp(links[curdoc.link].lname, "lynxexec:", 9) || !strncmp(links[curdoc.link].lname, "lynxprog:", 9)) { - HTUserMsg(NO_DOWNLOAD_SPECIAL); - - } else if (!strncmp(links[curdoc.link].lname, - "mailto:", 7)) { - HTUserMsg(NO_DOWNLOAD_MAILTO_LINK); - - /* - * From here on we could have a remote host, so check if - * that's allowed. - * - * We copy all these checks from getfile() to LYK_DOWNLOAD - * here because LYNXDOWNLOAD:// will NOT be pushing the - * previous document into the history stack so preserve - * getfile() from returning a wrong status (NULLFILE). - */ - } else if (local_host_only && - !(LYisLocalHost(links[curdoc.link].lname) || - LYisLocalAlias(links[curdoc.link].lname))) { - HTUserMsg(ACCESS_ONLY_LOCALHOST); - + _statusline(NO_DOWNLOAD_SPECIAL); + sleep(MessageSecs); } else { /* Not a forms, options or history link */ /* @@ -5013,7 +5045,8 @@ check_add_bookmark_to_self: } } else if (old_c != real_c) { old_c = real_c; - HTUserMsg(NO_DOWNLOAD_CHOICE); + _statusline(NO_DOWNLOAD_CHOICE); + sleep(MessageSecs); } break; @@ -5053,6 +5086,9 @@ check_add_bookmark_to_self: else WWW_TraceFlag = TRUE; + _statusline(WWW_TraceFlag ? TRACE_ON : TRACE_OFF); + sleep(MessageSecs); + if (TRACE && LYUseTraceLog && LYTraceLogFP == NULL) { /* * We haven't yet started a TRACE log for this @@ -5066,20 +5102,25 @@ check_add_bookmark_to_self: * command. - FM */ if ((LYTraceLogFP = LYNewTxtFile(LYTraceLogPath)) == NULL) { - TracelogOpenFailed(); + WWW_TraceFlag = FALSE; + _statusline(TRACELOG_OPEN_FAILED); + sleep(MessageSecs); break; } #ifdef VMS - LYCloseTracelog(); - HTSYS_remove(LYTraceLogPath); + fclose(LYTraceLogFP); + while (remove(LYTraceLogPath) == 0) + ; if ((LYTraceLogFP = LYNewTxtFile(LYTraceLogPath)) == NULL) { - TracelogOpenFailed(); + WWW_TraceFlag == FALSE; + _statusline(TRACELOG_OPEN_FAILED); + sleep(MessageSecs); break; } #endif /* VMS */ - fprintf(tfp, "\t\t%s\n\n", LYNX_TRACELOG_TITLE); + *stderr = *LYTraceLogFP; + fprintf(stderr, "\t\t%s\n\n", LYNX_TRACELOG_TITLE); } - HTUserMsg(WWW_TraceFlag ? TRACE_ON : TRACE_OFF); break; case LYK_TRACE_LOG: /* View TRACE log. */ @@ -5088,7 +5129,8 @@ check_add_bookmark_to_self: * in this session. - FM */ if (LYTraceLogFP == NULL) { - HTUserMsg(NO_TRACELOG_STARTED); + _statusline(NO_TRACELOG_STARTED); + sleep(MessageSecs); break; } @@ -5110,10 +5152,29 @@ check_add_bookmark_to_self: * and open it again, to make sure all stderr messages thus * far will be in the log. - FM */ - if (!LYReopenTracelog(&trace_mode_flag)) + if (TRACE) + fprintf(stderr, "\nTurning off TRACE for fetch of log.\n"); + fflush(stdout); + fflush(stderr); + fclose(LYTraceLogFP); + *stderr = LYOrigStderr; + if ((LYTraceLogFP = LYAppendToTxtFile(LYTraceLogPath)) == NULL) { + WWW_TraceFlag = FALSE; + _statusline(TRACELOG_OPEN_FAILED); + sleep(MessageSecs); break; - - LYLocalFileToURL (&(newdoc.address), LYTraceLogPath); + } + *stderr = *LYTraceLogFP; + if (TRACE) { + WWW_TraceFlag = FALSE; + trace_mode_flag = TRUE; + } + StrAllocCopy(newdoc.address, "file://localhost"); +#ifdef VMS + StrAllocCat(newdoc.address, HTVMS_wwwName(LYTraceLogPath)); +#else + StrAllocCat(newdoc.address, LYTraceLogPath); +#endif /* VMS */ StrAllocCopy(newdoc.title, LYNX_TRACELOG_TITLE); FREE(newdoc.post_data); FREE(newdoc.post_content_type); @@ -5133,10 +5194,12 @@ check_add_bookmark_to_self: else clickable_images = TRUE; - HTUserMsg(clickable_images ? + _statusline(clickable_images ? CLICKABLE_IMAGES_ON : CLICKABLE_IMAGES_OFF); + sleep(MessageSecs); cmd = LYK_RELOAD; goto new_cmd; + break; case LYK_INLINE_TOGGLE: if (pseudo_inline_alts) @@ -5144,21 +5207,25 @@ check_add_bookmark_to_self: else pseudo_inline_alts = TRUE; - HTUserMsg(pseudo_inline_alts ? + _statusline(pseudo_inline_alts ? PSEUDO_INLINE_ALTS_ON : PSEUDO_INLINE_ALTS_OFF); + sleep(MessageSecs); cmd = LYK_RELOAD; goto new_cmd; + break; case LYK_RAW_TOGGLE: if (LYUseDefaultRawMode) LYUseDefaultRawMode = FALSE; else LYUseDefaultRawMode = TRUE; - HTUserMsg(LYRawMode ? RAWMODE_OFF : RAWMODE_ON); + _statusline(LYRawMode ? RAWMODE_OFF : RAWMODE_ON); HTMLSetCharacterHandling(current_char_set); LYRawMode_flag = LYRawMode; + sleep(MessageSecs); cmd = LYK_RELOAD; goto new_cmd; + break; case LYK_HEAD: if (nlinks > 0 && @@ -5175,7 +5242,8 @@ check_add_bookmark_to_self: char *scheme = strncmp(curdoc.address, "LYNXIMGMAP:", 11) ? curdoc.address : curdoc.address + 11; if (LYCanDoHEAD(scheme) != TRUE) { - HTUserMsg(DOC_NOT_HTTP_URL); + _statusline(DOC_NOT_HTTP_URL); + sleep(MessageSecs); } else { /* * Check if this is a reply from a POST, @@ -5185,7 +5253,8 @@ check_add_bookmark_to_self: if ((curdoc.post_data != NULL && curdoc.safe != TRUE) && HTConfirm(CONFIRM_POST_DOC_HEAD) == FALSE) { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); break; } HEAD_request = TRUE; @@ -5208,21 +5277,25 @@ check_add_bookmark_to_self: (links[curdoc.link].type != WWW_INTERN_LINK_TYPE || !curdoc.address || strncmp(curdoc.address, "http", 4))) { - HTUserMsg(LINK_NOT_HTTP_URL); + _statusline(LINK_NOT_HTTP_URL); + sleep(MessageSecs); } else if (links[curdoc.link].type == WWW_FORM_LINK_TYPE && links[curdoc.link].form->disabled) { - HTUserMsg(FORM_ACTION_DISABLED); + _statusline(FORM_ACTION_DISABLED); + sleep(MessageSecs); } else if (links[curdoc.link].type == WWW_FORM_LINK_TYPE && strncmp(links[curdoc.link].form->submit_action, "lynxcgi:", 8) && strncmp(links[curdoc.link].form->submit_action, "http", 4)) { - HTUserMsg(FORM_ACTION_NOT_HTTP_URL); + _statusline(FORM_ACTION_NOT_HTTP_URL); + sleep(MessageSecs); } else if (links[curdoc.link].type == WWW_FORM_LINK_TYPE && links[curdoc.link].form->submit_method == URL_POST_METHOD && HTConfirm(CONFIRM_POST_LINK_HEAD) == FALSE) { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); } else { HEAD_request = TRUE; LYforce_no_cache = TRUE; @@ -5241,7 +5314,8 @@ check_add_bookmark_to_self: if ((curdoc.post_data != NULL && curdoc.safe != TRUE) && HTConfirm(CONFIRM_POST_DOC_HEAD) == FALSE) { - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); break; } else if (nlinks > 0) { /* @@ -5269,7 +5343,8 @@ check_add_bookmark_to_self: * current document. - FM */ if (LYCanDoHEAD(scheme) != TRUE) { - HTUserMsg(DOC_NOT_HTTP_URL); + _statusline(DOC_NOT_HTTP_URL); + sleep(MessageSecs); } else { HEAD_request = TRUE; LYforce_no_cache = TRUE; @@ -5334,9 +5409,10 @@ check_add_bookmark_to_self: if (old_c != real_c) { old_c = real_c; if (no_jump) - HTUserMsg(JUMP_DISALLOWED); + _statusline(JUMP_DISALLOWED); else - HTUserMsg(NO_JUMPFILE); + _statusline(NO_JUMPFILE); + sleep(MessageSecs); } } else { LYJumpFileURL = TRUE; @@ -5356,7 +5432,8 @@ check_add_bookmark_to_self: goto check_recall; } FREE(temp); - HTUserMsg(NO_RANDOM_URLS_YET); + statusline(NO_RANDOM_URLS_YET); + sleep(MessageSecs); break; } ret = HTParse((ret+3), startfile, PARSE_ALL); @@ -5380,7 +5457,7 @@ check_add_bookmark_to_self: HTUnEscapeSome(ret, " \r\n\t"); convert_to_spaces(ret, TRUE); } else { - LYRemoveBlanks(user_input_buffer); + collapse_spaces(user_input_buffer); } StrAllocCopy(newdoc.address, ret); StrAllocCopy(lynxjumpfile, ret); @@ -5410,10 +5487,11 @@ check_add_bookmark_to_self: HTClearHTTPAuthInfo(); HTClearNNTPAuthInfo(); HTClearFTPPassword(); - HTUserMsg(AUTH_INFO_CLEARED); + _statusline(AUTH_INFO_CLEARED); } else { - HTUserMsg(CANCELLED); + _statusline(CANCELLED); } + sleep(MessageSecs); } break; diff --git a/src/LYMainLoop.h b/src/LYMainLoop.h index 25d7b133..b3a5bd99 100644 --- a/src/LYMainLoop.h +++ b/src/LYMainLoop.h @@ -1,9 +1,7 @@ + #ifndef LYMAINLOOP_H #define LYMAINLOOP_H -#include <HTUtils.h> - -extern void LYCloseTracelog NOPARAMS; extern int mainloop NOPARAMS; #endif /* LYMAINLOOP_H */ diff --git a/src/LYMap.c b/src/LYMap.c index 0d63a36e..1e1ba24d 100644 --- a/src/LYMap.c +++ b/src/LYMap.c @@ -6,6 +6,7 @@ */ #include <HTUtils.h> +#include <tcp.h> #include <HTTP.h> #include <HTAnchor.h> #include <HTAccess.h> @@ -28,6 +29,8 @@ #include <LYexit.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x=NULL;} + typedef struct _LYMapElement { char * address; char * title; @@ -168,8 +171,6 @@ PUBLIC BOOL LYAddImageMap ARGS3( if (theList) { cur = theList; while (NULL != (old = (LYImageMap *)HTList_nextObject(cur))) { - if (old->address == 0) /* shouldn't happen */ - continue; if (!strcmp(old->address, address)) { FREE(old->address); FREE(old->title); diff --git a/src/LYMap.h b/src/LYMap.h index 0ce31797..ae0f9d69 100644 --- a/src/LYMap.h +++ b/src/LYMap.h @@ -1,10 +1,7 @@ + #ifndef LYMAP_H #define LYMAP_H -#include <HTUtils.h> -#include <HTList.h> -#include <HTAnchor.h> - extern BOOL LYMapsOnly; extern void ImageMapList_free PARAMS((HTList * list)); diff --git a/src/LYNews.c b/src/LYNews.c index d644de6c..5574819c 100644 --- a/src/LYNews.c +++ b/src/LYNews.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTParse.h> #include <HTAccess.h> #include <HTCJK.h> @@ -11,6 +12,7 @@ #include <LYStrings.h> #include <LYGetFile.h> #include <LYHistory.h> +#include <LYSystem.h> #include <GridText.h> #include <LYCharSets.h> #include <LYNews.h> @@ -19,6 +21,8 @@ #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* ** Global variable for async i/o. */ @@ -43,7 +47,6 @@ PUBLIC char *LYNewsPost ARGS2( char user_input[1024]; char CJKinput[1024]; char *cp = NULL; - CONST char *kp = NULL; int c = 0; /* user input */ FILE *fd = NULL; char my_tempfile[256]; @@ -65,7 +68,8 @@ PUBLIC char *LYNewsPost ARGS2( * Open a temporary file for the headers * and message body. - FM */ - if ((fd = LYOpenTemp(my_tempfile, HTML_SUFFIX, "w")) == NULL) { + tempname(my_tempfile, NEW_FILE); + if ((fd = LYNewTxtFile(my_tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(postfile); } @@ -75,11 +79,18 @@ PUBLIC char *LYNewsPost ARGS2( * open a temporary file for a conversion to JIS. - FM */ CJKfile[0] = '\0'; - if (current_char_set == UCGetLYhndl_byMIME("euc-jp") || - current_char_set == UCGetLYhndl_byMIME("shift_jis")) { - if ((fc = LYOpenTemp(CJKfile, HTML_SUFFIX, "w")) == NULL) { + if (!strncmp(LYchar_set_names[current_char_set], "Japanese (EUC)", 14) || + !strncmp(LYchar_set_names[current_char_set], "Japanese (SJIS)", 15)) { + tempname(CJKfile, NEW_FILE); + if ((fc = LYNewTxtFile(CJKfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); - LYRemoveTemp(my_tempfile); + fclose(fd); +#ifdef VMS + while (remove(my_tempfile) == 0) + ; /* loop through all versions */ +#else + remove(my_tempfile); +#endif /* VMS */ return(postfile); } } @@ -121,9 +132,10 @@ PUBLIC char *LYNewsPost ARGS2( if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 || term_message) { - HTInfoMsg(NEWS_POST_CANCELLED); - LYCloseTempFP(fd); /* Close the temp file. */ - scrollok(stdscr, FALSE); /* Stop scrolling. */ + _statusline(NEWS_POST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the temp file. */ + scrollok(stdscr, FALSE); /* Stop scrolling. */ goto cleanup; } fprintf(fd, "%s\n", user_input); @@ -136,23 +148,26 @@ PUBLIC char *LYNewsPost ARGS2( addstr("\n\n Please provide or edit the Subject: header\n"); strcpy(user_input, "Subject: "); if ((followup == TRUE && nhist > 0) && - (kp = HText_getTitle()) != NULL) { + (cp = HText_getTitle()) != NULL) { /* * Add the default subject. */ - kp = LYSkipCBlanks(kp); - if (strncasecomp(kp, "Re:", 3)) { + while (isspace(*cp)) { + cp++; + } + if (strncasecomp(cp, "Re:", 3)) { strcat(user_input, "Re: "); } - strcat(user_input, kp); + strcat(user_input, cp); } cp = NULL; if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 || term_message) { - HTInfoMsg(NEWS_POST_CANCELLED); - LYCloseTempFP(fd); /* Close the temp file. */ - scrollok(stdscr, FALSE); /* Stop scrolling. */ + _statusline(NEWS_POST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the temp file. */ + scrollok(stdscr, FALSE); /* Stop scrolling. */ goto cleanup; } fprintf(fd,"%s\n",user_input); @@ -185,9 +200,10 @@ PUBLIC char *LYNewsPost ARGS2( if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 || term_message) { - HTInfoMsg(NEWS_POST_CANCELLED); - LYCloseTempFP(fd); /* Close the temp file. */ - scrollok(stdscr, FALSE); /* Stop scrolling. */ + _statusline(NEWS_POST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the temp file. */ + scrollok(stdscr, FALSE); /* Stop scrolling. */ goto cleanup; } fprintf(fd, "%s\n", user_input); @@ -225,8 +241,8 @@ PUBLIC char *LYNewsPost ARGS2( */ print_wwwfile_to_fd(fd, 1); } - LYCloseTempFP(fd); /* Close the temp file. */ - scrollok(stdscr, FALSE); /* Stop scrolling. */ + fclose(fd); /* Close the temp file. */ + scrollok(stdscr, FALSE); /* Stop scrolling. */ if (term_message || c == 7 || c == 3) goto cleanup; @@ -239,9 +255,10 @@ PUBLIC char *LYNewsPost ARGS2( sprintf(user_input,"%s%s %s", editor, editor_arg, my_tempfile); _statusline(SPAWNING_EDITOR_FOR_NEWS); stop_curses(); - if (LYSystem(user_input)) { + if (system(user_input)) { start_curses(); - HTAlert(ERROR_SPAWNING_EDITOR); + _statusline(ERROR_SPAWNING_EDITOR); + sleep(AlertSecs); } else { start_curses(); } @@ -258,8 +275,9 @@ PUBLIC char *LYNewsPost ARGS2( if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 || term_message) { - HTInfoMsg(NEWS_POST_CANCELLED); - LYCloseTempFP(fd); /* Close the temp file. */ + _statusline(NEWS_POST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the temp file. */ scrollok(stdscr, FALSE); /* Stop scrolling. */ goto cleanup; } @@ -269,15 +287,16 @@ PUBLIC char *LYNewsPost ARGS2( *user_input = '\0'; if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0) { - HTInfoMsg(NEWS_POST_CANCELLED); - LYCloseTempFP(fd); /* Close the temp file. */ - scrollok(stdscr, FALSE); /* Stop scrolling. */ + _statusline(NEWS_POST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the temp file. */ + scrollok(stdscr, FALSE); /* Stop scrolling. */ goto cleanup; } } fprintf(fd, "\n"); - LYCloseTempFP(fd); /* Close the temp file. */ - scrollok(stdscr, FALSE); /* Stop scrolling. */ + fclose(fd); /* Close the temp file. */ + scrollok(stdscr, FALSE); /* Stop scrolling. */ } /* @@ -305,7 +324,7 @@ PUBLIC char *LYNewsPost ARGS2( !term_message && c != 7 && c != 3) c = LYgetch(); if (TOUPPER(c) == 'Y') { - if ((fd = LYAppendToTxtFile (my_tempfile)) != NULL) { + if ((fd = fopen(my_tempfile, "a")) != NULL) { fputs("-- \n", fd); while (fgets(user_input, sizeof(user_input), fp) != NULL) { fputs(user_input, fd); @@ -331,10 +350,16 @@ PUBLIC char *LYNewsPost ARGS2( (unsigned char *)CJKinput); fputs(CJKinput, fc); } - LYCloseTempFP(fc); + fclose(fc); StrAllocCopy(postfile, CJKfile); fclose(fd); - LYRemoveTemp(my_tempfile); +#ifdef VMS + while (remove(my_tempfile) == 0) + ; /* loop through all versions */ +#else + remove(my_tempfile); +#endif /* VMS */ + fd = fc; strcpy(my_tempfile, CJKfile); CJKfile[0] = '\0'; } else { @@ -356,8 +381,9 @@ PUBLIC char *LYNewsPost ARGS2( LYforce_no_cache = TRUE; } LYStatusLine = (LYlines - 1); - HTUserMsg(POSTING_TO_NEWS); + statusline(POSTING_TO_NEWS); LYStatusLine = -1; + sleep(MessageSecs); /* * Come here to cleanup and exit. @@ -367,9 +393,23 @@ cleanup: signal(SIGINT, cleanup_sig); #endif /* !VMS */ term_message = FALSE; - if (!postfile) - LYRemoveTemp(my_tempfile); - LYRemoveTemp(CJKfile); + if (!postfile) { +#ifdef VMS + while (remove(my_tempfile) == 0) + ; /* loop through all versions */ +#else + remove(my_tempfile); +#endif /* VMS */ + } + if (CJKfile[0] != '\0') { +#ifdef VMS + fclose(fc); + while (remove(CJKfile) == 0) + ; /* loop through all versions */ +#else + remove(CJKfile); +#endif /* VMS */ + } FREE(NewsGroups); return(postfile); diff --git a/src/LYNews.h b/src/LYNews.h index 9eaa8e13..17d9d48a 100644 --- a/src/LYNews.h +++ b/src/LYNews.h @@ -2,7 +2,7 @@ #define LYNEWSPOST_H #ifndef LYSTRUCTS_H -#include <LYStructs.h> +#include "LYStructs.h" #endif /* LYSTRUCTS_H */ extern BOOLEAN term_message; diff --git a/src/LYOptions.c b/src/LYOptions.c index 3d894764..0bd7bb0f 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -1,11 +1,11 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTFTP.h> #include <HTML.h> #include <LYCurses.h> #include <LYUtils.h> #include <LYStrings.h> #include <LYGlobalDefs.h> -#include <LYHistory.h> #include <LYOptions.h> #include <LYSignal.h> #include <LYClean.h> @@ -18,16 +18,21 @@ #include <HTAlert.h> #include <LYBookmark.h> #include <GridText.h> -#include <LYGetFile.h> -#include <LYReadCFG.h> #include <LYLeaks.h> -BOOLEAN term_options; +#define FREE(x) if (x) {free(x); x = NULL;} -PRIVATE void terminate_options PARAMS((int sig)); +#ifdef VMS +#define DISPLAY "DECW$DISPLAY" +#else +#define DISPLAY "DISPLAY" +#endif /* VMS */ + +#define COL_OPTION_VALUES 36 /* display column where option values start */ -#ifndef NO_OPTION_MENU +BOOLEAN term_options; +PRIVATE void terminate_options PARAMS((int sig)); PRIVATE int boolean_choice PARAMS(( int status, int line, @@ -43,70 +48,6 @@ PRIVATE int popup_choice PARAMS(( #define MAXCHOICES 10 -/* - * Values for the options menu. - FM - * - * L_foo values are the Y coordinates for the menu item. - * B_foo values are the X coordinates for the item's prompt string. - * C_foo values are the X coordinates for the item's value string. - */ -#define L_EDITOR 2 -#define L_DISPLAY 3 - -#define L_HOME 4 -#define C_MULTI 24 -#define B_BOOK 34 -#define C_DEFAULT 50 - -#define L_FTPSTYPE 5 -#define L_MAIL_ADDRESS 6 -#define L_SSEARCH 7 -#define L_LANGUAGE 8 -#define L_PREF_CHARSET 9 -#define L_ASSUME_CHARSET (L_PREF_CHARSET + 1) -#define L_CHARSET 10 -#define L_RAWMODE 11 - -#define L_COLOR L_RAWMODE -#define B_COLOR 44 -#define C_COLOR 62 - -#define L_BOOL_A 12 -#define B_VIKEYS 5 -#define C_VIKEYS 15 -#define B_EMACSKEYS 22 -#define C_EMACSKEYS 36 -#define B_SHOW_DOTFILES 44 -#define C_SHOW_DOTFILES 62 - -#define L_BOOL_B 13 -#define B_SELECT_POPUPS 5 -#define C_SELECT_POPUPS 36 -#define B_SHOW_CURSOR 44 -#define C_SHOW_CURSOR 62 - -#define L_KEYPAD 14 -#define L_LINEED 15 - -#ifdef DIRED_SUPPORT -#define L_DIRED 16 -#define L_USER_MODE 17 -#define L_USER_AGENT 18 -#define L_EXEC 19 -#else -#define L_USER_MODE 16 -#define L_USER_AGENT 17 -#define L_EXEC 18 -#endif /* DIRED_SUPPORT */ - -#define L_VERBOSE_IMAGES L_USER_MODE -#define B_VERBOSE_IMAGES 50 -#define C_VERBOSE_IMAGES (B_VERBOSE_IMAGES + 21) - - -#define COL_OPTION_VALUES 36 /* display column where option values start */ - -/* a kludge to add assume_charset only in ADVANCED mode... */ #define L_Bool_A (use_assume_charset ? L_BOOL_A + 1 : L_BOOL_A) #define L_Bool_B (use_assume_charset ? L_BOOL_B + 1 : L_BOOL_B) #define L_Exec (use_assume_charset ? L_EXEC + 1 : L_EXEC) @@ -119,8 +60,54 @@ PRIVATE int popup_choice PARAMS(( #define L_User_Mode (use_assume_charset ? L_USER_MODE + 1 : L_USER_MODE) #define L_User_Agent (use_assume_charset ? L_USER_AGENT + 1 : L_USER_AGENT) +PRIVATE void option_statusline ARGS1( + CONST char *, text) +{ + /* + * Make sure we have a pointer to a string. + */ + if (text == NULL) + return; -PUBLIC void LYoptions NOARGS + /* + * Don't print statusline messages if dumping to stdout. + */ + if (dump_output_immediately) + return; + + /* + * Use _statusline() set to output on the bottom line. - FM + */ + LYStatusLine = (LYlines - 1); + _statusline(text); + LYStatusLine = -1; +} + +PRIVATE void option_user_message ARGS2( + CONST char *, message, + char *, argument) +{ + /* + * Make sure we have a pointer to a string. + */ + if (message == NULL || argument == NULL) + return; + + /* + * Don't print statusline messages if dumping to stdout. + */ + if (dump_output_immediately) + return; + + /* + * Use _user_message() set to output on the bottom line. + */ + LYStatusLine = (LYlines - 1); + _user_message(message, argument); + LYStatusLine = -1; +} + +PUBLIC void options NOARGS { #ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS int itmp; @@ -130,10 +117,13 @@ PUBLIC void LYoptions NOARGS * If the user changes the display we need memory to put it in. */ char display_option[256]; +#ifndef VMS + static char putenv_command[142]; +#endif /* !VMS */ char *choices[MAXCHOICES]; int CurrentCharSet = current_char_set; - int CurrentAssumeCharSet = UCLYhndl_for_unspec; int CurrentShowColor = LYShowColor; + int CurrentAssumeCharSet = UCLYhndl_for_unspec; BOOLEAN CurrentRawMode = LYRawMode; BOOLEAN AddValueAccepted = FALSE; char *cp = NULL; @@ -167,7 +157,6 @@ PUBLIC void LYoptions NOARGS #endif /* DIRED_SUPPORT */ term_options = FALSE; - LYStatusLine = (LYlines - 1); /* screen is otherwise too crowded */ signal(SIGINT, terminate_options); if (no_option_save) { if (LYShowColor == SHOW_COLOR_NEVER) { @@ -241,7 +230,7 @@ draw_options: move(L_DISPLAY, 5); addstr("D)ISPLAY variable : "); - addstr((x_display && *x_display) ? x_display : "NONE"); + addstr((display && *display) ? display : "NONE"); move(L_HOME, 5); addstr("mu(L)ti-bookmarks: "); @@ -309,7 +298,7 @@ draw_options: } else { switch (LYChosenShowColor) { case SHOW_COLOR_NEVER: - addstr("NEVER "); + addstr("NEVER "); break; case SHOW_COLOR_OFF: addstr("OFF"); @@ -374,9 +363,6 @@ draw_options: ((user_mode == INTERMEDIATE_MODE) ? "Intermediate" : "Advanced ")); - addstr(" verbose images (!) : "); - addstr( verbose_img ? "ON " : "OFF" ); - move(L_User_Agent, 5); addstr("user (A)gent : "); addstr((LYUserAgent && *LYUserAgent) ? LYUserAgent : "NONE"); @@ -421,7 +407,7 @@ draw_options: response != '>' && !term_options && response != 7 && response != 3) { if (AddValueAccepted == TRUE) { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); AddValueAccepted = FALSE; } move((LYlines - 2), 0); @@ -441,9 +427,9 @@ draw_options: case 'e': /* Change the editor. */ case 'E': if (no_editor) { - _statusline(EDIT_DISABLED); + option_statusline(EDIT_DISABLED); } else if (system_editor ) { - _statusline(EDITOR_LOCKED); + option_statusline(EDITOR_LOCKED); } else { if (editor && *editor) strcpy(display_option, editor); @@ -452,7 +438,7 @@ draw_options: addstr(" "); *display_option = '\0'; } - _statusline(ACCEPT_DATA); + option_statusline(ACCEPT_DATA); move(L_EDITOR, COL_OPTION_VALUES); start_bold(); ch = LYgetstr(display_option, VISIBLE, @@ -471,10 +457,11 @@ draw_options: } clrtoeol(); if (ch == -1) { - HTInfoMsg(CANCELLED); - HTInfoMsg(""); + option_statusline(CANCELLED); + sleep(InfoSecs); + option_statusline(""); } else { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); } } response = ' '; @@ -482,14 +469,14 @@ draw_options: case 'd': /* Change the display. */ case 'D': - if (x_display && *x_display) { - strcpy(display_option, x_display); + if (display && *display) { + strcpy(display_option, display); } else { /* clear the NONE */ move(L_DISPLAY, COL_OPTION_VALUES); addstr(" "); *display_option = '\0'; } - _statusline(ACCEPT_DATA); + option_statusline(ACCEPT_DATA); move(L_DISPLAY, COL_OPTION_VALUES); start_bold(); ch = LYgetstr(display_option, VISIBLE, @@ -497,37 +484,38 @@ draw_options: stop_bold(); move(L_DISPLAY, COL_OPTION_VALUES); if ((term_options || ch == -1) || - (x_display != NULL && + (display != NULL && #ifdef VMS - !strcasecomp(x_display, display_option))) + !strcasecomp(display, display_option))) #else - !strcmp(x_display, display_option))) + !strcmp(display, display_option))) #endif /* VMS */ { /* * Cancelled, or a non-NULL display string * wasn't changed. - FM */ - addstr((x_display && *x_display) ? x_display : "NONE"); + addstr((display && *display) ? display : "NONE"); clrtoeol(); if (ch == -1) { - HTInfoMsg(CANCELLED); - HTInfoMsg(""); + option_statusline(CANCELLED); + sleep(InfoSecs); + option_statusline(""); } else { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); } response = ' '; break; } else if (*display_option == '\0') { - if ((x_display == NULL) || - (x_display != NULL && *x_display == '\0')) { + if ((display == NULL) || + (display != NULL && *display == '\0')) { /* * NULL or zero-length display string * wasn't changed. - FM */ addstr("NONE"); clrtoeol(); - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); response = ' '; break; } @@ -535,32 +523,42 @@ draw_options: /* * Set the new DISPLAY variable. - FM */ - LYsetXDisplay(display_option); - if ((cp = LYgetXDisplay()) != NULL) { - StrAllocCopy(x_display, cp); +#ifdef VMS + { + int i; + for (i = 0; display_option[i]; i++) + display_option[i] = TOUPPER(display_option[i]); + Define_VMSLogical(DISPLAY, display_option); + } +#else + sprintf(putenv_command, "DISPLAY=%s", display_option); + putenv(putenv_command); +#endif /* VMS */ + if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { + StrAllocCopy(display, cp); } else { - FREE(x_display); + FREE(display); } cp = NULL; - addstr(x_display ? x_display : "NONE"); + addstr(display ? display : "NONE"); clrtoeol(); - if ((x_display == NULL && *display_option == '\0') || - (x_display != NULL && - !strcmp(x_display, display_option))) { - if (x_display == NULL && + if ((display == NULL && *display_option == '\0') || + (display != NULL && + !strcmp(display, display_option))) { + if (display == NULL && LYisConfiguredForX == TRUE) { - _statusline(VALUE_ACCEPTED_WARNING_X); - } else if (x_display != NULL && + option_statusline(VALUE_ACCEPTED_WARNING_X); + } else if (display != NULL && LYisConfiguredForX == FALSE) { - _statusline(VALUE_ACCEPTED_WARNING_NONX); + option_statusline(VALUE_ACCEPTED_WARNING_NONX); } else { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); } } else { if (*display_option) { - _statusline(FAILED_TO_SET_DISPLAY); + option_statusline(FAILED_TO_SET_DISPLAY); } else { - _statusline(FAILED_CLEAR_SET_DISPLAY); + option_statusline(FAILED_CLEAR_SET_DISPLAY); } } response = ' '; @@ -569,7 +567,7 @@ draw_options: case 'l': /* Change multibookmarks option. */ case 'L': if (LYMBMBlocked) { - _statusline(MULTIBOOKMARKS_DISALLOWED); + option_statusline(MULTIBOOKMARKS_DISALLOWED); response = ' '; break; } @@ -656,7 +654,7 @@ draw_options: clrtoeol(); *display_option = '\0'; } - _statusline(ACCEPT_DATA); + option_statusline(ACCEPT_DATA); move(L_HOME, C_DEFAULT); start_bold(); ch = LYgetstr(display_option, VISIBLE, @@ -672,7 +670,7 @@ draw_options: addstr((bookmark_page && *bookmark_page) ? bookmark_page : "NONE"); clrtoeol(); - _statusline(USE_PATH_OFF_HOME); + option_statusline(USE_PATH_OFF_HOME); response = ' '; break; } else { @@ -683,13 +681,14 @@ draw_options: } clrtoeol(); if (ch == -1) { - HTInfoMsg(CANCELLED); - HTInfoMsg(""); + option_statusline(CANCELLED); + sleep(InfoSecs); + option_statusline(""); } else { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); } } else { /* anonymous */ - _statusline(BOOKMARK_CHANGE_DISALLOWED); + option_statusline(BOOKMARK_CHANGE_DISALLOWED); } response = ' '; break; @@ -751,7 +750,7 @@ draw_options: addstr(" "); *display_option = '\0'; } - _statusline(ACCEPT_DATA); + option_statusline(ACCEPT_DATA); move(L_MAIL_ADDRESS, COL_OPTION_VALUES); start_bold(); ch = LYgetstr(display_option, VISIBLE, @@ -771,15 +770,16 @@ draw_options: } clrtoeol(); if (ch == -1) { - HTInfoMsg(CANCELLED); - HTInfoMsg(""); + option_statusline(CANCELLED); + sleep(InfoSecs); + option_statusline(""); } else { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); } response = ' '; break; - case 's': /* Change case sensitivity for searches. */ + case 's': /* Change case sentitivity for searches. */ case 'S': /* * Copy strings into choice array. @@ -832,9 +832,9 @@ draw_options: } /* - * Set the raw 8-bit or CJK mode defaults and - * character set if changed. - FM - */ + * Set the raw 8-bit or CJK mode defaults and + * character set if changed. - FM + */ if (CurrentAssumeCharSet != UCLYhndl_for_unspec || UCLYhndl_for_unspec != curval) { if (UCLYhndl_for_unspec != CurrentAssumeCharSet) { @@ -843,7 +843,7 @@ draw_options: } LYRawMode = (UCLYhndl_for_unspec == current_char_set); HTMLSetUseDefaultRawMode(current_char_set, LYRawMode); - HTMLSetCharacterHandling(current_char_set); + HTMLUseCharacterSet(current_char_set); CurrentAssumeCharSet = UCLYhndl_for_unspec; CurrentRawMode = LYRawMode; #if !defined(VMS) && !defined(USE_SLANG) @@ -870,12 +870,12 @@ draw_options: #endif /* !VMS || USE_SLANG */ } } else { - _statusline(NEED_ADVANCED_USER_MODE); + option_statusline(NEED_ADVANCED_USER_MODE); AddValueAccepted = FALSE; } break; - case 'c': /* Change display charset setting. */ + case 'c': /* Change charset setting. */ case 'C': if (!LYSelectPopups) { current_char_set = boolean_choice(current_char_set, @@ -897,6 +897,7 @@ draw_options: * character set if changed. - FM */ if (CurrentCharSet != current_char_set) { + HTMLSetRawModeDefault(current_char_set); LYUseDefaultRawMode = TRUE; HTMLUseCharacterSet(current_char_set); CurrentCharSet = current_char_set; @@ -959,7 +960,7 @@ draw_options: addstr(" "); *display_option = '\0'; } - _statusline(ACCEPT_DATA); + option_statusline(ACCEPT_DATA); move(L_LANGUAGE, COL_OPTION_VALUES); start_bold(); ch = LYgetstr(display_option, VISIBLE, @@ -978,10 +979,11 @@ draw_options: } clrtoeol(); if (ch == -1) { - HTInfoMsg(CANCELLED); - HTInfoMsg(""); + option_statusline(CANCELLED); + sleep(InfoSecs); + option_statusline(""); } else { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); } response = ' '; break; @@ -995,7 +997,7 @@ draw_options: addstr(" "); *display_option = '\0'; } - _statusline(ACCEPT_DATA); + option_statusline(ACCEPT_DATA); move(L_PREF_CHARSET, COL_OPTION_VALUES); start_bold(); ch = LYgetstr(display_option, VISIBLE, @@ -1014,10 +1016,11 @@ draw_options: } clrtoeol(); if (ch == -1) { - HTInfoMsg(CANCELLED); - HTInfoMsg(""); + option_statusline(CANCELLED); + sleep(InfoSecs); + option_statusline(""); } else { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); } response = ' '; break; @@ -1071,7 +1074,7 @@ draw_options: case 'W': /* Change show dotfiles setting. */ case 'w': if (no_dotfiles) { - _statusline(DOTFILE_ACCESS_DISABLED); + option_statusline(DOTFILE_ACCESS_DISABLED); } else { /* * Copy strings into choice array. @@ -1117,11 +1120,12 @@ draw_options: if (!has_colors()) { char * terminal = getenv("TERM"); if (terminal) - HTUserMsg2( + option_user_message( COLOR_TOGGLE_DISABLED_FOR_TERM, terminal); else - HTUserMsg(COLOR_TOGGLE_DISABLED); + option_statusline(COLOR_TOGGLE_DISABLED); + sleep(AlertSecs); } #endif /* @@ -1178,11 +1182,12 @@ draw_options: if (again) { char * terminal = getenv("TERM"); if (terminal) - HTUserMsg2( + option_user_message( COLOR_TOGGLE_DISABLED_FOR_TERM, terminal); else - HTUserMsg(COLOR_TOGGLE_DISABLED); + option_statusline(COLOR_TOGGLE_DISABLED); + sleep(AlertSecs); } #endif } while (again); @@ -1432,46 +1437,6 @@ draw_options: } break; - case '!': - /* - * Copy strings into choice array. - */ - choices[0] = NULL; - StrAllocCopy(choices[0], "OFF"); - choices[1] = NULL; - StrAllocCopy(choices[1], "ON "); - choices[2] = NULL; - if (!LYSelectPopups) { - verbose_img = boolean_choice(verbose_img, - L_VERBOSE_IMAGES, - C_VERBOSE_IMAGES, - choices); - } else { - verbose_img = popup_choice(verbose_img, - L_VERBOSE_IMAGES, - C_VERBOSE_IMAGES, - choices, - 2, FALSE); - } - FREE(choices[0]); - FREE(choices[1]); - response = ' '; - if (LYSelectPopups) { -#if !defined(VMS) || defined(USE_SLANG) - if (term_options) { - term_options = FALSE; - } else { - AddValueAccepted = TRUE; - } - goto draw_options; -#else - term_options = FALSE; - if (use_assume_charset != old_use_assume_charset) - goto draw_options; -#endif /* !VMS || USE_SLANG */ - } - break; - case 'a': /* Change user agent string. */ case 'A': if (!no_useragent) { @@ -1482,7 +1447,7 @@ draw_options: addstr(" "); *display_option = '\0'; } - _statusline(ACCEPT_DATA_OR_DEFAULT); + option_statusline(ACCEPT_DATA_OR_DEFAULT); move(L_User_Agent, COL_OPTION_VALUES); start_bold(); ch = LYgetstr(display_option, VISIBLE, @@ -1504,17 +1469,18 @@ draw_options: } clrtoeol(); if (ch == -1) { - HTInfoMsg(CANCELLED); - HTInfoMsg(""); + option_statusline(CANCELLED); + sleep(InfoSecs); + option_statusline(""); } else if (LYUserAgent && *LYUserAgent && !strstr(LYUserAgent, "Lynx") && !strstr(LYUserAgent, "lynx")) { - _statusline(UA_COPYRIGHT_WARNING); + option_statusline(UA_COPYRIGHT_WARNING); } else { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); } } else { /* disallowed */ - _statusline(UA_COPYRIGHT_WARNING); + option_statusline(UA_COPYRIGHT_WARNING); } response = ' '; break; @@ -1523,7 +1489,7 @@ draw_options: case 'x': /* Change local exec restriction. */ case 'X': if (exec_frozen && !LYSelectPopups) { - _statusline(CHANGE_OF_SETTING_DISALLOWED); + option_statusline(CHANGE_OF_SETTING_DISALLOWED); response = ' '; break; } @@ -1607,15 +1573,15 @@ draw_options: case '>': /* Save current options to RC file. */ if (!no_option_save) { - _statusline(SAVING_OPTIONS); + option_statusline(SAVING_OPTIONS); if (save_rc()) { LYrcShowColor = LYChosenShowColor; - _statusline(OPTIONS_SAVED); + option_statusline(OPTIONS_SAVED); } else { HTAlert(OPTIONS_NOT_SAVED); } } else { - _statusline(R_TO_RETURN_TO_LYNX); + option_statusline(R_TO_RETURN_TO_LYNX); /* * Change response so that we don't exit * the options menu. @@ -1630,15 +1596,14 @@ draw_options: default: if (!no_option_save) { - _statusline(SAVE_OR_R_TO_RETURN_TO_LYNX); + option_statusline(SAVE_OR_R_TO_RETURN_TO_LYNX); } else { - _statusline(R_TO_RETURN_TO_LYNX); + option_statusline(R_TO_RETURN_TO_LYNX); } } /* end switch */ } /* end while */ term_options = FALSE; - LYStatusLine = -1; /* let user_mode have some of the screen */ signal(SIGINT, cleanup_sig); } @@ -1672,7 +1637,7 @@ PRIVATE int boolean_choice ARGS4( /* * Update the statusline. */ - _statusline(ANY_KEY_CHANGE_RET_ACCEPT); + option_statusline(ANY_KEY_CHANGE_RET_ACCEPT); /* * Highlight the current choice. @@ -1780,16 +1745,16 @@ PRIVATE int boolean_choice ARGS4( if (term_options) { term_options = FALSE; - HTInfoMsg(CANCELLED); - HTInfoMsg(""); + option_statusline(CANCELLED); + sleep(InfoSecs); + option_statusline(""); } else { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); } return(cur_choice); } } } -#endif /* !NO_OPTION_MENU */ PRIVATE void terminate_options ARGS1( int, sig GCC_UNUSED) @@ -1948,13 +1913,13 @@ draw_bookmark_list: */ if (response == '>') { if (!no_option_save) { - _statusline(SAVING_OPTIONS); + option_statusline(SAVING_OPTIONS); if (save_rc()) - _statusline(OPTIONS_SAVED); + option_statusline(OPTIONS_SAVED); else HTAlert(OPTIONS_NOT_SAVED); } else { - _statusline(R_TO_RETURN_TO_LYNX); + option_statusline(R_TO_RETURN_TO_LYNX); /* * Change response so that we don't exit * the options menu. @@ -2011,7 +1976,7 @@ draw_bookmark_list: goto draw_bookmark_list; } } - _statusline(ACCEPT_DATA); + option_statusline(ACCEPT_DATA); if (a > 0) { start_bold(); @@ -2096,7 +2061,6 @@ draw_bookmark_list: signal(SIGINT, cleanup_sig); } -#ifndef NO_OPTION_MENU /* ** This function prompts for a choice or page number. ** If a 'g' or 'p' suffix is included, that will be @@ -2112,14 +2076,15 @@ PRIVATE int get_popup_choice_number ARGS1( */ temp[0] = *c; temp[1] = '\0'; - _statusline(OPTION_CHOICE_NUMBER); + option_statusline(OPTION_CHOICE_NUMBER); /* * Get the number, possibly with a suffix, from the user. */ if (LYgetstr(temp, VISIBLE, sizeof(temp), NORECALL) < 0 || *temp == 0 || term_options) { - HTInfoMsg(CANCELLED); + option_statusline(CANCELLED); + sleep(InfoSecs); *c = '\0'; term_options = FALSE; return(0); @@ -2159,8 +2124,7 @@ PRIVATE int popup_choice ARGS6( #ifndef USE_SLANG WINDOW * form_window; #endif /* !USE_SLANG */ - int num_choices = 0, top, bottom, length = -1; - unsigned width = 0; + int num_choices = 0, top, bottom, length = -1, width = 0; char ** Cptr = choices; int window_offset = 0; int DisplayLines = (LYlines - 2); @@ -2296,7 +2260,7 @@ PRIVATE int popup_choice ARGS6( if (!(form_window = newwin(bottom - top, (Lnum + width + 4), top, (lx - 1))) && !(form_window = newwin(bottom - top, 0, top, 0))) { - HTAlert(POPUP_FAILED); + option_statusline(POPUP_FAILED); return(orig_choice); } scrollok(form_window, TRUE); @@ -2319,9 +2283,9 @@ PRIVATE int popup_choice ARGS6( move((LYlines - 2), 0); clrtoeol(); if (disabled) { - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); } else { - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); } /* @@ -2454,6 +2418,9 @@ redraw: term_options = FALSE; c = LYgetch(); if (term_options || c == 3 || c == 7) { + /* + * Control-C or Control-G + */ cmd = LYK_QUIT; } else { cmd = keymap[c+1]; @@ -2493,20 +2460,21 @@ redraw: */ if (number <= 1) { if (window_offset == 0) { - HTUserMsg(ALREADY_AT_CHOICE_BEGIN); + option_statusline(ALREADY_AT_CHOICE_BEGIN); + sleep(MessageSecs); if (disabled) { - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); } else { - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); } break; } window_offset = 0; cur_choice = 0; if (disabled) { - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); } else { - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); } goto redraw; } @@ -2517,11 +2485,12 @@ redraw: */ if (number >= npages) { if (window_offset >= ((num_choices - length) + 1)) { - HTUserMsg(ALREADY_AT_CHOICE_END); + option_statusline(ALREADY_AT_CHOICE_END); + sleep(MessageSecs); if (disabled) { - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); } else { - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); } break; } @@ -2532,9 +2501,9 @@ redraw: if (cur_choice < window_offset) cur_choice = window_offset; if (disabled) { - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); } else { - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); } goto redraw; } @@ -2544,19 +2513,20 @@ redraw: */ if (((number - 1) * length) == window_offset) { sprintf(buffer, ALREADY_AT_CHOICE_PAGE, number); - HTUserMsg(buffer); + option_statusline(buffer); + sleep(MessageSecs); if (disabled) { - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); } else { - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); } break; } cur_choice = window_offset = ((number - 1) * length); if (disabled) { - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); } else { - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); } goto redraw; @@ -2594,11 +2564,12 @@ redraw: */ sprintf(buffer, CHOICE_ALREADY_CURRENT, (number + 1)); - HTUserMsg(buffer); + option_statusline(buffer); + sleep(MessageSecs); if (disabled) { - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); } else { - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); } break; } @@ -2622,9 +2593,9 @@ redraw: window_offset = 0; } if (disabled) { - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); } else { - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); } goto redraw; } @@ -2632,7 +2603,8 @@ redraw: /* * Not in range. - FM */ - HTUserMsg(BAD_CHOICE_NUM_ENTERED); + option_statusline(BAD_CHOICE_NUM_ENTERED); + sleep(MessageSecs); } } @@ -2640,9 +2612,9 @@ redraw: * Restore the popup statusline. - FM */ if (disabled) { - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); } else { - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); } break; @@ -2860,14 +2832,15 @@ redraw: strcpy(prev_target, prev_target_buffer); case LYK_WHEREIS: if (*prev_target == '\0' ) { - _statusline(ENTER_WHEREIS_QUERY); + option_statusline(ENTER_WHEREIS_QUERY); if ((ch = LYgetstr(prev_target, VISIBLE, sizeof(prev_target_buffer), recall)) < 0) { /* * User cancelled the search via ^G. - FM */ - HTInfoMsg(CANCELLED); + option_statusline(CANCELLED); + sleep(InfoSecs); goto restore_popup_statusline; } } @@ -2878,7 +2851,8 @@ check_recall: /* * No entry. Simply break. - FM */ - HTInfoMsg(CANCELLED); + option_statusline(CANCELLED); + sleep(InfoSecs); goto restore_popup_statusline; } @@ -2918,20 +2892,21 @@ check_recall: strcpy(prev_target, cp); if (*prev_target_buffer && !strcmp(prev_target_buffer, prev_target)) { - _statusline(EDIT_CURRENT_QUERY); + option_statusline(EDIT_CURRENT_QUERY); } else if ((*prev_target_buffer && QueryTotal == 2) || (!(*prev_target_buffer) && QueryTotal == 1)) { - _statusline(EDIT_THE_PREV_QUERY); + option_statusline(EDIT_THE_PREV_QUERY); } else { - _statusline(EDIT_A_PREV_QUERY); + option_statusline(EDIT_A_PREV_QUERY); } if ((ch = LYgetstr(prev_target, VISIBLE, sizeof(prev_target_buffer), recall)) < 0) { /* * User cancelled the search via ^G. - FM */ - HTInfoMsg(CANCELLED); + option_statusline(CANCELLED); + sleep(InfoSecs); goto restore_popup_statusline; } goto check_recall; @@ -2972,14 +2947,14 @@ check_recall: strcpy(prev_target, cp); if (*prev_target_buffer && !strcmp(prev_target_buffer, prev_target)) { - _statusline(EDIT_CURRENT_QUERY); + option_statusline(EDIT_CURRENT_QUERY); } else if ((*prev_target_buffer && QueryTotal == 2) || (!(*prev_target_buffer) && QueryTotal == 1)) { - _statusline(EDIT_THE_PREV_QUERY); + option_statusline(EDIT_THE_PREV_QUERY); } else { - _statusline(EDIT_A_PREV_QUERY); + option_statusline(EDIT_A_PREV_QUERY); } if ((ch = LYgetstr(prev_target, VISIBLE, sizeof(prev_target_buffer), @@ -2987,7 +2962,8 @@ check_recall: /* * User cancelled the search via ^G. - FM */ - HTInfoMsg(CANCELLED); + option_statusline(CANCELLED); + sleep(InfoSecs); goto restore_popup_statusline; } goto check_recall; @@ -3037,7 +3013,8 @@ check_recall: * If we started at the beginning, it can't be present. - FM */ if (cur_choice == 0) { - HTUserMsg2(STRING_NOT_FOUND, prev_target_buffer); + option_user_message(STRING_NOT_FOUND, prev_target_buffer); + sleep(MessageSecs); goto restore_popup_statusline; } @@ -3079,7 +3056,8 @@ check_recall: /* * Didn't find it in the preceding choices either. - FM */ - HTUserMsg2(STRING_NOT_FOUND, prev_target_buffer); + option_user_message(STRING_NOT_FOUND, prev_target_buffer); + sleep(MessageSecs); restore_popup_statusline: /* @@ -3087,9 +3065,9 @@ restore_popup_statusline: * reset the search variables. - FM */ if (disabled) - _statusline(CHOICE_LIST_UNM_MSG); + option_statusline(CHOICE_LIST_UNM_MSG); else - _statusline(CHOICE_LIST_MESSAGE); + option_statusline(CHOICE_LIST_MESSAGE); *prev_target = '\0'; QueryTotal = (search_queries ? HTList_count(search_queries) : 0); @@ -3106,7 +3084,8 @@ restore_popup_statusline: case LYK_PREV_DOC: cur_choice = orig_choice; term_options = TRUE; - HTUserMsg(CANCELLED); + option_statusline(CANCELLED); + sleep(MessageSecs); cmd = LYK_ACTIVATE; /* to exit */ break; } @@ -3119,994 +3098,10 @@ restore_popup_statusline: #endif /* !USE_SLANG */ if (disabled || term_options) { - _statusline(""); + option_statusline(""); return(orig_choice); } else { - _statusline(VALUE_ACCEPTED); + option_statusline(VALUE_ACCEPTED); return(cur_choice); } } - -#endif /* !NO_OPTION_MENU */ - -#ifndef NO_OPTION_FORMS - -/* - * I'm paranoid about mistyping strings. Also, this way they get combined - * so we don't have to worry about the intelligence of the compiler. - * We don't need to burn memory like it's cheap. We're better than that. - */ -#define SELECTED(flag) (flag) ? selected_string : "" -#define DISABLED(flag) (flag) ? disabled_string : "" -#define NOTEMPTY(text) (text && text[0]) ? text : "" - -typedef struct { - int value; - CONST char *LongName; - CONST char *HtmlName; -} OptValues; - -typedef struct { - char * tag; - char * value; -} PostPair; - -static CONST char selected_string[] = "selected"; -static CONST char disabled_string[] = "disabled"; -static CONST char on_string[] = "ON"; -static CONST char off_string[] = "OFF"; -static CONST char never_string[] = "NEVER"; -static CONST char always_string[] = "ALWAYS"; -static OptValues bool_values[] = { - { FALSE, "OFF", "OFF" }, - { TRUE, "ON", "ON" }, - { 0, 0, 0 }}; - -static char * secure_string = "secure"; -static char * secure_value = NULL; -static char * save_options_string = "save_options"; - -/* - * Personal Preferences - */ -static char * cookies_string = "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 = "editor"; -static char * emacs_keys_string = "emacs_keys"; - -#ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS -#define EXEC_ALWAYS 2 -#define EXEC_LOCAL 1 -#define EXEC_NEVER 0 -static char * exec_links_string = "exec_options"; -static OptValues exec_links_values[] = { - { EXEC_NEVER, "ALWAYS OFF", "ALWAYS OFF" }, - { EXEC_LOCAL, "FOR LOCAL FILES ONLY", "FOR LOCAL FILES ONLY" }, -#ifndef NEVER_ALLOW_REMOTE_EXEC - { EXEC_ALWAYS, "ALWAYS ON", "ALWAYS ON" }, -#endif - { 0, 0, 0 }}; -#endif /* ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */ - -static char * keypad_mode_string = "keypad_mode"; -static OptValues keypad_mode_values[] = { - { NUMBERS_AS_ARROWS, "Numbers act as arrows", "number_arrows" }, - { LINKS_ARE_NUMBERED, "Links are numbered", "links_numbered" }, - { LINKS_AND_FORM_FIELDS_ARE_NUMBERED, - "Links and form fields are numbered", - "links_and_forms" }, - { 0, 0, 0 }}; -static char * mail_address_string = "mail_address"; -static char * search_type_string = "search_type"; -static OptValues search_type_values[] = { - { FALSE, "Case insensitive", "case_insensitive" }, - { TRUE, "Case sensitive", "case_sensitive" }, - { 0, 0, 0 }}; -static char * select_popups_string = "select_popups"; -#if defined(USE_SLANG) || defined(COLOR_CURSES) -static char * show_color_string = "show_color"; -static OptValues show_color_values[] = { - { SHOW_COLOR_NEVER, never_string, never_string }, - { SHOW_COLOR_OFF, off_string, off_string }, - { SHOW_COLOR_ON, on_string, on_string }, - { SHOW_COLOR_ALWAYS, always_string, always_string }, - { 0, 0, 0 }}; -#endif -static char * show_cursor_string = "show_cursor"; -static char * user_mode_string = "user_mode"; -static OptValues user_mode_values[] = { - { NOVICE_MODE, "Novice", "Novice" }, - { INTERMEDIATE_MODE, "Intermediate", "Intermediate" }, - { ADVANCED_MODE, "Advanced", "Advanced" }, - { 0, 0, 0 }}; -static char * verbose_images_string = "verbose_images"; -static char * vi_keys_string = "vi_keys"; - -/* - * Bookmark Options - */ -static char * mbm_advanced_string = "ADVANCED"; -static char * mbm_off_string = "OFF"; -static char * mbm_standard_string = "STANDARD"; -static char * mbm_string = "multi_bookmarks_mode"; -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 = "display_char_set"; -static char * raw_mode_string = "raw_mode"; - -/* - * File Management Options - */ -static char * show_dotfiles_string = "show_dotfiles"; -#ifdef DIRED_SUPPORT -static char * dired_sort_string = "dired_sort"; -static OptValues dired_values[] = { - { 0, "Directories first", "dired_dir" }, - { FILES_FIRST, "Files first", "dired_files" }, - { MIXED_STYLE, "Mixed style", "dired_mixed" }, - { 0, 0, 0 }}; -#endif /* DIRED_SUPPORT */ -static char * ftp_sort_string = "ftp_sort"; -static OptValues ftp_sort_values[] = { - { FILE_BY_NAME, "By Name", "ftp_by_name" }, - { FILE_BY_TYPE, "By Type", "ftp_by_type" }, - { FILE_BY_SIZE, "By Size", "ftp_by_size" }, - { FILE_BY_DATE, "By Date", "ftp_by_date" }, - { 0, 0, 0 }}; - -/* - * Headers transferred to remote server - */ -static char * preferred_doc_char_string = "preferred_doc_char"; -static char * preferred_doc_lang_string = "preferred_doc_lang"; -static char * user_agent_string = "user_agent"; - -#define PutLabel(fp, text) \ - fprintf(fp," %-33s: ", text) - -#define PutTextInput(fp, Name, Value, Size, disable) \ - fprintf(fp,\ - "<input size=%d type=\"text\" name=\"%s\" value=\"%s\" %s>\n",\ - (int) Size, Name, Value, disable) - -#define PutOption(fp, flag, html, name) \ - fprintf(fp,"<option value=\"%s\" %s>%s\n", html, SELECTED(flag), name) - -#define BeginSelect(fp, text) \ - fprintf(fp,"<select name=\"%s\">\n", text) - -#define MaybeSelect(fp, flag, text) \ - fprintf(fp,"<select name=\"%s\" %s>\n", text, DISABLED(flag)) - -#define EndSelect(fp)\ - fprintf(fp,"</select>\n") - -PRIVATE void PutOptValues ARGS3( - FILE *, fp, - int, value, - OptValues *, table) -{ - while (table->LongName != 0) { - PutOption(fp, - value == table->value, - table->HtmlName, - table->LongName); - table++; - } -} - -PRIVATE int GetOptValues ARGS2( - OptValues *, table, - char *, value) -{ - while (table->LongName != 0) { - if (!strcmp(value, table->HtmlName)) - return table->value; - table++; - } - return -1; -} - -/* - * Break cgi line into array of pairs of pointers. Don't bother trying to - * be efficient. We're not called all that often. - * We come in with a string looking like: - * tag1=value1&tag2=value2&...&tagN=valueN - * We leave with an array of post_pairs. The last element in the array - * will have a tag pointing to NULL. - * Not pretty, but works. Hey, if strings can be null terminate arrays... - */ - -PRIVATE PostPair * break_data ARGS1( - char *, data) -{ - char * p = data; - PostPair * q = NULL; - int count = 0; - - if (p==NULL || p[0]=='\0') - return NULL; - - q = calloc(sizeof(PostPair), 1); - if (q==NULL) - outofmem(__FILE__, "break_data(calloc)"); - - do { - /* - * First, break up on '&', sliding 'p' on down the line. - */ - q[count].value = LYstrsep(&p, "&"); - /* - * Then break up on '=', sliding value down, and setting tag. - */ - q[count].tag = LYstrsep(&(q[count].value), "="); - - /* - * Clean them up a bit, in case user entered a funky string. - */ - HTUnEscape(q[count].tag); - - /* In the value field we have '+' instead of ' '. So do a simple - * find&replace on the value field before UnEscaping() - SKY - */ - { - size_t i, len; - len = strlen(q[count].value); - for (i = 0; i < len; i++) { - if (q[count].value[i] == '+') { -#ifdef UNIX - /* - * Allow for special case of options which begin with a "+" on - * Unix - TD - */ - if (i > 0 - && q[count].value[i+1] == '+' - && isalnum(q[count].value[i+2])) { - q[count].value[i++] = ' '; - i++; - continue; - } - -#endif - q[count].value[i] = ' '; - } - } - } - HTUnEscape(q[count].value); - - count++; - /* - * Like I said, screw efficiency. Sides, realloc is fast on - * Linux ;-> - */ - q = realloc(q, sizeof(PostPair)*(count+1)); - if (q==NULL) - outofmem(__FILE__, "break_data(realloc)"); - q[count].tag=NULL; - } while (p!=NULL && p[0]!='\0'); - return q; -} - -/* - * Handle options from the pseudo-post. I think we really only need - * post_data here, but bring along everything just in case. It's only a - * pointer. MRC - * - * By changing the certain options value (like preferred language or - * fake browser name) we need to inform the remote server and reload - * (uncache on a proxy) the document which was active just before - * the Options menu was invoked. Another values (like display_char_set - * or assume_char_set) used by lynx initial rendering stages - * and can only be changed after reloading :-( - * So we introduce boolean flag 'need_reload' (currently dummy). - * - * Options are processed in order according to gen_options(), we should not - * depend on it and add boolean flags where the order is essential (save, - * character sets...) - * - * Security: some options are disabled in gen_options() under certain - * conditions. We *should* duplicate the same conditions here in postoptions() - * to prevent user with a limited access from editing HTML options code - * manually and submit it to access the restricted items. - LP - */ - -PUBLIC int postoptions ARGS1( - document *, newdoc) -{ - PostPair *data = 0; - int i; - BOOLEAN save_all = FALSE; - int display_char_set_old = current_char_set; - BOOLEAN raw_mode_old = LYRawMode; - BOOLEAN assume_char_set_changed = FALSE; - BOOLEAN need_reload = FALSE; -#if defined(USE_SLANG) || defined(COLOR_CURSES) - int CurrentShowColor = LYShowColor; -#endif - - /*------------------------------------------------- - * kludge a link from mbm_menu, the URL was: - * "<a href=\"LYNXOPTIONS://MBM_MENU\">Goto multi-bookmark menu</a>\n" - *--------------------------------------------------*/ - - if (strstr(newdoc->address, "LYNXOPTIONS://MBM_MENU")) { - FREE(newdoc->post_data); - FREE(data); - edit_bookmarks(); - return(NULLFILE); - } - - data = break_data(newdoc->post_data); - - for (i = 0; data[i].tag != NULL; i++) { - /* - * Paranoid security. - */ - if (!strcmp(data[i].tag, secure_string)) { - if (!secure_value || strcmp(data[i].value, secure_value)) { - /* - * FIXME: We've been spoofed message here. - */ - FREE(data); - return(NULLFILE); - } - FREE(secure_value); - } - - /* Save options */ - if (!strcmp(data[i].tag, save_options_string) && (!no_option_save)) { - save_all = TRUE; - } - - /* Cookies: SELECT */ - if (!strcmp(data[i].tag, cookies_string)) { - if (!strcmp(data[i].value, cookies_ignore_all_string)) { - LYSetCookies = FALSE; - } else if (!strcmp(data[i].value, cookies_up_to_user_string)) { - LYSetCookies = TRUE; - LYAcceptAllCookies = FALSE; - } else if (!strcmp(data[i].value, cookies_accept_all_string)) { - LYSetCookies = TRUE; - LYAcceptAllCookies = TRUE; - } - } - - /* X Display: INPUT */ - if (!strcmp(data[i].tag, x_display_string)) { - LYsetXDisplay(data[i].value); - } - - /* Editor: INPUT */ - if (!strcmp(data[i].tag, editor_string)) { - FREE(editor); - StrAllocCopy(editor, data[i].value); - } - - /* Emacs keys: ON/OFF */ - if (!strcmp(data[i].tag, emacs_keys_string)) { - if ((emacs_keys = GetOptValues(bool_values, data[i].value))) { - set_emacs_keys(); - } else { - reset_emacs_keys(); - } - } - - /* Execution links: SELECT */ -#ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS - if (!strcmp(data[i].tag, exec_links_string)) { - int code = GetOptValues(exec_links_values, data[i].value); -#ifndef NEVER_ALLOW_REMOTE_EXEC - local_exec = (code == EXEC_ALWAYS); -#endif /* !NEVER_ALLOW_REMOTE_EXEC */ - local_exec_on_local_files = (code == EXEC_LOCAL); - } -#endif /* ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */ - - /* Keypad Mode: SELECT */ - if (!strcmp(data[i].tag, keypad_mode_string)) { - keypad_mode = GetOptValues(keypad_mode_values, data[i].value); - } - - /* Mail Address: INPUT */ - if (!strcmp(data[i].tag, mail_address_string)) { - FREE(personal_mail_address); - StrAllocCopy(personal_mail_address, data[i].value); - } - - /* Search Type: SELECT */ - if (!strcmp(data[i].tag, search_type_string)) { - case_sensitive = GetOptValues(search_type_values, data[i].value); - } - - /* Select Popups: ON/OFF */ - if (!strcmp(data[i].tag, select_popups_string)) { - LYSelectPopups = GetOptValues(bool_values, data[i].value); - } - -#if defined(USE_SLANG) || defined(COLOR_CURSES) - /* Show Color: SELECT */ - if (!strcmp(data[i].tag, show_color_string)) { - LYShowColor = GetOptValues(show_color_values, data[i].value); - LYChosenShowColor = LYShowColor; - if (CurrentShowColor != LYShowColor) { - lynx_force_repaint(); - } - CurrentShowColor = LYShowColor; -#ifdef USE_SLANG - SLtt_Use_Ansi_Colors = (LYShowColor > 1 ? 1 : 0); -#endif - } -#endif /* USE_SLANG || COLOR_CURSES */ - - /* Show Cursor: ON/OFF */ - if (!strcmp(data[i].tag, show_cursor_string)) { - LYShowCursor = GetOptValues(bool_values, data[i].value); - } - - /* User Mode: SELECT */ - if (!strcmp(data[i].tag, user_mode_string)) { - user_mode = GetOptValues(user_mode_values, data[i].value); - if (user_mode == NOVICE_MODE) { - display_lines = (LYlines - 4); - } else { - display_lines = LYlines-2; - } - } - - /* Verbose Images: ON/OFF */ - if (!strcmp(data[i].tag, verbose_images_string)) { - verbose_img = GetOptValues(bool_values, data[i].value); - } - - /* VI Keys: ON/OFF */ - if (!strcmp(data[i].tag, vi_keys_string)) { - if ((vi_keys = GetOptValues(bool_values, data[i].value))) { - set_vi_keys(); - } else if (!strcmp(data[i].value, off_string)) { - reset_vi_keys(); - } - } - - /* Bookmarks File Menu: SELECT */ - if (!strcmp(data[i].tag, mbm_string) && (!LYMBMBlocked)) { - if (!strcmp(data[i].value, mbm_off_string)) { - LYMultiBookmarks = FALSE; - } else if (!strcmp(data[i].value, mbm_standard_string)) { - LYMultiBookmarks = TRUE; - LYMBMAdvanced = FALSE; - } else if (!strcmp(data[i].value, mbm_advanced_string)) { - LYMultiBookmarks = TRUE; - LYMBMAdvanced = TRUE; - } - } - - /* Single Bookmarks filename: INPUT */ - if (!strcmp(data[i].tag, single_bookmark_string)) { - if (strcmp(data[i].value, "")) { - FREE(bookmark_page); - StrAllocCopy(bookmark_page, data[i].value); - } - } - - /* Assume Character Set: SELECT */ - if (!strcmp(data[i].tag, assume_char_set_string)) { - int newval; - - newval = UCGetLYhndl_byMIME(data[i].value); - if ((raw_mode_old && - newval != safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset)) - || (!raw_mode_old && - newval != UCLYhndl_for_unspec)) { - - UCLYhndl_for_unspec = newval; - StrAllocCopy(UCAssume_MIMEcharset, data[i].value); - assume_char_set_changed = TRUE; - } - } - - /* Display Character Set: SELECT */ - if (!strcmp(data[i].tag, display_char_set_string)) { - current_char_set = atoi(data[i].value); - } - - /* Raw Mode: ON/OFF */ - if (!strcmp(data[i].tag, raw_mode_string)) { - LYRawMode = GetOptValues(bool_values, data[i].value); - } - - /* - * ftp sort: SELECT - */ - if (!strcmp(data[i].tag, ftp_sort_string)) { - HTfileSortMethod = GetOptValues(ftp_sort_values, data[i].value); - } - -#ifdef DIRED_SUPPORT - /* Local Directory Sort: SELECT */ - if (!strcmp(data[i].tag, dired_sort_string)) { - dir_list_style = GetOptValues(dired_values, data[i].value); - } -#endif /* DIRED_SUPPORT */ - - /* Show dot files: ON/OFF */ - if (!strcmp(data[i].tag, show_dotfiles_string) && (!no_dotfiles)) { - show_dotfiles = GetOptValues(bool_values, data[i].value); - } - - /* Preferred Document Character Set: INPUT */ - if (!strcmp(data[i].tag, preferred_doc_char_string)) { - FREE(pref_charset); - StrAllocCopy(pref_charset, data[i].value); - } - - /* Preferred Document Language: INPUT */ - if (!strcmp(data[i].tag, preferred_doc_lang_string)) { - FREE(language); - StrAllocCopy(language, data[i].value); - } - - /* User Agent: INPUT */ - if (!strcmp(data[i].tag, user_agent_string) && (!no_useragent)) { - FREE(LYUserAgent); - /* ignore Copyright warning ? */ - StrAllocCopy(LYUserAgent, - *(data[i].value) - ? data[i].value - : LYUserAgentDefault); - if (LYUserAgent && *LYUserAgent && - !strstr(LYUserAgent, "Lynx") && - !strstr(LYUserAgent, "lynx")) { - HTAlert(UA_COPYRIGHT_WARNING); - } - } - } /* end of loop */ - - /* - * Process the flags: - */ - if ( display_char_set_old != current_char_set || - raw_mode_old != LYRawMode || - assume_char_set_changed ) { - /* - * charset settings: the order is essential here. - */ - if (display_char_set_old != current_char_set) { - /* - * Set the LYUseDefaultRawMode value and character - * handling if LYRawMode was changed. - FM - */ - LYUseDefaultRawMode = TRUE; - HTMLUseCharacterSet(current_char_set); - } - if (assume_char_set_changed) { - LYRawMode = (UCLYhndl_for_unspec == current_char_set); - } - if (raw_mode_old != LYRawMode || assume_char_set_changed) { - /* - * Set the raw 8-bit or CJK mode defaults and - * character set if changed. - FM - */ - HTMLSetUseDefaultRawMode(current_char_set, LYRawMode); - HTMLSetCharacterHandling(current_char_set); - } - need_reload = TRUE; - } /* end of charset settings */ - - - /* - * FIXME: Golly gee, we need to write all of this out now, don't we? - */ - FREE(newdoc->post_data); - FREE(data); - if (save_all) { - _statusline(SAVING_OPTIONS); - if (save_rc()) { - _statusline(OPTIONS_SAVED); - } else { - HTAlert(OPTIONS_NOT_SAVED); - } - } - LYpop(newdoc); /* return to previous doc, not to options menu! */ - - if (need_reload == TRUE) { - /* FIXME: currently dummy */ - } - return(NULLFILE); -} - -PRIVATE char *NewSecureValue NOARGS -{ - FREE(secure_value); - if ((secure_value = malloc(80)) != 0) { - sprintf(secure_value, "%ld", (long)secure_value + (long)time(0)); - return secure_value; - } - return "?"; -} - -/* - * Okay, someone wants to change options. So, lets gen up a form for them - * and pass it around. Gor, this is ugly. Be a lot easier in Bourne with - * "here" documents. :-> - * Basic Strategy: For each option, throw up the appropriate type of - * control, giving defaults as appropriate. If nothing else, we're - * probably going to test every control there is. MRC - * - * This function is synchronized with postoptions(). Read the comments in - * postoptions() header if you change something in gen_options(). - */ -PUBLIC int gen_options ARGS1( - char **, newfile) -{ - int i; -#if defined(USE_SLANG) || defined(COLOR_CURSES) - BOOLEAN can_do_colors; -#endif - static char tempfile[LY_MAXPATH]; - FILE *fp0; - size_t cset_len = 0; - size_t text_len = COLS - 38; /* cf: PutLabel */ - - LYRemoveTemp(tempfile); - fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w"); - if (fp0 == NULL) { - HTAlert(UNABLE_TO_OPEN_TEMPFILE); - return(-1); - } - - LYLocalFileToURL(newfile, tempfile); - - LYforce_no_cache = TRUE; - - BeginInternalPage(fp0, OPTIONS_TITLE, NULL); /* help link below */ - - /* - * I do C, not HTML. Feel free to pretty this up. - */ - fprintf(fp0,"<form action=\"LYNXOPTIONS:\" method=\"post\">\n"); - /* - * use following with some sort of one shot secret key akin to NCSA - * (or was it CUTE?) telnet one shot password to allow ftp to self. - * to prevent spoofing. - */ - fprintf(fp0,"<input name=\"%s\" type=\"hidden\" value=\"%s\">\n", - secure_string, NewSecureValue()); - - /* - * visible text begins here - */ - - /* Submit/Reset/Help */ - fprintf(fp0,"<p align=center>\n"); - fprintf(fp0,"<input type=\"submit\" value=\"Accept Changes\"> - \n"); - fprintf(fp0,"<input type=\"reset\" value=\"Reset Changes\">\n"); - fprintf(fp0,"Left Arrow cancels changes\n"); - fprintf(fp0, "<a href=\"%s%s\">HELP!</a>\n", - helpfilepath, OPTIONS_HELP); - - /* Save options */ - if (!no_option_save) { - fprintf(fp0, "<p align=center>Save options to disk: "); - fprintf(fp0, "<input type=\"checkbox\" name=\"%s\">\n", - save_options_string); - } - - /* - * preformatted text follows - */ - fprintf(fp0,"<pre>\n"); - fprintf(fp0,"\n <em>Personal Preferences</em>\n"); - - /* Cookies: SELECT */ - PutLabel(fp0, "Cookies"); - BeginSelect(fp0, cookies_string); - PutOption(fp0, !LYSetCookies, - cookies_ignore_all_string, - cookies_ignore_all_string); - PutOption(fp0, LYSetCookies && !LYAcceptAllCookies, - cookies_up_to_user_string, - cookies_up_to_user_string); - PutOption(fp0, LYSetCookies && LYAcceptAllCookies, - cookies_accept_all_string, - cookies_accept_all_string); - EndSelect(fp0); - - /* Editor: INPUT */ - PutLabel(fp0, "Editor"); - PutTextInput(fp0, editor_string, NOTEMPTY(editor), text_len, - DISABLED(no_editor || system_editor)); - - /* Emacs keys: ON/OFF */ - PutLabel(fp0, "Emacs keys"); - BeginSelect(fp0, emacs_keys_string); - PutOptValues(fp0, emacs_keys, bool_values); - EndSelect(fp0); - - /* Execution links: SELECT */ -#ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS - PutLabel(fp0, "Execution links"); - BeginSelect(fp0, exec_links_string); -#ifndef NEVER_ALLOW_REMOTE_EXEC - PutOptValues(fp0, local_exec - ? EXEC_ALWAYS - : (local_exec_on_local_files - ? EXEC_LOCAL - : EXEC_NEVER), - exec_links_values); -#else - PutOptValues(fp0, local_exec_on_local_files - ? EXEC_LOCAL - : EXEC_NEVER, - exec_links_values); -#endif /* !NEVER_ALLOW_REMOTE_EXEC */ - EndSelect(fp0); -#endif /* ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */ - - /* Keypad Mode: SELECT */ - PutLabel(fp0, "Keypad mode"); - BeginSelect(fp0, keypad_mode_string); - PutOptValues(fp0, keypad_mode, keypad_mode_values); - EndSelect(fp0); - - /* Mail Address: INPUT */ - PutLabel(fp0, "Personal mail address"); - PutTextInput(fp0, mail_address_string, - NOTEMPTY(personal_mail_address), text_len, ""); - - /* Select Popups: ON/OFF */ - PutLabel(fp0, "Popups for select fields"); - BeginSelect(fp0, select_popups_string); - PutOptValues(fp0, LYSelectPopups, bool_values); - EndSelect(fp0); - - /* Search Type: SELECT */ - PutLabel(fp0, "Searching type"); - BeginSelect(fp0, search_type_string); - PutOptValues(fp0, case_sensitive, search_type_values); - EndSelect(fp0); - - /* Show Color: SELECT */ -#if defined(USE_SLANG) || defined(COLOR_CURSES) - can_do_colors = 1; -#if defined(COLOR_CURSES) - can_do_colors = has_colors(); -#endif - PutLabel(fp0, "Show color"); - MaybeSelect(fp0, !can_do_colors, show_color_string); - if (no_option_save) { - if (LYShowColor == SHOW_COLOR_NEVER) { - LYShowColor = SHOW_COLOR_OFF; - } else if (LYShowColor == SHOW_COLOR_ALWAYS) { - LYShowColor = SHOW_COLOR_ON; - } - PutOptValues(fp0, LYShowColor, bool_values); - } else { - if (LYChosenShowColor == SHOW_COLOR_UNKNOWN) { - switch (LYrcShowColor) { - case SHOW_COLOR_NEVER: - LYChosenShowColor = - (LYShowColor >= SHOW_COLOR_ON) ? - SHOW_COLOR_ON : SHOW_COLOR_NEVER; - break; - case SHOW_COLOR_ALWAYS: - if (!can_do_colors) - LYChosenShowColor = SHOW_COLOR_ALWAYS; - else - LYChosenShowColor = - (LYShowColor >= SHOW_COLOR_ON) ? - SHOW_COLOR_ALWAYS : SHOW_COLOR_OFF; - break; - default: - LYChosenShowColor = - (LYShowColor >= SHOW_COLOR_ON) ? - SHOW_COLOR_ON : SHOW_COLOR_OFF; - } - } - show_color_values[3].LongName = (can_do_colors) ? always_string - : "Always try"; - PutOptValues(fp0, LYChosenShowColor, show_color_values); - } - EndSelect(fp0); -#endif /* USE_SLANG || COLOR_CURSES */ - - /* Show cursor: ON/OFF */ - PutLabel(fp0, "Show cursor"); - BeginSelect(fp0, show_cursor_string); - PutOptValues(fp0, LYShowCursor, bool_values); - EndSelect(fp0); - - /* User Mode: SELECT */ - PutLabel(fp0, "User mode"); - BeginSelect(fp0, user_mode_string); - PutOptValues(fp0, user_mode, user_mode_values); - EndSelect(fp0); - - /* Verbose Images: ON/OFF */ - PutLabel(fp0, "Verbose images"); - BeginSelect(fp0, verbose_images_string); - PutOptValues(fp0, verbose_img, bool_values); - EndSelect(fp0); - - /* VI Keys: ON/OFF */ - PutLabel(fp0, "VI keys"); - BeginSelect(fp0, vi_keys_string); - PutOptValues(fp0, vi_keys, bool_values); - EndSelect(fp0); - - - /* X Display: INPUT */ - PutLabel(fp0, "X Display"); - PutTextInput(fp0, x_display_string, NOTEMPTY(x_display), text_len, ""); - - /* - * Bookmark Options - */ - fprintf(fp0,"\n <em>Bookmark Options</em>\n"); - - /* Multi-Bookmark Mode: SELECT */ - if (!LYMBMBlocked) { - PutLabel(fp0, "Multi-bookmarks"); - BeginSelect(fp0, mbm_string); - PutOption(fp0, !LYMultiBookmarks, - mbm_off_string, - mbm_off_string); - PutOption(fp0, LYMultiBookmarks && !LYMBMAdvanced, - mbm_standard_string, - mbm_standard_string); - PutOption(fp0, LYMultiBookmarks && LYMBMAdvanced, - mbm_advanced_string, - mbm_advanced_string); - EndSelect(fp0); - } - - /* Bookmarks File Menu: LINK/INPUT */ - if (LYMultiBookmarks) { - - PutLabel(fp0, "Review/edit Bookmarks files"); - fprintf(fp0, - "<a href=\"LYNXOPTIONS://MBM_MENU\">Goto multi-bookmark menu</a>\n"); - - } else { - PutLabel(fp0, "Bookmarks file"); - PutTextInput(fp0, single_bookmark_string, - NOTEMPTY(bookmark_page), text_len, ""); - } - - /* - * Character Set Options - */ - fprintf(fp0,"\n <em>Character Set Options</em>\n"); - - /* Assume Character Set: SELECT */ - /* if (user_mode==ADVANCED_MODE) */ - { - int curval; - curval = UCLYhndl_for_unspec; - - /* - * FIXME: If bogus value in lynx.cfg, then in old way, that is the - * string that was displayed. Now, user will never see that. Good - * or bad? I don't know. MRC - */ - if (curval == current_char_set) { - /* ok, LYRawMode, so use UCAssume_MIMEcharset */ - curval = safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset); - } - PutLabel(fp0, "Assumed document character set"); - BeginSelect(fp0, assume_char_set_string); - for (i = 0; i < LYNumCharsets; i++) { - PutOption(fp0, i==curval, - LYCharSet_UC[i].MIMEname, - LYCharSet_UC[i].MIMEname); - } - EndSelect(fp0); - } - - /* Display Character Set: SELECT */ - PutLabel(fp0, "Display character set"); - BeginSelect(fp0, display_char_set_string); - for (i = 0; LYchar_set_names[i]; i++) { - char temp[10]; - size_t len = strlen(LYchar_set_names[i]); - if (len > cset_len) - cset_len = len; - sprintf(temp, "%d", i); - PutOption(fp0, i==current_char_set, temp, LYchar_set_names[i]); - } - EndSelect(fp0); - - /* Raw Mode: ON/OFF */ - if (LYHaveCJKCharacterSet) - /* - * Since CJK people hardly mixed with other world - * we split the header to make it more readable: - * "CJK mode" for CJK display charsets, and "Raw 8-bit" for others. - */ - PutLabel(fp0, "CJK mode"); - else - PutLabel(fp0, "Raw 8-bit"); - - BeginSelect(fp0, raw_mode_string); - PutOptValues(fp0, LYRawMode, bool_values); - EndSelect(fp0); - - /* - * File Management Options - */ - fprintf(fp0,"\n <em>File Management Options</em>\n"); - - /* FTP sort: SELECT */ - PutLabel(fp0, "Ftp sort criteria"); - BeginSelect(fp0, ftp_sort_string); - PutOptValues(fp0, HTfileSortMethod, ftp_sort_values); - EndSelect(fp0); - -#ifdef DIRED_SUPPORT - /* Local Directory Sort: SELECT */ - PutLabel(fp0, "Local directory sort criteria"); - BeginSelect(fp0, dired_sort_string); - PutOptValues(fp0, dir_list_style, dired_values); - EndSelect(fp0); -#endif /* DIRED_SUPPORT */ - - /* Show dot files: ON/OFF */ - if (!no_dotfiles) { - PutLabel(fp0, "Show dot files"); - BeginSelect(fp0, show_dotfiles_string); - PutOptValues(fp0, show_dotfiles, bool_values); - EndSelect(fp0); - } - - /* - * Headers transferred to remote server - */ - fprintf(fp0,"\n <em>Headers transferred to remote server</em>\n"); - - /* Preferred Document Character Set: INPUT */ - PutLabel(fp0, "Preferred document character set"); - PutTextInput(fp0, preferred_doc_char_string, - NOTEMPTY(pref_charset), cset_len+2, ""); - - /* Preferred Document Language: INPUT */ - PutLabel(fp0, "Preferred document language"); - PutTextInput(fp0, preferred_doc_lang_string, - NOTEMPTY(language), cset_len+2, ""); - - /* User Agent: INPUT */ - if (!no_useragent) { - PutLabel(fp0, "User-Agent header"); - PutTextInput(fp0, user_agent_string, - NOTEMPTY(LYUserAgent), text_len, ""); - } - - if (!LYRestricted) { - fprintf(fp0, - "\n Check your <a href=\"%s\">lynx.cfg</a> here\n", - lynx_cfg_infopage()); - } - - fprintf(fp0,"\n</pre>\n"); - - /* Submit/Reset */ - fprintf(fp0,"<p align=center>\n"); - fprintf(fp0,"<input type=\"submit\" value=\"Accept Changes\">\n - "); - fprintf(fp0,"<input type=\"reset\" value=\"Reset Changes\">\n"); - fprintf(fp0,"Left Arrow cancels changes\n"); - - /* - * close HTML - */ - fprintf(fp0,"</form>\n"); - EndInternalPage(fp0); - - LYCloseTempFP(fp0); - return(0); -} -#endif /* !NO_OPTION_FORMS */ diff --git a/src/LYOptions.h b/src/LYOptions.h index c8fdccbd..ea9e914a 100644 --- a/src/LYOptions.h +++ b/src/LYOptions.h @@ -1,19 +1,65 @@ #ifndef LYOPTIONS_H #define LYOPTIONS_H -#include <LYStructs.h> - -extern BOOLEAN term_options; /* for LYgetstr() */ +extern BOOLEAN term_options; +extern void options NOPARAMS; extern void edit_bookmarks NOPARAMS; -#ifndef NO_OPTION_FORMS -extern int postoptions PARAMS((document *newdoc)); -extern int gen_options PARAMS((char **newfile)); -#endif /* !NO_OPTION_FORMS */ +/* + * Values for the options menu. - FM + * + * L_foo values are the Y coordinates for the menu item. + * B_foo values are the X coordinates for the item's prompt string. + * C_foo values are the X coordinates for the item's value string. + */ +#define L_EDITOR 2 +#define L_DISPLAY 3 + +#define L_HOME 4 +#define C_MULTI 24 +#define B_BOOK 34 +#define C_DEFAULT 50 + +#define L_FTPSTYPE 5 +#define L_MAIL_ADDRESS 6 +#define L_SSEARCH 7 +#define L_LANGUAGE 8 +#define L_PREF_CHARSET 9 +#define L_ASSUME_CHARSET (L_PREF_CHARSET + 1) +#define L_CHARSET 10 +#define L_RAWMODE 11 + +#define L_COLOR L_RAWMODE +#define B_COLOR 44 +#define C_COLOR 62 + +#define L_BOOL_A 12 +#define B_VIKEYS 5 +#define C_VIKEYS 15 +#define B_EMACSKEYS 22 +#define C_EMACSKEYS 36 +#define B_SHOW_DOTFILES 44 +#define C_SHOW_DOTFILES 62 + +#define L_BOOL_B 13 +#define B_SELECT_POPUPS 5 +#define C_SELECT_POPUPS 36 +#define B_SHOW_CURSOR 44 +#define C_SHOW_CURSOR 62 + +#define L_KEYPAD 14 +#define L_LINEED 15 -#ifndef NO_OPTION_MENU -extern void LYoptions NOPARAMS; -#endif /* !NO_OPTION_MENU */ +#ifdef DIRED_SUPPORT +#define L_DIRED 16 +#define L_USER_MODE 17 +#define L_USER_AGENT 18 +#define L_EXEC 19 +#else +#define L_USER_MODE 16 +#define L_USER_AGENT 17 +#define L_EXEC 18 +#endif /* DIRED_SUPPORT */ #endif /* LYOPTIONS_H */ diff --git a/src/LYPrint.c b/src/LYPrint.c index 8c4415d0..2ad75810 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTAccess.h> #include <HTList.h> #include <HTAlert.h> @@ -13,14 +14,23 @@ #include <LYClean.h> #include <LYGetFile.h> #include <LYHistory.h> +#include <LYSystem.h> #include <LYList.h> #include <LYCharSets.h> /* To get current charset for mail header. */ +#ifdef VMS +#include <HTVMSUtils.h> +#endif /* VMS */ +#ifdef DOSPATH +#include <HTDOS.h> +#endif #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* * printfile prints out the current file minus the links and targets - * to a variety of places + * to a veriaty of places */ /* it parses an incoming link that looks like @@ -28,49 +38,30 @@ * LYNXPRINT://LOCAL_FILE/lines=## * LYNXPRINT://MAIL_FILE/lines=## * LYNXPRINT://TO_SCREEN/lines=## - * LYNXPRINT://LPANSI/lines=## * LYNXPRINT://PRINTER/lines=##/number=# */ #define TO_FILE 1 #define TO_SCREEN 2 -/* - * "lpansi.c" - * Original author: Gary Day (gday@comp.uark.edu), 11/30/93 - * Current version: 2.1 by Noel Hunter (noel@wfu.edu), 10/20/94 - * - * Basic structure based on print -- format files for printing from - * _Practical_C_Programming by Steve Oualline, O'Reilly & Associates - * - * adapted from the README for lpansi.c v2.1, dated 10/20/1994: - * Print to ANSI printer on local terminal - * The VT100 standard defines printer on and off escape sequences, - * esc[5i is printer on, and esc[4i is printer off. - * - * incorporate the idea of "lpansi" directly into LYPrint.c - HN - */ -#define LPANSI 3 -#define MAIL 4 -#define PRINTER 5 +#define MAIL 3 +#define PRINTER 4 #ifdef VMS PRIVATE int remove_quotes PARAMS((char *string)); #endif /* VMS */ -PRIVATE char* subject_translate8bit PARAMS((char *source)); - PUBLIC int printfile ARGS1( document *, newdoc) { - static char tempfile[LY_MAXPATH]; + static char tempfile[256]; + static BOOLEAN first = TRUE; char buffer[LINESIZE]; char filename[LINESIZE]; char user_response[256]; int lines_in_file = 0; int printer_number = 0; int pages = 0; - int type = 0, c; - BOOLEAN Lpansi = FALSE; + int type = 0, c, len; FILE *outfile_fp; char *cp = NULL; lynx_printer_item_type *cur_printer; @@ -87,12 +78,11 @@ PUBLIC int printfile ARGS1( HTAtom *encoding; BOOL use_mime, use_cte, use_type; CONST char *disp_charset; - char *subject = NULL; /* print-to-email */ static BOOLEAN first_mail_preparsed = TRUE; char *envbuffer = NULL; #ifdef VMS BOOLEAN isPMDF = FALSE; - char hdrfile[LY_MAXPATH]; + char hdrfile[256]; FILE *hfd; if (!strncasecomp(system_mail, "PMDF SEND", 9)) { @@ -124,7 +114,7 @@ PUBLIC int printfile ARGS1( */ if (HText_getContentBase()) { StrAllocCopy(content_base, HText_getContentBase()); - LYRemoveBlanks(content_base); + collapse_spaces(content_base); if (!(content_base && *content_base)) { FREE(content_base); } @@ -136,7 +126,7 @@ PUBLIC int printfile ARGS1( if (HTisDocumentSource()) { if (HText_getContentLocation()) { StrAllocCopy(content_location, HText_getContentLocation()); - LYRemoveBlanks(content_location); + collapse_spaces(content_location); if (!(content_location && *content_location)) { FREE(content_location); } @@ -156,7 +146,7 @@ PUBLIC int printfile ARGS1( /* * Load the suggested filename string. - FM */ - if (HText_getSugFname() != 0) + if (HText_getSugFname() != NULL) StrAllocCopy(sug_filename, HText_getSugFname()); /* must be freed */ else StrAllocCopy(sug_filename, newdoc->address); /* must be freed */ @@ -206,9 +196,6 @@ PUBLIC int printfile ARGS1( type = TO_FILE; } else if (strstr(link_info, "TO_SCREEN")) { type = TO_SCREEN; - } else if (strstr(link_info, "LPANSI")) { - Lpansi = TRUE; - type = TO_SCREEN; } else if (strstr(link_info, "MAIL_FILE")) { type = MAIL; } else if (strstr(link_info, "PRINTER")) { @@ -240,8 +227,10 @@ PUBLIC int printfile ARGS1( * Act on the request. - FM */ switch (type) { - case TO_FILE: +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_TEXT; +#endif /* __DJGPP__ or _WINDOWS */ _statusline(FILENAME_PROMPT); retry: strcpy(filename, sug_filename); /* add suggestion info */ /* make the sug_filename conform to system specs */ @@ -336,12 +325,18 @@ PUBLIC int printfile ARGS1( /* * Save cancelled. */ - HTInfoMsg(SAVE_REQUEST_CANCELLED); + _statusline(SAVE_REQUEST_CANCELLED); + sleep(InfoSecs); break; } if (no_dotfiles || !show_dotfiles) { - if (*LYPathLeaf(filename) == '.') { + if (*filename == '.' || +#ifdef VMS + ((cp = strrchr(filename, ':')) && *(cp+1) == '.') || + ((cp = strrchr(filename, ']')) && *(cp+1) == '.') || +#endif /* VMS */ + ((cp = strrchr(filename, '/')) && *(cp+1) == '.')) { HTAlert(FILENAME_CANNOT_BE_DOT); _statusline(NEW_FILENAME_PROMPT); FirstRecall = TRUE; @@ -360,14 +355,24 @@ PUBLIC int printfile ARGS1( if (!strcmp(filename, "/dev/null")) #endif /* VMS */ { - HTInfoMsg(SAVE_REQUEST_CANCELLED); + _statusline(SAVE_REQUEST_CANCELLED); + sleep(InfoSecs); break; } if ((cp = strchr(filename, '~'))) { *(cp++) = '\0'; strcpy(buffer, filename); - LYTrimPathSep(buffer); - strcat(buffer, wwwName(Home_Dir())); + if ((len=strlen(buffer)) > 0 && buffer[len-1] == '/') + buffer[len-1] = '\0'; +#ifdef DOSPATH + strcat(buffer, HTDOS_wwwName((char *)Home_Dir())); +#else +#ifdef VMS + strcat(buffer, HTVMS_wwwName((char *)Home_Dir())); +#else + strcat(buffer, Home_Dir()); +#endif /* VMS */ +#endif /* DOSPATH */ strcat(buffer, cp); strcpy(filename, buffer); } @@ -385,25 +390,22 @@ PUBLIC int printfile ARGS1( strcpy(buffer, filename); } #else - -#ifndef __EMX__ - if (!LYIsPathSep(*filename)) { -#if defined(__DJGPP__) || defined(_WINDOWS) - if (strchr(buffer, ':') != NULL) - cp = NULL; - else -#endif /* __DJGPP__ || _WINDOWS */ + if (*filename != '/') cp = getenv("PWD"); - } else -#endif cp = NULL; - - LYTrimPathSep(cp); if (cp) - sprintf(buffer, "%s/%s", cp, HTSYS_name(filename)); +#ifdef DOSPATH + sprintf(buffer, "%s/%s", cp, HTDOS_name(filename)); +#else + sprintf(buffer, "%s/%s", cp, filename); +#endif else - strcpy(buffer, HTSYS_name(filename)); +#ifdef DOSPATH + strcpy(buffer, HTDOS_name(filename)); +#else + strcpy(buffer, filename); +#endif #endif /* VMS */ /* @@ -423,12 +425,14 @@ PUBLIC int printfile ARGS1( #ifdef VMS if (HadVMSInterrupt) { HadVMSInterrupt = FALSE; - HTInfoMsg(SAVE_REQUEST_CANCELLED); + _statusline(SAVE_REQUEST_CANCELLED); + sleep(InfoSecs); break; } #endif /* VMS */ if (c == 7 || c == 3) { /* Control-G or Control-C */ - HTInfoMsg(SAVE_REQUEST_CANCELLED); + _statusline(SAVE_REQUEST_CANCELLED); + sleep(InfoSecs); break; } if (TOUPPER(c) == 'N') { @@ -455,17 +459,10 @@ PUBLIC int printfile ARGS1( * get any partial or relative URLs resolved * properly if no BASE tag is present to * replace it. - FM - * - * Add timestamp (last reload). */ - fprintf(outfile_fp, - "<!-- X-URL: %s -->\n", newdoc->address); - if (HText_getDate() != NULL) - fprintf(outfile_fp, - "<!-- Date: %s -->\n", HText_getDate()); - fprintf(outfile_fp, - "<BASE HREF=\"%s\">\n", content_base); + "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n", + newdoc->address, content_base); } if (LYPrependCharsetToSource && HTisDocumentSource()) { @@ -516,6 +513,9 @@ PUBLIC int printfile ARGS1( #else HTAddSugFilename(buffer); #endif /* VMS */ +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_BINARY; +#endif /* __DJGPP__ or _WINDOWS */ break; case MAIL: @@ -529,7 +529,8 @@ PUBLIC int printfile ARGS1( #ifdef VMS if (HadVMSInterrupt) { HadVMSInterrupt = FALSE; - HTInfoMsg(MAIL_REQUEST_CANCELLED); + _statusline(MAIL_REQUEST_CANCELLED); + sleep(InfoSecs); break; } #endif /* VMS */ @@ -538,7 +539,8 @@ PUBLIC int printfile ARGS1( addstr(" Ok..."); first_mail_preparsed = FALSE; } else { - HTInfoMsg(MAIL_REQUEST_CANCELLED); + _statusline(MAIL_REQUEST_CANCELLED); + sleep(InfoSecs); break; } } @@ -549,7 +551,8 @@ PUBLIC int printfile ARGS1( if (LYgetstr(user_response, VISIBLE, sizeof(user_response), NORECALL) < 0 || *user_response == '\0') { - HTInfoMsg(MAIL_REQUEST_CANCELLED); + _statusline(MAIL_REQUEST_CANCELLED); + sleep(InfoSecs); break; } @@ -575,13 +578,7 @@ PUBLIC int printfile ARGS1( } use_type = (disp_charset || HTisDocumentSource()); - /* - * Use newdoc->title as a subject instead of sug_filename: - * MORE readable and 8-bit letters shouldn't be a problem - LP - */ - /* change_sug_filename(sug_filename); */ - subject = subject_translate8bit(newdoc->title); - + change_sug_filename(sug_filename); #ifdef VMS if (strchr(user_response,'@') && !strchr(user_response,':') && !strchr(user_response,'%') && !strchr(user_response,'"')) { @@ -589,19 +586,44 @@ PUBLIC int printfile ARGS1( strcpy(user_response, filename); } - LYRemoveTemp(tempfile); - outfile_fp = LYOpenTemp(tempfile, - (HTisDocumentSource()) - ? HTML_SUFFIX - : ".txt", - "w"); - if (outfile_fp == NULL) { + if (first) { + tempname(tempfile, NEW_FILE); + if (isPMDF) { + tempname(hdrfile, NEW_FILE); + if ((len = strlen(hdrfile)) > 4) { + len -= 5; + if (!strcasecomp((hdrfile + len), ".html")) { + hdrfile[len] = '\0'; + strcat(hdrfile, ".txt"); + } + } + } + first = FALSE; + } else { + remove(tempfile); /* remove duplicates */ + } + if (HTisDocumentSource()) { + if ((len = strlen(tempfile)) > 3) { + len -= 4; + if (!strcasecomp((tempfile + len), ".txt")) { + tempfile[len] = '\0'; + strcat(tempfile, ".html"); + } + } + } else if ((len = strlen(tempfile)) > 4) { + len -= 5; + if (!strcasecomp((tempfile + len), ".html")) { + tempfile[len] = '\0'; + strcat(tempfile, ".txt"); + } + } + if ((outfile_fp = LYNewTxtFile(tempfile)) == NULL) { HTAlert(UNABLE_TO_OPEN_TEMPFILE); break; } if (isPMDF) { - if ((hfd = LYOpenTemp(hdrfile, ".txt", "w")) == NULL) { + if ((hfd = LYNewTxtFile(hdrfile)) == NULL) { HTAlert(UNABLE_TO_OPEN_TEMPFILE); break; } @@ -670,15 +692,15 @@ PUBLIC int printfile ARGS1( print_wwwfile_to_fd(outfile_fp, 0); if (keypad_mode) printlist(outfile_fp, FALSE); - LYCloseTempFP(outfile_fp); + fclose(outfile_fp); if (isPMDF) { /* * For PMDF, put the subject in the * header file and close it. - FM */ - fprintf(hfd, "Subject: %.70s\n\n", subject); - LYCloseTempFP(hfd); + fprintf(hfd, "Subject: %.70s\n\n", sug_filename); + fclose(hfd); /* * Now set up the command. - FM */ @@ -694,35 +716,46 @@ PUBLIC int printfile ARGS1( * For "generic" VMS MAIL, include * the subject in the command. - FM */ - remove_quotes(subject); + remove_quotes(sug_filename); sprintf(buffer, "%s %s/subject=\"%.70s\" %s %s", system_mail, system_mail_flags, - subject, + sug_filename, tempfile, user_response); } stop_curses(); printf(MAILING_FILE); - LYSystem(buffer); + fflush(stdout); + system(buffer); + fflush(stdout); sleep(AlertSecs); start_curses(); - if (isPMDF) - LYRemoveTemp(hdrfile); -#else /* Unix or DOS */ + if (isPMDF) { + /* + * Delete the header file. - FM + */ + remove(hdrfile); + } +#else /* Unix: */ + sprintf(buffer, "%s %s", system_mail, system_mail_flags); #ifdef DOSPATH - outfile_fp = LYOpenTemp(tempfile, ".txt", "w"); + sprintf(tempfile, "%s%s", lynx_temp_space, "temp_mail.txt"); + if ((outfile_fp = LYNewTxtFile(tempfile)) == NULL) { + _statusline(MAIL_REQUEST_FAILED); + sleep(AlertSecs); + return; + } #else - sprintf(buffer, "%s %s", system_mail, system_mail_flags); - outfile_fp = popen(buffer, "w"); -#endif - if (outfile_fp == NULL) { - HTAlert(MAIL_REQUEST_FAILED); - break; + if ((outfile_fp = popen(buffer, "w")) == NULL) { + _statusline(MAIL_REQUEST_FAILED); + sleep(AlertSecs); + break; } +#endif /* * Determine which mail headers should be sent. @@ -742,7 +775,7 @@ PUBLIC int printfile ARGS1( /* * Don't send a charset if we have a CJK character set * selected, since it may not be appropriate for mail... - * Also don't use an unofficial "x-" charset. - kw + * Also don't use an inofficial "x-" charset. - kw */ if (!use_cte || LYHaveCJKCharacterSet || strncasecomp(disp_charset, "x-", 2) == 0) { @@ -807,7 +840,7 @@ PUBLIC int printfile ARGS1( * Add the To, Subject, and X-URL headers. - FM */ fprintf(outfile_fp, "To: %s\nSubject: %s\n", - user_response, subject); + user_response, sug_filename); fprintf(outfile_fp, "X-URL: %s\n\n", newdoc->address); if (LYPrependBaseToSource && HTisDocumentSource()) { /* @@ -828,13 +861,13 @@ PUBLIC int printfile ARGS1( #ifdef DOSPATH sprintf(buffer, "%s -t \"%s\" -F %s", system_mail, user_response, tempfile); - LYCloseTempFP(outfile_fp); /* Close the tmpfile. */ + fclose(outfile_fp); /* Close the tmpfile. */ stop_curses(); printf("Sending \n\n$ %s\n\nPlease wait...", buffer); - LYSystem(buffer); + system(buffer); sleep(MessageSecs); start_curses(); - LYRemoveTemp(tempfile); /* Delete the tmpfile. */ + remove(tempfile); /* Delete the tmpfile. */ #else pclose(outfile_fp); #endif @@ -849,11 +882,12 @@ PUBLIC int printfile ARGS1( if (pages > 4) { sprintf(filename, CONFIRM_LONG_SCREEN_PRINT, pages); _statusline(filename); - c = LYgetch(); + c=LYgetch(); #ifdef VMS if (HadVMSInterrupt) { HadVMSInterrupt = FALSE; - HTInfoMsg(PRINT_REQUEST_CANCELLED); + _statusline(PRINT_REQUEST_CANCELLED); + sleep(InfoSecs); break; } #endif /* VMS */ @@ -861,20 +895,18 @@ PUBLIC int printfile ARGS1( || c == '\n' || c == '\r') { addstr(" Ok..."); } else { - HTInfoMsg(PRINT_REQUEST_CANCELLED); + _statusline(PRINT_REQUEST_CANCELLED); + sleep(InfoSecs); break; } } - if (Lpansi) { - _statusline(CHECK_PRINTER); - } else { - _statusline(PRESS_RETURN_TO_BEGIN); - } + _statusline(PRESS_RETURN_TO_BEGIN); *filename = '\0'; if (LYgetstr(filename, VISIBLE, sizeof(filename), NORECALL) < 0) { - HTInfoMsg(PRINT_REQUEST_CANCELLED); + _statusline(PRINT_REQUEST_CANCELLED); + sleep(InfoSecs); break; } @@ -898,8 +930,6 @@ PUBLIC int printfile ARGS1( "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n", newdoc->address, content_base); } - if (Lpansi) - printf("\033[5i"); print_wwwfile_to_fd(outfile_fp, 0); if (keypad_mode) printlist(outfile_fp, FALSE); @@ -911,18 +941,13 @@ PUBLIC int printfile ARGS1( break; } #endif /* VMS */ - if (Lpansi) { - printf("\n\014"); /* Form feed */ - printf("\033[4i"); - Lpansi = FALSE; - } else { - fprintf(stdout,"\n\n%s", PRESS_RETURN_TO_FINISH); - LYgetch(); /* grab some user input to pause */ + fprintf(stdout,"\n\n%s", PRESS_RETURN_TO_FINISH); + + fflush(stdout); /* refresh to screen */ + LYgetch(); /* grab some user input to pause */ #ifdef VMS - HadVMSInterrupt = FALSE; + HadVMSInterrupt = FALSE; #endif /* VMS */ - } - fflush(stdout); /* refresh to screen */ start_curses(); break; @@ -938,7 +963,8 @@ PUBLIC int printfile ARGS1( #ifdef VMS if (HadVMSInterrupt) { HadVMSInterrupt = FALSE; - HTInfoMsg(PRINT_REQUEST_CANCELLED); + _statusline(PRINT_REQUEST_CANCELLED); + sleep(InfoSecs); break; } #endif /* VMS */ @@ -946,18 +972,34 @@ PUBLIC int printfile ARGS1( || c == '\n' || c == '\r') { addstr(" Ok..."); } else { - HTInfoMsg(PRINT_REQUEST_CANCELLED); + _statusline(PRINT_REQUEST_CANCELLED); + sleep(InfoSecs); break; } } - LYRemoveTemp(tempfile); - outfile_fp = LYOpenTemp(tempfile, - (HTisDocumentSource()) - ? HTML_SUFFIX - : ".txt", - "w"); - if (outfile_fp == NULL) { + if (first) { + tempname(tempfile, NEW_FILE); + first = FALSE; + } else { + remove(tempfile); /* Remove previous tempfile. */ + } + if (((cp = strrchr(tempfile, '.')) != NULL) && +#ifdef VMS + NULL == strchr(cp, ']') && +#endif /* VMS */ + NULL == strchr(cp, '/')) { + if (HTisDocumentSource() && + strcasecomp(cp, HTML_SUFFIX)) { + *cp = '\0'; + strcat(tempfile, HTML_SUFFIX); + } else if (!HTisDocumentSource() && + strcasecomp(cp, ".txt")) { + *cp = '\0'; + strcat(tempfile, ".txt"); + } + } + if ((outfile_fp = LYNewTxtFile(tempfile)) == NULL) { HTAlert(FILE_ALLOC_FAILED); break; } @@ -979,7 +1021,7 @@ PUBLIC int printfile ARGS1( if (keypad_mode) printlist(outfile_fp, FALSE); - LYCloseTempFP(outfile_fp); + fclose(outfile_fp); /* find the right printer number */ { @@ -1092,12 +1134,21 @@ PUBLIC int printfile ARGS1( /* * Printer cancelled. */ - HTInfoMsg(PRINT_REQUEST_CANCELLED); + _statusline(PRINT_REQUEST_CANCELLED); + sleep(InfoSecs); break; } if (no_dotfiles || !show_dotfiles) { - if (*LYPathLeaf(filename) == '.') { + if (*filename == '.' || +#ifdef VMS + ((cp = strrchr(filename, ':')) && + *(cp+1) == '.') || + ((cp = strrchr(filename, ']')) && + *(cp+1) == '.') || +#endif /* VMS */ + ((cp = strrchr(filename, '/')) && + *(cp+1) == '.')) { HTAlert(FILENAME_CANNOT_BE_DOT); _statusline(NEW_FILENAME_PROMPT); FirstRecall = TRUE; @@ -1116,13 +1167,14 @@ PUBLIC int printfile ARGS1( if (!strcmp(filename, "/dev/null")) #endif /* VMS */ { - HTInfoMsg(PRINT_REQUEST_CANCELLED); + _statusline(PRINT_REQUEST_CANCELLED); + sleep(InfoSecs); break; } HTAddSugFilename(filename); } -#if defined (VMS) || defined (__EMX__) || defined(__DJGPP__) +#ifdef VMS sprintf(buffer, cur_printer->command, tempfile, filename, "", "", "", "", "", "", "", "", "", ""); #else /* Unix: */ @@ -1148,7 +1200,8 @@ PUBLIC int printfile ARGS1( move(1,1); stop_curses(); - CTRACE(tfp, "command: %s\n", buffer); + if (TRACE) + fprintf(stderr, "command: %s\n", buffer); printf(PRINTING_FILE); #ifdef VMS /* @@ -1166,7 +1219,8 @@ PUBLIC int printfile ARGS1( StrAllocCat(envbuffer, HText_getTitle()); putenv(envbuffer); #endif /* VMS */ - LYSystem(buffer); + fflush(stdout); + system(buffer); #ifdef VMS /* * Remove LYNX_PRINT_TITLE logical. - FM @@ -1186,11 +1240,11 @@ PUBLIC int printfile ARGS1( #endif /* !VMS */ sleep(MessageSecs); start_curses(); + /* don't remove(tempfile); */ } /* end switch */ FREE(link_info); FREE(sug_filename); - FREE(subject); FREE(content_base); FREE(content_location); return(NORMAL); @@ -1215,129 +1269,83 @@ PRIVATE int remove_quotes ARGS1( #endif /* VMS */ /* - * Mail subject may have 8-bit characters and they are in display charset. - * There is no stable practice for 8-bit subject encodings: - * MIME define "quoted-printable" which holds charset info - * but most mailers still don't support it, on the other hand - * many mailers send open 8-bit subjects without charset info - * and use local assumption for certain countries. - * - * We translate subject to "outgoing_mail_charset" (defined in lynx.cfg) - * it may correspond to US-ASCII as the safest value or any other - * lynx character handler, -1 for no translation (so display charset). - * - */ -PRIVATE char* subject_translate8bit ARGS1(char *, source) -{ - CONST char *p = source; - char temp[256]; - char *q = temp; - char *target = NULL; - - int charset_in, charset_out, uck; - char replace_buf [10]; - - int i = outgoing_mail_charset; /* from lynx.cfg, -1 by default */ - - if (i < 0 - || LYHaveCJKCharacterSet - || LYCharSet_UC[i].enc == UCT_ENC_CJK) { - return(source); /* OK */ - } else { - charset_out = i; - charset_in = current_char_set; - } - - for ( ; *p; p++) { - LYstrncpy(q, p, 1); - if ((unsigned char)*q <= 127) { - StrAllocCat(target, q); - } else { - uck = UCTransCharStr(replace_buf, sizeof(replace_buf), *q, - charset_in, charset_out, YES); - if (uck >0) - StrAllocCat(target, replace_buf); - } - } - - return(target); -} - -/* * print_options writes out the current printer choices to a file * so that the user can select printers in the same way that * they select all other links * printer links look like * LYNXPRINT://LOCAL_FILE/lines=# print to a local file * LYNXPRINT://TO_SCREEN/lines=# print to the screen - * LYNXPRINT://LPANSI/lines=# print to the local terminal * LYNXPRINT://MAIL_FILE/lines=# mail the file * LYNXPRINT://PRINTER/lines=#/number=# print to printer number # */ -PUBLIC int print_options ARGS3( +PUBLIC int print_options ARGS2( char **, newfile, - char **, printed_url, int, lines_in_file) { - static char tempfile[LY_MAXPATH]; + static char tempfile[256]; + static BOOLEAN first = TRUE; + static char print_filename[256]; char buffer[LINESIZE]; int count; int pages; FILE *fp0; lynx_printer_item_type *cur_printer; + pages = lines_in_file/66 + 1; - LYRemoveTemp(tempfile); - if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) { + if (first) { + tempname(tempfile, NEW_FILE); +#if defined (VMS) || defined (DOSPATH) + sprintf(print_filename, "file://localhost/%s", tempfile); +#else + sprintf(print_filename, "file://localhost%s", tempfile); +#endif /* VMS */ + first = FALSE; +#ifdef VMS + } else { + remove(tempfile); /* Remove duplicates on VMS. */ +#endif /* !VMS */ + } + + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(UNABLE_TO_OPEN_PRINTOP_FILE); return(-1); } - LYLocalFileToURL(newfile, tempfile); + StrAllocCopy(*newfile, print_filename); + LYforce_no_cache = TRUE; - BeginInternalPage(fp0, PRINT_OPTIONS_TITLE, PRINT_OPTIONS_HELP); + fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n", + PRINT_OPTIONS_TITLE); - fprintf(fp0, "<pre>\n"); + fprintf(fp0,"<h1>Printing Options (%s Version %s)</h1><pre>\n", + LYNX_NAME, LYNX_VERSION); - /* pages = lines_in_file/66 + 1; */ pages = (lines_in_file+65)/66; - sprintf(buffer, " \ -<em>Document:</em> %s\n \ -<em>Number of lines:</em> %d\n \ -<em>Number of pages:</em> %d page%s (approximately)\n", - *printed_url, - lines_in_file, - pages, (pages > 1 ? "s" : "")); - fputs(buffer, fp0); + sprintf(buffer, + " There are %d lines, or approximately %d page%s, to print.\n", + lines_in_file, pages, (pages > 1 ? "s" : "")); + fputs(buffer,fp0); if (no_print || no_disk_save || child_lynx || no_mail) - fprintf(fp0, " <em>Some print functions have been disabled!</em>\n"); + fprintf(fp0, " Some print functions have been disabled!!!\n"); - fprintf(fp0, "\n%s options:\n", - (user_mode == NOVICE_MODE) ? "Standard print" : "Print"); + fprintf(fp0, " You have the following print choices.\n"); + fprintf(fp0, " Please select one:\n\n"); if (child_lynx == FALSE && no_disk_save == FALSE && no_print == FALSE) fprintf(fp0, " <a href=\"LYNXPRINT://LOCAL_FILE/lines=%d\">Save to a local file</a>\n", lines_in_file); else - fprintf(fp0," <em>Save to disk disabled.</em>\n"); - if (child_lynx == FALSE && no_mail == FALSE && local_host_only == FALSE) + fprintf(fp0," Save to disk disabled.\n"); + if (child_lynx == FALSE && no_mail == FALSE) fprintf(fp0, " <a href=\"LYNXPRINT://MAIL_FILE/lines=%d\">Mail the file</a>\n", lines_in_file); - -#ifndef DOSPATH fprintf(fp0, " <a href=\"LYNXPRINT://TO_SCREEN/lines=%d\">Print to the screen</a>\n", lines_in_file); - fprintf(fp0, - " <a href=\"LYNXPRINT://LPANSI/lines=%d\">Print out on a printer attached to your vt100 terminal</a>\n", - lines_in_file); -#endif - - if (user_mode == NOVICE_MODE) - fprintf(fp0, "\nLocal additions:\n"); for (count = 0, cur_printer = printers; cur_printer != NULL; cur_printer = cur_printer->next, count++) @@ -1349,9 +1357,8 @@ PUBLIC int print_options ARGS3( cur_printer->name : "No Name Given")); fprintf(fp0, "</a>\n"); } - fprintf(fp0, "</pre>\n"); - EndInternalPage(fp0); - LYCloseTempFP(fp0); + fprintf(fp0, "</pre>\n</body>\n"); + fclose(fp0); LYforce_no_cache = TRUE; return(0); diff --git a/src/LYPrint.h b/src/LYPrint.h index 12efe47c..fec8200f 100644 --- a/src/LYPrint.h +++ b/src/LYPrint.h @@ -1,3 +1,4 @@ + #ifndef LYPRINT_H #define LYPRINT_H @@ -6,8 +7,9 @@ #endif /* LYSTRUCTS_H */ extern int printfile PARAMS((document *newdoc)); -extern int print_options PARAMS((char **newfile, - char **printed_url, int lines_in_file)); +extern int print_options PARAMS((char **newfile, int lines_in_file)); + +#define PRINT_OPTIONS_TITLE "Lynx Printing Options" #endif /* LYPRINT_H */ diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 59c8d15e..228d5029 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTFile.h> #include <UCMap.h> @@ -14,9 +15,7 @@ #include <LYCurses.h> #include <LYSignal.h> #include <LYBookmark.h> -#include <LYCookie.h> #include <LYReadCFG.h> -#include <HTAlert.h> #ifdef DIRED_SUPPORT #include <LYLocal.h> @@ -25,12 +24,20 @@ #include <LYexit.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + extern int HTNewsMaxChunk; /* Max news articles before chunking (HTNews.c) */ extern int HTNewsChunkSize; /* Number of news articles per chunk (HTNews.c) */ PUBLIC BOOLEAN have_read_cfg=FALSE; PUBLIC BOOLEAN LYUseNoviceLineTwo=TRUE; +#ifdef VMS +#define DISPLAY "DECW$DISPLAY" +#else +#define DISPLAY "DISPLAY" +#endif /* VMS */ + /* * Translate a TRUE/FALSE field in a string buffer. */ @@ -131,7 +138,7 @@ PRIVATE void add_item_to_list ARGS2( */ cur_item = (lynx_html_item_type *)calloc(sizeof(lynx_html_item_type),1); if (cur_item == NULL) - outofmem(__FILE__, "read_cfg"); + perror("Out of memory in read_cfg"); *list_ptr = cur_item; atexit(free_item_list); } else { @@ -144,7 +151,7 @@ PRIVATE void add_item_to_list ARGS2( ; /* null body */ cur_item = (lynx_html_item_type *)calloc(sizeof(lynx_html_item_type),1); if (cur_item == NULL) - outofmem(__FILE__, "read_cfg"); + perror("Out of memory in read_cfg"); else prev_item->next = cur_item; } @@ -162,27 +169,20 @@ PRIVATE void add_item_to_list ARGS2( */ cur_item->name = (char *)calloc((colon-buffer+1),sizeof(char)); if (cur_item->name == NULL) - outofmem(__FILE__, "read_cfg"); + perror("Out of memory in read_cfg"); LYstrncpy(cur_item->name, buffer, (int)(colon-buffer)); remove_backslashes(cur_item->name); /* - * Process TRUE/FALSE field. If we do not find one, assume it is - * true. In any case, we want the command string. + * Process TRUE/FALSE field */ - if ((next_colon = find_colon(colon+1)) == NULL) { - next_colon = colon + strlen(colon); - } - if (next_colon - (colon+1) > 0) { + if ((next_colon = find_colon(colon+1)) != NULL) { cur_item->command = (char *)calloc(next_colon-colon, sizeof(char)); if (cur_item->command == NULL) - outofmem(__FILE__, "read_cfg"); + perror("Out of memory in read_cfg"); LYstrncpy(cur_item->command, colon+1, (int)(next_colon-(colon+1))); remove_backslashes(cur_item->command); - cur_item->always_enabled = TRUE; - } - if (*next_colon++) { - cur_item->always_enabled = is_true(next_colon); + cur_item->always_enabled = is_true(next_colon+1); } } } @@ -227,7 +227,7 @@ PRIVATE void add_printer_to_list ARGS2( */ cur_item = (lynx_printer_item_type *)calloc(sizeof(lynx_printer_item_type),1); if (cur_item == NULL) - outofmem(__FILE__, "read_cfg"); + perror("Out of memory in read_cfg"); *list_ptr = cur_item; atexit(free_printer_item_list); } else { @@ -241,7 +241,7 @@ PRIVATE void add_printer_to_list ARGS2( cur_item = (lynx_printer_item_type *)calloc(sizeof(lynx_printer_item_type),1); if (cur_item == NULL) - outofmem(__FILE__, "read_cfg"); + perror("Out of memory in read_cfg"); else prev_item->next = cur_item; } @@ -259,7 +259,7 @@ PRIVATE void add_printer_to_list ARGS2( */ cur_item->name = (char *)calloc((colon-buffer+1), sizeof(char)); if (cur_item->name == NULL) - outofmem(__FILE__, "read_cfg"); + perror("Out of memory in read_cfg"); LYstrncpy(cur_item->name, buffer, (int)(colon-buffer)); remove_backslashes(cur_item->name); @@ -269,7 +269,7 @@ PRIVATE void add_printer_to_list ARGS2( if ((next_colon = find_colon(colon+1)) != NULL) { cur_item->command = (char *)calloc(next_colon-colon, sizeof(char)); if (cur_item->command == NULL) - outofmem(__FILE__, "read_cfg"); + perror("Out of memory in read_cfg"); LYstrncpy(cur_item->command, colon+1, (int)(next_colon-(colon+1))); remove_backslashes(cur_item->command); cur_item->always_enabled = is_true(next_colon+1); @@ -297,7 +297,7 @@ PRIVATE void add_printer_to_list ARGS2( int default_fg = COLOR_WHITE; int default_bg = COLOR_BLACK; -static CONST char *Color_Strings[16] = +static char *Color_Strings[16] = { "black", "red", @@ -437,767 +437,892 @@ PRIVATE void parse_color ARGS1( } #endif /* USE_COLOR_TABLE */ -#define MAX_LINE_BUFFER_LEN 501 - -typedef int (*ParseFunc) PARAMS((char *)); - -typedef union { - lynx_html_item_type ** add_value; - BOOLEAN * set_value; - int * int_value; - char ** str_value; - ParseFunc fun_value; - long def_value; -} ConfigUnion; - -#undef PARSE_DEBUG -#ifdef PARSE_DEBUG -#define ParseData \ - lynx_html_item_type** add_value; \ - BOOLEAN *set_value; \ - int *int_value; \ - char **str_value; \ - ParseFunc fun_value; \ - long def_value -#define PARSE_ADD(n,t,v) {n,t, &v, 0, 0, 0, 0, 0} -#define PARSE_SET(n,t,v) {n,t, 0, &v, 0, 0, 0, 0} -#define PARSE_INT(n,t,v) {n,t, 0, 0, &v, 0, 0, 0} -#define PARSE_STR(n,t,v) {n,t, 0, 0, 0, &v, 0, 0} -#define PARSE_ENV(n,t,v) {n,t, 0, 0, 0, v, 0, 0} -#define PARSE_FUN(n,t,v) {n,t, 0, 0, 0, 0, v, 0} -#define PARSE_DEF(n,t,v) {n,t, 0, 0, 0, 0, 0, v} -#else -#define ParseData long value -#define PARSE_ADD(n,t,v) {n,t, (long)&(v)} -#define PARSE_SET(n,t,v) {n,t, (long)&(v)} -#define PARSE_INT(n,t,v) {n,t, (long)&(v)} -#define PARSE_STR(n,t,v) {n,t, (long)&(v)} -#define PARSE_ENV(n,t,v) {n,t, (long) (v)} -#define PARSE_FUN(n,t,v) {n,t, (long) (v)} -#define PARSE_DEF(n,t,v) {n,t, (long) (v)} -#endif - -typedef struct +/* + * Process the configuration file (lynx.cfg). + */ +PUBLIC void read_cfg ARGS3( + char *, cfg_filename, + char *, parent_filename, + int, nesting_level) { - CONST char *name; - int type; -#define CONF_UNSPECIFIED 0 -#define CONF_BOOL 1 /* BOOLEAN type */ -#define CONF_FUN 2 -#define CONF_INT 3 -#define CONF_STR 4 -#define CONF_ENV 5 /* from environment variable */ -#define CONF_ENV2 6 /* from environment VARIABLE */ -#define CONF_INCLUDE 7 /* include file-- handle special */ -#define CONF_ADD_ITEM 8 -#define CONF_ADD_TRUSTED 9 - - ParseData; -} -Config_Type; + FILE *fp; + char buffer[501]; + char temp[501]; + char *cp, *cp1; + int i, j, len; -static int assume_charset_fun ARGS1( - char *, value) -{ - UCLYhndl_for_unspec = safeUCGetLYhndl_byMIME(value); - StrAllocCopy(UCAssume_MIMEcharset, - LYCharSet_UC[UCLYhndl_for_unspec].MIMEname); -/* this may be a memory for bogus typo - - StrAllocCopy(UCAssume_MIMEcharset, value); - LYLowerCase(UCAssume_MIMEcharset); */ - - return 0; -} + if (TRACE) { + fprintf(stderr, + "Loading cfg file '%s'.\n", cfg_filename); + } + /* + * Don't get hung up by an include file loop. Arbitrary max depth + * of 10. - BL + */ + if (nesting_level > 10) { + fprintf(stderr, + "More than %d nested lynx.cfg includes -- perhaps there is a loop?!?\n", + nesting_level - 1); + fprintf(stderr,"Last attempted include was '%s',\n", cfg_filename); + fprintf(stderr,"included from '%s'.\n", parent_filename); + exit(-1); + } + /* + * Locate and open the file. + */ + if (!cfg_filename || strlen(cfg_filename) == 0) { + if (TRACE) + fprintf(stderr,"No filename following -cfg switch!\n"); + return; + } + if ((fp = fopen(cfg_filename,"r")) == NULL) { + if (TRACE) + fprintf(stderr,"lynx.cfg file not found as %s\n",cfg_filename); + return; + } + have_read_cfg=TRUE; -static int assume_local_charset_fun ARGS1( - char *, value) -{ - UCLYhndl_HTFile_for_unspec = safeUCGetLYhndl_byMIME(value); - return 0; -} + /* + * Process each line in the file. + */ + while (fgets(buffer, 500, fp) != NULL) { + /* + * Strip off \n at the end. + */ + if ((cp = (char *)strchr(buffer, '\n')) != NULL) + *cp = '\0'; -static int assume_unrec_charset_fun ARGS1( - char *, value) -{ - UCLYhndl_for_unrec = safeUCGetLYhndl_byMIME(value); - return 0; -} + /* + * Trim off any trailing comments. + */ + if ((cp = (char *)strrchr(buffer, ':')) != NULL) { + if ((cp1 = (char *)strchr(cp, '#')) != NULL) { + cp1--; + if (isspace((unsigned char)*cp1)) { + *cp1 = '\0'; + } + } + } -static int character_set_fun ARGS1( - char *, value) -{ - int i = UCGetLYhndl_byAnyName(value); /* by MIME or full name */ - if (i < 0) - ; /* do nothing here: so fallback to userdefs.h */ - else - current_char_set = i; + /* + * Strip off trailing white space. + */ + len = strlen(buffer); + while (len && isspace(buffer[len-1])) { + len--; + buffer[len] = '\0'; + } - return 0; -} + /* + * Skip any blank or purely comment lines. + */ + if (buffer[0] == '\0' || buffer[0] == '#') + continue; -static int outgoing_mail_charset_fun ARGS1( - char *, value) -{ - outgoing_mail_charset = UCGetLYhndl_byMIME(value); - /* -1 if NULL or not recognized value: no translation (compatibility) */ + /* + * Process the string buffer. + */ + switch (TOUPPER(buffer[0])) { + + case 'A': + if (!strncasecomp(buffer, "ALERTSECS:", 10)) { + strcpy(temp, buffer+10); + for (i = 0; temp[i]; i++) { + if (!isdigit(temp[i])) { + temp[i] = '\0'; + break; + } + } + if (temp[0]) + AlertSecs = atoi(temp); - return 0; -} + } else if (!strncasecomp(buffer, "ALWAYS_RESUBMIT_POSTS:", 22)) { + LYresubmit_posts = is_true(buffer+22); +#ifdef EXEC_LINKS + } else if (!strncasecomp(buffer, "ALWAYS_TRUSTED_EXEC:", 20)) { + add_trusted(&buffer[20], ALWAYS_EXEC_PATH); /* Add exec path */ +#endif /* EXEC_LINKS */ + + } else if (!strncasecomp(buffer, "ASSUME_CHARSET:", 15)) { + StrAllocCopy(UCAssume_MIMEcharset, buffer+15); + for (i = 0; UCAssume_MIMEcharset[i]; i++) + UCAssume_MIMEcharset[i] = TOLOWER(UCAssume_MIMEcharset[i]); + UCLYhndl_for_unspec = + UCGetLYhndl_byMIME(UCAssume_MIMEcharset); + + } else if (!strncasecomp(buffer, "ASSUME_LOCAL_CHARSET:", 21)) { + StrAllocCopy(UCAssume_localMIMEcharset, buffer+21); + for (i = 0; UCAssume_localMIMEcharset[i]; i++) + UCAssume_localMIMEcharset[i] = + TOLOWER(UCAssume_localMIMEcharset[i]); + UCLYhndl_HTFile_for_unspec = + UCGetLYhndl_byMIME(UCAssume_localMIMEcharset); + + } else if (!strncasecomp(buffer, "ASSUME_UNREC_CHARSET:", 21)) { + StrAllocCopy(UCAssume_unrecMIMEcharset, buffer+21); + for (i = 0; UCAssume_unrecMIMEcharset[i]; i++) + UCAssume_unrecMIMEcharset[i] = + TOLOWER(UCAssume_unrecMIMEcharset[i]); + UCLYhndl_for_unrec = + UCGetLYhndl_byMIME(UCAssume_unrecMIMEcharset); + } + break; -#ifdef USE_COLOR_TABLE -static int color_fun ARGS1( - char *, value) -{ - parse_color (value); - return 0; -} -#endif + case 'B': + if (!strncasecomp(buffer, "BLOCK_MULTI_BOOKMARKS:", 22)) { + LYMBMBlocked = is_true(buffer+22); -static int default_bookmark_file_fun ARGS1( - char *, value) -{ - StrAllocCopy(bookmark_page, value); - StrAllocCopy(BookmarkPage, bookmark_page); - StrAllocCopy(MBM_A_subbookmark[0], bookmark_page); - StrAllocCopy(MBM_A_subdescript[0], MULTIBOOKMARKS_DEFAULT); - return 0; -} + } else if (!strncasecomp(buffer, "BOLD_H1:", 8)) { + bold_H1 = is_true(buffer+8); -static int default_cache_size_fun ARGS1( - char *, value) -{ - HTCacheSize = atoi(value); - if (HTCacheSize < 2) HTCacheSize = 2; - return 0; -} + } else if (!strncasecomp(buffer, "BOLD_HEADERS:", 13)) { + bold_headers = is_true(buffer+13); -static int default_editor_fun ARGS1( - char *, value) -{ - if (!system_editor) StrAllocCopy(editor, value); - return 0; -} + } else if (!strncasecomp(buffer, "BOLD_NAME_ANCHORS:", 18)) { + bold_name_anchors = is_true(buffer+18); + } + break; + + case 'C': + if (!strncasecomp(buffer, "CASE_SENSITIVE_ALWAYS_ON:", 25)) { + case_sensitive = is_true(buffer+25); + + } else if (!strncasecomp(buffer, "CHARACTER_SET:", 14)) { + for (i = 0; LYchar_set_names[i]; i++) { + if (!strncmp(buffer+14, + LYchar_set_names[i], strlen(buffer+14))) { + current_char_set=i; + HTMLSetRawModeDefault(i); + break; + } + } -static int numbers_as_arrows_fun ARGS1( - char *, value) -{ - if (is_true(value)) - keypad_mode = NUMBERS_AS_ARROWS; - else - keypad_mode = LINKS_ARE_NUMBERED; + } else if (!strncasecomp(buffer, "CHECKMAIL:", 10)) { + check_mail = is_true(buffer+10); - return 0; -} + } else if (!strncasecomp(buffer, "COLLAPSE_BR_TAGS:", 17)) { + LYCollapseBRs = is_true(buffer+17); -static int default_user_mode_fun ARGS1( - char *, value) -{ - if (!strncasecomp(value, "NOVICE", 6)) - user_mode = NOVICE_MODE; - else if (!strncasecomp(value, "INTER", 5)) - user_mode = INTERMEDIATE_MODE; - else if (!strncasecomp(value, "ADVANCE", 7)) - user_mode = ADVANCED_MODE; - - return 0; -} +#if USE_COLOR_TABLE + } else if (!strncasecomp(buffer, "COLOR:", 6)) { + parse_color(buffer + 6); +#endif /* USE_COLOR_TABLE */ -#ifdef DIRED_SUPPORT -static int dired_menu_fun ARGS1( - char *, value) -{ - add_menu_item(value); - return 0; -} -#endif + } else if (!strncasecomp(buffer, "cso_proxy:", 10)) { + if (getenv("cso_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "cso_proxy"); + Define_VMSLogical(temp, (char *)&buffer[10]); +#else + strcpy(temp, "cso_proxy="); + StrAllocCopy(cso_proxy_putenv_cmd, temp); + StrAllocCat(cso_proxy_putenv_cmd, (char *)&buffer[10]); + putenv(cso_proxy_putenv_cmd); +#endif /* VMS */ + } -static int jumpfile_fun ARGS1( - char *, value) -{ - char buffer [MAX_LINE_BUFFER_LEN]; +#ifdef VMS + } else if (!strncasecomp(buffer, "CSWING_PATH:", 12)) { + StrAllocCopy(LYCSwingPath, buffer+12); +#endif /* VMS */ + } + break; + + case 'D': + if (!strncasecomp(buffer, "DEFAULT_BOOKMARK_FILE:", 22)) { + StrAllocCopy(bookmark_page, buffer+22); + StrAllocCopy(BookmarkPage, bookmark_page); + StrAllocCopy(MBM_A_subbookmark[0], bookmark_page); + StrAllocCopy(MBM_A_subdescript[0], MULTIBOOKMARKS_DEFAULT); + + } else if (!strncasecomp(buffer, "DEFAULT_CACHE_SIZE:", 19)) { + HTCacheSize = atoi(buffer+19); + if (HTCacheSize < 2) HTCacheSize = 2; + + } else if (!system_editor && + !strncasecomp(buffer, "DEFAULT_EDITOR:", 15)) { + StrAllocCopy(editor, buffer+15); + + } else if (!strncasecomp(buffer, "DEFAULT_INDEX_FILE:", 19)) { + StrAllocCopy(indexfile, buffer+19); + + } else if (!strncasecomp(buffer, + "DEFAULT_KEYPAD_MODE_IS_NUMBERS_AS_ARROWS:", 41)) { + if (is_true(buffer+41)) + keypad_mode = NUMBERS_AS_ARROWS; + else + keypad_mode = LINKS_ARE_NUMBERED; - sprintf (buffer, "JUMPFILE:%s", value); - if (!LYJumpInit(buffer)) - CTRACE(tfp, "Failed to register %s\n", buffer); + } else if (!strncasecomp(buffer, "DEFAULT_USER_MODE:", 18)) { + if (!strncasecomp(buffer+18, "NOVICE", 6)) + user_mode = NOVICE_MODE; + else if (!strncasecomp(buffer+18, "INTER", 5)) + user_mode = INTERMEDIATE_MODE; + else if (!strncasecomp(buffer+18, "ADVANCE", 7)) + user_mode = ADVANCED_MODE; - return 0; -} +#if defined(VMS) && defined(VAXC) && !defined(__DECC) + } else if (!strncasecomp(buffer, + "DEFAULT_VIRTUAL_MEMORY_SIZE:", 28)) { + HTVirtualMemorySize = atoi(buffer+28); +#endif /* VMS && VAXC && !__DECC */ -static int keymap_fun ARGS1( - char *, key) -{ - char *func; - - if ((func = strchr(key, ':')) != NULL) { - *func++ = '\0'; - /* Allow comments on the ends of key remapping lines. - DT */ - if (!remap(key, strtok(func, " \t\n#"))) - fprintf(stderr, - "key remapping of %s to %s failed\n",key,func); - else if (!strcmp("TOGGLE_HELP", strtok(func, " \t\n#"))) - LYUseNoviceLineTwo = FALSE; - } - return 0; -} +#ifdef DIRED_SUPPORT + } else if (!strncasecomp(buffer, "DIRED_MENU:", 11)) { + add_menu_item(&buffer[11]); +#endif /* DIRED_SUPPORT */ -static int localhost_alias_fun ARGS1( - char *, value) -{ - LYAddLocalhostAlias(value); - return 0; -} + } else if (!strncasecomp(buffer, "DOWNLOADER:", 11)) { + add_item_to_list(&buffer[11], &downloaders); + } + break; -#ifdef LYNXCGI_LINKS -static int lynxcgi_environment_fun ARGS1( - char *, value) -{ - add_lynxcgi_environment(value); - return 0; -} + case 'E': + if (!strncasecomp(buffer, "EMACS_KEYS_ALWAYS_ON:", 21)) { + emacs_keys = is_true(buffer+21); + + } else if (!strncasecomp(buffer, "ENABLE_SCROLLBACK:", 18)) { + enable_scrollback = is_true(buffer+18); + } +#ifdef USE_EXTERNALS + else if(!strncasecomp(buffer,"EXTERNAL:",9)) { + add_item_to_list(&buffer[9],&externals); + } #endif + break; -static int lynx_sig_file_fun ARGS1( - char *, value) -{ - if (LYPathOffHomeOK(value, 256)) { - StrAllocCopy(LynxSigFile, value); - LYAddPathToHome(value, 256, LynxSigFile); - StrAllocCopy(LynxSigFile, value); - CTRACE(tfp, "LYNX_SIG_FILE set to '%s'\n", LynxSigFile); - } else { - CTRACE(tfp, "LYNX_SIG_FILE '%s' is bad. Ignoring.\n", LYNX_SIG_FILE); - } - return 0; -} + case 'F': + if (!strncasecomp(buffer, "finger_proxy:", 13)) { + if (getenv("finger_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "finger_proxy"); + Define_VMSLogical(temp, (char *)&buffer[13]); +#else + strcpy(temp, "finger_proxy="); + StrAllocCopy(finger_proxy_putenv_cmd, temp); + StrAllocCat(finger_proxy_putenv_cmd, (char *)&buffer[13]); + putenv(finger_proxy_putenv_cmd); +#endif /* VMS */ + } -static int news_chunk_size_fun ARGS1( - char *, value) -{ - HTNewsChunkSize = atoi(value); - /* - * If the new HTNewsChunkSize exceeds the maximum, - * increase HTNewsMaxChunk to this size. - FM - */ - if (HTNewsChunkSize > HTNewsMaxChunk) - HTNewsMaxChunk = HTNewsChunkSize; - return 0; -} + } else if (!strncasecomp(buffer, "FORCE_SSL_COOKIES_SECURE:", 25)) { + LYForceSSLCookiesSecure = is_true(buffer+25); -static int news_max_chunk_fun ARGS1( - char *, value) -{ - HTNewsMaxChunk = atoi(value); - /* - * If HTNewsChunkSize exceeds the new maximum, - * reduce HTNewsChunkSize to this maximum. - FM - */ - if (HTNewsChunkSize > HTNewsMaxChunk) - HTNewsChunkSize = HTNewsMaxChunk; - return 0; -} + } else if (!strncasecomp(buffer, "ftp_proxy:", 10)) { + if (getenv("ftp_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "ftp_proxy"); + Define_VMSLogical(temp, (char *)&buffer[10]); +#else + strcpy(temp, "ftp_proxy="); + StrAllocCopy(ftp_proxy_putenv_cmd, temp); + StrAllocCat(ftp_proxy_putenv_cmd, (char *)&buffer[10]); + putenv(ftp_proxy_putenv_cmd); +#endif /* VMS */ + } + } + break; -static int news_posting_fun ARGS1( - char *, value) -{ - LYNewsPosting = is_true(value); - no_newspost = (LYNewsPosting == FALSE); - return 0; -} + case 'G': + if (!strncasecomp(buffer, "GLOBAL_EXTENSION_MAP:", 21)) { + StrAllocCopy(global_extension_map, buffer+21); -static int printer_fun ARGS1( - char *, value) -{ - add_printer_to_list(value, &printers); - return 0; -} + } else if (!strncasecomp(buffer, "GLOBAL_MAILCAP:", 15)) { + StrAllocCopy(global_type_map, buffer+15); -static int suffix_fun ARGS1( - char *, value) -{ - char *mime_type; + } else if (!strncasecomp(buffer, "gopher_proxy:", 13)) { + if (getenv("gopher_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "gopher_proxy"); + Define_VMSLogical(temp, (char *)&buffer[13]); +#else + strcpy(temp, "gopher_proxy="); + StrAllocCopy(gopher_proxy_putenv_cmd, temp); + StrAllocCat(gopher_proxy_putenv_cmd, (char *)&buffer[13]); + putenv(gopher_proxy_putenv_cmd); +#endif /* VMS */ + } - if ((strlen (value) < 3) - || (NULL == (mime_type = strchr (value, ':')))) - return 0; + } else if (!strncasecomp(buffer, "GOTOBUFFER:", 11)) { + goto_buffer = is_true(buffer+11); + } + break; - *mime_type++ = '\0'; + case 'H': + if (!strncasecomp(buffer, "HELPFILE:", 9)) { + StrAllocCopy(helpfile, buffer+9); - LYRemoveBlanks(mime_type); - LYLowerCase(mime_type); + } else if (!strncasecomp(buffer, "HISTORICAL_COMMENTS:", 20)) { + historical_comments = is_true(buffer+20); - if (strstr(mime_type, "tex") != NULL || - strstr(mime_type, "postscript") != NULL || - strstr(mime_type, "sh") != NULL || - strstr(mime_type, "troff") != NULL || - strstr(mime_type, "rtf") != NULL) - HTSetSuffix(value, mime_type, "8bit", 1.0); - else - HTSetSuffix(value, mime_type, "binary", 1.0); + } else if (!strncasecomp(buffer, "http_proxy:", 11)) { + if (getenv("http_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "http_proxy"); + Define_VMSLogical(temp, (char *)&buffer[11]); +#else + strcpy(temp, "http_proxy="); + StrAllocCopy(http_proxy_putenv_cmd, temp); + StrAllocCat(http_proxy_putenv_cmd, (char *)&buffer[11]); + putenv(http_proxy_putenv_cmd); +#endif /* VMS */ + } - return 0; -} + } else if (!strncasecomp(buffer, "https_proxy:", 12)) { + if (getenv("https_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "https_proxy"); + Define_VMSLogical(temp, (char *)&buffer[12]); +#else + strcpy(temp, "https_proxy="); + StrAllocCopy(https_proxy_putenv_cmd, temp); + StrAllocCat(https_proxy_putenv_cmd, (char *)&buffer[12]); + putenv(https_proxy_putenv_cmd); +#endif /* VMS */ + } + } + break; + + case 'I': + if (!strncasecomp(buffer, "include:", 8)) { + strcpy(temp, buffer+8); + read_cfg(temp, cfg_filename, nesting_level + 1); + } else if (!strncasecomp(buffer, "INFOSECS:", 9)) { + strcpy(temp, buffer+9); + for (i = 0; temp[i]; i++) { + if (!isdigit(temp[i])) { + temp[i] = '\0'; + break; + } + } + if (temp[0]) + InfoSecs = atoi(temp); + } + break; -static int system_editor_fun ARGS1( - char *, value) -{ - StrAllocCopy(editor, value); - system_editor = TRUE; - return 0; -} + case 'J': + if (!strncasecomp(buffer, "JUMP_PROMPT:", 12)) { + StrAllocCopy(jumpprompt, buffer+12); -static int viewer_fun ARGS1( - char *, value) -{ - char *mime_type; - char *viewer; - char *environment; + } else if (!strncasecomp(buffer, "JUMPBUFFER:", 11)) { + jump_buffer = is_true(buffer+11); - mime_type = value; + } else if (!strncasecomp(buffer, "JUMPFILE:", 9)) { + if (!LYJumpInit(buffer)) { + if (TRACE) + fprintf(stderr, "Failed to register %s\n", buffer); + } + } + break; + + case 'K': + if (!strncasecomp(buffer, "KEYMAP:", 7)) { + char *key; + char *func; + + key = buffer + 7; + if ((func = strchr(key, ':')) != NULL) { + *func++ = '\0'; + /* Allow comments on the ends of key remapping lines. - DT */ + if (!remap(key, strtok(func, " \t\n#"))) + fprintf(stderr, + "key remapping of %s to %s failed\n",key,func); + else if (!strcmp("TOGGLE_HELP", strtok(func, " \t\n#"))) + LYUseNoviceLineTwo = FALSE; + } + } + break; - if ((strlen (value) < 3) - || (NULL == (viewer = strchr (mime_type, ':')))) - return 0; + case 'L': + if (!strncasecomp(buffer, "LIST_NEWS_NUMBERS:", 18)) { + LYListNewsNumbers = is_true(buffer+18); - *viewer++ = '\0'; + } else if (!strncasecomp(buffer, "LIST_NEWS_DATES:", 16)) { + LYListNewsDates = is_true(buffer+16); - LYRemoveBlanks(mime_type); - LYLowerCase(mime_type); +#ifndef VMS + } else if (!strncasecomp(buffer, "LIST_FORMAT:", 12)) { + StrAllocCopy(list_format, buffer+12); +#endif /* !VMS */ - environment = strrchr(viewer, ':'); - if ((environment != NULL) && - (strlen(viewer) > 1) && *(environment-1) != '\\') { - *environment++ = '\0'; - remove_backslashes(viewer); - /* - * If environment equals xwindows then only assign the presentation if - * there is a $DISPLAY variable. - */ - if (!strcasecomp(environment,"XWINDOWS")) { - if (LYgetXDisplay() != NULL) - HTSetPresentation(mime_type, viewer, 1.0, 3.0, 0.0, 0); - } else if (!strcasecomp(environment,"NON_XWINDOWS")) { - if (LYgetXDisplay() == NULL) - HTSetPresentation(mime_type, viewer, 1.0, 3.0, 0.0, 0); - } else { - HTSetPresentation(mime_type, viewer, 1.0, 3.0, 0.0, 0); - } - } else { - remove_backslashes(viewer); - HTSetPresentation(mime_type, viewer, 1.0, 3.0, 0.0, 0); - } + } else if (!strncasecomp(buffer, "LOCALHOST_ALIAS:", 16)) { + LYAddLocalhostAlias(buffer+16); - return 0; -} + } else if (!strncasecomp(buffer, "LOCAL_DOMAIN:", 13)) { + StrAllocCopy(LYLocalDomain, buffer+13); -/* This table should be sorted alphabetically */ -static Config_Type Config_Table [] = -{ - PARSE_SET("accept_all_cookies", CONF_BOOL, LYAcceptAllCookies), - PARSE_INT("alertsecs", CONF_INT, AlertSecs), - PARSE_SET("always_resubmit_posts", CONF_BOOL, LYresubmit_posts), -#ifdef EXEC_LINKS - PARSE_DEF("always_trusted_exec", CONF_ADD_TRUSTED, ALWAYS_EXEC_PATH), -#endif - PARSE_FUN("assume_charset", CONF_FUN, assume_charset_fun), - PARSE_FUN("assume_local_charset", CONF_FUN, assume_local_charset_fun), - PARSE_FUN("assume_unrec_charset", CONF_FUN, assume_unrec_charset_fun), - PARSE_SET("block_multi_bookmarks", CONF_BOOL, LYMBMBlocked), - PARSE_SET("bold_h1", CONF_BOOL, bold_H1), - PARSE_SET("bold_headers", CONF_BOOL, bold_headers), - PARSE_SET("bold_name_anchors", CONF_BOOL, bold_name_anchors), - PARSE_SET("case_sensitive_always_on", CONF_BOOL, case_sensitive), - PARSE_FUN("character_set", CONF_FUN, character_set_fun), - PARSE_SET("checkmail", CONF_BOOL, check_mail), - PARSE_SET("collapse_br_tags", CONF_BOOL, LYCollapseBRs), -#ifdef USE_COLOR_TABLE - PARSE_FUN("color", CONF_FUN, color_fun), -#endif - PARSE_STR("cookie_accept_domains", CONF_STR, LYCookieAcceptDomains), -#ifdef EXP_PERSISTENT_COOKIES - PARSE_STR("cookie_file", CONF_STR, LYCookieFile), -#endif /* EXP_PERSISTENT_COOKIES */ - PARSE_STR("cookie_reject_domains", CONF_STR, LYCookieRejectDomains), - PARSE_ENV("cso_proxy", CONF_ENV, 0 ), -#ifdef VMS - PARSE_STR("CSWING_PATH", CONF_STR, LYCSwingPath), -#endif - PARSE_FUN("default_bookmark_file", CONF_FUN, default_bookmark_file_fun), - PARSE_FUN("default_cache_size", CONF_FUN, default_cache_size_fun), - PARSE_FUN("default_editor", CONF_FUN, default_editor_fun), - PARSE_STR("default_index_file", CONF_STR, indexfile), - PARSE_FUN("default_keypad_mode_is_numbers_as_arrows", CONF_FUN, numbers_as_arrows_fun), - PARSE_FUN("default_user_mode", CONF_FUN, default_user_mode_fun), -#if defined(VMS) && defined(VAXC) && !defined(__DECC) - PARSE_INT("default_virtual_memory_size", CONF_INT, HTVirtualMemorySize), -#endif -#ifdef DIRED_SUPPORT - PARSE_FUN("dired_menu", CONF_FUN, dired_menu_fun), -#endif - PARSE_ADD("downloader", CONF_ADD_ITEM, downloaders), - PARSE_SET("emacs_keys_always_on", CONF_BOOL, emacs_keys), - PARSE_SET("enable_scrollback", CONF_BOOL, enable_scrollback), -#ifdef USE_EXTERNALS - PARSE_ADD("external", CONF_ADD_ITEM, externals), -#endif - PARSE_ENV("finger_proxy", CONF_ENV, 0 ), - PARSE_SET("force_8bit_toupper", CONF_BOOL, UCForce8bitTOUPPER), - PARSE_SET("force_ssl_cookies_secure", CONF_BOOL, LYForceSSLCookiesSecure), -#if !defined(NO_OPTION_FORMS) && !defined(NO_OPTION_MENU) - PARSE_SET("forms_options", CONF_BOOL, LYUseFormsOptions), -#endif - PARSE_ENV("ftp_proxy", CONF_ENV, 0 ), - PARSE_STR("global_extension_map", CONF_STR, global_extension_map), - PARSE_STR("global_mailcap", CONF_STR, global_type_map), - PARSE_ENV("gopher_proxy", CONF_ENV, 0 ), - PARSE_SET("gotobuffer", CONF_BOOL, goto_buffer), - PARSE_STR("helpfile", CONF_STR, helpfile), - PARSE_SET("historical_comments", CONF_BOOL, historical_comments), - PARSE_ENV("http_proxy", CONF_ENV, 0 ), - PARSE_ENV("https_proxy", CONF_ENV, 0 ), - PARSE_FUN("include", CONF_INCLUDE, 0), - PARSE_INT("infosecs", CONF_INT, InfoSecs), - PARSE_STR("jump_prompt", CONF_STR, jumpprompt), - PARSE_SET("jumpbuffer", CONF_BOOL, jump_buffer), - PARSE_FUN("jumpfile", CONF_FUN, jumpfile_fun), - PARSE_FUN("keymap", CONF_FUN, keymap_fun), - PARSE_SET("list_news_numbers", CONF_BOOL, LYListNewsNumbers), - PARSE_SET("list_news_dates", CONF_BOOL, LYListNewsDates), -#ifndef VMS - PARSE_STR("list_format", CONF_STR, list_format), -#endif - PARSE_FUN("localhost_alias", CONF_FUN, localhost_alias_fun), - PARSE_STR("local_domain", CONF_STR, LYLocalDomain), #if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) - PARSE_SET("local_execution_links_always_on", CONF_BOOL, local_exec), - PARSE_SET("local_execution_links_on_but_not_remote", CONF_BOOL, local_exec_on_local_files), -#endif + } else if (!strncasecomp(buffer, + "LOCAL_EXECUTION_LINKS_ALWAYS_ON:", 32)) { + local_exec = is_true(buffer+32); + + } else if (!strncasecomp(buffer, + "LOCAL_EXECUTION_LINKS_ON_BUT_NOT_REMOTE:", 40)) { + local_exec_on_local_files = is_true(buffer+40); +#endif /* defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) */ + #ifdef LYNXCGI_LINKS - PARSE_FUN("lynxcgi_environment", CONF_FUN, lynxcgi_environment_fun), -#ifndef VMS - PARSE_STR("lynxcgi_document_root", CONF_STR, LYCgiDocumentRoot), -#endif -#endif - PARSE_STR("lynx_host_name", CONF_STR, LYHostName), - PARSE_FUN("lynx_sig_file", CONF_FUN, lynx_sig_file_fun), - PARSE_SET("mail_system_error_logging", CONF_BOOL, error_logging), -#ifdef VMS - PARSE_STR("mail_adrs", CONF_STR, mail_adrs), -#endif - PARSE_SET("make_links_for_all_images", CONF_BOOL, clickable_images), - PARSE_SET("make_pseudo_alts_for_inlines", CONF_BOOL, pseudo_inline_alts), - PARSE_INT("messagesecs", CONF_INT, MessageSecs), - PARSE_SET("minimal_comments", CONF_BOOL, minimal_comments), - PARSE_INT("multi_bookmark_support", CONF_BOOL, LYMultiBookmarks), - PARSE_SET("ncr_in_bookmarks", CONF_BOOL, UCSaveBookmarksInUnicode), - PARSE_FUN("news_chunk_size", CONF_FUN, news_chunk_size_fun), - PARSE_FUN("news_max_chunk", CONF_FUN, news_max_chunk_fun), - PARSE_FUN("news_posting", CONF_FUN, news_posting_fun), - PARSE_ENV("news_proxy", CONF_ENV, 0), - PARSE_ENV("newspost_proxy", CONF_ENV, 0), - PARSE_ENV("newsreply_proxy", CONF_ENV, 0), - PARSE_ENV("nntp_proxy", CONF_ENV, 0), - PARSE_ENV("nntpserver", CONF_ENV2, 0), /* actually NNTPSERVER */ - PARSE_SET("no_dot_files", CONF_BOOL, no_dotfiles), - PARSE_SET("no_file_referer", CONF_BOOL, no_filereferer), + } else if (!strncasecomp(buffer, "LYNXCGI_ENVIRONMENT:", 20)) { + add_lynxcgi_environment(buffer+20); + #ifndef VMS - PARSE_SET("no_forced_core_dump", CONF_BOOL, LYNoCore), -#endif - PARSE_SET("no_from_header", CONF_BOOL, LYNoFromHeader), - PARSE_SET("no_ismap_if_usemap", CONF_BOOL, LYNoISMAPifUSEMAP), - PARSE_ENV("no_proxy", CONF_ENV, 0 ), - PARSE_SET("no_referer_header", CONF_BOOL, LYNoRefererHeader), - PARSE_FUN("outgoing_mail_charset", CONF_FUN, outgoing_mail_charset_fun), -#ifdef DISP_PARTIAL - PARSE_SET("partial", CONF_BOOL, display_partial), - PARSE_INT("partial_thres", CONF_INT, partial_threshold), -#endif -#ifdef EXP_PERSISTENT_COOKIES - PARSE_SET("persistent_cookies", CONF_BOOL, persistent_cookies), -#endif /* EXP_PERSISTENT_COOKIES */ - PARSE_STR("personal_mailcap", CONF_STR, personal_type_map), - PARSE_STR("personal_extension_map", CONF_STR, personal_extension_map), - PARSE_STR("preferred_charset", CONF_STR, pref_charset), - PARSE_STR("preferred_language", CONF_STR, language), - PARSE_SET("prepend_base_to_source", CONF_BOOL, LYPrependBaseToSource), - PARSE_SET("prepend_charset_to_source", CONF_BOOL, LYPrependCharsetToSource), - PARSE_FUN("printer", CONF_FUN, printer_fun), - PARSE_SET("quit_default_yes", CONF_BOOL, LYQuitDefaultYes), - PARSE_STR("save_space", CONF_STR, lynx_save_space), - PARSE_SET("scan_for_buried_news_refs", CONF_BOOL, scan_for_buried_news_references), - PARSE_SET("seek_frag_area_in_cur", CONF_BOOL, LYSeekFragAREAinCur), - PARSE_SET("seek_frag_map_in_cur", CONF_BOOL, LYSeekFragMAPinCur), - PARSE_SET("set_cookies", CONF_BOOL, LYSetCookies), - PARSE_SET("show_cursor", CONF_BOOL, LYShowCursor), - PARSE_SET("show_kb_rate", CONF_BOOL, LYshow_kb_rate), - PARSE_ENV("snews_proxy", CONF_ENV, 0 ), - PARSE_ENV("snewspost_proxy", CONF_ENV, 0 ), - PARSE_ENV("snewsreply_proxy", CONF_ENV, 0 ), - PARSE_SET("soft_dquotes", CONF_BOOL, soft_dquotes), - PARSE_STR("startfile", CONF_STR, startfile), - PARSE_SET("strip_dotdot_urls", CONF_BOOL, LYStripDotDotURLs), - PARSE_SET("substitute_underscores", CONF_BOOL, use_underscore), - PARSE_FUN("suffix", CONF_FUN, suffix_fun), - PARSE_FUN("system_editor", CONF_FUN, system_editor_fun), - PARSE_STR("system_mail", CONF_STR, system_mail), - PARSE_STR("system_mail_flags", CONF_STR, system_mail_flags), - PARSE_SET("tagsoup", CONF_BOOL, New_DTD), -#ifdef EXEC_LINKS - PARSE_DEF("trusted_exec", CONF_ADD_TRUSTED, EXEC_PATH), -#endif -#ifdef LYNXCGI_LINKS - PARSE_DEF("trusted_lynxcgi", CONF_ADD_TRUSTED, CGI_PATH), -#endif - PARSE_STR("url_domain_prefixes", CONF_STR, URLDomainPrefixes), - PARSE_STR("url_domain_suffixes", CONF_STR, URLDomainSuffixes), -#ifdef DIRED_SUPPORT - PARSE_ADD("uploader", CONF_ADD_ITEM, uploaders), -#endif + /* WebSter Mods - Next 2 Lines -jkt */ + } else if (!strncasecomp(buffer, "LYNXCGI_DOCUMENT_ROOT:", 22)) { + StrAllocCopy(LYCgiDocumentRoot, buffer+22); +#endif /* !VMS */ +#endif /* LYNXCGI_LINKS */ + + } else if (!strncasecomp(buffer, "LYNX_HOST_NAME:", 15)) { + StrAllocCopy(LYHostName, buffer+15); + + } else if (!strncasecomp(buffer, "LYNX_SIG_FILE:", 14)) { + strcpy(temp, (buffer+14)); + if (LYPathOffHomeOK(temp, 256)) { + StrAllocCopy(LynxSigFile, temp); + LYAddPathToHome(temp, 256, LynxSigFile); + StrAllocCopy(LynxSigFile, temp); + if (TRACE) + fprintf(stderr, + "LYNX_SIG_FILE set to '%s'\n", LynxSigFile); + } else { + if (TRACE) + fprintf(stderr, "LYNX_SIG_FILE '%s' is bad. Ignoring.\n", + LYNX_SIG_FILE); + } + } + break; + + case 'M': + if (!strncasecomp(buffer, "MAIL_SYSTEM_ERROR_LOGGING:", 26)) { + error_logging = is_true(buffer+26); + #ifdef VMS - PARSE_SET("use_fixed_records", CONF_BOOL, UseFixedRecords), -#endif -#if defined(NCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE) - PARSE_SET("use_mouse", CONF_BOOL, LYUseMouse), -#endif - PARSE_SET("use_select_popups", CONF_BOOL, LYSelectPopups), - PARSE_SET("verbose_images", CONF_BOOL, verbose_img), - PARSE_SET("vi_keys_always_on", CONF_BOOL, vi_keys), - PARSE_FUN("viewer", CONF_FUN, viewer_fun), - PARSE_ENV("wais_proxy", CONF_ENV, 0 ), - PARSE_STR("xloadimage_command", CONF_STR, XLoadImageCommand), - - {0} -}; + } else if (!strncasecomp(buffer, "MAIL_ADRS:", 10)) { + StrAllocCopy(mail_adrs, buffer+10); +#endif /* VMS */ + + } else if (!strncasecomp(buffer, "MAKE_LINKS_FOR_ALL_IMAGES:", 26)) { + clickable_images = is_true(buffer+26); + + } else if (!strncasecomp(buffer, + "MAKE_PSEUDO_ALTS_FOR_INLINES:", 29)) { + pseudo_inline_alts = is_true(buffer+29); + + } else if (!strncasecomp(buffer, "MESSAGESECS:", 12)) { + strcpy(temp, buffer+12); + for (i = 0; temp[i]; i++) { + if (!isdigit(temp[i])) { + temp[i] = '\0'; + break; + } + } + if (temp[0]) + MessageSecs = atoi(temp); -/* - * Free memory allocated in 'read_cfg()' - */ -PUBLIC void free_lynx_cfg NOARGS -{ - Config_Type *tbl; + } else if (!strncasecomp(buffer, "MINIMAL_COMMENTS:", 17)) { + minimal_comments = is_true(buffer+17); + + } else if (!strncasecomp(buffer, "MULTI_BOOKMARK_SUPPORT:", 23)) { + LYMultiBookmarks = is_true(buffer+23); + } + break; + + case 'N': + if (!strncasecomp(buffer, "NEWS_CHUNK_SIZE:", 16)) { + HTNewsChunkSize = atoi(buffer+16); + /* + * If the new HTNewsChunkSize exceeds the maximum, + * increase HTNewsMaxChunk to this size. - FM + */ + if (HTNewsChunkSize > HTNewsMaxChunk) { + HTNewsMaxChunk = HTNewsChunkSize; + } - for (tbl = Config_Table; tbl->name != 0; tbl++) { -#ifdef PARSE_DEBUG - Config_Type *q = tbl; + } else if (!strncasecomp(buffer, "NEWS_MAX_CHUNK:", 15)) { + HTNewsMaxChunk = atoi(buffer+15); + /* + * If HTNewsChunkSize exceeds the new maximum, + * reduce HTNewsChunkSize to this maximum. - FM + */ + if (HTNewsChunkSize > HTNewsMaxChunk) { + HTNewsChunkSize = HTNewsMaxChunk; + } + + } else if (!strncasecomp(buffer, "NEWS_POSTING:", 13)) { + LYNewsPosting = is_true(buffer+13); + no_newspost = (LYNewsPosting == FALSE); + + } else if (!strncasecomp(buffer, "news_proxy:", 11)) { + if (getenv("news_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "news_proxy"); + Define_VMSLogical(temp, (char *)&buffer[11]); #else - ConfigUnion *q = (ConfigUnion *)(&(tbl->value)); -#endif - switch (tbl->type) { - case CONF_ENV: - if (q->str_value != 0) { - FREE(*(q->str_value)); - free((char *)q->str_value); + strcpy(temp, "news_proxy="); + StrAllocCopy(news_proxy_putenv_cmd, temp); + StrAllocCat(news_proxy_putenv_cmd, (char *)&buffer[11]); + putenv(news_proxy_putenv_cmd); +#endif /* VMS */ } - break; - default: - break; - } - } -} -/* - * Process the configuration file (lynx.cfg). - */ -PUBLIC void read_cfg ARGS4( - char *, cfg_filename, - char *, parent_filename, - int, nesting_level, - FILE *, fp0) -{ - FILE *fp; - char mypath[LY_MAXPATH]; - char buffer[MAX_LINE_BUFFER_LEN]; + } else if (!strncasecomp(buffer, "newspost_proxy:", 15)) { + if (getenv("newspost_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "newspost_proxy"); + Define_VMSLogical(temp, (char *)&buffer[15]); +#else + strcpy(temp, "newspost_proxy="); + StrAllocCopy(newspost_proxy_putenv_cmd, temp); + StrAllocCat(newspost_proxy_putenv_cmd, (char *)&buffer[15]); + putenv(newspost_proxy_putenv_cmd); +#endif /* VMS */ + } - CTRACE(tfp, "Loading cfg file '%s'.\n", cfg_filename); + } else if (!strncasecomp(buffer, "newsreply_proxy:", 16)) { + if (getenv("newsreply_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "newsreply_proxy"); + Define_VMSLogical(temp, (char *)&buffer[16]); +#else + strcpy(temp, "newsreply_proxy="); + StrAllocCopy(newsreply_proxy_putenv_cmd, temp); + StrAllocCat(newsreply_proxy_putenv_cmd, (char *)&buffer[16]); + putenv(newsreply_proxy_putenv_cmd); +#endif /* VMS */ + } - /* - * Don't get hung up by an include file loop. Arbitrary max depth - * of 10. - BL - */ - if (nesting_level > 10) { - fprintf(stderr, - "More than %d nested lynx.cfg includes -- perhaps there is a loop?!?\n", - nesting_level - 1); - fprintf(stderr,"Last attempted include was '%s',\n", cfg_filename); - fprintf(stderr,"included from '%s'.\n", parent_filename); - exit(-1); - } - /* - * Locate and open the file. - */ - if (!cfg_filename || strlen(cfg_filename) == 0) { - CTRACE(tfp,"No filename following -cfg switch!\n"); - return; - } - if (!strncmp(cfg_filename, "~/", 2)) { - strcpy(mypath, Home_Dir()); - strcat(mypath, cfg_filename+1); - cfg_filename = mypath; - } - if ((fp = fopen(cfg_filename,"r")) == 0) { - CTRACE(tfp,"lynx.cfg file not found as %s\n",cfg_filename); - return; - } - have_read_cfg = TRUE; + } else if (!strncasecomp(buffer, "nntp_proxy:", 11)) { + if (getenv("nntp_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "nntp_proxy"); + Define_VMSLogical(temp, (char *)&buffer[11]); +#else + strcpy(temp, "nntp_proxy="); + StrAllocCopy(nntp_proxy_putenv_cmd, temp); + StrAllocCat(nntp_proxy_putenv_cmd, (char *)&buffer[11]); + putenv(nntp_proxy_putenv_cmd); +#endif /* VMS */ + } - /* - * Process each line in the file. - */ - while (fgets(buffer, sizeof(buffer), fp) != 0) { - char *name, *value; - char *cp; - Config_Type *tbl; - char ch; -#ifdef PARSE_DEBUG - Config_Type *q; + } else if (!strncasecomp(buffer, "NNTPSERVER:", 11)) { + if (getenv("NNTPSERVER") == NULL) { +#ifdef VMS + strcpy(temp, "NNTPSERVER"); + Define_VMSLogical(temp, (char *)&buffer[11]); #else - ConfigUnion *q; -#endif + strcpy(temp, "NNTPSERVER="); + StrAllocCopy(NNTPSERVER_putenv_cmd, temp); + StrAllocCat(NNTPSERVER_putenv_cmd, (char *)&buffer[11]); + putenv(NNTPSERVER_putenv_cmd); +#endif /* VMS */ + } - /* Most lines in the config file are comment lines. Weed them out - * now. Also, leading whitespace is ok, so trim it. - */ - name = LYSkipBlanks(buffer); + } else if (!strncasecomp(buffer, "NO_DOT_FILES:", 13)) { + no_dotfiles = is_true(buffer+13); - if (*name == '#') - continue; + } else if (!strncasecomp(buffer, "NO_FILE_REFERER:", 16)) { + no_filereferer = is_true(buffer+16); - LYTrimTrailing(name); +#ifndef VMS + } else if (!strncasecomp(buffer, "NO_FORCED_CORE_DUMP:", 20)) { + LYNoCore = is_true(buffer+20); +#endif /* !VMS */ - if (*name == 0) continue; + } else if (!strncasecomp(buffer, "NO_FROM_HEADER:", 15)) { + LYNoFromHeader = is_true(buffer+15); - /* Significant lines are of the form KEYWORD:WHATEVER */ - if ((value = strchr (name, ':')) == 0) { - /* fprintf (stderr, "Bad line-- no :\n"); */ - continue; - } + } else if (!strncasecomp(buffer, "NO_ISMAP_IF_USEMAP:", 19)) { + LYNoISMAPifUSEMAP = is_true(buffer+19); - /* skip past colon, but replace ':' with 0 to make name meaningful */ - *value++ = 0; + } else if (!strncasecomp(buffer, "no_proxy:", 9)) { + if (getenv("no_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "no_proxy"); + Define_VMSLogical(temp, (char *)&buffer[9]); +#else + strcpy(temp, "no_proxy="); + StrAllocCopy(no_proxy_putenv_cmd, temp); + StrAllocCat(no_proxy_putenv_cmd, (char *)&buffer[9]); + putenv(no_proxy_putenv_cmd); +#endif /* VMS */ + } - /* - * Trim off any trailing comments. - * - * (Apparently, the original code considers a trailing comment - * valid only if preceded by a space character but is not followed - * by a colon. -- JED) - */ - if ((cp = strrchr (value, ':')) == 0) - cp = value; - if ((cp = strchr (cp, '#')) != 0) { - cp--; - if (isspace ((unsigned char) *cp)) - *cp = 0; + } else if (!strncasecomp(buffer, "NO_REFERER_HEADER:", 18)) { + LYNoRefererHeader = is_true(buffer+18); } + break; - tbl = Config_Table; - ch = TOUPPER(*name); - while (tbl->name != 0) { - char ch1 = tbl->name[0]; + case 'P': + if (!strncasecomp(buffer, "PERSONAL_MAILCAP:", 17)) { + StrAllocCopy(personal_type_map, buffer+17); - if ((ch == TOUPPER(ch1)) - && (0 == strcasecomp (name, tbl->name))) - break; + } else if (!strncasecomp(buffer, "PERSONAL_EXTENSION_MAP:", 23)) { + StrAllocCopy(personal_extension_map, buffer+23); + + } else if (!strncasecomp(buffer, "PREFERRED_CHARSET:", 18)) { + StrAllocCopy(pref_charset, buffer+18); + + } else if (!strncasecomp(buffer, "PREFERRED_LANGUAGE:", 19)) { + StrAllocCopy(language, buffer+19); + + } else if (!strncasecomp(buffer, "PREPEND_BASE_TO_SOURCE:", 23)) { + LYPrependBaseToSource = is_true(buffer+23); - tbl++; + } else if (!strncasecomp(buffer, "PREPEND_CHARSET_TO_SOURCE:", 26)) { + LYPrependCharsetToSource = is_true(buffer+26); + + } else if (!strncasecomp(buffer, "PRINTER:", 8)) { + add_printer_to_list(&buffer[8], &printers); } + break; - if (tbl->name == 0) { - /* Apparently, lynx ignores unknown keywords */ - /* fprintf (stderr, "%s not found in config file */ - continue; +#ifdef RAWDOSKEYHACK + case 'R': + if (!strncasecomp(buffer, "RAW_DOS_KEY_HACK:", 17)) { + raw_dos_key_hack = is_true(buffer+17); } + break; +#endif /* RAWDOSKEYHACK */ -#ifdef PARSE_DEBUG - q = tbl; -#else - q = (ConfigUnion *)(&(tbl->value)); -#endif - switch ((fp0 != 0 && tbl->type != CONF_INCLUDE) - ? CONF_UNSPECIFIED - : tbl->type) { - case CONF_BOOL: - if (q->set_value != 0) - *(q->set_value) = is_true (value); - break; - - case CONF_FUN: - if (q->fun_value != 0) - (*(q->fun_value)) (value); - break; - - case CONF_INT: - if (q->int_value != 0) { - int ival; - /* Apparently, if an integer value is not present, then the - * value is not changed. So, use the sscanf function to make - * this determination. - */ - if (1 == sscanf (value, "%d", &ival)) - *(q->int_value) = ival; - } - break; + case 'Q': + if (!strncasecomp(buffer, "QUIT_DEFAULT_YES:", 17)) { + LYQuitDefaultYes = is_true(buffer+17); + } + break; - case CONF_STR: - if (q->str_value != 0) - StrAllocCopy(*(q->str_value), value); - break; + case 'S': + if (!strncasecomp(buffer, "SAVE_SPACE:", 11)) { + StrAllocCopy(lynx_save_space, buffer+11); - case CONF_ENV: - case CONF_ENV2: + } else if (!strncasecomp(buffer, "SCAN_FOR_BURIED_NEWS_REFS:", 26)) { + scan_for_buried_news_references = is_true(buffer+26); - if (tbl->type == CONF_ENV) - LYLowerCase(name); - else - LYUpperCase(name); + } else if (!strncasecomp(buffer, "SEEK_FRAG_AREA_IN_CUR:", 22)) { + LYSeekFragAREAinCur = is_true(buffer+22); + + } else if (!strncasecomp(buffer, "SEEK_FRAG_MAP_IN_CUR:", 21)) { + LYSeekFragMAPinCur = is_true(buffer+21); + + } else if (!strncasecomp(buffer, "SET_COOKIES:", 12)) { + LYSetCookies = is_true(buffer+12); + + } else if (!strncasecomp(buffer, "SHOW_CURSOR:", 12)) { + LYShowCursor = is_true(buffer+12); - if (getenv (name) == 0) { + } else if (!strncasecomp(buffer, "snews_proxy:", 12)) { + if (getenv("snews_proxy") == NULL) { #ifdef VMS - Define_VMSLogical(name, value); + strcpy(temp, "snews_proxy"); + Define_VMSLogical(temp, (char *)&buffer[12]); #else - char tmpbuf[MAX_LINE_BUFFER_LEN]; - sprintf (tmpbuf, "%s=%s", name, value); - if ((q->str_value = (char **)calloc(1, sizeof(char **))) != 0) { - StrAllocCopy(*(q->str_value), tmpbuf); - putenv (*(q->str_value)); + strcpy(temp, "snews_proxy="); + StrAllocCopy(snews_proxy_putenv_cmd, temp); + StrAllocCat(snews_proxy_putenv_cmd, (char *)&buffer[12]); + putenv(snews_proxy_putenv_cmd); +#endif /* VMS */ + } + + } else if (!strncasecomp(buffer, "snewspost_proxy:", 16)) { + if (getenv("snewspost_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "snewspost_proxy"); + Define_VMSLogical(temp, (char *)&buffer[16]); +#else + strcpy(temp, "snewspost_proxy="); + StrAllocCopy(snewspost_proxy_putenv_cmd, temp); + StrAllocCat(snewspost_proxy_putenv_cmd, (char *)&buffer[16]); + putenv(snewspost_proxy_putenv_cmd); +#endif /* VMS */ + } + + } else if (!strncasecomp(buffer, "snewsreply_proxy:", 17)) { + if (getenv("snewsreply_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "snewsreply_proxy"); + Define_VMSLogical(temp, (char *)&buffer[17]); +#else + strcpy(temp, "snewsreply_proxy="); + StrAllocCopy(snewsreply_proxy_putenv_cmd, temp); + StrAllocCat(snewsreply_proxy_putenv_cmd, (char *)&buffer[17]); + putenv(snewsreply_proxy_putenv_cmd); +#endif /* VMS */ + } + + } else if (!strncasecomp(buffer, "SOFT_DQUOTES:", 13)) { + soft_dquotes = is_true(buffer+13); + + } else if (!strncasecomp(buffer, "STARTFILE:", 10)) { + StrAllocCopy(startfile, buffer+10); + + } else if (!strncasecomp(buffer, "STRIP_DOTDOT_URLS:", 18)) { + LYStripDotDotURLs = is_true(buffer+18); + + } else if (!strncasecomp(buffer, "SUBSTITUTE_UNDERSCORES:", 23)) { + use_underscore = is_true(buffer+23); + + } else if (!strncasecomp(buffer, "SUFFIX:", 7)) { + char *extention; + char *mime_type; + + if (strlen(buffer) > 9) { + extention = buffer + 7; + if ((mime_type = strchr(extention, ':')) != NULL) { + *mime_type++ = '\0'; + for (i = 0, j = 0; mime_type[i]; i++) { + if (mime_type[i] != ' ') { + mime_type[j++] = TOLOWER(mime_type[i]); + } + } + mime_type[j] = '\0'; + if (strstr(mime_type, "tex") != NULL || + strstr(mime_type, "postscript") != NULL || + strstr(mime_type, "sh") != NULL || + strstr(mime_type, "troff") != NULL || + strstr(mime_type, "rtf") != NULL) + HTSetSuffix(extention, mime_type, "8bit", 1.0); + else + HTSetSuffix(extention, mime_type, "binary", 1.0); } + } + + } else if (!strncasecomp(buffer, "SYSTEM_EDITOR:", 14)) { + StrAllocCopy(editor, buffer+14); + system_editor = TRUE; + + } else if (!strncasecomp(buffer, "SYSTEM_MAIL:", 12)) { + StrAllocCopy(system_mail, buffer+12); + + } else if (!strncasecomp(buffer, "SYSTEM_MAIL_FLAGS:", 18)) { + StrAllocCopy(system_mail_flags, buffer+18); + } + break; + + case 'T': +#ifdef EXEC_LINKS + if (!strncasecomp(buffer, "TRUSTED_EXEC:", 13)) { + add_trusted(&buffer[13], EXEC_PATH); /* Add exec path */ + } +#endif /* EXEC_LINKS */ + +#ifdef LYNXCGI_LINKS + if (!strncasecomp(buffer, "TRUSTED_LYNXCGI:", 16)) { + add_trusted(&buffer[16], CGI_PATH); /* Add CGI path */ + } +#endif /* LYNXCGI_LINKS */ + break; + + case 'U': + if (!strncasecomp(buffer, "URL_DOMAIN_PREFIXES:", 20)) { + StrAllocCopy(URLDomainPrefixes, buffer+20); + + } else if (!strncasecomp(buffer, "URL_DOMAIN_SUFFIXES:", 20)) { + StrAllocCopy(URLDomainSuffixes, buffer+20); + +#ifdef DIRED_SUPPORT + } else if (!strncasecomp(buffer, "UPLOADER:", 9)) { + add_item_to_list(&buffer[9], &uploaders); +#endif /* DIRED_SUPPORT */ + +#ifdef VMS + } else if (!strncasecomp(buffer, "USE_FIXED_RECORDS:", 18)) { + UseFixedRecords = is_true(buffer+18); +#endif /* VMS */ + +#if defined(NCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE) + } else if(!strncasecomp(buffer, "USE_MOUSE:",10)) { + LYUseMouse = is_true(buffer+10); #endif + + } else if (!strncasecomp(buffer, "USE_SELECT_POPUPS:", 18)) { + LYSelectPopups = is_true(buffer+18); + } + break; + + case 'V': + if (!strncasecomp(buffer, "VERBOSE_IMAGES:", 15)) { + verbose_img = is_true(buffer+15); + + } else if (!strncasecomp(buffer, "VI_KEYS_ALWAYS_ON:", 18)) { + vi_keys = is_true(buffer+18); + + } else if (!strncasecomp(buffer, "VIEWER:", 7)) { + char *mime_type; + char *viewer; + char *environment; + + if (strlen(buffer) > 9) { + mime_type = buffer + 7; + if ((viewer = strchr(mime_type, ':')) != NULL) { + *viewer++ = '\0'; + for (i = 0, j = 0; mime_type[i]; i++) { + if (mime_type[i] != ' ') { + mime_type[j++] = TOLOWER(mime_type[i]); + } + } + mime_type[j] = '\0'; + environment = strrchr(viewer, ':'); + if ((environment != NULL) && + (strlen(viewer) > 1) && *(environment-1) != '\\') { + *environment++ = '\0'; + remove_backslashes(viewer); + /* + * If environment equals xwindows then only + * assign the presentation if there is a display + * variable. + */ + if (!strcasecomp(environment,"XWINDOWS")) { + if ((cp = getenv(DISPLAY)) != NULL && + *cp != '\0') + HTSetPresentation(mime_type, viewer, + 1.0, 3.0, 0.0, 0); + } else if (!strcasecomp(environment,"NON_XWINDOWS")) { + if ((cp = getenv(DISPLAY)) == NULL || + *cp == '\0') + HTSetPresentation(mime_type, viewer, + 1.0, 3.0, 0.0, 0); + } else { + HTSetPresentation(mime_type, viewer, + 1.0, 3.0, 0.0, 0); + } + } else { + remove_backslashes(viewer); + HTSetPresentation(mime_type, viewer, + 1.0, 3.0, 0.0, 0); + } + } } - break; - - case CONF_INCLUDE: - /* include another file */ -#ifndef NO_CONFIG_INFO - if (fp0 != 0) { - fprintf(fp0, "%s:%s\n\n", name, value); - fprintf(fp0, " #<begin %s>\n", value); + } + break; + + case 'W': + if (!strncasecomp(buffer, "wais_proxy:", 11)) { + if (getenv("wais_proxy") == NULL) { +#ifdef VMS + strcpy(temp, "wais_proxy"); + Define_VMSLogical(temp, (char *)&buffer[11]); +#else + strcpy(temp, "wais_proxy="); + StrAllocCopy(wais_proxy_putenv_cmd, temp); + StrAllocCat(wais_proxy_putenv_cmd, (char *)&buffer[11]); + putenv(wais_proxy_putenv_cmd); +#endif /* VMS */ } -#endif - read_cfg (value, cfg_filename, nesting_level + 1, fp0); -#ifndef NO_CONFIG_INFO - if (fp0 != 0) - fprintf(fp0, " #<end of %s>\n\n", value); -#endif - break; + } + break; - case CONF_ADD_ITEM: - if (q->add_value != 0) - add_item_to_list (value, q->add_value); - break; + case 'X': + if (!strncasecomp(buffer, "XLOADIMAGE_COMMAND:", 19)) { + StrAllocCopy(XLoadImageCommand, (char *)&buffer[19]); + } + break; -#if defined(EXEC_LINKS) || defined(LYNXCGI_LINKS) - case CONF_ADD_TRUSTED: - add_trusted (value, q->def_value); - break; -#endif default: - if (fp0 != 0) - fprintf(fp0, "%s:%s\n", name, value); - break; - } - } + break; - fclose (fp); + } /* end of Huge switch */ + } /* end of while */ + fclose(fp); /* * If any DOWNLOADER: commands have always_enabled set (:TRUE), @@ -1205,84 +1330,17 @@ PUBLIC void read_cfg ARGS4( * settings will not block presentation of a download menu * with those always_enabled options still available. - FM */ - if (downloaders != 0) { + if (downloaders != NULL) { + int count; lynx_html_item_type *cur_download; - cur_download = downloaders; - while (cur_download != 0) { + for (count = 0, cur_download = downloaders; + cur_download != NULL; + cur_download = cur_download->next, count++) { if (cur_download->always_enabled) { override_no_download = TRUE; break; } - cur_download = cur_download->next; } } - - /* - * If any COOKIE_{ACCEPT,REJECT}_DOMAINS have been defined, - * process them. These are comma delimited lists of - * domains. - BJP - */ - - if (LYCookieAcceptDomains != NULL) { - cookie_add_acceptlist(LYCookieAcceptDomains); - } - - if (LYCookieRejectDomains != NULL) { - cookie_add_rejectlist(LYCookieRejectDomains); - } -} - -/* - * lynx.cfg infopage, returns local url. - */ -PUBLIC char *lynx_cfg_infopage NOARGS -{ - static char *local_url; - char tempfile[LY_MAXPATH]; - char *temp = 0; - FILE *fp0; - - if (local_url == 0) { - if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) { - HTAlert(CANNOT_OPEN_TEMP); - return(0); - } - LYLocalFileToURL(&local_url, tempfile); - - LYforce_no_cache = TRUE; /* don't cache this doc */ - - BeginInternalPage (fp0, LYNXCFG_TITLE, NULL); - fprintf(fp0, "<pre>\n"); - -#ifndef NO_CONFIG_INFO - fprintf(fp0, "<em>This is read from your lynx.cfg file,\n"); -#if defined(HAVE_CONFIG_H) || defined(VMS) - StrAllocCopy(temp, LYNX_CFG_FILE); -#else - StrAllocCopy(temp, helpfilepath); /* no absolute path... */ - StrAllocCat(temp, LYNXCFG_HELP); /* for lynx.cfg on DOS/Win32 */ -#endif /* HAVE_CONFIG_H */ - fprintf(fp0, "please \"read\" distribution's <a href=\"%s\">lynx.cfg", - temp); - fprintf(fp0, "</a> for more comments.</em>\n\n"); - - fprintf(fp0, " #<em>Your primary configuration %s</em>\n", - lynx_cfg_file); -#else - fprintf(fp0, "<em>This is read from your lynx.cfg file:</em>\n\n"); -#endif /* NO_CONFIG_INFO */ - - /* - * Process the configuration file. - */ - read_cfg(lynx_cfg_file, "main program", 1, fp0); - - FREE(temp); - fprintf(fp0, "</pre>\n"); - EndInternalPage(fp0); - LYCloseTempFP(fp0); - } - - return(local_url); } diff --git a/src/LYReadCFG.h b/src/LYReadCFG.h index acbbd276..a6ed7c70 100644 --- a/src/LYReadCFG.h +++ b/src/LYReadCFG.h @@ -43,10 +43,7 @@ extern int default_bg; extern int check_color PARAMS((char * color, int the_default)); #endif -extern void read_cfg PARAMS((char *cfg_filename, char *parent_filename, int nesting_level, FILE *fp0)); -extern void free_lynx_cfg NOPARAMS; +extern void read_cfg PARAMS((char *cfg_filename, char *parent_filename, int nesting_level)); extern BOOLEAN have_read_cfg; -extern char *lynx_cfg_infopage NOPARAMS; - #endif /* LYREADCFG_H */ diff --git a/src/LYSearch.c b/src/LYSearch.c index dfd359c3..aed16225 100644 --- a/src/LYSearch.c +++ b/src/LYSearch.c @@ -1,5 +1,5 @@ #include <HTUtils.h> -#include <HTAlert.h> +#include <tcp.h> #include <LYUtils.h> #include <LYStrings.h> #include <LYSearch.h> @@ -9,6 +9,8 @@ #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + /* * Search for the target string inside of the links * that are currently displayed on the screen beginning @@ -215,7 +217,8 @@ PUBLIC BOOL textsearch ARGS3( * Restore prev_target and return. - FM */ strcpy(prev_target, prev_target_buffer); - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return(FALSE); } } @@ -229,7 +232,8 @@ check_recall: * previous search string will no longer occur, but it can * be used again via LYK_NEXT. - FM */ - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return(FALSE); } @@ -280,7 +284,8 @@ check_recall: * Restore prev_target and return. - FM */ strcpy(prev_target, prev_target_buffer); - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return(FALSE); } goto check_recall; @@ -332,7 +337,8 @@ check_recall: * Restore prev_target and return. - FM */ strcpy(prev_target, prev_target_buffer); - HTInfoMsg(CANCELLED); + _statusline(CANCELLED); + sleep(InfoSecs); return(FALSE); } goto check_recall; diff --git a/src/LYSearch.h b/src/LYSearch.h index a8a31973..cff7b806 100644 --- a/src/LYSearch.h +++ b/src/LYSearch.h @@ -3,7 +3,7 @@ #define LYSEARCH_H #ifndef LYSTRUCTS_H -#include <LYStructs.h> +#include "LYStructs.h" #endif /* LYSTRUCT_H */ extern BOOL textsearch PARAMS((document *cur_doc, diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index ec2002c9..65f06958 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -1,5 +1,5 @@ #include <HTUtils.h> -#include <HTFile.h> +#include <tcp.h> #include <HTParse.h> #include <HTAlert.h> #include <HTTP.h> @@ -12,7 +12,6 @@ #include <LYSignal.h> #include <LYCharUtils.h> #include <GridText.h> -#include <LYReadCFG.h> #include <LYLeaks.h> @@ -23,88 +22,57 @@ #include <LYLocal.h> #endif /* DIRED_SUPPORT */ -#if defined(HAVE_CONFIG_H) && !defined(NO_CONFIG_INFO) -#define HAVE_CFG_DEFS_H +#define FREE(x) if (x) {free(x); x = NULL;} -#define PutDefs(table, N) fprintf(fp0, "%-35s %s\n", table[N].name, table[N].value) - -/* - * Compile-time definitions info, returns local url - */ -PRIVATE char *lynx_compile_opts NOARGS -{ - char tempfile[LY_MAXPATH]; -#include <cfg_defs.h> - unsigned n; - static char *info_url; - FILE *fp0; - - if (info_url == 0) { - if ((fp0 = LYOpenTemp (tempfile, HTML_SUFFIX, "w")) == 0) { - HTAlert(CANNOT_OPEN_TEMP); - return(0); - } - LYLocalFileToURL(&info_url, tempfile); - - BeginInternalPage (fp0, CONFIG_DEF_TITLE, NULL); - fprintf(fp0, "<pre>\n"); - - fprintf(fp0, "See also <a href=\"%s\">your lynx.cfg</a> for run-time options\n\n", - lynx_cfg_infopage()); - - fprintf(fp0, "\n%s<br>\n<em>config.cache</em>\n", AUTOCONF_CONFIG_CACHE); - for (n = 0; n < TABLESIZE(config_cache); n++) { - PutDefs(config_cache, n); - } - fprintf(fp0, "\n%s<br>\n<em>lynx_cfg.h</em>\n", AUTOCONF_LYNXCFG_H); - for (n = 0; n < TABLESIZE(config_defines); n++) { - PutDefs(config_defines, n); - } - fprintf(fp0, "</pre>\n"); - EndInternalPage(fp0); - LYCloseTempFP(fp0); - } - return info_url; -} -#else -#undef HAVE_CFG_DEFS_H -#endif /* !NO_CONFIG_INFO */ - -/* +/* * Showinfo prints a page of info about the current file and the link * that the cursor is on. */ - + PUBLIC int showinfo ARGS4( document *, doc, int, size_of_file, document *, newdoc, - char *, owner_address) + char *, owner_address) { - static char tempfile[LY_MAXPATH]; - static char *info_url; + static char tempfile[256]; + static BOOLEAN first = TRUE; + static char info_url[256]; int url_type; FILE *fp0; char *Address = NULL, *Title = NULL; - CONST char *cp; + char *cp; #ifdef DIRED_SUPPORT - char temp[LY_MAXPATH]; + char temp[300]; struct stat dir_info; struct passwd *pw; struct group *grp; #endif /* DIRED_SUPPORT */ - - LYRemoveTemp(tempfile); - if ((fp0 = LYOpenTemp (tempfile, HTML_SUFFIX, "w")) == 0) { - HTAlert(CANNOT_OPEN_TEMP); - return(-1); + if (first) { + tempname(tempfile, NEW_FILE); + /* + * Make the temporary file a URL now. + */ +#if defined (VMS) || defined (DOSPATH) + sprintf(info_url, "file://localhost/%s", tempfile); +#else + sprintf(info_url, "file://localhost%s", tempfile); +#endif /* VMS */ + first = FALSE; +#ifdef VMS + } else { + remove(tempfile); /* Remove duplicates on VMS. */ +#endif /* VMS */ } - LYLocalFileToURL(&info_url, tempfile); + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { + HTAlert(CANNOT_OPEN_TEMP); + return(0); + } /* - * Point the address pointer at this Url + * Point the address pointer at this Url */ StrAllocCopy(newdoc->address, info_url); @@ -120,61 +88,49 @@ PUBLIC int showinfo ARGS4( } } - fprintf(fp0, "<html>\n<head>\n"); + fprintf(fp0, "<head>\n"); LYAddMETAcharsetToFD(fp0, -1); fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n", SHOWINFO_TITLE); - - fprintf(fp0, "<h1>%s %s (%.*s) (<a href=\"%s\">%s</a>)", - LYNX_NAME, LYNX_VERSION, - LYNX_DATE_LEN, - (LYNX_RELEASE ? LYNX_RELEASE_DATE : &LYNX_DATE[LYNX_DATE_OFF]), - (LYNX_RELEASE ? LYNX_WWW_HOME : LYNX_WWW_DIST), - (LYNX_RELEASE ? "latest release" : "development version") ); - - if (!LYRestricted) { -#ifdef HAVE_CFG_DEFS_H - fprintf(fp0, " - <a href=\"%s\">compile time settings</a>\n", - lynx_compile_opts()); -#else - fprintf(fp0, " - <a href=\"%s\">your lynx.cfg</a>\n", - lynx_cfg_infopage()); -#endif - } - fprintf(fp0, "</h1>\n"); /* don't forget to close <h1> */ - + fprintf(fp0,"<h1>You have reached the Information Page</h1>\n"); + fprintf(fp0,"<h2>%s Version %s</h2>\n", LYNX_NAME, LYNX_VERSION); #ifdef DIRED_SUPPORT if (lynx_edit_mode && nlinks > 0) { - char *s; - - fprintf(fp0, "<pre>\n"); - fprintf(fp0, "\nDirectory that you are currently viewing\n\n"); + fprintf(fp0, + "<h2>Directory that you are currently viewing</h2>\n<pre>"); - s = HTfullURL_toFile(doc->address); - strcpy(temp, s); - free(s); + cp = doc->address; + if (!strncmp(cp, "file://localhost", 16)) + cp += 16; + else if (!strncmp(cp, "file:", 5)) + cp += 5; + strcpy(temp, cp); + HTUnEscape(temp); fprintf(fp0," <em>Name:</em> %s\n", temp); fprintf(fp0," <em> URL:</em> %s\n", doc->address); - s = HTfullURL_toFile(links[doc->link].lname); - strcpy(temp, s); - free(s); - + cp = links[doc->link].lname; + if (!strncmp(cp, "file://localhost", 16)) + cp += 16; + else if (!strncmp(cp, "file:", 5)) + cp += 5; + strcpy(temp, cp); + HTUnEscape(temp); if (lstat(temp, &dir_info) == -1) { - CTRACE(tfp, "lstat(%s) failed, errno=%d\n", temp, errno); - HTAlert(CURRENT_LINK_STATUS_FAILED); + _statusline(CURRENT_LINK_STATUS_FAILED); + sleep(AlertSecs); } else { char modes[80]; - if (S_ISDIR(dir_info.st_mode)) { + if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) { fprintf(fp0, "\nDirectory that you have currently selected\n\n"); - } else if (S_ISREG(dir_info.st_mode)) { - fprintf(fp0, + } else if (((dir_info.st_mode) & S_IFMT) == S_IFREG) { + fprintf(fp0, "\nFile that you have currently selected\n\n"); #ifdef S_IFLNK - } else if (S_ISLNK(dir_info.st_mode)) { + } else if (((dir_info.st_mode) & S_IFMT) == S_IFLNK) { fprintf(fp0, "\nSymbolic link that you have currently selected\n\n"); #endif @@ -184,7 +140,7 @@ PUBLIC int showinfo ARGS4( } fprintf(fp0," <em>Full name:</em> %s\n", temp); #ifdef S_IFLNK - if (S_ISLNK(dir_info.st_mode)) { + if (((dir_info.st_mode) & S_IFMT) == S_IFLNK) { char buf[1025]; int buf_size; @@ -198,28 +154,28 @@ PUBLIC int showinfo ARGS4( #endif pw = getpwuid(dir_info.st_uid); if (pw) - fprintf(fp0, " <em>Name of owner:</em> %s\n", pw->pw_name); + fprintf(fp0, " <em>Name of owner:</em> %s\n", pw->pw_name); grp = getgrgid(dir_info.st_gid); if (grp && grp->gr_name) - fprintf(fp0, " <em>Group name:</em> %s\n", grp->gr_name); - if (S_ISREG(dir_info.st_mode)) { + fprintf(fp0, " <em>Group name:</em> %s\n", grp->gr_name); + if (((dir_info.st_mode) & S_IFMT) == S_IFREG) { sprintf(temp, " <em>File size:</em> %ld (bytes)\n", - (long)dir_info.st_size); + (long)dir_info.st_size); fprintf(fp0, "%s", temp); } /* - * Include date and time information. + * Include date and time information. */ cp = ctime(&dir_info.st_ctime); fprintf(fp0, " <em>Creation date:</em> %s", cp); - cp = ctime(&dir_info.st_mtime); + cp = ctime(&dir_info.st_mtime); fprintf(fp0, " <em>Last modified:</em> %s", cp); cp = ctime(&dir_info.st_atime); fprintf(fp0, " <em>Last accessed:</em> %s\n", cp); - fprintf(fp0, " Access Permissions\n"); + fprintf(fp0, " <em>Access Permissions</em>\n"); fprintf(fp0, " <em>Owner:</em> "); modes[0] = '\0'; modes[1] = '\0'; /* In case there are no permissions */ @@ -229,13 +185,13 @@ PUBLIC int showinfo ARGS4( if ((dir_info.st_mode & S_IWUSR)) strcat(modes, ", write"); if ((dir_info.st_mode & S_IXUSR)) { - if (S_ISDIR(dir_info.st_mode)) + if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) strcat(modes, ", search"); - else { + else { strcat(modes, ", execute"); if ((dir_info.st_mode & S_ISUID)) - strcat(modes, ", setuid"); - } + strcat(modes, ", setuid"); + } } fprintf(fp0, "%s\n", (char *)&modes[2]); /* Skip leading ', ' */ @@ -243,18 +199,18 @@ PUBLIC int showinfo ARGS4( modes[0] = '\0'; modes[1] = '\0'; /* In case there are no permissions */ modes[2] = '\0'; - if ((dir_info.st_mode & S_IRGRP)) + if ((dir_info.st_mode & S_IRGRP)) strcat(modes, ", read"); if ((dir_info.st_mode & S_IWGRP)) strcat(modes, ", write"); if ((dir_info.st_mode & S_IXGRP)) { - if (S_ISDIR(dir_info.st_mode)) + if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) strcat(modes, ", search"); - else { + else { strcat(modes, ", execute"); if ((dir_info.st_mode & S_ISGID)) - strcat(modes, ", setgid"); - } + strcat(modes, ", setgid"); + } } fprintf(fp0, "%s\n", (char *)&modes[2]); /* Skip leading ', ' */ @@ -267,15 +223,15 @@ PUBLIC int showinfo ARGS4( if ((dir_info.st_mode & S_IWOTH)) strcat(modes, ", write"); if ((dir_info.st_mode & S_IXOTH)) { - if (S_ISDIR(dir_info.st_mode)) + if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) strcat(modes, ", search"); - else { + else { strcat(modes, ", execute"); #ifdef S_ISVTX if ((dir_info.st_mode & S_ISVTX)) - strcat(modes, ", sticky"); + strcat(modes, ", sticky"); #endif - } + } } fprintf(fp0, "%s\n", (char *)&modes[2]); /* Skip leading ', ' */ } @@ -289,38 +245,38 @@ PUBLIC int showinfo ARGS4( StrAllocCopy(Title, doc->title); LYEntify(&Title, TRUE); fprintf(fp0, "<dt><em>Linkname:</em> %s%s\n", - Title, (doc->isHEAD ? " (HEAD)" : "")); + Title, (doc->isHEAD ? " (HEAD)" : "")); StrAllocCopy(Address, doc->address); LYEntify(&Address, TRUE); fprintf(fp0, - "<dt> <em>URL:</em> %s\n", Address); + "<dt> <em>URL:</em> %s\n", Address); if (HTLoadedDocumentCharset()) { - fprintf(fp0, "<dt><em> Charset:</em> %s\n", + fprintf(fp0, "<dt><em> Charset:</em> %s\n", HTLoadedDocumentCharset()); } else { LYUCcharset * p_in = HTAnchor_getUCInfoStage(HTMainAnchor, - UCT_STAGE_PARSER); + UCT_STAGE_PARSER); if (!p_in || !(p_in->MIMEname) || !*(p_in->MIMEname) || HTAnchor_getUCLYhndl(HTMainAnchor, UCT_STAGE_PARSER) < 0) { p_in = HTAnchor_getUCInfoStage(HTMainAnchor, UCT_STAGE_MIME); } if (p_in && p_in->MIMEname && *(p_in->MIMEname) && HTAnchor_getUCLYhndl(HTMainAnchor, UCT_STAGE_MIME) >= 0) { - fprintf(fp0, "<dt><em> Charset:</em> %s (assumed)\n", + fprintf(fp0, "<dt><em> Charset:</em> %s (assumed)\n", p_in->MIMEname); } } if ((cp = HText_getServer()) != NULL && *cp != '\0') - fprintf(fp0, "<dt><em> Server:</em> %s\n", cp); + fprintf(fp0, "<dt><em> Server:</em> %s\n", cp); if ((cp = HText_getDate()) != NULL && *cp != '\0') - fprintf(fp0, "<dt><em> Date:</em> %s\n", cp); + fprintf(fp0, "<dt><em> Date:</em> %s\n", cp); if ((cp = HText_getLastModified()) != NULL && *cp != '\0') - fprintf(fp0, "<dt><em>Last Mod:</em> %s\n", cp); + fprintf(fp0, "<dt><em>Last Mod:</em> %s\n", cp); if (doc->post_data) { fprintf(fp0, @@ -330,10 +286,10 @@ PUBLIC int showinfo ARGS4( } if (owner_address) { - StrAllocCopy(Address, owner_address); + StrAllocCopy(Address, owner_address); LYEntify(&Address, TRUE); } else { - StrAllocCopy(Address, "None"); + StrAllocCopy(Address, "None"); } fprintf(fp0, "<dt><em>Owner(s):</em> %s\n", Address); @@ -358,8 +314,8 @@ PUBLIC int showinfo ARGS4( if (lynx_mode == FORMS_LYNX_MODE && links[doc->link].type == WWW_FORM_LINK_TYPE) { if (links[doc->link].form->submit_method) { - int method = links[doc->link].form->submit_method; - char *enctype = links[doc->link].form->submit_enctype; + int method = links[doc->link].form->submit_method; + char *enctype = links[doc->link].form->submit_enctype; fprintf(fp0, "<dt> <em>Method:</em> %s\n", (method == URL_POST_METHOD) ? "POST" : @@ -371,20 +327,20 @@ PUBLIC int showinfo ARGS4( enctype : "application/x-www-form-urlencoded")); } if (links[doc->link].form->submit_action) { - StrAllocCopy(Address, links[doc->link].form->submit_action); + StrAllocCopy(Address, links[doc->link].form->submit_action); LYEntify(&Address, TRUE); - fprintf(fp0, "<dt> <em>Action:</em> %s\n", Address); + fprintf(fp0, "<dt> <em>Action:</em> %s\n", Address); } if (!(links[doc->link].form->submit_method && links[doc->link].form->submit_action)) { - fprintf(fp0,"<dt> (Form field)\n"); + fprintf(fp0,"<dt> (Form field)\n"); } } else { if (links[doc->link].lname) { - StrAllocCopy(Title, links[doc->link].lname); + StrAllocCopy(Title, links[doc->link].lname); LYEntify(&Title, TRUE); } else { - StrAllocCopy(Title, ""); + StrAllocCopy(Title, ""); } fprintf(fp0, "<dt> <em>URL:</em> %s\n", Title); @@ -397,13 +353,13 @@ PUBLIC int showinfo ARGS4( #ifdef DIRED_SUPPORT } #endif /* DIRED_SUPPORT */ - EndInternalPage(fp0); + fprintf(fp0, "</body>\n"); refresh(); - LYCloseTemp(tempfile); + fclose(fp0); FREE(Address); FREE(Title); - return(0); + return(1); } diff --git a/src/LYShowInfo.h b/src/LYShowInfo.h index 65eb88e5..3333cb4b 100644 --- a/src/LYShowInfo.h +++ b/src/LYShowInfo.h @@ -1,3 +1,4 @@ + #ifndef LYSHOWINFO_H #define LYSHOWINFO_H @@ -8,5 +9,8 @@ extern int showinfo PARAMS((document *doc, int size_of_file, document *newdoc, char *owner_address)); +#define SHOWINFO_TITLE "Information about the current document" + + #endif /* LYSHOWINFO_H */ diff --git a/src/LYSignal.h b/src/LYSignal.h index d8b1d106..9db40918 100644 --- a/src/LYSignal.h +++ b/src/LYSignal.h @@ -5,7 +5,7 @@ #include <signal.h> #ifdef VMS -extern void VMSsignal PARAMS((int sig, void (*func)())); +extern void *VMSsignal PARAMS((int sig, void (*func)())); #ifdef signal #undef signal #endif /* signal */ diff --git a/src/LYStrings.c b/src/LYStrings.c index 8a6a8c65..f273f051 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTCJK.h> #include <LYCurses.h> #include <LYUtils.h> @@ -14,13 +15,12 @@ #include <LYCharSets.h> #include <HTString.h> -#ifdef DJGPP_KEYHANDLER -#include <pc.h> -#include <keys.h> -#endif /* DJGPP_KEYHANDLER */ +#include <ctype.h> #include <LYLeaks.h> +#define FREE(x) if (x) {free(x); x = NULL;} + extern BOOL HTPassHighCtrlRaw; extern HTCJKlang HTCJK; @@ -56,47 +56,41 @@ PUBLIC int get_mouse_link NOARGS PRIVATE int set_clicked_link ARGS2(int,x,int,y) { - int left = 6; - int right = LYcols-6; - /* yes, I am assuming that my screen will be a certain width. */ - int i; - int c = -1; - - if (y == (LYlines-1)) { - if (x < left) c = LTARROW; - else if (x > right) c = '\b'; - else c = PGDOWN; - } else if (y == 0) { - if (x < left) c = LTARROW; - else if (x > right) c = '\b'; - else c = PGUP; - } else { - /* Loop over the links and see if we can get a match */ - for (i = 0; i < nlinks; i++) { - /* Check the first line of the link */ - if ( links[i].hightext != NULL && - links[i].ly == y && - (x - links[i].lx) < (int)strlen(links[i].hightext ) ) { - mouse_link = i; - break; - } - /* Check the second line */ - if (links[i].hightext2 != NULL && - 1+links[i].ly == y && - (x - links[i].hightext2_offset) < (int)strlen(links[i].hightext2) ) { - mouse_link = i; - break; - } - } - /* - * If a link was hit, we must look for a key which will activate - * LYK_ACTIVATE We expect to find LYK_ACTIVATE (it's usually mapped to - * the Enter key). - */ - if (mouse_link >= 0) - c = lookup_keymap(LYK_ACTIVATE); + int i; + + /* Loop over the links and see if we can get a match */ + for(i=0; i < nlinks && mouse_link == -1; i++) { + /* Check the first line of the link */ + if ( links[i].hightext != NULL && + links[i].ly == y && + (x - links[i].lx) < (int)strlen(links[i].hightext ) ) { + mouse_link=i; } - return c; + /* Check the second line */ + if (links[i].hightext2 != NULL && + 1+links[i].ly == y && + (x - links[i].hightext2_offset) < (int)strlen(links[i].hightext2) ) { + mouse_link=i; + } + } + /* If no link was found, just return a do-nothing code */ + if (mouse_link == -1) return -1; + + /* If a link was hit, we must look for a key which will activate LYK_ACTIVATE + ** XXX The 127 in the following line will depend on the size of the keymap[] + ** array. However, usually we'll find LYK_ACTIVATE somewhere in the first + ** 127 keys (it's usually mapped to the Enter key) + **/ + for (i=0; i<127; i++) { + if (LYisNonAlnumKeyname(i, LYK_ACTIVATE)) { + return i; + } + } + /* Whoops! Nothing's defined as LYK_ACTIVATE! + Well, who are we to argue with the user? + Forget about the mouse click */ + mouse_link = -1; + return -1; } @@ -110,7 +104,7 @@ PUBLIC char *LYstrncpy ARGS3( int, n) { char *val; - int len = strlen(src); + int len=strlen(src); if (n < 0) n = 0; @@ -238,15 +232,7 @@ PUBLIC int LYmbcsstrlen ARGS2( #ifdef VMS #define GetChar() ttgetc() #else -#ifdef __DJGPP__ -#ifdef DJGPP_KEYHANDLER -#define GetChar getxkey -#else -#define GetChar SLkp_getkey -#endif /* DJGPP_KEYHANDLER */ -#else #define GetChar (int)SLang_getkey -#endif /* __DJGPP__ */ #endif /* VMS */ #endif /* USE_SLANG */ @@ -277,62 +263,53 @@ PUBLIC int LYmbcsstrlen ARGS2( /* * Workaround a bug in ncurses order-of-refresh by setting a pointer to * the topmost window that should be displayed. - * - * FIXME: the associated call on 'keypad()' is not needed for Unix, but - * something in the OS/2 EMX port requires it. */ PRIVATE WINDOW *my_subwindow; PUBLIC void LYsubwindow ARGS1(WINDOW *, param) { - if ((my_subwindow = param) != 0) - keypad(param, TRUE); + my_subwindow = param; } #endif #ifdef USE_SLANG_MOUSE PRIVATE int sl_parse_mouse_event ARGS3(int *, x, int *, y, int *, button) { - /* "ESC [ M" has already been processed. There more characters are - * expected: BUTTON X Y - */ - *button = SLang_getkey (); - switch (*button) - { - case 040: /* left button */ - case 041: /* middle button */ - case 042: /* right button */ + /* "ESC [ M" has already been processed. There more characters are + * expected: BUTTON X Y + */ + *button = SLang_getkey (); + switch (*button) + { + case 040: /* left button */ + case 041: /* middle button */ + case 042: /* right button */ *button -= 040; break; - default: /* Hmmm.... */ + default: /* Hmmm.... */ SLang_flush_input (); return -1; - } + } - *x = SLang_getkey () - 33; - *y = SLang_getkey () - 33; - return 0; + *x = SLang_getkey () - 33; + *y = SLang_getkey () - 33; + return 0; } +#endif -PRIVATE int sl_read_mouse_event NOARGS +#if defined(USE_SLANG_MOUSE) || defined(NCURSES_MOUSE_VERSION) +PRIVATE int map_function_to_key ARGS1(char, keysym) { - int mouse_x, mouse_y, button; + int i; - mouse_link = -1; - if (-1 != sl_parse_mouse_event (&mouse_x, &mouse_y, &button)) + /* I would prefer to use sizeof keymap but its size is not available. + * A better method would be to declare it as some fixed size. + */ + for (i = 1; i < 256; i++) { - if (button == 0) /* left */ - return set_clicked_link (mouse_x, mouse_y); - - if (button == 2) /* right */ - { - /* Right button: go back to prev document. - * The problem is that we need to determine - * what to return to achieve this. - */ - return LYReverseKeymap (LYK_PREV_DOC); - } + if (keymap[i] == keysym) + return i - 1; } return -1; } @@ -344,477 +321,9 @@ PUBLIC void ena_csi ARGS1( { csi_is_csi = flag; } - -#if defined(USE_KEYMAPS) - -#ifdef USE_SLANG -#define define_key(string, code) \ - SLkm_define_keysym (string, code, Keymap_List) -#define expand_substring(dst, first, last) \ - SLexpand_escaped_string(dst, first, last) -static SLKeyMap_List_Type *Keymap_List; -/* This value should be larger than anything in LYStrings.h */ -#define MOUSE_KEYSYM 0x1000 -#endif - - -#define SQUOTE '\'' -#define DQUOTE '"' -#define ESCAPE '\\' -#define LPAREN '(' -#define RPAREN ')' - -/* - * For ncurses, we use the predefined keysyms, since that lets us also reuse - * the CSI logic and other special cases for VMS, NCSA telnet, etc. - */ -#ifdef USE_SLANG -#define DEFINE_KEY(string,lynx,curses) {string,lynx} -#else -#define DEFINE_KEY(string,lynx,curses) {string,curses} -#endif - -typedef struct -{ - char *string; - int value; -} -Keysym_String_List; - -static Keysym_String_List Keysym_Strings [] = -{ - DEFINE_KEY( "UPARROW", UPARROW, KEY_UP ), - DEFINE_KEY( "DNARROW", DNARROW, KEY_DOWN ), - DEFINE_KEY( "RTARROW", RTARROW, KEY_RIGHT ), - DEFINE_KEY( "LTARROW", LTARROW, KEY_LEFT ), - DEFINE_KEY( "PGDOWN", PGDOWN, KEY_NPAGE ), - DEFINE_KEY( "PGUP", PGUP, KEY_PPAGE ), - DEFINE_KEY( "HOME", HOME, KEY_HOME ), - DEFINE_KEY( "END", END_KEY, KEY_END ), - DEFINE_KEY( "F1", F1, KEY_F(1) ), - DEFINE_KEY( "DO_KEY", DO_KEY, KEY_F(16) ), - DEFINE_KEY( "FIND_KEY", FIND_KEY, KEY_FIND ), - DEFINE_KEY( "SELECT_KEY", SELECT_KEY, KEY_SELECT ), - DEFINE_KEY( "INSERT_KEY", INSERT_KEY, KEY_IC ), - DEFINE_KEY( "REMOVE_KEY", REMOVE_KEY, KEY_DC ), - DEFINE_KEY( "DO_NOTHING", DO_NOTHING, 0 ), - DEFINE_KEY( NULL, -1, ERR ) -}; - -#ifdef NCURSES_VERSION -/* - * Ncurses stores the termcap/terminfo names in arrays sorted to match the - * array of strings in the TERMTYPE struct. - */ -PRIVATE int lookup_tiname (char *name, NCURSES_CONST char *const *names) -{ - int code; - - for (code = 0; names[code] != 0; code++) - if (!strcmp(names[code], name)) - return code; - return -1; -} - -PRIVATE char *expand_tiname (char *first, size_t len, char **result) -{ - char name[BUFSIZ]; - int code; - - strncpy(name, first, len); - name[len] = '\0'; - if ((code = lookup_tiname(name, strnames)) >= 0 - || (code = lookup_tiname(name, strfnames)) >= 0) { - strcpy(*result, cur_term->type.Strings[code]); - (*result) += strlen(*result); - } - return first + len; -} - -PRIVATE char *expand_tichar (char *first, char **result) -{ - int ch; - int limit = 0; - int radix = 0; - int value = 0; - char *name = 0; - - switch (ch = *first++) { - case 'E': case 'e': value = 27; break; - case 'a': name = "bel"; break; - case 'b': value = '\b'; break; - case 'f': value = '\f'; break; - case 'n': value = '\n'; break; - case 'r': value = '\r'; break; - case 't': value = '\t'; break; - case 'v': value = '\v'; break; - case 'd': radix = 10; limit = 3; break; - case 'x': radix = 16; limit = 2; break; - default: - if (isdigit(ch)) { - radix = 8; - limit = 3; - first--; - } else { - value = *first; - } - break; - } - - if (radix != 0) { - char *last; - int save = first[limit]; - first[limit] = '\0'; - value = strtol(first, &last, radix); - first[limit] = save; - first = last; - } - - if (name != 0) { - (void) expand_tiname(name, strlen(name), result); - } else { - **result = value; - (*result) += 1; - } - - return first; -} - -PRIVATE void expand_substring (char* dst, char* first, char* last) -{ - int ch; - while (first < last) { - switch (ch = *first++) { - case ESCAPE: - first = expand_tichar(first, &dst); - break; - case '^': - ch = *first++; - if (ch == LPAREN) { - char *s = strchr(first, RPAREN); - if (s == 0) - s = first + strlen(first); - first = expand_tiname(first, s-first, &dst); - } else if (ch == '?') { /* ASCII delete? */ - *dst++ = 127; - } else if ((ch & 0x3f) < 0x20) { /* ASCII control char? */ - *dst++ = (ch & 0x1f); - } else { - *dst++ = '^'; - first--; /* not legal... */ - } - break; - case 0: /* convert nulls for terminfo */ - ch = 0200; - /* FALLTHRU */ - default: - *dst++ = ch; - break; - } - } - *dst = '\0'; -} -#endif - -PRIVATE void unescaped_char ARGS2(char*, parse, int*,keysym) -{ - size_t len = strlen(parse); - char buf[BUFSIZ]; - - if (len >= 3) { - expand_substring(buf, parse + 1, parse + len - 1); - if (strlen(buf) == 1) - *keysym = *buf; - } -} - -PRIVATE BOOLEAN unescape_string ARGS2(char*, src, char *, dst) -{ - BOOLEAN ok = FALSE; - - if (*src == SQUOTE) { - int keysym; - unescaped_char(src, &keysym); - if (keysym >= 0) { - dst[0] = keysym; - dst[1] = '\0'; - ok = TRUE; - } - } else if (*src == DQUOTE) { - expand_substring(dst, src + 1, src + strlen(src) - 1); - ok = TRUE; - } - return ok; -} - -PRIVATE int map_string_to_keysym ARGS2(char*, str, int*,keysym) -{ - *keysym = -1; - - if (*str == SQUOTE) { - unescaped_char(str, keysym); - } else if (isdigit(*str)) { - char *tmp; - long value = strtol(str, &tmp, 0); - if (!isalnum(*tmp)) - *keysym = value; - } else { - Keysym_String_List *k; - - k = Keysym_Strings; - while (k->string != NULL) { - if (0 == strcmp (k->string, str)) { - *keysym = k->value; - break; - } - k++; - } - } - - return (*keysym); -} - -/* - * Starting at a nonblank character, skip over a token, counting quoted and - * escaped characters. - */ -PRIVATE char *skip_keysym ARGS1(char *, parse) -{ - int quoted = 0; - int escaped = 0; - - while (*parse) { - if (escaped) { - escaped = 0; - } else if (quoted) { - if (*parse == ESCAPE) { - escaped = 1; - } else if (*parse == quoted) { - quoted = 0; - } - } else if (*parse == ESCAPE) { - escaped = 1; - } else if (*parse == DQUOTE || *parse == SQUOTE) { - quoted = *parse; - } else if (isspace(*parse)) { - break; - } - parse++; - } - return (quoted || escaped) ? 0 : parse; -} - -/* - * The first token is the string to define, the second is the name (of the - * keysym) to define it to. - */ -PRIVATE int setkey_cmd (char *parse) -{ - char *s, *t; - int keysym; - char buf[BUFSIZ]; - - if ((s = skip_keysym(parse)) != 0) { - if (isspace(*s)) { - *s++ = '\0'; - s = LYSkipBlanks(s); - if ((t = skip_keysym(s)) == 0) - return -1; - if (t != s) - *t = '\0'; - if (map_string_to_keysym (s, &keysym) >= 0 - && unescape_string(parse, buf)) { - return define_key(buf, keysym); - } - } - } - return -1; -} - -PRIVATE int unsetkey_cmd (char *parse) -{ - char *s = skip_keysym(parse); - if (s != parse) { - *s = '\0'; -#ifdef NCURSES_VERSION - /* - * This won't work with Slang. Remove the definition for the given - * keysym. - */ - { - int keysym; - if (map_string_to_keysym (parse, &keysym) >= 0) - define_key((char *)0, keysym); - } -#endif -#ifdef USE_SLANG - /* Slang implements this, for undefining the string which is associated - * with a keysym (the reverse of what we normally want, but may - * occasionally find useful). - */ - SLang_undefine_key (parse, Keymap_List); - if (SLang_Error) return -1; -#endif - } - return 0; -} - -#ifdef FNAMES_8_3 -#define FNAME_LYNX_KEYMAPS "_lynxkey.map" -#else -#define FNAME_LYNX_KEYMAPS ".lynx-keymaps" -#endif /* FNAMES_8_3 */ - -PRIVATE int read_keymap_file NOARGS -{ - static struct { - CONST char *name; - int (*func) PARAMS((char *s)); - } table[] = { - {"setkey", setkey_cmd }, - {"unsetkey", unsetkey_cmd }, - }; - - char line[1024]; - FILE *fp; - char file[LY_MAXPATH]; - int ret; - int linenum; - size_t n; - - LYAddPathToHome(file, sizeof(file), FNAME_LYNX_KEYMAPS); - - if ((fp = fopen (file, "r")) == 0) - return 0; - - linenum = 0; - ret = 0; - while ((fgets (line, sizeof (line), fp) != 0) && (ret == 0)) - { - char *s = LYSkipBlanks(line); - - linenum++; - - if ((*s == 0) || (*s == '#')) - continue; - - for (n = 0; n < TABLESIZE(table); n++) { - size_t len = strlen(table[n].name); - if (strlen(s) > len - && !strncmp(s, table[n].name, len)) { - if ((*(table[n].func))(LYSkipBlanks(s+len)) < 0) { - ret = -1; - break; - } - } - } - } - - fclose (fp); - - if (ret == -1) - fprintf (stderr, "Error processing line %d of %s\n", linenum, file); - - return ret; -} - -PRIVATE void setup_vtXXX_keymap NOARGS -{ - static Keysym_String_List table[] = { - DEFINE_KEY( "\033[A", UPARROW, KEY_UP ), - DEFINE_KEY( "\033OA", UPARROW, KEY_UP ), - DEFINE_KEY( "\033[B", DNARROW, KEY_DOWN ), - DEFINE_KEY( "\033OB", DNARROW, KEY_DOWN ), - DEFINE_KEY( "\033[C", RTARROW, KEY_RIGHT ), - DEFINE_KEY( "\033OC", RTARROW, KEY_RIGHT ), - DEFINE_KEY( "\033[D", LTARROW, KEY_LEFT ), - DEFINE_KEY( "\033OD", LTARROW, KEY_LEFT ), - DEFINE_KEY( "\033[1~", FIND_KEY, KEY_FIND ), - DEFINE_KEY( "\033[2~", INSERT_KEY, KEY_IC ), - DEFINE_KEY( "\033[3~", REMOVE_KEY, KEY_DC ), - DEFINE_KEY( "\033[4~", SELECT_KEY, KEY_SELECT ), - DEFINE_KEY( "\033[5~", PGUP, KEY_PPAGE ), - DEFINE_KEY( "\033[6~", PGDOWN, KEY_NPAGE ), - DEFINE_KEY( "\033[8~", END_KEY, KEY_END ), - DEFINE_KEY( "\033[7~", HOME, KEY_HOME), - DEFINE_KEY( "\033[28~", F1, KEY_F(1) ), - DEFINE_KEY( "\033OP", F1, KEY_F(1) ), - DEFINE_KEY( "\033[OP", F1, KEY_F(1) ), - DEFINE_KEY( "\033[29~", DO_KEY, KEY_F(16) ), - }; - size_t n; - for (n = 0; n < TABLESIZE(table); n++) - define_key(table[n].string, table[n].value); -} - -PUBLIC int lynx_initialize_keymaps NOARGS -{ -#ifdef USE_SLANG - int i; - char keybuf[2]; - - if (NULL == (Keymap_List = SLang_create_keymap ("Lynx", NULL))) - return -1; - - keybuf[1] = 0; - for (i = 1; i < 256; i++) - { - keybuf[0] = (char) i; - define_key (keybuf, i); - } - - setup_vtXXX_keymap(); - define_key ("\033[M", MOUSE_KEYSYM); - - if (SLang_Error - || (-1 == read_keymap_file ())) - SLang_exit_error ("Unable to initialize keymaps"); - return 0; -#else - setup_vtXXX_keymap(); - return read_keymap_file(); -#endif -} - -#endif /* USE_KEYMAPS */ - -#if defined(USE_KEYMAPS) && defined(USE_SLANG) - -/* We cannot guarantee the type for 'GetChar', and should not use a cast. */ -PRIVATE int myGetChar NOARGS -{ - return GetChar(); -} - -PUBLIC int LYgetch NOARGS -{ - SLang_Key_Type *key; - int keysym; - - key = SLang_do_key (Keymap_List, myGetChar); - if ((key == NULL) || (key->type != SLKEY_F_KEYSYM)) - return DO_NOTHING; - - keysym = key->f.keysym; - -#if defined (USE_SLANG_MOUSE) - if (keysym == MOUSE_KEYSYM) - return sl_read_mouse_event (); -#endif - - if ((keysym > DO_NOTHING) || (keysym < 0)) - return 0; - - return keysym; -} - -#else /* !USE_KEYMAPS */ - /* * LYgetch() translates some escape sequences and may fake noecho. */ -#define found_CSI(first,second) ((second) == '[' || (first) == 155) - PUBLIC int LYgetch NOARGS { int a, b, c, d = -1; @@ -825,7 +334,7 @@ re_read: #ifndef USE_SLANG clearerr(stdin); /* needed here for ultrix and SOCKETSHR, but why? - FM */ #endif /* !USE_SLANG */ -#if !defined(USE_SLANG) || defined(VMS) || defined(DJGPP_KEYHANDLER) +#if !defined(USE_SLANG) || defined(VMS) c = GetChar(); #else if (LYCursesON) { @@ -841,9 +350,27 @@ re_read: #endif /* IGNORE_CTRL_C */ return(7); /* use ^G to cancel whatever called us. */ } - } + } #endif /* !USE_SLANG || VMS */ +#ifdef RAWDOSKEYHACK + if (raw_dos_key_hack) { + if (c == 0) c = '/'; + if (c > 255) { /* handle raw dos keys */ + switch (c) + { + case 464: c = '-'; break; /* keypad minus*/ + case 465: c = '+'; break; /* keypad plus*/ + case 459: c = 13; break; /* keypad enter*/ + case 463: c = '*'; break; /* keypad * */ + case 440: c = 'Q'; break; /* alt x */ + case 265: c = 'H'; break; /* F1 */ + default: break; + } + } + } +#endif /* RAWDOSKEYHACK */ + #ifdef USE_GETCHAR if (c == EOF && errno == EINTR) /* Ctrl-Z causes EINTR in getchar() */ goto re_read; @@ -908,16 +435,32 @@ re_read: 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 '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; break; /* keypad on pc ncsa telnet */ case 'M': #ifdef USE_SLANG_MOUSE - if (found_CSI(c,b)) + if ((c == 27) && (b == '[')) { - c = sl_read_mouse_event (); + int mouse_x, mouse_y, button; + + mouse_link = -1; + c = -1; + if (-1 != sl_parse_mouse_event (&mouse_x, &mouse_y, &button)) + { + if (button == 0) /* left */ + c = set_clicked_link (mouse_x, mouse_y); + else if (button == 2) /* right */ + { + /* Right button: go back to prev document. + * The problem is that we need to determine + * what to return to achieve this. + */ + c = map_function_to_key (LYK_PREV_DOC); + } + } } else #endif @@ -959,11 +502,11 @@ re_read: c = '0'; /* keypad 0 */ break; case '1': /** VTxxx Find **/ - if (found_CSI(c,b) && (d=GetChar()) == '~') + if ((b == '[' || c == 155) && (d=GetChar()) == '~') c = FIND_KEY; break; case '2': - if (found_CSI(c,b)) { + if (b == '[' || c == 155) { if ((d=GetChar())=='~') /** VTxxx Insert **/ c = INSERT_KEY; else if ((d == '8' || @@ -979,33 +522,36 @@ re_read: } break; case '3': /** VTxxx Delete **/ - if (found_CSI(c,b) && (d=GetChar()) == '~') + if ((b == '[' || c == 155) && (d=GetChar()) == '~') c = REMOVE_KEY; break; case '4': /** VTxxx Select **/ - if (found_CSI(c,b) && (d=GetChar()) == '~') + if ((b == '[' || c == 155) && (d=GetChar()) == '~') c = SELECT_KEY; break; case '5': /** VTxxx PrevScreen **/ - if (found_CSI(c,b) && (d=GetChar()) == '~') + if ((b == '[' || c == 155) && (d=GetChar()) == '~') c = PGUP; break; case '6': /** VTxxx NextScreen **/ - if (found_CSI(c,b) && (d=GetChar()) == '~') + if ((b == '[' || c == 155) && (d=GetChar()) == '~') c = PGDOWN; break; case '[': /** Linux F1-F5: ^[[[A etc. **/ - if (found_CSI(c,b)) { + if (b == '[' || c == 155) { if ((d=GetChar()) == 'A') c = F1; break; } default: - CTRACE(tfp,"Unknown key sequence: %d:%d:%d\n",c,b,a); - CTRACE_SLEEP(MessageSecs); - break; + if (TRACE) { + fprintf(stderr,"Unknown key sequence: %d:%d:%d\n",c,b,a); + if (!LYTraceLogFP) { + sleep(MessageSecs); + } + } } - if (isdigit(a) && found_CSI(c,b) && d != -1 && d != '~') + if (isdigit(a) && (b == '[' || c == 155) && d != -1 && d != '~') d = GetChar(); } #if HAVE_KEYPAD @@ -1039,7 +585,7 @@ re_read: c = PGUP; break; case KEY_LL: /* home down or bottom (lower left) */ - c = END_KEY; + c = END; break; /* The keypad is arranged like this:*/ /* a1 up a3 */ @@ -1055,14 +601,14 @@ re_read: c = DO_NOTHING; break; case KEY_C1: /* lower left of keypad */ - c = END_KEY; + c = END; break; case KEY_C3: /* lower right of keypad */ c = PGDOWN; break; #ifdef KEY_END case KEY_END: /* end key 001 */ - c = END_KEY; + c = END; break; #endif /* KEY_END */ #ifdef KEY_HELP @@ -1075,7 +621,7 @@ re_read: c = 127; /* backspace key (delete, not Ctrl-H) */ break; #endif /* KEY_BACKSPACE */ -#if defined(KEY_F) && !defined(__DJGPP__) && !defined(_WINDOWS) +#ifdef KEY_F case KEY_F(1): c = F1; /* VTxxx Help */ break; @@ -1110,114 +656,47 @@ re_read: #endif /* KEY_DC */ #ifdef NCURSES_MOUSE_VERSION case KEY_MOUSE: - { + { #ifndef DOSPATH - MEVENT event; - int err; - - c = -1; - mouse_link = -1; - err = getmouse(&event); - if (event.bstate & BUTTON1_CLICKED) { - c = set_clicked_link(event.x, event.y); - } else if (event.bstate & BUTTON3_CLICKED) { - c = LYReverseKeymap (LYK_PREV_DOC); - } + MEVENT event; + int err; + + c = -1; + mouse_link = -1; + err=getmouse(&event); + if (event.bstate & BUTTON1_CLICKED) { + c = set_clicked_link(event.x, event.y); + } else if (event.bstate & BUTTON3_CLICKED) { + c = map_function_to_key (LYK_PREV_DOC); + } #else /* pdcurses version */ - c = -1; - mouse_link = -1; - request_mouse_pos(); - if (BUTTON_STATUS(1) & BUTTON_CLICKED) { - c = set_clicked_link(MOUSE_X_POS, MOUSE_Y_POS); - } else if (BUTTON_STATUS(3) & BUTTON_CLICKED) { - c = LYReverseKeymap (LYK_PREV_DOC); - } -#endif /* DOSPATH */ - } - break; + int left,right; + /* yes, I am assuming that my screen will be a certain width. */ + left = 6; + right = LYcols-6; + c = -1; + mouse_link = -1; + request_mouse_pos(); + if (Mouse_status.button[0] & BUTTON_CLICKED) { + if (Mouse_status.y == (LYlines-1)) + if (Mouse_status.x < left) c=LTARROW; + else if (Mouse_status.x > right) c='\b'; + else c=PGDOWN; + else if (Mouse_status.y == 0) + if (Mouse_status.x < left) c=LTARROW; + else if (Mouse_status.x > right) c='\b'; + else c=PGUP; + else c = set_clicked_link(Mouse_status.x, Mouse_status.y); + } +#endif /* _WINDOWS */ + } + break; #endif /* NCURSES_MOUSE_VERSION */ } } #endif /* HAVE_KEYPAD */ -#ifdef DJGPP_KEYHANDLER - else { - switch(c) { - case K_Down: /* The four arrow keys ... */ - case K_EDown: - c = DNARROW; - break; - case K_Up: - case K_EUp: - c = UPARROW; - break; - case K_Left: - case K_ELeft: - c = LTARROW; - break; - case K_Right: /* ... */ - case K_ERight: - c = RTARROW; - break; - case K_Home: /* Home key (upward+left arrow) */ - case K_EHome: - c = HOME; - break; - case K_PageDown: /* Next page */ - case K_EPageDown: - c = PGDOWN; - break; - case K_PageUp: /* Previous page */ - case K_EPageUp: - c = PGUP; - break; - case K_End: /* home down or bottom (lower left) */ - case K_EEnd: - c = END_KEY; - break; - } - } -#endif /* DGJPP_KEYHANDLER */ -#if defined(USE_SLANG) && defined(__DJGPP__) && !defined(DJGPP_KEYHANDLER) && !defined(USE_KEYMAPS) - else { - switch(c) { - case SL_KEY_DOWN: /* The four arrow keys ... */ - c = DNARROW; - break; - case SL_KEY_UP: - c = UPARROW; - break; - case SL_KEY_LEFT: - c = LTARROW; - break; - case SL_KEY_RIGHT: /* ... */ - c = RTARROW; - break; - case SL_KEY_HOME: /* Home key (upward+left arrow) */ - case SL_KEY_A1: /* upper left of keypad */ - c = HOME; - break; - case SL_KEY_NPAGE: /* Next page */ - case SL_KEY_C3: /* lower right of keypad */ - c = PGDOWN; - break; - case SL_KEY_PPAGE: /* Previous page */ - case SL_KEY_A3: /* upper right of keypad */ - c = PGUP; - break; - case SL_KEY_END: /* home down or bottom (lower left) */ - case SL_KEY_C1: /* lower left of keypad */ - c = END_KEY; - break; - } - } -#endif /* USE_SLANG && __DJGPP__ && !DJGPP_KEYHANDLER && !USE_KEYMAPS */ -#if (defined(__DJGPP__) || defined(_WINDOWS)) - if (c > 659) -#else - if (c > DO_NOTHING) -#endif /* __DJGPP__ || _WINDOWS */ - { + if (c > DO_NOTHING) { /* * Don't return raw values for KEYPAD symbols which we may have * missed in the switch above if they are obviously invalid when @@ -1229,110 +708,6 @@ re_read: } } -#endif /* NOT USE_KEYMAPS */ - -/* - * Convert a null-terminated string to lowercase - */ -PUBLIC void LYLowerCase ARGS1( - char *, buffer) -{ - size_t i; - for (i = 0; buffer[i]; i++) - buffer[i] = TOLOWER(buffer[i]); -} - -/* - * Convert a null-terminated string to uppercase - */ -PUBLIC void LYUpperCase ARGS1( - char *, buffer) -{ - size_t i; - for (i = 0; buffer[i]; i++) - buffer[i] = TOUPPER(buffer[i]); -} - -/* - * Remove ALL whitespace from a string (including embedded blanks). - */ -PUBLIC void LYRemoveBlanks ARGS1( - char *, buffer) -{ - if (buffer != 0) { - size_t i, j; - for (i = j = 0; buffer[i]; i++) - if (!isspace((unsigned char)(buffer[i]))) - buffer[j++] = buffer[i]; - buffer[j] = 0; - } -} - -/* - * Skip whitespace - */ -PUBLIC char * LYSkipBlanks ARGS1( - char *, buffer) -{ - while (isspace((unsigned char)(*buffer))) - buffer++; - return buffer; -} - -/* - * Skip non-whitespace - */ -PUBLIC char * LYSkipNonBlanks ARGS1( - char *, buffer) -{ - while (*buffer != 0 && !isspace((unsigned char)(*buffer))) - buffer++; - return buffer; -} - -/* - * Skip CONST whitespace - */ -PUBLIC CONST char * LYSkipCBlanks ARGS1( - CONST char *, buffer) -{ - while (isspace((unsigned char)(*buffer))) - buffer++; - return buffer; -} - -/* - * Skip CONST non-whitespace - */ -PUBLIC CONST char * LYSkipCNonBlanks ARGS1( - CONST char *, buffer) -{ - while (*buffer != 0 && !isspace((unsigned char)(*buffer))) - buffer++; - return buffer; -} - -/* - * Trim leading blanks from a string - */ -PUBLIC void LYTrimLeading ARGS1( - char *, buffer) -{ - char *skipped = LYSkipBlanks(buffer); - while ((*buffer++ = *skipped++) != 0) - ; -} - -/* - * Trim trailing blanks from a string - */ -PUBLIC void LYTrimTrailing ARGS1( - char *, buffer) -{ - size_t i = strlen(buffer); - while (i != 0 && isspace((unsigned char)buffer[i-1])) - buffer[--i] = 0; -} /* ** Display the current value of the string and allow the user @@ -1419,7 +794,7 @@ PUBLIC int LYEdit1 ARGS4( if (MaxLen <= 0) return(0); /* Be defensive */ - length = strlen(&Buf[0]); + length=strlen(&Buf[0]); StrLen = length; switch (action) { @@ -1565,11 +940,13 @@ PUBLIC int LYEdit1 ARGS4( break; case LYE_UPPER: - LYUpperCase(Buf); + for (i = 0; Buf[i]; i++) + Buf[i] = TOUPPER(Buf[i]); break; case LYE_LOWER: - LYLowerCase(Buf); + for (i = 0; Buf[i]; i++) + Buf[i] = TOLOWER(Buf[i]); break; default: @@ -1739,6 +1116,7 @@ again: */ strcpy(inputline, MyEdit.buffer); return(ch); + break; case LYE_ABORT: /* @@ -1746,6 +1124,7 @@ again: */ inputline[0] = '\0'; return(-1); + break; case LYE_LKCMD: /* @@ -1762,34 +1141,6 @@ again: } /* - * A replacement for 'strsep()' - */ -PUBLIC char *LYstrsep ARGS2( - char **, stringp, - CONST char *, delim) -{ - char *tmp, *out; - - if (!stringp || !*stringp) /* nothing to do? */ - return 0; /* then don't fall on our faces */ - - if (!**stringp) { /* empty string: */ - *stringp = 0; /* let caller see he's done; */ - return 0; /* no tokens in an empty string */ - } - - out = *stringp; /* save the start of the string */ - tmp = strpbrk(*stringp, delim); - if (tmp) { - *tmp = '\0'; /* terminate the substring with \0 */ - *stringp = ++tmp; /* point at the next substring */ - } - else *stringp = 0; /* this was the last substring: */ - /* let caller see he's done */ - return out; -} - -/* * LYstrstr will find the first occurrence of the string * pointed to by tarptr in the string pointed to by chptr. * It returns NULL if string not found. @@ -1797,7 +1148,7 @@ PUBLIC char *LYstrsep ARGS2( */ PUBLIC char * LYstrstr ARGS2( char *, chptr, - CONST char *, tarptr) + char *, tarptr) { int len = strlen(tarptr); @@ -2214,7 +1565,8 @@ PUBLIC char * SNACopy ARGS3( if (src) { *dest = (char *)calloc(1, n + 1); if (*dest == NULL) { - CTRACE(tfp, "Tried to calloc %d bytes\n", n); + if (TRACE) + fprintf(stderr, "Tried to calloc %d bytes\n", n); outofmem(__FILE__, "SNACopy"); } strncpy (*dest, src, n); @@ -2275,8 +1627,8 @@ PUBLIC char * SNACat ARGS3( ** may be interpreted as equal, but this side effect is negligible ** if the user search string is more than one character long. - LP ** -** We enable new technique only if DisplayCharsetMatchLocale = FALSE -** (see description in LYCharSets.c) +** We enable new technique only if DisplayCharsetMatchLocale = FALSE +** (see description in LYCharSets.c) */ PUBLIC int UPPER8 ARGS2(int,ch1, int,ch2) { @@ -2288,18 +1640,19 @@ PUBLIC int UPPER8 ARGS2(int,ch1, int,ch2) /* case-insensitive match for upper half */ if ((unsigned char)ch1 > 127 && (unsigned char)ch2 >127) { - if (DisplayCharsetMatchLocale) - return(TOUPPER(ch1) - TOUPPER(ch2)); /* old-style */ - else + if (DisplayCharsetMatchLocale) + return(TOUPPER(ch1) - TOUPPER(ch2)); /* old-style */ + else { /* compare "7bit approximation" for letters >127 */ /* BTW, if we remove the check for >127 above */ /* we get even more "relaxed" insensitive match... */ + CONST char *disp_charset = LYCharSet_UC[current_char_set].MIMEname; int charset_in, charset_out, uck1, uck2; char replace_buf1 [10], replace_buf2 [10]; - charset_in = current_char_set; /* display character set */ + charset_in = UCGetLYhndl_byMIME(disp_charset); charset_out = UCGetLYhndl_byMIME("us-ascii"); uck1 = UCTransCharStr(replace_buf1, sizeof(replace_buf1), ch1, @@ -2312,7 +1665,7 @@ PUBLIC int UPPER8 ARGS2(int,ch1, int,ch2) /* check to be sure we have not lost any strange characters */ /* which are not found in def7_uni.tbl but _equal_ in fact. */ - /* this also applied for "x-transparent" display mode. */ + /* this also applied for "x-transparent" display mode. */ if ((unsigned char)ch1==(unsigned char)ch2) return(0); /* match */ } diff --git a/src/LYStrings.h b/src/LYStrings.h index 14cb46cf..bb4d70f2 100644 --- a/src/LYStrings.h +++ b/src/LYStrings.h @@ -1,7 +1,8 @@ #ifndef LYSTRINGS_H #define LYSTRINGS_H -#include <HTUtils.h> +#include <string.h> + /* UPPER8(ch1,ch2) is an extension of (TOUPPER(ch1) - TOUPPER(ch2)) */ extern int UPPER8 PARAMS(( @@ -20,12 +21,9 @@ extern int LYgetstr PARAMS(( int hidden, size_t bufsize, int recall)); -extern char *LYstrsep PARAMS(( - char ** stringp, - const char * delim)); extern char * LYstrstr PARAMS(( char * chptr, - CONST char * tarptr)); + char * tarptr)); extern char * LYmbcsstrncpy PARAMS(( char * dst, CONST char * src, @@ -69,6 +67,8 @@ extern char * SNACat PARAMS(( #define StrnAllocCopy(dest, src, n) SNACopy (&(dest), src, n) #define StrnAllocCat(dest, src, n) SNACat (&(dest), src, n) +#define printable(c) (((c)>31 && (c)<=255) || (c)==9 || (c)==10 || (c)<0 ) + /* values for LYgetch */ #define UPARROW 256 /* 0x100 */ #define DNARROW 257 /* 0x101 */ @@ -77,7 +77,7 @@ extern char * SNACat PARAMS(( #define PGDOWN 260 /* 0x104 */ #define PGUP 261 /* 0x105 */ #define HOME 262 /* 0x106 */ -#define END_KEY 263 /* 0x107 */ +#define END 263 /* 0x107 */ #define F1 264 /* 0x108 */ #define DO_KEY 265 /* 0x109 */ #define FIND_KEY 266 /* 0x10A */ @@ -144,28 +144,6 @@ typedef struct _EditFieldData { #define LYE_AIX (LYE_LKCMD +1) /* Hex 97 */ -#if defined(USE_KEYMAPS) -extern int lynx_initialize_keymaps NOPARAMS; -#endif - -extern void LYLowerCase PARAMS(( - char * buffer)); -extern void LYUpperCase PARAMS(( - char * buffer)); -extern void LYRemoveBlanks PARAMS(( - char * buffer)); -extern char * LYSkipBlanks PARAMS(( - char * buffer)); -extern char * LYSkipNonBlanks PARAMS(( - char * buffer)); -extern CONST char * LYSkipCBlanks PARAMS(( - CONST char * buffer)); -extern CONST char * LYSkipCNonBlanks PARAMS(( - CONST char * buffer)); -extern void LYTrimLeading PARAMS(( - char * buffer)); -extern void LYTrimTrailing PARAMS(( - char * buffer)); extern void LYSetupEdit PARAMS(( EditFieldData * edit, char * old, @@ -184,7 +162,7 @@ extern int current_lineedit; extern char * LYLineeditNames[]; extern char * LYLineEditors[]; -/* Push a character through the lineedit machinery */ +/* Push a chacter through the linedit machinery */ #define EditBinding(c) (LYLineEditors[current_lineedit][c]) #define LYLineEdit(e,c,m) LYEdit1(e,c,EditBinding(c),m) diff --git a/src/LYStructs.h b/src/LYStructs.h index ff58cd87..051db432 100644 --- a/src/LYStructs.h +++ b/src/LYStructs.h @@ -1,3 +1,4 @@ + #ifndef LYSTRUCTS_H #define LYSTRUCTS_H @@ -31,9 +32,9 @@ typedef struct _document { char * address; char * post_data; char * post_content_type; - char * bookmark; BOOL safe; BOOL isHEAD; + char * bookmark; int link; int line; BOOL internal_link; /* whether doc was reached via an internal @@ -52,11 +53,11 @@ typedef struct _histstruct { char * address; char * post_data; char * post_content_type; - char * bookmark; BOOL safe; + char * bookmark; BOOL isHEAD; int link; - int line; + int page; BOOL internal_link; /* whether doc was reached via an internal (fragment) link. - kw */ int intern_seq_start; /* indicates which element on the history diff --git a/src/LYStyle.c b/src/LYStyle.c index 8a95d2b6..3953621f 100644 --- a/src/LYStyle.c +++ b/src/LYStyle.c @@ -1,9 +1,10 @@ /* character level styles for Lynx * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-) - * @Id: LYStyle.c 1.19 Thu, 06 Aug 1998 06:28:22 -0600 dickey @ + * @Id: LYStyle.c 1.17 Wed, 25 Mar 1998 06:58:54 -0700 dickey @ */ #include <HTUtils.h> #include <HTML.h> +#include <tcp.h> #include <LYSignal.h> #include <LYGlobalDefs.h> @@ -49,6 +50,9 @@ PUBLIC int s_alink = NOSTYLE, s_a = NOSTYLE, s_status = NOSTYLE, PRIVATE int colorPairs = 0; PRIVATE int last_fA = COLOR_WHITE, last_bA = COLOR_BLACK; + +#define FREE(x) if (x) {free(x); x = NULL;} + /* icky parsing of the style options */ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char*,element) { @@ -56,7 +60,8 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char* int mA = 0, fA = default_fg, bA = default_bg, cA = A_NORMAL; int newstyle = hash_code(element); - CTRACE(tfp, "CSS(PA):style d=%d / h=%d, e=%s\n", style, newstyle,element); + if (TRACE) + fprintf(stderr, "CSS(PA):style d=%d / h=%d, e=%s\n", style, newstyle,element); for (i = 0; i <7; i++) { @@ -65,7 +70,8 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char* mA = ncursesMono[i]; } } - CTRACE(tfp, "CSS(CP):%d\n", colorPairs); + if (TRACE) + fprintf(stderr, "CSS(CP):%d\n", colorPairs); fA = check_color(fg, default_fg); bA = check_color(bg, default_bg); @@ -171,9 +177,13 @@ where OBJECT is one of EM,STRONG,B,I,U,BLINK etc.\n\n", buffer); } } - CTRACE(tfp, "CSSPARSE:%s => %d %s\n", - element, hash_code(element), - (hashStyles[hash_code(element)].name ? "used" : "")); + if (TRACE) + { + int bkt = hash_code(element); + fprintf(stderr, "CSSPARSE:%s => %d %s\n", + element, bkt, + (hashStyles[bkt].name ? "used" : "")); + } strtolower(element); @@ -225,7 +235,8 @@ where OBJECT is one of EM,STRONG,B,I,U,BLINK etc.\n\n", buffer); { if (!strcasecomp (HTML_dtd.tags[i].name, element)) { - CTRACE(tfp, "PARSECSS:applying style <%s,%s,%s> for HTML_%s\n",mono,fg,bg,HTML_dtd.tags[i].name); + if (TRACE) + fprintf(stderr, "PARSECSS:applying style <%s,%s,%s> for HTML_%s\n",mono,fg,bg,HTML_dtd.tags[i].name); parse_attributes(mono,fg,bg,i+STARTAT,element); break; } @@ -307,7 +318,8 @@ PUBLIC void parse_userstyles NOARGS while ((name = HTList_nextObject(cur)) != NULL) { - CTRACE(tfp, "LSS:%s\n", name ? name : "!?! empty !?!"); + if (TRACE) + fprintf(stderr, "LSS:%s\n", name ? name : "!?! empty !?!"); if (name != NULL) parse_style(name); } @@ -322,7 +334,8 @@ PUBLIC void HStyle_addStyle ARGS1(char*,buffer) if (lss_styles == NULL) lss_styles = HTList_new(); strtolower(name); - CTRACE(tfp, "READCSS:%s\n", name ? name : "!?! empty !?!"); + if (TRACE) + fprintf(stderr, "READCSS:%s\n", name ? name : "!?! empty !?!"); HTList_addObject (lss_styles, name); } @@ -353,14 +366,16 @@ PUBLIC int style_readFromFile ARGS1(char*, file) char buffer[1024]; int len; - CTRACE(tfp, "CSS:Reading styles from file: %s\n", file ? file : "?!? empty ?!?"); + if (TRACE) + fprintf(stderr, "CSS:Reading styles from file: %s\n", file ? file : "?!? empty ?!?"); if (file == NULL || *file == '\0') return -1; fh = fopen(file, "r"); if (!fh) { /* this should probably be an alert or something */ - CTRACE(tfp, "CSS:Can't open style file %s, using defaults\n", file); + if (TRACE) + fprintf(stderr, "CSS:Can't open style file %s, using defaults\n", file); return -1; } diff --git a/src/LYSystem.h b/src/LYSystem.h new file mode 100644 index 00000000..6acd02b3 --- /dev/null +++ b/src/LYSystem.h @@ -0,0 +1,10 @@ + +#ifndef LYSYSTEM_H +#define LYSYSTEM_H + +#ifdef VMS +extern int DCLsystem PARAMS((char *command)); +#define system(a) DCLsystem(a) /* use LYCurses.c routines for spawns */ +#endif /* VMS */ + +#endif /* LYSYSTEM_H */ diff --git a/src/LYTraversal.c b/src/LYTraversal.c index d92b7dcd..c8e0df47 100644 --- a/src/LYTraversal.c +++ b/src/LYTraversal.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <LYGlobalDefs.h> #include <LYUtils.h> #include <LYSignal.h> diff --git a/src/LYUpload.c b/src/LYUpload.c index c9488e22..0ad784f5 100644 --- a/src/LYUpload.c +++ b/src/LYUpload.c @@ -15,7 +15,7 @@ */ #include <HTUtils.h> -#include <HTFile.h> +#include <tcp.h> #include <HTParse.h> #include <HTAlert.h> #include <LYCurses.h> @@ -26,49 +26,52 @@ #include <LYClean.h> #include <LYGetFile.h> #include <LYUpload.h> +#include <LYSystem.h> #include <LYLocal.h> #include <LYexit.h> #include <LYLeaks.h> -PUBLIC char LYUploadFileURL[LY_MAXPATH] = "\0"; +#define FREE(x) if (x) {free(x); x = NULL;} + +PUBLIC char LYUploadFileURL[256] = "\0"; /* - * LYUpload uploads a file to a given location using a + * LYUpload uploads a file to a given location using a * specified upload method. It parses an incoming link * that looks like: * LYNXDIRED://UPLOAD=<#>/TO=<STRING> */ PUBLIC int LYUpload ARGS1( - char *, line) + char *, line) { char *method, *directory, *dir; int method_number; int count; - char tmpbuf[LY_MAXPATH]; - char buffer[LY_MAXPATH]; + char tmpbuf[256]; + char buffer[256]; lynx_html_item_type *upload_command = 0; int c; char *cp; FILE *fp; - char cmd[20 + (LY_MAXPATH*2)]; + char cmd[512]; #ifdef VMS extern BOOLEAN HadVMSInterrupt; #endif /* VMS */ /* - * Use configured upload commands. + * Use configured upload commands. */ if((directory = (char *)strstr(line, "TO=")) == NULL) goto failed; *(directory - 1) = '\0'; /* go past "Directory=" */ - directory += 3; + directory+=3; if((method = (char *)strstr(line, "UPLOAD=")) == NULL) goto failed; /* - * Go past "Method=". + * Go past "Method=". */ method += 7; method_number = atoi(method); @@ -78,22 +81,23 @@ PUBLIC int LYUpload ARGS1( ; /* null body */ /* - * Parsed out the Method and the Location? + * Parsed out the Method and the Location? */ if (upload_command->command == NULL) { - HTAlert("ERROR! - upload command is misconfigured"); + _statusline("ERROR! - upload command is misconfigured"); + sleep(AlertSecs); goto failed; } /* - * Care about the local name? + * Care about the local name? */ if (strstr(upload_command->command, "%s")) { /* * Commands have the form "command %s [etc]" * where %s is the filename. */ - _statusline(FILENAME_PROMPT); + _statusline("Enter a filename: "); retry: *tmpbuf = '\0'; if (LYgetstr(tmpbuf, VISIBLE, sizeof(tmpbuf), NORECALL) < 0) @@ -103,21 +107,31 @@ retry: goto cancelled; if (strstr(tmpbuf, "../") != NULL) { - HTAlert("Illegal redirection \"../\" found! Request ignored."); + _statusline( + "Illegal redirection \"../\" found! Request ignored."); + sleep(AlertSecs); goto cancelled; } else if (strchr(tmpbuf, '/') != NULL) { - HTAlert("Illegal character \"/\" found! Request ignored."); + _statusline("Illegal character \"/\" found! Request ignored."); + sleep(AlertSecs); goto cancelled; } else if (tmpbuf[0] == '~') { - HTAlert("Illegal redirection using \"~\" found! Request ignored."); + _statusline( + "Illegal redirection using \"~\" found! Request ignored."); + sleep(AlertSecs); goto cancelled; } sprintf(buffer, "%s/%s", directory, tmpbuf); if (no_dotfiles || !show_dotfiles) { - if (*LYPathLeaf(buffer) == '.') { - HTAlert(FILENAME_CANNOT_BE_DOT); - _statusline(NEW_FILENAME_PROMPT); + if (*buffer == '.' || +#ifdef VMS + ((cp = strrchr(buffer, ':')) && *(cp+1) == '.') || + ((cp = strrchr(buffer, ']')) && *(cp+1) == '.') || +#endif /* VMS */ + ((cp = strrchr(buffer, '/')) && *(cp+1) == '.')) { + _statusline( + "File name may not begin with dot. Enter a new filename: "); goto retry; } } @@ -129,9 +143,9 @@ retry: fclose(fp); #ifdef VMS - _statusline(FILE_EXISTS_HPROMPT); + _statusline("File exists. Create higher version? (y/n)"); #else - _statusline(FILE_EXISTS_OPROMPT); + _statusline("File exists. Overwrite? (y/n)"); #endif /* VMS */ c = 0; while (TOUPPER(c) != 'Y' && TOUPPER(c) != 'N' && c != 7 && c != 3) @@ -148,7 +162,7 @@ retry: } if (TOUPPER(c) == 'N') { - _statusline(NEW_FILENAME_PROMPT); + _statusline("Enter a filename: "); goto retry; } } @@ -156,18 +170,15 @@ retry: /* * See if we can write to it. */ - CTRACE(tfp, "LYUpload: filename is %s", buffer); - if ((fp = fopen(buffer, "w")) != NULL) { fclose(fp); remove(buffer); } else { - HTAlert(CANNOT_WRITE_TO_FILE); - _statusline(NEW_FILENAME_PROMPT); + _statusline("Cannot write to file. Enter a new filename: "); goto retry; } -#if defined (VMS) || defined (__EMX__) || defined(__DJGPP__) +#ifdef VMS sprintf(tmpbuf, upload_command->command, buffer, "", "", "", "", ""); #else cp = quote_pathname(buffer); /* to prevent spoofing of the shell */ @@ -182,22 +193,26 @@ retry: sprintf(cmd, "cd %s ; %s", dir, tmpbuf); FREE(dir); stop_curses(); - CTRACE(tfp, "command: %s\n", cmd); - LYSystem(cmd); + if (TRACE) + fprintf(stderr, "command: %s\n", cmd); + system(cmd); + fflush(stdout); start_curses(); -#ifdef UNIX +#ifdef UNIX chmod(buffer, HIDE_CHMOD); -#endif /* UNIX */ +#endif /* UNIX */ /* don't remove(file); */ return 1; failed: - HTAlert("Unable to upload file."); + _statusline("Unable to upload file."); + sleep(AlertSecs); return 0; cancelled: - HTInfoMsg("Cancelling."); + _statusline("Cancelling."); + sleep(InfoSecs); return 0; } @@ -209,17 +224,33 @@ cancelled: */ PUBLIC int LYUpload_options ARGS2( char **, newfile, - char *, directory) + char *, directory) { - static char tempfile[LY_MAXPATH]; + static char tempfile[256]; + static BOOLEAN first = TRUE; FILE *fp0; lynx_html_item_type *cur_upload; int count; - static char curloc[LY_MAXPATH]; + static char curloc[256]; char *cp; - LYRemoveTemp(tempfile); - if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) { + if (first) { + /* + * Get an unused tempfile name. - FM + */ + tempname(tempfile, NEW_FILE); +#ifdef VMS + } else { + remove(tempfile); /* Remove duplicates on VMS. */ +#endif /* VMS */ + } + + /* + * Open the tempfile for writing and set it's + * protection in case this wasn't done via an + * external umask. - FM + */ + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(-1); } @@ -227,38 +258,57 @@ PUBLIC int LYUpload_options ARGS2( #ifdef VMS strcpy(curloc, "/sys$login"); #else - cp = HTfullURL_toFile(directory); + cp = directory; + if (!strncmp(cp, "file://localhost", 16)) + cp += 16; + else if (!strncmp(cp, "file:", 5)) + cp += 5; strcpy(curloc,cp); - LYTrimPathSep(curloc); - free(cp); + HTUnEscape(curloc); + if (curloc[strlen(curloc) - 1] == '/') + curloc[strlen(curloc) - 1] = '\0'; +#endif /* VMS */ + + if (first) { + /* + * Make the tempfile a URL. + */ +#if defined (VMS) || defined (DOSPATH) + sprintf(LYUploadFileURL, "file://localhost/%s", tempfile); +#else + sprintf(LYUploadFileURL, "file://localhost%s", tempfile); #endif /* VMS */ + first = FALSE; + } + StrAllocCopy(*newfile, LYUploadFileURL); - LYLocalFileToURL(newfile, tempfile); - strcpy(LYUploadFileURL, *newfile); + fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n", + UPLOAD_OPTIONS_TITLE); - BeginInternalPage(fp0, UPLOAD_OPTIONS_TITLE, UPLOAD_OPTIONS_HELP); + fprintf(fp0, "<h1>Upload Options (%s Version %s)</h1>\n", + LYNX_NAME, LYNX_VERSION); - fprintf(fp0, "<pre>\n"); - fprintf(fp0, " <em>Upload To:</em> %s\n", curloc); - fputs("\nUpload options:\n", fp0); + fputs("You have the following upload choices.<br>\n", fp0); + fputs("Please select one:<br>\n<pre>\n", fp0); if (uploaders != NULL) { for (count = 0, cur_upload = uploaders; - cur_upload != NULL; + cur_upload != NULL; cur_upload = cur_upload->next, count++) { fprintf(fp0, " <a href=\"LYNXDIRED://UPLOAD=%d/TO=%s\">", count, curloc); - fprintf(fp0, (cur_upload->name ? + fprintf(fp0, (cur_upload->name ? cur_upload->name : "No Name Given")); fprintf(fp0, "</a>\n"); } } else { - fprintf(fp0, " <NONE>\n"); - } + fprintf(fp0, "\n \ +No other upload methods have been defined yet. You may define\n \ +an unlimited number of upload methods using the lynx.cfg file.\n"); - fprintf(fp0, "</pre>\n"); - EndInternalPage(fp0); - LYCloseTempFP(fp0); + } + fprintf(fp0, "</pre>\n</body>\n"); + fclose(fp0); LYforce_no_cache = TRUE; diff --git a/src/LYUpload.h b/src/LYUpload.h index 563c063e..17542b06 100644 --- a/src/LYUpload.h +++ b/src/LYUpload.h @@ -9,5 +9,7 @@ extern int LYUpload PARAMS((char *line)); extern int LYUpload_options PARAMS((char **newfile, char *directory)); +#define UPLOAD_OPTIONS_TITLE "Lynx Upload Options" + #endif /* LYUPLOAD_H */ diff --git a/src/LYUtils.c b/src/LYUtils.c index 5e82ca6d..842b8f0c 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1,31 +1,26 @@ #include <HTUtils.h> -#include <HTTCP.h> +#include <tcp.h> +#include <ctype.h> #include <HTParse.h> #include <HTAccess.h> #include <HTCJK.h> #include <HTAlert.h> #include <LYCurses.h> -#include <LYHistory.h> #include <LYUtils.h> #include <LYStrings.h> #include <LYGlobalDefs.h> #include <LYSignal.h> #include <GridText.h> #include <LYCharSets.h> -#include <LYCharUtils.h> - -#ifdef DJGPP_KEYHANDLER -#include <bios.h> -#endif /* DJGPP_KEYHANDLER */ - -#ifdef DISP_PARTIAL -#include <LYKeymap.h> -#endif /* DISP_PARTIAL */ +#ifdef DOSPATH +#include <HTDOS.h> +#endif #ifdef VMS #include <descrip.h> #include <libclidef.h> #include <lib$routines.h> +#include <HTVMSUtils.h> #endif /* VMS */ #if HAVE_UTMP @@ -58,6 +53,8 @@ #include <LYStyle.h> #endif +#undef hline /* FIXME: this is a curses feature used as a variable here */ + #ifdef SVR4_BSDSELECT extern int BSDselect PARAMS((int nfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds, struct timeval * timeout)); @@ -85,6 +82,8 @@ extern int BSDselect PARAMS((int nfds, fd_set * readfds, fd_set * writefds, #endif /* __FreeBSD__ || __bsdi__ */ #endif /* !UTMP_FILE */ +#define FREE(x) if (x) {free(x); x = NULL;} + extern HTkcode kanji_code; extern BOOLEAN LYHaveCJKCharacterSet; extern HTCJKlang HTCJK; @@ -1714,6 +1713,26 @@ PUBLIC void free_and_clear ARGS1( } /* + * Collapse (REMOVE) all spaces in the string. + */ +PUBLIC void collapse_spaces ARGS1( + char *, string) +{ + int i=0; + int j=0; + + if (!string) + return; + + for (; string[i] != '\0'; i++) + if (!isspace((unsigned char)string[i])) + string[j++] = string[i]; + + string[j] = '\0'; /* terminate */ + return; +} + +/* * Convert single or serial newlines to single spaces throughout a string * (ignore newlines if the preceding character is a space) and convert * tabs to single spaces. Don't ignore any explicit tabs or spaces if @@ -1819,9 +1838,9 @@ PUBLIC void statusline ARGS1( if ((temp = (unsigned char *)calloc(1, strlen(text) + 1)) == NULL) outofmem(__FILE__, "statusline"); if (kanji_code == EUC) { - TO_EUC((CONST unsigned char *)text, temp); + TO_EUC((unsigned char *)text, temp); } else if (kanji_code == SJIS) { - TO_SJIS((CONST unsigned char *)text, temp); + TO_SJIS((unsigned char *)text, temp); } else { for (i = 0, j = 0; text[i]; i++) { if (text[i] != '\033') { @@ -1974,7 +1993,7 @@ PUBLIC void noviceline ARGS1( if (LYUseNoviceLineTwo) addstr(NOVICE_LINE_TWO); else - addstr((char *)novice_lines[lineno]); + addstr(novice_lines[lineno]); #ifdef NOTDEFINED if (is_www_index && more_flag) { @@ -2013,15 +2032,19 @@ PUBLIC void LYFakeZap ARGS1( BOOL, set) { if (set && fake_zap < 1) { - CTRACE(tfp, "\r *** Set simulated 'Z'"); - if (fake_zap) - CTRACE(tfp, ", %d pending", fake_zap); - CTRACE(tfp, " ***\n"); + if (TRACE) { + fprintf(stderr, "\r *** Set simulated 'Z'"); + if (fake_zap) + fprintf(stderr, ", %d pending", fake_zap); + fprintf(stderr, " ***\n"); + } fake_zap++; } else if (!set && fake_zap) { - CTRACE(tfp, "\r *** Unset simulated 'Z'"); - CTRACE(tfp, ", %d pending", fake_zap); - CTRACE(tfp, " ***\n"); + if (TRACE) { + fprintf(stderr, "\r *** Unset simulated 'Z'"); + fprintf(stderr, ", %d pending", fake_zap); + fprintf(stderr, " ***\n"); + } fake_zap = 0; } @@ -2029,8 +2052,8 @@ PUBLIC void LYFakeZap ARGS1( PUBLIC int HTCheckForInterrupt NOARGS { - int c; #ifndef VMS /* UNIX stuff: */ + int c; #ifndef USE_SLANG struct timeval socket_timeout; int ret = 0; @@ -2039,9 +2062,12 @@ PUBLIC int HTCheckForInterrupt NOARGS if (fake_zap > 0) { fake_zap--; - CTRACE(tfp, "\r *** Got simulated 'Z' ***\n"); - CTRACE_FLUSH(tfp); - CTRACE_SLEEP(AlertSecs); + if (TRACE) { + fprintf(stderr, "\r *** Got simulated 'Z' ***\n"); + fflush(stderr); + if (!LYTraceLogFP) + sleep(AlertSecs); + } return((int)TRUE); } @@ -2054,11 +2080,7 @@ PUBLIC int HTCheckForInterrupt NOARGS Note that this isn't taking possible SOCKSification and the socks_flag into account, and may fail on the slang library's select() when SOCKSified. - FM **/ -#ifdef DJGPP_KEYHANDLER - if (0 == _bios_keybrd(_NKEYBRD_READY)) -#else if (0 == SLang_input_pending(0)) -#endif /* DJGPP_KEYHANDLER */ return(FALSE); #else /* Unix curses: */ @@ -2093,16 +2115,26 @@ PUBLIC int HTCheckForInterrupt NOARGS #if defined (DOSPATH) && defined (NCURSES) nodelay(stdscr,FALSE); #endif /* DOSPATH */ + if (TOUPPER(c) == 'Z' || c == 7 || c == 3) + return((int)TRUE); + + /** Other keystrokes **/ + return((int)FALSE); #else /* VMS: */ + + int c; extern BOOLEAN HadVMSInterrupt; extern int typeahead(); if (fake_zap > 0) { fake_zap--; - CTRACE(tfp, "\r *** Got simulated 'Z' ***\n"); - CTRACE_FLUSH(tfp); - CTRACE_SLEEP(AlertSecs); + if (TRACE) { + fprintf(stderr, "\r *** Got simulated 'Z' ***\n"); + fflush(stderr); + if (!LYTraceLogFP) + sleep(AlertSecs); + } return((int)TRUE); } @@ -2118,66 +2150,12 @@ PUBLIC int HTCheckForInterrupt NOARGS /** Keyboard 'Z' or 'z', or Control-G or Control-C **/ c = typeahead(); - -#endif /* !VMS */ - - /* - * 'c' contains whatever character we're able to read from type-ahead - */ if (TOUPPER(c) == 'Z' || c == 7 || c == 3) return((int)TRUE); -#ifdef DISP_PARTIAL - else if (display_partial && (NumOfLines_partial > 2)) - /* OK, we got several lines from new document and want to scroll... */ - { - switch (keymap[c+1]) - { - case LYK_PREV_PAGE : - if (Newline_partial > 1) - Newline_partial -= display_lines ; - break ; - case LYK_NEXT_PAGE : - if (HText_canScrollDown()) - Newline_partial += display_lines ; - break ; - case LYK_UP_HALF : - if (Newline_partial > 1) - Newline_partial -= (display_lines/2) ; - break ; - case LYK_DOWN_HALF : - if (HText_canScrollDown()) - Newline_partial += (display_lines/2) ; - break ; - case LYK_UP_TWO : - if (Newline_partial > 1) - Newline_partial -= 2 ; - break ; - case LYK_DOWN_TWO : - if (HText_canScrollDown()) - Newline_partial += 2 ; - break ; - case LYK_HOME: - if (Newline_partial > 1) - Newline_partial = 1; - break; - case LYK_END: - if (HText_canScrollDown()) - Newline_partial = HText_getNumOfLines() - display_lines + 1; - /* calculate for "current" bottom value */ - break; - case LYK_REFRESH : - break ; - default : - return ((int)FALSE) ; - } - if (Newline_partial < 1) - Newline_partial = 1; - NumOfLines_partial = HText_getNumOfLines(); - HText_pageDisplay(Newline_partial, ""); - } -#endif /* DISP_PARTIAL */ + /** Other or no keystrokes **/ return((int)FALSE); +#endif /* !VMS */ } /* @@ -2248,13 +2226,12 @@ PUBLIC BOOLEAN LYisLocalHost ARGS1( #ifdef VMS if ((0==strcasecomp(host, "localhost") || 0==strcasecomp(host, LYHostName) || - 0==strcasecomp(host, HTHostName()))) + 0==strcasecomp(host, HTHostName()))) { #else if ((0==strcmp(host, "localhost") || 0==strcmp(host, LYHostName) || - 0==strcmp(host, HTHostName()))) + 0==strcmp(host, HTHostName()))) { #endif /* VMS */ - { FREE(host); return YES; } @@ -2332,11 +2309,10 @@ PUBLIC BOOLEAN LYisLocalAlias ARGS1( while (NULL != (alias = (char *)HTList_nextObject(cur))) { #ifdef VMS - if (0==strcasecomp(host, alias)) + if (0==strcasecomp(host, alias)) { #else - if (0==strcmp(host, alias)) + if (0==strcmp(host, alias)) { #endif /* VMS */ - { FREE(host); return YES; } @@ -2371,7 +2347,8 @@ PUBLIC int LYCheckForProxyURL ARGS1( return(0); /* kill beginning spaces */ - cp = LYSkipBlanks(cp); + while (isspace((unsigned char)*cp)) + cp++; /* * Check for a colon, and if present, @@ -2391,7 +2368,7 @@ PUBLIC int LYCheckForProxyURL ARGS1( if (isdigit((unsigned char)*cp1)) { while (*cp1 && isdigit((unsigned char)*cp1)) cp1++; - if (*cp1 && !LYIsHtmlSep(*cp1)) + if (*cp1 && *cp1 != '/') return(UNKNOWN_URL_TYPE); } } @@ -2400,29 +2377,9 @@ PUBLIC int LYCheckForProxyURL ARGS1( } /* - * Compare a "type:" string, replacing it by the comparison-string if it - * matches (and return true in that case). - */ -static BOOLEAN compare_type ARGS3( - char *, tst, - CONST char *, cmp, - size_t, len) -{ - if (!strncasecomp(tst, cmp, len)) { - if (strncmp(tst, cmp, len)) { - size_t i; - for (i = 0; i < len; i++) - tst[i] = cmp[i]; - } - return TRUE; - } - return FALSE; -} - -/* ** Must recognize a URL and return the type. ** If recognized, based on a case-insensitive -** analysis of the scheme field, ensures that +** analyis of the scheme field, ensures that ** the scheme field has the expected case. ** ** Returns 0 (not a URL) for a NULL argument, @@ -2436,6 +2393,7 @@ PUBLIC int is_url ARGS1( { char *cp = filename; char *cp1; + int i; /* * Don't crash on an empty argument. @@ -2452,7 +2410,8 @@ PUBLIC int is_url ARGS1( /* * Kill beginning spaces. */ - cp = LYSkipBlanks(cp); + while (isspace((unsigned char)*cp)) + cp++; /* * Can't be a URL if it starts with a slash. @@ -2460,132 +2419,206 @@ PUBLIC int is_url ARGS1( * also to avoid false positives if there was * a colon later in the string. - KW */ - if (LYIsHtmlSep(*cp)) + if (*cp == '/') return(0); -#if defined (DOSPATH) || defined (__EMX__) /* sorry! */ - if (strncmp(cp, "file:///", 8) && strlen(cp) == 19 && - cp[strlen(cp)-1] == ':') - StrAllocCat(cp,"/"); +#ifdef DOSPATH /* sorry! */ + if (strncmp(cp, "file:///", 8) && strlen(cp) == 19 && + cp[strlen(cp)-1] == ':') + StrAllocCat(cp,"/"); #endif - if (compare_type(cp, "news:", 5)) { + if (!strncasecomp(cp, "news:", 5)) { + if (strncmp(cp, "news", 4)) { + for (i = 0; i < 4; i++) + cp[i] = TOLOWER(cp[i]); + } return(NEWS_URL_TYPE); - } else if (compare_type(cp, "nntp:", 5)) { + } else if (!strncasecomp(cp, "nntp:", 5)) { + if (strncmp(cp, "nntp", 4)) { + for (i = 0; i < 4; i++) + cp[i] = TOLOWER(cp[i]); + } return(NNTP_URL_TYPE); - } else if (compare_type(cp, "snews:", 6)) { + } else if (!strncasecomp(cp, "snews:", 6)) { + if (strncmp(cp, "snews", 5)) { + for (i = 0; i < 5; i++) + cp[i] = TOLOWER(cp[i]); + } return(SNEWS_URL_TYPE); - } else if (compare_type(cp, "newspost:", 9)) { + } else if (!strncasecomp(cp, "newspost:", 9)) { /* * Special Lynx type to handle news posts. */ + if (strncmp(cp, "newspost", 8)) { + for (i = 0; i < 8; i++) + cp[i] = TOLOWER(cp[i]); + } return(NEWSPOST_URL_TYPE); - } else if (compare_type(cp, "newsreply:", 10)) { + } else if (!strncasecomp(cp, "newsreply:", 10)) { /* * Special Lynx type to handle news replies (followups). */ + if (strncmp(cp, "newsreply", 9)) { + for (i = 0; i < 9; i++) + cp[i] = TOLOWER(cp[i]); + } return(NEWSREPLY_URL_TYPE); - } else if (compare_type(cp, "snewspost:", 10)) { + } else if (!strncasecomp(cp, "snewspost:", 10)) { /* * Special Lynx type to handle snews posts. */ + if (strncmp(cp, "snewspost", 9)) { + for (i = 0; i < 9; i++) + cp[i] = TOLOWER(cp[i]); + } return(NEWSPOST_URL_TYPE); - } else if (compare_type(cp, "snewsreply:", 11)) { + } else if (!strncasecomp(cp, "snewsreply:", 11)) { /* * Special Lynx type to handle snews replies (followups). */ + if (strncmp(cp, "snewsreply", 10)) { + for (i = 0; i < 10; i++) + cp[i] = TOLOWER(cp[i]); + } return(NEWSREPLY_URL_TYPE); - } else if (compare_type(cp, "mailto:", 7)) { + } else if (!strncasecomp(cp, "mailto:", 7)) { + if (strncmp(cp, "mailto", 6)) { + for (i = 0; i < 6; i++) + cp[i] = TOLOWER(cp[i]); + } return(MAILTO_URL_TYPE); - } else if (compare_type(cp, "file:", 5)) { + } else if (!strncasecomp(cp, "file:", 5)) { + if (strncmp(cp, "file", 4)) { + for (i = 0; i < 4; i++) + cp[i] = TOLOWER(cp[i]); + } if (LYisLocalFile(cp)) { return(FILE_URL_TYPE); - } else if (LYIsHtmlSep(cp[5]) && LYIsHtmlSep(cp[6])) { + } else if (cp[5] == '/' && cp[6] == '/') { return(FTP_URL_TYPE); } else { return(0); } - } else if (compare_type(cp, "data:", 5)) { + } else if (!strncasecomp(cp, "data:", 5)) { + if (strncmp(cp, "data", 4)) { + for (i = 0; i < 4; i++) + cp[i] = TOLOWER(cp[i]); + } return(DATA_URL_TYPE); - } else if (compare_type(cp, "lynxexec:", 9)) { + } else if (!strncasecomp(cp, "lynxexec:", 9)) { /* * Special External Lynx type to handle execution * of commands or scripts which require a pause to * read the screen upon completion. */ + if (strncmp(cp, "lynxexec", 8)) { + for (i = 0; i < 8; i++) + cp[i] = TOLOWER(cp[i]); + } return(LYNXEXEC_URL_TYPE); - } else if (compare_type(cp, "lynxprog:", 9)) { + } else if (!strncasecomp(cp, "lynxprog:", 9)) { /* * Special External Lynx type to handle execution - * of commands, scripts or programs with do not + * of commans, sriptis or programs with do not * require a pause to read screen upon completion. */ + if (strncmp(cp, "lynxprog", 8)) { + for (i = 0; i < 8; i++) + cp[i] = TOLOWER(cp[i]); + } return(LYNXPROG_URL_TYPE); - } else if (compare_type(cp, "lynxcgi:", 8)) { + } else if (!strncasecomp(cp, "lynxcgi:", 8)) { /* * Special External Lynx type to handle cgi scripts. */ + if (strncmp(cp, "lynxcgi", 7)) { + for (i = 0; i < 7; i++) + cp[i] = TOLOWER(cp[i]); + } return(LYNXCGI_URL_TYPE); - } else if (compare_type(cp, "LYNXPRINT:", 10)) { + } else if (!strncasecomp(cp, "LYNXPRINT:", 10)) { /* * Special Internal Lynx type. */ + if (strncmp(cp, "LYNXPRINT", 9)) { + for (i = 0; i < 9; i++) + cp[i] = TOUPPER(cp[i]); + } return(LYNXPRINT_URL_TYPE); - } else if (compare_type(cp, "LYNXOPTIONS:", 12)) { - /* - * Special Internal Lynx type. - */ - return(LYNXOPTIONS_URL_TYPE); - - } else if (compare_type(cp, "LYNXDOWNLOAD:", 13)) { + } else if (!strncasecomp(cp, "LYNXDOWNLOAD:", 13)) { /* * Special Internal Lynx type. */ + if (strncmp(cp, "LYDOWNLOAD", 12)) { + for (i = 0; i < 12; i++) + cp[i] = TOUPPER(cp[i]); + } return(LYNXDOWNLOAD_URL_TYPE); - } else if (compare_type(cp, "LYNXDIRED:", 10)) { + } else if (!strncasecomp(cp, "LYNXDIRED:", 10)) { /* * Special Internal Lynx type. */ + if (strncmp(cp, "LYNXDIRED", 9)) { + for (i = 0; i < 9; i++) + cp[i] = TOUPPER(cp[i]); + } return(LYNXDIRED_URL_TYPE); - } else if (compare_type(cp, "LYNXHIST:", 9)) { + } else if (!strncasecomp(cp, "LYNXHIST:", 9)) { /* * Special Internal Lynx type. */ + if (strncmp(cp, "LYNXHIST", 8)) { + for (i = 0; i < 8; i++) + cp[i] = TOUPPER(cp[i]); + } return(LYNXHIST_URL_TYPE); - } else if (compare_type(cp, "LYNXKEYMAP:", 11)) { + } else if (!strncasecomp(cp, "LYNXKEYMAP:", 11)) { /* * Special Internal Lynx type. */ + if (strncmp(cp, "LYNXKEYMAP", 10)) { + for (i = 0; i < 10; i++) + cp[i] = TOUPPER(cp[i]); + } return(LYNXKEYMAP_URL_TYPE); - } else if (compare_type(cp, "LYNXIMGMAP:", 11)) { + } else if (!strncasecomp(cp, "LYNXIMGMAP:", 11)) { /* * Special Internal Lynx type. */ + if (strncmp(cp, "LYNXIMGMAP", 10)) { + for (i = 0; i < 10; i++) + cp[i] = TOUPPER(cp[i]); + } (void)is_url(&cp[11]); return(LYNXIMGMAP_URL_TYPE); - } else if (compare_type(cp, "LYNXCOOKIE:", 11)) { + } else if (!strncasecomp(cp, "LYNXCOOKIE:", 11)) { /* * Special Internal Lynx type. */ + if (strncmp(cp, "LYNXCOOKIE", 10)) { + for (i = 0; i < 10; i++) + cp[i] = TOUPPER(cp[i]); + } return(LYNXCOOKIE_URL_TYPE); } else if (strstr((cp+3), "://") == NULL) { @@ -2597,13 +2630,25 @@ PUBLIC int is_url ARGS1( */ return(LYCheckForProxyURL(filename)); - } else if (compare_type(cp, "http:", 5)) { + } else if (!strncasecomp(cp, "http:", 5)) { + if (strncmp(cp, "http", 4)) { + for (i = 0; i < 4; i++) + cp[i] = TOLOWER(cp[i]); + } return(HTTP_URL_TYPE); - } else if (compare_type(cp, "https:", 6)) { + } else if (!strncasecomp(cp, "https:", 6)) { + if (strncmp(cp, "https", 5)) { + for (i = 0; i < 5; i++) + cp[i] = TOLOWER(cp[i]); + } return(HTTPS_URL_TYPE); - } else if (compare_type(cp, "gopher:", 7)) { + } else if (!strncasecomp(cp, "gopher:", 7)) { + if (strncmp(cp, "gopher", 6)) { + for (i = 0; i < 6; i++) + cp[i] = TOLOWER(cp[i]); + } if ((cp1 = strchr(cp+11,'/')) != NULL) { if (TOUPPER(*(cp1+1)) == 'H' || *(cp1+1) == 'w') @@ -2619,31 +2664,67 @@ PUBLIC int is_url ARGS1( return(GOPHER_URL_TYPE); } - } else if (compare_type(cp, "ftp:", 4)) { + } else if (!strncasecomp(cp, "ftp:", 4)) { + if (strncmp(cp, "ftp", 3)) { + for (i = 0; i < 3; i++) + cp[i] = TOLOWER(cp[i]); + } return(FTP_URL_TYPE); - } else if (compare_type(cp, "wais:", 5)) { + } else if (!strncasecomp(cp, "wais:", 5)) { + if (strncmp(cp, "wais", 4)) { + for (i = 0; i < 4; i++) + cp[i] = TOLOWER(cp[i]); + } return(WAIS_URL_TYPE); - } else if (compare_type(cp, "telnet:", 7)) { + } else if (!strncasecomp(cp, "telnet:", 7)) { + if (strncmp(cp, "telnet", 6)) { + for (i = 0; i < 6; i++) + cp[i] = TOLOWER(cp[i]); + } return(TELNET_URL_TYPE); - } else if (compare_type(cp, "tn3270:", 7)) { + } else if (!strncasecomp(cp, "tn3270:", 7)) { + if (strncmp(cp, "tn", 2)) { + for (i = 0; i < 2; i++) + cp[i] = TOLOWER(cp[i]); + } return(TN3270_URL_TYPE); - } else if (compare_type(cp, "rlogin:", 7)) { + } else if (!strncasecomp(cp, "rlogin:", 7)) { + if (strncmp(cp, "rlogin", 6)) { + for (i = 0; i < 6; i++) + cp[i] = TOLOWER(cp[i]); + } return(RLOGIN_URL_TYPE); - } else if (compare_type(cp, "cso:", 4)) { + } else if (!strncasecomp(cp, "cso:", 4)) { + if (strncmp(cp, "cso", 3)) { + for (i = 0; i < 3; i++) + cp[i] = TOLOWER(cp[i]); + } return(CSO_URL_TYPE); - } else if (compare_type(cp, "finger:", 7)) { + } else if (!strncasecomp(cp, "finger:", 7)) { + if (strncmp(cp, "finger", 6)) { + for (i = 0; i < 6; i++) + cp[i] = TOLOWER(cp[i]); + } return(FINGER_URL_TYPE); - } else if (compare_type(cp, "afs:", 4)) { + } else if (!strncasecomp(cp, "afs:", 4)) { + if (strncmp(cp, "afs", 3)) { + for (i = 0; i < 3; i++) + cp[i] = TOLOWER(cp[i]); + } return(AFS_URL_TYPE); - } else if (compare_type(cp, "prospero:", 9)) { + } else if (!strncasecomp(cp, "prospero:", 9)) { + if (strncmp(cp, "prospero", 8)) { + for (i = 0; i < 8; i++) + cp[i] = TOLOWER(cp[i]); + } return(PROSPERO_URL_TYPE); } else { @@ -2729,7 +2810,6 @@ PUBLIC void remove_backslashes ARGS1( */ PUBLIC char * quote_pathname ARGS1( char *, pathname) -#ifndef __DJGPP__ { size_t i, n = 0; char * result; @@ -2741,9 +2821,8 @@ PUBLIC char * quote_pathname ARGS1( if (result == NULL) outofmem(__FILE__, "quote_pathname"); - n = 0; - result[n++] = '\''; - for (i = 0; i < strlen(pathname); i++) { + result[0] = '\''; + for (i = 0, n = 1; i < strlen(pathname); i++) if (pathname[i] == '\'') { result[n++] = '\''; result[n++] = '"'; @@ -2753,16 +2832,10 @@ PUBLIC char * quote_pathname ARGS1( } else { result[n++] = pathname[i]; } - } result[n++] = '\''; result[n] = '\0'; return result; } -#else -{ - return pathname; -} -#endif /* !__DJGPP__ */ #if HAVE_UTMP extern char *ttyname PARAMS((int fd)); @@ -2805,7 +2878,8 @@ PUBLIC BOOLEAN inlocaldomain NOARGS #endif /* LINUX */ } else { - CTRACE(tfp,"Could not get ttyname or open UTMP file"); + if (TRACE) + fprintf(stderr,"Could not get ttyname or open UTMP file"); } return(FALSE); @@ -2820,21 +2894,18 @@ PUBLIC BOOLEAN inlocaldomain NOARGS #include <sys/ioctl.h> #endif -/* For systems that have both, but both can't be included, duh (or neither) */ -/* FIXME: this whole chunk may be redundant */ -#ifdef TERMIO_AND_CURSES -# ifdef TERMIO_AND_TERMIOS -# include <termio.h> +/* For systems that have both, but both can't be included, duh */ +#ifdef TERMIO_AND_TERMIOS +# include <termio.h> +#else +# ifdef HAVE_TERMIOS_H +# include <termios.h> # else -# ifdef HAVE_TERMIOS_H -# include <termios.h> -# else -# ifdef HAVE_TERMIO_H -# include <termio.h> -# endif /* HAVE_TERMIO_H */ -# endif /* HAVE_TERMIOS_H */ -# endif /* TERMIO_AND_TERMIOS */ -#endif /* TERMIO_AND_CURSES */ +# ifdef HAVE_TERMIO_H +# include <termio.h> +# endif /* HAVE_TERMIO_H */ +# endif /* HAVE_TERMIOS_H */ +#endif /* TERMIO_AND_TERMIOS */ PUBLIC void size_change ARGS1( int, sig GCC_UNUSED) @@ -2843,9 +2914,7 @@ PUBLIC void size_change ARGS1( int old_cols = LYcols; #ifdef USE_SLANG -#if defined(VMS) || defined(UNIX) SLtt_get_screen_size(); -#endif /* VMS || UNIX */ LYlines = SLtt_Screen_Rows; LYcols = SLtt_Screen_Cols; #ifdef SLANG_MBCS_HACK @@ -2901,7 +2970,10 @@ PUBLIC void size_change ARGS1( */ if (LYlines != old_lines || LYcols != old_cols) { recent_sizechange = TRUE; - CTRACE(tfp, "Window size changed from (%d,%d) to (%d,%d)\n", + } + if (TRACE) { + fprintf(stderr, + "Window size changed from (%d,%d) to (%d,%d)\n", old_lines, old_cols, LYlines, LYcols); } #ifdef SIGWINCH @@ -2932,7 +3004,7 @@ PUBLIC void HTSugFilenames_free NOARGS /* * Utility for listing suggested filenames, making any - * repeated filenames the most current in the list. - FM + * repeated filenanmes the most current in the list. - FM */ PUBLIC void HTAddSugFilename ARGS1( char *, fname) @@ -2995,8 +3067,12 @@ PUBLIC void change_sug_filename ARGS1( * Rename any temporary files. */ temp = (char *)calloc(1, (strlen(lynx_temp_space) + 60)); - cp = wwwName(lynx_temp_space); - if (LYIsHtmlSep(*cp)) { +#if defined(FNAMES_8_3) && defined(DOSPATH) + cp = HTDOS_wwwName(lynx_temp_space); +#else + cp = lynx_temp_space; +#endif + if (*cp == '/') { sprintf(temp, "file://localhost%s%d", cp, (int)getpid()); } else { sprintf(temp, "file://localhost/%s%d", cp, (int)getpid()); @@ -3011,14 +3087,6 @@ 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'; - /* * Remove everything up the the last_slash if there is one. */ @@ -3114,7 +3182,7 @@ PUBLIC void change_sug_filename ARGS1( /* * Trim any trailing or leading - * underscores or dashes. + * underscrores or dashes. */ cp = fname + (strlen(fname)) - 1; while (*cp == '_' || *cp == '-') { @@ -3210,7 +3278,7 @@ PUBLIC void change_sug_filename ARGS1( /* * No period, so put one on the end, or after * the 39th character, trimming trailing dashes - * or underscores. + * or underscrores. */ if (strlen(fname) > 39) { fname[39] = '\0'; @@ -3251,45 +3319,143 @@ PUBLIC void change_sug_filename ARGS1( } /* - * Construct a temporary-filename + * To create standard temporary file names. */ -PRIVATE char *fmt_tempname ARGS3( - char *, result, - CONST char *, prefix, - CONST char *, suffix) +PUBLIC void tempname ARGS2( + char *, namebuffer, + int, action) { - static unsigned counter; - char *leaf; - - if (prefix == 0) - prefix = ""; - if (suffix == 0) - suffix = ""; - strcpy(result, prefix); - leaf = result + strlen(result); - counter++; + static int counter = 0; + FILE *fp = NULL; +#ifdef FNAMES_8_3 + int LYMaxTempCount = 1000; /* Arbitrary limit. Make it configurable? */ +#else + int LYMaxTempCount = 10000; /* Arbitrary limit. Make it configurable? */ +#endif /* FNAMES_8_3 */ + + if (action == REMOVE_FILES) { + /* + * Remove all temporary files with .txt or .html suffixes. - FM + */ + for (; counter > 0; counter--) { +#ifdef FNAMES_8_3 + sprintf(namebuffer, + "%s%d%u.txt", + lynx_temp_space, (int)getpid(), counter-1); + remove(namebuffer); + sprintf(namebuffer, + "%s%d%u%s", + lynx_temp_space, (int)getpid(), counter-1, HTML_SUFFIX); + remove(namebuffer); +#else + sprintf(namebuffer, + "%sL%d-%uTMP.txt", + lynx_temp_space, (int)getpid(), counter-1); + remove(namebuffer); + sprintf(namebuffer, + "%sL%d-%uTMP%s", + lynx_temp_space, (int)getpid(), counter-1, HTML_SUFFIX); + remove(namebuffer); +#endif /* FNAMES_8_3 */ + } + } else { + /* + * Load a tentative temporary file name into namebuffer. - FM + */ + while (counter < LYMaxTempCount) { + /* + * Create names with .txt, then .bin, then + * .html suffixes, and check for their prior + * existence. If any already exist, someone + * might be trying to spoof us, so increment + * the count and try again. Otherwise, return + * with the name which has the .html suffix + * loaded in namebuffer. - FM + * + * Some systems may use .htm instead of .html. This + * should be done consistently by always using HTML_SUFFIX + * where filenames are generated for new local files. - kw + */ +#ifdef FNAMES_8_3 + sprintf(namebuffer, + "%s%d%u.txt", + lynx_temp_space, (int)getpid(), counter); +#else + sprintf(namebuffer, + "%sL%d-%uTMP.txt", + lynx_temp_space, (int)getpid(), counter); +#endif /* FNAMES_8_3 */ + if ((fp = fopen(namebuffer, "r")) != NULL) { + fclose(fp); + if (TRACE) + fprintf(stderr, + "tempname: file '%s' already exists!\n", + namebuffer); + counter++; + continue; + } +#ifdef FNAMES_8_3 + sprintf(namebuffer, + "%s%d%u.bin", + lynx_temp_space, (int)getpid(), counter); +#else + sprintf(namebuffer, + "%sL%d-%uTMP.bin", + lynx_temp_space, (int)getpid(), counter); +#endif /* FNAMES_8_3 */ + if ((fp = fopen(namebuffer, "r")) != NULL) { + fclose(fp); + if (TRACE) + fprintf(stderr, + "tempname: file '%s' already exists!\n", + namebuffer); + counter++; + continue; + } #ifdef FNAMES_8_3 + sprintf(namebuffer, + "%s%d%u%s", + lynx_temp_space, (int)getpid(), counter++, HTML_SUFFIX); +#else + sprintf(namebuffer, + "%sL%d-%uTMP%s", + lynx_temp_space, (int)getpid(), counter++, HTML_SUFFIX); +#endif /* FNAMES_8_3 */ + if ((fp = fopen(namebuffer, "r")) != NULL) { + fclose(fp); + if (TRACE) + fprintf(stderr, + "tempname: file '%s' already exists!\n", + namebuffer); + continue; + } + /* + * Return to the calling function, with the tentative + * temporary file name loaded in namebuffer. Note that + * if the calling function will use a suffix other than + * .txt, .bin, or .html, it similarly should do tests for + * a spoof. The file name can be reused if it is written + * to on receipt of this name, and thereafter accessed + * for reading. Note that if writing to a file is to + * be followed by reading it, as it the usual case for + * Lynx, the spoof attempt will be apparent, and the user + * can take appropriate action. - FM + */ + return; + } + /* + * The tempfile maximum count has been reached. + * Issue a message and exit. - FM + */ + _statusline(MAX_TEMPCOUNT_REACHED); + sleep(AlertSecs); + exit(-1); + } + /* - * The 'lynx_temp_space' string ends with a '/' or '\\', so we only have to - * limit the length of the leaf. As received (e.g., from HTCompressed), - * the suffix may contain more than a ".htm", e.g., "-txt.gz", so we trim - * off from the filename portion to make room. + * We were called for a clean up, and have done it. - FM */ - sprintf(leaf, "%u%u", counter, (unsigned)getpid()); - if (strlen(leaf) > 8) - leaf[8] = 0; - if (strlen(suffix) > 4 || *suffix != '.') { - CONST char *tail = strchr(suffix, '.'); - if (tail == 0) - tail = suffix + strlen(suffix); - leaf[8 - (tail - suffix)] = 0; - } - strcat(leaf, suffix); -#else - sprintf(leaf, "L%u-%uTMP%s", (unsigned)getpid(), counter, suffix); -#endif - CTRACE(tfp, "-> '%s'\n", result); - return result; + return; } /* @@ -3300,7 +3466,7 @@ PUBLIC int number2arrows ARGS1( { switch(number) { case '1': - number=END_KEY; + number=END; break; case '2': number=DNARROW; @@ -3335,7 +3501,7 @@ PUBLIC int number2arrows ARGS1( * parse_restrictions takes a string of comma-separated restrictions * and sets the corresponding flags to restrict the facilities available. */ -PRIVATE CONST char *restrict_name[] = { +PRIVATE char *restrict_name[] = { "inside_telnet" , "outside_telnet", "telnet_port" , @@ -3422,10 +3588,10 @@ PRIVATE BOOLEAN *restrict_flag[] = { (BOOLEAN *) 0 }; PUBLIC void parse_restrictions ARGS1( - CONST char *, s) + char *, s) { - CONST char *p; - CONST char *word; + char *p; + char *word; int i; if (STREQ("all", s)) { @@ -3480,21 +3646,21 @@ PUBLIC void parse_restrictions ARGS1( p = s; while (*p) { - p = LYSkipCBlanks(p); + while (isspace((unsigned char)*p)) + p++; if (*p == '\0') break; word = p; while (*p != ',' && *p != '\0') p++; + if (*p) + *p++ = '\0'; - for (i=0; restrict_name[i]; i++) { - if (STRNEQ(word, restrict_name[i], p-word)) { + for (i=0; restrict_name[i]; i++) + if (STREQ(word, restrict_name[i])) { *restrict_flag[i] = TRUE; break; } - } - if (*p) - p++; } return; } @@ -3512,7 +3678,7 @@ typedef struct _VMSMailItemList long *return_length_address; } VMSMailItemList; -PUBLIC void LYCheckMail NOARGS +PUBLIC int LYCheckMail NOARGS { static BOOL firsttime = TRUE, failure = FALSE; static char user[13], dir[252]; @@ -3536,7 +3702,7 @@ PUBLIC void LYCheckMail NOARGS extern long mail$user_end(); if (failure) - return; + return 0; if (firsttime) { firsttime = FALSE; @@ -3544,51 +3710,56 @@ PUBLIC void LYCheckMail NOARGS status = sys$getjpiw(0,0,0,jpi_list,0,0,0); if (!(status & 1)) { failure = TRUE; - return; + return 0; } user[userlen] = '\0'; - LYTrimTrailing(user); + while (user[0] && + /* + * Suck up trailing spaces. + */ + isspace((unsigned char)user[--userlen])) + user[userlen] = '\0'; } /* Minimum report interval is 60 sec. */ time(&now); if (now - lastcheck < 60) - return; + return 0; lastcheck = now; /* Get the current newmail count. */ status = mail$user_begin(&ucontext,null_list,null_list); if (!(status & 1)) { failure = TRUE; - return; + return 0; } uilist[0].buffer_length = strlen(user); uilist[0].buffer_address = user; status = mail$user_get_info(&ucontext,uilist,uolist); if (!(status & 1)) { failure = TRUE; - return; + return 0; } /* Should we report anything to the user? */ if (new > 0) { if (lastcount == 0) /* Have newmail at startup of Lynx. */ - HTUserMsg(HAVE_UNREAD_MAIL_MSG); + _statusline(HAVE_UNREAD_MAIL_MSG); else if (new > lastcount) /* Have additional mail since last report. */ - HTUserMsg(HAVE_NEW_MAIL_MSG); + _statusline(HAVE_NEW_MAIL_MSG); lastcount = new; - return; + return 1; } lastcount = new; /* Clear the context */ mail$user_end((long *)&ucontext,null_list,null_list); - return; + return 0; } #else -PUBLIC void LYCheckMail NOARGS +PUBLIC int LYCheckMail NOARGS { static BOOL firsttime = TRUE; static char *mf; @@ -3603,29 +3774,29 @@ PUBLIC void LYCheckMail NOARGS } if (mf == NULL) - return; + return 0; time(&now); if (now - lastcheck < 60) - return; + return 0; lastcheck = now; if (stat(mf,&st) < 0) { mf = NULL; - return; + return 0; } if (st.st_size > 0) { if (st.st_mtime > st.st_atime || (lastsize && st.st_size > lastsize)) - HTUserMsg(HAVE_NEW_MAIL_MSG); + _statusline(HAVE_NEW_MAIL_MSG); else if (lastsize == 0) - HTUserMsg(HAVE_MAIL_MSG); + _statusline(HAVE_MAIL_MSG); lastsize = st.st_size; - return; + return 1; } lastsize = st.st_size; - return; + return 0; } #endif /* VMS */ @@ -3641,7 +3812,7 @@ PUBLIC void LYCheckMail NOARGS */ PUBLIC void LYEnsureAbsoluteURL ARGS2( char **, href, - CONST char *, name) + char *, name) { char *temp = NULL; @@ -3658,7 +3829,8 @@ PUBLIC void LYEnsureAbsoluteURL ARGS2( StrAllocCat(*href, "/*"); } if (!is_url(*href)) { - CTRACE(tfp, "%s%s'%s' is not a URL\n", + if (TRACE) + fprintf(stderr, "%s%s'%s' is not a URL\n", (name ? name : ""), (name ? " " : ""), *href); LYConvertToURL(href); } @@ -3687,7 +3859,7 @@ PUBLIC void LYConvertToURL ARGS1( if (!old_string || *old_string == '\0') return; -#if defined(DOSPATH) || defined(__EMX__) +#ifdef DOSPATH { char *cp_url = *AllocatedString; for(; *cp_url != '\0'; cp_url++) @@ -3695,6 +3867,10 @@ PUBLIC void LYConvertToURL ARGS1( cp_url--; if(*cp_url == ':') StrAllocCat(*AllocatedString,"/"); +#ifdef NOTDEFINED + if(strlen(old_string) > 3 && *cp_url == '/') + *cp_url = '\0'; +#endif } #endif /* DOSPATH */ @@ -3703,7 +3879,7 @@ PUBLIC void LYConvertToURL ARGS1( if (*old_string != '/') { char *fragment = NULL; -#if defined(DOSPATH) || defined(__EMX__) +#ifdef DOSPATH StrAllocCat(*AllocatedString,"/"); #endif /* DOSPATH */ #ifdef VMS @@ -3748,7 +3924,9 @@ PUBLIC void LYConvertToURL ARGS1( if ((cp = strchr(file_name, ';')) != NULL) { *cp = '\0'; } - LYLowerCase(file_name); + for (cp = file_name; *cp; cp++) { + *cp = TOLOWER(*cp); + } StrAllocCat(*AllocatedString, HTVMS_wwwName(file_name)); if ((cp = strchr(old_string, ';')) != NULL) { StrAllocCat(*AllocatedString, cp); @@ -3771,7 +3949,9 @@ PUBLIC void LYConvertToURL ARGS1( /* * Yup, we got it! */ - LYLowerCase(dir_name); + for (cp = dir_name; *cp; cp++) { + *cp = TOLOWER(*cp); + } StrAllocCat(*AllocatedString, dir_name); if (fragment != NULL) { StrAllocCat(*AllocatedString, fragment); @@ -3797,8 +3977,11 @@ PUBLIC void LYConvertToURL ARGS1( */ strcpy(url_file, "/"); strcat(url_file, old_string); - CTRACE(tfp, "Can't find '%s' Will assume it's a bad path.\n", + if (TRACE) { + fprintf(stderr, + "Can't find '%s' Will assume it's a bad path.\n", old_string); + } StrAllocCat(*AllocatedString, url_file); } else { /* @@ -3836,8 +4019,11 @@ PUBLIC void LYConvertToURL ARGS1( */ strcpy(url_file, "/"); strcat(url_file, old_string); - CTRACE(tfp, "Can't find '%s' Will assume it's a bad path.\n", - old_string); + if (TRACE) { + fprintf(stderr, + "Can't find '%s' Will assume it's a bad path.\n", + old_string); + } StrAllocCat(*AllocatedString, url_file); } else { /* @@ -3855,7 +4041,9 @@ PUBLIC void LYConvertToURL ARGS1( lib$find_file_end(&context); FREE(cur_dir); have_VMS_URL: - CTRACE(tfp, "Trying: '%s'\n", *AllocatedString); + if (TRACE) { + fprintf(stderr, "Trying: '%s'\n", *AllocatedString); + } #else /* Unix: */ #ifdef DOSPATH if (strlen(old_string) == 1 && *old_string == '.') { @@ -3864,11 +4052,13 @@ have_VMS_URL: */ char curdir[DIRNAMESIZE]; getcwd (curdir, DIRNAMESIZE); - StrAllocCopy(temp, wwwName(curdir)); + StrAllocCopy(temp, HTDOS_wwwName(curdir)); StrAllocCat(*AllocatedString, temp); FREE(temp); - CTRACE(tfp, "Converted '%s' to '%s'\n", - old_string, *AllocatedString); + if (TRACE) { + fprintf(stderr, "Converted '%s' to '%s'\n", + old_string, *AllocatedString); + } } else #endif /* DOSPATH */ if (*old_string == '~') { @@ -3887,8 +4077,10 @@ have_VMS_URL: StrAllocCat(*AllocatedString, temp); FREE(temp); } - CTRACE(tfp, "Converted '%s' to '%s'\n", - old_string, *AllocatedString); + if (TRACE) { + fprintf(stderr, "Converted '%s' to '%s'\n", + old_string, *AllocatedString); + } } else { /* * Create a full path to the current default directory. @@ -3905,29 +4097,32 @@ have_VMS_URL: * Concatenate and simplify, trimming any * residual relative elements. - FM */ -#if defined (DOSPATH) || defined (__EMX__) +#ifndef DOSPATH + StrAllocCopy(temp, curdir); + StrAllocCat(temp, "/"); + StrAllocCat(temp, old_string); +#else if (old_string[1] != ':' && old_string[1] != '|') { - StrAllocCopy(temp, wwwName(curdir)); - LYAddHtmlSep(&temp); + StrAllocCopy(temp, HTDOS_wwwName(curdir)); + if(curdir[strlen(curdir)-1] != '/') + StrAllocCat(temp, "/"); LYstrncpy(curdir, temp, (DIRNAMESIZE - 1)); StrAllocCat(temp, old_string); } else { curdir[0] = '\0'; StrAllocCopy(temp, old_string); } -#else - StrAllocCopy(temp, curdir); - StrAllocCat(temp, "/"); - StrAllocCat(temp, old_string); #endif /* DOSPATH */ LYTrimRelFromAbsPath(temp); - CTRACE(tfp, "Converted '%s' to '%s'\n", old_string, temp); + if (TRACE) { + fprintf(stderr, "Converted '%s' to '%s'\n", old_string, temp); + } if ((stat(temp, &st) > -1) || (fptemp = fopen(temp, "r")) != NULL) { /* * It is a subdirectory or file on the local system. */ -#if defined (DOSPATH) || defined (__EMX__) +#ifdef DOSPATH /* Don't want to see DOS local paths like c: escaped */ /* especially when we really have file://localhost/ */ /* at the beginning. To avoid any confusion we allow */ @@ -3940,13 +4135,16 @@ have_VMS_URL: cp = HTEscape(temp, URL_PATH); StrAllocCat(*AllocatedString, cp); FREE(cp); - CTRACE(tfp, "Converted '%s' to '%s'\n", - old_string, *AllocatedString); + if (TRACE) { + fprintf(stderr, "Converted '%s' to '%s'\n", + old_string, *AllocatedString); + } is_local = TRUE; } else { char *cp2 = NULL; StrAllocCopy(temp2, curdir); - LYAddPathSep(&temp2); + if (curdir[0] != '\0' && curdir[strlen(curdir)-1] != '/') + StrAllocCat(temp2, "/"); StrAllocCopy(cp, old_string); if ((fragment = strchr(cp, '#')) != NULL) *fragment = '\0'; /* keep as pointer into cp string */ @@ -3971,7 +4169,8 @@ have_VMS_URL: * old_string as given. - kw */ temp = HTEscape(curdir, URL_PATH); - LYAddHtmlSep(&temp); + if (curdir[0] != '\0' && curdir[strlen(curdir)-1] != '/') + StrAllocCat(temp, "/"); StrAllocCat(temp, old_string); } else { temp = HTEscape(temp2, URL_PATH); @@ -3981,8 +4180,10 @@ have_VMS_URL: } } StrAllocCat(*AllocatedString, temp); - CTRACE(tfp, "Converted '%s' to '%s'\n", - old_string, *AllocatedString); + if (TRACE) { + fprintf(stderr, "Converted '%s' to '%s'\n", + old_string, *AllocatedString); + } is_local = TRUE; } else if (strchr(curdir, '#') != NULL || @@ -4001,7 +4202,8 @@ have_VMS_URL: * old_string as given. - kw */ temp = HTEscape(curdir, URL_PATH); - LYAddHtmlSep(&temp); + if (curdir[0] != '\0' && curdir[strlen(curdir)-1] != '/') + StrAllocCat(temp, "/"); StrAllocCat(temp, old_string); } else { temp = HTEscape(temp2, URL_PATH); @@ -4020,8 +4222,10 @@ have_VMS_URL: * local system, so assume it's a URL request and guess * the scheme with "http://" as the default. */ - CTRACE(tfp, "Can't stat() or fopen() '%s'\n", + if (TRACE) { + fprintf(stderr, "Can't stat() or fopen() '%s'\n", temp2 ? temp2 : temp); + } if (LYExpandHostForURL((char **)&old_string, URLDomainPrefixes, URLDomainSuffixes)) { @@ -4032,10 +4236,12 @@ have_VMS_URL: StrAllocCopy(*AllocatedString, old_string); } } else { - /* RW 1998Mar16 Restore AllocatedString to 'old_string' */ - StrAllocCopy(*AllocatedString, old_string); + /* RW 1998Mar16 Restore AllocatedString to 'old_string' */ + StrAllocCopy(*AllocatedString, old_string); + } + if (TRACE) { + fprintf(stderr, "Trying: '%s'\n", *AllocatedString); } - CTRACE(tfp, "Trying: '%s'\n", *AllocatedString); } FREE(temp); FREE(temp2); @@ -4067,7 +4273,9 @@ have_VMS_URL: */ StrAllocCopy(temp, old_string); LYTrimRelFromAbsPath(temp); - CTRACE(tfp, "Converted '%s' to '%s'\n", old_string, temp); + if (TRACE) { + fprintf(stderr, "Converted '%s' to '%s'\n", old_string, temp); + } cp = HTEscape(temp, URL_PATH); StrAllocCat(*AllocatedString, cp); FREE(cp); @@ -4076,8 +4284,10 @@ have_VMS_URL: fclose(fptemp); fptemp = NULL; } - CTRACE(tfp, "Converted '%s' to '%s'\n", + if (TRACE) { + fprintf(stderr, "Converted '%s' to '%s'\n", old_string, *AllocatedString); + } #endif /* VMS */ } else if (old_string[1] == '~') { /* @@ -4110,12 +4320,17 @@ have_VMS_URL: StrAllocCat(*AllocatedString, temp); FREE(temp); } - CTRACE(tfp, "Converted '%s' to '%s'\n", - old_string, *AllocatedString); + if (TRACE) { + fprintf(stderr, "Converted '%s' to '%s'\n", + old_string, *AllocatedString); + } } FREE(old_string); - /* Pause so we can read the messages before invoking curses */ - CTRACE_SLEEP(AlertSecs); + if (TRACE) { + /* Pause so we can read the messages before invoking curses */ + if (!LYTraceLogFP) + sleep(AlertSecs); + } } /* @@ -4124,7 +4339,7 @@ have_VMS_URL: * and returns TRUE, otherwise it does not modify the string and * returns FALSE. It first tries the element as is, then, if the * element does not end with a dot, it adds prefixes from the - * (comma separated) prefix list argument, and, if the element + * (comma separated) prefix list arguement, and, if the element * does not begin with a dot, suffixes from the (comma separated) * suffix list arguments (e.g., www.host.com, then www.host,edu, * then www.host.net, then www.host.org). The remaining path, if @@ -4147,8 +4362,7 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3( char *Host = NULL, *HostColon = NULL, *host = NULL; char *Path = NULL; char *Fragment = NULL; - int hoststat; - SockA sock; + struct hostent *phost; BOOLEAN GotHost = FALSE; BOOLEAN Startup = (helpfilepath == NULL); @@ -4223,8 +4437,7 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3( fprintf(stdout, "Looking up '%s' first.\n", host); } #ifndef DJGPP - sock.sin_port = htons(80); - if ((hoststat = HTParseInet(&sock, host)) == 0) + if ((phost = gethostbyname(host)) != NULL) #else if (resolve(host) != 0) #endif /* DJGPP */ @@ -4233,8 +4446,11 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3( * Clear any residual interrupt. - FM */ if (LYCursesON && HTCheckForInterrupt()) { - CTRACE(tfp, "LYExpandHostForURL: Ignoring interrupt because '%s' resolved.\n", + if (TRACE) { + fprintf(stderr, + "LYExpandHostForURL: Ignoring interrupt because '%s' resolved.\n", host); + } } /* @@ -4245,16 +4461,15 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3( FREE(Str); FREE(MsgStr); return GotHost; -#ifndef DJGPP - } else if (LYCursesON && ((hoststat == HT_INTERRUPTED) || HTCheckForInterrupt())) { -#else /* DJGPP */ } else if (LYCursesON && HTCheckForInterrupt()) { -#endif /* DJGPP */ /* * Give the user chance to interrupt lookup cycles. - KW & FM */ - CTRACE(tfp, "LYExpandHostForURL: Interrupted while '%s' failed to resolve.\n", + if (TRACE) { + fprintf(stderr, + "LYExpandHostForURL: Interrupted while '%s' failed to resolve.\n", host); + } /* * Return failure. - FM @@ -4345,8 +4560,7 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3( fprintf(stdout, "Looking up '%s', guessing...\n", host); } #ifndef DJGPP - sock.sin_port = htons(80); - GotHost = ((hoststat = HTParseInet(&sock, host)) == 0); + GotHost = ((phost = gethostbyname(host)) != NULL); #else GotHost = (resolve(host) != 0); #endif /* DJGPP */ @@ -4357,14 +4571,12 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3( /* * Give the user chance to interrupt lookup cycles. - KW */ -#ifndef DJGPP - if (LYCursesON && ((hoststat == HT_INTERRUPTED) || HTCheckForInterrupt())) -#else /* DJGPP */ - if (LYCursesON && HTCheckForInterrupt()) -#endif /* DJGPP */ - { - CTRACE(tfp, "LYExpandHostForURL: Interrupted while '%s' failed to resolve.\n", + if (LYCursesON && HTCheckForInterrupt()) { + if (TRACE) { + fprintf(stderr, + "LYExpandHostForURL: Interrupted while '%s' failed to resolve.\n", host); + } FREE(Str); FREE(MsgStr); FREE(Host); @@ -4429,9 +4641,12 @@ PUBLIC BOOLEAN LYExpandHostForURL ARGS3( * Clear any residual interrupt. - FM */ if (LYCursesON && HTCheckForInterrupt()) { - CTRACE(tfp, "LYExpandHostForURL: Ignoring interrupt because '%s' %s.\n", + if (TRACE) { + fprintf(stderr, + "LYExpandHostForURL: Ignoring interrupt because '%s' %s.\n", host, (GotHost ? "resolved" : "timed out")); + } } /* @@ -4568,13 +4783,13 @@ PUBLIC void LYTrimRelFromAbsPath ARGS1( /* * Make sure we have a pointer to an absolute path. - FM */ - if (path == NULL || !LYIsPathSep(*path)) + if (path == NULL || *path != '/') return; /* * Check whether the path has a terminal slash. - FM */ - TerminalSlash = LYIsPathSep(path[(strlen(path) - 1)]); + TerminalSlash = (path[(strlen(path) - 1)] == '/'); /* * Simplify the path and then do any necessary trimming. - FM @@ -4587,7 +4802,7 @@ PUBLIC void LYTrimRelFromAbsPath ARGS1( * Eliminate trailing dot. - FM */ cp[1] = '\0'; - } else if (LYIsPathSep(cp[2])) { + } else if (cp[2] == '/') { /* * Skip over the "/." of a "/./". - FM */ @@ -4620,8 +4835,9 @@ PUBLIC void LYTrimRelFromAbsPath ARGS1( path[i] = cp[i]; path[i] = '\0'; } - if (TerminalSlash == FALSE) { - LYTrimPathSep(path); + if (TerminalSlash == FALSE && + path[(strlen(path) - 1)] == '/') { + path[(strlen(path) - 1)] = '\0'; } } @@ -4700,7 +4916,7 @@ PUBLIC CONST char * Home_Dir NOARGS if (homedir == NULL) { if ((cp = getenv("HOME")) == NULL || *cp == '\0') { -#if defined (DOSPATH) || defined (__EMX__) /* BAD! WSB */ +#ifdef DOSPATH /* BAD! WSB */ if ((cp = getenv("TEMP")) == NULL || *cp == '\0') { if ((cp = getenv("TMP")) == NULL || *cp == '\0') { StrAllocCopy(HomeDir, "C:\\"); @@ -4750,42 +4966,11 @@ PUBLIC CONST char * Home_Dir NOARGS } /* - * Return a pointer to the final leaf of the given pathname, If no pathname - * separators are found, returns the original pathname. The leaf may be - * empty. - */ -PUBLIC char *LYPathLeaf ARGS1(char *, pathname) -{ - char *leaf; -#ifdef UNIX - if ((leaf = strrchr(pathname, '/')) != 0) { - leaf++; - } -#else -#ifdef VMS - if ((leaf = strrchr(pathname, ']')) == 0) - leaf = strrchr(pathname, ':'); - if (leaf != 0) - leaf++; -#else - int n; - for (leaf = 0, n = strlen(pathname)-1; n >= 0; n--) { - if (strchr("\\/:", pathname[n]) != 0) { - leaf = pathname + n; - break; - } - } -#endif -#endif - return (leaf != 0) ? leaf : pathname; -} - -/* * This function checks the acceptability of file paths that * are intended to be off the home directory. The file path * should be passed in fbuffer, together with the size of the * buffer. The function simplifies the file path, and if it - * is acceptable, loads it into fbuffer and returns TRUE. + * is acceptible, loads it into fbuffer and returns TRUE. * Otherwise, it does not modify fbuffer and returns FALSE. * If a subdirectory is present and the path does not begin * with "./", that is prefixed to make the situation clear. - FM @@ -4903,7 +5088,7 @@ PUBLIC BOOLEAN LYPathOffHomeOK ARGS2( /* * Check for a URL or absolute path, and reject if present. - FM */ - if (is_url(cp) || LYIsPathSep(*cp)) { + if (is_url(cp) || *cp == '/') { FREE(file); return(FALSE); } @@ -4925,11 +5110,8 @@ PUBLIC BOOLEAN LYPathOffHomeOK ARGS2( /* * Check for spoofing. - FM */ - if (*cp == '\0' - || LYIsPathSep(*cp) - || LYIsPathSep(cp[(strlen(cp) - 1)]) - || strstr(cp, "..") != NULL - || !strcmp(cp, ".")) { + if (*cp == '\0' || *cp == '/' || cp[(strlen(cp) - 1)] == '/' || + strstr(cp, "..") != NULL || !strcmp(cp, ".")) { FREE(file); return(FALSE); } @@ -5091,11 +5273,12 @@ PUBLIC time_t LYmktime ARGS2( if (!(string && *string)) return(0); s = string; - CTRACE(tfp, "LYmktime: Parsing '%s'\n", s); + if (TRACE) + fprintf(stderr, "LYmktime: Parsing '%s'\n", s); /* * Skip any lead alphabetic "Day, " field and - * seek a numeric day field. - FM + * seek a numberic day field. - FM */ while (*s != '\0' && !isdigit((unsigned char)*s)) s++; @@ -5307,10 +5490,9 @@ PUBLIC time_t LYmktime ARGS2( seconds); if (absolute == FALSE && clock2 <= time(NULL)) clock2 = (time_t)0; - if (clock2 > 0) - CTRACE(tfp, "LYmktime: clock=%ld, ctime=%s", - (long) clock2, - ctime(&clock2)); + if (TRACE && clock2 > 0) + fprintf(stderr, + "LYmktime: clock=%ld, ctime=%s", (long) clock2, ctime(&clock2)); return(clock2); } @@ -5338,8 +5520,20 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <sys/types.h> +#include <errno.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#else +extern int errno; +#endif /* STDC_HEADERS */ + #if defined(STDC_HEADERS) || defined(USG) #include <string.h> +#ifdef NOTDEFINED +#define index strchr +#define bcopy(s, d, n) memcpy((d), (s), (n)) +#endif /* NOTDEFINED */ #else /* Not (STDC_HEADERS or USG): */ #include <strings.h> #endif /* STDC_HEADERS or USG */ @@ -5418,111 +5612,18 @@ int remove ARGS1(char *, name) #ifdef UNIX /* - * Verify if this is really a file, not accessed by a link, except for the - * special case of its directory being pointed to by a link from a directory - * owned by root and not writable by other users. - */ -PRIVATE BOOL IsOurFile ARGS1(char *, name) -{ - struct stat data; - - if (lstat(name, &data) == 0 - && S_ISREG(data.st_mode) - && data.st_nlink == 1 - && data.st_uid == getuid()) { - int linked = FALSE; -#if HAVE_LSTAT - char *path = 0; - char *leaf; - - StrAllocCopy(path, name); - do { - if ((leaf = LYPathLeaf(path)) != path) - *--leaf = '\0'; /* write a null on the '/' */ - if (lstat(*path ? path : "/", &data) != 0) { - break; - } - /* - * If we find a symbolic link, it has to be in a directory that's - * protected. Otherwise someone could have switched it to point - * to one of the real user's files. - */ - if (S_ISLNK(data.st_mode)) { - linked = TRUE; /* could be link-to-link; doesn't matter */ - } else if (S_ISDIR(data.st_mode)) { - if (linked) { - linked = FALSE; - /* - * We assume that a properly-configured system has the - * unwritable directories owned by root. This is not - * necessarily so (bin, news, etc., may), but the only - * uid we can count on is 0. It would be nice to add a - * check for the gid also, but that wouldn't be - * portable. - */ - if (data.st_uid != 0 - || data.st_mode & S_IWOTH) { - linked = TRUE; /* force an error-return */ - break; - } - } - } else if (linked) { - break; - } - } while (leaf != path); - free(path); -#endif - return !linked; - } - return FALSE; -} - -/* - * Open a file that we don't want other users to see. + * Open a file that we don't want other users to see. For new files, the umask + * will suffice; however if the file already exists we'll change permissions + * first, before opening it. If the chmod fails because of some reason other + * than a non-existent file, there's no point in trying to open it. */ PRIVATE FILE *OpenHiddenFile ARGS2(char *, name, char *, mode) { + int save = umask(HIDE_UMASK); FILE *fp = 0; - -#if defined(O_CREAT) && defined(O_EXCL) /* we have fcntl.h or kindred? */ - /* - * This is the preferred method for creating new files, since it ensures - * that no one has an existing file or link that they happen to own. - */ - if (*mode == 'w') { - int fd = open(name, O_CREAT|O_EXCL|O_WRONLY, HIDE_CHMOD); - if (fd < 0 - && errno == EEXIST - && IsOurFile(name)) { - remove(name); - /* FIXME: there's a race at this point if directory is open */ - fd = open(name, O_CREAT|O_EXCL|O_WRONLY, HIDE_CHMOD); - } - if (fd >= 0) { - fp = fdopen(fd, mode); - } - } - else -#endif - if (*mode == 'a' - && IsOurFile(name) - && chmod(name, HIDE_CHMOD) == 0) + if (chmod(name, HIDE_CHMOD) == 0 || errno == ENOENT) fp = fopen(name, mode); - /* - * This is less stringent, but reasonably portable. For new files, the - * umask will suffice; however if the file already exists we'll change - * permissions first, before opening it. If the chmod fails because of - * some reason other than a non-existent file, there's no point in trying - * to open it. - * - * This won't work properly if the user is root, since the chmod succeeds. - */ - else if (*mode != 'a') { - int save = umask(HIDE_UMASK); - if (chmod(name, HIDE_CHMOD) == 0 || errno == ENOENT) - fp = fopen(name, mode); - umask(save); - } + umask(save); return fp; } #else @@ -5544,42 +5645,29 @@ PUBLIC FILE *LYNewBinFile ARGS1(char *, name) PUBLIC FILE *LYNewTxtFile ARGS1(char *, name) { - FILE *fp; - #ifdef VMS - fp = fopen (name, "w", "shr=get"); + FILE *fp = fopen (name, "w", "shr=get"); chmod(name, HIDE_CHMOD); #else - SetDefaultMode(O_TEXT); - - fp = OpenHiddenFile(name, "w"); - - SetDefaultMode(O_BINARY); + FILE *fp = OpenHiddenFile(name, "w"); #endif - return fp; } PUBLIC FILE *LYAppendToTxtFile ARGS1(char *, name) { - FILE *fp; - #ifdef VMS - fp = fopen (name, "a+", "shr=get"); + FILE *fp = fopen (name, "a+", "shr=get"); chmod(name, HIDE_CHMOD); #else - SetDefaultMode(O_TEXT); - - fp = OpenHiddenFile(name, "a+"); - - SetDefaultMode(O_BINARY); + FILE *fp = OpenHiddenFile(name, "a+"); #endif return fp; } #ifdef UNIX /* - * Restore normal permissions to a copy of a file that we have created + * Restore normal permisions to a copy of a file that we have created * with temp file restricted permissions. The normal umask should * apply for user files. - kw */ @@ -5602,528 +5690,3 @@ PUBLIC void LYRelaxFilePermissions ARGS1(CONST char *, name) } } #endif - -/* - * Check if the given anchor has an associated file-cache. - */ -PUBLIC BOOLEAN LYCachedTemp ARGS2( - char *, result, - char **, cached) -{ - FILE *fp; - - if (*cached) { - strcpy(result, *cached); - FREE(*cached); - if ((fp = fopen(result, "r")) != NULL) { - fclose(fp); - remove(result); - } - return TRUE; - } - return FALSE; -} - -/* - * Maintain a list of all of the temp-files we create so that we can remove - * them during the cleanup. - */ -typedef struct _LYTemp { - struct _LYTemp *next; - char *name; - FILE *file; -} LY_TEMP; - -static LY_TEMP *ly_temp; - -/* - * Open a temp-file, ensuring that it is unique, and not readable by other - * users. - * - * The mode can be one of: "w", "a", "wb". - */ -PUBLIC FILE *LYOpenTemp ARGS3( - char *, result, - CONST char *, suffix, - CONST char *, mode) -{ - FILE *fp = 0; - BOOL txt = TRUE; - BOOL wrt = 'r'; - LY_TEMP *p; - - CTRACE(tfp, "LYOpenTemp(,%s,%s)\n", suffix, mode); - while (*mode != '\0') { - switch (*mode++) { - case 'w': wrt = 'w'; break; - case 'a': wrt = 'a'; break; - case 'b': txt = FALSE; break; - default: - CTRACE(tfp, "%s @%d: BUG\n", __FILE__, __LINE__); - return fp; - } - } - - do { - (void) fmt_tempname(result, lynx_temp_space, suffix); - if (txt) { - switch (wrt) { - case 'w': - fp = LYNewTxtFile (result); - break; - case 'a': - fp = LYAppendToTxtFile (result); - break; - } - } else { - fp = LYNewBinFile (result); - } - } while (fp == 0); - - if ((p = (LY_TEMP *)calloc(1, sizeof(LY_TEMP))) != 0) { - p->next = ly_temp; - StrAllocCopy((p->name), result); - p->file = fp; - ly_temp = p; - } - - CTRACE(tfp, "... LYOpenTemp(%s)\n", result); - return fp; -} - -/* - * Reopen a temporary file - */ -PUBLIC FILE *LYReopenTemp ARGS1( - char *, name) -{ - LY_TEMP *p; - FILE *fp = 0; - - LYCloseTemp(name); - for (p = ly_temp; p != 0; p = p->next) { - if (!strcmp(p->name, name)) { - fp = p->file = LYAppendToTxtFile (name); - break; - } - } - return fp; -} - -/* - * Special case of LYOpenTemp, used for manipulating bookmark file, i.e., with - * renaming. - */ -PUBLIC FILE *LYOpenScratch ARGS2( - char *, result, - CONST char *, prefix) -{ - FILE *fp; - LY_TEMP *p; - - (void) fmt_tempname(result, prefix, HTML_SUFFIX); - if ((fp = LYNewTxtFile (result)) != 0) { - if ((p = (LY_TEMP *)calloc(1, sizeof(LY_TEMP))) != 0) { - p->next = ly_temp; - StrAllocCopy((p->name), result); - p->file = fp; - ly_temp = p; - } - } - CTRACE(tfp, "LYOpenScratch(%s)\n", result); - return fp; -} - -/* - * Close a temp-file, given its name - */ -PUBLIC void LYCloseTemp ARGS1( - char *, name) -{ - LY_TEMP *p; - - CTRACE(tfp, "LYCloseTemp(%s)\n", name); - for (p = ly_temp; p != 0; p = p->next) { - if (!strcmp(name, p->name)) { - CTRACE(tfp, "...LYCloseTemp(%s)%s\n", name, - (p->file != 0) ? ", closed" : ""); - if (p->file != 0) { - fclose(p->file); - p->file = 0; - } - break; - } - } -} - -/* - * Close a temp-file, given its file-pointer - */ -PUBLIC void LYCloseTempFP ARGS1( - FILE *, fp) -{ - LY_TEMP *p; - - CTRACE(tfp, "LYCloseTempFP\n"); - for (p = ly_temp; p != 0; p = p->next) { - if (p->file == fp) { - fclose(p->file); - p->file = 0; - break; - } - } -} - -/* - * Close a temp-file, removing it. - */ -PUBLIC void LYRemoveTemp ARGS1( - char *, name) -{ - LY_TEMP *p, *q; - int code; - - if (name != 0 && *name != 0) { - CTRACE(tfp, "LYRemoveTemp(%s)\n", name); - for (p = ly_temp, q = 0; p != 0; q = p, p = p->next) { - if (!strcmp(name, p->name)) { - if (q != 0) { - q->next = p->next; - } else { - ly_temp = p->next; - } - code = HTSYS_remove(name); - CTRACE(tfp, "...LYRemoveTemp done(%d)%s\n", code, - (p->file != 0) ? ", closed" : ""); - CTRACE_FLUSH(tfp); - if (p->file != 0) - fclose(p->file); - free(p->name); - free(p); - break; - } - } - } -} - -/* - * Remove all of the temp-files. Note that this assumes that they are closed, - * since some systems will not allow us to remove a file which is open. - */ -PUBLIC void LYCleanupTemp NOARGS -{ - while (ly_temp != 0) { - LYRemoveTemp(ly_temp->name); - } -} - -/* - * Convert local pathname to www name - * (do not bother about file://localhost prefix at this point). - */ -PUBLIC char * wwwName ARGS1( - CONST char *, pathname) -{ - char *cp = NULL; - -#ifdef DOSPATH - cp = HTDOS_wwwName((char *)pathname); -#else -#ifdef VMS - cp = HTVMS_wwwName((char *)pathname); -#else - cp = (char *)pathname; -#endif /* VMS */ -#endif /* DOSPATH */ - - return cp; -} - -/* - * Convert a local filename to a URL - */ -PUBLIC void LYLocalFileToURL ARGS2( - char **, target, - CONST char *, source) -{ - char *leaf; - - StrAllocCopy(*target, "file://localhost"); - - leaf = wwwName(source); - - if (!LYIsHtmlSep(*leaf)) - LYAddHtmlSep(target); - StrAllocCat(*target, leaf); -} - -#ifdef NOTDEFINED -/* FIXME: this may be useful for pages that do not allow nested pages */ -PUBLIC int LYOpenInternalPage ARGS2( - FILE **, fp0, - char **, newfile) -{ - static char tempfile[256]; - - LYRemoveTemp(tempfile); - if ((*fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) { - HTAlert(CANNOT_OPEN_TEMP); - return(-1); - } - - LYLocalFileToURL(newfile, tempfile); - LYforce_no_cache = TRUE; /* don't cache this doc */ - - return(0); /* OK */ -} -#endif - -PUBLIC void BeginInternalPage ARGS3( - FILE *, fp0, - char*, Title, - char*, HelpURL) -{ - fprintf(fp0, "<html>\n<head>\n"); - LYAddMETAcharsetToFD(fp0, -1); - if (!strcmp(Title, LIST_PAGE_TITLE)) { - if (strchr(HTLoadedDocumentURL(), '"') == NULL) { - char *Address = NULL; - /* - * Insert a BASE tag so there is some way to relate the List Page - * file to its underlying document after we are done. It won't be - * actually used for resolving relative URLs. - kw - */ - StrAllocCopy(Address, HTLoadedDocumentURL()); - LYEntify(&Address, FALSE); - fprintf(fp0, "<base href=\"%s\">\n", Address); - FREE(Address); - } - } - fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n", - Title); - - if ((user_mode == NOVICE_MODE) - && LYwouldPush(Title) - && (HelpURL != 0)) { - fprintf(fp0, "<h1>%s (%s Version %s), <a href=\"%s%s\">help</a></h1>\n", - Title, LYNX_NAME, LYNX_VERSION, - helpfilepath, HelpURL); - } else { - fprintf(fp0, "<h1>%s (%s Version %s)</h1>\n", - Title, LYNX_NAME, LYNX_VERSION); - } -} - -PUBLIC void EndInternalPage ARGS1( - FILE *, fp0) -{ - fprintf(fp0, "</body>\n</html>"); -} - -/* - * Trim a trailing path-separator to avoid confusing other programs when we concatenate - * to it. This only applies to local filesystems. - */ -PUBLIC void LYTrimPathSep ARGS1( - char *, path) -{ - size_t len; - - if (path != 0 - && (len = strlen(path)) != 0 - && LYIsPathSep(path[len-1])) - path[len-1] = 0; -} - -#ifdef DOSPATH -#define PATHSEP_STR "\\" -#else -#define PATHSEP_STR "/" -#endif - -/* - * Add a trailing path-separator to avoid confusing other programs when we concatenate - * to it. This only applies to local filesystems. - */ -PUBLIC void LYAddPathSep ARGS1( - char **, path) -{ - size_t len; - char *temp; - - if ((path != 0) - && ((temp = *path) != 0) - && (len = strlen(temp)) != 0 - && !LYIsPathSep(temp[len-1])) { - StrAllocCat(*path, PATHSEP_STR); - } -} - -/* - * Add a trailing path-separator to avoid confusing other programs when we concatenate - * to it. This only applies to local filesystems. - */ -PUBLIC void LYAddPathSep0 ARGS1( - char *, path) -{ - size_t len; - - if ((path != 0) - && (len = strlen(path)) != 0 - && !LYIsPathSep(path[len-1])) { - strcat(path, PATHSEP_STR); - } -} - -/* - * Trim a trailing path-separator to avoid confusing other programs when we concatenate - * to it. This only applies to HTML paths. - */ -PUBLIC void LYTrimHtmlSep ARGS1( - char *, path) -{ - size_t len; - - if (path != 0 - && (len = strlen(path)) != 0 - && LYIsHtmlSep(path[len-1])) - path[len-1] = 0; -} - -/* - * Add a trailing path-separator to avoid confusing other programs when we concatenate - * to it. This only applies to HTML paths. - */ -PUBLIC void LYAddHtmlSep ARGS1( - char **, path) -{ - size_t len; - char *temp; - - if ((path != 0) - && ((temp = *path) != 0) - && (len = strlen(temp)) != 0 - && !LYIsHtmlSep(temp[len-1])) { - StrAllocCat(*path, "/"); - } -} - -/* - * Add a trailing path-separator to avoid confusing other programs when we concatenate - * to it. This only applies to HTML paths. - */ -PUBLIC void LYAddHtmlSep0 ARGS1( - char *, path) -{ - size_t len; - - if ((path != 0) - && (len = strlen(path)) != 0 - && !LYIsHtmlSep(path[len-1])) { - strcat(path, "/"); - } -} - -/* - * Invoke a shell command - */ -PUBLIC int LYSystem ARGS1( - char *, command) -{ - int code; - - fflush(stdout); - fflush(stderr); - -#ifdef __DJGPP__ - __djgpp_set_ctrl_c(0); - _go32_want_ctrl_break(1); -#endif /* __DJGPP__ */ - -#ifdef VMS - code = DCLsystem(command); -#else - code = system(command); -#endif - -#ifdef __DJGPP__ - __djgpp_set_ctrl_c(1); - _go32_want_ctrl_break(0); -#endif /* __DJGPP__ */ - - fflush(stdout); - fflush(stderr); - - return code; -} - -/* - * Return a string which can be used in LYSystem() for spawning a subshell - */ -PUBLIC char *LYSysShell NOARGS -{ - char *shell = 0; -#ifdef DOSPATH - if (getenv("SHELL") != NULL) { - shell = getenv("SHELL"); - } else { - shell = (getenv("COMSPEC") == NULL) ? "command.com" : getenv("COMSPEC"); - } -#else -#ifdef __EMX__ - if (getenv("SHELL") != NULL) { - shell = getenv("SHELL"); - } else { - shell = (getenv("COMSPEC") == NULL) ? "cmd.exe" : getenv("COMSPEC"); - } -#else -#ifdef VMS - shell = ""; -#else - shell = "exec $SHELL"; -#endif /* __EMX__ */ -#endif /* VMS */ -#endif /* DOSPATH */ - return shell; -} - -#ifdef VMS -#define DISPLAY "DECW$DISPLAY" -#else -#define DISPLAY "DISPLAY" -#endif /* VMS */ - -/* - * Return the X-Window $DISPLAY string if it is nonnull/nonempty - */ -PUBLIC char *LYgetXDisplay NOARGS -{ - char *cp; - if ((cp = getenv(DISPLAY)) == NULL || *cp == '\0') - cp = 0; - return cp; -} - -/* - * Set the value of the X-Window $DISPLAY variable (yes it leaks memory, but - * that is putenv's fault). - */ -PUBLIC void LYsetXDisplay ARGS1( - char *, new_display) -{ - if (new_display != 0 && *new_display != '\0') { -#ifdef VMS - LYUpperCase(new_display); - Define_VMSLogical(DISPLAY, new_display); -#else - static char *display_putenv_command; - display_putenv_command = malloc(strlen(new_display) + 12); - - sprintf(display_putenv_command, "DISPLAY=%s", new_display); - putenv(display_putenv_command); -#endif /* VMS */ - if ((new_display = LYgetXDisplay()) != 0) { - StrAllocCopy(x_display, new_display); - } - } -} diff --git a/src/LYUtils.h b/src/LYUtils.h index 5c4ab08e..29ab92c4 100644 --- a/src/LYUtils.h +++ b/src/LYUtils.h @@ -1,122 +1,70 @@ + #ifndef LYUTILS_H #define LYUTILS_H +#include <stdio.h> + #ifndef HTLIST_H #include <HTList.h> #endif /* HTLIST_H */ -#ifdef VMS -#include <HTVMSUtils.h> -#define HTSYS_name(path) HTVMS_name("", path) -#define HTSYS_purge(path) HTVMS_purge(path) -#define HTSYS_remove(path) HTVMS_remove(path) -#endif /* VMS */ - -#if defined(DOSPATH) || defined(__EMX__) -#include <HTDOS.h> -#define HTSYS_name(path) HTDOS_name(path) -#endif - -#ifndef HTSYS_name -#define HTSYS_name(path) path -#endif - -#ifndef HTSYS_purge -#define HTSYS_purge(path) /*nothing*/ -#endif - -#ifndef HTSYS_remove -#define HTSYS_remove(path) remove(path) -#endif - -#ifdef DOSPATH -#define LYIsPathSep(ch) ((ch) == '/' || (ch) == '\\') -#else -#define LYIsPathSep(ch) ((ch) == '/') -#endif - -#define LYIsHtmlSep(ch) ((ch) == '/') - -#define TABLESIZE(v) (sizeof(v)/sizeof(v[0])) - -extern BOOLEAN LYAddSchemeForURL PARAMS((char **AllocatedString, char *default_scheme)); -extern BOOLEAN LYCachedTemp PARAMS((char *result, char **cached)); -extern BOOLEAN LYCanDoHEAD PARAMS((CONST char *address)); -extern BOOLEAN LYExpandHostForURL PARAMS((char **AllocatedString, char *prefix_list, char *suffix_list)); -extern BOOLEAN LYPathOffHomeOK PARAMS((char *fbuffer, size_t fbuffer_size)); -extern BOOLEAN LYisLocalAlias PARAMS((char *filename)); +extern void highlight PARAMS((int flag, int cur, char *target)); +extern void free_and_clear PARAMS((char **obj)); +extern void collapse_spaces PARAMS((char *string)); +extern void convert_to_spaces PARAMS((char *string, BOOL condense)); +extern char * strip_trailing_slash PARAMS((char * dirname)); +extern void statusline PARAMS((CONST char *text)); +extern void toggle_novice_line NOPARAMS; +extern void noviceline PARAMS((int more_flag)); +extern void LYFakeZap PARAMS((BOOL set)); +extern int HTCheckForInterrupt NOPARAMS; extern BOOLEAN LYisLocalFile PARAMS((char *filename)); extern BOOLEAN LYisLocalHost PARAMS((char *filename)); -extern BOOLEAN inlocaldomain NOPARAMS; -extern CONST char *Home_Dir NOPARAMS; -extern FILE *LYAppendToTxtFile PARAMS((char * name)); -extern FILE *LYNewBinFile PARAMS((char * name)); -extern FILE *LYNewTxtFile PARAMS((char * name)); -extern FILE *LYOpenScratch PARAMS((char *result, CONST char *prefix)); -extern FILE *LYOpenTemp PARAMS((char *result, CONST char *suffix, CONST char *mode)); -extern FILE *LYReopenTemp PARAMS((char *name)); -extern char *LYPathLeaf PARAMS((char * pathname)); -extern char *LYSysShell NOPARAMS; -extern char *LYgetXDisplay NOPARAMS; -extern char *quote_pathname PARAMS((char *pathname)); -extern char *strip_trailing_slash PARAMS((char * my_dirname)); -extern char *wwwName PARAMS((CONST char *pathname)); -extern int HTCheckForInterrupt NOPARAMS; +extern void LYLocalhostAliases_free NOPARAMS; +extern void LYAddLocalhostAlias PARAMS((char *alias)); +extern BOOLEAN LYisLocalAlias PARAMS((char *filename)); extern int LYCheckForProxyURL PARAMS((char *filename)); -extern int LYOpenInternalPage PARAMS((FILE **fp0, char **newfile)); -extern int LYSystem PARAMS((char *command)); extern int is_url PARAMS((char *filename)); -extern int number2arrows PARAMS((int number)); -extern time_t LYmktime PARAMS((char *string, BOOL absolute)); -extern void BeginInternalPage PARAMS((FILE *fp0, char *Title, char *HelpURL)); -extern void EndInternalPage PARAMS((FILE *fp0)); -extern void HTAddSugFilename PARAMS((char *fname)); +extern BOOLEAN LYCanDoHEAD PARAMS((CONST char *address)); +extern void remove_backslashes PARAMS((char *buf)); +extern char *quote_pathname PARAMS((char *pathname)); +extern BOOLEAN inlocaldomain NOPARAMS; +extern void size_change PARAMS((int sig)); extern void HTSugFilenames_free NOPARAMS; -extern void LYAddHtmlSep PARAMS((char **path)); -extern void LYAddHtmlSep0 PARAMS((char *path)); -extern void LYAddLocalhostAlias PARAMS((char *alias)); -extern void LYAddPathSep PARAMS((char **path)); -extern void LYAddPathSep0 PARAMS((char *path)); -extern void LYAddPathToHome PARAMS((char *fbuffer, size_t fbuffer_size, char *fname)); -extern void LYCheckMail NOPARAMS; -extern void LYCleanupTemp NOPARAMS; -extern void LYCloseTemp PARAMS((char *name)); -extern void LYCloseTempFP PARAMS((FILE *fp)); -extern void LYConvertToURL PARAMS((char **AllocatedString)); -extern void LYDoCSI PARAMS((char *url, CONST char *comment, char **csi)); -extern void LYEnsureAbsoluteURL PARAMS((char **href, CONST char *name)); -extern void LYFakeZap PARAMS((BOOL set)); -extern void LYLocalFileToURL PARAMS((char **target, CONST char *source)); -extern void LYLocalhostAliases_free NOPARAMS; -extern void LYRemoveTemp PARAMS((char *name)); -extern void LYTrimHtmlSep PARAMS((char *path)); -extern void LYTrimPathSep PARAMS((char *path)); -extern void LYTrimRelFromAbsPath PARAMS((char *path)); -extern void LYsetXDisplay PARAMS((char *new_display)); +extern void HTAddSugFilename PARAMS((char *fname)); extern void change_sug_filename PARAMS((char *fname)); +extern void tempname PARAMS((char *namebuffer, int action)); +extern int number2arrows PARAMS((int number)); +extern void parse_restrictions PARAMS((char *s)); extern void checkmail NOPARAMS; -extern void convert_to_spaces PARAMS((char *string, BOOL condense)); -extern void free_and_clear PARAMS((char **obj)); -extern void highlight PARAMS((int flag, int cur, char *target)); -extern void noviceline PARAMS((int more_flag)); -extern void parse_restrictions PARAMS((CONST char *s)); -extern void remove_backslashes PARAMS((char *buf)); -extern void size_change PARAMS((int sig)); -extern void statusline PARAMS((CONST char *text)); -extern void toggle_novice_line NOPARAMS; - +extern int LYCheckMail NOPARAMS; +extern void LYEnsureAbsoluteURL PARAMS((char **href, char *name)); +extern void LYConvertToURL PARAMS((char **AllocatedString)); +extern BOOLEAN LYExpandHostForURL PARAMS(( + char **AllocatedString, char *prefix_list, char *suffix_list)); +extern BOOLEAN LYAddSchemeForURL PARAMS(( + char **AllocatedString, char *default_scheme)); +extern void LYTrimRelFromAbsPath PARAMS((char *path)); +extern void LYDoCSI PARAMS((char *url, CONST char *comment, char **csi)); #ifdef VMS -extern void Define_VMSLogical PARAMS((char *LogicalName, char *LogicalValue)); +extern void Define_VMSLogical PARAMS(( + char *LogicalName, char *LogicalValue)); #endif /* VMS */ - +extern CONST char *Home_Dir NOPARAMS; +extern BOOLEAN LYPathOffHomeOK PARAMS((char *fbuffer, size_t fbuffer_size)); +extern void LYAddPathToHome PARAMS(( + char *fbuffer, size_t fbuffer_size, char *fname)); +extern time_t LYmktime PARAMS((char *string, BOOL absolute)); #if ! HAVE_PUTENV extern int putenv PARAMS((CONST char *string)); #endif /* HAVE_PUTENV */ +FILE *LYNewBinFile PARAMS((char * name)); +FILE *LYNewTxtFile PARAMS((char * name)); +FILE *LYAppendToTxtFile PARAMS((char * name)); #ifdef UNIX extern void LYRelaxFilePermissions PARAMS((CONST char * name)); #endif - /* * Whether or not the status line must be shown. */ @@ -167,11 +115,10 @@ extern BOOLEAN mustshow; #define LYNXIMGMAP_URL_TYPE 33 #define LYNXCOOKIE_URL_TYPE 34 #define LYNXDIRED_URL_TYPE 35 -#define LYNXOPTIONS_URL_TYPE 36 -#define PROXY_URL_TYPE 37 +#define PROXY_URL_TYPE 36 -#define UNKNOWN_URL_TYPE 38 +#define UNKNOWN_URL_TYPE 37 /* * For change_sug_filename(). @@ -179,6 +126,12 @@ extern BOOLEAN mustshow; extern HTList *sug_filenames; /* + * For tempname(). + */ +#define NEW_FILE 0 +#define REMOVE_FILES 1 + +/* * Miscellaneous. */ #define ON 1 diff --git a/src/LYexit.c b/src/LYexit.c index 0eace151..1e2fb11c 100644 --- a/src/LYexit.c +++ b/src/LYexit.c @@ -2,18 +2,20 @@ * Copyright (c) 1994, University of Kansas, All Rights Reserved */ #include <HTUtils.h> +#include <tcp.h> #include <LYexit.h> #ifndef VMS #include <LYGlobalDefs.h> #include <LYUtils.h> #include <LYSignal.h> #include <LYClean.h> -#include <LYMainLoop.h> #ifdef SYSLOG_REQUESTED_URLS #include <syslog.h> #endif /* SYSLOG_REQUESTED_URLS */ #endif /* !VMS */ +#define FREE(x) if (x) {free(x); x = NULL;} + /* * Stack of functions to call upon exit. */ @@ -111,7 +113,13 @@ PUBLIC void LYexit ARGS1( printf("\r\n%s\r\n\r\n", MEMORY_EXHAUSTED_ABORT); fflush(stdout); } - LYCloseTracelog(); + if (LYTraceLogFP != NULL) { + fflush(stdout); + fflush(stderr); + fclose(LYTraceLogFP); + LYTraceLogFP = NULL; + *stderr = LYOrigStderr; + } #endif /* !VMS */ exit(status); } @@ -136,7 +144,8 @@ void (*function)(); * Check for available space. */ if (topOfStack == ATEXITSIZE) { - CTRACE(tfp, "(LY)atexit: Too many functions, ignoring one!\n"); + if (TRACE) + fprintf(stderr, "(LY)atexit: Too many functions, ignoring one!\n"); return(-1); } @@ -166,13 +175,3 @@ PRIVATE void LYCompleteExit NOPARAMS callstack[topOfStack](); } } - -PUBLIC void outofmem ARGS2( - CONST char *, fname, - CONST char *, func) -{ - fprintf(stderr, - "\r\n\r\n\r\n%s %s: out of memory. Aborting...\r\n", fname, func); - LYOutOfMemory = TRUE; - LYexit(-1); -} diff --git a/src/LYrcFile.c b/src/LYrcFile.c index 1c63fff1..64aadeff 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTFTP.h> #include <LYUtils.h> #include <LYrcFile.h> @@ -6,20 +7,13 @@ #include <LYGlobalDefs.h> #include <LYCharSets.h> #include <LYBookmark.h> -#include <LYCookie.h> #include <LYLeaks.h> -#ifdef FNAMES_8_3 -#define FNAME_LYNXRC "lynx.rc" -#else -#define FNAME_LYNXRC ".lynxrc" -#endif /* FNAMES_8_3 */ - PUBLIC void read_rc NOPARAMS { char line_buffer[256]; - char rcfile[LY_MAXPATH]; + char rcfile[256]; FILE *fp; char *cp, *cp2; int number_sign; @@ -31,7 +25,15 @@ PUBLIC void read_rc NOPARAMS /* * Make an RC file name. */ - LYAddPathToHome(rcfile, sizeof(rcfile), FNAME_LYNXRC); +#ifdef DJGPP + sprintf(rcfile, "%s/lynx.rc", Home_Dir()); +#else +#ifdef VMS + sprintf(rcfile, "sys$login:.lynxrc"); +#else + sprintf(rcfile, "%s/.lynxrc", Home_Dir()); +#endif /* VMS */ +#endif /* DJGPP */ /* * Open the RC file for reading. @@ -43,7 +45,7 @@ PUBLIC void read_rc NOPARAMS /* * Process the entries. */ - while (fgets(line_buffer, sizeof(line_buffer)-1, fp) != NULL) { + while (fgets(line_buffer, 256, fp) != NULL) { /* * Remove the /n from the end of the line. */ @@ -53,7 +55,8 @@ PUBLIC void read_rc NOPARAMS /* * Remove any trailing white space. */ - LYTrimTrailing(line_buffer); + while (line_buffer[0] && isspace(line_buffer[strlen(line_buffer)-1])) + line_buffer[strlen(line_buffer)-1] = '\0'; /* * Skip any comment or blank lines. @@ -78,7 +81,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ StrAllocCopy(editor, cp); /* @@ -89,7 +93,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp,'=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ /* * Since this is the "Default Bookmark File", we save it @@ -108,7 +113,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = (cp2 + 1); - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (!strncasecomp(cp, "standard", 8)) { LYMultiBookmarks = TRUE; LYMBMAdvanced = FALSE; @@ -175,7 +181,8 @@ PUBLIC void read_rc NOPARAMS /* * Eat spaces in front of description. */ - MBM_cp1 = LYSkipBlanks(MBM_cp1); + while (isspace(*MBM_cp1)) + MBM_cp1++; while (*MBM_cp1) MBM_line[MBM_i2++] = *MBM_cp1++; MBM_line[MBM_i2++] = '\0'; @@ -198,7 +205,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (!strncasecomp(cp, "BY_FILENAME", 11)) HTfileSortMethod = FILE_BY_NAME; else if (!strncasecomp(cp, "BY_TYPE", 7)) @@ -217,7 +225,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ StrAllocCopy(personal_mail_address, cp); /* @@ -229,7 +238,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (!strncasecomp(cp, "on", 2)) case_sensitive = TRUE; else @@ -245,13 +255,15 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); - - i = UCGetLYhndl_byAnyName(cp); /* by MIME or full name */ - if (i < 0) - ; /* do nothing here: so fallback to lynx.cfg */ - else - current_char_set = i; + while (isspace(*cp)) + cp++; /* get rid of spaces */ + for (; LYchar_set_names[i]; i++) { + if (!strncmp(cp, LYchar_set_names[i], strlen(cp))) { + current_char_set=i; + HTMLSetRawModeDefault(i); + break; + } + } /* * Preferred language. @@ -262,7 +274,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ StrAllocCopy(language, cp); /* @@ -274,7 +287,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ StrAllocCopy(pref_charset, cp); /* @@ -285,7 +299,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char * )strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (!strncasecomp(cp, "on", 2)) vi_keys = TRUE; else @@ -299,7 +314,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (!strncasecomp(cp, "on", 2)) emacs_keys = TRUE; else @@ -313,7 +329,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char * )strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (!strncasecomp(cp, "on", 2)) show_dotfiles = TRUE; else @@ -327,7 +344,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char * )strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (!strncasecomp(cp, "always", 6)) { LYrcShowColor = SHOW_COLOR_ALWAYS; #if defined(USE_SLANG) || defined(COLOR_CURSES) @@ -350,7 +368,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char * )strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (!strncasecomp(cp, "off", 3)) LYSelectPopups = FALSE; else @@ -364,7 +383,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char * )strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (!strncasecomp(cp, "off", 3)) LYShowCursor = FALSE; else @@ -378,7 +398,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (LYstrstr(cp, "LINKS_ARE_NUMBERED")) keypad_mode = LINKS_ARE_NUMBERED; else if (LYstrstr(cp, "LINKS_AND_FORM_FIELDS_ARE_NUMBERED")) @@ -396,7 +417,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ for (; LYLineeditNames[i]; i++) { if (!strncmp(cp, LYLineeditNames[i], strlen(cp))) { current_lineedit = i; @@ -413,7 +435,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp,'=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (LYstrstr(cp, "FILES_FIRST") != NULL) { dir_list_style = FILES_FIRST; } else if (LYstrstr(cp,"DIRECTORIES_FIRST") != NULL) { @@ -424,59 +447,6 @@ PUBLIC void read_rc NOPARAMS #endif /* DIRED_SUPPORT */ /* - * Accept cookies from all domains? - */ - } else if ((cp = LYstrstr(line_buffer, "accept_all_cookies")) != NULL && - cp-line_buffer < number_sign) { - if((cp2 = (char *)strchr(cp,'=')) != NULL) - cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ - if (LYstrstr(cp,"TRUE") != NULL) { - LYAcceptAllCookies = TRUE; - } else { - LYAcceptAllCookies = FALSE; - } - - - /* - * Accept all cookies from certain domains? - */ - } else if ((cp = LYstrstr(line_buffer, "cookie_accept_domains")) - != NULL && cp-line_buffer < number_sign) { - if((cp2 = (char *)strchr(cp,'=')) != NULL) - cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ - cookie_add_acceptlist(cp); - - - /* - * Reject all cookies from certain domains? - */ - } else if ((cp = LYstrstr(line_buffer, "cookie_reject_domains")) - != NULL && cp-line_buffer < number_sign) { - if((cp2 = (char *)strchr(cp,'=')) != NULL) - cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ - cookie_add_rejectlist(cp); - -#ifdef EXP_PERSISTENT_COOKIES - /* - * File to store cookies in. - */ - } else if ((cp = LYstrstr(line_buffer, "cookie_file")) - != NULL && cp-line_buffer < number_sign) { - if((cp2 = (char *)strchr(cp,'=')) != NULL) - cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ - - StrAllocCopy(LYCookieFile, cp); -#endif /* EXP_PERSISTENT_COOKIES */ - - /* * User mode. */ } else if ((cp = LYstrstr(line_buffer, "user_mode")) != NULL && @@ -484,7 +454,8 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (LYstrstr(cp, "ADVANCED") != NULL) { user_mode = ADVANCED_MODE; } else if (LYstrstr(cp,"INTERMEDIATE") != NULL) { @@ -503,26 +474,14 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ + if (!strncasecomp(cp, "on", 2)) local_exec = TRUE; else local_exec = FALSE; -#ifdef DISP_PARTIAL - /* - * Partial display logic--set the threshold # of lines before - * Lynx redraws the screen - */ - } else if ((cp = LYstrstr(line_buffer, "partial_thres")) != NULL && - cp-line_buffer < number_sign) { - if ((cp2 = (char *)strchr(cp, '=')) != NULL) - cp = cp2 + 1; - cp = LYSkipBlanks(cp); - if (atoi(cp) != 0) - partial_threshold = atoi(cp); -#endif /* DISP_PARTIAL */ - /* * Local execution mode - only links in local files. */ @@ -532,25 +491,14 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - cp = LYSkipBlanks(cp); + while (isspace(*cp)) + cp++; /* get rid of spaces */ if (!strncasecomp(cp, "on", 2)) local_exec_on_local_files = TRUE; else local_exec_on_local_files=FALSE; #endif /* ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */ - } else if ((cp = LYstrstr(line_buffer, - "verbose_images")) != NULL && - cp-line_buffer < number_sign) { - - if ((cp2 = (char *)strchr(cp, '=')) != NULL) - cp = cp2 + 1; - cp = LYSkipBlanks(cp); - if (!strncasecomp(cp, "on", 2)) - verbose_img = 1; - else if (!strncasecomp(cp, "off", 3)) - verbose_img = 0; - } /* end of if */ } /* end of while */ @@ -560,7 +508,7 @@ PUBLIC void read_rc NOPARAMS PUBLIC int save_rc NOPARAMS { - char rcfile[LY_MAXPATH]; + char rcfile[256]; FILE *fp; int i; int MBM_c; @@ -568,11 +516,22 @@ PUBLIC int save_rc NOPARAMS /* * Make a name. */ - LYAddPathToHome(rcfile, sizeof(rcfile), FNAME_LYNXRC); +#ifdef DJGPP + sprintf(rcfile, "%s/lynx.rc", Home_Dir()); +#else +#ifdef VMS + sprintf(rcfile, "sys$login:.lynxrc"); +#else + sprintf(rcfile, "%s/.lynxrc", Home_Dir()); +#endif /* VMS */ +#endif /* DJGPP */ /* * Open the file for write. */ +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_TEXT; +#endif /* __DJGPP__ or _WINDOWS */ if ((fp = LYNewTxtFile(rcfile)) == NULL) { return FALSE; } @@ -813,7 +772,7 @@ PUBLIC int save_rc NOPARAMS # current link in documents, or current option in select popup windows.\n\ # Positioning the cursor to the left of the current link or option is\n\ # helpful for speech or braille interfaces, and when the terminal is\n\ -# one which does not distinguish the current link based on highlighting\n\ +# one which does not distingish the current link based on highlighting\n\ # 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"); @@ -850,24 +809,11 @@ PUBLIC int save_rc NOPARAMS ((keypad_mode == LINKS_ARE_NUMBERED) ? "LINKS_ARE_NUMBERED" : "LINKS_AND_FORM_FIELDS_ARE_NUMBERED"))); -#ifdef DISP_PARTIAL - /* - * Partial display threshold - */ - fprintf(fp, "\ -# partial_thres specifies the number of lines Lynx should download and render\n\ -# before we redraw the screen in Partial Display logic\n\ -# e.g. partial_thres=2\n\ -# would have Lynx redraw every 2 lines that it renders\n\ -# partial_thres=-1 would use the entire screensize\n"); - fprintf(fp, "partial_thres=%d\n\n", partial_threshold); -#endif /* DISP_PARTIAL */ - /* * Lineedit mode. */ fprintf(fp, "\ -# lineedit_mode specifies the key binding used for inputting strings in\n\ +# linedit_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\ #\n\ @@ -918,50 +864,12 @@ PUBLIC int save_rc NOPARAMS (user_mode == ADVANCED_MODE ? "ADVANCED" : "INTERMEDIATE"))); - /* - * Cookie options - */ - fprintf(fp, "\ -# 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"); - fprintf(fp, "accept_all_cookies=%s\n\n", - (LYAcceptAllCookies == FALSE ? "FALSE" : "TRUE")); - - fprintf(fp, "\ -# cookie_accept_domains and cookie_reject_domains are comma-delimited\n\ -# lists of domains (with a leading '.') to automatically accept or\n\ -# reject all cookies from. The accept_all_cookies parameter will\n\ -# override any settings made here. If a single domain is specified in\n\ -# both cookie_accept_domains and in cookie_reject_domains, the rejection\n\ -# will take precedence.\n"); - fprintf(fp, "# cookie_accept_domains=\n"); - fprintf(fp, "# cookie_reject_domains=\n\n"); - - /* - * cookie_accept_domains and cookie_reject_domains not set here because - * there's not currently a method on the options menu (maybe later?) - * to set them. - */ - -#ifdef EXP_PERSISTENT_COOKIES - /* - * Cookie file. - */ - fprintf(fp, "\ -# cookie_file specifies the file in which to store persistent cookies.\n\ -# The default is ~/.lynx_cookies.\n"); - fprintf(fp, "cookie_file=%s\n\n", - (LYCookieFile == NULL ? "~/.lynx_cookies" : LYCookieFile)); -#endif /* EXP_PERSISTENT_COOKIES */ - #if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) /* * Local execution mode - all links. */ fprintf(fp, "\ -# If run_all_execution_links is set \"on\" then all local execution links\n\ +# If run_all_execution_links is set \"on\" then all local exection links\n\ # will be executed when they are selected.\n\ #\n\ # WARNING - This is potentially VERY dangerous. Since you may view\n\ @@ -993,19 +901,24 @@ PUBLIC int save_rc NOPARAMS (local_exec_on_local_files ? "on" : "off")); #endif /* defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) */ - fprintf(fp, "\ -# 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"); - fprintf(fp, "verbose_images=%s\n\n", - verbose_img ? "on" : "off"); - /* * Close the RC file. */ fclose(fp); +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_BINARY; +#endif /* __DJGPP__ or _WINDOWS */ - HTSYS_purge(rcfile); +#ifdef VMS + /* + * Get rid of any copies of the .lynxrc file that VMS creates. + */ + while (remove("sys$login:.lynxrc;-1") == 0) ; + /* + * Reset version number. + */ + rename("sys$login:.lynxrc", "sys$login:.lynxrc;1"); +#endif /* VMS */ - return TRUE; + return TRUE; } diff --git a/src/UCAuto.c b/src/UCAuto.c index a3584ecb..e5f11af9 100644 --- a/src/UCAuto.c +++ b/src/UCAuto.c @@ -15,7 +15,7 @@ */ #include <HTUtils.h> -#include <LYUtils.h> +#include <tcp.h> #include <UCMap.h> #include <UCDefs.h> @@ -26,6 +26,12 @@ #ifdef EXP_CHARTRANS_AUTOSWITCH +#ifdef VMS +#define DISPLAY "DECW$DISPLAY" +#else +#define DISPLAY "DISPLAY" +#endif /* VMS */ + #ifdef LINUX typedef enum { Is_Unset, Is_Set, Dunno, Dont_Care @@ -77,8 +83,10 @@ PRIVATE void call_setfont ARGS3( } if (*T_setfont_cmd) { - CTRACE(tfp, "Executing setfont: '%s'\n", T_setfont_cmd); - LYSystem(T_setfont_cmd); + if (TRACE) { + fprintf(stderr, "Executing setfont: '%s'\n", T_setfont_cmd); + } + system(T_setfont_cmd); } } @@ -99,7 +107,7 @@ PRIVATE int nonempty_file ARGS1( struct stat sb; return (stat(p, &sb) == 0 && - S_ISREG(sb.st_mode) && + (sb.st_mode & S_IFMT) == S_IFREG && (sb.st_size != 0)); } @@ -125,6 +133,7 @@ PUBLIC void UCChangeTerminalCodepage ARGS2( TGen_state_t HasUmap = Dunno; char tmpbuf1[100], tmpbuf2[20]; + char *cp; /* * Restore the original character set. @@ -143,7 +152,7 @@ PUBLIC void UCChangeTerminalCodepage ARGS2( sprintf(tmpbuf1, "%s %s %s", SETFONT, old_font, NOOUTPUT); } - LYSystem(tmpbuf1); + system(tmpbuf1); } remove(old_font); @@ -160,7 +169,7 @@ PUBLIC void UCChangeTerminalCodepage ARGS2( old_font = tempnam((char *)0, "font"); sprintf(tmpbuf1, "%s -o %s -ou %s %s", SETFONT, old_font, old_umap, NOOUTPUT); - LYSystem(tmpbuf1); + system(tmpbuf1); } name = p->MIMEname; @@ -176,8 +185,8 @@ PUBLIC void UCChangeTerminalCodepage ARGS2( /* * Use this for output of escape sequences. */ - if ((x_display != NULL) || - LYgetXDisplay() != NULL) { + if ((display != NULL) || + ((cp = getenv(DISPLAY)) != NULL && *cp != '\0')) { /* * We won't do anything in an xterm. Better that way... */ @@ -330,7 +339,10 @@ PUBLIC void UCChangeTerminalCodepage ARGS2( int, newcs, LYUCcharset *, p) { - CTRACE(tfp, "UCChangeTerminalCodepage: Called, but not implemented!"); + if (TRACE) { + fprintf(stderr, + "UCChangeTerminalCodepage: Called, but not implemented!"); + } } #endif /* LINUX */ @@ -342,6 +354,9 @@ PUBLIC void UCChangeTerminalCodepage ARGS2( int, newcs GCC_UNUSED, LYUCcharset *, p GCC_UNUSED) { - CTRACE(tfp, "UCChangeTerminalCodepage: Called, but not implemented!"); + if (TRACE) { + fprintf(stderr, + "UCChangeTerminalCodepage: Called, but not implemented!"); + } } #endif /* EXP_CHARTRANS_AUTOSWITCH */ diff --git a/src/UCAuto.h b/src/UCAuto.h index e9f1681e..b4d582c3 100644 --- a/src/UCAuto.h +++ b/src/UCAuto.h @@ -1,8 +1,7 @@ + #ifndef UCAUTO_H #define UCAUTO_H -#include <UCDefs.h> - extern void UCChangeTerminalCodepage PARAMS((int newcs, LYUCcharset *p)); #endif /* UCAUTO_H */ diff --git a/src/UCAux.c b/src/UCAux.c index 6847b150..3a8bc56d 100644 --- a/src/UCAux.c +++ b/src/UCAux.c @@ -1,4 +1,5 @@ #include <HTUtils.h> +#include <tcp.h> #include <HTCJK.h> #include <UCDefs.h> @@ -37,9 +38,9 @@ PUBLIC BOOL UCCanTranslateFromTo ARGS2( return YES; if (from < 0 || to < 0) return NO; - if (from == LATIN1) + if (from == 0) return UCCanTranslateUniTo(to); - if (to == LATIN1 || LYCharSet_UC[to].enc == UCT_ENC_UTF8) + if (to == 0 || LYCharSet_UC[to].enc == UCT_ENC_UTF8) return UCCanUniTranslateFrom(from); { CONST char * fromname = LYCharSet_UC[from].MIMEname; @@ -102,7 +103,7 @@ PUBLIC BOOL UCNeedNotTranslate ARGS2( } if (to < 0) return NO; /* ??? */ - if (to == LATIN1) { + if (to == 0) { if (LYCharSet_UC[from].codepoints & (UCT_CP_SUBSETOF_LAT1)) return YES; } @@ -113,7 +114,7 @@ PUBLIC BOOL UCNeedNotTranslate ARGS2( if (LYCharSet_UC[to].enc == UCT_ENC_UTF8) { return NO; } - if (from == LATIN1) { + if (from == 0) { if (LYCharSet_UC[from].codepoints & (UCT_CP_SUPERSETOF_LAT1)) return YES; } @@ -121,7 +122,14 @@ PUBLIC BOOL UCNeedNotTranslate ARGS2( if (HTCJK == NOCJK) /* Use that global flag, for now. */ return NO; if (HTCJK == JAPANESE && + /* + ** Always strip the "x-" from "x-euc-jp", + ** or convert "x-shift-jis" to "shift_jis", + ** before calling this function, and so + ** don't check for them here. - FM + */ (!strcmp(fromname, "euc-jp") || + !strncmp(fromname, "iso-2022-jp",11) || !strcmp(fromname, "shift_jis"))) return YES; /* ??? */ return NO; /* If not handled by (from == to) above. */ @@ -178,7 +186,7 @@ PUBLIC void UCSetTransParams ARGS5( pT->trans_C0_to_uni = (p_in->enc == UCT_ENC_8BIT_C0 || p_out->enc == UCT_ENC_8BIT_C0); } else { - /* + /* ** Initialize local flags. - FM */ BOOL intm_ucs = FALSE; @@ -215,7 +223,7 @@ PUBLIC void UCSetTransParams ARGS5( ** equivalent to them, i.e. if we have UCS without ** having to do a table translation. */ - intm_ucs = (cs_in == LATIN1 || pT->decode_utf8 || + intm_ucs = (cs_in == 0 || pT->decode_utf8 || (p_in->codepoints & (UCT_CP_SUBSETOF_LAT1|UCT_CP_SUBSETOF_UCS2))); /* @@ -270,7 +278,7 @@ PUBLIC void UCSetTransParams ARGS5( */ pT->use_raw_char_in = (!pT->output_utf8 && cs_in == cs_out && - !pT->trans_C0_to_uni); + !pT->trans_C0_to_uni); /* ** This should be set TRUE when we expect to have ** done translation to Unicode or had the equivalent @@ -405,7 +413,7 @@ PUBLIC BOOL UCConvertUniToUtf8 ARGS2( if (code <= 0 || code > 0x7fffffffL) { *ch = '\0'; - return NO; + return NO; } if (code < 0x800L) { diff --git a/src/UCdomap.c b/src/UCdomap.c index 4a579f34..20d78e92 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -15,6 +15,7 @@ * aeb, 950210 */ #include <HTUtils.h> +#include <tcp.h> #include <HTMLDTD.h> #include <LYGlobalDefs.h> @@ -23,7 +24,6 @@ #include <UCMap.h> #include <UCDefs.h> #include <LYCharSets.h> -#include <LYStrings.h> /* * Include tables & parameters. @@ -67,6 +67,8 @@ #include <mnem_suni.h> #endif /* NOTDEFINED */ +#define FREE(x) if (x) {free(x); x = NULL;} + /* * Some of the code below, and some of the comments, are left in for * historical reasons. Not all those tables below are currently @@ -263,7 +265,7 @@ PRIVATE int con_insert_unipair PARAMS(( int fordefault)); PRIVATE int con_insert_unipair_str PARAMS(( u16 unicode, - CONST char * replace_str, + char * replace_str, int fordefault)); PRIVATE void con_clear_unimap PARAMS(( int fordefault)); @@ -304,7 +306,7 @@ PRIVATE int UC_FindGN_byMIME PARAMS(( CONST char * UC_MIMEcharset)); PRIVATE void UCreset_allocated_LYCharSets NOPARAMS; PRIVATE void UCfree_allocated_LYCharSets NOPARAMS; -PRIVATE CONST char ** UC_setup_LYCharSets_repl PARAMS(( +PRIVATE char ** UC_setup_LYCharSets_repl PARAMS(( int UC_charset_in_hndl, unsigned lowest8)); PRIVATE int UC_Register_with_LYCharSets PARAMS(( @@ -471,7 +473,8 @@ PRIVATE void UC_con_set_trans ARGS3( u16 *ptrans; if (!UC_valid_UC_charset(UC_charset_in_hndl)) { - CTRACE(tfp, "UC_con_set_trans: Invalid charset handle %d.\n", + if (TRACE) + fprintf(stderr, "UC_con_set_trans: Invalid charset handle %d.\n", UC_charset_in_hndl); return; } @@ -600,12 +603,11 @@ PRIVATE int con_insert_unipair ARGS3( PRIVATE int con_insert_unipair_str ARGS3( u16, unicode, - CONST char *, replace_str, + char *, replace_str, int, fordefault) { int i, n; - char ***p1; - CONST char **p2; + char ***p1, **p2; if(fordefault) p1 = unidefault_pagedir_str[n = unicode >> 11]; @@ -625,18 +627,15 @@ PRIVATE int con_insert_unipair_str ARGS3( } } - n = ((unicode >> 6) & 0x1f); - if (!p1[n]) { - p1[n] = (char **)malloc(64*sizeof(char *)); - if (!p1[n]) + if (!(p2 = p1[n = (unicode >> 6) & 0x1f])) { + p2 = p1[n] = (char* *)malloc(64*sizeof(char *)); + if (!p2) return -ENOMEM; - p2 = (CONST char **)p1[n]; for (i = 0; i < 64; i++) { p2[i] = NULL; /* No replace string this character (yet) */ } } - p2 = (CONST char **)p1[n]; p2[unicode & 0x3f] = replace_str; @@ -783,7 +782,8 @@ PRIVATE int UC_con_set_unimap ARGS2( u16 *p; if (!UC_valid_UC_charset(UC_charset_out_hndl)) { - CTRACE(tfp, "UC_con_set_unimap: Invalid charset handle %d.\n", + if (TRACE) + fprintf(stderr, "UC_con_set_unimap: Invalid charset handle %d.\n", UC_charset_out_hndl); return -1; } @@ -896,7 +896,7 @@ PRIVATE int conv_uni_to_pc ARGS2( * Not a printable character. */ return -1; - } else if (ucs == 0xfeff || (ucs >= 0x200b && ucs <= 0x200f)) { + } else if (ucs == 0xfeff || (ucs >= 0x200a && ucs <= 0x200f)) { /* * Zero-width space. */ @@ -961,7 +961,7 @@ PRIVATE int conv_uni_to_str ARGS4( * Not a printable character. */ return -1; - } else if (ucs == 0xfeff || (ucs >= 0x200b && ucs <= 0x200f)) { + } else if (ucs == 0xfeff || (ucs >= 0x200a && ucs <= 0x200f)) { /* * Zero-width space. */ @@ -1190,8 +1190,11 @@ PRIVATE int UC_MapGN ARGS2( UCInfo[UChndl].GN = Gn; UC_GNhandles[Gn] = UChndl; } - CTRACE(tfp, "UC_MapGN: Using %d <- %d (%s)\n", + if (TRACE) { + fprintf(stderr, + "UC_MapGN: Using %d <- %d (%s)\n", Gn, UChndl, UCInfo[UChndl].MIMEname); + } UC_con_set_trans(UChndl,Gn,update_flag); return Gn; } @@ -1275,7 +1278,7 @@ PUBLIC long int UCTransToUni ARGS2( ch_iu = (unsigned char)ch_in; #ifndef UC_NO_SHORTCUTS - if (charset_in == LATIN1) + if (charset_in == 0) return ch_iu; if ((unsigned char)ch_in < 128 && (unsigned char)ch_in >= 32) return ch_iu; @@ -1503,34 +1506,27 @@ PUBLIC int UCGetRawUniMode_byLYhndl ARGS1( } /* - * Get Lynx internal charset handler from MIME name, - * return -1 if we got NULL or did not recognize value. - * According to RFC, MIME headers should match case-insensitively. + * Currently the charset name has to match exactly -- not substring + * matching as was done before (see HTMIME.c, HTML.c). */ PUBLIC int UCGetLYhndl_byMIME ARGS1( - CONST char *, value) + CONST char *, UC_MIMEcharset) { int i; int LYhndl = -1; - char *UC_MIMEcharset = NULL; - if (!value || !(*value)) { - CTRACE(tfp, "UCGetLYhndl_byMIME: NULL argument instead of MIME name.\n"); + if (!UC_MIMEcharset || !(*UC_MIMEcharset)) return -1; - } - - StrAllocCopy(UC_MIMEcharset, value); - LYLowerCase(UC_MIMEcharset); for (i = 0; (i < MAXCHARSETS && i < LYNumCharsets && - LYchar_set_names[i]); i++) { + LYchar_set_names[i] && LYhndl < 0); i++) { if (LYCharSet_UC[i].MIMEname && !strcmp(UC_MIMEcharset, LYCharSet_UC[i].MIMEname)) { - return i; + LYhndl = i; } } - { + if (LYhndl < 0) { /* * Not yet found, try synonyms. - FM */ @@ -1633,12 +1629,9 @@ PUBLIC int UCGetLYhndl_byMIME ARGS1( } if (!strcmp(UC_MIMEcharset, "koi-8")) { /* accentsoft bugosity */ return UCGetLYhndl_byMIME("koi8-r"); - } + } } - /* no more synonyms if come here... */ - - CTRACE(tfp, "UCGetLYhndl_byMIME: unrecognized MIME name \"%s\"\n", value); - return -1; /* returns -1 if no charset found by that MIME name */ + return LYhndl; /* returns -1 if no charset found by that MIME name */ } /* @@ -1661,7 +1654,7 @@ PUBLIC int UCGetLYhndl_byMIME ARGS1( /* * We need to remember which ones were allocated and which are static. */ -PRIVATE CONST char ** remember_allocated_LYCharSets[MAXCHARSETS]; +PRIVATE char ** remember_allocated_LYCharSets[MAXCHARSETS]; PRIVATE void UCreset_allocated_LYCharSets NOARGS { @@ -1683,17 +1676,17 @@ PRIVATE void UCfree_allocated_LYCharSets NOARGS } } -PRIVATE CONST char ** UC_setup_LYCharSets_repl ARGS2( +PRIVATE char ** UC_setup_LYCharSets_repl ARGS2( int, UC_charset_in_hndl, unsigned, lowest8) { - CONST char **ISO_Latin1 = LYCharSets[0]; - CONST char **p; + char **ISO_Latin1 = LYCharSets[0]; + char **p; char **prepl; u16 *pp; - CONST char **tp; - CONST char *s7; - CONST char *s8; + char **tp; + char *s7; + char *s8; size_t i; int j, changed; u16 k; @@ -1702,7 +1695,7 @@ PRIVATE CONST char ** UC_setup_LYCharSets_repl ARGS2( /* * Create a temporary table for reverse lookup of latin1 codes: */ - tp = (CONST char **)malloc(96 * sizeof(CONST char *)); + tp = (char **)malloc(96 * sizeof(char *)); if (!tp) return NULL; for (i = 0; i < 96; i++) @@ -1756,14 +1749,12 @@ PRIVATE CONST char ** UC_setup_LYCharSets_repl ARGS2( * Now allocate a new table compatible with LYCharSets[] * and with the HTMLDTD for entities. * We don't know yet whether we'll keep it around. */ - prepl = (char **)malloc(HTML_dtd.number_of_entities * sizeof(char *)); - if (!prepl) { + p = prepl = (char **)malloc(HTML_dtd.number_of_entities * sizeof(char *)); + if (!p) { FREE(tp); FREE(ti); - return 0; + return NULL; } - - p = (CONST char **)prepl; changed = 0; for (i = 0; i < HTML_dtd.number_of_entities; i++, p++) { /* @@ -1834,7 +1825,7 @@ PRIVATE CONST char ** UC_setup_LYCharSets_repl ARGS2( FREE(prepl); return NULL; } - return (CONST char **)prepl; + return prepl; } /* @@ -1846,61 +1837,70 @@ PRIVATE int UC_Register_with_LYCharSets ARGS4( CONST char *, UC_LYNXcharset, int, lowest_eightbit) { - int i, LYhndl, found; - CONST char **repl; + int i, LYhndl, found; + char **repl; - LYhndl = -1; + LYhndl = -1; if (LYNumCharsets == 0) { /* * Initialize here; so whoever changes * LYCharSets.c doesn't have to count... */ for (i = 0; (i < MAXCHARSETS) && LYchar_set_names[i]; i++) { - LYNumCharsets = i+1; + LYNumCharsets = i+1; } } /* - * Search by MIME name, (LYchar_set_names may differ...) + * Do different kinds of searches... + * Normally the first should find the match if there is one! */ for (i = 0; i < MAXCHARSETS && LYchar_set_names[i] && LYhndl < 0; i++) { + if (!strcmp(UC_LYNXcharset, LYchar_set_names[i])) { + LYhndl = i; + } + } + for (i = 0; i < MAXCHARSETS && LYchar_set_names[i] && LYhndl < 0; i++) { if (LYCharSet_UC[i].MIMEname && !strcmp(UC_MIMEcharset, LYCharSet_UC[i].MIMEname)) { LYhndl = i; } } - if (LYhndl < 0) { /* not found */ - found = 0; - if (LYNumCharsets >= MAXCHARSETS) { - CTRACE(tfp, "UC_Register_with_LYCharSets: Too many. Ignoring %s/%s.", + if (LYhndl < 0) { /* not found */ + found = 0; + if (LYNumCharsets >= MAXCHARSETS) { + if (TRACE) { + fprintf(stderr, + "UC_Register_with_LYCharSets: Too many. Ignoring %s/%s.", UC_MIMEcharset, UC_LYNXcharset); - return -1; - } + } + return -1; + } /* * Add to LYCharSets.c lists. */ LYhndl = LYNumCharsets; LYNumCharsets ++; - LYlowest_eightbit[LYhndl] = 999; - LYCharSets[LYhndl] = SevenBitApproximations; + LYlowest_eightbit[LYhndl] = 999; + LYCharSets[LYhndl] = SevenBitApproximations; /* * Hmm, try to be conservative here. */ LYchar_set_names[LYhndl] = UC_LYNXcharset; LYchar_set_names[LYhndl+1] = NULL; /* - * Terminating NULL may be looked for by Lynx code. - */ + * Terminating NULL may be looked for by Lynx code. + */ } else { found = 1; } - LYCharSet_UC[LYhndl].UChndl = s; + LYCharSet_UC[LYhndl].UChndl = s; /* * Can we just copy the pointer? Hope so... */ - LYCharSet_UC[LYhndl].MIMEname = UC_MIMEcharset; - LYCharSet_UC[LYhndl].enc = UCInfo[s].enc; + LYCharSet_UC[LYhndl].MIMEname = UC_MIMEcharset; + LYCharSet_UC[LYhndl].enc = UCInfo[s].enc; /* * @@@ We really SHOULD get more info from the table files, @@ -1908,22 +1908,22 @@ PRIVATE int UC_Register_with_LYCharSets ARGS4( * that info... For now, let's try it without. - KW */ if (lowest_eightbit < LYlowest_eightbit[LYhndl]) { - LYlowest_eightbit[LYhndl] = lowest_eightbit; + LYlowest_eightbit[LYhndl] = lowest_eightbit; } else if (lowest_eightbit > LYlowest_eightbit[LYhndl]) { - UCInfo[s].lowest_eight = LYlowest_eightbit[LYhndl]; + UCInfo[s].lowest_eight = LYlowest_eightbit[LYhndl]; } - if (!found && LYhndl > 0) { - repl = UC_setup_LYCharSets_repl(s,UCInfo[s].lowest_eight); - if (repl) { - LYCharSets[LYhndl] = repl; + if (!found && LYhndl > 0) { + repl = UC_setup_LYCharSets_repl(s,UCInfo[s].lowest_eight); + if (repl) { + LYCharSets[LYhndl] = repl; /* * Remember to FREE at exit. */ - remember_allocated_LYCharSets[LYhndl] = repl; - } + remember_allocated_LYCharSets[LYhndl]=repl; } - return LYhndl; + } + return LYhndl; } /* @@ -1956,8 +1956,10 @@ PUBLIC void UC_Charset_Setup ARGS8( s = found; } else { if (UCNumCharsets >= MAXCHARSETS) { - CTRACE(tfp, "UC_Charset_Setup: Too many. Ignoring %s/%s.", - UC_MIMEcharset, UC_LYNXcharset); + if (TRACE) { + fprintf(stderr, "UC_Charset_Setup: Too many. Ignoring %s/%s.", + UC_MIMEcharset, UC_LYNXcharset); + } return; } s = UCNumCharsets; @@ -2064,19 +2066,3 @@ PUBLIC void UCInit NOARGS * check function UCGetLYhndl_byMIME in this file. */ } - -/* - * Safe variant of UCGetLYhndl_byMIME, with blind recovery from typo - * in user input: lynx.cfg, userdefs.h, switches from command line. - */ -PUBLIC int safeUCGetLYhndl_byMIME ARGS1 (CONST char *, value) -{ - int i = UCGetLYhndl_byMIME(value); - - if (i == -1) { /* was user's typo or not yet recognized value */ - i = LATIN1; /* error recovery? */ - CTRACE(tfp, "safeUCGetLYhndl_byMIME: ISO-8859-1 assumed.\n"); - } - - return(i); -} diff --git a/src/UCdomap.h b/src/UCdomap.h index e0160953..a0ff36b3 100644 --- a/src/UCdomap.h +++ b/src/UCdomap.h @@ -1,9 +1,7 @@ + #ifndef UCDOMAP_H #define UCDOMAP_H -#include <HTUtils.h> -#include <UCkd.h> - /* * [old comments: - KW ] * consolemap.h @@ -31,7 +29,7 @@ extern void UC_Charset_Setup PARAMS(( int lowest_eight, int UC_rawuni)); -CONST char *UC_GNsetMIMEnames[4] = +char *UC_GNsetMIMEnames[4] = {"iso-8859-1", "x-dec-graphics", "cp437", "x-transparent"}; int UC_GNhandles[4] = {-1, -1, -1, -1}; diff --git a/src/chrtrans/Makefile.old b/src/chrtrans/Makefile.old index 42b49eec..0ca53fc2 100644 --- a/src/chrtrans/Makefile.old +++ b/src/chrtrans/Makefile.old @@ -30,7 +30,6 @@ TABLES= \ cp1257_uni.h \ cp437_uni.h \ cp737_uni.h \ - cp775_uni.h \ cp850_uni.h \ cp852_uni.h \ cp862_uni.h \ @@ -77,7 +76,6 @@ cp1256_uni.h: cp1256_uni.tbl makeuctb cp1257_uni.h: cp1257_uni.tbl makeuctb cp437_uni.h: cp437_uni.tbl makeuctb cp737_uni.h: cp737_uni.tbl makeuctb -cp775_uni.h: cp775_uni.tbl makeuctb cp850_uni.h: cp850_uni.tbl makeuctb cp852_uni.h: cp852_uni.tbl makeuctb cp862_uni.h: cp862_uni.tbl makeuctb diff --git a/src/chrtrans/README.format b/src/chrtrans/README.format index 636afd32..4ced0a14 100644 --- a/src/chrtrans/README.format +++ b/src/chrtrans/README.format @@ -26,7 +26,7 @@ b) directives: start with a keyword which may be abbreviated to one letter (first letter must be capitalized), followed by space and a value. Currently recognized: - + OptionName The name under which this should appear on the O)ptions screen in the list for Display Character Set @@ -53,7 +53,7 @@ c) character translation definitions: 0x41 U+0041 U+0391 ... and are used for "forward" translation (mapping this charset to Unicode) - AS WELL AS "back" translation (mapping Unicodes to an 8-bit + AS WELL AS "back" translation (mapping Unicodes to an 8-bit [incl. 7-bit ASCII] code). For the "forward" direction, only the first Unicode is used; for @@ -63,7 +63,7 @@ c) character translation definitions: The above example line would tell the chartrans mechanism: "For this charset, code position 65 [hex 0x41] contains Unicode U+0041 (LATIN CAPITAL LETTER A). For translation of Unicodes to - this charset, use byte value 65 [hex 0x41] for U+0041 (LATIN CAPITAL + this charset, use byte value 65 [hex 0x41] for U+0041 (LATIN CAPITAL LETTER A) as well as for U+0391 (GREEK CAPITAL LETTER ALPHA)." [Note that for bytes in the ASCII range 0x00-0x7F, the forward translations @@ -82,10 +82,6 @@ c) character translation definitions: * where <range> ::= <fontpos>-<fontpos> * and <unicode> ::= U+<h><h><h><h> * and <h> ::= <hexadecimal digit> - * - [Note that <fontpos> _without_ targets assumed notdefined, - so tables from ftp.unicode.org need no patching.] - d) string replacement definitions: @@ -93,10 +89,10 @@ d) string replacement definitions: U+00cd:I' - which would mean "Replace Unicode U+00cd (LATIN CAPITAL LETTER I WITH + which would mean "Replace Unicode U+00cd (LATIN CAPITAL LETTER I WITH ACUTE" with the string (consisting of two character) I' (if no other translation is available)." Please note that replacement definitions - in certain charset table will override ones from the Default table. + in certnain charset table will override ones from Default table. Note that everything after the ':' is currently taken VERBATIM, so careful with trailing blanks etc. @@ -115,7 +111,7 @@ d) string replacement definitions: Motivation: -- It is an extension of the format already in use for Linux (kernel, +- It is an extention of the format already in use for Linux (kernel, kbd package), those files can be used with some minimal editing. - It is easy to convert Unicode tables for other charsets, as they diff --git a/src/chrtrans/README.tables b/src/chrtrans/README.tables index 5993ccee..be6dac6a 100644 --- a/src/chrtrans/README.tables +++ b/src/chrtrans/README.tables @@ -1,13 +1,12 @@ -The translation table files in this directory were collected from -several sources (among them ftp://ftp.unicode.org, Linux kbd package, -ftp://dkuug.dk/) and are believed to be correct in their mappings, -but not checked in detail. The Unicode/UCS2 values -for some of the RFC 1345 Mnemonic codes are out of date, -a cleanup and update would be needed for serious use. -[See also http://czyborra.com/charsets/iso8859.html for codepages survey.] +The translation table files in this directory are _examples only_. +They were collected from several sources (among them ftp://ftp.unicode.org, +Linux kbd package, ftp://dkuug.dk/) and are believed to be correct +in their mappings, but not checked in detail. The Unicode/UCS2 values +for some of the RFC 1345 Mnemonic codes are out of date, a cleanup and +update would be needed for serious use. More translation files can be easily provided (and new character entities -added to entities.h), this set is just to test whether the system works +added to entities.h), this set is just to test whether the system works in principle (and also how it behaves with incomplete data...) See the file README.format for a brief explanation of what's in the @@ -28,7 +27,7 @@ charset known to Lynx) you currently have to manually edit UCdomap.c, in two places: a) Near the top, you will find a bunch of lines (some may be commented out) - + #include "<fn>.h" Add or comment out as you wish. But it is probably safest to leave the @@ -45,7 +44,7 @@ did under a)...) [The <something> is derived from the charset's MIME name. if in doubt, check the last lines of the corresponding ...uni.h file.] c) To let make automatically notice when you have changed one of the - table files, and automatically regenerate the *uni.h file(s), + table files, and automatically regenerate the *uni.h file(s), you also have to add any new tables to both src/Makefile *and* src/chrtrans/Makefile. Or, for auto-config, the equivalent files named makefile.in before running ./configure, or makefile after running diff --git a/src/chrtrans/UCkd.h b/src/chrtrans/UCkd.h index 104882d7..1e55716e 100644 --- a/src/chrtrans/UCkd.h +++ b/src/chrtrans/UCkd.h @@ -34,7 +34,7 @@ struct unipair { }; struct unipair_str { u16 unicode; - CONST char * replace_str; + char * replace_str; }; struct unimapdesc { u16 entry_ct; diff --git a/src/chrtrans/cp1250_uni.tbl b/src/chrtrans/cp1250_uni.tbl index 49ba9008..41e8581d 100644 --- a/src/chrtrans/cp1250_uni.tbl +++ b/src/chrtrans/cp1250_uni.tbl @@ -2,155 +2,280 @@ Mwindows-1250 #Name as a Display Charset (used on Options screen) -OEastern European (windows-1250) +OWinLatin2 (cp1250) # -# Name: cp1250 to Unicode table +# Name: cp1250_WinLatin2 to Unicode table # Unicode version: 2.0 # Table version: 2.00 # Table format: Format A -# Date: 04/15/98 -# -# Contact: cpxlate@microsoft.com -# +# Date: 04/24/96 +# Authors: Lori Brownell <loribr@microsoft.com> +# K.D. Chang <a-kchang@microsoft.com> # General notes: none # # Format: Three tab-separated columns -# Column #1 is the cp1250 code (in hex) +# Column #1 is the cp1250_WinLatin2 code (in hex) # Column #2 is the Unicode (in hex as 0xXXXX) # Column #3 is the Unicode name (follows a comment sign, '#') # -# The entries are in cp1250 order +# The entries are in cp1250_WinLatin2 order # -################## +#0x00 U+0000 #NULL +#0x01 U+0001 #START OF HEADING +#0x02 U+0002 #START OF TEXT +#0x03 U+0003 #END OF TEXT +#0x04 U+0004 #END OF TRANSMISSION +#0x05 U+0005 #ENQUIRY +#0x06 U+0006 #ACKNOWLEDGE +#0x07 U+0007 #BELL +#0x08 U+0008 #BACKSPACE +#0x09 U+0009 #HORIZONTAL TABULATION +#0x0A U+000A #LINE FEED +#0x0B U+000B #VERTICAL TABULATION +#0x0C U+000C #FORM FEED +#0x0D U+000D #CARRIAGE RETURN +#0x0E U+000E #SHIFT OUT +#0x0F U+000F #SHIFT IN +#0x10 U+0010 #DATA LINK ESCAPE +#0x11 U+0011 #DEVICE CONTROL ONE +#0x12 U+0012 #DEVICE CONTROL TWO +#0x13 U+0013 #DEVICE CONTROL THREE +#0x14 U+0014 #DEVICE CONTROL FOUR +#0x15 U+0015 #NEGATIVE ACKNOWLEDGE +#0x16 U+0016 #SYNCHRONOUS IDLE +#0x17 U+0017 #END OF TRANSMISSION BLOCK +#0x18 U+0018 #CANCEL +#0x19 U+0019 #END OF MEDIUM +#0x1A U+001A #SUBSTITUTE +#0x1B U+001B #ESCAPE +#0x1C U+001C #FILE SEPARATOR +#0x1D U+001D #GROUP SEPARATOR +#0x1E U+001E #RECORD SEPARATOR +#0x1F U+001F #UNIT SEPARATOR +0x20 U+0020 #SPACE +0x21 U+0021 #EXCLAMATION MARK +0x22 U+0022 #QUOTATION MARK +0x23 U+0023 #NUMBER SIGN +0x24 U+0024 #DOLLAR SIGN +0x25 U+0025 #PERCENT SIGN +0x26 U+0026 #AMPERSAND +0x27 U+0027 #APOSTROPHE +0x28 U+0028 #LEFT PARENTHESIS +0x29 U+0029 #RIGHT PARENTHESIS +0x2A U+002A #ASTERISK +0x2B U+002B #PLUS SIGN +0x2C U+002C #COMMA +0x2D U+002D #HYPHEN-MINUS +0x2E U+002E #FULL STOP +0x2F U+002F #SOLIDUS +0x30 U+0030 #DIGIT ZERO +0x31 U+0031 #DIGIT ONE +0x32 U+0032 #DIGIT TWO +0x33 U+0033 #DIGIT THREE +0x34 U+0034 #DIGIT FOUR +0x35 U+0035 #DIGIT FIVE +0x36 U+0036 #DIGIT SIX +0x37 U+0037 #DIGIT SEVEN +0x38 U+0038 #DIGIT EIGHT +0x39 U+0039 #DIGIT NINE +0x3A U+003A #COLON +0x3B U+003B #SEMICOLON +0x3C U+003C #LESS-THAN SIGN +0x3D U+003D #EQUALS SIGN +0x3E U+003E #GREATER-THAN SIGN +0x3F U+003F #QUESTION MARK +0x40 U+0040 #COMMERCIAL AT +0x41 U+0041 #LATIN CAPITAL LETTER A +0x42 U+0042 #LATIN CAPITAL LETTER B +0x43 U+0043 #LATIN CAPITAL LETTER C +0x44 U+0044 #LATIN CAPITAL LETTER D +0x45 U+0045 #LATIN CAPITAL LETTER E +0x46 U+0046 #LATIN CAPITAL LETTER F +0x47 U+0047 #LATIN CAPITAL LETTER G +0x48 U+0048 #LATIN CAPITAL LETTER H +0x49 U+0049 #LATIN CAPITAL LETTER I +0x4A U+004A #LATIN CAPITAL LETTER J +0x4B U+004B #LATIN CAPITAL LETTER K +0x4C U+004C #LATIN CAPITAL LETTER L +0x4D U+004D #LATIN CAPITAL LETTER M +0x4E U+004E #LATIN CAPITAL LETTER N +0x4F U+004F #LATIN CAPITAL LETTER O +0x50 U+0050 #LATIN CAPITAL LETTER P +0x51 U+0051 #LATIN CAPITAL LETTER Q +0x52 U+0052 #LATIN CAPITAL LETTER R +0x53 U+0053 #LATIN CAPITAL LETTER S +0x54 U+0054 #LATIN CAPITAL LETTER T +0x55 U+0055 #LATIN CAPITAL LETTER U +0x56 U+0056 #LATIN CAPITAL LETTER V +0x57 U+0057 #LATIN CAPITAL LETTER W +0x58 U+0058 #LATIN CAPITAL LETTER X +0x59 U+0059 #LATIN CAPITAL LETTER Y +0x5A U+005A #LATIN CAPITAL LETTER Z +0x5B U+005B #LEFT SQUARE BRACKET +0x5C U+005C #REVERSE SOLIDUS +0x5D U+005D #RIGHT SQUARE BRACKET +0x5E U+005E #CIRCUMFLEX ACCENT +0x5F U+005F #LOW LINE +0x60 U+0060 #GRAVE ACCENT +0x61 U+0061 #LATIN SMALL LETTER A +0x62 U+0062 #LATIN SMALL LETTER B +0x63 U+0063 #LATIN SMALL LETTER C +0x64 U+0064 #LATIN SMALL LETTER D +0x65 U+0065 #LATIN SMALL LETTER E +0x66 U+0066 #LATIN SMALL LETTER F +0x67 U+0067 #LATIN SMALL LETTER G +0x68 U+0068 #LATIN SMALL LETTER H +0x69 U+0069 #LATIN SMALL LETTER I +0x6A U+006A #LATIN SMALL LETTER J +0x6B U+006B #LATIN SMALL LETTER K +0x6C U+006C #LATIN SMALL LETTER L +0x6D U+006D #LATIN SMALL LETTER M +0x6E U+006E #LATIN SMALL LETTER N +0x6F U+006F #LATIN SMALL LETTER O +0x70 U+0070 #LATIN SMALL LETTER P +0x71 U+0071 #LATIN SMALL LETTER Q +0x72 U+0072 #LATIN SMALL LETTER R +0x73 U+0073 #LATIN SMALL LETTER S +0x74 U+0074 #LATIN SMALL LETTER T +0x75 U+0075 #LATIN SMALL LETTER U +0x76 U+0076 #LATIN SMALL LETTER V +0x77 U+0077 #LATIN SMALL LETTER W +0x78 U+0078 #LATIN SMALL LETTER X +0x79 U+0079 #LATIN SMALL LETTER Y +0x7A U+007A #LATIN SMALL LETTER Z +0x7B U+007B #LEFT CURLY BRACKET +0x7C U+007C #VERTICAL LINE +0x7D U+007D #RIGHT CURLY BRACKET +0x7E U+007E #TILDE +#0x7F U+007F #DELETE +#0x80 #UNDEFINED +#0x81 #UNDEFINED +0x82 U+201A #SINGLE LOW-9 QUOTATION MARK +#0x83 #UNDEFINED +0x84 U+201E #DOUBLE LOW-9 QUOTATION MARK +0x85 U+2026 #HORIZONTAL ELLIPSIS +0x86 U+2020 #DAGGER +0x87 U+2021 #DOUBLE DAGGER +#0x88 #UNDEFINED +0x89 U+2030 #PER MILLE SIGN +0x8A U+0160 #LATIN CAPITAL LETTER S WITH CARON +0x8B U+2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK +0x8C U+015A #LATIN CAPITAL LETTER S WITH ACUTE +0x8D U+0164 #LATIN CAPITAL LETTER T WITH CARON +0x8E U+017D #LATIN CAPITAL LETTER Z WITH CARON +0x8F U+0179 #LATIN CAPITAL LETTER Z WITH ACUTE +#0x90 #UNDEFINED +0x91 U+2018 #LEFT SINGLE QUOTATION MARK +0x92 U+2019 #RIGHT SINGLE QUOTATION MARK +0x93 U+201C #LEFT DOUBLE QUOTATION MARK +0x94 U+201D #RIGHT DOUBLE QUOTATION MARK +0x95 U+2022 #BULLET +0x96 U+2013 #EN DASH +0x97 U+2014 #EM DASH +#0x98 #UNDEFINED +0x99 U+2122 #TRADE MARK SIGN +0x9A U+0161 #LATIN SMALL LETTER S WITH CARON +0x9B U+203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +0x9C U+015B #LATIN SMALL LETTER S WITH ACUTE +0x9D U+0165 #LATIN SMALL LETTER T WITH CARON +0x9E U+017E #LATIN SMALL LETTER Z WITH CARON +0x9F U+017A #LATIN SMALL LETTER Z WITH ACUTE +0xA0 U+00A0 #NO-BREAK SPACE +0xA1 U+02C7 #CARON +0xA2 U+02D8 #BREVE +0xA3 U+0141 #LATIN CAPITAL LETTER L WITH STROKE +0xA4 U+00A4 #CURRENCY SIGN +0xA5 U+0104 #LATIN CAPITAL LETTER A WITH OGONEK +0xA6 U+00A6 #BROKEN BAR +0xA7 U+00A7 #SECTION SIGN +0xA8 U+00A8 #DIAERESIS +0xA9 U+00A9 #COPYRIGHT SIGN +0xAA U+015E #LATIN CAPITAL LETTER S WITH CEDILLA +0xAB U+00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +#0xAC #UNDEFINED +0xAD U+00AD #SOFT HYPHEN +0xAE U+00AE #REGISTERED SIGN +0xAF U+017B #LATIN CAPITAL LETTER Z WITH DOT ABOVE +0xB0 U+00B0 #DEGREE SIGN +0xB1 U+00B1 #PLUS-MINUS SIGN +0xB2 U+02DB #OGONEK +0xB3 U+0142 #LATIN SMALL LETTER L WITH STROKE +0xB4 U+00B4 #ACUTE ACCENT +0xB5 U+00B5 #MICRO SIGN +0xB6 U+00B6 #PILCROW SIGN +0xB7 U+00B7 #MIDDLE DOT +0xB8 U+00B8 #CEDILLA +0xB9 U+0105 #LATIN SMALL LETTER A WITH OGONEK +0xBA U+015F #LATIN SMALL LETTER S WITH CEDILLA +0xBB U+00BB #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +0xBC U+013D #LATIN CAPITAL LETTER L WITH CARON +0xBD U+02DD #DOUBLE ACUTE ACCENT +0xBE U+013E #LATIN SMALL LETTER L WITH CARON +0xBF U+017C #LATIN SMALL LETTER Z WITH DOT ABOVE +0xC0 U+0154 #LATIN CAPITAL LETTER R WITH ACUTE +0xC1 U+00C1 #LATIN CAPITAL LETTER A WITH ACUTE +0xC2 U+00C2 #LATIN CAPITAL LETTER A WITH CIRCUMFLEX +0xC3 U+0102 #LATIN CAPITAL LETTER A WITH BREVE +0xC4 U+00C4 #LATIN CAPITAL LETTER A WITH DIAERESIS +0xC5 U+0139 #LATIN CAPITAL LETTER L WITH ACUTE +0xC6 U+0106 #LATIN CAPITAL LETTER C WITH ACUTE +0xC7 U+00C7 #LATIN CAPITAL LETTER C WITH CEDILLA +0xC8 U+010C #LATIN CAPITAL LETTER C WITH CARON +0xC9 U+00C9 #LATIN CAPITAL LETTER E WITH ACUTE +0xCA U+0118 #LATIN CAPITAL LETTER E WITH OGONEK +0xCB U+00CB #LATIN CAPITAL LETTER E WITH DIAERESIS +0xCC U+011A #LATIN CAPITAL LETTER E WITH CARON +0xCD U+00CD #LATIN CAPITAL LETTER I WITH ACUTE +0xCE U+00CE #LATIN CAPITAL LETTER I WITH CIRCUMFLEX +0xCF U+010E #LATIN CAPITAL LETTER D WITH CARON +0xD0 U+0110 #LATIN CAPITAL LETTER D WITH STROKE +0xD1 U+0143 #LATIN CAPITAL LETTER N WITH ACUTE +0xD2 U+0147 #LATIN CAPITAL LETTER N WITH CARON +0xD3 U+00D3 #LATIN CAPITAL LETTER O WITH ACUTE +0xD4 U+00D4 #LATIN CAPITAL LETTER O WITH CIRCUMFLEX +0xD5 U+0150 #LATIN CAPITAL LETTER O WITH DOUBLE ACUTE +0xD6 U+00D6 #LATIN CAPITAL LETTER O WITH DIAERESIS +0xD7 U+00D7 #MULTIPLICATION SIGN +0xD8 U+0158 #LATIN CAPITAL LETTER R WITH CARON +0xD9 U+016E #LATIN CAPITAL LETTER U WITH RING ABOVE +0xDA U+00DA #LATIN CAPITAL LETTER U WITH ACUTE +0xDB U+0170 #LATIN CAPITAL LETTER U WITH DOUBLE ACUTE +0xDC U+00DC #LATIN CAPITAL LETTER U WITH DIAERESIS +0xDD U+00DD #LATIN CAPITAL LETTER Y WITH ACUTE +0xDE U+0162 #LATIN CAPITAL LETTER T WITH CEDILLA +0xDF U+00DF #LATIN SMALL LETTER SHARP S +0xE0 U+0155 #LATIN SMALL LETTER R WITH ACUTE +0xE1 U+00E1 #LATIN SMALL LETTER A WITH ACUTE +0xE2 U+00E2 #LATIN SMALL LETTER A WITH CIRCUMFLEX +0xE3 U+0103 #LATIN SMALL LETTER A WITH BREVE +0xE4 U+00E4 #LATIN SMALL LETTER A WITH DIAERESIS +0xE5 U+013A #LATIN SMALL LETTER L WITH ACUTE +0xE6 U+0107 #LATIN SMALL LETTER C WITH ACUTE +0xE7 U+00E7 #LATIN SMALL LETTER C WITH CEDILLA +0xE8 U+010D #LATIN SMALL LETTER C WITH CARON +0xE9 U+00E9 #LATIN SMALL LETTER E WITH ACUTE +0xEA U+0119 #LATIN SMALL LETTER E WITH OGONEK +0xEB U+00EB #LATIN SMALL LETTER E WITH DIAERESIS +0xEC U+011B #LATIN SMALL LETTER E WITH CARON +0xED U+00ED #LATIN SMALL LETTER I WITH ACUTE +0xEE U+00EE #LATIN SMALL LETTER I WITH CIRCUMFLEX +0xEF U+010F #LATIN SMALL LETTER D WITH CARON +0xF0 U+0111 #LATIN SMALL LETTER D WITH STROKE +0xF1 U+0144 #LATIN SMALL LETTER N WITH ACUTE +0xF2 U+0148 #LATIN SMALL LETTER N WITH CARON +0xF3 U+00F3 #LATIN SMALL LETTER O WITH ACUTE +0xF4 U+00F4 #LATIN SMALL LETTER O WITH CIRCUMFLEX +0xF5 U+0151 #LATIN SMALL LETTER O WITH DOUBLE ACUTE +0xF6 U+00F6 #LATIN SMALL LETTER O WITH DIAERESIS +0xF7 U+00F7 #DIVISION SIGN +0xF8 U+0159 #LATIN SMALL LETTER R WITH CARON +0xF9 U+016F #LATIN SMALL LETTER U WITH RING ABOVE +0xFA U+00FA #LATIN SMALL LETTER U WITH ACUTE +0xFB U+0171 #LATIN SMALL LETTER U WITH DOUBLE ACUTE +0xFC U+00FC #LATIN SMALL LETTER U WITH DIAERESIS +0xFD U+00FD #LATIN SMALL LETTER Y WITH ACUTE +0xFE U+0163 #LATIN SMALL LETTER T WITH CEDILLA +0xFF U+02D9 #DOT ABOVE + -0x20-0x7e idem -# -0x80 U+20AC #EURO SIGN -0x81 #UNDEFINED -0x82 U+201A #SINGLE LOW-9 QUOTATION MARK -0x83 #UNDEFINED -0x84 U+201E #DOUBLE LOW-9 QUOTATION MARK -0x85 U+2026 #HORIZONTAL ELLIPSIS -0x86 U+2020 #DAGGER -0x87 U+2021 #DOUBLE DAGGER -0x88 #UNDEFINED -0x89 U+2030 #PER MILLE SIGN -0x8A U+0160 #LATIN CAPITAL LETTER S WITH CARON -0x8B U+2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK -0x8C U+015A #LATIN CAPITAL LETTER S WITH ACUTE -0x8D U+0164 #LATIN CAPITAL LETTER T WITH CARON -0x8E U+017D #LATIN CAPITAL LETTER Z WITH CARON -0x8F U+0179 #LATIN CAPITAL LETTER Z WITH ACUTE -0x90 #UNDEFINED -0x91 U+2018 #LEFT SINGLE QUOTATION MARK -0x92 U+2019 #RIGHT SINGLE QUOTATION MARK -0x93 U+201C #LEFT DOUBLE QUOTATION MARK -0x94 U+201D #RIGHT DOUBLE QUOTATION MARK -0x95 U+2022 #BULLET -0x96 U+2013 #EN DASH -0x97 U+2014 #EM DASH -0x98 #UNDEFINED -0x99 U+2122 #TRADE MARK SIGN -0x9A U+0161 #LATIN SMALL LETTER S WITH CARON -0x9B U+203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -0x9C U+015B #LATIN SMALL LETTER S WITH ACUTE -0x9D U+0165 #LATIN SMALL LETTER T WITH CARON -0x9E U+017E #LATIN SMALL LETTER Z WITH CARON -0x9F U+017A #LATIN SMALL LETTER Z WITH ACUTE -0xA0 U+00A0 #NO-BREAK SPACE -0xA1 U+02C7 #CARON -0xA2 U+02D8 #BREVE -0xA3 U+0141 #LATIN CAPITAL LETTER L WITH STROKE -0xA4 U+00A4 #CURRENCY SIGN -0xA5 U+0104 #LATIN CAPITAL LETTER A WITH OGONEK -0xA6 U+00A6 #BROKEN BAR -0xA7 U+00A7 #SECTION SIGN -0xA8 U+00A8 #DIAERESIS -0xA9 U+00A9 #COPYRIGHT SIGN -0xAA U+015E #LATIN CAPITAL LETTER S WITH CEDILLA -0xAB U+00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK -0xAC U+00AC #NOT SIGN -0xAD U+00AD #SOFT HYPHEN -0xAE U+00AE #REGISTERED SIGN -0xAF U+017B #LATIN CAPITAL LETTER Z WITH DOT ABOVE -0xB0 U+00B0 #DEGREE SIGN -0xB1 U+00B1 #PLUS-MINUS SIGN -0xB2 U+02DB #OGONEK -0xB3 U+0142 #LATIN SMALL LETTER L WITH STROKE -0xB4 U+00B4 #ACUTE ACCENT -0xB5 U+00B5 #MICRO SIGN -0xB6 U+00B6 #PILCROW SIGN -0xB7 U+00B7 #MIDDLE DOT -0xB8 U+00B8 #CEDILLA -0xB9 U+0105 #LATIN SMALL LETTER A WITH OGONEK -0xBA U+015F #LATIN SMALL LETTER S WITH CEDILLA -0xBB U+00BB #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -0xBC U+013D #LATIN CAPITAL LETTER L WITH CARON -0xBD U+02DD #DOUBLE ACUTE ACCENT -0xBE U+013E #LATIN SMALL LETTER L WITH CARON -0xBF U+017C #LATIN SMALL LETTER Z WITH DOT ABOVE -0xC0 U+0154 #LATIN CAPITAL LETTER R WITH ACUTE -0xC1 U+00C1 #LATIN CAPITAL LETTER A WITH ACUTE -0xC2 U+00C2 #LATIN CAPITAL LETTER A WITH CIRCUMFLEX -0xC3 U+0102 #LATIN CAPITAL LETTER A WITH BREVE -0xC4 U+00C4 #LATIN CAPITAL LETTER A WITH DIAERESIS -0xC5 U+0139 #LATIN CAPITAL LETTER L WITH ACUTE -0xC6 U+0106 #LATIN CAPITAL LETTER C WITH ACUTE -0xC7 U+00C7 #LATIN CAPITAL LETTER C WITH CEDILLA -0xC8 U+010C #LATIN CAPITAL LETTER C WITH CARON -0xC9 U+00C9 #LATIN CAPITAL LETTER E WITH ACUTE -0xCA U+0118 #LATIN CAPITAL LETTER E WITH OGONEK -0xCB U+00CB #LATIN CAPITAL LETTER E WITH DIAERESIS -0xCC U+011A #LATIN CAPITAL LETTER E WITH CARON -0xCD U+00CD #LATIN CAPITAL LETTER I WITH ACUTE -0xCE U+00CE #LATIN CAPITAL LETTER I WITH CIRCUMFLEX -0xCF U+010E #LATIN CAPITAL LETTER D WITH CARON -0xD0 U+0110 #LATIN CAPITAL LETTER D WITH STROKE -0xD1 U+0143 #LATIN CAPITAL LETTER N WITH ACUTE -0xD2 U+0147 #LATIN CAPITAL LETTER N WITH CARON -0xD3 U+00D3 #LATIN CAPITAL LETTER O WITH ACUTE -0xD4 U+00D4 #LATIN CAPITAL LETTER O WITH CIRCUMFLEX -0xD5 U+0150 #LATIN CAPITAL LETTER O WITH DOUBLE ACUTE -0xD6 U+00D6 #LATIN CAPITAL LETTER O WITH DIAERESIS -0xD7 U+00D7 #MULTIPLICATION SIGN -0xD8 U+0158 #LATIN CAPITAL LETTER R WITH CARON -0xD9 U+016E #LATIN CAPITAL LETTER U WITH RING ABOVE -0xDA U+00DA #LATIN CAPITAL LETTER U WITH ACUTE -0xDB U+0170 #LATIN CAPITAL LETTER U WITH DOUBLE ACUTE -0xDC U+00DC #LATIN CAPITAL LETTER U WITH DIAERESIS -0xDD U+00DD #LATIN CAPITAL LETTER Y WITH ACUTE -0xDE U+0162 #LATIN CAPITAL LETTER T WITH CEDILLA -0xDF U+00DF #LATIN SMALL LETTER SHARP S -0xE0 U+0155 #LATIN SMALL LETTER R WITH ACUTE -0xE1 U+00E1 #LATIN SMALL LETTER A WITH ACUTE -0xE2 U+00E2 #LATIN SMALL LETTER A WITH CIRCUMFLEX -0xE3 U+0103 #LATIN SMALL LETTER A WITH BREVE -0xE4 U+00E4 #LATIN SMALL LETTER A WITH DIAERESIS -0xE5 U+013A #LATIN SMALL LETTER L WITH ACUTE -0xE6 U+0107 #LATIN SMALL LETTER C WITH ACUTE -0xE7 U+00E7 #LATIN SMALL LETTER C WITH CEDILLA -0xE8 U+010D #LATIN SMALL LETTER C WITH CARON -0xE9 U+00E9 #LATIN SMALL LETTER E WITH ACUTE -0xEA U+0119 #LATIN SMALL LETTER E WITH OGONEK -0xEB U+00EB #LATIN SMALL LETTER E WITH DIAERESIS -0xEC U+011B #LATIN SMALL LETTER E WITH CARON -0xED U+00ED #LATIN SMALL LETTER I WITH ACUTE -0xEE U+00EE #LATIN SMALL LETTER I WITH CIRCUMFLEX -0xEF U+010F #LATIN SMALL LETTER D WITH CARON -0xF0 U+0111 #LATIN SMALL LETTER D WITH STROKE -0xF1 U+0144 #LATIN SMALL LETTER N WITH ACUTE -0xF2 U+0148 #LATIN SMALL LETTER N WITH CARON -0xF3 U+00F3 #LATIN SMALL LETTER O WITH ACUTE -0xF4 U+00F4 #LATIN SMALL LETTER O WITH CIRCUMFLEX -0xF5 U+0151 #LATIN SMALL LETTER O WITH DOUBLE ACUTE -0xF6 U+00F6 #LATIN SMALL LETTER O WITH DIAERESIS -0xF7 U+00F7 #DIVISION SIGN -0xF8 U+0159 #LATIN SMALL LETTER R WITH CARON -0xF9 U+016F #LATIN SMALL LETTER U WITH RING ABOVE -0xFA U+00FA #LATIN SMALL LETTER U WITH ACUTE -0xFB U+0171 #LATIN SMALL LETTER U WITH DOUBLE ACUTE -0xFC U+00FC #LATIN SMALL LETTER U WITH DIAERESIS -0xFD U+00FD #LATIN SMALL LETTER Y WITH ACUTE -0xFE U+0163 #LATIN SMALL LETTER T WITH CEDILLA -0xFF U+02D9 #DOT ABOVE diff --git a/src/chrtrans/cp1251_uni.tbl b/src/chrtrans/cp1251_uni.tbl index 541f8640..e9bb9460 100644 --- a/src/chrtrans/cp1251_uni.tbl +++ b/src/chrtrans/cp1251_uni.tbl @@ -2,155 +2,153 @@ Mwindows-1251 #Name as a Display Charset (used on Options screen) -OCyrillic (windows-1251) +OWinCyrillic (cp1251) # -# Name: cp1251 to Unicode table +# Name: cp1251_WinCyrillic to Unicode table # Unicode version: 2.0 # Table version: 2.00 # Table format: Format A -# Date: 04/15/98 -# -# Contact: cpxlate@microsoft.com -# +# Date: 04/24/96 +# Authors: Lori Brownell <loribr@microsoft.com> +# K.D. Chang <a-kchang@microsoft.com> # General notes: none # # Format: Three tab-separated columns -# Column #1 is the cp1251 code (in hex) +# Column #1 is the cp1251_WinCyrillic code (in hex) # Column #2 is the Unicode (in hex as 0xXXXX) # Column #3 is the Unicode name (follows a comment sign, '#') # -# The entries are in cp1251 order +# The entries are in cp1251_WinCyrillic order # -################## - -0x20-0x7e idem # -0x80 U+0402 #CYRILLIC CAPITAL LETTER DJE -0x81 U+0403 #CYRILLIC CAPITAL LETTER GJE -0x82 U+201A #SINGLE LOW-9 QUOTATION MARK -0x83 U+0453 #CYRILLIC SMALL LETTER GJE -0x84 U+201E #DOUBLE LOW-9 QUOTATION MARK -0x85 U+2026 #HORIZONTAL ELLIPSIS -0x86 U+2020 #DAGGER -0x87 U+2021 #DOUBLE DAGGER -0x88 U+20AC #EURO SIGN -0x89 U+2030 #PER MILLE SIGN -0x8A U+0409 #CYRILLIC CAPITAL LETTER LJE -0x8B U+2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK -0x8C U+040A #CYRILLIC CAPITAL LETTER NJE -0x8D U+040C #CYRILLIC CAPITAL LETTER KJE -0x8E U+040B #CYRILLIC CAPITAL LETTER TSHE -0x8F U+040F #CYRILLIC CAPITAL LETTER DZHE -0x90 U+0452 #CYRILLIC SMALL LETTER DJE -0x91 U+2018 #LEFT SINGLE QUOTATION MARK -0x92 U+2019 #RIGHT SINGLE QUOTATION MARK -0x93 U+201C #LEFT DOUBLE QUOTATION MARK -0x94 U+201D #RIGHT DOUBLE QUOTATION MARK -0x95 U+2022 #BULLET -0x96 U+2013 #EN DASH -0x97 U+2014 #EM DASH -0x98 #UNDEFINED -0x99 U+2122 #TRADE MARK SIGN -0x9A U+0459 #CYRILLIC SMALL LETTER LJE -0x9B U+203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -0x9C U+045A #CYRILLIC SMALL LETTER NJE -0x9D U+045C #CYRILLIC SMALL LETTER KJE -0x9E U+045B #CYRILLIC SMALL LETTER TSHE -0x9F U+045F #CYRILLIC SMALL LETTER DZHE -0xA0 U+00A0 #NO-BREAK SPACE -0xA1 U+040E #CYRILLIC CAPITAL LETTER SHORT U -0xA2 U+045E #CYRILLIC SMALL LETTER SHORT U -0xA3 U+0408 #CYRILLIC CAPITAL LETTER JE -0xA4 U+00A4 #CURRENCY SIGN -0xA5 U+0490 #CYRILLIC CAPITAL LETTER GHE WITH UPTURN -0xA6 U+00A6 #BROKEN BAR -0xA7 U+00A7 #SECTION SIGN -0xA8 U+0401 #CYRILLIC CAPITAL LETTER IO -0xA9 U+00A9 #COPYRIGHT SIGN -0xAA U+0404 #CYRILLIC CAPITAL LETTER UKRAINIAN IE -0xAB U+00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK -0xAC U+00AC #NOT SIGN -0xAD U+00AD #SOFT HYPHEN -0xAE U+00AE #REGISTERED SIGN -0xAF U+0407 #CYRILLIC CAPITAL LETTER YI -0xB0 U+00B0 #DEGREE SIGN -0xB1 U+00B1 #PLUS-MINUS SIGN -0xB2 U+0406 #CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I -0xB3 U+0456 #CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I -0xB4 U+0491 #CYRILLIC SMALL LETTER GHE WITH UPTURN -0xB5 U+00B5 #MICRO SIGN -0xB6 U+00B6 #PILCROW SIGN -0xB7 U+00B7 #MIDDLE DOT -0xB8 U+0451 #CYRILLIC SMALL LETTER IO -0xB9 U+2116 #NUMERO SIGN -0xBA U+0454 #CYRILLIC SMALL LETTER UKRAINIAN IE -0xBB U+00BB #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -0xBC U+0458 #CYRILLIC SMALL LETTER JE -0xBD U+0405 #CYRILLIC CAPITAL LETTER DZE -0xBE U+0455 #CYRILLIC SMALL LETTER DZE -0xBF U+0457 #CYRILLIC SMALL LETTER YI -0xC0 U+0410 #CYRILLIC CAPITAL LETTER A -0xC1 U+0411 #CYRILLIC CAPITAL LETTER BE -0xC2 U+0412 #CYRILLIC CAPITAL LETTER VE -0xC3 U+0413 #CYRILLIC CAPITAL LETTER GHE -0xC4 U+0414 #CYRILLIC CAPITAL LETTER DE -0xC5 U+0415 #CYRILLIC CAPITAL LETTER IE -0xC6 U+0416 #CYRILLIC CAPITAL LETTER ZHE -0xC7 U+0417 #CYRILLIC CAPITAL LETTER ZE -0xC8 U+0418 #CYRILLIC CAPITAL LETTER I -0xC9 U+0419 #CYRILLIC CAPITAL LETTER SHORT I -0xCA U+041A #CYRILLIC CAPITAL LETTER KA -0xCB U+041B #CYRILLIC CAPITAL LETTER EL -0xCC U+041C #CYRILLIC CAPITAL LETTER EM -0xCD U+041D #CYRILLIC CAPITAL LETTER EN -0xCE U+041E #CYRILLIC CAPITAL LETTER O -0xCF U+041F #CYRILLIC CAPITAL LETTER PE -0xD0 U+0420 #CYRILLIC CAPITAL LETTER ER -0xD1 U+0421 #CYRILLIC CAPITAL LETTER ES -0xD2 U+0422 #CYRILLIC CAPITAL LETTER TE -0xD3 U+0423 #CYRILLIC CAPITAL LETTER U -0xD4 U+0424 #CYRILLIC CAPITAL LETTER EF -0xD5 U+0425 #CYRILLIC CAPITAL LETTER HA -0xD6 U+0426 #CYRILLIC CAPITAL LETTER TSE -0xD7 U+0427 #CYRILLIC CAPITAL LETTER CHE -0xD8 U+0428 #CYRILLIC CAPITAL LETTER SHA -0xD9 U+0429 #CYRILLIC CAPITAL LETTER SHCHA -0xDA U+042A #CYRILLIC CAPITAL LETTER HARD SIGN -0xDB U+042B #CYRILLIC CAPITAL LETTER YERU -0xDC U+042C #CYRILLIC CAPITAL LETTER SOFT SIGN -0xDD U+042D #CYRILLIC CAPITAL LETTER E -0xDE U+042E #CYRILLIC CAPITAL LETTER YU -0xDF U+042F #CYRILLIC CAPITAL LETTER YA -0xE0 U+0430 #CYRILLIC SMALL LETTER A -0xE1 U+0431 #CYRILLIC SMALL LETTER BE -0xE2 U+0432 #CYRILLIC SMALL LETTER VE -0xE3 U+0433 #CYRILLIC SMALL LETTER GHE -0xE4 U+0434 #CYRILLIC SMALL LETTER DE -0xE5 U+0435 #CYRILLIC SMALL LETTER IE -0xE6 U+0436 #CYRILLIC SMALL LETTER ZHE -0xE7 U+0437 #CYRILLIC SMALL LETTER ZE -0xE8 U+0438 #CYRILLIC SMALL LETTER I -0xE9 U+0439 #CYRILLIC SMALL LETTER SHORT I -0xEA U+043A #CYRILLIC SMALL LETTER KA -0xEB U+043B #CYRILLIC SMALL LETTER EL -0xEC U+043C #CYRILLIC SMALL LETTER EM -0xED U+043D #CYRILLIC SMALL LETTER EN -0xEE U+043E #CYRILLIC SMALL LETTER O -0xEF U+043F #CYRILLIC SMALL LETTER PE -0xF0 U+0440 #CYRILLIC SMALL LETTER ER -0xF1 U+0441 #CYRILLIC SMALL LETTER ES -0xF2 U+0442 #CYRILLIC SMALL LETTER TE -0xF3 U+0443 #CYRILLIC SMALL LETTER U -0xF4 U+0444 #CYRILLIC SMALL LETTER EF -0xF5 U+0445 #CYRILLIC SMALL LETTER HA -0xF6 U+0446 #CYRILLIC SMALL LETTER TSE -0xF7 U+0447 #CYRILLIC SMALL LETTER CHE -0xF8 U+0448 #CYRILLIC SMALL LETTER SHA -0xF9 U+0449 #CYRILLIC SMALL LETTER SHCHA -0xFA U+044A #CYRILLIC SMALL LETTER HARD SIGN -0xFB U+044B #CYRILLIC SMALL LETTER YERU -0xFC U+044C #CYRILLIC SMALL LETTER SOFT SIGN -0xFD U+044D #CYRILLIC SMALL LETTER E -0xFE U+044E #CYRILLIC SMALL LETTER YU -0xFF U+044F #CYRILLIC SMALL LETTER YA +0x20-0x7f idem +# +0x80 U+0402 #CYRILLIC CAPITAL LETTER DJE +0x81 U+0403 #CYRILLIC CAPITAL LETTER GJE +0x82 U+201A #SINGLE LOW-9 QUOTATION MARK +0x83 U+0453 #CYRILLIC SMALL LETTER GJE +0x84 U+201E #DOUBLE LOW-9 QUOTATION MARK +0x85 U+2026 #HORIZONTAL ELLIPSIS +0x86 U+2020 #DAGGER +0x87 U+2021 #DOUBLE DAGGER +#0x88 #UNDEFINED +0x89 U+2030 #PER MILLE SIGN +0x8A U+0409 #CYRILLIC CAPITAL LETTER LJE +0x8B U+2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK +0x8C U+040A #CYRILLIC CAPITAL LETTER NJE +0x8D U+040C #CYRILLIC CAPITAL LETTER KJE +0x8E U+040B #CYRILLIC CAPITAL LETTER TSHE +0x8F U+040F #CYRILLIC CAPITAL LETTER DZHE +0x90 U+0452 #CYRILLIC SMALL LETTER DJE +0x91 U+2018 #LEFT SINGLE QUOTATION MARK +0x92 U+2019 #RIGHT SINGLE QUOTATION MARK +0x93 U+201C #LEFT DOUBLE QUOTATION MARK +0x94 U+201D #RIGHT DOUBLE QUOTATION MARK +0x95 U+2022 #BULLET +0x96 U+2013 #EN DASH +0x97 U+2014 #EM DASH +#0x98 #UNDEFINED +0x99 U+2122 #TRADE MARK SIGN +0x9A U+0459 #CYRILLIC SMALL LETTER LJE +0x9B U+203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +0x9C U+045A #CYRILLIC SMALL LETTER NJE +0x9D U+045C #CYRILLIC SMALL LETTER KJE +0x9E U+045B #CYRILLIC SMALL LETTER TSHE +0x9F U+045F #CYRILLIC SMALL LETTER DZHE +0xA0 U+00A0 #NO-BREAK SPACE +0xA1 U+040E #CYRILLIC CAPITAL LETTER SHORT U +0xA2 U+045E #CYRILLIC SMALL LETTER SHORT U +0xA3 U+0408 #CYRILLIC CAPITAL LETTER JE +0xA4 U+00A4 #CURRENCY SIGN +0xA5 U+0490 #CYRILLIC CAPITAL LETTER GHE WITH UPTURN +0xA6 U+00A6 #BROKEN BAR +0xA7 U+00A7 #SECTION SIGN +0xA8 U+0401 #CYRILLIC CAPITAL LETTER IO +0xA9 U+00A9 #COPYRIGHT SIGN +0xAA U+0404 #CYRILLIC CAPITAL LETTER UKRAINIAN IE +0xAB U+00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +0xAC U+00AC #NOT SIGN +0xAD U+00AD #SOFT HYPHEN +0xAE U+00AE #REGISTERED SIGN +0xAF U+0407 #CYRILLIC CAPITAL LETTER YI +0xB0 U+00B0 #DEGREE SIGN +0xB1 U+00B1 #PLUS-MINUS SIGN +0xB2 U+0406 #CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I +0xB3 U+0456 #CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I +0xB4 U+0491 #CYRILLIC SMALL LETTER GHE WITH UPTURN +0xB5 U+00B5 #MICRO SIGN +0xB6 U+00B6 #PILCROW SIGN +0xB7 U+00B7 #MIDDLE DOT +0xB8 U+0451 #CYRILLIC SMALL LETTER IO +0xB9 U+2116 #NUMERO SIGN +0xBA U+0454 #CYRILLIC SMALL LETTER UKRAINIAN IE +0xBB U+00BB #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +0xBC U+0458 #CYRILLIC SMALL LETTER JE +0xBD U+0405 #CYRILLIC CAPITAL LETTER DZE +0xBE U+0455 #CYRILLIC SMALL LETTER DZE +0xBF U+0457 #CYRILLIC SMALL LETTER YI +0xC0 U+0410 #CYRILLIC CAPITAL LETTER A +0xC1 U+0411 #CYRILLIC CAPITAL LETTER BE +0xC2 U+0412 #CYRILLIC CAPITAL LETTER VE +0xC3 U+0413 #CYRILLIC CAPITAL LETTER GHE +0xC4 U+0414 #CYRILLIC CAPITAL LETTER DE +0xC5 U+0415 #CYRILLIC CAPITAL LETTER IE +0xC6 U+0416 #CYRILLIC CAPITAL LETTER ZHE +0xC7 U+0417 #CYRILLIC CAPITAL LETTER ZE +0xC8 U+0418 #CYRILLIC CAPITAL LETTER I +0xC9 U+0419 #CYRILLIC CAPITAL LETTER SHORT I +0xCA U+041A #CYRILLIC CAPITAL LETTER KA +0xCB U+041B #CYRILLIC CAPITAL LETTER EL +0xCC U+041C #CYRILLIC CAPITAL LETTER EM +0xCD U+041D #CYRILLIC CAPITAL LETTER EN +0xCE U+041E #CYRILLIC CAPITAL LETTER O +0xCF U+041F #CYRILLIC CAPITAL LETTER PE +0xD0 U+0420 #CYRILLIC CAPITAL LETTER ER +0xD1 U+0421 #CYRILLIC CAPITAL LETTER ES +0xD2 U+0422 #CYRILLIC CAPITAL LETTER TE +0xD3 U+0423 #CYRILLIC CAPITAL LETTER U +0xD4 U+0424 #CYRILLIC CAPITAL LETTER EF +0xD5 U+0425 #CYRILLIC CAPITAL LETTER HA +0xD6 U+0426 #CYRILLIC CAPITAL LETTER TSE +0xD7 U+0427 #CYRILLIC CAPITAL LETTER CHE +0xD8 U+0428 #CYRILLIC CAPITAL LETTER SHA +0xD9 U+0429 #CYRILLIC CAPITAL LETTER SHCHA +0xDA U+042A #CYRILLIC CAPITAL LETTER HARD SIGN +0xDB U+042B #CYRILLIC CAPITAL LETTER YERU +0xDC U+042C #CYRILLIC CAPITAL LETTER SOFT SIGN +0xDD U+042D #CYRILLIC CAPITAL LETTER E +0xDE U+042E #CYRILLIC CAPITAL LETTER YU +0xDF U+042F #CYRILLIC CAPITAL LETTER YA +0xE0 U+0430 #CYRILLIC SMALL LETTER A +0xE1 U+0431 #CYRILLIC SMALL LETTER BE +0xE2 U+0432 #CYRILLIC SMALL LETTER VE +0xE3 U+0433 #CYRILLIC SMALL LETTER GHE +0xE4 U+0434 #CYRILLIC SMALL LETTER DE +0xE5 U+0435 #CYRILLIC SMALL LETTER IE +0xE6 U+0436 #CYRILLIC SMALL LETTER ZHE +0xE7 U+0437 #CYRILLIC SMALL LETTER ZE +0xE8 U+0438 #CYRILLIC SMALL LETTER I +0xE9 U+0439 #CYRILLIC SMALL LETTER SHORT I +0xEA U+043A #CYRILLIC SMALL LETTER KA +0xEB U+043B #CYRILLIC SMALL LETTER EL +0xEC U+043C #CYRILLIC SMALL LETTER EM +0xED U+043D #CYRILLIC SMALL LETTER EN +0xEE U+043E #CYRILLIC SMALL LETTER O +0xEF U+043F #CYRILLIC SMALL LETTER PE +0xF0 U+0440 #CYRILLIC SMALL LETTER ER +0xF1 U+0441 #CYRILLIC SMALL LETTER ES +0xF2 U+0442 #CYRILLIC SMALL LETTER TE +0xF3 U+0443 #CYRILLIC SMALL LETTER U +0xF4 U+0444 #CYRILLIC SMALL LETTER EF +0xF5 U+0445 #CYRILLIC SMALL LETTER HA +0xF6 U+0446 #CYRILLIC SMALL LETTER TSE +0xF7 U+0447 #CYRILLIC SMALL LETTER CHE +0xF8 U+0448 #CYRILLIC SMALL LETTER SHA +0xF9 U+0449 #CYRILLIC SMALL LETTER SHCHA +0xFA U+044A #CYRILLIC SMALL LETTER HARD SIGN +0xFB U+044B #CYRILLIC SMALL LETTER YERU +0xFC U+044C #CYRILLIC SMALL LETTER SOFT SIGN +0xFD U+044D #CYRILLIC SMALL LETTER E +0xFE U+044E #CYRILLIC SMALL LETTER YU +0xFF U+044F #CYRILLIC SMALL LETTER YA diff --git a/src/chrtrans/cp1252_uni.tbl b/src/chrtrans/cp1252_uni.tbl index 09ee9b6a..d8adb2fa 100644 --- a/src/chrtrans/cp1252_uni.tbl +++ b/src/chrtrans/cp1252_uni.tbl @@ -6,155 +6,280 @@ D0 Mwindows-1252 #Name as a Display Charset (used on Options screen) -OWestern (windows-1252) +OWinLatin1 (cp1252) # -# Name: cp1252 to Unicode table -# Unicode version: 2.0 -# Table version: 2.00 +# Name: cp1252_WinLatin1 to Unicode table +# Unicode version: 1.1 +# Table version: 1.1 # Table format: Format A -# Date: 04/15/98 -# -# Contact: cpxlate@microsoft.com -# +# Date: 03/31/95 +# Authors: Michel Suignard <michelsu@microsoft.com> +# Lori Hoerth <lorih@microsoft.com> # General notes: none # # Format: Three tab-separated columns -# Column #1 is the cp1252 code (in hex) -# Column #2 is the Unicode (in hex as 0xXXXX) +# Column #1 is the cp1252_WinLatin1 code (in hex) +# Column #2 is the Unicode (in hex as U+XXXX) # Column #3 is the Unicode name (follows a comment sign, '#') # -# The entries are in cp1252 order +# The entries are in cp1252_WinLatin1 order # -################## +#0x00 U+0000 #Null +#0x01 U+0001 #START OF HEADING +#0x02 U+0002 #START OF TEXT +#0x03 U+0003 #END OF TEXT +#0x04 U+0004 #END OF TRANSMISSION +#0x05 U+0005 #ENQUIRY +#0x06 U+0006 #ACKNOWLEDGE +#0x07 U+0007 #BELL +#0x08 U+0008 #BACKSPACE +#0x09 U+0009 #HORIZONTAL TABULATION +#0x0a U+000a #LINE FEED +#0x0b U+000b #VERTICAL TABULATION +#0x0c U+000c #FORM FEED +#0x0d U+000d #CARRIAGE RETURN +#0x0e U+000e #SHIFT OUT +#0x0f U+000f #SHIFT IN +#0x10 U+0010 #DATA LINK ESCAPE +#0x11 U+0011 #DEVICE CONTROL ONE +#0x12 U+0012 #DEVICE CONTROL TWO +#0x13 U+0013 #DEVICE CONTROL THREE +#0x14 U+0014 #DEVICE CONTROL FOUR +#0x15 U+0015 #NEGATIVE ACKNOWLEDGE +#0x16 U+0016 #SYNCHRONOUS IDLE +#0x17 U+0017 #END OF TRANSMISSION BLOCK +#0x18 U+0018 #CANCEL +#0x19 U+0019 #END OF MEDIUM +#0x1a U+001a #SUBSTITUTE +#0x1b U+001b #ESCAPE +#0x1c U+001c #FILE SEPARATOR +#0x1d U+001d #GROUP SEPARATOR +#0x1e U+001e #RECORD SEPARATOR +#0x1f U+001f #UNIT SEPARATOR +0x20 U+0020 #SPACE +0x21 U+0021 #EXCLAMATION MARK +0x22 U+0022 #QUOTATION MARK +0x23 U+0023 #NUMBER SIGN +0x24 U+0024 #DOLLAR SIGN +0x25 U+0025 #PERCENT SIGN +0x26 U+0026 #AMPERSAND +0x27 U+0027 #APOSTROPHE +0x28 U+0028 #LEFT PARENTHESIS +0x29 U+0029 #RIGHT PARENTHESIS +0x2a U+002a #ASTERISK +0x2b U+002b #PLUS SIGN +0x2c U+002c #COMMA +0x2d U+002d #HYPHEN-MINUS +0x2e U+002e #FULL STOP +0x2f U+002f #SOLIDUS +0x30 U+0030 #DIGIT ZERO +0x31 U+0031 #DIGIT ONE +0x32 U+0032 #DIGIT TWO +0x33 U+0033 #DIGIT THREE +0x34 U+0034 #DIGIT FOUR +0x35 U+0035 #DIGIT FIVE +0x36 U+0036 #DIGIT SIX +0x37 U+0037 #DIGIT SEVEN +0x38 U+0038 #DIGIT EIGHT +0x39 U+0039 #DIGIT NINE +0x3a U+003a #COLON +0x3b U+003b #SEMICOLON +0x3c U+003c #LESS-THAN SIGN +0x3d U+003d #EQUALS SIGN +0x3e U+003e #GREATER-THAN SIGN +0x3f U+003f #QUESTION MARK +0x40 U+0040 #COMMERCIAL AT +0x41 U+0041 #LATIN CAPITAL LETTER A +0x42 U+0042 #LATIN CAPITAL LETTER B +0x43 U+0043 #LATIN CAPITAL LETTER C +0x44 U+0044 #LATIN CAPITAL LETTER D +0x45 U+0045 #LATIN CAPITAL LETTER E +0x46 U+0046 #LATIN CAPITAL LETTER F +0x47 U+0047 #LATIN CAPITAL LETTER G +0x48 U+0048 #LATIN CAPITAL LETTER H +0x49 U+0049 #LATIN CAPITAL LETTER I +0x4a U+004a #LATIN CAPITAL LETTER J +0x4b U+004b #LATIN CAPITAL LETTER K +0x4c U+004c #LATIN CAPITAL LETTER L +0x4d U+004d #LATIN CAPITAL LETTER M +0x4e U+004e #LATIN CAPITAL LETTER N +0x4f U+004f #LATIN CAPITAL LETTER O +0x50 U+0050 #LATIN CAPITAL LETTER P +0x51 U+0051 #LATIN CAPITAL LETTER Q +0x52 U+0052 #LATIN CAPITAL LETTER R +0x53 U+0053 #LATIN CAPITAL LETTER S +0x54 U+0054 #LATIN CAPITAL LETTER T +0x55 U+0055 #LATIN CAPITAL LETTER U +0x56 U+0056 #LATIN CAPITAL LETTER V +0x57 U+0057 #LATIN CAPITAL LETTER W +0x58 U+0058 #LATIN CAPITAL LETTER X +0x59 U+0059 #LATIN CAPITAL LETTER Y +0x5a U+005a #LATIN CAPITAL LETTER Z +0x5b U+005b #LEFT SQUARE BRACKET +0x5c U+005c #REVERSE SOLIDUS +0x5d U+005d #RIGHT SQUARE BRACKET +0x5e U+005e #CIRCUMFLEX ACCENT +0x5f U+005f #LOW LINE +0x60 U+0060 #GRAVE ACCENT +0x61 U+0061 #LATIN SMALL LETTER A +0x62 U+0062 #LATIN SMALL LETTER B +0x63 U+0063 #LATIN SMALL LETTER C +0x64 U+0064 #LATIN SMALL LETTER D +0x65 U+0065 #LATIN SMALL LETTER E +0x66 U+0066 #LATIN SMALL LETTER F +0x67 U+0067 #LATIN SMALL LETTER G +0x68 U+0068 #LATIN SMALL LETTER H +0x69 U+0069 #LATIN SMALL LETTER I +0x6a U+006a #LATIN SMALL LETTER J +0x6b U+006b #LATIN SMALL LETTER K +0x6c U+006c #LATIN SMALL LETTER L +0x6d U+006d #LATIN SMALL LETTER M +0x6e U+006e #LATIN SMALL LETTER N +0x6f U+006f #LATIN SMALL LETTER O +0x70 U+0070 #LATIN SMALL LETTER P +0x71 U+0071 #LATIN SMALL LETTER Q +0x72 U+0072 #LATIN SMALL LETTER R +0x73 U+0073 #LATIN SMALL LETTER S +0x74 U+0074 #LATIN SMALL LETTER T +0x75 U+0075 #LATIN SMALL LETTER U +0x76 U+0076 #LATIN SMALL LETTER V +0x77 U+0077 #LATIN SMALL LETTER W +0x78 U+0078 #LATIN SMALL LETTER X +0x79 U+0079 #LATIN SMALL LETTER Y +0x7a U+007a #LATIN SMALL LETTER Z +0x7b U+007b #LEFT CURLY BRACKET +0x7c U+007c #VERTICAL LINE +0x7d U+007d #RIGHT CURLY BRACKET +0x7e U+007e #TILDE +0x7f U+007f #DELETE +#0x80 U+0080 #NOT USED +#0x81 U+0081 #NOT USED +0x82 U+201a #SINGLE LOW-9 QUOTATION MARK +0x83 U+0192 #LATIN SMALL LETTER F WITH HOOK +0x84 U+201e #DOUBLE LOW-9 QUOTATION MARK +0x85 U+2026 #HORIZONTAL ELLIPSIS +0x86 U+2020 #DAGGER +0x87 U+2021 #DOUBLE DAGGER +0x88 U+02c6 #MODIFIER LETTER CIRCUMFLEX ACCENT +0x89 U+2030 #PER MILLE SIGN +0x8a U+0160 #LATIN CAPITAL LETTER S WITH CARON +0x8b U+2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK +0x8c U+0152 #LATIN CAPITAL LIGATURE OE +#0x8d U+008d #NOT USED +#0x8e U+008e #NOT USED +#0x8f U+008f #NOT USED +#0x90 U+0090 #NOT USED +0x91 U+2018 #LEFT SINGLE QUOTATION MARK +0x92 U+2019 #RIGHT SINGLE QUOTATION MARK +0x93 U+201c #LEFT DOUBLE QUOTATION MARK +0x94 U+201d #RIGHT DOUBLE QUOTATION MARK +0x95 U+2022 #BULLET +0x96 U+2013 #EN DASH +0x97 U+2014 #EM DASH +0x98 U+02dc #SMALL TILDE +0x99 U+2122 #TRADE MARK SIGN +0x9a U+0161 #LATIN SMALL LETTER S WITH CARON +0x9b U+203a #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +0x9c U+0153 #LATIN SMALL LIGATURE OE +#0x9d U+009d #NOT USED +#0x9e U+009e #NOT USED +0x9f U+0178 #LATIN CAPITAL LETTER Y WITH DIAERESIS +0xa0 U+00a0 #NO-BREAK SPACE +0xa1 U+00a1 #INVERTED EXCLAMATION MARK +0xa2 U+00a2 #CENT SIGN +0xa3 U+00a3 #POUND SIGN +0xa4 U+00a4 #CURRENCY SIGN +0xa5 U+00a5 #YEN SIGN +0xa6 U+00a6 #BROKEN BAR +0xa7 U+00a7 #SECTION SIGN +0xa8 U+00a8 #DIAERESIS +0xa9 U+00a9 #COPYRIGHT SIGN +0xaa U+00aa #FEMININE ORDINAL INDICATOR +0xab U+00ab #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +0xac U+00ac #NOT SIGN +0xad U+00ad #SOFT HYPHEN +0xae U+00ae #REGISTERED SIGN +0xaf U+00af #MACRON +0xb0 U+00b0 #DEGREE SIGN +0xb1 U+00b1 #PLUS-MINUS SIGN +0xb2 U+00b2 #SUPERSCRIPT TWO +0xb3 U+00b3 #SUPERSCRIPT THREE +0xb4 U+00b4 #ACUTE ACCENT +0xb5 U+00b5 #MICRO SIGN +0xb6 U+00b6 #PILCROW SIGN +0xb7 U+00b7 #MIDDLE DOT +0xb8 U+00b8 #CEDILLA +0xb9 U+00b9 #SUPERSCRIPT ONE +0xba U+00ba #MASCULINE ORDINAL INDICATOR +0xbb U+00bb #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +0xbc U+00bc #VULGAR FRACTION ONE QUARTER +0xbd U+00bd #VULGAR FRACTION ONE HALF +0xbe U+00be #VULGAR FRACTION THREE QUARTERS +0xbf U+00bf #INVERTED QUESTION MARK +0xc0 U+00c0 #LATIN CAPITAL LETTER A WITH GRAVE +0xc1 U+00c1 #LATIN CAPITAL LETTER A WITH ACUTE +0xc2 U+00c2 #LATIN CAPITAL LETTER A WITH CIRCUMFLEX +0xc3 U+00c3 #LATIN CAPITAL LETTER A WITH TILDE +0xc4 U+00c4 #LATIN CAPITAL LETTER A WITH DIAERESIS +0xc5 U+00c5 #LATIN CAPITAL LETTER A WITH RING ABOVE +0xc6 U+00c6 #LATIN CAPITAL LIGATURE AE +0xc7 U+00c7 #LATIN CAPITAL LETTER C WITH CEDILLA +0xc8 U+00c8 #LATIN CAPITAL LETTER E WITH GRAVE +0xc9 U+00c9 #LATIN CAPITAL LETTER E WITH ACUTE +0xca U+00ca #LATIN CAPITAL LETTER E WITH CIRCUMFLEX +0xcb U+00cb #LATIN CAPITAL LETTER E WITH DIAERESIS +0xcc U+00cc #LATIN CAPITAL LETTER I WITH GRAVE +0xcd U+00cd #LATIN CAPITAL LETTER I WITH ACUTE +0xce U+00ce #LATIN CAPITAL LETTER I WITH CIRCUMFLEX +0xcf U+00cf #LATIN CAPITAL LETTER I WITH DIAERESIS +0xd0 U+00d0 #LATIN CAPITAL LETTER ETH +0xd1 U+00d1 #LATIN CAPITAL LETTER N WITH TILDE +0xd2 U+00d2 #LATIN CAPITAL LETTER O WITH GRAVE +0xd3 U+00d3 #LATIN CAPITAL LETTER O WITH ACUTE +0xd4 U+00d4 #LATIN CAPITAL LETTER O WITH CIRCUMFLEX +0xd5 U+00d5 #LATIN CAPITAL LETTER O WITH TILDE +0xd6 U+00d6 #LATIN CAPITAL LETTER O WITH DIAERESIS +0xd7 U+00d7 #MULTIPLICATION SIGN +0xd8 U+00d8 #LATIN CAPITAL LETTER O WITH STROKE +0xd9 U+00d9 #LATIN CAPITAL LETTER U WITH GRAVE +0xda U+00da #LATIN CAPITAL LETTER U WITH ACUTE +0xdb U+00db #LATIN CAPITAL LETTER U WITH CIRCUMFLEX +0xdc U+00dc #LATIN CAPITAL LETTER U WITH DIAERESIS +0xdd U+00dd #LATIN CAPITAL LETTER Y WITH ACUTE +0xde U+00de #LATIN CAPITAL LETTER THORN +0xdf U+00df #LATIN SMALL LETTER SHARP S +0xe0 U+00e0 #LATIN SMALL LETTER A WITH GRAVE +0xe1 U+00e1 #LATIN SMALL LETTER A WITH ACUTE +0xe2 U+00e2 #LATIN SMALL LETTER A WITH CIRCUMFLEX +0xe3 U+00e3 #LATIN SMALL LETTER A WITH TILDE +0xe4 U+00e4 #LATIN SMALL LETTER A WITH DIAERESIS +0xe5 U+00e5 #LATIN SMALL LETTER A WITH RING ABOVE +0xe6 U+00e6 #LATIN SMALL LIGATURE AE +0xe7 U+00e7 #LATIN SMALL LETTER C WITH CEDILLA +0xe8 U+00e8 #LATIN SMALL LETTER E WITH GRAVE +0xe9 U+00e9 #LATIN SMALL LETTER E WITH ACUTE +0xea U+00ea #LATIN SMALL LETTER E WITH CIRCUMFLEX +0xeb U+00eb #LATIN SMALL LETTER E WITH DIAERESIS +0xec U+00ec #LATIN SMALL LETTER I WITH GRAVE +0xed U+00ed #LATIN SMALL LETTER I WITH ACUTE +0xee U+00ee #LATIN SMALL LETTER I WITH CIRCUMFLEX +0xef U+00ef #LATIN SMALL LETTER I WITH DIAERESIS +0xf0 U+00f0 #LATIN SMALL LETTER ETH +0xf1 U+00f1 #LATIN SMALL LETTER N WITH TILDE +0xf2 U+00f2 #LATIN SMALL LETTER O WITH GRAVE +0xf3 U+00f3 #LATIN SMALL LETTER O WITH ACUTE +0xf4 U+00f4 #LATIN SMALL LETTER O WITH CIRCUMFLEX +0xf5 U+00f5 #LATIN SMALL LETTER O WITH TILDE +0xf6 U+00f6 #LATIN SMALL LETTER O WITH DIAERESIS +0xf7 U+00f7 #DIVISION SIGN +0xf8 U+00f8 #LATIN SMALL LETTER O WITH STROKE +0xf9 U+00f9 #LATIN SMALL LETTER U WITH GRAVE +0xfa U+00fa #LATIN SMALL LETTER U WITH ACUTE +0xfb U+00fb #LATIN SMALL LETTER U WITH CIRCUMFLEX +0xfc U+00fc #LATIN SMALL LETTER U WITH DIAERESIS +0xfd U+00fd #LATIN SMALL LETTER Y WITH ACUTE +0xfe U+00fe #LATIN SMALL LETTER THORN +0xff U+00ff #LATIN SMALL LETTER Y WITH DIAERESIS + -0x20-0x7e idem -# -0x80 U+20AC #EURO SIGN -0x81 #UNDEFINED -0x82 U+201A #SINGLE LOW-9 QUOTATION MARK -0x83 U+0192 #LATIN SMALL LETTER F WITH HOOK -0x84 U+201E #DOUBLE LOW-9 QUOTATION MARK -0x85 U+2026 #HORIZONTAL ELLIPSIS -0x86 U+2020 #DAGGER -0x87 U+2021 #DOUBLE DAGGER -0x88 U+02C6 #MODIFIER LETTER CIRCUMFLEX ACCENT -0x89 U+2030 #PER MILLE SIGN -0x8A U+0160 #LATIN CAPITAL LETTER S WITH CARON -0x8B U+2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK -0x8C U+0152 #LATIN CAPITAL LIGATURE OE -0x8D #UNDEFINED -0x8E U+017D #LATIN CAPITAL LETTER Z WITH CARON -0x8F #UNDEFINED -0x90 #UNDEFINED -0x91 U+2018 #LEFT SINGLE QUOTATION MARK -0x92 U+2019 #RIGHT SINGLE QUOTATION MARK -0x93 U+201C #LEFT DOUBLE QUOTATION MARK -0x94 U+201D #RIGHT DOUBLE QUOTATION MARK -0x95 U+2022 #BULLET -0x96 U+2013 #EN DASH -0x97 U+2014 #EM DASH -0x98 U+02DC #SMALL TILDE -0x99 U+2122 #TRADE MARK SIGN -0x9A U+0161 #LATIN SMALL LETTER S WITH CARON -0x9B U+203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -0x9C U+0153 #LATIN SMALL LIGATURE OE -0x9D #UNDEFINED -0x9E U+017E #LATIN SMALL LETTER Z WITH CARON -0x9F U+0178 #LATIN CAPITAL LETTER Y WITH DIAERESIS -0xA0 U+00A0 #NO-BREAK SPACE -0xA1 U+00A1 #INVERTED EXCLAMATION MARK -0xA2 U+00A2 #CENT SIGN -0xA3 U+00A3 #POUND SIGN -0xA4 U+00A4 #CURRENCY SIGN -0xA5 U+00A5 #YEN SIGN -0xA6 U+00A6 #BROKEN BAR -0xA7 U+00A7 #SECTION SIGN -0xA8 U+00A8 #DIAERESIS -0xA9 U+00A9 #COPYRIGHT SIGN -0xAA U+00AA #FEMININE ORDINAL INDICATOR -0xAB U+00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK -0xAC U+00AC #NOT SIGN -0xAD U+00AD #SOFT HYPHEN -0xAE U+00AE #REGISTERED SIGN -0xAF U+00AF #MACRON -0xB0 U+00B0 #DEGREE SIGN -0xB1 U+00B1 #PLUS-MINUS SIGN -0xB2 U+00B2 #SUPERSCRIPT TWO -0xB3 U+00B3 #SUPERSCRIPT THREE -0xB4 U+00B4 #ACUTE ACCENT -0xB5 U+00B5 #MICRO SIGN -0xB6 U+00B6 #PILCROW SIGN -0xB7 U+00B7 #MIDDLE DOT -0xB8 U+00B8 #CEDILLA -0xB9 U+00B9 #SUPERSCRIPT ONE -0xBA U+00BA #MASCULINE ORDINAL INDICATOR -0xBB U+00BB #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -0xBC U+00BC #VULGAR FRACTION ONE QUARTER -0xBD U+00BD #VULGAR FRACTION ONE HALF -0xBE U+00BE #VULGAR FRACTION THREE QUARTERS -0xBF U+00BF #INVERTED QUESTION MARK -0xC0 U+00C0 #LATIN CAPITAL LETTER A WITH GRAVE -0xC1 U+00C1 #LATIN CAPITAL LETTER A WITH ACUTE -0xC2 U+00C2 #LATIN CAPITAL LETTER A WITH CIRCUMFLEX -0xC3 U+00C3 #LATIN CAPITAL LETTER A WITH TILDE -0xC4 U+00C4 #LATIN CAPITAL LETTER A WITH DIAERESIS -0xC5 U+00C5 #LATIN CAPITAL LETTER A WITH RING ABOVE -0xC6 U+00C6 #LATIN CAPITAL LETTER AE -0xC7 U+00C7 #LATIN CAPITAL LETTER C WITH CEDILLA -0xC8 U+00C8 #LATIN CAPITAL LETTER E WITH GRAVE -0xC9 U+00C9 #LATIN CAPITAL LETTER E WITH ACUTE -0xCA U+00CA #LATIN CAPITAL LETTER E WITH CIRCUMFLEX -0xCB U+00CB #LATIN CAPITAL LETTER E WITH DIAERESIS -0xCC U+00CC #LATIN CAPITAL LETTER I WITH GRAVE -0xCD U+00CD #LATIN CAPITAL LETTER I WITH ACUTE -0xCE U+00CE #LATIN CAPITAL LETTER I WITH CIRCUMFLEX -0xCF U+00CF #LATIN CAPITAL LETTER I WITH DIAERESIS -0xD0 U+00D0 #LATIN CAPITAL LETTER ETH -0xD1 U+00D1 #LATIN CAPITAL LETTER N WITH TILDE -0xD2 U+00D2 #LATIN CAPITAL LETTER O WITH GRAVE -0xD3 U+00D3 #LATIN CAPITAL LETTER O WITH ACUTE -0xD4 U+00D4 #LATIN CAPITAL LETTER O WITH CIRCUMFLEX -0xD5 U+00D5 #LATIN CAPITAL LETTER O WITH TILDE -0xD6 U+00D6 #LATIN CAPITAL LETTER O WITH DIAERESIS -0xD7 U+00D7 #MULTIPLICATION SIGN -0xD8 U+00D8 #LATIN CAPITAL LETTER O WITH STROKE -0xD9 U+00D9 #LATIN CAPITAL LETTER U WITH GRAVE -0xDA U+00DA #LATIN CAPITAL LETTER U WITH ACUTE -0xDB U+00DB #LATIN CAPITAL LETTER U WITH CIRCUMFLEX -0xDC U+00DC #LATIN CAPITAL LETTER U WITH DIAERESIS -0xDD U+00DD #LATIN CAPITAL LETTER Y WITH ACUTE -0xDE U+00DE #LATIN CAPITAL LETTER THORN -0xDF U+00DF #LATIN SMALL LETTER SHARP S -0xE0 U+00E0 #LATIN SMALL LETTER A WITH GRAVE -0xE1 U+00E1 #LATIN SMALL LETTER A WITH ACUTE -0xE2 U+00E2 #LATIN SMALL LETTER A WITH CIRCUMFLEX -0xE3 U+00E3 #LATIN SMALL LETTER A WITH TILDE -0xE4 U+00E4 #LATIN SMALL LETTER A WITH DIAERESIS -0xE5 U+00E5 #LATIN SMALL LETTER A WITH RING ABOVE -0xE6 U+00E6 #LATIN SMALL LETTER AE -0xE7 U+00E7 #LATIN SMALL LETTER C WITH CEDILLA -0xE8 U+00E8 #LATIN SMALL LETTER E WITH GRAVE -0xE9 U+00E9 #LATIN SMALL LETTER E WITH ACUTE -0xEA U+00EA #LATIN SMALL LETTER E WITH CIRCUMFLEX -0xEB U+00EB #LATIN SMALL LETTER E WITH DIAERESIS -0xEC U+00EC #LATIN SMALL LETTER I WITH GRAVE -0xED U+00ED #LATIN SMALL LETTER I WITH ACUTE -0xEE U+00EE #LATIN SMALL LETTER I WITH CIRCUMFLEX -0xEF U+00EF #LATIN SMALL LETTER I WITH DIAERESIS -0xF0 U+00F0 #LATIN SMALL LETTER ETH -0xF1 U+00F1 #LATIN SMALL LETTER N WITH TILDE -0xF2 U+00F2 #LATIN SMALL LETTER O WITH GRAVE -0xF3 U+00F3 #LATIN SMALL LETTER O WITH ACUTE -0xF4 U+00F4 #LATIN SMALL LETTER O WITH CIRCUMFLEX -0xF5 U+00F5 #LATIN SMALL LETTER O WITH TILDE -0xF6 U+00F6 #LATIN SMALL LETTER O WITH DIAERESIS -0xF7 U+00F7 #DIVISION SIGN -0xF8 U+00F8 #LATIN SMALL LETTER O WITH STROKE -0xF9 U+00F9 #LATIN SMALL LETTER U WITH GRAVE -0xFA U+00FA #LATIN SMALL LETTER U WITH ACUTE -0xFB U+00FB #LATIN SMALL LETTER U WITH CIRCUMFLEX -0xFC U+00FC #LATIN SMALL LETTER U WITH DIAERESIS -0xFD U+00FD #LATIN SMALL LETTER Y WITH ACUTE -0xFE U+00FE #LATIN SMALL LETTER THORN -0xFF U+00FF #LATIN SMALL LETTER Y WITH DIAERESIS diff --git a/src/chrtrans/cp1253_uni.tbl b/src/chrtrans/cp1253_uni.tbl index b53e44a2..097dae2b 100644 --- a/src/chrtrans/cp1253_uni.tbl +++ b/src/chrtrans/cp1253_uni.tbl @@ -2,47 +2,45 @@ Mwindows-1253 #Name as a Display Charset (used on Options screen) -OGreek (windows-1253) +OWinGreek (cp1253) -# -# Name: cp1253 to Unicode table +# Name: cp1253_WinGreek to Unicode table # Unicode version: 2.0 # Table version: 2.00 # Table format: Format A -# Date: 04/15/98 -# -# Contact: cpxlate@microsoft.com -# +# Date: 04/24/96 +# Authors: Lori Brownell <loribr@microsoft.com> +# K.D. Chang <a-kchang@microsoft.com> # General notes: none # # Format: Three tab-separated columns -# Column #1 is the cp1253 code (in hex) +# Column #1 is the cp1253_WinGreek code (in hex) # Column #2 is the Unicode (in hex as 0xXXXX) # Column #3 is the Unicode name (follows a comment sign, '#') # -# The entries are in cp1253 order +# The entries are in cp1253_WinGreek order # ################## -0x20-0x7e idem +0x20-0x7f idem # -0x80 U+20AC #EURO SIGN -0x81 #UNDEFINED +#0x80 #UNDEFINED +#0x81 #UNDEFINED 0x82 U+201A #SINGLE LOW-9 QUOTATION MARK 0x83 U+0192 #LATIN SMALL LETTER F WITH HOOK 0x84 U+201E #DOUBLE LOW-9 QUOTATION MARK 0x85 U+2026 #HORIZONTAL ELLIPSIS 0x86 U+2020 #DAGGER 0x87 U+2021 #DOUBLE DAGGER -0x88 #UNDEFINED +#0x88 #UNDEFINED 0x89 U+2030 #PER MILLE SIGN -0x8A #UNDEFINED +#0x8A #UNDEFINED 0x8B U+2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK -0x8C #UNDEFINED -0x8D #UNDEFINED -0x8E #UNDEFINED -0x8F #UNDEFINED -0x90 #UNDEFINED +#0x8C #UNDEFINED +#0x8D #UNDEFINED +#0x8E #UNDEFINED +#0x8F #UNDEFINED +#0x90 #UNDEFINED 0x91 U+2018 #LEFT SINGLE QUOTATION MARK 0x92 U+2019 #RIGHT SINGLE QUOTATION MARK 0x93 U+201C #LEFT DOUBLE QUOTATION MARK @@ -50,14 +48,14 @@ OGreek (windows-1253) 0x95 U+2022 #BULLET 0x96 U+2013 #EN DASH 0x97 U+2014 #EM DASH -0x98 #UNDEFINED +#0x98 #UNDEFINED 0x99 U+2122 #TRADE MARK SIGN -0x9A #UNDEFINED +#0x9A #UNDEFINED 0x9B U+203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -0x9C #UNDEFINED -0x9D #UNDEFINED -0x9E #UNDEFINED -0x9F #UNDEFINED +#0x9C #UNDEFINED +#0x9D #UNDEFINED +#0x9E #UNDEFINED +#0x9F #UNDEFINED 0xA0 U+00A0 #NO-BREAK SPACE 0xA1 U+0385 #GREEK DIALYTIKA TONOS 0xA2 U+0386 #GREEK CAPITAL LETTER ALPHA WITH TONOS @@ -68,7 +66,7 @@ OGreek (windows-1253) 0xA7 U+00A7 #SECTION SIGN 0xA8 U+00A8 #DIAERESIS 0xA9 U+00A9 #COPYRIGHT SIGN -0xAA #UNDEFINED +#0xAA #UNDEFINED 0xAB U+00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK 0xAC U+00AC #NOT SIGN 0xAD U+00AD #SOFT HYPHEN @@ -108,7 +106,7 @@ OGreek (windows-1253) 0xCF U+039F #GREEK CAPITAL LETTER OMICRON 0xD0 U+03A0 #GREEK CAPITAL LETTER PI 0xD1 U+03A1 #GREEK CAPITAL LETTER RHO -0xD2 #UNDEFINED +#0xD2 #UNDEFINED 0xD3 U+03A3 #GREEK CAPITAL LETTER SIGMA 0xD4 U+03A4 #GREEK CAPITAL LETTER TAU 0xD5 U+03A5 #GREEK CAPITAL LETTER UPSILON @@ -153,4 +151,4 @@ OGreek (windows-1253) 0xFC U+03CC #GREEK SMALL LETTER OMICRON WITH TONOS 0xFD U+03CD #GREEK SMALL LETTER UPSILON WITH TONOS 0xFE U+03CE #GREEK SMALL LETTER OMEGA WITH TONOS -0xFF #UNDEFINED +#0xFF #UNDEFINED diff --git a/src/chrtrans/cp1255_uni.tbl b/src/chrtrans/cp1255_uni.tbl index 6c4ca7d0..5f4d761a 100644 --- a/src/chrtrans/cp1255_uni.tbl +++ b/src/chrtrans/cp1255_uni.tbl @@ -2,94 +2,92 @@ Mwindows-1255 #Name as a Display Charset (used on Options screen). -OHebrew (windows-1255) +OWinHebrew (cp1255) -# -# Name: cp1255 to Unicode table +# Name: cp1255_WinHebrew to Unicode table # Unicode version: 2.0 # Table version: 2.00 # Table format: Format A -# Date: 04/15/98 -# -# Contact: cpxlate@microsoft.com -# +# Date: 04/24/96 +# Authors: Lori Brownell <loribr@microsoft.com> +# K.D. Chang <a-kchang@microsoft.com> # General notes: none # # Format: Three tab-separated columns -# Column #1 is the cp1255 code (in hex) +# Column #1 is the cp1255_WinHebrew code (in hex) # Column #2 is the Unicode (in hex as 0xXXXX) # Column #3 is the Unicode name (follows a comment sign, '#') # -# The entries are in cp1255 order +# The entries are in cp1255_WinHebrew order # ################## -0x20-0x7e idem +0x20-0x7f idem # -0x80 U+20AC #EURO SIGN -0x81 #UNDEFINED -0x82 U+201A #SINGLE LOW-9 QUOTATION MARK -0x83 U+0192 #LATIN SMALL LETTER F WITH HOOK -0x84 U+201E #DOUBLE LOW-9 QUOTATION MARK +#0x80 #UNDEFINED +#0x81 #UNDEFINED +0x82 U+201A #LOW SINGLE COMMA QUOTATION MARK +0x83 U+0192 #LATIN SMALL LETTER SCRIPT F +0x84 U+201E #LOW DOUBLE COMMA QUOTATION MARK 0x85 U+2026 #HORIZONTAL ELLIPSIS 0x86 U+2020 #DAGGER 0x87 U+2021 #DOUBLE DAGGER -0x88 U+02C6 #MODIFIER LETTER CIRCUMFLEX ACCENT +0x88 U+02C6 #MODIFIER LETTER CIRCUMFLEX 0x89 U+2030 #PER MILLE SIGN -0x8A #UNDEFINED -0x8B U+2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK -0x8C #UNDEFINED -0x8D #UNDEFINED -0x8E #UNDEFINED -0x8F #UNDEFINED -0x90 #UNDEFINED -0x91 U+2018 #LEFT SINGLE QUOTATION MARK -0x92 U+2019 #RIGHT SINGLE QUOTATION MARK -0x93 U+201C #LEFT DOUBLE QUOTATION MARK -0x94 U+201D #RIGHT DOUBLE QUOTATION MARK +#0x8A #UNDEFINED +0x8B U+2039 #LEFT POINTING SINGLE GUILLEMET +#0x8C #UNDEFINED +#0x8D #UNDEFINED +#0x8E #UNDEFINED +#0x8F #UNDEFINED +#0x90 #UNDEFINED +0x91 U+2018 #SINGLE TURNED COMMA QUOTATION MARK +0x92 U+2019 #SINGLE COMMA QUOTATION MARK +0x93 U+201C #DOUBLE TURNED COMMA QUOTATION MARK +0x94 U+201D #DOUBLE COMMA QUOTATION MARK 0x95 U+2022 #BULLET 0x96 U+2013 #EN DASH 0x97 U+2014 #EM DASH -0x98 U+02DC #SMALL TILDE -0x99 U+2122 #TRADE MARK SIGN -0x9A #UNDEFINED -0x9B U+203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -0x9C #UNDEFINED -0x9D #UNDEFINED -0x9E #UNDEFINED -0x9F #UNDEFINED -0xA0 U+00A0 #NO-BREAK SPACE -0xA1 U+00A1 #INVERTED EXCLAMATION MARK +0x98 U+02DC #SPACING TILDE +0x99 U+2122 #TRADEMARK +#0x9A #UNDEFINED +0x9B U+203A #RIGHT POINTING SINGLE GUILLEMET +#0x9C #UNDEFINED +#0x9D #UNDEFINED +#0x9E #UNDEFINED +#0x9F #UNDEFINED +0xA0 U+00A0 #NON-BREAKING SPACE +#0xA1 #UNDEFINED 0xA2 U+00A2 #CENT SIGN 0xA3 U+00A3 #POUND SIGN 0xA4 U+20AA #NEW SHEQEL SIGN 0xA5 U+00A5 #YEN SIGN -0xA6 U+00A6 #BROKEN BAR +0xA6 U+00A6 #BROKEN VERTICAL BAR 0xA7 U+00A7 #SECTION SIGN -0xA8 U+00A8 #DIAERESIS +0xA8 U+00A8 #SPACING DIAERESIS 0xA9 U+00A9 #COPYRIGHT SIGN -0xAA U+00D7 #MULTIPLICATION SIGN -0xAB U+00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +#0xAA #UNDEFINED +0xAB U+00AB #LEFT POINTING GUILLEMET 0xAC U+00AC #NOT SIGN 0xAD U+00AD #SOFT HYPHEN -0xAE U+00AE #REGISTERED SIGN -0xAF U+00AF #MACRON +0xAE U+00AE #REGISTERED TRADE MARK SIGN +0xAF U+00AF #SPACING MACRON 0xB0 U+00B0 #DEGREE SIGN -0xB1 U+00B1 #PLUS-MINUS SIGN -0xB2 U+00B2 #SUPERSCRIPT TWO -0xB3 U+00B3 #SUPERSCRIPT THREE -0xB4 U+00B4 #ACUTE ACCENT +0xB1 U+00B1 #PLUS-OR-MINUS SIGN +0xB2 U+00B2 #SUPERSCRIPT DIGIT TWO +0xB3 U+00B3 #SUPERSCRIPT DIGIT THREE +0xB4 U+00B4 #SPACING ACUTE 0xB5 U+00B5 #MICRO SIGN -0xB6 U+00B6 #PILCROW SIGN +0xB6 U+00B6 #PARAGRAPH SIGN 0xB7 U+00B7 #MIDDLE DOT -0xB8 U+00B8 #CEDILLA -0xB9 U+00B9 #SUPERSCRIPT ONE -0xBA U+00F7 #DIVISION SIGN -0xBB U+00BB #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -0xBC U+00BC #VULGAR FRACTION ONE QUARTER -0xBD U+00BD #VULGAR FRACTION ONE HALF -0xBE U+00BE #VULGAR FRACTION THREE QUARTERS -0xBF U+00BF #INVERTED QUESTION MARK +#0xB8 #UNDEFINED +0xB9 U+00B9 #SUPERSCRIPT DIGIT ONE +#0xBA #UNDEFINED +0xBB U+00BB #RIGHT POINTING GUILLEMET +0xBC U+00BC #FRACTION ONE QUARTER +0xBD U+00BD #FRACTION ONE HALF +0xBE U+00BE #FRACTION THREE QUARTERS +#0xBF #UNDEFINED 0xC0 U+05B0 #HEBREW POINT SHEVA 0xC1 U+05B1 #HEBREW POINT HATAF SEGOL 0xC2 U+05B2 #HEBREW POINT HATAF PATAH @@ -100,28 +98,28 @@ OHebrew (windows-1255) 0xC7 U+05B7 #HEBREW POINT PATAH 0xC8 U+05B8 #HEBREW POINT QAMATS 0xC9 U+05B9 #HEBREW POINT HOLAM -0xCA #UNDEFINED +0xCA U+05BA #HEBREW POINT 0xCB U+05BB #HEBREW POINT QUBUTS -0xCC U+05BC #HEBREW POINT DAGESH OR MAPIQ +0xCC U+05BC #HEBREW POINT DAGESH 0xCD U+05BD #HEBREW POINT METEG 0xCE U+05BE #HEBREW PUNCTUATION MAQAF 0xCF U+05BF #HEBREW POINT RAFE -0xD0 U+05C0 #HEBREW PUNCTUATION PASEQ +0xD0 U+05C0 #HEBREW POINT PASEQ 0xD1 U+05C1 #HEBREW POINT SHIN DOT 0xD2 U+05C2 #HEBREW POINT SIN DOT 0xD3 U+05C3 #HEBREW PUNCTUATION SOF PASUQ -0xD4 U+05F0 #HEBREW LIGATURE YIDDISH DOUBLE VAV -0xD5 U+05F1 #HEBREW LIGATURE YIDDISH VAV YOD -0xD6 U+05F2 #HEBREW LIGATURE YIDDISH DOUBLE YOD -0xD7 U+05F3 #HEBREW PUNCTUATION GERESH -0xD8 U+05F4 #HEBREW PUNCTUATION GERSHAYIM -0xD9 #UNDEFINED -0xDA #UNDEFINED -0xDB #UNDEFINED -0xDC #UNDEFINED -0xDD #UNDEFINED -0xDE #UNDEFINED -0xDF #UNDEFINED +0xD4 U+05F0 #HEBREW LETTER DOUBLE VAV +0xD5 U+05F1 #HEBREW LETTER VAV YOD +0xD6 U+05F2 #HEBREW LETTER DOUBLE YOD +#0xD7 #UNDEFINED +#0xD8 #UNDEFINED +#0xD9 #UNDEFINED +#0xDA #UNDEFINED +#0xDB #UNDEFINED +#0xDC #UNDEFINED +#0xDD #UNDEFINED +#0xDE #UNDEFINED +#0xDF #UNDEFINED 0xE0 U+05D0 #HEBREW LETTER ALEF 0xE1 U+05D1 #HEBREW LETTER BET 0xE2 U+05D2 #HEBREW LETTER GIMEL @@ -149,8 +147,8 @@ OHebrew (windows-1255) 0xF8 U+05E8 #HEBREW LETTER RESH 0xF9 U+05E9 #HEBREW LETTER SHIN 0xFA U+05EA #HEBREW LETTER TAV -0xFB #UNDEFINED -0xFC #UNDEFINED +#0xFB #UNDEFINED +#0xFC #UNDEFINED 0xFD U+200E #LEFT-TO-RIGHT MARK 0xFE U+200F #RIGHT-TO-LEFT MARK -0xFF #UNDEFINED +#0xFF #UNDEFINED diff --git a/src/chrtrans/cp1256_uni.tbl b/src/chrtrans/cp1256_uni.tbl index 23af4614..6d85d221 100644 --- a/src/chrtrans/cp1256_uni.tbl +++ b/src/chrtrans/cp1256_uni.tbl @@ -2,112 +2,110 @@ Mwindows-1256 #Name as a Display Charset (used on Options screen). -OArabic (windows-1256) +OWinArabic (cp1256) -# -# Name: cp1256 to Unicode table +# Name: cp1256_WinArabic to Unicode table # Unicode version: 2.0 # Table version: 2.00 # Table format: Format A -# Date: 04/15/98 -# -# Contact: cpxlate@microsoft.com -# +# Date: 04/24/96 +# Authors: Lori Brownell <loribr@microsoft.com> +# K.D. Chang <a-kchang@microsoft.com> # General notes: none # # Format: Three tab-separated columns -# Column #1 is the cp1256 code (in hex) +# Column #1 is the cp1256_WinArabic code (in hex) # Column #2 is the Unicode (in hex as 0xXXXX) # Column #3 is the Unicode name (follows a comment sign, '#') # -# The entries are in cp1256 order +# The entries are in cp1256_WinArabic order # ################## -0x20-0x7e idem +0x20-0x7f idem # -0x80 U+20AC #EURO SIGN -0x81 U+067E #ARABIC LETTER PEH -0x82 U+201A #SINGLE LOW-9 QUOTATION MARK -0x83 U+0192 #LATIN SMALL LETTER F WITH HOOK -0x84 U+201E #DOUBLE LOW-9 QUOTATION MARK +#0x80 #UNDEFINED +0x81 U+067E #ARABIC TAA WITH THREE DOTS BELOW +0x82 U+201A #LOW SINGLE COMMA QUOTATION MARK +0x83 U+0192 #LATIN SMALL LETTER SCRIPT F +0x84 U+201E #LOW DOUBLE COMMA QUOTATION MARK 0x85 U+2026 #HORIZONTAL ELLIPSIS 0x86 U+2020 #DAGGER 0x87 U+2021 #DOUBLE DAGGER -0x88 U+02C6 #MODIFIER LETTER CIRCUMFLEX ACCENT +0x88 U+02C6 #MODIFIER LETTER CIRCUMFLEX 0x89 U+2030 #PER MILLE SIGN -0x8A #UNDEFINED -0x8B U+2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK -0x8C U+0152 #LATIN CAPITAL LIGATURE OE -0x8D U+0686 #ARABIC LETTER TCHEH -0x8E U+0698 #ARABIC LETTER JEH -0x8F #UNDEFINED -0x90 U+06AF #ARABIC LETTER GAF -0x91 U+2018 #LEFT SINGLE QUOTATION MARK -0x92 U+2019 #RIGHT SINGLE QUOTATION MARK -0x93 U+201C #LEFT DOUBLE QUOTATION MARK -0x94 U+201D #RIGHT DOUBLE QUOTATION MARK +#0x8A #UNDEFINED +0x8B U+2039 #LEFT POINTING SINGLE GUILLEMET +0x8C U+0152 #LATIN CAPITAL LETTER O E +0x8D U+0686 #ARABIC HAA WITH MIDDLE THREE DOTS DOWNWARD +0x8E U+0698 #ARABIC RA WITH THREE DOTS ABOVE +#0x8F #UNDEFINED +0x90 U+06AF #ARABIC GAF +0x91 U+2018 #SINGLE TURNED COMMA QUOTATION MARK +0x92 U+2019 #SINGLE COMMA QUOTATION MARK +0x93 U+201C #DOUBLE TURNED COMMA QUOTATION MARK +0x94 U+201D #DOUBLE COMMA QUOTATION MARK 0x95 U+2022 #BULLET 0x96 U+2013 #EN DASH 0x97 U+2014 #EM DASH -0x98 #UNDEFINED -0x99 U+2122 #TRADE MARK SIGN -0x9A #UNDEFINED -0x9B U+203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -0x9C U+0153 #LATIN SMALL LIGATURE OE +#0x98 #UNDEFINED +0x99 U+2122 #TRADEMARK +#0x9A #UNDEFINED +0x9B U+203A #RIGHT POINTING SINGLE GUILLEMET +0x9C U+0153 #LATIN SMALL LETTER O E 0x9D U+200C #ZERO WIDTH NON-JOINER 0x9E U+200D #ZERO WIDTH JOINER -0x9F #UNDEFINED -0xA0 U+00A0 #NO-BREAK SPACE +#0x9F #UNDEFINED +0xA0 U+00A0 #NON-BREAKING SPACE 0xA1 U+060C #ARABIC COMMA 0xA2 U+00A2 #CENT SIGN 0xA3 U+00A3 #POUND SIGN 0xA4 U+00A4 #CURRENCY SIGN 0xA5 U+00A5 #YEN SIGN -0xA6 U+00A6 #BROKEN BAR +0xA6 U+00A6 #BROKEN VERTICAL BAR 0xA7 U+00A7 #SECTION SIGN -0xA8 U+00A8 #DIAERESIS +0xA8 U+00A8 #SPACING DIAERESIS 0xA9 U+00A9 #COPYRIGHT SIGN -0xAA #UNDEFINED -0xAB U+00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +#0xAA #UNDEFINED +0xAB U+00AB #LEFT POINTING GUILLEMET 0xAC U+00AC #NOT SIGN 0xAD U+00AD #SOFT HYPHEN -0xAE U+00AE #REGISTERED SIGN -0xAF U+00AF #MACRON +0xAE U+00AE #REGISTERED TRADE MARK SIGN +0xAF U+00AF #SPACING MACRON 0xB0 U+00B0 #DEGREE SIGN -0xB1 U+00B1 #PLUS-MINUS SIGN -0xB2 U+00B2 #SUPERSCRIPT TWO -0xB3 U+00B3 #SUPERSCRIPT THREE -0xB4 U+00B4 #ACUTE ACCENT +0xB1 U+00B1 #PLUS-OR-MINUS SIGN +0xB2 U+00B2 #SUPERSCRIPT DIGIT TWO +0xB3 U+00B3 #SUPERSCRIPT DIGIT THREE +0xB4 U+00B4 #SPACING ACUTE 0xB5 U+00B5 #MICRO SIGN -0xB6 U+00B6 #PILCROW SIGN +0xB6 U+00B6 #PARAGRAPH SIGN 0xB7 U+00B7 #MIDDLE DOT -0xB8 U+00B8 #CEDILLA -0xB9 U+00B9 #SUPERSCRIPT ONE +0xB8 U+00B8 #SPACING CEDILLA +0xB9 U+00B9 #SUPERSCRIPT DIGIT ONE 0xBA U+061B #ARABIC SEMICOLON -0xBB U+00BB #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -0xBC U+00BC #VULGAR FRACTION ONE QUARTER -0xBD U+00BD #VULGAR FRACTION ONE HALF -0xBE U+00BE #VULGAR FRACTION THREE QUARTERS +0xBB U+00BB #RIGHT POINTING GUILLEMET +0xBC U+00BC #FRACTION ONE QUARTER +0xBD U+00BD #FRACTION ONE HALF +0xBE U+00BE #FRACTION THREE QUARTERS 0xBF U+061F #ARABIC QUESTION MARK -0xC0 #UNDEFINED -0xC1 U+0621 #ARABIC LETTER HAMZA -0xC2 U+0622 #ARABIC LETTER ALEF WITH MADDA ABOVE -0xC3 U+0623 #ARABIC LETTER ALEF WITH HAMZA ABOVE -0xC4 U+0624 #ARABIC LETTER WAW WITH HAMZA ABOVE -0xC5 U+0625 #ARABIC LETTER ALEF WITH HAMZA BELOW -0xC6 U+0626 #ARABIC LETTER YEH WITH HAMZA ABOVE +#0xC0 #UNDEFINED +0xC1 U+0621 #ARABIC LETTER HAMZAH +0xC2 U+0622 #ARABIC LETTER MADDAH ON ALEF +0xC3 U+0623 #ARABIC LETTER HAMZAH ON ALEF +0xC4 U+0624 #ARABIC LETTER HAMZAH ON WAW +0xC5 U+0625 #ARABIC LETTER HAMZAH UNDER ALEF +0xC6 U+0626 #ARABIC LETTER HAMZAH ON YA 0xC7 U+0627 #ARABIC LETTER ALEF -0xC8 U+0628 #ARABIC LETTER BEH -0xC9 U+0629 #ARABIC LETTER TEH MARBUTA -0xCA U+062A #ARABIC LETTER TEH -0xCB U+062B #ARABIC LETTER THEH +0xC8 U+0628 #ARABIC LETTER BAA +0xC9 U+0629 #ARABIC LETTER TAA MARBUTAH +0xCA U+062A #ARABIC LETTER TAA +0xCB U+062B #ARABIC LETTER THAA 0xCC U+062C #ARABIC LETTER JEEM -0xCD U+062D #ARABIC LETTER HAH -0xCE U+062E #ARABIC LETTER KHAH +0xCD U+062D #ARABIC LETTER HAA +0xCE U+062E #ARABIC LETTER KHAA 0xCF U+062F #ARABIC LETTER DAL 0xD0 U+0630 #ARABIC LETTER THAL -0xD1 U+0631 #ARABIC LETTER REH +0xD1 U+0631 #ARABIC LETTER RA 0xD2 U+0632 #ARABIC LETTER ZAIN 0xD3 U+0633 #ARABIC LETTER SEEN 0xD4 U+0634 #ARABIC LETTER SHEEN @@ -115,42 +113,42 @@ OArabic (windows-1256) 0xD6 U+0636 #ARABIC LETTER DAD 0xD7 U+00D7 #MULTIPLICATION SIGN 0xD8 U+0637 #ARABIC LETTER TAH -0xD9 U+0638 #ARABIC LETTER ZAH +0xD9 U+0638 #ARABIC LETTER DHAH 0xDA U+0639 #ARABIC LETTER AIN 0xDB U+063A #ARABIC LETTER GHAIN 0xDC U+0640 #ARABIC TATWEEL -0xDD U+0641 #ARABIC LETTER FEH +0xDD U+0641 #ARABIC LETTER FA 0xDE U+0642 #ARABIC LETTER QAF -0xDF U+0643 #ARABIC LETTER KAF -0xE0 U+00E0 #LATIN SMALL LETTER A WITH GRAVE +0xDF U+0643 #ARABIC LETTER CAF +0xE0 U+00E0 #LATIN SMALL LETTER A GRAVE 0xE1 U+0644 #ARABIC LETTER LAM -0xE2 U+00E2 #LATIN SMALL LETTER A WITH CIRCUMFLEX +0xE2 U+00E2 #LATIN SMALL LETTER A CIRCUMFLEX 0xE3 U+0645 #ARABIC LETTER MEEM 0xE4 U+0646 #ARABIC LETTER NOON -0xE5 U+0647 #ARABIC LETTER HEH +0xE5 U+0647 #ARABIC LETTER HA 0xE6 U+0648 #ARABIC LETTER WAW -0xE7 U+00E7 #LATIN SMALL LETTER C WITH CEDILLA -0xE8 U+00E8 #LATIN SMALL LETTER E WITH GRAVE -0xE9 U+00E9 #LATIN SMALL LETTER E WITH ACUTE -0xEA U+00EA #LATIN SMALL LETTER E WITH CIRCUMFLEX -0xEB U+00EB #LATIN SMALL LETTER E WITH DIAERESIS -0xEC U+0649 #ARABIC LETTER ALEF MAKSURA -0xED U+064A #ARABIC LETTER YEH -0xEE U+00EE #LATIN SMALL LETTER I WITH CIRCUMFLEX -0xEF U+00EF #LATIN SMALL LETTER I WITH DIAERESIS +0xE7 U+00E7 #LATIN SMALL LETTER C CEDILLA +0xE8 U+00E8 #LATIN SMALL LETTER E GRAVE +0xE9 U+00E9 #LATIN SMALL LETTER E ACUTE +0xEA U+00EA #LATIN SMALL LETTER E CIRCUMFLEX +0xEB U+00EB #LATIN SMALL LETTER E DIAERESIS +0xEC U+0649 #ARABIC LETTER ALEF MAQSURAH +0xED U+064A #ARABIC LETTER YA +0xEE U+00EE #LATIN SMALL LETTER I CIRCUMFLEX +0xEF U+00EF #LATIN SMALL LETTER I DIAERESIS 0xF0 U+064B #ARABIC FATHATAN 0xF1 U+064C #ARABIC DAMMATAN 0xF2 U+064D #ARABIC KASRATAN -0xF3 U+064E #ARABIC FATHA -0xF4 U+00F4 #LATIN SMALL LETTER O WITH CIRCUMFLEX -0xF5 U+064F #ARABIC DAMMA -0xF6 U+0650 #ARABIC KASRA +0xF3 U+064E #ARABIC FATHAH +0xF4 U+00F4 #LATIN SMALL LETTER O CIRCUMFLEX +0xF5 U+064F #ARABIC DAMMAH +0xF6 U+0650 #ARABIC KASRAH 0xF7 U+00F7 #DIVISION SIGN -0xF8 U+0651 #ARABIC SHADDA -0xF9 U+00F9 #LATIN SMALL LETTER U WITH GRAVE +0xF8 U+0651 #ARABIC SHADDAH +0xF9 U+00F9 #LATIN SMALL LETTER U GRAVE 0xFA U+0652 #ARABIC SUKUN -0xFB U+00FB #LATIN SMALL LETTER U WITH CIRCUMFLEX -0xFC U+00FC #LATIN SMALL LETTER U WITH DIAERESIS +0xFB U+00FB #LATIN SMALL LETTER U CIRCUMFLEX +0xFC U+00FC #LATIN SMALL LETTER U DIAERESIS 0xFD U+200E #LEFT-TO-RIGHT MARK 0xFE U+200F #RIGHT-TO-LEFT MARK -0xFF #UNDEFINED +#0xFF #UNDEFINED diff --git a/src/chrtrans/cp1257_uni.tbl b/src/chrtrans/cp1257_uni.tbl index 4c1e70e6..794df717 100644 --- a/src/chrtrans/cp1257_uni.tbl +++ b/src/chrtrans/cp1257_uni.tbl @@ -2,47 +2,169 @@ Mwindows-1257 #Name as a Display Charset (used on Options screen) -OBaltic Rim (windows-1257) +OWinBaltRim (cp1257) -# -# Name: cp1257 to Unicode table +# Name: cp1257_WinBaltic to Unicode table # Unicode version: 2.0 # Table version: 2.00 # Table format: Format A -# Date: 04/15/98 -# -# Contact: cpxlate@microsoft.com -# +# Date: 04/24/96 +# Authors: Lori Brownell <loribr@microsoft.com> +# K.D. Chang <a-kchang@microsoft.com> # General notes: none # # Format: Three tab-separated columns -# Column #1 is the cp1257 code (in hex) +# Column #1 is the cp1257_WinBaltic code (in hex) # Column #2 is the Unicode (in hex as 0xXXXX) # Column #3 is the Unicode name (follows a comment sign, '#') # -# The entries are in cp1257 order +# The entries are in cp1257_WinBaltic order # -################## - -0x20-0x7e idem -# -0x80 U+20AC #EURO SIGN -0x81 #UNDEFINED -0x82 U+201A #SINGLE LOW-9 QUOTATION MARK -0x83 #UNDEFINED -0x84 U+201E #DOUBLE LOW-9 QUOTATION MARK +#0x00 U+0000 #NULL +#0x01 U+0001 #START OF HEADING +#0x02 U+0002 #START OF TEXT +#0x03 U+0003 #END OF TEXT +#0x04 U+0004 #END OF TRANSMISSION +#0x05 U+0005 #ENQUIRY +#0x06 U+0006 #ACKNOWLEDGE +#0x07 U+0007 #BELL +#0x08 U+0008 #BACKSPACE +#0x09 U+0009 #HORIZONTAL TABULATION +#0x0A U+000A #LINE FEED +#0x0B U+000B #VERTICAL TABULATION +#0x0C U+000C #FORM FEED +#0x0D U+000D #CARRIAGE RETURN +#0x0E U+000E #SHIFT OUT +#0x0F U+000F #SHIFT IN +#0x10 U+0010 #DATA LINK ESCAPE +#0x11 U+0011 #DEVICE CONTROL ONE +#0x12 U+0012 #DEVICE CONTROL TWO +#0x13 U+0013 #DEVICE CONTROL THREE +#0x14 U+0014 #DEVICE CONTROL FOUR +#0x15 U+0015 #NEGATIVE ACKNOWLEDGE +#0x16 U+0016 #SYNCHRONOUS IDLE +#0x17 U+0017 #END OF TRANSMISSION BLOCK +#0x18 U+0018 #CANCEL +#0x19 U+0019 #END OF MEDIUM +#0x1A U+001A #SUBSTITUTE +#0x1B U+001B #ESCAPE +#0x1C U+001C #FILE SEPARATOR +#0x1D U+001D #GROUP SEPARATOR +#0x1E U+001E #RECORD SEPARATOR +#0x1F U+001F #UNIT SEPARATOR +0x20 U+0020 #SPACE +0x21 U+0021 #EXCLAMATION MARK +0x22 U+0022 #QUOTATION MARK +0x23 U+0023 #NUMBER SIGN +0x24 U+0024 #DOLLAR SIGN +0x25 U+0025 #PERCENT SIGN +0x26 U+0026 #AMPERSAND +0x27 U+0027 #APOSTROPHE +0x28 U+0028 #LEFT PARENTHESIS +0x29 U+0029 #RIGHT PARENTHESIS +0x2A U+002A #ASTERISK +0x2B U+002B #PLUS SIGN +0x2C U+002C #COMMA +0x2D U+002D #HYPHEN-MINUS +0x2E U+002E #FULL STOP +0x2F U+002F #SOLIDUS +0x30 U+0030 #DIGIT 0 +0x31 U+0031 #DIGIT 1 +0x32 U+0032 #DIGIT 2 +0x33 U+0033 #DIGIT 3 +0x34 U+0034 #DIGIT 4 +0x35 U+0035 #DIGIT 5 +0x36 U+0036 #DIGIT 6 +0x37 U+0037 #DIGIT 7 +0x38 U+0038 #DIGIT 8 +0x39 U+0039 #DIGIT 9 +0x3A U+003A #COLON +0x3B U+003B #SEMICOLON +0x3C U+003C #LESS-THAN SIGN +0x3D U+003D #EQUALS SIGN +0x3E U+003E #GREATER-THAN SIGN +0x3F U+003F #QUESTION MARK +0x40 U+0040 #COMMERCIAL AT +0x41 U+0041 #LATIN CAPITAL A +0x42 U+0042 #LATIN CAPITAL B +0x43 U+0043 #LATIN CAPITAL C +0x44 U+0044 #LATIN CAPITAL D +0x45 U+0045 #LATIN CAPITAL E +0x46 U+0046 #LATIN CAPITAL F +0x47 U+0047 #LATIN CAPITAL G +0x48 U+0048 #LATIN CAPITAL H +0x49 U+0049 #LATIN CAPITAL I +0x4A U+004A #LATIN CAPITAL J +0x4B U+004B #LATIN CAPITAL K +0x4C U+004C #LATIN CAPITAL L +0x4D U+004D #LATIN CAPITAL M +0x4E U+004E #LATIN CAPITAL N +0x4F U+004F #LATIN CAPITAL O +0x50 U+0050 #LATIN CAPITAL P +0x51 U+0051 #LATIN CAPITAL Q +0x52 U+0052 #LATIN CAPITAL R +0x53 U+0053 #LATIN CAPITAL S +0x54 U+0054 #LATIN CAPITAL T +0x55 U+0055 #LATIN CAPITAL U +0x56 U+0056 #LATIN CAPITAL V +0x57 U+0057 #LATIN CAPITAL W +0x58 U+0058 #LATIN CAPITAL X +0x59 U+0059 #LATIN CAPITAL Y +0x5A U+005A #LATIN CAPITAL Z +0x5B U+005B #LEFT SQUARE BRACKET +0x5C U+005C #BACKSLASH +0x5D U+005D #RIGHT SQUARE BRACKET +0x5E U+005E #CIRCUMFLEX +0x5F U+005F #LOW LINE +0x60 U+0060 #GRAVE +0x61 U+0061 #LATIN SMALL A +0x62 U+0062 #LATIN SMALL B +0x63 U+0063 #LATIN SMALL C +0x64 U+0064 #LATIN SMALL D +0x65 U+0065 #LATIN SMALL E +0x66 U+0066 #LATIN SMALL F +0x67 U+0067 #LATIN SMALL G +0x68 U+0068 #LATIN SMALL H +0x69 U+0069 #LATIN SMALL I +0x6A U+006A #LATIN SMALL J +0x6B U+006B #LATIN SMALL K +0x6C U+006C #LATIN SMALL L +0x6D U+006D #LATIN SMALL M +0x6E U+006E #LATIN SMALL N +0x6F U+006F #LATIN SMALL O +0x70 U+0070 #LATIN SMALL P +0x71 U+0071 #LATIN SMALL Q +0x72 U+0072 #LATIN SMALL R +0x73 U+0073 #LATIN SMALL S +0x74 U+0074 #LATIN SMALL T +0x75 U+0075 #LATIN SMALL U +0x76 U+0076 #LATIN SMALL V +0x77 U+0077 #LATIN SMALL W +0x78 U+0078 #LATIN SMALL X +0x79 U+0079 #LATIN SMALL Y +0x7A U+007A #LATIN SMALL Z +0x7B U+007B #LEFT CURLY BRACKET +0x7C U+007C #VERTICAL LINE +0x7D U+007D #RIGHT CURLY BRACKET +0x7E U+007E #TILDE +#0x7F U+007F #DELETE +#0x80 #UNDEFINED +#0x81 #UNDEFINED +0x82 U+201A #LOW SINGLE COMMA QUOTATION MARK +#0x83 #UNDEFINED +0x84 U+201E #LOW DOUBLE COMMA QUOTATION MARK 0x85 U+2026 #HORIZONTAL ELLIPSIS 0x86 U+2020 #DAGGER 0x87 U+2021 #DOUBLE DAGGER -0x88 #UNDEFINED +#0x88 #UNDEFINED 0x89 U+2030 #PER MILLE SIGN -0x8A #UNDEFINED -0x8B U+2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK -0x8C #UNDEFINED +#0x8A #UNDEFINED +0x8B U+2039 #LEFT POINTING SINGLE GUILLEMENT +#0x8C #UNDEFINED 0x8D U+00A8 #DIAERESIS -0x8E U+02C7 #CARON +0x8E U+02C7 #HACEK 0x8F U+00B8 #CEDILLA -0x90 #UNDEFINED +#0x90 #UNDEFINED 0x91 U+2018 #LEFT SINGLE QUOTATION MARK 0x92 U+2019 #RIGHT SINGLE QUOTATION MARK 0x93 U+201C #LEFT DOUBLE QUOTATION MARK @@ -50,108 +172,107 @@ OBaltic Rim (windows-1257) 0x95 U+2022 #BULLET 0x96 U+2013 #EN DASH 0x97 U+2014 #EM DASH -0x98 #UNDEFINED +#0x98 #UNDEFINED 0x99 U+2122 #TRADE MARK SIGN -0x9A #UNDEFINED -0x9B U+203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -0x9C #UNDEFINED +#0x9A #UNDEFINED +0x9B U+203A #RIGHT POINTING SINGLE GUILLEMENT +#0x9C #UNDEFINED 0x9D U+00AF #MACRON 0x9E U+02DB #OGONEK -0x9F #UNDEFINED +#0x9F #UNDEFINED 0xA0 U+00A0 #NO-BREAK SPACE -0xA1 #UNDEFINED +#0xA1 #UNDEFINED 0xA2 U+00A2 #CENT SIGN 0xA3 U+00A3 #POUND SIGN 0xA4 U+00A4 #CURRENCY SIGN -0xA5 #UNDEFINED +#0xA5 #UNDEFINED 0xA6 U+00A6 #BROKEN BAR 0xA7 U+00A7 #SECTION SIGN -0xA8 U+00D8 #LATIN CAPITAL LETTER O WITH STROKE +0xA8 U+00D8 #LATIN CAPITAL O STROKE 0xA9 U+00A9 #COPYRIGHT SIGN -0xAA U+0156 #LATIN CAPITAL LETTER R WITH CEDILLA -0xAB U+00AB #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +0xAA U+0156 #LATIN CAPITAL R CEDILLA +0xAB U+00AB #LEFT POINTING GUILLEMENT 0xAC U+00AC #NOT SIGN 0xAD U+00AD #SOFT HYPHEN 0xAE U+00AE #REGISTERED SIGN -0xAF U+00C6 #LATIN CAPITAL LETTER AE +0xAF U+00C6 #LATIN CAPITAL AE LIGATURE 0xB0 U+00B0 #DEGREE SIGN 0xB1 U+00B1 #PLUS-MINUS SIGN -0xB2 U+00B2 #SUPERSCRIPT TWO -0xB3 U+00B3 #SUPERSCRIPT THREE -0xB4 U+00B4 #ACUTE ACCENT +0xB2 U+00B2 #SUPERSCRIPT 2 +0xB3 U+00B3 #SUPERSCRIPT 3 +0xB4 U+00B4 #ACUTE 0xB5 U+00B5 #MICRO SIGN 0xB6 U+00B6 #PILCROW SIGN 0xB7 U+00B7 #MIDDLE DOT -0xB8 U+00F8 #LATIN SMALL LETTER O WITH STROKE +0xB8 U+00F8 #LATIN SAMLL O STROKE 0xB9 U+00B9 #SUPERSCRIPT ONE -0xBA U+0157 #LATIN SMALL LETTER R WITH CEDILLA -0xBB U+00BB #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -0xBC U+00BC #VULGAR FRACTION ONE QUARTER -0xBD U+00BD #VULGAR FRACTION ONE HALF -0xBE U+00BE #VULGAR FRACTION THREE QUARTERS -0xBF U+00E6 #LATIN SMALL LETTER AE -0xC0 U+0104 #LATIN CAPITAL LETTER A WITH OGONEK -0xC1 U+012E #LATIN CAPITAL LETTER I WITH OGONEK -0xC2 U+0100 #LATIN CAPITAL LETTER A WITH MACRON -0xC3 U+0106 #LATIN CAPITAL LETTER C WITH ACUTE -0xC4 U+00C4 #LATIN CAPITAL LETTER A WITH DIAERESIS -0xC5 U+00C5 #LATIN CAPITAL LETTER A WITH RING ABOVE -0xC6 U+0118 #LATIN CAPITAL LETTER E WITH OGONEK -0xC7 U+0112 #LATIN CAPITAL LETTER E WITH MACRON -0xC8 U+010C #LATIN CAPITAL LETTER C WITH CARON -0xC9 U+00C9 #LATIN CAPITAL LETTER E WITH ACUTE -0xCA U+0179 #LATIN CAPITAL LETTER Z WITH ACUTE -0xCB U+0116 #LATIN CAPITAL LETTER E WITH DOT ABOVE -0xCC U+0122 #LATIN CAPITAL LETTER G WITH CEDILLA -0xCD U+0136 #LATIN CAPITAL LETTER K WITH CEDILLA -0xCE U+012A #LATIN CAPITAL LETTER I WITH MACRON -0xCF U+013B #LATIN CAPITAL LETTER L WITH CEDILLA -0xD0 U+0160 #LATIN CAPITAL LETTER S WITH CARON -0xD1 U+0143 #LATIN CAPITAL LETTER N WITH ACUTE -0xD2 U+0145 #LATIN CAPITAL LETTER N WITH CEDILLA -0xD3 U+00D3 #LATIN CAPITAL LETTER O WITH ACUTE -0xD4 U+014C #LATIN CAPITAL LETTER O WITH MACRON -0xD5 U+00D5 #LATIN CAPITAL LETTER O WITH TILDE -0xD6 U+00D6 #LATIN CAPITAL LETTER O WITH DIAERESIS +0xBA U+0157 #LATIN SMALL R CEDILLA +0xBB U+00BB #RIGHT POINTING GUILLEMENT +0xBC U+00BC #FRACTION 1/4 +0xBD U+00BD #FRACTION 1/2 +0xBE U+00BE #FRACTION 3/4 +0xBF U+00E6 #LATIN SMALL AE LIGATURE +0xC0 U+0104 #LATIN CAPITAL A OGONEK +0xC1 U+012E #LATIN CAPITAL I OGONEK +0xC2 U+0100 #LATIN CAPITAL A MACRON +0xC3 U+0106 #LATIN CAPITAL C ACUTE +0xC4 U+00C4 #LATIN CAPITAL A DIAERESIS +0xC5 U+00C5 #LATIN CAPITAL A RING ABOVE +0xC6 U+0118 #LATIN CAPITAL E OGONEK +0xC7 U+0112 #LATIN CAPITAL E MACRON +0xC8 U+010C #LATIN CAPITAL C HACEK +0xC9 U+00C9 #LATIN CAPITAL E ACUTE +0xCA U+0179 #LATIN CAPITAL Z ACUTE +0xCB U+0116 #LATIN CAPITAL E DOT ABOVE +0xCC U+0122 #LATIN CAPITAL G CEDILLA +0xCD U+0136 #LATIN CAPITAL K CEDILLA +0xCE U+012A #LATIN CAPITAL I MACRON +0xCF U+013B #LATIN CAPITAL L CEDILLA +0xD0 U+0160 #LATIN CAPITAL S HACEK +0xD1 U+0143 #LATIN CAPITAL N ACUTE +0xD2 U+0145 #LATIN CAPITAL N CEDILLA +0xD3 U+00D3 #LATIN CAPITAL O ACUTE +0xD4 U+014C #LATIN CAPITAL O MACRON +0xD5 U+00D5 #LATIN CAPITAL O TILDE +0xD6 U+00D6 #LATIN CAPITAL O DIAERESIS 0xD7 U+00D7 #MULTIPLICATION SIGN -0xD8 U+0172 #LATIN CAPITAL LETTER U WITH OGONEK -0xD9 U+0141 #LATIN CAPITAL LETTER L WITH STROKE -0xDA U+015A #LATIN CAPITAL LETTER S WITH ACUTE -0xDB U+016A #LATIN CAPITAL LETTER U WITH MACRON -0xDC U+00DC #LATIN CAPITAL LETTER U WITH DIAERESIS -0xDD U+017B #LATIN CAPITAL LETTER Z WITH DOT ABOVE -0xDE U+017D #LATIN CAPITAL LETTER Z WITH CARON -0xDF U+00DF #LATIN SMALL LETTER SHARP S -0xE0 U+0105 #LATIN SMALL LETTER A WITH OGONEK -0xE1 U+012F #LATIN SMALL LETTER I WITH OGONEK -0xE2 U+0101 #LATIN SMALL LETTER A WITH MACRON -0xE3 U+0107 #LATIN SMALL LETTER C WITH ACUTE -0xE4 U+00E4 #LATIN SMALL LETTER A WITH DIAERESIS -0xE5 U+00E5 #LATIN SMALL LETTER A WITH RING ABOVE -0xE6 U+0119 #LATIN SMALL LETTER E WITH OGONEK -0xE7 U+0113 #LATIN SMALL LETTER E WITH MACRON -0xE8 U+010D #LATIN SMALL LETTER C WITH CARON -0xE9 U+00E9 #LATIN SMALL LETTER E WITH ACUTE -0xEA U+017A #LATIN SMALL LETTER Z WITH ACUTE -0xEB U+0117 #LATIN SMALL LETTER E WITH DOT ABOVE -0xEC U+0123 #LATIN SMALL LETTER G WITH CEDILLA -0xED U+0137 #LATIN SMALL LETTER K WITH CEDILLA -0xEE U+012B #LATIN SMALL LETTER I WITH MACRON -0xEF U+013C #LATIN SMALL LETTER L WITH CEDILLA -0xF0 U+0161 #LATIN SMALL LETTER S WITH CARON -0xF1 U+0144 #LATIN SMALL LETTER N WITH ACUTE -0xF2 U+0146 #LATIN SMALL LETTER N WITH CEDILLA -0xF3 U+00F3 #LATIN SMALL LETTER O WITH ACUTE -0xF4 U+014D #LATIN SMALL LETTER O WITH MACRON -0xF5 U+00F5 #LATIN SMALL LETTER O WITH TILDE -0xF6 U+00F6 #LATIN SMALL LETTER O WITH DIAERESIS +0xD8 U+0172 #LATIN CAPITAL U OGONEK +0xD9 U+0141 #LATIN CAPITAL L STROKE +0xDA U+015A #LATIN CAPITAL S ACUTE +0xDB U+016A #LATIN CAPITAL U MACRON +0xDC U+00DC #LATIN CAPITAL U DIAERESIS +0xDD U+017B #LATIN CAPITAL Z DOT ABOVE +0xDE U+017D #LATIN CAPITAL Z HACEK +0xDF U+00DF #LATIN SMALL SHARP SS +0xE0 U+0105 #LATIN SMALL A OGONEK +0xE1 U+012F #LATIN SMALL I OGONEK +0xE2 U+0101 #LATIN SMALL A MACRON +0xE3 U+0107 #LATIN SMALL C ACUTE +0xE4 U+00E4 #LATIN SMALL A DIAERESIS +0xE5 U+00E5 #LATIN SMALL A RING ABOVE +0xE6 U+0119 #LATIN SMALL E OGONEK +0xE7 U+0113 #LATIN SMALL E MACRON +0xE8 U+010D #LATIN SMALL C HACEK +0xE9 U+00E9 #LATIN SMALL E ACUTE +0xEA U+017A #LATIN SMALL Z ACUTE +0xEB U+0117 #LATIN SMALL E DOT ABOVE +0xEC U+0123 #LATIN SMALL G CEDILLA +0xED U+0137 #LATIN SMALL K CEDILLA +0xEE U+012B #LATIN SMALL I MACRON +0xEF U+013C #LATIN SMALL L CEDILLA +0xF0 U+0161 #LATIN SMALL S HACEK +0xF1 U+0144 #LATIN SMALL N ACUTE +0xF2 U+0146 #LATIN SMALL N CEDILLA +0xF3 U+00F3 #LATIN SMALL O ACUTE +0xF4 U+014D #LATIN SMALL O MACRON +0xF5 U+00F5 #LATIN SMALL O TILDE +0xF6 U+00F6 #LATIN SMALL O DIAERESIS 0xF7 U+00F7 #DIVISION SIGN -0xF8 U+0173 #LATIN SMALL LETTER U WITH OGONEK -0xF9 U+0142 #LATIN SMALL LETTER L WITH STROKE -0xFA U+015B #LATIN SMALL LETTER S WITH ACUTE -0xFB U+016B #LATIN SMALL LETTER U WITH MACRON -0xFC U+00FC #LATIN SMALL LETTER U WITH DIAERESIS -0xFD U+017C #LATIN SMALL LETTER Z WITH DOT ABOVE -0xFE U+017E #LATIN SMALL LETTER Z WITH CARON +0xF8 U+0173 #LATIN SMALL U OGONEK +0xF9 U+0142 #LATIN SMALL L STROKE +0xFA U+015B #LATIN SMALL S ACUTE +0xFB U+016B #LATIN SMALL U MACRON +0xFC U+00FC #LATIN SMALL U DIAERESIS +0xFD U+017C #LATIN SMALL Z DOT ABOVE +0xFE U+017E #LATIN SMALL Z HACEK 0xFF U+02D9 #DOT ABOVE - diff --git a/src/chrtrans/cp437_uni.tbl b/src/chrtrans/cp437_uni.tbl index b84f503f..621e730e 100644 --- a/src/chrtrans/cp437_uni.tbl +++ b/src/chrtrans/cp437_uni.tbl @@ -6,21 +6,20 @@ D0 Mcp437 #Name as a Display Charset (used on Options screen) -OIBM PC US codepage (cp437) - +ODosLatinUS (cp437) # # Name: cp437_DOSLatinUS to Unicode table -# Unicode version: 2.0 -# Table version: 2.00 +# Unicode version: 1.1 +# Table version: 1.1 # Table format: Format A -# Date: 04/24/96 -# Authors: Lori Brownell <loribr@microsoft.com> -# K.D. Chang <a-kchang@microsoft.com> +# Date: 03/31/95 +# Authors: Michel Suignard <michelsu@microsoft.com> +# Lori Hoerth <lorih@microsoft.com> # General notes: none # # Format: Three tab-separated columns -# Column #1 is the cp437_DOSLatinUS code (in hex) -# Column #2 is the Unicode (in hex as 0xXXXX) +# Column #1 is the cp437_DosLatinUS code (in hex) +# Column #2 is the Unicode (in hex as U+XXXX) # Column #3 is the Unicode name (follows a comment sign, '#') # # The entries are in cp437_DosLatinUS order @@ -28,8 +27,6 @@ OIBM PC US codepage (cp437) # some mapppings of greek letters to latin letters added, # just for fun.. - KW # -####################################### - 0x20-0x7f idem # 0x80 U+00c7 #LATIN CAPITAL LETTER C WITH CEDILLA diff --git a/src/chrtrans/cp737_uni.tbl b/src/chrtrans/cp737_uni.tbl index 81442ccc..32f01c8c 100644 --- a/src/chrtrans/cp737_uni.tbl +++ b/src/chrtrans/cp737_uni.tbl @@ -2,7 +2,7 @@ Mcp737 #Name as a Display Charset (used on Options screen) -OGreek (cp737) +ODosGreek (cp737) # # Name: cp737_DOSGreek to Unicode table diff --git a/src/chrtrans/cp775_uni.tbl b/src/chrtrans/cp775_uni.tbl index 4d63208b..02a8b61b 100644 --- a/src/chrtrans/cp775_uni.tbl +++ b/src/chrtrans/cp775_uni.tbl @@ -2,7 +2,7 @@ Mcp775 #Name as a Display Charset (used on Options screen) -OBaltic Rim (cp775) +ODosBaltRim (cp775) # Name: cp775_DOSBaltRim to Unicode table # Unicode version: 2.0 @@ -20,10 +20,134 @@ OBaltic Rim (cp775) # # The entries are in cp775_DOSBaltRim order # -################## - -0x20-0x7e idem -# +#0x00 U+0000 #NULL +#0x01 U+0001 #START OF HEADING +#0x02 U+0002 #START OF TEXT +#0x03 U+0003 #END OF TEXT +#0x04 U+0004 #END OF TRANSMISSION +#0x05 U+0005 #ENQUIRY +#0x06 U+0006 #ACKNOWLEDGE +#0x07 U+0007 #BELL +#0x08 U+0008 #BACKSPACE +#0x09 U+0009 #HORIZONTAL TABULATION +#0x0a U+000a #LINE FEED +#0x0b U+000b #VERTICAL TABULATION +#0x0c U+000c #FORM FEED +#0x0d U+000d #CARRIAGE RETURN +#0x0e U+000e #SHIFT OUT +#0x0f U+000f #SHIFT IN +#0x10 U+0010 #DATA LINK ESCAPE +#0x11 U+0011 #DEVICE CONTROL ONE +#0x12 U+0012 #DEVICE CONTROL TWO +#0x13 U+0013 #DEVICE CONTROL THREE +#0x14 U+0014 #DEVICE CONTROL FOUR +#0x15 U+0015 #NEGATIVE ACKNOWLEDGE +#0x16 U+0016 #SYNCHRONOUS IDLE +#0x17 U+0017 #END OF TRANSMISSION BLOCK +#0x18 U+0018 #CANCEL +#0x19 U+0019 #END OF MEDIUM +#0x1a U+001a #SUBSTITUTE +#0x1b U+001b #ESCAPE +#0x1c U+001c #FILE SEPARATOR +#0x1d U+001d #GROUP SEPARATOR +#0x1e U+001e #RECORD SEPARATOR +#0x1f U+001f #UNIT SEPARATOR +0x20 U+0020 #SPACE +0x21 U+0021 #EXCLAMATION MARK +0x22 U+0022 #QUOTATION MARK +0x23 U+0023 #NUMBER SIGN +0x24 U+0024 #DOLLAR SIGN +0x25 U+0025 #PERCENT SIGN +0x26 U+0026 #AMPERSAND +0x27 U+0027 #APOSTROPHE +0x28 U+0028 #LEFT PARENTHESIS +0x29 U+0029 #RIGHT PARENTHESIS +0x2a U+002a #ASTERISK +0x2b U+002b #PLUS SIGN +0x2c U+002c #COMMA +0x2d U+002d #HYPHEN-MINUS +0x2e U+002e #FULL STOP +0x2f U+002f #SOLIDUS +0x30 U+0030 #DIGIT ZERO +0x31 U+0031 #DIGIT ONE +0x32 U+0032 #DIGIT TWO +0x33 U+0033 #DIGIT THREE +0x34 U+0034 #DIGIT FOUR +0x35 U+0035 #DIGIT FIVE +0x36 U+0036 #DIGIT SIX +0x37 U+0037 #DIGIT SEVEN +0x38 U+0038 #DIGIT EIGHT +0x39 U+0039 #DIGIT NINE +0x3a U+003a #COLON +0x3b U+003b #SEMICOLON +0x3c U+003c #LESS-THAN SIGN +0x3d U+003d #EQUALS SIGN +0x3e U+003e #GREATER-THAN SIGN +0x3f U+003f #QUESTION MARK +0x40 U+0040 #COMMERCIAL AT +0x41 U+0041 #LATIN CAPITAL LETTER A +0x42 U+0042 #LATIN CAPITAL LETTER B +0x43 U+0043 #LATIN CAPITAL LETTER C +0x44 U+0044 #LATIN CAPITAL LETTER D +0x45 U+0045 #LATIN CAPITAL LETTER E +0x46 U+0046 #LATIN CAPITAL LETTER F +0x47 U+0047 #LATIN CAPITAL LETTER G +0x48 U+0048 #LATIN CAPITAL LETTER H +0x49 U+0049 #LATIN CAPITAL LETTER I +0x4a U+004a #LATIN CAPITAL LETTER J +0x4b U+004b #LATIN CAPITAL LETTER K +0x4c U+004c #LATIN CAPITAL LETTER L +0x4d U+004d #LATIN CAPITAL LETTER M +0x4e U+004e #LATIN CAPITAL LETTER N +0x4f U+004f #LATIN CAPITAL LETTER O +0x50 U+0050 #LATIN CAPITAL LETTER P +0x51 U+0051 #LATIN CAPITAL LETTER Q +0x52 U+0052 #LATIN CAPITAL LETTER R +0x53 U+0053 #LATIN CAPITAL LETTER S +0x54 U+0054 #LATIN CAPITAL LETTER T +0x55 U+0055 #LATIN CAPITAL LETTER U +0x56 U+0056 #LATIN CAPITAL LETTER V +0x57 U+0057 #LATIN CAPITAL LETTER W +0x58 U+0058 #LATIN CAPITAL LETTER X +0x59 U+0059 #LATIN CAPITAL LETTER Y +0x5a U+005a #LATIN CAPITAL LETTER Z +0x5b U+005b #LEFT SQUARE BRACKET +0x5c U+005c #REVERSE SOLIDUS +0x5d U+005d #RIGHT SQUARE BRACKET +0x5e U+005e #CIRCUMFLEX ACCENT +0x5f U+005f #LOW LINE +0x60 U+0060 #GRAVE ACCENT +0x61 U+0061 #LATIN SMALL LETTER A +0x62 U+0062 #LATIN SMALL LETTER B +0x63 U+0063 #LATIN SMALL LETTER C +0x64 U+0064 #LATIN SMALL LETTER D +0x65 U+0065 #LATIN SMALL LETTER E +0x66 U+0066 #LATIN SMALL LETTER F +0x67 U+0067 #LATIN SMALL LETTER G +0x68 U+0068 #LATIN SMALL LETTER H +0x69 U+0069 #LATIN SMALL LETTER I +0x6a U+006a #LATIN SMALL LETTER J +0x6b U+006b #LATIN SMALL LETTER K +0x6c U+006c #LATIN SMALL LETTER L +0x6d U+006d #LATIN SMALL LETTER M +0x6e U+006e #LATIN SMALL LETTER N +0x6f U+006f #LATIN SMALL LETTER O +0x70 U+0070 #LATIN SMALL LETTER P +0x71 U+0071 #LATIN SMALL LETTER Q +0x72 U+0072 #LATIN SMALL LETTER R +0x73 U+0073 #LATIN SMALL LETTER S +0x74 U+0074 #LATIN SMALL LETTER T +0x75 U+0075 #LATIN SMALL LETTER U +0x76 U+0076 #LATIN SMALL LETTER V +0x77 U+0077 #LATIN SMALL LETTER W +0x78 U+0078 #LATIN SMALL LETTER X +0x79 U+0079 #LATIN SMALL LETTER Y +0x7a U+007a #LATIN SMALL LETTER Z +0x7b U+007b #LEFT CURLY BRACKET +0x7c U+007c #VERTICAL LINE +0x7d U+007d #RIGHT CURLY BRACKET +0x7e U+007e #TILDE +#0x7f U+007f #DELETE 0x80 U+0106 #LATIN CAPITAL LETTER C WITH ACUTE 0x81 U+00fc #LATIN SMALL LETTER U WITH DIAERESIS 0x82 U+00e9 #LATIN SMALL LETTER E WITH ACUTE diff --git a/src/chrtrans/cp850_uni.tbl b/src/chrtrans/cp850_uni.tbl index af4dbff5..05685971 100644 --- a/src/chrtrans/cp850_uni.tbl +++ b/src/chrtrans/cp850_uni.tbl @@ -8,29 +8,153 @@ D0 Mcp850 #Name as a Display Charset (used on Options screen) -OWestern (cp850) +ODosLatin1 (cp850) # # Name: cp850_DOSLatin1 to Unicode table -# Unicode version: 2.0 -# Table version: 2.00 +# Unicode version: 1.1 +# Table version: 1.1 # Table format: Format A -# Date: 04/24/96 -# Authors: Lori Brownell <loribr@microsoft.com> -# K.D. Chang <a-kchang@microsoft.com> +# Date: 03/31/95 +# Authors: Michel Suignard <michelsu@microsoft.com> +# Lori Hoerth <lorih@microsoft.com> # General notes: none # # Format: Three tab-separated columns # Column #1 is the cp850_DOSLatin1 code (in hex) -# Column #2 is the Unicode (in hex as 0xXXXX) +# Column #2 is the Unicode (in hex as U+XXXX) # Column #3 is the Unicode name (follows a comment sign, '#') # # The entries are in cp850_DOSLatin1 order # -################## - -0x20-0x7e idem -# +#0x00 U+0000 #NULL +#0x01 U+0001 #START OF HEADING +#0x02 U+0002 #START OF TEXT +#0x03 U+0003 #END OF TEXT +#0x04 U+0004 #END OF TRANSMISSION +#0x05 U+0005 #ENQUIRY +#0x06 U+0006 #ACKNOWLEDGE +#0x07 U+0007 #BELL +#0x08 U+0008 #BACKSPACE +#0x09 U+0009 #HORIZONTAL TABULATION +#0x0a U+000a #LINE FEED +#0x0b U+000b #VERTICAL TABULATION +#0x0c U+000c #FORM FEED +#0x0d U+000d #CARRIAGE RETURN +#0x0e U+000e #SHIFT OUT +#0x0f U+000f #SHIFT IN +#0x10 U+0010 #DATA LINK ESCAPE +#0x11 U+0011 #DEVICE CONTROL ONE +#0x12 U+0012 #DEVICE CONTROL TWO +#0x13 U+0013 #DEVICE CONTROL THREE +#0x14 U+0014 #DEVICE CONTROL FOUR +#0x15 U+0015 #NEGATIVE ACKNOWLEDGE +#0x16 U+0016 #SYNCHRONOUS IDLE +#0x17 U+0017 #END OF TRANSMISSION BLOCK +#0x18 U+0018 #CANCEL +#0x19 U+0019 #END OF MEDIUM +#0x1a U+001a #SUBSTITUTE +#0x1b U+001b #ESCAPE +#0x1c U+001c #FILE SEPARATOR +#0x1d U+001d #GROUP SEPARATOR +#0x1e U+001e #RECORD SEPARATOR +#0x1f U+001f #UNIT SEPARATOR +0x20 U+0020 #SPACE +0x21 U+0021 #EXCLAMATION MARK +0x22 U+0022 #QUOTATION MARK +0x23 U+0023 #NUMBER SIGN +0x24 U+0024 #DOLLAR SIGN +0x25 U+0025 #PERCENT SIGN +0x26 U+0026 #AMPERSAND +0x27 U+0027 #APOSTROPHE +0x28 U+0028 #LEFT PARENTHESIS +0x29 U+0029 #RIGHT PARENTHESIS +0x2a U+002a #ASTERISK +0x2b U+002b #PLUS SIGN +0x2c U+002c #COMMA +0x2d U+002d #HYPHEN-MINUS +0x2e U+002e #FULL STOP +0x2f U+002f #SOLIDUS +0x30 U+0030 #DIGIT ZERO +0x31 U+0031 #DIGIT ONE +0x32 U+0032 #DIGIT TWO +0x33 U+0033 #DIGIT THREE +0x34 U+0034 #DIGIT FOUR +0x35 U+0035 #DIGIT FIVE +0x36 U+0036 #DIGIT SIX +0x37 U+0037 #DIGIT SEVEN +0x38 U+0038 #DIGIT EIGHT +0x39 U+0039 #DIGIT NINE +0x3a U+003a #COLON +0x3b U+003b #SEMICOLON +0x3c U+003c #LESS-THAN SIGN +0x3d U+003d #EQUALS SIGN +0x3e U+003e #GREATER-THAN SIGN +0x3f U+003f #QUESTION MARK +0x40 U+0040 #COMMERCIAL AT +0x41 U+0041 #LATIN CAPITAL LETTER A +0x42 U+0042 #LATIN CAPITAL LETTER B +0x43 U+0043 #LATIN CAPITAL LETTER C +0x44 U+0044 #LATIN CAPITAL LETTER D +0x45 U+0045 #LATIN CAPITAL LETTER E +0x46 U+0046 #LATIN CAPITAL LETTER F +0x47 U+0047 #LATIN CAPITAL LETTER G +0x48 U+0048 #LATIN CAPITAL LETTER H +0x49 U+0049 #LATIN CAPITAL LETTER I +0x4a U+004a #LATIN CAPITAL LETTER J +0x4b U+004b #LATIN CAPITAL LETTER K +0x4c U+004c #LATIN CAPITAL LETTER L +0x4d U+004d #LATIN CAPITAL LETTER M +0x4e U+004e #LATIN CAPITAL LETTER N +0x4f U+004f #LATIN CAPITAL LETTER O +0x50 U+0050 #LATIN CAPITAL LETTER P +0x51 U+0051 #LATIN CAPITAL LETTER Q +0x52 U+0052 #LATIN CAPITAL LETTER R +0x53 U+0053 #LATIN CAPITAL LETTER S +0x54 U+0054 #LATIN CAPITAL LETTER T +0x55 U+0055 #LATIN CAPITAL LETTER U +0x56 U+0056 #LATIN CAPITAL LETTER V +0x57 U+0057 #LATIN CAPITAL LETTER W +0x58 U+0058 #LATIN CAPITAL LETTER X +0x59 U+0059 #LATIN CAPITAL LETTER Y +0x5a U+005a #LATIN CAPITAL LETTER Z +0x5b U+005b #LEFT SQUARE BRACKET +0x5c U+005c #REVERSE SOLIDUS +0x5d U+005d #RIGHT SQUARE BRACKET +0x5e U+005e #CIRCUMFLEX ACCENT +0x5f U+005f #LOW LINE +0x60 U+0060 #GRAVE ACCENT +0x61 U+0061 #LATIN SMALL LETTER A +0x62 U+0062 #LATIN SMALL LETTER B +0x63 U+0063 #LATIN SMALL LETTER C +0x64 U+0064 #LATIN SMALL LETTER D +0x65 U+0065 #LATIN SMALL LETTER E +0x66 U+0066 #LATIN SMALL LETTER F +0x67 U+0067 #LATIN SMALL LETTER G +0x68 U+0068 #LATIN SMALL LETTER H +0x69 U+0069 #LATIN SMALL LETTER I +0x6a U+006a #LATIN SMALL LETTER J +0x6b U+006b #LATIN SMALL LETTER K +0x6c U+006c #LATIN SMALL LETTER L +0x6d U+006d #LATIN SMALL LETTER M +0x6e U+006e #LATIN SMALL LETTER N +0x6f U+006f #LATIN SMALL LETTER O +0x70 U+0070 #LATIN SMALL LETTER P +0x71 U+0071 #LATIN SMALL LETTER Q +0x72 U+0072 #LATIN SMALL LETTER R +0x73 U+0073 #LATIN SMALL LETTER S +0x74 U+0074 #LATIN SMALL LETTER T +0x75 U+0075 #LATIN SMALL LETTER U +0x76 U+0076 #LATIN SMALL LETTER V +0x77 U+0077 #LATIN SMALL LETTER W +0x78 U+0078 #LATIN SMALL LETTER X +0x79 U+0079 #LATIN SMALL LETTER Y +0x7a U+007a #LATIN SMALL LETTER Z +0x7b U+007b #LEFT CURLY BRACKET +0x7c U+007c #VERTICAL LINE +0x7d U+007d #RIGHT CURLY BRACKET +0x7e U+007e #TILDE +0x7f U+007f #DELETE 0x80 U+00c7 #LATIN CAPITAL LETTER C WITH CEDILLA 0x81 U+00fc #LATIN SMALL LETTER U WITH DIAERESIS 0x82 U+00e9 #LATIN SMALL LETTER E WITH ACUTE diff --git a/src/chrtrans/cp852_uni.tbl b/src/chrtrans/cp852_uni.tbl index 946b4996..0658d893 100644 --- a/src/chrtrans/cp852_uni.tbl +++ b/src/chrtrans/cp852_uni.tbl @@ -2,7 +2,7 @@ Mcp852 #Name as a Display Charset (used on Options screen) -OEastern European (cp852) +ODosLatin2 (cp852) # # Name: cp852_DOSLatin2 to Unicode table @@ -21,136 +21,260 @@ OEastern European (cp852) # # The entries are in cp852_DOSLatin2 order # -################## - -0x20-0x7e idem -# -0x80 U+00c7 #LATIN CAPITAL LETTER C WITH CEDILLA -0x81 U+00fc #LATIN SMALL LETTER U WITH DIAERESIS -0x82 U+00e9 #LATIN SMALL LETTER E WITH ACUTE -0x83 U+00e2 #LATIN SMALL LETTER A WITH CIRCUMFLEX -0x84 U+00e4 #LATIN SMALL LETTER A WITH DIAERESIS -0x85 U+016f #LATIN SMALL LETTER U WITH RING ABOVE -0x86 U+0107 #LATIN SMALL LETTER C WITH ACUTE -0x87 U+00e7 #LATIN SMALL LETTER C WITH CEDILLA -0x88 U+0142 #LATIN SMALL LETTER L WITH STROKE -0x89 U+00eb #LATIN SMALL LETTER E WITH DIAERESIS -0x8a U+0150 #LATIN CAPITAL LETTER O WITH DOUBLE ACUTE -0x8b U+0151 #LATIN SMALL LETTER O WITH DOUBLE ACUTE -0x8c U+00ee #LATIN SMALL LETTER I WITH CIRCUMFLEX -0x8d U+0179 #LATIN CAPITAL LETTER Z WITH ACUTE -0x8e U+00c4 #LATIN CAPITAL LETTER A WITH DIAERESIS -0x8f U+0106 #LATIN CAPITAL LETTER C WITH ACUTE -0x90 U+00c9 #LATIN CAPITAL LETTER E WITH ACUTE -0x91 U+0139 #LATIN CAPITAL LETTER L WITH ACUTE -0x92 U+013a #LATIN SMALL LETTER L WITH ACUTE -0x93 U+00f4 #LATIN SMALL LETTER O WITH CIRCUMFLEX -0x94 U+00f6 #LATIN SMALL LETTER O WITH DIAERESIS -0x95 U+013d #LATIN CAPITAL LETTER L WITH CARON -0x96 U+013e #LATIN SMALL LETTER L WITH CARON -0x97 U+015a #LATIN CAPITAL LETTER S WITH ACUTE -0x98 U+015b #LATIN SMALL LETTER S WITH ACUTE -0x99 U+00d6 #LATIN CAPITAL LETTER O WITH DIAERESIS -0x9a U+00dc #LATIN CAPITAL LETTER U WITH DIAERESIS -0x9b U+0164 #LATIN CAPITAL LETTER T WITH CARON -0x9c U+0165 #LATIN SMALL LETTER T WITH CARON -0x9d U+0141 #LATIN CAPITAL LETTER L WITH STROKE -0x9e U+00d7 #MULTIPLICATION SIGN -0x9f U+010d #LATIN SMALL LETTER C WITH CARON -0xa0 U+00e1 #LATIN SMALL LETTER A WITH ACUTE -0xa1 U+00ed #LATIN SMALL LETTER I WITH ACUTE -0xa2 U+00f3 #LATIN SMALL LETTER O WITH ACUTE -0xa3 U+00fa #LATIN SMALL LETTER U WITH ACUTE -0xa4 U+0104 #LATIN CAPITAL LETTER A WITH OGONEK -0xa5 U+0105 #LATIN SMALL LETTER A WITH OGONEK -0xa6 U+017d #LATIN CAPITAL LETTER Z WITH CARON -0xa7 U+017e #LATIN SMALL LETTER Z WITH CARON -0xa8 U+0118 #LATIN CAPITAL LETTER E WITH OGONEK -0xa9 U+0119 #LATIN SMALL LETTER E WITH OGONEK -0xaa U+00ac #NOT SIGN -0xab U+017a #LATIN SMALL LETTER Z WITH ACUTE -0xac U+010c #LATIN CAPITAL LETTER C WITH CARON -0xad U+015f #LATIN SMALL LETTER S WITH CEDILLA -0xae U+00ab #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK -0xaf U+00bb #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -0xb0 U+2591 #LIGHT SHADE -0xb1 U+2592 #MEDIUM SHADE -0xb2 U+2593 #DARK SHADE -0xb3 U+2502 #BOX DRAWINGS LIGHT VERTICAL -0xb4 U+2524 #BOX DRAWINGS LIGHT VERTICAL AND LEFT -0xb5 U+00c1 #LATIN CAPITAL LETTER A WITH ACUTE -0xb6 U+00c2 #LATIN CAPITAL LETTER A WITH CIRCUMFLEX -0xb7 U+011a #LATIN CAPITAL LETTER E WITH CARON -0xb8 U+015e #LATIN CAPITAL LETTER S WITH CEDILLA -0xb9 U+2563 #BOX DRAWINGS DOUBLE VERTICAL AND LEFT -0xba U+2551 #BOX DRAWINGS DOUBLE VERTICAL -0xbb U+2557 #BOX DRAWINGS DOUBLE DOWN AND LEFT -0xbc U+255d #BOX DRAWINGS DOUBLE UP AND LEFT -0xbd U+017b #LATIN CAPITAL LETTER Z WITH DOT ABOVE -0xbe U+017c #LATIN SMALL LETTER Z WITH DOT ABOVE -0xbf U+2510 #BOX DRAWINGS LIGHT DOWN AND LEFT -0xc0 U+2514 #BOX DRAWINGS LIGHT UP AND RIGHT -0xc1 U+2534 #BOX DRAWINGS LIGHT UP AND HORIZONTAL -0xc2 U+252c #BOX DRAWINGS LIGHT DOWN AND HORIZONTAL -0xc3 U+251c #BOX DRAWINGS LIGHT VERTICAL AND RIGHT -0xc4 U+2500 #BOX DRAWINGS LIGHT HORIZONTAL -0xc5 U+253c #BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL -0xc6 U+0102 #LATIN CAPITAL LETTER A WITH BREVE -0xc7 U+0103 #LATIN SMALL LETTER A WITH BREVE -0xc8 U+255a #BOX DRAWINGS DOUBLE UP AND RIGHT -0xc9 U+2554 #BOX DRAWINGS DOUBLE DOWN AND RIGHT -0xca U+2569 #BOX DRAWINGS DOUBLE UP AND HORIZONTAL -0xcb U+2566 #BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL -0xcc U+2560 #BOX DRAWINGS DOUBLE VERTICAL AND RIGHT -0xcd U+2550 #BOX DRAWINGS DOUBLE HORIZONTAL -0xce U+256c #BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL -0xcf U+00a4 #CURRENCY SIGN -0xd0 U+0111 #LATIN SMALL LETTER D WITH STROKE -0xd1 U+0110 #LATIN CAPITAL LETTER D WITH STROKE -0xd2 U+010e #LATIN CAPITAL LETTER D WITH CARON -0xd3 U+00cb #LATIN CAPITAL LETTER E WITH DIAERESIS -0xd4 U+010f #LATIN SMALL LETTER D WITH CARON -0xd5 U+0147 #LATIN CAPITAL LETTER N WITH CARON -0xd6 U+00cd #LATIN CAPITAL LETTER I WITH ACUTE -0xd7 U+00ce #LATIN CAPITAL LETTER I WITH CIRCUMFLEX -0xd8 U+011b #LATIN SMALL LETTER E WITH CARON -0xd9 U+2518 #BOX DRAWINGS LIGHT UP AND LEFT -0xda U+250c #BOX DRAWINGS LIGHT DOWN AND RIGHT -0xdb U+2588 #FULL BLOCK -0xdc U+2584 #LOWER HALF BLOCK -0xdd U+0162 #LATIN CAPITAL LETTER T WITH CEDILLA -0xde U+016e #LATIN CAPITAL LETTER U WITH RING ABOVE -0xdf U+2580 #UPPER HALF BLOCK -0xe0 U+00d3 #LATIN CAPITAL LETTER O WITH ACUTE -0xe1 U+00df #LATIN SMALL LETTER SHARP S -0xe2 U+00d4 #LATIN CAPITAL LETTER O WITH CIRCUMFLEX -0xe3 U+0143 #LATIN CAPITAL LETTER N WITH ACUTE -0xe4 U+0144 #LATIN SMALL LETTER N WITH ACUTE -0xe5 U+0148 #LATIN SMALL LETTER N WITH CARON -0xe6 U+0160 #LATIN CAPITAL LETTER S WITH CARON -0xe7 U+0161 #LATIN SMALL LETTER S WITH CARON -0xe8 U+0154 #LATIN CAPITAL LETTER R WITH ACUTE -0xe9 U+00da #LATIN CAPITAL LETTER U WITH ACUTE -0xea U+0155 #LATIN SMALL LETTER R WITH ACUTE -0xeb U+0170 #LATIN CAPITAL LETTER U WITH DOUBLE ACUTE -0xec U+00fd #LATIN SMALL LETTER Y WITH ACUTE -0xed U+00dd #LATIN CAPITAL LETTER Y WITH ACUTE -0xee U+0163 #LATIN SMALL LETTER T WITH CEDILLA -0xef U+00b4 #ACUTE ACCENT -0xf0 U+00ad #SOFT HYPHEN -0xf1 U+02dd #DOUBLE ACUTE ACCENT -0xf2 U+02db #OGONEK -0xf3 U+02c7 #CARON -0xf4 U+02d8 #BREVE -0xf5 U+00a7 #SECTION SIGN -0xf6 U+00f7 #DIVISION SIGN -0xf7 U+00b8 #CEDILLA -0xf8 U+00b0 #DEGREE SIGN -0xf9 U+00a8 #DIAERESIS -0xfa U+02d9 #DOT ABOVE -0xfb U+0171 #LATIN SMALL LETTER U WITH DOUBLE ACUTE -0xfc U+0158 #LATIN CAPITAL LETTER R WITH CARON -0xfd U+0159 #LATIN SMALL LETTER R WITH CARON -0xfe U+25a0 #BLACK SQUARE -0xff U+00a0 #NO-BREAK SPACE +#0x00 U+0000 #NULL +#0x01 U+0001 #START OF HEADING +#0x02 U+0002 #START OF TEXT +#0x03 U+0003 #END OF TEXT +#0x04 U+0004 #END OF TRANSMISSION +#0x05 U+0005 #ENQUIRY +#0x06 U+0006 #ACKNOWLEDGE +#0x07 U+0007 #BELL +#0x08 U+0008 #BACKSPACE +#0x09 U+0009 #HORIZONTAL TABULATION +#0x0a U+000a #LINE FEED +#0x0b U+000b #VERTICAL TABULATION +#0x0c U+000c #FORM FEED +#0x0d U+000d #CARRIAGE RETURN +#0x0e U+000e #SHIFT OUT +#0x0f U+000f #SHIFT IN +#0x10 U+0010 #DATA LINK ESCAPE +#0x11 U+0011 #DEVICE CONTROL ONE +#0x12 U+0012 #DEVICE CONTROL TWO +#0x13 U+0013 #DEVICE CONTROL THREE +#0x14 U+0014 #DEVICE CONTROL FOUR +#0x15 U+0015 #NEGATIVE ACKNOWLEDGE +#0x16 U+0016 #SYNCHRONOUS IDLE +#0x17 U+0017 #END OF TRANSMISSION BLOCK +#0x18 U+0018 #CANCEL +#0x19 U+0019 #END OF MEDIUM +#0x1a U+001a #SUBSTITUTE +#0x1b U+001b #ESCAPE +#0x1c U+001c #FILE SEPARATOR +#0x1d U+001d #GROUP SEPARATOR +#0x1e U+001e #RECORD SEPARATOR +#0x1f U+001f #UNIT SEPARATOR +0x20 U+0020 #SPACE +0x21 U+0021 #EXCLAMATION MARK +0x22 U+0022 #QUOTATION MARK +0x23 U+0023 #NUMBER SIGN +0x24 U+0024 #DOLLAR SIGN +0x25 U+0025 #PERCENT SIGN +0x26 U+0026 #AMPERSAND +0x27 U+0027 #APOSTROPHE +0x28 U+0028 #LEFT PARENTHESIS +0x29 U+0029 #RIGHT PARENTHESIS +0x2a U+002a #ASTERISK +0x2b U+002b #PLUS SIGN +0x2c U+002c #COMMA +0x2d U+002d #HYPHEN-MINUS +0x2e U+002e #FULL STOP +0x2f U+002f #SOLIDUS +0x30 U+0030 #DIGIT ZERO +0x31 U+0031 #DIGIT ONE +0x32 U+0032 #DIGIT TWO +0x33 U+0033 #DIGIT THREE +0x34 U+0034 #DIGIT FOUR +0x35 U+0035 #DIGIT FIVE +0x36 U+0036 #DIGIT SIX +0x37 U+0037 #DIGIT SEVEN +0x38 U+0038 #DIGIT EIGHT +0x39 U+0039 #DIGIT NINE +0x3a U+003a #COLON +0x3b U+003b #SEMICOLON +0x3c U+003c #LESS-THAN SIGN +0x3d U+003d #EQUALS SIGN +0x3e U+003e #GREATER-THAN SIGN +0x3f U+003f #QUESTION MARK +0x40 U+0040 #COMMERCIAL AT +0x41 U+0041 #LATIN CAPITAL LETTER A +0x42 U+0042 #LATIN CAPITAL LETTER B +0x43 U+0043 #LATIN CAPITAL LETTER C +0x44 U+0044 #LATIN CAPITAL LETTER D +0x45 U+0045 #LATIN CAPITAL LETTER E +0x46 U+0046 #LATIN CAPITAL LETTER F +0x47 U+0047 #LATIN CAPITAL LETTER G +0x48 U+0048 #LATIN CAPITAL LETTER H +0x49 U+0049 #LATIN CAPITAL LETTER I +0x4a U+004a #LATIN CAPITAL LETTER J +0x4b U+004b #LATIN CAPITAL LETTER K +0x4c U+004c #LATIN CAPITAL LETTER L +0x4d U+004d #LATIN CAPITAL LETTER M +0x4e U+004e #LATIN CAPITAL LETTER N +0x4f U+004f #LATIN CAPITAL LETTER O +0x50 U+0050 #LATIN CAPITAL LETTER P +0x51 U+0051 #LATIN CAPITAL LETTER Q +0x52 U+0052 #LATIN CAPITAL LETTER R +0x53 U+0053 #LATIN CAPITAL LETTER S +0x54 U+0054 #LATIN CAPITAL LETTER T +0x55 U+0055 #LATIN CAPITAL LETTER U +0x56 U+0056 #LATIN CAPITAL LETTER V +0x57 U+0057 #LATIN CAPITAL LETTER W +0x58 U+0058 #LATIN CAPITAL LETTER X +0x59 U+0059 #LATIN CAPITAL LETTER Y +0x5a U+005a #LATIN CAPITAL LETTER Z +0x5b U+005b #LEFT SQUARE BRACKET +0x5c U+005c #REVERSE SOLIDUS +0x5d U+005d #RIGHT SQUARE BRACKET +0x5e U+005e #CIRCUMFLEX ACCENT +0x5f U+005f #LOW LINE +0x60 U+0060 #GRAVE ACCENT +0x61 U+0061 #LATIN SMALL LETTER A +0x62 U+0062 #LATIN SMALL LETTER B +0x63 U+0063 #LATIN SMALL LETTER C +0x64 U+0064 #LATIN SMALL LETTER D +0x65 U+0065 #LATIN SMALL LETTER E +0x66 U+0066 #LATIN SMALL LETTER F +0x67 U+0067 #LATIN SMALL LETTER G +0x68 U+0068 #LATIN SMALL LETTER H +0x69 U+0069 #LATIN SMALL LETTER I +0x6a U+006a #LATIN SMALL LETTER J +0x6b U+006b #LATIN SMALL LETTER K +0x6c U+006c #LATIN SMALL LETTER L +0x6d U+006d #LATIN SMALL LETTER M +0x6e U+006e #LATIN SMALL LETTER N +0x6f U+006f #LATIN SMALL LETTER O +0x70 U+0070 #LATIN SMALL LETTER P +0x71 U+0071 #LATIN SMALL LETTER Q +0x72 U+0072 #LATIN SMALL LETTER R +0x73 U+0073 #LATIN SMALL LETTER S +0x74 U+0074 #LATIN SMALL LETTER T +0x75 U+0075 #LATIN SMALL LETTER U +0x76 U+0076 #LATIN SMALL LETTER V +0x77 U+0077 #LATIN SMALL LETTER W +0x78 U+0078 #LATIN SMALL LETTER X +0x79 U+0079 #LATIN SMALL LETTER Y +0x7a U+007a #LATIN SMALL LETTER Z +0x7b U+007b #LEFT CURLY BRACKET +0x7c U+007c #VERTICAL LINE +0x7d U+007d #RIGHT CURLY BRACKET +0x7e U+007e #TILDE +#0x7f U+007f #DELETE +0x80 U+00c7 #LATIN CAPITAL LETTER C WITH CEDILLA +0x81 U+00fc #LATIN SMALL LETTER U WITH DIAERESIS +0x82 U+00e9 #LATIN SMALL LETTER E WITH ACUTE +0x83 U+00e2 #LATIN SMALL LETTER A WITH CIRCUMFLEX +0x84 U+00e4 #LATIN SMALL LETTER A WITH DIAERESIS +0x85 U+016f #LATIN SMALL LETTER U WITH RING ABOVE +0x86 U+0107 #LATIN SMALL LETTER C WITH ACUTE +0x87 U+00e7 #LATIN SMALL LETTER C WITH CEDILLA +0x88 U+0142 #LATIN SMALL LETTER L WITH STROKE +0x89 U+00eb #LATIN SMALL LETTER E WITH DIAERESIS +0x8a U+0150 #LATIN CAPITAL LETTER O WITH DOUBLE ACUTE +0x8b U+0151 #LATIN SMALL LETTER O WITH DOUBLE ACUTE +0x8c U+00ee #LATIN SMALL LETTER I WITH CIRCUMFLEX +0x8d U+0179 #LATIN CAPITAL LETTER Z WITH ACUTE +0x8e U+00c4 #LATIN CAPITAL LETTER A WITH DIAERESIS +0x8f U+0106 #LATIN CAPITAL LETTER C WITH ACUTE +0x90 U+00c9 #LATIN CAPITAL LETTER E WITH ACUTE +0x91 U+0139 #LATIN CAPITAL LETTER L WITH ACUTE +0x92 U+013a #LATIN SMALL LETTER L WITH ACUTE +0x93 U+00f4 #LATIN SMALL LETTER O WITH CIRCUMFLEX +0x94 U+00f6 #LATIN SMALL LETTER O WITH DIAERESIS +0x95 U+013d #LATIN CAPITAL LETTER L WITH CARON +0x96 U+013e #LATIN SMALL LETTER L WITH CARON +0x97 U+015a #LATIN CAPITAL LETTER S WITH ACUTE +0x98 U+015b #LATIN SMALL LETTER S WITH ACUTE +0x99 U+00d6 #LATIN CAPITAL LETTER O WITH DIAERESIS +0x9a U+00dc #LATIN CAPITAL LETTER U WITH DIAERESIS +0x9b U+0164 #LATIN CAPITAL LETTER T WITH CARON +0x9c U+0165 #LATIN SMALL LETTER T WITH CARON +0x9d U+0141 #LATIN CAPITAL LETTER L WITH STROKE +0x9e U+00d7 #MULTIPLICATION SIGN +0x9f U+010d #LATIN SMALL LETTER C WITH CARON +0xa0 U+00e1 #LATIN SMALL LETTER A WITH ACUTE +0xa1 U+00ed #LATIN SMALL LETTER I WITH ACUTE +0xa2 U+00f3 #LATIN SMALL LETTER O WITH ACUTE +0xa3 U+00fa #LATIN SMALL LETTER U WITH ACUTE +0xa4 U+0104 #LATIN CAPITAL LETTER A WITH OGONEK +0xa5 U+0105 #LATIN SMALL LETTER A WITH OGONEK +0xa6 U+017d #LATIN CAPITAL LETTER Z WITH CARON +0xa7 U+017e #LATIN SMALL LETTER Z WITH CARON +0xa8 U+0118 #LATIN CAPITAL LETTER E WITH OGONEK +0xa9 U+0119 #LATIN SMALL LETTER E WITH OGONEK +0xaa U+00ac #NOT SIGN +0xab U+017a #LATIN SMALL LETTER Z WITH ACUTE +0xac U+010c #LATIN CAPITAL LETTER C WITH CARON +0xad U+015f #LATIN SMALL LETTER S WITH CEDILLA +0xae U+00ab #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +0xaf U+00bb #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +0xb0 U+2591 #LIGHT SHADE +0xb1 U+2592 #MEDIUM SHADE +0xb2 U+2593 #DARK SHADE +0xb3 U+2502 #BOX DRAWINGS LIGHT VERTICAL +0xb4 U+2524 #BOX DRAWINGS LIGHT VERTICAL AND LEFT +0xb5 U+00c1 #LATIN CAPITAL LETTER A WITH ACUTE +0xb6 U+00c2 #LATIN CAPITAL LETTER A WITH CIRCUMFLEX +0xb7 U+011a #LATIN CAPITAL LETTER E WITH CARON +0xb8 U+015e #LATIN CAPITAL LETTER S WITH CEDILLA +0xb9 U+2563 #BOX DRAWINGS DOUBLE VERTICAL AND LEFT +0xba U+2551 #BOX DRAWINGS DOUBLE VERTICAL +0xbb U+2557 #BOX DRAWINGS DOUBLE DOWN AND LEFT +0xbc U+255d #BOX DRAWINGS DOUBLE UP AND LEFT +0xbd U+017b #LATIN CAPITAL LETTER Z WITH DOT ABOVE +0xbe U+017c #LATIN SMALL LETTER Z WITH DOT ABOVE +0xbf U+2510 #BOX DRAWINGS LIGHT DOWN AND LEFT +0xc0 U+2514 #BOX DRAWINGS LIGHT UP AND RIGHT +0xc1 U+2534 #BOX DRAWINGS LIGHT UP AND HORIZONTAL +0xc2 U+252c #BOX DRAWINGS LIGHT DOWN AND HORIZONTAL +0xc3 U+251c #BOX DRAWINGS LIGHT VERTICAL AND RIGHT +0xc4 U+2500 #BOX DRAWINGS LIGHT HORIZONTAL +0xc5 U+253c #BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL +0xc6 U+0102 #LATIN CAPITAL LETTER A WITH BREVE +0xc7 U+0103 #LATIN SMALL LETTER A WITH BREVE +0xc8 U+255a #BOX DRAWINGS DOUBLE UP AND RIGHT +0xc9 U+2554 #BOX DRAWINGS DOUBLE DOWN AND RIGHT +0xca U+2569 #BOX DRAWINGS DOUBLE UP AND HORIZONTAL +0xcb U+2566 #BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL +0xcc U+2560 #BOX DRAWINGS DOUBLE VERTICAL AND RIGHT +0xcd U+2550 #BOX DRAWINGS DOUBLE HORIZONTAL +0xce U+256c #BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL +0xcf U+00a4 #CURRENCY SIGN +0xd0 U+0111 #LATIN SMALL LETTER D WITH STROKE +0xd1 U+0110 #LATIN CAPITAL LETTER D WITH STROKE +0xd2 U+010e #LATIN CAPITAL LETTER D WITH CARON +0xd3 U+00cb #LATIN CAPITAL LETTER E WITH DIAERESIS +0xd4 U+010f #LATIN SMALL LETTER D WITH CARON +0xd5 U+0147 #LATIN CAPITAL LETTER N WITH CARON +0xd6 U+00cd #LATIN CAPITAL LETTER I WITH ACUTE +0xd7 U+00ce #LATIN CAPITAL LETTER I WITH CIRCUMFLEX +0xd8 U+011b #LATIN SMALL LETTER E WITH CARON +0xd9 U+2518 #BOX DRAWINGS LIGHT UP AND LEFT +0xda U+250c #BOX DRAWINGS LIGHT DOWN AND RIGHT +0xdb U+2588 #FULL BLOCK +0xdc U+2584 #LOWER HALF BLOCK +0xdd U+0162 #LATIN CAPITAL LETTER T WITH CEDILLA +0xde U+016e #LATIN CAPITAL LETTER U WITH RING ABOVE +0xdf U+2580 #UPPER HALF BLOCK +0xe0 U+00d3 #LATIN CAPITAL LETTER O WITH ACUTE +0xe1 U+00df #LATIN SMALL LETTER SHARP S +0xe2 U+00d4 #LATIN CAPITAL LETTER O WITH CIRCUMFLEX +0xe3 U+0143 #LATIN CAPITAL LETTER N WITH ACUTE +0xe4 U+0144 #LATIN SMALL LETTER N WITH ACUTE +0xe5 U+0148 #LATIN SMALL LETTER N WITH CARON +0xe6 U+0160 #LATIN CAPITAL LETTER S WITH CARON +0xe7 U+0161 #LATIN SMALL LETTER S WITH CARON +0xe8 U+0154 #LATIN CAPITAL LETTER R WITH ACUTE +0xe9 U+00da #LATIN CAPITAL LETTER U WITH ACUTE +0xea U+0155 #LATIN SMALL LETTER R WITH ACUTE +0xeb U+0170 #LATIN CAPITAL LETTER U WITH DOUBLE ACUTE +0xec U+00fd #LATIN SMALL LETTER Y WITH ACUTE +0xed U+00dd #LATIN CAPITAL LETTER Y WITH ACUTE +0xee U+0163 #LATIN SMALL LETTER T WITH CEDILLA +0xef U+00b4 #ACUTE ACCENT +0xf0 U+00ad #SOFT HYPHEN +0xf1 U+02dd #DOUBLE ACUTE ACCENT +0xf2 U+02db #OGONEK +0xf3 U+02c7 #CARON +0xf4 U+02d8 #BREVE +0xf5 U+00a7 #SECTION SIGN +0xf6 U+00f7 #DIVISION SIGN +0xf7 U+00b8 #CEDILLA +0xf8 U+00b0 #DEGREE SIGN +0xf9 U+00a8 #DIAERESIS +0xfa U+02d9 #DOT ABOVE +0xfb U+0171 #LATIN SMALL LETTER U WITH DOUBLE ACUTE +0xfc U+0158 #LATIN CAPITAL LETTER R WITH CARON +0xfd U+0159 #LATIN SMALL LETTER R WITH CARON +0xfe U+25a0 #BLACK SQUARE +0xff U+00a0 #NO-BREAK SPACE diff --git a/src/chrtrans/cp862_uni.tbl b/src/chrtrans/cp862_uni.tbl index 60d9692e..3d21c138 100644 --- a/src/chrtrans/cp862_uni.tbl +++ b/src/chrtrans/cp862_uni.tbl @@ -2,7 +2,7 @@ Mcp862 #Name as a Display Charset (used on Options screen). -OHebrew (cp862) +ODosHebrew (cp862) # Name: cp862_DOSHebrew to Unicode table # Unicode version: 2.0 diff --git a/src/chrtrans/cp864_uni.tbl b/src/chrtrans/cp864_uni.tbl index 8411f8b7..d6e92431 100644 --- a/src/chrtrans/cp864_uni.tbl +++ b/src/chrtrans/cp864_uni.tbl @@ -2,7 +2,7 @@ Mcp864 #Name as a Display Charset (used on Options screen). -OArabic (cp864) +ODosArabic (cp864) # Name: cp864_DOSArabic to Unicode table # Unicode version: 2.0 diff --git a/src/chrtrans/cp866_uni.tbl b/src/chrtrans/cp866_uni.tbl index 55ce0718..2d02ce1b 100644 --- a/src/chrtrans/cp866_uni.tbl +++ b/src/chrtrans/cp866_uni.tbl @@ -3,7 +3,7 @@ Mcp866 #Name as a Display Charset (used on Options screen) -OCyrillic (cp866) +ODosCyrillic (cp866) # # Name: cp866_DOSCyrillicRussian to Unicode table # Unicode version: 2.0 diff --git a/src/chrtrans/cp869_uni.tbl b/src/chrtrans/cp869_uni.tbl index 1f418728..21cdeb95 100644 --- a/src/chrtrans/cp869_uni.tbl +++ b/src/chrtrans/cp869_uni.tbl @@ -2,7 +2,7 @@ Mcp869 #Name as a Display Charset (used on Options screen) -OGreek2 (cp869) +ODosGreek2 (cp869) # Name: cp869_DOSGreek2 to Unicode table # Unicode version: 2.0 diff --git a/src/chrtrans/def7_uni.tbl b/src/chrtrans/def7_uni.tbl index bd6b1b1c..66a63f76 100644 --- a/src/chrtrans/def7_uni.tbl +++ b/src/chrtrans/def7_uni.tbl @@ -1350,13 +1350,13 @@ U+208c:_= U+208d:( U+208e:) # Old euro currency sign glyph: -#U+20A0:CE +U+20A0:CE U+20a3:Ff U+20a4:Li U+20a7:Pt U+20a9:W= -# New euro currency sign glyph: -U+20AC:EUR +# New euro currency sign glyph ? +# U+20AC:EUR U+2103:oC U+2105:c/o U+2109:oF @@ -1754,7 +1754,6 @@ U+266e:Mx U+266f:# 0x58 U+2713 U+2717 # check marks -> x U+2720:-X -# CJK area: 0x20 U+3000 # ideographic space U+3001:,_ U+3002:._ @@ -2015,17 +2014,6 @@ U+3229:10c U+327f:KSC U+33c2:am U+33d8:pm -# -# -#There are four special ranges of characters that are represented only by -#their start and end characters <...> -# -# The CJK Ideographs Area (U+4E00 - U+9FFF) -# The Hangul Syllables Area (U+AC00 - U+D7A3) -# The Surrogates Area (U+D800 - U+DFFF) -# The Private Use Area (U+E000 - U+F8FF) -# -# U+fb00:ff U+fb01:fi U+fb02:fl @@ -2184,12 +2172,12 @@ U+001d:GS U+001e:RS U+001f:US U+007f:DT -# Most of these characters (80-9F) may be inflicted on us +U+0080:PA +U+0081:HO +# Most of these characters (82-9F) may be inflicted on us # by MS FrontPages which uses Unicode notation such as ™ # but there are no assigned letters in Unicode 128-159 range. # It is assumed in the code that those codepoints are from windows-1252. -#U+0080:PA -#U+0081:HO #U+0082:BH #U+0083:NH #U+0084:IN @@ -2201,10 +2189,10 @@ U+007f:DT #U+008a:VS #U+008b:PD #U+008c:PU -#U+008d:RI -#U+008e:SS2 -#U+008f:SS3 -#U+0090:DCS +U+008d:RI +U+008e:SS2 +U+008f:SS3 +U+0090:DCS #U+0091:P1 #U+0092:P2 #U+0093:TS @@ -2214,13 +2202,15 @@ U+007f:DT #U+0097:EG #U+0098:SS #U+0099:GC -#U+009a:SC +U+009a:SC #U+009b:CSI #U+009c:ST #U+009d:OC #U+009e:PM #U+009f:AC +# Characters in Private Use Area (e000-f8ff) do not have ussigned numbers. + # Let's try to show a question mark for character that cannot # be shown. U+fffd is used for invalid characters. # It works, but let's stick with UHHH representatiion. - FM diff --git a/src/chrtrans/iso01_uni.tbl b/src/chrtrans/iso01_uni.tbl index 5b697e02..f792164d 100644 --- a/src/chrtrans/iso01_uni.tbl +++ b/src/chrtrans/iso01_uni.tbl @@ -8,7 +8,7 @@ D0 Miso-8859-1 #Name as a Display Charset (used on Options screen) -OWestern (ISO-8859-1) +OISO Latin 1 # # Name: ISO 8859-1 (1987) to Unicode diff --git a/src/chrtrans/iso02_uni.tbl b/src/chrtrans/iso02_uni.tbl index 7fa0df92..af97bc55 100644 --- a/src/chrtrans/iso02_uni.tbl +++ b/src/chrtrans/iso02_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-2 #Name as a Display Charset (used on Options screen) -OEastern European (ISO-8859-2) +OISO Latin 2 # # Name: ISO 8859-2 (1987) to Unicode diff --git a/src/chrtrans/iso03_uni.tbl b/src/chrtrans/iso03_uni.tbl index a3c1f07a..bb8cd90f 100644 --- a/src/chrtrans/iso03_uni.tbl +++ b/src/chrtrans/iso03_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-3 #Name as a Display Charset (used on Options screen) -OLatin 3 (ISO-8859-3) +OISO Latin 3 # # Name: ISO 8859-3 (1988) to Unicode diff --git a/src/chrtrans/iso04_uni.tbl b/src/chrtrans/iso04_uni.tbl index 29be0be5..3f54afda 100644 --- a/src/chrtrans/iso04_uni.tbl +++ b/src/chrtrans/iso04_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-4 #Name as a Display Charset (used on Options screen) -OLatin 4 (ISO-8859-4) +OISO Latin 4 # # Name: ISO 8859-4 (1988) to Unicode diff --git a/src/chrtrans/iso05_uni.tbl b/src/chrtrans/iso05_uni.tbl index a715b64f..40cdc24d 100644 --- a/src/chrtrans/iso05_uni.tbl +++ b/src/chrtrans/iso05_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-5 #Name as a Display Charset (used on Options screen) -OCyrillic (ISO-8859-5) +OISO 8859-5 Cyrillic # # Name: ISO 8859-5 (1988) to Unicode diff --git a/src/chrtrans/iso06_uni.tbl b/src/chrtrans/iso06_uni.tbl index 549b592d..c9418864 100644 --- a/src/chrtrans/iso06_uni.tbl +++ b/src/chrtrans/iso06_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-6 #Name as a Display Charset (used on Options screen). -OArabic (ISO-8859-6) +OISO 8859-6 Arabic # # Name: ISO 8859-6 (1987) to Unicode diff --git a/src/chrtrans/iso07_uni.tbl b/src/chrtrans/iso07_uni.tbl index dffca758..368209bf 100644 --- a/src/chrtrans/iso07_uni.tbl +++ b/src/chrtrans/iso07_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-7 #Name as a Display Charset (used on Options screen) -OGreek (ISO-8859-7) +OISO 8859-7 Greek # # Name: ISO 8859-7 (1987) to Unicode diff --git a/src/chrtrans/iso08_uni.tbl b/src/chrtrans/iso08_uni.tbl index 050be29d..4d83f5c4 100644 --- a/src/chrtrans/iso08_uni.tbl +++ b/src/chrtrans/iso08_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-8 #Name as a Display Charset (used on Options screen). -OHebrew (ISO-8859-8) +OISO 8859-8 Hebrew # # Name: ISO 8859-8 (1988) to Unicode diff --git a/src/chrtrans/iso09_uni.tbl b/src/chrtrans/iso09_uni.tbl index 5abe799f..1b204835 100644 --- a/src/chrtrans/iso09_uni.tbl +++ b/src/chrtrans/iso09_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-9 #Name as a Display Charset (used on Options screen) -OTurkish (ISO-8859-9) +OISO 8859-9 (Latin 5) # # Name: ISO 8859-9 (1989) to Unicode diff --git a/src/chrtrans/iso10_uni.tbl b/src/chrtrans/iso10_uni.tbl index ab8128f0..be3c02cd 100644 --- a/src/chrtrans/iso10_uni.tbl +++ b/src/chrtrans/iso10_uni.tbl @@ -10,7 +10,7 @@ D0 Miso-8859-10 #Name as a Display Charset (used on Options screen) -OISO-8859-10 +OISO 8859-10 0x20-0x7e idem #0x7f U+2302 diff --git a/src/chrtrans/koi8r_uni.tbl b/src/chrtrans/koi8r_uni.tbl index 69eef3c2..09e8743c 100644 --- a/src/chrtrans/koi8r_uni.tbl +++ b/src/chrtrans/koi8r_uni.tbl @@ -1,5 +1,5 @@ # Options screen name for this character set -OCyrillic (KOI8-R) +OKOI8-R Cyrillic # MIME name for this charset Mkoi8-r diff --git a/src/chrtrans/makefile.dos b/src/chrtrans/makefile.dos index 57c45dfc..6871b87a 100644 --- a/src/chrtrans/makefile.dos +++ b/src/chrtrans/makefile.dos @@ -13,9 +13,7 @@ CFLAGS = $(MCFLAGS) CC = gcc MCFLAGS = -O3 -DDOSPATH -DNO_TTYTYP \ --I. \ --I../../WWW/library/implement \ --I../../djgpp/tcplib/include \ +-I../../WWW/library/implement -I../../djgpp/tcplib/include \ -I../../djgpp/tcplib/include/tcp .SUFFIXES: .tbl @@ -83,7 +81,6 @@ cp1256_uni.h: cp1256_uni.tbl makeuctb.exe cp1257_uni.h: cp1257_uni.tbl makeuctb.exe cp437_uni.h: cp437_uni.tbl makeuctb.exe cp737_uni.h: cp737_uni.tbl makeuctb.exe -cp775_uni.h: cp775_uni.tbl makeuctb.exe cp850_uni.h: cp850_uni.tbl makeuctb.exe cp852_uni.h: cp852_uni.tbl makeuctb.exe cp862_uni.h: cp862_uni.tbl makeuctb.exe diff --git a/src/chrtrans/makefile.in b/src/chrtrans/makefile.in index 512b003d..7cb02699 100644 --- a/src/chrtrans/makefile.in +++ b/src/chrtrans/makefile.in @@ -107,7 +107,6 @@ cp1256_uni.h: $(srcdir)/cp1256_uni.tbl makeuctb$x cp1257_uni.h: $(srcdir)/cp1257_uni.tbl makeuctb$x cp437_uni.h: $(srcdir)/cp437_uni.tbl makeuctb$x cp737_uni.h: $(srcdir)/cp737_uni.tbl makeuctb$x -cp775_uni.h: $(srcdir)/cp775_uni.tbl makeuctb$x cp850_uni.h: $(srcdir)/cp850_uni.tbl makeuctb$x cp852_uni.h: $(srcdir)/cp852_uni.tbl makeuctb$x cp862_uni.h: $(srcdir)/cp862_uni.tbl makeuctb$x diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c index cc721723..874d971f 100644 --- a/src/chrtrans/makeuctb.c +++ b/src/chrtrans/makeuctb.c @@ -16,7 +16,13 @@ * version 2, or at your option any later version. */ -#define DONT_USE_SOCKS5 +#ifdef NOTDEFINED +#include <stdio.h> +#include <stdlib.h> +#include <sysexits.h> +#include <string.h> +#include <ctype.h> +#else #include <HTUtils.h> #include <tcp.h> /* @@ -25,6 +31,7 @@ #ifdef exit #undef exit #endif /* exit */ +#endif /* NODEFINED */ #ifndef TOLOWER #define TOLOWER(c) (isupper((unsigned char)c) ? tolower((unsigned char)c) : (c)) @@ -40,16 +47,6 @@ */ typedef u16 unicode; -/* - * Since we're writing the formatted file to stdout, ensure that we flush - * everything before leaving, since some old (and a few not-so-old) platforms - * that do not implement POSIX 'exit()'. - */ -#define done(code) \ - fflush(stdout); \ - fflush(stderr); \ - exit(code) - PRIVATE void usage ARGS1( char *, argv0) { @@ -59,7 +56,7 @@ PRIVATE void usage ARGS1( argv0); fprintf(stderr, "Utility to convert .tbl into .h files for Lynx compilation.\n"); - done(EX_USAGE); + exit(EX_USAGE); } /* copied from HTString.c, not everybody has strncasecmp */ @@ -132,7 +129,7 @@ PRIVATE void addpair_str ARGS2( if (!themap_str.entries) { fprintf(stderr, "%s: Out of memory\n", tblname); - done(EX_DATAERR); + exit(EX_DATAERR); } } else { /* @@ -152,7 +149,7 @@ PRIVATE void addpair_str ARGS2( if (themap_str.entry_ct > 1999) { fprintf(stderr, "ERROR: Only 2000 unicode replacement strings permitted!\n"); - done(EX_DATAERR); + exit(EX_DATAERR); } themap_str.entries[themap_str.entry_ct].unicode = un; themap_str.entries[themap_str.entry_ct].replace_str = str; @@ -198,7 +195,7 @@ PRIVATE void addpair ARGS2( */ if (unicount[fp] > 254) { fprintf(stderr, "ERROR: Only 255 unicodes/glyph permitted!\n"); - done(EX_DATAERR); + exit(EX_DATAERR); } unitable[fp][unicount[fp]] = un; unicount[fp]++; @@ -236,7 +233,7 @@ PUBLIC int main ARGS2( ctbl = fopen(tblname = argv[1], "r"); if (!ctbl) { perror(tblname); - done(EX_NOINPUT); + exit(EX_NOINPUT); } } @@ -386,11 +383,11 @@ PUBLIC int main ARGS2( un0 = getunicode(&p); if (un0 < 0) { fprintf(stderr, "Bad input line: %s\n", buffer); - done(EX_DATAERR); + exit(EX_DATAERR); fprintf(stderr, "%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n", tblname, fp0, fp1); - done(EX_DATAERR); + exit(EX_DATAERR); } un1 = un0; while (*p == ' ' || *p == '\t') { @@ -407,7 +404,7 @@ PUBLIC int main ARGS2( "%s: Bad Unicode range U+%x-U+%x\n", tblname, un0, un1); fprintf(stderr, "Bad input line: %s\n", buffer); - done(EX_DATAERR); + exit(EX_DATAERR); } while (*p == ' ' || *p == '\t') { p++; @@ -424,7 +421,7 @@ PUBLIC int main ARGS2( if (!(p1 = tbuf)) { fprintf(stderr, "%s: Out of memory\n", tblname); - done(EX_DATAERR); + exit(EX_DATAERR); } if (*p == '"') { /* @@ -484,7 +481,7 @@ PUBLIC int main ARGS2( fp0 = strtol(p, &p1, 0); if (p1 == p) { fprintf(stderr, "Bad input line: %s\n", buffer); - done(EX_DATAERR); + exit(EX_DATAERR); } p = p1; @@ -496,7 +493,7 @@ PUBLIC int main ARGS2( fp1 = strtol(p, &p1, 0); if (p1 == p) { fprintf(stderr, "Bad input line: %s\n", buffer); - done(EX_DATAERR); + exit(EX_DATAERR); } p = p1; } else { @@ -507,13 +504,13 @@ PUBLIC int main ARGS2( fprintf(stderr, "%s: Glyph number (0x%x) larger than font length\n", tblname, fp0); - done(EX_DATAERR); + exit(EX_DATAERR); } if (fp1 && (fp1 < fp0 || fp1 >= fontlen)) { fprintf(stderr, "%s: Bad end of range (0x%x)\n", tblname, fp1); - done(EX_DATAERR); + exit(EX_DATAERR); } if (fp1) { @@ -540,7 +537,7 @@ PUBLIC int main ARGS2( tblname); fprintf(stderr, " there should be a Unicode range.\n"); - done(EX_DATAERR); + exit(EX_DATAERR); } p++; un1 = getunicode(&p); @@ -548,7 +545,7 @@ PUBLIC int main ARGS2( fprintf(stderr, "%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n", tblname, fp0, fp1); - done(EX_DATAERR); + exit(EX_DATAERR); } if (un1 - un0 != fp1 - fp0) { fprintf(stderr, @@ -557,7 +554,7 @@ PUBLIC int main ARGS2( fprintf(stderr, " as font position range 0x%x-0x%x\n", fp0, fp1); - done(EX_DATAERR); + exit(EX_DATAERR); } for (i = fp0; i <= fp1; i++) { addpair(i,un0-fp0+i); @@ -588,7 +585,7 @@ PUBLIC int main ARGS2( fprintf(stderr, "%s: Bad Unicode range 0x%x-0x%x\n", tblname, un0, un1); - done(EX_DATAERR); + exit(EX_DATAERR); } for (un0++; un0 <= un1; un0++) { addpair(fp0, un0); @@ -634,14 +631,12 @@ PUBLIC int main ARGS2( } else if (this_LYNXcharset[0] == '\0') { strncpy(this_LYNXcharset,this_MIMEcharset,UC_MAXLEN_LYNXCSNAME); } -/***** DO NOT produce trailing spaces! if ((i = strlen(this_LYNXcharset)) < UC_LEN_LYNXCSNAME) { for (; i < UC_LEN_LYNXCSNAME; i++) { this_LYNXcharset[i] = ' '; } this_LYNXcharset[i] = '\0'; } -*******/ #ifdef NOTDEFINED fprintf(stderr,"this_MIMEcharset: %s.\n",this_MIMEcharset); fprintf(stderr,"this_LYNXcharset: %s.\n",this_LYNXcharset); @@ -660,8 +655,8 @@ PUBLIC int main ARGS2( p++, i++) { id_append[i+1] = isalnum(*p) ? *p : '_'; } - id_append[i+1] = '\0'; } + id_append[i+1] = '\0'; fprintf(stderr, " (%s).\n", id_append); printf("\ @@ -765,5 +760,5 @@ dfont_replacedesc%s,%d,%d)\n", id_append, this_MIMEcharset, this_LYNXcharset, id_append, id_append, nuni, id_append, lowest_eight, RawOrEnc); - done(EX_OK); + exit(EX_OK); } diff --git a/src/chrtrans/utf8_uni.tbl b/src/chrtrans/utf8_uni.tbl index 9fc470ad..67ff3460 100644 --- a/src/chrtrans/utf8_uni.tbl +++ b/src/chrtrans/utf8_uni.tbl @@ -7,7 +7,7 @@ Mutf-8 #Name as a Display Charset (used on Options screen) -OUNICODE (UTF-8) +OUNICODE UTF-8 # Some kind of raw Unicode? # Use 6 for for really "raw" 16bit UCS-2, 7 for UTF-8, ... diff --git a/src/descrip.mms b/src/descrip.mms index 014a3a2b..9f84a7b8 100644 --- a/src/descrip.mms +++ b/src/descrip.mms @@ -154,7 +154,7 @@ TCPFLAGS = /Define = (DEBUG, ACCESS_AUTH, $(TCP)) TOPT = sys$disk:[]$(TCPOPT).opt COPT = sys$disk:[]$(COMPILER).opt WWWLIB = [-.WWW.Library.Implementation]WWWLib_$(TCP).olb -CFLAGS = $(TCPFLAGS) $(CFLAGS)/Include=([], [-], [.chrtrans], [-.WWW.Library.Implementation]) +CFLAGS = $(TCPFLAGS) $(CFLAGS)/Include = ([-], [.chrtrans], [-.WWW.Library.Implementation]) lynx : lynx.exe diff --git a/src/makefile.dos b/src/makefile.dos index 283bcc27..91ace376 100644 --- a/src/makefile.dos +++ b/src/makefile.dos @@ -12,11 +12,7 @@ LYStyle.o LYHash.o CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)
CC = gcc
-MCFLAGS = -O3 -DHAVE_GETBKGD -DDISP_PARTIAL -DUSE_ZLIB \
- -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES \
- -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP \
- -Ichrtrans -I../WWW/library/implementation \
- -I../curses -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp
+MCFLAGS = -O3 -DRAWDOSKEYHACK -DUSE_ZLIB -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -Ichrtrans -I../WWW/library/implementation -I../curses -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp
WWWLIB = ../WWW/library/djgpp/libwww.a ../curses/pdcurses.a ../djgpp/tcplib/obj/libtcp.a
LIBS=-lz
@@ -24,7 +20,7 @@ all: lynx lynx: message $(OBJS) $(WWWLIB)
@echo "Linking and creating Lynx executable"
- $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
+ $(CC) $(CFLAGS) -o lynx $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
@echo "Welcome to Lynx!"
message:
@@ -38,7 +34,7 @@ lint: lint *.c > ../lint.out
clean:
- rm -f lynx.exe core *.[ob]
+ rm -f lynx core *.[ob]
LYMain.o: ../userdefs.h
LYMainLoop.o: LYMainLoop.c ../userdefs.h
diff --git a/src/makefile.dsl b/src/makefile.dsl deleted file mode 100644 index a66349ca..00000000 --- a/src/makefile.dsl +++ /dev/null @@ -1,62 +0,0 @@ -OBJS= UCdomap.o UCAux.o UCAuto.o \
-LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
-LYMail.o HTAlert.o GridText.o LYGetFile.o \
-LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
-LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
-LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
-HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
-LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \
-LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \
-LYStyle.o LYHash.o
-
-CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)
-
-CC = gcc
-MCFLAGS = -O3 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \
--DUSE_SLANG -DDJGPP_KEYHANDLER -DACCESS_AUTH -DNO_CUSERID \
--DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/library/implement -I../djgpp/tcplib/include \
--I./chrtrans -I../djgpp/tcplib/include/tcp
-WWWLIB = ../WWW/library/djgpp/libwww.a ../djgpp/tcplib/obj/libtcp.a
-LIBS= -lslang -lz
-CHRTR= ./chrtrans/
-
-all: lynx.exe
-
-lynx.exe: message $(OBJS) $(WWWLIB)
- @echo "Linking and creating Lynx executable"
- $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
- @echo "Welcome to Lynx!"
-
-message:
- @echo "Compiling Lynx sources"
-
-dbg: $(OBJS) $(WWWLIB)
- @echo "Making Lynx code"
- $(CC) $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)
-
-lint:
- lint *.c > ../lint.out
-
-clean:
- rm -f lynx.exe core *.[ob]
-
-LYMain.o: ../userdefs.h
-LYMainLoop.o: LYMainLoop.c ../userdefs.h
-LYReadCFG.o: LYReadCFG.c ../userdefs.h
-HTFWriter.o: HTFWriter.c ../userdefs.h
-LYGetFile.o: LYGetFile.c ../userdefs.h
-LYOptions.o: LYOptions.c ../userdefs.h
-LYReadCFG.o: LYReadCFG.c ../userdefs.h
-LYTraversal.o: LYTraversal.c ../userdefs.h
-LYCharSets.o: LYCharSets.c ../userdefs.h
-LYShowInfo.o: LYShowInfo.c ../userdefs.h
-LYStrings.o: LYStrings.c ../userdefs.h
-LYBookmark.o: LYBookmark.c ../userdefs.h
-LYHistory.o: LYHistory.c ../userdefs.h
-LYDownload.o: LYDownload.c ../userdefs.h
-DefaultStyle.o: DefaultStyle.c ../userdefs.h
-LYEditmap.o: LYEditmap.c ../userdefs.h
-LYCharUtils.o: LYCharUtils.c ../userdefs.h
-LYExtern.o: LYExtern.c ../userdefs.h
-LYUtils.o: LYUtils.c ../userdefs.h
-LYCookie.o: ../userdefs.h
diff --git a/src/makefile.in b/src/makefile.in index e14fa843..18016728 100644 --- a/src/makefile.in +++ b/src/makefile.in @@ -18,13 +18,14 @@ CFLAGS = @CFLAGS@ DEFS = @DEFS@ CPPFLAGS = @CPPFLAGS@ -LIBS = @LIBS@ $(RESOLVLIB) $(WAISLIB) $(SITE_LIBS) +LIBS = @LIBS@ $(RESOLVLIB) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS) LDFLAGS = @LDFLAGS@ # Symbols inherited from the top-level makefile RESOLVLIB = # FIXME: set in parent makefile SITE_DEFS = # FIXME: set in parent makefile SITE_LIBS = # FIXME: set in parent makefile +SOCKSLIB = # FIXME: set in parent makefile WAISLIB = # FIXME: set in parent makefile WWWINC = WWW/Library/Implementation @@ -44,9 +45,6 @@ CC_OPTS = $(CPP_OPTS) $(CFLAGS) LINT = @LINT@ LINTOPTS = -COMPRESS_PROG =@COMPRESS_PROG@ -COMPRESS_EXT =@COMPRESS_EXT@ - CHARTRANS_OBJS=UCdomap.o UCAux.o UCAuto.o OBJS= LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \ LYMail.o HTAlert.o GridText.o LYGetFile.o \ @@ -72,7 +70,7 @@ all: lynx$x @RULE_CC@ @ECHO_CC@$(CPP) -C $(CPP_OPTS) $*.c >$@ -lynx$x: message do_chartrans_stuff ../LYHelp.h $(OBJS) $(WWWLIB) +lynx$x: message do_chartrans_stuff $(OBJS) $(WWWLIB) @echo "Linking and creating Lynx executable" $(CC) $(CC_OPTS) $(LDFLAGS) -o $@ $(OBJS) $(WWWLIB) $(LIBS) @echo "Copying Lynx executable into top-level directory" @@ -112,7 +110,6 @@ HTInit.o: ../userdefs.h LYTraversal.o: ../userdefs.h LYMail.o: ../userdefs.h LYCharSets.o: ../userdefs.h -LYShowInfo.o: ../cfg_defs.h CHRTR= chrtrans/ diff --git a/src/makefile.wsl b/src/makefile.wsl deleted file mode 100644 index af721f2f..00000000 --- a/src/makefile.wsl +++ /dev/null @@ -1,62 +0,0 @@ -OBJS= UCdomap.o UCAux.o UCAuto.o \
-LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
-LYMail.o HTAlert.o GridText.o LYGetFile.o \
-LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
-LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
-LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
-HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
-LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \
-LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \
-LYStyle.o LYHash.o
-
-CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)
-
-CC = gcc
-MCFLAGS = -O3 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \
--DUSE_SLANG -DACCESS_AUTH -DNO_CUSERID \
--DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/library/implement -I../djgpp/tcplib/include \
--I./chrtrans -I../djgpp/tcplib/include/tcp
-WWWLIB = ../WWW/library/djgpp/libwww.a ../djgpp/tcplib/obj/libtcp.a
-LIBS= -lslang -lz
-CHRTR= ./chrtrans/
-
-all: lynx.exe
-
-lynx.exe: message $(OBJS) $(WWWLIB)
- @echo "Linking and creating Lynx executable"
- $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
- @echo "Welcome to Lynx!"
-
-message:
- @echo "Compiling Lynx sources"
-
-dbg: $(OBJS) $(WWWLIB)
- @echo "Making Lynx code"
- $(CC) $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)
-
-lint:
- lint *.c > ../lint.out
-
-clean:
- rm -f lynx.exe core *.[ob]
-
-LYMain.o: ../userdefs.h
-LYMainLoop.o: LYMainLoop.c ../userdefs.h
-LYReadCFG.o: LYReadCFG.c ../userdefs.h
-HTFWriter.o: HTFWriter.c ../userdefs.h
-LYGetFile.o: LYGetFile.c ../userdefs.h
-LYOptions.o: LYOptions.c ../userdefs.h
-LYReadCFG.o: LYReadCFG.c ../userdefs.h
-LYTraversal.o: LYTraversal.c ../userdefs.h
-LYCharSets.o: LYCharSets.c ../userdefs.h
-LYShowInfo.o: LYShowInfo.c ../userdefs.h
-LYStrings.o: LYStrings.c ../userdefs.h
-LYBookmark.o: LYBookmark.c ../userdefs.h
-LYHistory.o: LYHistory.c ../userdefs.h
-LYDownload.o: LYDownload.c ../userdefs.h
-DefaultStyle.o: DefaultStyle.c ../userdefs.h
-LYEditmap.o: LYEditmap.c ../userdefs.h
-LYCharUtils.o: LYCharUtils.c ../userdefs.h
-LYExtern.o: LYExtern.c ../userdefs.h
-LYUtils.o: LYUtils.c ../userdefs.h
-LYCookie.o: ../userdefs.h
diff --git a/test/c1.html b/test/c1.html deleted file mode 100644 index 0b43ab07..00000000 --- a/test/c1.html +++ /dev/null @@ -1,82 +0,0 @@ -<HTML> -<HEAD> -<TITLE> Test of some symbols </TITLE> -</HEAD> -<BODY> -<PRE> -You may press '\' to view the source of this test - -NCRs for symbols which are the C1 control chars for iso-8859-1 and Unicode, -but assumed as <em>windows-1252</em> codepoints (common for windows-xxxx), -say mercy to MS FrontPage (WYSIWYG HTML editor). - -<em>Number NCR alt-NCR windows-1252</em> - -0x80 € <IMG SRC=X ALT="€"> € #EURO SIGN -0x81  <IMG SRC=X ALT=""> <!----> #NOT USED -0x82 ‚ <IMG SRC=X ALT="‚"> ‚ #SINGLE LOW-9 QUOTATION MARK -0x83 ƒ <IMG SRC=X ALT="ƒ"> ƒ #LATIN SMALL LETTER F WITH HOOK -0x84 „ <IMG SRC=X ALT="„"> „ #DOUBLE LOW-9 QUOTATION MARK -0x85 … <IMG SRC=X ALT="…"> … #HORIZONTAL ELLIPSIS -0x86 † <IMG SRC=X ALT="†"> † #DAGGER -0x87 ‡ <IMG SRC=X ALT="‡"> ‡ #DOUBLE DAGGER -0x88 ˆ <IMG SRC=X ALT="ˆ"> ˆ #MODIFIER LETTER CIRCUMFLEX ACCENT -0x89 ‰ <IMG SRC=X ALT="‰"> ‰ #PER MILLE SIGN -0x8a Š <IMG SRC=X ALT="Š"> Š #LATIN CAPITAL LETTER S WITH CARON -0x8b ‹ <IMG SRC=X ALT="‹"> ‹ #SINGLE LEFT-POINTING ANGLE QUOTATION MARK -0x8c Œ <IMG SRC=X ALT="Œ"> Œ #LATIN CAPITAL LIGATURE OE -0x8d  <IMG SRC=X ALT=""> <!----> #NOT USED -0x8e Ž <IMG SRC=X ALT="Ž"> <!--Ž--> #NOT USED -0x8f  <IMG SRC=X ALT=""> <!----> #NOT USED -0x90  <IMG SRC=X ALT=""> <!----> #NOT USED -0x91 ‘ <IMG SRC=X ALT="‘"> ‘ #LEFT SINGLE QUOTATION MARK -0x92 ’ <IMG SRC=X ALT="’"> ’ #RIGHT SINGLE QUOTATION MARK -0x93 “ <IMG SRC=X ALT="“"> “ #LEFT DOUBLE QUOTATION MARK -0x94 ” <IMG SRC=X ALT="”"> ” #RIGHT DOUBLE QUOTATION MARK -0x95 • <IMG SRC=X ALT="•"> • #BULLET -0x96 – <IMG SRC=X ALT="–"> – #EN DASH -0x97 — <IMG SRC=X ALT="—"> — #EM DASH -0x98 ˜ <IMG SRC=X ALT="˜"> ˜ #SMALL TILDE -0x99 ™ <IMG SRC=X ALT="™"> ™ #TRADE MARK SIGN -0x9a š <IMG SRC=X ALT="š"> š #LATIN SMALL LETTER S WITH CARON -0x9b › <IMG SRC=X ALT="›"> › #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -0x9c œ <IMG SRC=X ALT="œ"> œ #LATIN SMALL LIGATURE OE -0x9d  <IMG SRC=X ALT=""> <!----> #NOT USED -0x9e ž <IMG SRC=X ALT="ž"> <!--ž--> #NOT USED -0x9f Ÿ <IMG SRC=X ALT="Ÿ"> Ÿ #LATIN CAPITAL LETTER Y WITH DIAERESIS - - -</PRE> -</BODY> -</HTML> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/raw8bit.html b/test/raw8bit.html deleted file mode 100644 index d64cf65b..00000000 --- a/test/raw8bit.html +++ /dev/null @@ -1,37 +0,0 @@ -<HTML> -<HEAD> -<TITLE> Test of raw 8-bit symbols </TITLE> -<!-- you may uncomment the next line -and set the document's charset directly via META tag --> -<!--META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"--> -</HEAD> -<BODY> -<PRE> -This is a test of translation 8-bit letters for different pairs of -document's charset (assumed charset) and display charset, -both can be reached from 'O'ptions menu. - -This page (obviously) corresponds to text/html mode -but you may test text/plain just by pressing '\' -Try also: '@' for ``raw mode'' and '=' for Information Page. - - - 0 1 2 3 4 5 6 7 8 9 A B C D E F -20 ! " # $ % & ' ( ) * + , - . / -30 0 1 2 3 4 5 6 7 8 9 : ; < = > ? -40 @ A B C D E F G H I J K L M N O -50 P Q R S T U V W X Y Z [ \ ] ^ _ -60 ` a b c d e f g h i j k l m n o -70 p q r s t u v w x y z { | } ~ -80 € � ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ � Ž � -90 � ‘ ’ “ ” • – — ˜ ™ š › œ � ž Ÿ -A0 ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ -B0 ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ -C0 À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï -D0 Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß -E0 à á â ã ä å æ ç è é ê ë ì í î ï -F0 ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ - -</PRE> -</BODY> -</HTML> diff --git a/test/sgml.html b/test/sgml.html index 57f55a03..e5c2105d 100644 --- a/test/sgml.html +++ b/test/sgml.html @@ -41,13 +41,12 @@ original comment: This test illuminating SGML character entities implementation in your browser. -We sort the entities according to unicode numbers. +We sort the entities according unicode numbers. You should see visible character if your display character set support it or some substitution string picked up from src/chrtrans/def7_uni.tbl. If you see &somename; - this name is not implemented yet, -you may search for &. (Sorry, ISOgrk4 which hold a dot in its name -seems to be nonvisible for most browsers. Keep in mind that -this table is much wider than in HTML 4.0 draft). +you may search for &. (Sorry, ISOgrk4 seems to be a nonsense. +Keep in mind that this table is much wider than in HTML 4.0 draft). Leonid Pauzner. @@ -76,13 +76,13 @@ * Note that some implementations of telnet allow passing of * environment variables, which might be used by unscrupulous * people to modify the environment in anonymous accounts. When - * making Lynx and Web access publicly available via anonymous + * making Lynx and Web access publically available via anonymous * accounts intended to run Lynx captively, be sure the wrapper * uses the -cfg switch and specifies the startfile, rather than * relying on the LYNX_CFG, LYNX_CFG_FILE, or WWW_HOME variables. * * Note that any SUFFIX or VIEWER mappings in the configuration - * file will be overridden by any suffix or viewer mappings + * file will be overidden by any suffix or viewer mappings * that are established as defaults in src/HTInit.c. You can * override the src/HTInit.c defaults via the mime.types and * mailcap files (see the examples in the samples directory). @@ -126,7 +126,7 @@ /************************** * SYSTEM_MAIL must be defined here to your mail sending command, - * and SYSTEM_MAIL_FLAGS to appropriate qualifiers. They can be + * and SYSTEM_MAIL_FLAGS to approrpriate qualifiers. They can be * changed in lynx.cfg. * * The mail command will be spawned as a subprocess of lynx @@ -230,7 +230,7 @@ #else /* UNIX */ /************************** - * NOTE: This variable is set by the configure script; editing changes will + * NOTE: This variable is set by the configure scrip; editing changes will * be ignored. * * LYNX_CFG_FILE is the location and name of the default lynx @@ -253,13 +253,13 @@ * Note that many implementations of telnetd allow passing of * environment variables, which might be used by unscrupulous * people to modify the environment in anonymous accounts. When - * making Lynx and Web access publicly available via anonymous + * making Lynx and Web access publically available via anonymous * accounts intended to run Lynx captively, be sure the wrapper * uses the -cfg switch and specifies the startfile, rather than * relying on the LYNX_CFG, LYNX_CFG_FILE, or WWW_HOME variables. * * Note that any SUFFIX or VIEWER mappings in the configuration - * file will be overridden by any suffix or viewer mappings + * file will be overidden by any suffix or viewer mappings * that are established as defaults in src/HTInit.c. You can * override the src/HTInit.c defaults via the mime.types and * mailcap files (see the examples in the samples directory). @@ -344,14 +344,16 @@ #define TEMP_SPACE "/tmp/" /******************************** - * Comment this line out to let the user enter his/her email address - * when sending a message. There should be no need to do this unless - * your mailer agent does not put in the From: field for you. (If your - * mailer agent does not automatically put in the From: field, you should - * upgrade, because anonymous mail makes it far too easy for a user to - * spoof someone else's email address.) + * Don't let the user enter his/her email address when sending a message. + * Anonymous mail makes it far too easy for a user to spoof someone else's + * email address. + * This requires that your mailer agent put in the From: field for you. + * + * The default should be to uncomment this line but there probably are too + * many mail agents out there that won't do the right thing if there is no + * From: line. */ -#define NO_ANONYMOUS_EMAIL TRUE +/* #define NO_ANONYMOUS_EMAIL TRUE */ /******************************** * LIST_FORMAT defines the display for local files when LONG_LIST @@ -451,7 +453,7 @@ /***************************** * If USE_TRACE_LOG is set FALSE, then when TRACE mode is invoked the - * syserr messages will not be directed to a log file named Lynx.trace + * syserr messages will not be directed to a log file named lynx.trace * in the account's HOME directory. The default defined here can be * toggled via the -tlog command line switch. Also, it is set FALSE * automatically when Lynx is executed in an anonymous or validation @@ -466,7 +468,7 @@ * the log, even if TRACE mode is turned off via the TOGGLE_TRACE * (Control-T) command. */ -#define USE_TRACE_LOG TRUE +#define USE_TRACE_LOG FALSE /******************************* * If GOTOBUFFER is set to TRUE here or in lynx.cfg the last entered @@ -490,7 +492,7 @@ * <dt>?<dd><a href="file://localhost/path/jumps.html">This Shortcut List</a> * * If not defined here or in lynx.cfg, the JUMP command will invoke - * the NO_JUMPFILE status line message (see LYMessages_en.h). The prompt + * the NO_JUMPFILE statusline message (see LYMessages_en.h). The prompt * associated with the default jumps file is defined as JUMP_PROMPT in * LYMessages_en.h and can be modified in lynx.cfg. Additional, alternate * jumps files can be defined and mapped to keystrokes, and alternate @@ -540,7 +542,7 @@ /********************* * LOCAL_DOMAIN is used for a tail match with the ut_host element of - * the utmp or utmpx structure on systems with utmp capabilities, to + * the utmp or utmpx structure on systems with utmp capabilites, to * determine if a user is local to your campus or organization when * handling -restrictions=inside_foo or outside_foo settings for ftp, * news, telnet/tn3270 and rlogin URLs. An "inside" user is assumed @@ -597,7 +599,7 @@ /******************************** * CHARACTER_SET defines the default character set, i.e., that assumed - * to be installed on the user's terminal. It determines which characters + * to be installed on the user's termimal. It determines which characters * or strings will be used to represent 8-bit character entities within * HTML. New character sets may be defined as explained in the README * files of the src/chrtrans directory in the Lynx source code distribution. @@ -606,65 +608,61 @@ * via the 'o'ptions menu. The 'o'ptions menu setting will be stored in * the user's RC file whenever those settings are saved, and thereafter * will be used as the default. Also see lynx.cfg for information about - * the -raw switch and LYK_RAW_TOGGLE command. - * - * Since Lynx now supports a wide range of platforms it may be useful - * to note that cpXXX codepages used by IBM PC compatible computers, - * and windows-xxxx used by native MS-Windows apps. - * - * Recognized character sets include: - * - * string for 'O'ptions Menu MIME name - * =========================== ========= - * 7 bit approximations (US-ASCII) us-ascii - * Western (ISO-8859-1) iso-8859-1 - * Western (cp850) cp850 - * Western (windows-1252) windows-1251 - * IBM PC US codepage (cp437) cp437 - * DEC Multinational dec-mcs - * Macintosh (8 bit) macintosh - * NeXT character set next - * Chinese euc-cn - * Japanese (EUC-JP) euc-jp - * Japanese (Shift_JIS) shift_jis - * Korean euc-kr - * Taipei (Big5) big5 - * Vietnamese (VISCII) viscii - * Eastern European (ISO-8859-2) iso-8859-2 - * Eastern European (cp852) cp852 - * Eastern European (windows-1250) windows-1250 - * Latin 3 (ISO-8859-3) iso-8859-3 - * Latin 4 (ISO-8859-4) iso-8859-4 - * Baltic Rim (cp775) cp775 - * Baltic Rim (windows-1257) windows-1257 - * Cyrillic (ISO-8859-5) is-8859-5 - * Cyrillic (cp866) cp866 - * Cyrillic (windows-1251) windows-1251 - * Cyrillic (KOI8-R) koi8-r - * Arabic (ISO-8859-6) iso-8859-6 - * Arabic (cp864) cp864 - * Arabic (windows-1256) windows-1256 - * Greek (ISO-8859-7) iso-8859-7 - * Greek (cp737) cp737 - * Greek2 (cp869) cp869 - * Greek (windows-1253) windows-1253 - * Hebrew (ISO-8859-8) iso-8859-8 - * Hebrew (cp862) cp862 - * Hebrew (windows-1255) windows-1255 - * Turkish (ISO-8859-9) iso-8859-9 - * ISO-8859-10 iso-8859-10 - * UNICODE (UTF-8) utf-8 - * RFC 1345 w/o Intro mnemonic+ascii+0 - * RFC 1345 Mnemonic mnemonic - * Transparent x-transparent - */ -#define CHARACTER_SET "iso-8859-1" + * the -raw switch and LYE_RAW_TOGGLE command. + * + * The default character sets include: + * + * Display Character Set name MIME name + * ========================== ========= + * 7 bit approximations us-ascii + * Chinese euc-cn + * DEC Multinational dec-mcs + * DosArabic (cp864) cp864 + * DosBaltRim (cp775) cp775 + * DosCyrillic (cp866) cp866 + * DosGreek (cp737) cp737 + * DosGreek2 (cp869) cp869 + * DosHebrew (cp862) cp862 + * DosLatin1 (cp850) cp850 + * DosLatin2 (cp852) cp852 + * DosLatinUS (cp437) cp437 + * ISO 8859-10 iso-8859-10 + * ISO 8859-5 Cyrillic iso-8859-5 + * ISO 8859-6 Arabic iso-8859-6 + * ISO 8859-7 Greek iso-8859-7 + * ISO 8859-8 Hebrew iso-8859-8 + * ISO 8859-9 (Latin 5) iso-8859-9 + * ISO Latin 1 iso-8859-1 + * ISO Latin 2 iso-8859-2 + * ISO Latin 3 iso-8859-3 + * ISO Latin 4 iso-8859-4 + * Japanese (EUC) euc-jp + * Japanese (SJIS) shift_jis + * KOI8-R Cyrillic koi8-r + * Korean euc-kr + * Macintosh (8 bit) macintosh + * NeXT character set next + * RFC 1345 Mnemonic mnemonic + * RFC 1345 w/o Intro mnemonic+ascii+0 + * Taipei (Big5) big5 + * Transparent x-transparent + * UNICODE UTF-8 utf-8 + * Vietnamese (VISCII) viscii + * WinArabic (cp1256) windows-1256 + * WinBaltRim (cp1257) windows-1257 + * WinCyrillic (cp1251) windows-1251 + * WinGreek (cp1253) windows-1253 + * WinHebrew (cp1255) windows-1255 + * WinLatin1 (cp1252) windows-1252 + * WinLatin2 (cp1250) windows-1250 + */ +#define CHARACTER_SET "ISO Latin 1" /***************************** * PREFERRED_LANGUAGE is the language in MIME notation (e.g., "en", * "fr") which will be indicated by Lynx in its Accept-Language headers * as the preferred language. If available, the document will be - * transmitted in that language. This definition can be overridden via + * transmitted in that language. This definition can be overriden via * lynx.cfg. Users also can change it via the 'o'ptions menu and save * that preference in their RC file. This may be a comma-separated list * of languages in decreasing preference. @@ -675,7 +673,7 @@ * PREFERRED_CHARSET specifies the character set in MIME notation (e.g., * "ISO-8859-2", "ISO-8859-5") which Lynx will indicate you prefer in * requests to http servers using an Accept-Charsets header. - * This definition can be overridden via lynx.cfg. Users also can change it + * This definition can be overriden via lynx.cfg. Users also can change it * via the 'o'ptions menu and save that preference in their RC file. * The value should NOT include "ISO-8859-1" or "US-ASCII", since those * values are always assumed by default. @@ -699,7 +697,7 @@ * support via the 'o'ptions menu, and can save that choice as the startup * default via the .lynxrc file. When on, the setting can be STANDARD or * ADVANCED. If support is set to the latter, and the user mode also is -* ADVANCED, the VIEW_BOOKMARK command will invoke a status line prompt at +* ADVANCED, the VIEW_BOOKMARK command will invoke a statusline prompt at * which the user can enter the letter token (A - Z) of the desired bookmark, * or '=' to get a menu of available bookmark files. The menu always is * presented in NOVICE or INTERMEDIATE mode, or if the support is set to @@ -729,7 +727,7 @@ * cannot be opened as a local file (file://localhost/string). Both * can be comma-separated lists. Each prefix must end with a dot, each * suffix must begin with a dot, and either may contain other dots (e.g., - * .co.jp). The default lists are defined here, and can be changed + * .com.jp). The default lists are defined here, and can be changed * in lynx.cfg. Each prefix will be used with each suffix, in order, * until a valid Internet host is created, based on a successful DNS * lookup (e.g., foo will be tested as www.foo.com and then www.foo.edu @@ -804,10 +802,8 @@ /******************************** * If COLLAPSE_BR_TAGS is set FALSE, Lynx will not collapse serial - * BR tags. If set TRUE, two or more concurrent BRs will be collapsed - * into a single blank line. Note that the valid way to insert extra - * blank lines in HTML is via a PRE block with only newlines in the - * block. + * BR tags. Note that the valid way to insert extra blank lines in + * HTML is via a PRE block with only newlines in the block. * * The default defined here can be changed in lynx.cfg. */ @@ -822,15 +818,6 @@ */ #define SET_COOKIES TRUE -/******************************* - * If ACCEPT_ALL_COOKIES is set TRUE, and SET_COOKIES is TRUE, Lynx will - * accept all cookies. - * - * The default defined here can be changed in lynx.cfg, and .lynxrc, or - * toggled via the -accept_all_cookies command line switch. - */ -#define ACCEPT_ALL_COOKIES FALSE - /**************************************************************** * Section 2. Things that you probably want to change or review @@ -839,10 +826,10 @@ /***************************** * The following three definitions set the number of seconds for - * pauses following status line messages that would otherwise be + * pauses following statusline messages that would otherwise be * replaced immediately, and are more important than the unpaused * progress messages. Those set by INFOSECS are also basically - * progress messages (e.g., that a prompted input has been canceled) + * progress messages (e.g., that a prompted input has been cancelled) * and should have the shortest pause. Those set by MESSAGESECS are * informational (e.g., that a function is disabled) and should have * a pause of intermediate duration. Those set by ALERTSECS typically @@ -882,15 +869,15 @@ /****************************** * VERBOSE_IMAGES controls whether or not Lynx replaces the [LINK], [INLINE] and -* [IMAGE] comments (for images without ALT) with filenames of these images. +* [IMAGE] comments (for images without ALT) with filenames of these images. * This is extremely useful because now we can determine immediately what images -* are just decorations (button.gif, line.gif) and what images are important. -* -* The default defined here can be changed in lynx.cfg. -*/ -#define VERBOSE_IMAGES TRUE - -/****************************** +* are just decorations (button.gif, line.gif) and what images are important. +* +* The default defined here can be changed in lynx.cfg. +*/ +#define VERBOSE_IMAGES FALSE + +/****************************** * BOXVERT and BOXHORI control the layout of popup menus. Set to 0 if your * curses supports line-drawing characters, set to '*' or any other character * to not use line-drawing (e.g., '|' for vertical and '-' for horizontal). @@ -1044,7 +1031,7 @@ * specify the DEFAULT setting of the users execution link * options, but the user may still change those options. * If you do not wish the user to be able to change the - * execution link settings you may wish to use the command line option: + * execution link settings you may wish to use the commandline option: * -restrictions=exec_frozen * * LOCAL_EXECUTION_LINKS_ALWAYS_ON will be FALSE @@ -1078,16 +1065,16 @@ #define MAIL_SYSTEM_ERROR_LOGGING FALSE /*mail a message for every error?*/ /********************************* - * If CHECKMAIL is set to TRUE, the user will be informed (via a status line + * If CHECKMAIL is set to TRUE, the user will be informed (via a statusline * message) about the existence of any unread mail at startup of Lynx, and - * will get status line messages if subsequent new mail arrives. If a jumps + * will get statusline messages if subsequent new mail arrives. If a jumps * file with a lynxprog URL for invoking mail is available, or your html * pages include an mail launch file URL, the user thereby can access mail - * and read the messages. The checks and status line reports will not be + * and read the messages. The checks and statusline reports will not be * performed if Lynx has been invoked with the -restrictions=mail switch. * * VMS USERS !!! - * New mail is normally broadcast as it arrives, via "unsolicited screen + * New mail is normally broadcast as it arrives, via "unsolicitied screen * broadcasts", which can be "wiped" from the Lynx display via the Ctrl-W * command. You may prefer to disable the broadcasts and use CHECKMAIL * instead (e.g., in a public account which will be used by people who @@ -1143,7 +1130,7 @@ * strings will be links for the resolved SRC rather than just text. For * ISMAP or other graphic links, the ALT or pseudo-ALT ("[ISMAP]" or "[LINK]") * strings will have '-' and a link labeled "[IMAGE]" for the resolved SRC - * appended. See also VERBOSE_IMAGES flag. + * appended. * * The default defined here can be changed in lynx.cfg, and the user can * use LYK_IMAGE_TOGGLE to toggle the feature on or off at run time. @@ -1158,7 +1145,6 @@ * i.e., they'll be treated as having ALT="". If MAKE_LINKS_FOR_ALL_IMAGES * is defined or toggled to TRUE, however, the pseudo-ALTs will be created * for inlines, so that they can be used as links to the SRCs. - * See also VERBOSE_IMAGES flag. * * The default defined here can be changed in lynx.cfg, and the user can * use LYK_INLINE_TOGGLE to toggle the feature on or off at run time. @@ -1188,7 +1174,7 @@ /******************************** * These definitions specify files created or used in conjunction - * with traversals. See CRAWL.ANNOUNCE for more information. + * with traversals. See CRAWL.ANNOUNCE for more infomation. */ #define TRAVERSE_FILE "traverse.dat" #define TRAVERSE_FOUND_FILE "traverse2.dat" @@ -1197,7 +1183,7 @@ /**************************************************************** * The LYMessages_en.h header defines default, English strings - * used in status line prompts, messages, and warnings during + * used in statusline prompts, messages, and warnings during * program execution. See the comments in LYMessages_en.h for * information on translating or customizing them for your site. */ @@ -1216,15 +1202,7 @@ * the version definition with the Project Version on checkout. Just * ignore it. - kw */ /* $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$ */ -#define LYNX_VERSION "2.8.1rel.2" -#define LYNX_WWW_HOME "http://lynx.browser.org/" -#define LYNX_WWW_DIST "http://www.slcc.edu/lynx/current/" -#define LYNX_RELEASE TRUE -/* $Format: "#define LYNX_DATE \"$ProjectDate$\""$ */ -#define LYNX_DATE "Tue, 27 Oct 1998 19:08:12 -0700" -#define LYNX_DATE_OFF 5 /* truncate the automatically-generated date */ -#define LYNX_DATE_LEN 11 /* truncate the automatically-generated date */ -#define LYNX_RELEASE_DATE "1998" +#define LYNX_VERSION "2.8.1dev.4" #ifndef MAXINT #define MAXINT 2147483647 /* max integer */ @@ -1246,7 +1224,7 @@ #define MAXCHARSETSP 61 /* always one more than MAXCHARSETS */ /* Win32 may support more, but old win16 helper apps may not. */ -#if defined(__DJGPP__) || defined(_WINDOWS) +#if defined(__DJGPP__) && defined(_WINDOWS) #define FNAMES_8_3 #endif @@ -1266,17 +1244,13 @@ #else #ifdef DOSPATH -/* Something has to be defined for this or we don't compile. */ -#define SYSTEM_MAIL "sendmail" -#define SYSTEM_MAIL_FLAGS "-t -oi" /* ** Following executables may be sought from your PATH at run-time. -** To get those programs look for GNU-port stuff elsewhere. Currently, -** if compiled with -DUSE_ZLIB and without -DDIRED_SUPPORT (default), -** you need only "cp.exe" from the list below. +** To get those programs look for GNU-port stuff elsewhere. +** Currently, if compiled with -DUSE_ZLIB (default), you need only "cp" ** -** WINDOWS/DOS -** =========== +** WINDOWS +** =========== */ #define COMPRESS_PATH "compress" #define UNCOMPRESS_PATH "uncompress" @@ -1286,6 +1260,11 @@ #define INSTALL_PATH "install" #define TAR_PATH "tar" #define TOUCH_PATH "touch" + +/* +** WINDOWS/DOS +** =========== +*/ #define ZIP_PATH "zip" #define UNZIP_PATH "unzip" #define MKDIR_PATH "mkdir" @@ -1295,11 +1274,7 @@ #define CHMOD_PATH "chmod" #else /* Unix */ - /* Standard locations are defined via the configure script. When - * helper applications are in your home directory or other nonstandard - * locations, you probably will have to preset the path to them with - * environment variables (see INSTALLATION, Section II-1d). - */ + /* this is done via the configure script */ #endif /* DOSPATH */ #endif /* VMS */ diff --git a/utils/lpansi/lpansi.c b/utils/lpansi/lpansi.c new file mode 100644 index 00000000..4ea10e4f --- /dev/null +++ b/utils/lpansi/lpansi.c @@ -0,0 +1,160 @@ +/******************************************************** + * lpansi.c * + * Original author: Gary Day, 11/30/93 * + * Current version: 2.1 by Noel Hunter, 10/20/94 * + * * + * Basic structure based on print -- format files for * + * printing from _Pratical_C_Programming by Steve * + * Oualline, O'Reilly & Associates * + ********************************************************/ +#include <stdio.h> +#include <stdlib.h> /* ANSI Standard only */ +#include <string.h> +#ifdef VMS +#include <unixio.h> +#include <unixlib.h> +#endif /* VMS */ + +int verbose = 0; /* verbose mode (default = false) */ +int formfeed = 1; /* form feed mode (default = true) */ +char *program_name; /* name of the program (for errors) */ + +/* Ansi C function prototypes */ +void ansi_printer_on(void); +void ansi_printer_off(void); +int main(int argc, char *argv[]); + +main(int argc, char *argv[]) +{ + void do_file(char *); /* print a file */ + void usage(void); /* tell user how to use the program */ + + /* save the program name for future use */ + program_name = argv[0]; + + /* + * loop for each option. + * Stop if we run out of arguments + * or we get an argument without a dash. + */ + while ((argc > 1) && (argv[1][0] == '-')) { + /* + * argv[1][1] is the actual option character. + */ + switch (argv[1][1]) { + /* + * -v verbose + */ + case 'v': + verbose = 1; + (void)printf("VERBOSE mode ON\n"); + break; + case 'f': + formfeed = 0; + break; + default: + (void)fprintf(stderr,"Bad option %s\n", argv[1]); + usage(); + } + /* + * move the argument list up one + * move the count down one + */ + argv++; + argc--; + } + + /* + * At this point all the options have been processed. + * Check to see if we have no files in the list + * and if so, we need to process just standard in. + */ + if (argc == 1) { + do_file("stdin"); + } else { + while (argc > 1) { + do_file(argv[1]); + argv++; + argc--; + } + } + return (0); +} +/******************************************************** + * do_file -- send a file to the printer * + * * + * Parameter * + * name -- name of the file to print * + ********************************************************/ +void do_file(char *name) +{ + int ch; /* Where we store our characters */ + FILE *fp; /* File pointer */ + + if ( verbose == 1 ) (void)printf("Processing: %s\n", name); + + ansi_printer_on(); + + if ( strcmp(name,"stdin") == 0 ) + { + while ((ch=getc(stdin))!=EOF) + { + putc(ch,stdout); + } + } + else /* Reading from a file */ + { + if ((fp=fopen(name, "r"))==NULL) + { + printf("Can't open %s\n",name); + exit(1); + } + while ((ch=getc(fp))!=EOF) + { + putc(ch,stdout); + } + fclose(fp); + } + + if ( formfeed == 1 ) + { + printf("\n\x0C"); /* Do a form feed at the end of the document */ + } + + ansi_printer_off(); + + if ( verbose == 1 ) (void)printf("Finished processing: %s\n", name); + +} + +/******************************************************** + * usage -- tell the user how to use this program and * + * exit * + ********************************************************/ +void usage(void) +{ + (void)fprintf(stderr,"Usage is %s [options] [file-list]\n", + program_name); + (void)fprintf(stderr,"Options\n"); + (void)fprintf(stderr," -f form feed OFF\n"); + (void)fprintf(stderr," -v verbose\n"); + exit (1); +} + +/******************************************************** + * Send a printer on escape sequence * + *******************************************************/ +void ansi_printer_on(void) +{ + if ( verbose == 1 ) (void)printf("ANSI printer ON\n"); + printf("\x1B[5i"); +} + +/******************************************************** + * Send a printer off escape sequence * + *******************************************************/ +void ansi_printer_off(void) +{ + printf("\x1B[4i"); + if ( verbose == 1 ) (void)printf("ANSI printer OFF\n"); +} |