aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-12-26 21:00:40 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1998-12-26 21:00:40 -0500
commit8bccca15371c1bee770ef51f389a915b4ef4e417 (patch)
tree52275b2b26bb0ca082da6db8c9534f744589c2a0
parent152e034b54f203f5b53ef44a70c57834b7b66137 (diff)
downloadlynx-snapshots-8bccca15371c1bee770ef51f389a915b4ef4e417.tar.gz
snapshot of project "lynx", label v2-8-2dev_12
-rw-r--r--CHANGES17
-rw-r--r--WWW/Library/Implementation/HTDOS.c92
-rw-r--r--WWW/Library/Implementation/HTVMSUtils.c2
-rw-r--r--lynx_help/Lynx_users_guide.html4
-rw-r--r--src/HTML.c5
-rw-r--r--src/LYCgi.c76
-rw-r--r--src/LYEdit.c92
-rw-r--r--src/LYEditmap.c2
-rw-r--r--src/LYLocal.c24
-rw-r--r--src/LYMain.c4
-rw-r--r--src/LYMainLoop.c4
-rw-r--r--src/LYStrings.c80
-rw-r--r--src/LYStrings.h4
-rw-r--r--userdefs.h4
14 files changed, 265 insertions, 145 deletions
diff --git a/CHANGES b/CHANGES
index fd62ffb2..500d656f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,23 @@
Changes since Lynx 2.8.1 release
================================================================================
+1998-12-26 (2.8.2dev.12)
+* use HTSprintf0 in LYCgi.c - TD
+* add tab-completion on URL's, by using previously-entered strings for
+ matching (patch by Kari Davidsson <karid@loki.midheimar>) - TD
+* add version number to trace log (patch by IC)
+* modify HTDOS_name to be consistent with HTVMS_name, which does not modify
+ its parameter (reported by LP). Also, modify HTDOS_name and HTDOS_wwwName
+ so they allocate space for the result rather than using a static buffer - TD
+* modify LYEdit.c to use HTAddParam - TD
+* make HREF/NAME for "Environment" consistent in Lynx_users_guide.html
+ (reported by LP)
+* correct DOS/EMX logic in LYEdit.c which incremented 'filename' pointer when
+ its length was greater than 1 rather than recopying the string, causing a
+ core dump when 'filename' was freed (reported by LP, this applies to
+ 2.8.1rel.2) - TD
+* correct sense of 'already_exists()' function from dev.11, which caused
+ various file-menu operations to stop working (reported by IC) - TD
1998-12-24 (2.8.2dev.11)
* use HTSprintf/HTSprintf0 in about half of the WWW library files where
applicable: HTAABrow.c HTAAServ.c HTAAUtil.c HTAccess.c HTAnchor.c HTDOS.c
diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c
index df506cd2..f6697249 100644
--- a/WWW/Library/Implementation/HTDOS.c
+++ b/WWW/Library/Implementation/HTDOS.c
@@ -5,6 +5,18 @@
#include <HTUtils.h>
#include <HTDOS.h>
+/*
+ * Make a copy of the source argument in the result, allowing some extra
+ * space so we can append directly onto the result without reallocating.
+ */
+PRIVATE char * copy_plus ARGS2(char **, result, char *, source)
+{
+ int length = strlen(source);
+ HTSprintf0(result, "%-*s", length+10, source);
+ (*result)[length] = 0;
+ return (*result);
+}
+
/* PUBLIC HTDOS_wwwName()
** CONVERTS DOS Name into WWW Name
** ON ENTRY:
@@ -16,29 +28,22 @@
*/
char * HTDOS_wwwName ARGS1(char *, dosname)
{
- static char wwwname[1024];
- char *cp_url = wwwname;
-
- strcpy(wwwname,dosname);
+ static char *wwwname;
+ char *cp_url = copy_plus(&wwwname, dosname);
- for ( ; *cp_url != '\0' ; cp_url++)
- if(*cp_url == '\\') *cp_url = '/'; /* convert dos backslash to unix-style */
+ for ( ; *cp_url != '\0' ; cp_url++)
+ if(*cp_url == '\\')
+ *cp_url = '/'; /* convert dos backslash to unix-style */
- if(strlen(wwwname) > 3 && *cp_url == '/')
- *cp_url = '\0';
+ if(strlen(wwwname) > 3 && *cp_url == '/')
+ *cp_url = '\0';
- if(*cp_url == ':')
- {
- cp_url++;
- *cp_url = '/';
- }
+ if(*cp_url == ':') {
+ cp_url++;
+ *cp_url = '/';
+ }
-/*
- if((strlen(wwwname)>2)&&(wwwname[1]==':')) wwwname[1]='|';
- printf("\n\nwww: %s\n\ndos: %s\n\n",wwwname,dosname);
- sleep(5);
-*/
- return(wwwname);
+ return(wwwname);
}
@@ -49,41 +54,36 @@ char * HTDOS_wwwName ARGS1(char *, dosname)
**
** ON EXIT:
** returns DOS file specification
-**
-** Bug(?): Returns pointer to input string, which is modified
*/
char * HTDOS_name ARGS1(char *, wwwname)
{
- static char cp_url[1024];
- int joe;
+ static char *cp_url;
+ char *result;
+ int joe;
- memset(cp_url, 0, 1023);
- sprintf(cp_url, "%s",wwwname);
+ copy_plus(&cp_url, wwwname);
- for(joe = 0; cp_url[joe] != '\0'; joe++) {
- if(cp_url[joe] == '/') {
- cp_url[joe] = '\\';
- }
+ for (joe = 0; cp_url[joe] != '\0'; joe++) {
+ if (cp_url[joe] == '/') {
+ cp_url[joe] = '\\';
}
+ }
- /* Needed to surf the root of a local drive. */
+ /* Needed to surf the root of a local drive. */
- if(strlen(cp_url) < 4) cp_url[2] = ':';
- if(strlen(cp_url) == 3) cp_url[3] = '\\';
- if(strlen(cp_url) == 4) cp_url[4] = '.';
+ if(strlen(cp_url) < 4) cp_url[2] = ':';
+ if(strlen(cp_url) == 3) strcpy(cp_url+3, "\\");
+ if(strlen(cp_url) == 4) strcpy(cp_url+4, ".");
- if((strlen(cp_url) > 2) && (cp_url[1] == '|'))
- cp_url[1] = ':';
+ if((strlen(cp_url) > 2) && (cp_url[1] == '|'))
+ cp_url[1] = ':';
- if((cp_url[1] == '\\') || (cp_url[0] != '\\'))
- {
- CTRACE(tfp, "HTDOS_name changed `%s' to `%s'\n",
- wwwname, cp_url);
- strcpy(wwwname, cp_url); /* return(cp_url); */
- } else {
- CTRACE(tfp, "HTDOS_name changed `%s' to `%s'\n",
- wwwname, cp_url+1);
- strcpy(wwwname, cp_url+1); /* return(cp_url+1); */
- }
- return (wwwname);
+ if((cp_url[1] == '\\') || (cp_url[0] != '\\')) {
+ result = cp_url;
+ } else {
+ result = cp_url+1;
+ }
+
+ CTRACE(tfp, "HTDOS_name changed `%s' to `%s'\n", wwwname, result);
+ return (result);
}
diff --git a/WWW/Library/Implementation/HTVMSUtils.c b/WWW/Library/Implementation/HTVMSUtils.c
index 7c599386..ae103082 100644
--- a/WWW/Library/Implementation/HTVMSUtils.c
+++ b/WWW/Library/Implementation/HTVMSUtils.c
@@ -33,8 +33,6 @@
#include <LYUtils.h>
#include <LYLeaks.h>
-#define FREE(x) if (x) {free(x); x = NULL;}
-
#define INFINITY 512 /* File name length @@ FIXME */
PUBLIC BOOL HTVMSFileVersions=FALSE; /* Include version numbers in listing? */
diff --git a/lynx_help/Lynx_users_guide.html b/lynx_help/Lynx_users_guide.html
index eaf2a84b..b6c1fab9 100644
--- a/lynx_help/Lynx_users_guide.html
+++ b/lynx_help/Lynx_users_guide.html
@@ -2371,12 +2371,12 @@ 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="Environments"><A NAME="Environments"><em>Environments variables used by Lynx</em></A></h2>
+<h2 ID="Environments"><A NAME="Environment"><em>Environment variables used by Lynx</em></A></h2>
Lynx uses certain environment variables and sets a few of them.
Please visit a <A HREF="keystrokes/environments.html">separate page</A>
for this rather technical information.
-[<A HREF="#ToC-Environments">ToC</A>]
+[<A HREF="#ToC-Environment">ToC</A>]
<h2 ID="lynx.cfg"><A NAME="lynx.cfg"><em>Main configuration file lynx.cfg</em></A></h2>
diff --git a/src/HTML.c b/src/HTML.c
index fa12456d..cd7dac93 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -1126,8 +1126,8 @@ PRIVATE void HTML_start_element ARGS6(
if (present && present[HTML_LINK_CLASS] &&
value && *value[HTML_LINK_CLASS]!='\0')
{
- char tmp[1024];
- sprintf(tmp, "link.%s.%s.%s", value[HTML_LINK_CLASS], title, value[HTML_LINK_CLASS]);
+ char *tmp = 0;
+ HTSprintf0(&tmp, "link.%s.%s.%s", value[HTML_LINK_CLASS], title, value[HTML_LINK_CLASS]);
CTRACE(tfp, "CSSTRIM:link=%s\n", tmp);
HText_characterStyle(me->text, hash_code(tmp), 1);
@@ -1136,6 +1136,7 @@ PRIVATE void HTML_start_element ARGS6(
HTML_put_string(me, value[HTML_LINK_CLASS]);
HTML_put_string(me, ")");
HText_characterStyle(me->text, hash_code(tmp), 0);
+ FREE(tmp);
}
else
#endif
diff --git a/src/LYCgi.c b/src/LYCgi.c
index 4ad5f376..e939d308 100644
--- a/src/LYCgi.c
+++ b/src/LYCgi.c
@@ -59,8 +59,10 @@ PRIVATE char **env = NULL; /* Environment variables */
PRIVATE int envc_size = 0; /* Slots in environment array */
PRIVATE int envc = 0; /* Slots used so far */
#ifdef LYNXCGI_LINKS
-PRIVATE char user_agent[64];
-PRIVATE char server_software[64];
+PRIVATE char *user_agent;
+PRIVATE char *server_software;
+PRIVATE char *accept_language;
+PRIVATE char *post_len;
#endif /* LYNXCGI_LINKS */
PRIVATE void add_environment_value PARAMS((char *env_value));
@@ -311,9 +313,12 @@ PRIVATE int LYLoadCGI ARGS4(
sink, anAnchor);
if (!target || target == NULL) {
- sprintf(buf, CANNOT_CONVERT_I_TO_O,
- HTAtom_name(format_in), HTAtom_name(format_out));
- HTAlert(buf);
+ char *tmp = 0;
+ HTSprintf0(&tmp, CANNOT_CONVERT_I_TO_O,
+ HTAtom_name(format_in),
+ HTAtom_name(format_out));
+ HTAlert(tmp);
+ FREE(tmp);
status = HT_NOT_LOADED;
} else if (anAnchor->post_data && pipe(fd1) < 0) {
@@ -341,11 +346,11 @@ PRIVATE int LYLoadCGI ARGS4(
add_environment_value("REMOTE_HOST=localhost");
add_environment_value("REMOTE_ADDR=127.0.0.1");
- sprintf(user_agent, "HTTP_USER_AGENT=%s/%s libwww/%s",
+ HTSprintf0(&user_agent, "HTTP_USER_AGENT=%s/%s libwww/%s",
LYNX_NAME, LYNX_VERSION, HTLibraryVersion);
add_environment_value(user_agent);
- sprintf(server_software, "SERVER_SOFTWARE=%s/%s",
+ HTSprintf0(&server_software, "SERVER_SOFTWARE=%s/%s",
LYNX_NAME, LYNX_VERSION);
add_environment_value(server_software);
}
@@ -423,10 +428,8 @@ PRIVATE int LYLoadCGI ARGS4(
} else if (pid == 0) { /* The Bad, */
char **argv = NULL;
- char post_len[32];
int argv_cnt = 3; /* name, one arg and terminator */
char **cur_argv = NULL;
- char buf2[BUFSIZ];
/* Set up output pipe */
close(fd2[0]);
@@ -434,10 +437,8 @@ 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);
+ HTSprintf0(&accept_language, "HTTP_ACCEPT_LANGUAGE=%s", language);
+ add_environment_value(accept_language);
if (pref_charset) {
cp = NULL;
@@ -463,7 +464,7 @@ PRIVATE int LYLoadCGI ARGS4(
add_environment_value("REQUEST_METHOD=POST");
- sprintf(post_len, "CONTENT_LENGTH=%d",
+ HTSprintf0(&post_len, "CONTENT_LENGTH=%d",
strlen(anAnchor->post_data));
add_environment_value(post_len);
} else {
@@ -582,38 +583,39 @@ PRIVATE int LYLoadCGI ARGS4(
FREE(pgm);
FREE(orig_pgm);
#else /* VMS */
- HTStream *target;
- char buf[256];
+ HTStream *target;
+ char *buf = 0;
- target = HTStreamStack(WWW_HTML,
- format_out,
- sink, anAnchor);
+ target = HTStreamStack(WWW_HTML,
+ format_out,
+ sink, anAnchor);
- sprintf(buf, "<head>\n<title>%s</title>\n</head>\n<body>\n", gettext("Good Advice"));
- (*target->isa->put_block)(target, buf, strlen(buf));
+ HTSprintf0(&buf, "<head>\n<title>%s</title>\n</head>\n<body>\n", gettext("Good Advice"));
+ (*target->isa->put_block)(target, buf, strlen(buf));
- sprintf(buf, "<h1>%s</h1>\n", gettext("Good Advice"));
- (*target->isa->put_block)(target, buf, strlen(buf));
+ HTSprintf0(&buf, "<h1>%s</h1>\n", gettext("Good Advice"));
+ (*target->isa->put_block)(target, buf, strlen(buf));
- sprintf(buf, "%s <a\n", gettext("An excellent http server for VMS is available via"));
- (*target->isa->put_block)(target, buf, strlen(buf));
+ HTSprintf0(&buf, "%s <a\n", gettext("An excellent http server for VMS is available via"));
+ (*target->isa->put_block)(target, buf, strlen(buf));
- sprintf(buf,
- "href=\"http://kcgl1.eng.ohio-state.edu/www/doc/serverinfo.html\"\n");
- (*target->isa->put_block)(target, buf, strlen(buf));
+ HTSprintf0(&buf,
+ "href=\"http://kcgl1.eng.ohio-state.edu/www/doc/serverinfo.html\"\n");
+ (*target->isa->put_block)(target, buf, strlen(buf));
- sprintf(buf, ">%s</a>.\n", gettext("this link"));
- (*target->isa->put_block)(target, buf, strlen(buf));
+ HTSprintf0(&buf, ">%s</a>.\n", gettext("this link"));
+ (*target->isa->put_block)(target, buf, strlen(buf));
- sprintf(buf, "<p>%s\n",
- gettext("It provides state of the art CGI script support.\n"));
- (*target->isa->put_block)(target, buf, strlen(buf));
+ HTSprintf0(&buf, "<p>%s\n",
+ gettext("It provides state of the art CGI script support.\n"));
+ (*target->isa->put_block)(target, buf, strlen(buf));
- sprintf(buf,"</body>\n");
- (*target->isa->put_block)(target, buf, strlen(buf));
+ HTSprintf0(&buf,"</body>\n");
+ (*target->isa->put_block)(target, buf, strlen(buf));
- (*target->isa->_free)(target);
- status = HT_LOADED;
+ (*target->isa->_free)(target);
+ FREE(buf);
+ status = HT_LOADED;
#endif /* VMS */
#else /* LYNXCGI_LINKS */
HTUserMsg(CGI_NOT_COMPILED);
diff --git a/src/LYEdit.c b/src/LYEdit.c
index b05a5575..772e4fa3 100644
--- a/src/LYEdit.c
+++ b/src/LYEdit.c
@@ -15,6 +15,17 @@
#include <LYLeaks.h>
+PRIVATE BOOLEAN editor_can_position NOARGS
+{
+#ifdef VMS
+ return (strstr(editor, "sedt") || strstr(editor, "SEDT"));
+#else
+ return (strstr(editor, "emacs") || strstr(editor, "vi") ||
+ strstr(editor, "pico") || strstr(editor, "jove") ||
+ strstr(editor, "jed"));
+#endif
+}
+
/*
* In edit mode invoke either emacs, vi, pico, jove, jed sedt or the
* default editor to display and edit the current file.
@@ -27,9 +38,13 @@ PUBLIC int edit_current_file ARGS3(
int, cur,
int, lineno)
{
- char command[512];
+ int result = FALSE;
+ int params = 1;
+ char *format = "%s %s";
+ char *command = NULL;
char *filename = NULL;
char *colon, *number_sign;
+ char position[80];
FILE *fp;
/*
@@ -63,13 +78,16 @@ PUBLIC int edit_current_file ARGS3(
filename = HTParse(newfile, "", PARSE_PATH+PARSE_PUNCTUATION);
HTUnEscape(filename);
#if defined (DOSPATH) || defined (__EMX__)
- if (strlen(filename)>1) filename++;
+ if (strlen(filename) > 1) { /* FIXME: why do we need to do this? */
+ int n;
+ for (n = 0; (filename[n] = filename[n+1]) != 0; n++)
+ ;
+ }
#endif
if ((fp = fopen(HTSYS_name(filename), "r")) == NULL)
{
HTAlert(COULD_NOT_ACCESS_FILE);
- FREE(filename);
- goto failure;
+ goto done;
}
#if !defined (VMS) && !defined (DOSPATH) && !defined (__EMX__)
}
@@ -83,7 +101,7 @@ PUBLIC int edit_current_file ARGS3(
if ((fp = fopen(HTSYS_name(filename), "a")) == NULL)
{
HTUserMsg(NOAUTH_TO_EDIT_FILE);
- goto failure;
+ goto done;
}
fclose(fp);
#endif /* VMS || CANT_EDIT_UNWRITABLE_FILES */
@@ -98,36 +116,36 @@ PUBLIC int edit_current_file ARGS3(
/*
* Set up the command for the editor. - FM
*/
+ *position = 0;
+#ifdef VMS
+ lineno--;
+#endif
+ lineno += (nlinks ? links[cur].ly : 0);
+ if (lineno > 0)
+ sprintf(position, "%d", lineno);
+
+ if (editor_can_position() && *position) {
#ifdef VMS
- if ((strstr(editor, "sedt") || strstr(editor, "SEDT")) &&
- ((lineno - 1) + (nlinks ? links[cur].ly : 0)) > 0) {
- sprintf(command, "%s %s -%d",
- editor,
- HTVMS_name("", filename),
- ((lineno - 1) + (nlinks ? links[cur].ly : 0)));
+ format = "%s %s -%s";
+ HTAddParam(&command, format, params++, editor);
+ HTAddParam(&command, format, params++, HTVMS_name("", filename));
+ HTAddParam(&command, format, params++, position);
+ HTEndParam(&command, format, params);
+#else
+ format = "%s +%s %s";
+ HTAddParam(&command, format, params++, editor);
+ HTAddParam(&command, format, params++, position);
+ HTAddParam(&command, format, params++, HTSYS_name(filename));
+ HTEndParam(&command, format, params);
+#endif
} else {
- sprintf(command, "%s %s", editor, HTVMS_name("", filename));
+ HTAddParam(&command, format, params++, editor);
+ HTAddParam(&command, format, params++, HTSYS_name(filename));
+ HTEndParam(&command, format, params);
}
-#else
- if (strstr(editor, "emacs") || strstr(editor, "vi") ||
- strstr(editor, "pico") || strstr(editor, "jove") ||
- strstr(editor, "jed"))
- sprintf(command, "%s +%d \"%s\"",
- editor,
- (lineno + (nlinks ? links[cur].ly : 0)),
- HTSYS_name(filename));
- else
-#ifdef __DJGPP__
- sprintf(command, "%s %s", editor, HTDOS_name(filename));
-#else
- sprintf(command, "%s \"%s\"", editor, HTSYS_name(filename));
-#endif /* __DJGPP__ */
-#endif /* VMS */
+
CTRACE(tfp, "LYEdit: %s\n", command);
CTRACE_SLEEP(MessageSecs);
-#ifndef __EMX__
- FREE(filename);
-#endif
/*
* Invoke the editor. - FM
@@ -136,18 +154,16 @@ PUBLIC int edit_current_file ARGS3(
LYSystem(command);
start_curses();
- /*
- * Restore the fragment if there was one. - FM
- */
- if (number_sign)
- *number_sign = '#';
- return TRUE;
+ result = TRUE;
-failure:
+done:
/*
* Restore the fragment if there was one. - FM
*/
if (number_sign)
*number_sign = '#';
- return FALSE;
+
+ FREE(command);
+ FREE(filename);
+ return (result);
}
diff --git a/src/LYEditmap.c b/src/LYEditmap.c
index 8ba0d65c..a7e50807 100644
--- a/src/LYEditmap.c
+++ b/src/LYEditmap.c
@@ -18,7 +18,7 @@ LYE_NOP, LYE_BOL, LYE_DELPW, LYE_ABORT,
LYE_DELN, LYE_EOL, LYE_DELNW, LYE_ABORT,
/* ^D ^E ^F ^G */
-LYE_DELP, LYE_ENTER, LYE_ENTER, LYE_LOWER,
+LYE_DELP, LYE_TAB, LYE_ENTER, LYE_LOWER,
/* bs tab nl ^K */
LYE_NOP, LYE_ENTER, LYE_FORWW, LYE_ABORT,
diff --git a/src/LYLocal.c b/src/LYLocal.c
index e873f186..8d0c2aba 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -80,7 +80,7 @@ PRIVATE int LYExecv PARAMS((
PUBLIC char LYPermitFileURL[LY_MAXPATH] = "\0";
PUBLIC char LYDiredFileURL[LY_MAXPATH] = "\0";
-PRIVATE char *filename PARAMS((
+PRIVATE char *get_filename PARAMS((
char * prompt,
char * buf,
size_t bufsize));
@@ -309,7 +309,7 @@ PRIVATE int move_file ARGS2(char *, source, char *, target)
return code;
}
-PRIVATE BOOLEAN already_exists ARGS1(char *, name)
+PRIVATE BOOLEAN not_already_exists ARGS1(char *, name)
{
struct stat dir_info;
@@ -585,7 +585,7 @@ PRIVATE BOOLEAN modify_name ARGS1(
} else {
return ok_file_or_dir(&dir_info);
}
- if (filename(cp, tmpbuf, sizeof(tmpbuf)) == NULL)
+ if (get_filename(cp, tmpbuf, sizeof(tmpbuf)) == NULL)
return 0;
/*
@@ -603,7 +603,7 @@ PRIVATE BOOLEAN modify_name ARGS1(
/*
* Make sure the destination does not already exist.
*/
- if (!already_exists(newpath)) {
+ if (not_already_exists(newpath)) {
return move_file(savepath, newpath);
}
}
@@ -646,7 +646,7 @@ PRIVATE BOOLEAN modify_location ARGS1(
} else {
return ok_file_or_dir(&dir_info);
}
- if (filename(cp, tmpbuf, sizeof(tmpbuf)) == NULL)
+ if (get_filename(cp, tmpbuf, sizeof(tmpbuf)) == NULL)
return 0;
if (strlen(tmpbuf)) {
strcpy(savepath, testpath);
@@ -781,8 +781,8 @@ PRIVATE BOOLEAN create_file ARGS1(
char *args[5];
char *bad_chars = ".~/";
- if (filename(gettext("Enter name of file to create: "),
- tmpbuf, sizeof(tmpbuf)) == NULL) {
+ if (get_filename(gettext("Enter name of file to create: "),
+ tmpbuf, sizeof(tmpbuf)) == NULL) {
return code;
}
@@ -804,7 +804,7 @@ PRIVATE BOOLEAN create_file ARGS1(
/*
* Make sure the target does not already exist
*/
- if (!already_exists(testpath)) {
+ if (not_already_exists(testpath)) {
char *msg = 0;
HTSprintf(&msg,gettext("create %s"),testpath);
args[0] = "touch";
@@ -829,8 +829,8 @@ PRIVATE BOOLEAN create_directory ARGS1(
char *args[5];
char *bad_chars = ".~/";
- if (filename(gettext("Enter name for new directory: "),
- tmpbuf, sizeof(tmpbuf)) == NULL) {
+ if (get_filename(gettext("Enter name for new directory: "),
+ tmpbuf, sizeof(tmpbuf)) == NULL) {
return code;
}
@@ -849,7 +849,7 @@ PRIVATE BOOLEAN create_directory ARGS1(
/*
* Make sure the target does not already exist.
*/
- if (!already_exists(testpath)) {
+ if (not_already_exists(testpath)) {
char *msg = 0;
HTSprintf(&msg,"make directory %s",testpath);
args[0] = "mkdir";
@@ -1744,7 +1744,7 @@ PUBLIC int dired_options ARGS2(
/*
* Check DIRED filename.
*/
-PRIVATE char *filename ARGS3(
+PRIVATE char *get_filename ARGS3(
char *, prompt,
char *, buf,
size_t, bufsize)
diff --git a/src/LYMain.c b/src/LYMain.c
index 852a9c59..9204b984 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1684,7 +1684,7 @@ PUBLIC int main ARGS2(
*/
StrAllocCopy(helpfilepath, helpfile);
if ((cp = LYPathLeaf(helpfilepath)) != helpfilepath)
- *cp = '\0';
+ *cp = '\0';
LYAddHtmlSep(&helpfilepath);
/*
@@ -1747,7 +1747,9 @@ PUBLIC int main ARGS2(
LYisConfiguredForX = TRUE;
}
ena_csi((LYlowest_eightbit[current_char_set] > 155));
+ LYOpenCloset();
status = mainloop();
+ LYCloseCloset();
cleanup();
exit(status);
}
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index bbc076c2..0994de49 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -5009,7 +5009,9 @@ check_add_bookmark_to_self:
break;
}
#endif /* VMS */
- fprintf(tfp, "\t\t%s\n\n", LYNX_TRACELOG_TITLE);
+ fprintf(tfp, "\t\t%s (%s)\n\n",
+ LYNX_TRACELOG_TITLE,
+ LYNX_VERSION);
}
HTUserMsg(WWW_TraceFlag ? TRACE_ON : TRACE_OFF);
break;
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 194d414f..71e50e28 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -25,6 +25,17 @@ extern unsigned short *LYKbLayout;
extern BOOL HTPassHighCtrlRaw;
extern HTCJKlang HTCJK;
+/*Allowing the user to press tab when entering URL to get the closest
+ match in the closet*/
+#define LYClosetSize 100
+static char* LYCloset[LYClosetSize]; /* Closet with LYClosetSize shelves */
+static int LYClosetTop = 0; /*Points to the next empty shelf */
+
+PRIVATE char *LYFindInCloset PARAMS((
+ char* base));
+PRIVATE int LYAddToCloset PARAMS((
+ char* str));
+
/* If you want to add mouse support for some new platform, it's fairly
** simple to do. Once you've determined the X and Y coordinates of
** the mouse event, loop through the elements in the links[] array and
@@ -2003,6 +2014,7 @@ PUBLIC int LYgetstr ARGS4(
int x, y, MaxStringSize;
int ch;
EditFieldData MyEdit;
+ char *res;
LYGetYX(y, x); /* Use screen from cursor position to eol */
MaxStringSize = (bufsize < sizeof(MyEdit.buffer)) ?
@@ -2025,6 +2037,7 @@ again:
#endif /* VMS */
if (recall && (ch == UPARROW || ch == DNARROW)) {
strcpy(inputline, MyEdit.buffer);
+ LYAddToCloset(MyEdit.buffer);
return(ch);
}
if (keymap[ch + 1] == LYK_REFRESH)
@@ -2033,6 +2046,17 @@ again:
case LYE_TAB:
ch = '\t';
/* fall through */
+ res = LYFindInCloset(MyEdit.buffer);
+ if (res != 0) {
+ LYEdit1(&MyEdit, '\0', LYE_ERASE, FALSE);
+ while (*res != '\0') {
+ LYLineEdit(&MyEdit, (int)(*res), FALSE);
+ res++;
+ }
+ } else {
+ ch = '\0';
+ }
+ break;
case LYE_AIX:
/*
* Hex 97.
@@ -2051,6 +2075,7 @@ again:
* Terminate the string and return.
*/
strcpy(inputline, MyEdit.buffer);
+ LYAddToCloset(MyEdit.buffer);
return(ch);
case LYE_ABORT:
@@ -2515,6 +2540,61 @@ PUBLIC char * LYno_attr_mbcs_strstr ARGS5(
return(NULL);
}
+PUBLIC void LYOpenCloset NOARGS
+{
+ /* We initialize the list-looka-like, i.e., the Closet */
+ int i = 0;
+ while(i < LYClosetSize){
+ LYCloset[i] = NULL;
+ i = i + 1;
+ }
+ LYClosetTop = 0;
+}
+
+PUBLIC void LYCloseCloset NOARGS
+{
+ int i = 0;
+
+ /* Clean up the list-looka-like, i.e., the Closet */
+ while (i < LYClosetSize){
+ FREE(LYCloset[i]);
+ i = i + 1;
+ }
+}
+
+/*
+ * Strategy: We begin at the top and search downwards. We return the first
+ * match, i.e., the newest since we search from the top. This should be made
+ * more intelligent, but works for now.
+ */
+PRIVATE char * LYFindInCloset ARGS1(char*, base)
+{
+ int shelf;
+ unsigned len = strlen(base);
+
+ shelf = (LYClosetTop - 1 + LYClosetSize) % LYClosetSize;
+
+ while (LYCloset[shelf] != NULL){
+ if (!strncmp(base, LYCloset[shelf], len)) {
+ return(LYCloset[shelf]);
+ }
+ shelf = (shelf - 1 + LYClosetSize) % LYClosetSize;
+ }
+ return(0);
+}
+
+PRIVATE int LYAddToCloset ARGS1(char*, str)
+{
+ unsigned len = strlen(str);
+
+ LYCloset[LYClosetTop] = malloc(len+1);
+ strcpy(LYCloset[LYClosetTop], str);
+
+ LYClosetTop = (LYClosetTop + 1) % LYClosetSize;
+ FREE(LYCloset[LYClosetTop]);
+ return(1);
+}
+
/*
* Allocate a new copy of a string, and returns it.
*/
diff --git a/src/LYStrings.h b/src/LYStrings.h
index 7bb6f95b..3d5d9a83 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -188,12 +188,14 @@ extern void LYSetupEdit PARAMS((
int maxdsp));
extern void LYRefreshEdit PARAMS((
EditFieldData * edit));
+extern int EditBinding PARAMS((int ch));
extern int LYEdit1 PARAMS((
EditFieldData * edit,
int ch,
int action,
BOOL maxMessage));
-
+extern void LYOpenCloset NOPARAMS;
+extern void LYCloseCloset NOPARAMS;
extern int current_lineedit;
extern char * LYLineeditNames[];
diff --git a/userdefs.h b/userdefs.h
index 13f952d1..63e019a8 100644
--- a/userdefs.h
+++ b/userdefs.h
@@ -1217,12 +1217,12 @@
* the version definition with the Project Version on checkout. Just
* ignore it. - kw */
/* $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$ */
-#define LYNX_VERSION "2.8.2dev.11"
+#define LYNX_VERSION "2.8.2dev.12"
#define LYNX_WWW_HOME "http://lynx.browser.org/"
#define LYNX_WWW_DIST "http://www.slcc.edu/lynx/current/"
#define LYNX_RELEASE FALSE
/* $Format: "#define LYNX_DATE \"$ProjectDate$\""$ */
-#define LYNX_DATE "Thu, 24 Dec 1998 04:27:23 -0700"
+#define LYNX_DATE "Sat, 26 Dec 1998 13:50:01 -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"