diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2004-10-11 00:44:26 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2004-10-11 00:44:26 -0400 |
commit | ff34560f27f6cc7ba97cfc11e10973ac34735c4c (patch) | |
tree | 937595d7e6eac4873a7a0749e5c126d43d7c1c54 /WWW | |
parent | ceb4156db8546c98875607dd91a799101b02c22f (diff) | |
download | lynx-snapshots-ff34560f27f6cc7ba97cfc11e10973ac34735c4c.tar.gz |
snapshot of project "lynx", label v2-8-6dev_6
Diffstat (limited to 'WWW')
-rw-r--r-- | WWW/Library/Implementation/HTDOS.c | 10 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFTP.c | 14 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFile.c | 30 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTGopher.c | 2 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTMIME.c | 25 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTMLGen.c | 5 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTTP.c | 7 | ||||
-rw-r--r-- | WWW/Library/Implementation/HText.h | 3 |
8 files changed, 67 insertions, 29 deletions
diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c index 4c98d5cf..c5c2fb83 100644 --- a/WWW/Library/Implementation/HTDOS.c +++ b/WWW/Library/Implementation/HTDOS.c @@ -9,6 +9,10 @@ #include <LYLeaks.h> +#ifdef _WINDOWS +#include <LYGlobalDefs.h> +#endif + /* * Make a copy of the source argument in the result, allowing some extra * space so we can append directly onto the result without reallocating. @@ -100,10 +104,6 @@ char *HTDOS_slashes(char *path) */ char *HTDOS_name(char *wwwname) { -#ifdef _WINDOWS /* 1998/04/02 (Thu) 08:47:20 */ - extern char windows_drive[]; - char temp_buff[LY_MAXPATH]; -#endif static char *result = NULL; int joe; @@ -129,6 +129,8 @@ char *HTDOS_name(char *wwwname) #ifdef _WINDOWS /* 1998/04/02 (Thu) 08:59:48 */ if (LYLastPathSep(result) != NULL && !LYIsDosDrive(result)) { + char temp_buff[LY_MAXPATH]; + sprintf(temp_buff, "%.3s\\%.*s", windows_drive, (int) (sizeof(temp_buff) - 5), result); StrAllocCopy(result, temp_buff); diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c index c017aebf..6770079c 100644 --- a/WWW/Library/Implementation/HTFTP.c +++ b/WWW/Library/Implementation/HTFTP.c @@ -1386,6 +1386,7 @@ static void set_years_and_date(void) typedef struct _EntryInfo { char *filename; + char *linkname; char *type; char *date; unsigned int size; @@ -1396,6 +1397,7 @@ static void free_entryinfo_struct_contents(EntryInfo *entry_info) { if (entry_info) { FREE(entry_info->filename); + FREE(entry_info->linkname); FREE(entry_info->type); FREE(entry_info->date); } @@ -1646,6 +1648,7 @@ static void parse_dls_line(char *line, cps = LYSkipBlanks(&line[23]); if (!strncmp(cps, "-> ", 3) && cps[3] != '\0' && cps[3] != ' ') { StrAllocCopy(entry_info->type, gettext("Symbolic Link")); + StrAllocCopy(entry_info->linkname, LYSkipBlanks(cps + 3)); entry_info->size = 0; /* don't display size */ } @@ -2154,6 +2157,7 @@ static EntryInfo *parse_dir_entry(char *entry, if (entry_info == NULL) outofmem(__FILE__, "parse_dir_entry"); entry_info->filename = NULL; + entry_info->linkname = NULL; entry_info->type = NULL; entry_info->date = NULL; entry_info->size = 0; @@ -2273,6 +2277,7 @@ static EntryInfo *parse_dir_entry(char *entry, if (i > 3) { entry[i - 3] = '\0'; len = i - 3; + StrAllocCopy(entry_info->linkname, LYSkipBlanks(entry + i)); } } /* link */ @@ -2811,7 +2816,7 @@ static int read_directory(HTParentAnchor *parent, int name_len, dot_len; #define FNAME_WIDTH 30 -#define FILE_GAP 2 +#define FILE_GAP 1 #endif HTBTElement *ele; @@ -2841,13 +2846,13 @@ static int read_directory(HTParentAnchor *parent, #ifdef SH_EX /* 1997/10/18 (Sat) 16:00 */ name_len = strlen(entry_info->filename); - sprintf(name_buff, "%-30s", entry_info->filename); + sprintf(name_buff, "%-*s", FNAME_WIDTH, entry_info->filename); if (name_len < FNAME_WIDTH) { dot_len = FNAME_WIDTH - FILE_GAP - name_len; if (dot_len > 0) { p = name_buff + name_len + 1; - while (dot_len--) + while (dot_len-- > 0) *p++ = '.'; } } else { @@ -2877,6 +2882,9 @@ static int read_directory(HTParentAnchor *parent, entry_info->size / 1024); #endif PUTS(string_buffer); + } else if (entry_info->linkname != 0) { + PUTS(" -> "); + PUTS(entry_info->linkname); } PUTC('\n'); /* end of this entry */ diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c index e5f6d77d..bf10952f 100644 --- a/WWW/Library/Implementation/HTFile.c +++ b/WWW/Library/Implementation/HTFile.c @@ -1696,6 +1696,11 @@ static int print_local_dir(DIR *dp, char *localname, BOOL need_parent_link = FALSE; int status; int i; + struct stat *actual_info; + +#ifdef S_IFLNK + struct stat link_info; +#endif CTRACE((tfp, "print_local_dir() started\n")); @@ -1796,22 +1801,37 @@ static int print_local_dir(DIR *dp, char *localname, StrAllocCat(tmpfilename, dirbuf->d_name); data = (DIRED *) malloc(sizeof(DIRED) + strlen(dirbuf->d_name) + 4); if (data == NULL) { - /* FIXME */ + status = HT_PARTIAL_CONTENT; + break; } LYTrimPathSep(tmpfilename); - if (lstat(tmpfilename, &(data->file_info)) < 0) - data->file_info.st_mode = 0; + + actual_info = &(data->file_info); +#ifdef S_IFLNK + if (lstat(tmpfilename, actual_info) < 0) { + actual_info->st_mode = 0; + } else { + if (S_ISLNK(actual_info->st_mode)) { + actual_info = &link_info; + if (stat(tmpfilename, actual_info) < 0) + actual_info->st_mode = 0; + } + } +#else + if (stat(tmpfilename, actual_info) < 0) + actual_info->st_mode = 0; +#endif strcpy(data->file_name, dirbuf->d_name); #ifndef DIRED_SUPPORT - if (S_ISDIR(data->file_info.st_mode)) { + if (S_ISDIR(actual_info->st_mode)) { data->sort_tags = 'D'; } else { data->sort_tags = 'F'; /* D & F to have first directories, then files */ } #else - if (S_ISDIR(data->file_info.st_mode)) { + if (S_ISDIR(actual_info->st_mode)) { if (dir_list_style == MIXED_STYLE) { data->sort_tags = ' '; LYAddPathSep0(data->file_name); diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index 9489e7c2..b98025b2 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -77,8 +77,6 @@ #define END(e) (*targetClass.end_element)(target, e, 0) #define FREE_TARGET (*targetClass._free)(target) -#define GOPHER_PROGRESS(foo) HTAlert(foo) - #define NEXT_CHAR HTGetCharacter() /* diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c index 3ebd5c3b..efa54e4e 100644 --- a/WWW/Library/Implementation/HTMIME.c +++ b/WWW/Library/Implementation/HTMIME.c @@ -155,11 +155,11 @@ void HTMIME_TrimDoubleQuotes(char *value) int i; char *cp = value; - if (!(cp && *cp) || *cp != '\"') + if (!(cp && *cp) || *cp != '"') return; i = strlen(cp); - if (cp[(i - 1)] != '\"') + if (cp[(i - 1)] != '"') return; else cp[(i - 1)] = '\0'; @@ -219,10 +219,10 @@ static int pumpData(HTStream *me) int chndl; cp2 += 7; - while (*cp2 == ' ' || *cp2 == '=' || *cp2 == '\"') + while (*cp2 == ' ' || *cp2 == '=' || *cp2 == '"') cp2++; StrAllocCopy(cp3, cp2); /* copy to mutilate more */ - for (cp4 = cp3; (*cp4 != '\0' && *cp4 != '\"' && + for (cp4 = cp3; (*cp4 != '\0' && *cp4 != '"' && *cp4 != ';' && *cp4 != ':' && !WHITE(*cp4)); cp4++) ; /* do nothing */ *cp4 = '\0'; @@ -255,6 +255,17 @@ static int pumpData(HTStream *me) UCT_STAGE_MIME, UCT_SETBY_DEFAULT); } + } else { + /* + * Something like 'big5' - we cannot translate it, but + * the user may still be able to navigate the links. + */ + *cp1 = '\0'; + me->format = HTAtom_for(cp); + StrAllocCopy(me->anchor->charset, cp4); + HTAnchor_setUCInfoStage(me->anchor, chndl, + UCT_STAGE_MIME, + UCT_SETBY_MIME); } if (chartrans_ok) { LYUCcharset *p_in = @@ -623,9 +634,9 @@ static int dispatchField(HTStream *me) if (*cp == '\0') break; StrAllocCopy(me->anchor->SugFname, cp); - if (*me->anchor->SugFname == '\"') { + if (*me->anchor->SugFname == '"') { if ((cp = strchr((me->anchor->SugFname + 1), - '\"')) != NULL) { + '"')) != NULL) { *(cp + 1) = '\0'; HTMIME_TrimDoubleQuotes(me->anchor->SugFname); } else { @@ -749,7 +760,7 @@ static int dispatchField(HTStream *me) * double-quotes. - FM */ for (i = 0, j = 0; me->value[i]; i++) { - if (me->value[i] != ' ' && me->value[i] != '\"') { + if (me->value[i] != ' ' && me->value[i] != '"') { me->value[j++] = (char) TOLOWER(me->value[i]); } } diff --git a/WWW/Library/Implementation/HTMLGen.c b/WWW/Library/Implementation/HTMLGen.c index c0821dee..361c47fc 100644 --- a/WWW/Library/Implementation/HTMLGen.c +++ b/WWW/Library/Implementation/HTMLGen.c @@ -34,6 +34,7 @@ #endif #include <LYGlobalDefs.h> +#include <LYCurses.h> #include <LYLeaks.h> #define PUTC(c) (*me->targetClass.put_character)(me->target, c) @@ -623,8 +624,6 @@ static const HTStructuredClass HTMLGeneration = /* As opposed to print etc */ /* Subclass-specific Methods * ------------------------- */ -extern int LYcols; /* LYCurses.h, set in LYMain.c */ - HTStructured *HTMLGenerator(HTStream *output) { HTStructured *me = (HTStructured *) malloc(sizeof(*me)); @@ -655,7 +654,7 @@ HTStructured *HTMLGenerator(HTStream *output) } else if (dump_output_immediately) { me->buffer_maxchars = 80; /* try to honor -width - kw */ } else { - me->buffer_maxchars = LYcols - 2; + me->buffer_maxchars = (LYcolLimit - 1); if (me->buffer_maxchars < 38) /* too narrow, let GridText deal */ me->buffer_maxchars = 40; } diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index 7aa30de8..ab12eb2b 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -46,9 +46,6 @@ struct _HTStream { HTStreamClass *isa; }; -extern char *HTAppName; /* Application name: please supply */ -extern char *HTAppVersion; /* Application version: please supply */ - BOOL reloading = FALSE; /* Reloading => send no-cache pragma to proxy */ char *redirecting_url = NULL; /* Location: value. */ BOOL permanent_redirection = FALSE; /* Got 301 status? */ @@ -345,7 +342,7 @@ static void strip_userid(char *host) if ((fake = HTParse(host, "", PARSE_HOST)) != NULL) { char *msg = NULL; - CTRACE((tfp, "FIXME:%s\n", fake)); + CTRACE((tfp, "parsed:%s\n", fake)); HTSprintf0(&msg, gettext("Address contains a username: %s"), host); HTAlert(msg); FREE(msg); @@ -1898,7 +1895,7 @@ static int HTLoadHTTP(const char *arg, format_out, sink, anAnchor); - if (!target || target == NULL) { + if (target == NULL) { char *buffer = NULL; HTTP_NETCLOSE(s, handle); diff --git a/WWW/Library/Implementation/HText.h b/WWW/Library/Implementation/HText.h index 8a87cc1c..08e91a10 100644 --- a/WWW/Library/Implementation/HText.h +++ b/WWW/Library/Implementation/HText.h @@ -29,6 +29,9 @@ typedef CHyperText HText; extern HText *HTMainText; /* Pointer to current main text */ extern HTParentAnchor *HTMainAnchor; /* Pointer to current text's anchor */ +extern char *HTAppName; /* Application name */ +extern char *HTAppVersion; /* Application version */ + /* Creation and deletion |