diff options
-rw-r--r-- | BUILD/VS2003/lynx/lynx_cfg.h | 12 | ||||
-rw-r--r-- | BUILD/VS2005X/lynx/lynx_cfg.h | 12 | ||||
-rw-r--r-- | BUILD/VS2008X/lynx/lynx_cfg.h | 12 | ||||
-rw-r--r-- | CHANGES | 7 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFormat.c | 10 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTString.c | 3 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTTCP.c | 4 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTTP.c | 7 | ||||
-rw-r--r-- | WWW/Library/Implementation/SGML.c | 4 | ||||
-rw-r--r-- | WWW/Library/Implementation/UCAux.h | 8 | ||||
-rw-r--r-- | src/GridText.c | 16 | ||||
-rw-r--r-- | src/HTAlert.c | 13 | ||||
-rw-r--r-- | src/LYCharUtils.c | 3 | ||||
-rw-r--r-- | src/LYCookie.c | 12 | ||||
-rw-r--r-- | src/LYKeymap.c | 4 | ||||
-rw-r--r-- | src/LYReadCFG.c | 4 | ||||
-rw-r--r-- | src/LYSignal.h | 4 | ||||
-rw-r--r-- | src/LYUtils.c | 4 | ||||
-rw-r--r-- | src/LYmktime.c | 11 | ||||
-rw-r--r-- | src/UCAux.c | 4 | ||||
-rw-r--r-- | src/UCdomap.c | 12 | ||||
-rw-r--r-- | src/mktime.c | 3 | ||||
-rw-r--r-- | src/parsdate.c | 317 | ||||
-rw-r--r-- | src/parsdate.y | 241 | ||||
-rw-r--r-- | src/tidy_tls.c | 4 | ||||
-rw-r--r-- | userdefs.h | 4 |
26 files changed, 346 insertions, 389 deletions
diff --git a/BUILD/VS2003/lynx/lynx_cfg.h b/BUILD/VS2003/lynx/lynx_cfg.h index da393951..5e5f25a3 100644 --- a/BUILD/VS2003/lynx/lynx_cfg.h +++ b/BUILD/VS2003/lynx/lynx_cfg.h @@ -1,4 +1,4 @@ -// $LynxId: lynx_cfg.h,v 1.4 2009/11/21 16:33:41 tom Exp $ +// $LynxId: lynx_cfg.h,v 1.5 2010/11/06 13:37:00 tom Exp $ // definitions abstracted from makefile.msc #ifndef LYNX_CFG_H @@ -6,7 +6,7 @@ #define __WIN32__ #define _WINDOWS -#define _WIN32_WINNT 0x0400 +#define _WIN32_WINNT 0x0400 #define ACCESS_AUTH 1 #define CJK_EX 1 @@ -61,8 +61,8 @@ #define FANCY_CURSES 1 #endif -#pragma warning (disable : 4244) /* conversion from 'xxx' to 'yyy', possible loss of data */ -#pragma warning (disable : 4267) /* conversion from 'xxx' to 'yyy', possible loss of data */ -#pragma warning (disable : 4311) /* 'type cast': pointer truncation from 'xxx' to 'yyy' FIXME */ +#pragma warning (disable : 4244) /* conversion from 'xxx' to 'yyy', possible loss of data */ +#pragma warning (disable : 4267) /* conversion from 'xxx' to 'yyy', possible loss of data */ +#pragma warning (disable : 4311) /* 'type cast': pointer truncation from 'xxx' to 'yyy' FIXME */ -#endif /* LYNX_CFG_H */ \ No newline at end of file +#endif /* LYNX_CFG_H */ diff --git a/BUILD/VS2005X/lynx/lynx_cfg.h b/BUILD/VS2005X/lynx/lynx_cfg.h index 5a6fe71d..1856824e 100644 --- a/BUILD/VS2005X/lynx/lynx_cfg.h +++ b/BUILD/VS2005X/lynx/lynx_cfg.h @@ -1,4 +1,4 @@ -// $LynxId: lynx_cfg.h,v 1.3 2009/11/21 16:33:41 tom Exp $ +// $LynxId: lynx_cfg.h,v 1.4 2010/11/06 13:37:00 tom Exp $ // definitions abstracted from makefile.msc #ifndef LYNX_CFG_H @@ -62,9 +62,9 @@ #define FANCY_CURSES 1 #endif -#pragma warning (disable : 4244) /* conversion from 'xxx' to 'yyy', possible loss of data */ -#pragma warning (disable : 4267) /* conversion from 'xxx' to 'yyy', possible loss of data */ -#pragma warning (disable : 4311) /* 'type cast': pointer truncation from 'xxx' to 'yyy' FIXME */ -#pragma warning (disable : 4996) /* 'xxx': This function or variable may be unsafe. Consider using yyy instead. */ +#pragma warning (disable : 4244) /* conversion from 'xxx' to 'yyy', possible loss of data */ +#pragma warning (disable : 4267) /* conversion from 'xxx' to 'yyy', possible loss of data */ +#pragma warning (disable : 4311) /* 'type cast': pointer truncation from 'xxx' to 'yyy' FIXME */ +#pragma warning (disable : 4996) /* 'xxx': This function or variable may be unsafe. Consider using yyy instead. */ -#endif /* LYNX_CFG_H */ \ No newline at end of file +#endif /* LYNX_CFG_H */ diff --git a/BUILD/VS2008X/lynx/lynx_cfg.h b/BUILD/VS2008X/lynx/lynx_cfg.h index 5a6fe71d..1856824e 100644 --- a/BUILD/VS2008X/lynx/lynx_cfg.h +++ b/BUILD/VS2008X/lynx/lynx_cfg.h @@ -1,4 +1,4 @@ -// $LynxId: lynx_cfg.h,v 1.3 2009/11/21 16:33:41 tom Exp $ +// $LynxId: lynx_cfg.h,v 1.4 2010/11/06 13:37:00 tom Exp $ // definitions abstracted from makefile.msc #ifndef LYNX_CFG_H @@ -62,9 +62,9 @@ #define FANCY_CURSES 1 #endif -#pragma warning (disable : 4244) /* conversion from 'xxx' to 'yyy', possible loss of data */ -#pragma warning (disable : 4267) /* conversion from 'xxx' to 'yyy', possible loss of data */ -#pragma warning (disable : 4311) /* 'type cast': pointer truncation from 'xxx' to 'yyy' FIXME */ -#pragma warning (disable : 4996) /* 'xxx': This function or variable may be unsafe. Consider using yyy instead. */ +#pragma warning (disable : 4244) /* conversion from 'xxx' to 'yyy', possible loss of data */ +#pragma warning (disable : 4267) /* conversion from 'xxx' to 'yyy', possible loss of data */ +#pragma warning (disable : 4311) /* 'type cast': pointer truncation from 'xxx' to 'yyy' FIXME */ +#pragma warning (disable : 4996) /* 'xxx': This function or variable may be unsafe. Consider using yyy instead. */ -#endif /* LYNX_CFG_H */ \ No newline at end of file +#endif /* LYNX_CFG_H */ diff --git a/CHANGES b/CHANGES index 12613bcd..d5f1aea0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,9 +1,12 @@ --- $LynxId: CHANGES,v 1.511 2010/11/01 21:30:42 tom Exp $ +-- $LynxId: CHANGES,v 1.514 2010/11/08 10:12:13 tom Exp $ =============================================================================== Changes since Lynx 2.8 release =============================================================================== -2010-11-01 (2.8.8dev.7) +2010-11-08 (2.8.8dev.7) +* undo a cleanup change to link-types from dev.6 which broke some uses of + input-anchors (report by FLWM) -TD +* minor formatting improvements to sources using cindent 2.0-20101107 -TD * restore \r to \n conversion in HTML_put_character(), broken in gcc warning cleanup (report by FLWM) -TD * fix a double-free in make_argv() (report by FLWM) -TD diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c index 798dbec7..2299efaf 100644 --- a/WWW/Library/Implementation/HTFormat.c +++ b/WWW/Library/Implementation/HTFormat.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFormat.c,v 1.72 2010/09/24 09:11:25 tom Exp $ + * $LynxId: HTFormat.c,v 1.73 2010/11/07 21:20:56 tom Exp $ * * Manage different file formats HTFormat.c * ============================= @@ -1089,7 +1089,7 @@ static int HTGzFileCopy(gzFile gzfp, HTStream *sink) (*targetClass.put_block) (sink, input_buffer, status); bytes += status; - HTReadProgress(bytes, (off_t) - 1); + HTReadProgress(bytes, (off_t) -1); HTDisplayPartial(); if (HTCheckForInterrupt()) { @@ -1191,7 +1191,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink) if (len > 0) { (*targetClass.put_block) (sink, output_buffer, len); bytes += len; - HTReadProgress(bytes, (off_t) - 1); + HTReadProgress(bytes, (off_t) -1); HTDisplayPartial(); } rv = HT_LOADED; @@ -1220,7 +1220,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink) (*targetClass.put_block) (sink, output_buffer, len); bytes += len; - HTReadProgress(bytes, (off_t) - 1); + HTReadProgress(bytes, (off_t) -1); HTDisplayPartial(); if (HTCheckForInterrupt()) { @@ -1295,7 +1295,7 @@ static int HTBzFileCopy(BZFILE * bzfp, HTStream *sink) (*targetClass.put_block) (sink, input_buffer, status); bytes += status; - HTReadProgress(bytes, (off_t) - 1); + HTReadProgress(bytes, (off_t) -1); HTDisplayPartial(); if (HTCheckForInterrupt()) { diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c index c3ee43c2..ba332206 100644 --- a/WWW/Library/Implementation/HTString.c +++ b/WWW/Library/Implementation/HTString.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTString.c,v 1.64 2010/09/25 11:32:30 tom Exp $ + * $LynxId: HTString.c,v 1.65 2010/11/07 21:20:58 tom Exp $ * * Case-independent string comparison HTString.c * @@ -777,6 +777,7 @@ PUBLIC_IF_FIND_LEAKS char *StrAllocVsprintf(char **pstr, else if (type == 'Z') VA_INTGR(size_t); + else VA_INTGR(int); diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index d85f2d35..d366d732 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTCP.c,v 1.105 2010/10/27 00:11:11 tom Exp $ + * $LynxId: HTTCP.c,v 1.106 2010/11/07 21:20:58 tom Exp $ * * Generic Communication Code HTTCP.c * ========================== @@ -2102,7 +2102,7 @@ int HTDoRead(int fildes, #ifdef USE_READPROGRESS CTRACE2(TRACE_TIMING, (tfp, "...HTDoRead returns %d (%" PRI_time_t " seconds)\n", - result, CAST_time_t(time((time_t *) 0) - start))); + result, CAST_time_t (time((time_t *)0) - start))); #endif return result; } diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index ff898adb..7ca3c1b9 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTP.c,v 1.120 2010/09/25 11:31:46 tom Exp $ + * $LynxId: HTTP.c,v 1.121 2010/11/07 21:20:58 tom Exp $ * * HyperText Tranfer Protocol - Client implementation HTTP.c * ========================== @@ -170,6 +170,7 @@ void HTSSLInitPRNG(void) } /* Seed in time (mod_ssl does this) */ RAND_seed((unsigned char *) &t, (int) sizeof(time_t)); + /* Seed in pid (mod_ssl does this) */ RAND_seed((unsigned char *) &pid, (int) sizeof(pid)); /* Initialize system's random number generator */ @@ -1048,12 +1049,12 @@ static int HTLoadHTTP(const char *arg, if (pres->quality < 1.0) { if (pres->maxbytes > 0) { sprintf(temp, ";q=%4.3f;mxb=%" PRI_off_t "", - pres->quality, CAST_off_t(pres->maxbytes)); + pres->quality, CAST_off_t (pres->maxbytes)); } else { sprintf(temp, ";q=%4.3f", pres->quality); } } else if (pres->maxbytes > 0) { - sprintf(temp, ";mxb=%" PRI_off_t "", CAST_off_t(pres->maxbytes)); + sprintf(temp, ";mxb=%" PRI_off_t "", CAST_off_t (pres->maxbytes)); } else { temp[0] = '\0'; } diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index 0b1edebc..611490bd 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -1,5 +1,5 @@ /* - * $LynxId: SGML.c,v 1.140 2010/10/04 00:04:12 tom Exp $ + * $LynxId: SGML.c,v 1.141 2010/11/07 21:20:59 tom Exp $ * * General SGML Parser code SGML.c * ======================== @@ -2153,7 +2153,7 @@ static void SGML_character(HTStream *context, int c_in) uck < 256) { CTRACE((tfp, "UCTransUniChar returned 0x%.2" PRI_UCode_t ":'%c'.\n", - uck, FROMASCII((char) uck))); + uck, FROMASCII((char)uck))); /* * We got one octet from the conversions, so use it. - FM */ diff --git a/WWW/Library/Implementation/UCAux.h b/WWW/Library/Implementation/UCAux.h index f89609be..e0b93e60 100644 --- a/WWW/Library/Implementation/UCAux.h +++ b/WWW/Library/Implementation/UCAux.h @@ -1,5 +1,5 @@ /* - * $LynxId: UCAux.h,v 1.17 2010/09/24 00:14:04 tom Exp $ + * $LynxId: UCAux.h,v 1.18 2010/11/07 21:20:59 tom Exp $ */ #ifndef UCAUX_H #define UCAUX_H @@ -59,11 +59,11 @@ extern "C" { int vert_in, int hori_in); - typedef void putc_func_t(HTStream *me, - int ch); + typedef void putc_func_t (HTStream *me, + int ch); extern BOOL UCPutUtf8_charstring(HTStream *target, - putc_func_t * actions, + putc_func_t *actions, UCode_t code); extern BOOL UCConvertUniToUtf8(UCode_t code, diff --git a/src/GridText.c b/src/GridText.c index bf277cfb..22713ef9 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -1,5 +1,5 @@ /* - * $LynxId: GridText.c,v 1.204 2010/10/03 17:47:23 tom Exp $ + * $LynxId: GridText.c,v 1.206 2010/11/08 09:57:30 tom Exp $ * * Character grid hypertext object * =============================== @@ -2299,7 +2299,7 @@ static void display_page(HText *text, */ if (Anchor_ptr->show_anchor && non_empty(hi_string) - && (Anchor_ptr->link_type == HYPERTEXT_ANCHOR)) { + && (Anchor_ptr->link_type & HYPERTEXT_ANCHOR)) { int count; char *s; @@ -4628,7 +4628,7 @@ static int HText_insertBlanksInStblLines(HText *me, int ncols) /* * oldpos, newpos: allocate space for two int arrays. */ - oldpos = typecallocn(int, 2 * (size_t) ncols); + oldpos = typecallocn(int, 2 * (size_t)ncols); if (!oldpos) return -1; else @@ -5884,7 +5884,7 @@ static void HText_trimHightext(HText *text, * is not yet done with it. - kw */ if (!anchor_ptr->extent && anchor_ptr->number && - (anchor_ptr->link_type == HYPERTEXT_ANCHOR) && + (anchor_ptr->link_type & HYPERTEXT_ANCHOR) && !anchor_ptr->show_anchor && anchor_ptr->number == text->last_anchor_number) continue; @@ -5918,7 +5918,7 @@ static void HText_trimHightext(HText *text, * Strip off any spaces or SpecialAttrChars at the beginning, * if they exist, but only on HYPERTEXT_ANCHORS. */ - if (anchor_ptr->link_type == HYPERTEXT_ANCHOR) { + if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) { ch = UCH(line_ptr->data[anchor_ptr->line_pos]); while (isspace(ch) || IsSpecialAttrChar(ch)) { @@ -6017,7 +6017,7 @@ static void HText_trimHightext(HText *text, /*handle LY_SOFT_NEWLINEs -VH */ hi_offset += remove_special_attr_chars(hi_string); - if (anchor_ptr->link_type == HYPERTEXT_ANCHOR) { + if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) { LYTrimTrailing(hi_string); } if (non_empty(hi_string)) { @@ -6036,7 +6036,7 @@ static void HText_trimHightext(HText *text, hilite_str = LYGetHiTextStr(anchor_ptr, 0); remove_special_attr_chars(hilite_str); - if (anchor_ptr->link_type == HYPERTEXT_ANCHOR) { + if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) { LYTrimTrailing(hilite_str); } @@ -7195,7 +7195,7 @@ static BOOL anchor_is_numbered(TextAnchor *Anchor_ptr) BOOL result = FALSE; if (Anchor_ptr->show_anchor - && (Anchor_ptr->link_type == HYPERTEXT_ANCHOR)) { + && (Anchor_ptr->link_type & HYPERTEXT_ANCHOR)) { result = TRUE; } else if (Anchor_ptr->link_type == INPUT_ANCHOR && Anchor_ptr->input_field->type != F_HIDDEN_TYPE) { diff --git a/src/HTAlert.c b/src/HTAlert.c index 29dcf518..23e4a14e 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAlert.c,v 1.93 2010/09/26 16:36:38 tom Exp $ + * $LynxId: HTAlert.c,v 1.94 2010/11/07 21:21:00 tom Exp $ * * Displaying messages and getting input for Lynx Browser * ========================================================== @@ -178,15 +178,16 @@ static const char *sprint_bytes(char *s, off_t n, const char *was_units) if (LYTransferRate == rateKB || LYTransferRate == rateEtaKB_maybe) { if (n >= 10 * kb_units) { - sprintf(s, "%" PRI_off_t, CAST_off_t(n / kb_units)); + sprintf(s, "%" PRI_off_t, CAST_off_t (n / kb_units)); } else if (n > 999) { /* Avoid switching between 1016b/s and 1K/s */ sprintf(s, "%.2g", ((double) n) / (double) kb_units); } else { - sprintf(s, "%" PRI_off_t, CAST_off_t(n)); + sprintf(s, "%" PRI_off_t, CAST_off_t (n)); + u = HTProgressUnits(rateBYTES); } } else { - sprintf(s, "%" PRI_off_t, CAST_off_t(n)); + sprintf(s, "%" PRI_off_t, CAST_off_t (n)); } if (!was_units || was_units != u) @@ -307,8 +308,8 @@ void HTReadProgress(off_t bytes, off_t total) CTRACE((tfp, "rateBAR: bytes: %" PRI_off_t ", total: " "%" PRI_off_t "\n", - CAST_off_t(bytes), - CAST_off_t(total))); + CAST_off_t (bytes), + CAST_off_t (total))); CTRACE((tfp, "meter = %d\n", meter)); HTSprintf0(&line, "%d%% ", (int) (percent * 100)); diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index 0b2c6382..a95c2d04 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCharUtils.c,v 1.108 2010/09/24 09:56:59 tom Exp $ + * $LynxId: LYCharUtils.c,v 1.109 2010/11/07 21:21:01 tom Exp $ * * Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM * ========================================================================== @@ -1754,6 +1754,7 @@ char **LYUCFullyTranslateString(char **str, !(HTPassEightBitRaw && UCH(*p) >= lowest_8)) { sprintf(replace_buf, "U%.2" PRI_UCode_t "", code); + state = S_got_outstring; } else { puni = p; diff --git a/src/LYCookie.c b/src/LYCookie.c index cbc7f80c..ca6f4cf0 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCookie.c,v 1.105 2010/09/24 23:53:47 tom Exp $ + * $LynxId: LYCookie.c,v 1.106 2010/11/07 21:21:02 tom Exp $ * * Lynx Cookie Support LYCookie.c * =================== @@ -1061,7 +1061,7 @@ static unsigned parse_attribute(unsigned flags, } else { cur_cookie->expires = (time(NULL) + temp); CTrace((tfp, "LYSetCookie: expires %" PRI_time_t ", %s", - CAST_time_t(cur_cookie->expires), + CAST_time_t (cur_cookie->expires), ctime(&cur_cookie->expires))); } flags |= FLAGS_MAXAGE_ATTR; @@ -1082,7 +1082,7 @@ static unsigned parse_attribute(unsigned flags, cur_cookie->expires = LYmktime(value, FALSE); if (cur_cookie->expires > 0) { CTrace((tfp, "LYSetCookie: expires %" PRI_time_t ", %s", - CAST_time_t(cur_cookie->expires), + CAST_time_t (cur_cookie->expires), ctime(&cur_cookie->expires))); } } @@ -1723,7 +1723,7 @@ static void LYProcessSetCookies(const char *SetCookie, (co->value ? co->value : "[no value]"))); if (co->expires > 0) { CTrace((tfp, " expires: %" PRI_time_t ", %s\n", - CAST_time_t(co->expires), + CAST_time_t (co->expires), ctime(&co->expires))); } if (isHTTPS_URL(address) && @@ -2098,7 +2098,7 @@ void LYStoreCookies(char *cookie_file) continue; CTrace((tfp, "LYStoreCookies: %" PRI_time_t " cf %" PRI_time_t " ", - CAST_time_t(now), CAST_time_t(co->expires))); + CAST_time_t (now), CAST_time_t (co->expires))); if ((co->flags & COOKIE_FLAG_DISCARD)) { CTrace((tfp, "not stored - DISCARD\n")); @@ -2124,7 +2124,7 @@ void LYStoreCookies(char *cookie_file) (de->domain[0] == '.') ? "TRUE" : "FALSE", co->path, co->flags & COOKIE_FLAG_SECURE ? "TRUE" : "FALSE", - CAST_time_t(co->expires), co->name, + CAST_time_t (co->expires), co->name, (co->quoted ? "\"" : ""), NonNull(co->value), (co->quoted ? "\"" : "")); diff --git a/src/LYKeymap.c b/src/LYKeymap.c index 49587fdf..639d9492 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -1,4 +1,4 @@ -/* $LynxId: LYKeymap.c,v 1.72 2010/09/25 12:44:34 tom Exp $ */ +/* $LynxId: LYKeymap.c,v 1.73 2010/11/07 21:21:04 tom Exp $ */ #include <HTUtils.h> #include <LYUtils.h> #include <LYGlobalDefs.h> @@ -1274,7 +1274,7 @@ static char *pretty_html(int c) return 0; } -static char *format_binding(LYKeymap_t * table, int i) +static char *format_binding(LYKeymap_t *table, int i) { LYKeymapCode the_key = (LYKeymapCode) table[i]; char *buf = 0; diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 08c08af8..593eed5e 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYReadCFG.c,v 1.156 2010/09/27 10:45:02 tom Exp $ + * $LynxId: LYReadCFG.c,v 1.157 2010/11/07 21:21:06 tom Exp $ */ #ifndef NO_RULES #include <HTRules.h> @@ -1904,7 +1904,7 @@ static void do_read_cfg(const char *cfg_filename, const char *parent_filename, int nesting_level, FILE *fp0, - optidx_set_t * allowed) + optidx_set_t *allowed) { FILE *fp; char *buffer = 0; diff --git a/src/LYSignal.h b/src/LYSignal.h index ccb81021..627edb3f 100644 --- a/src/LYSignal.h +++ b/src/LYSignal.h @@ -16,10 +16,10 @@ extern "C" { #endif /* VMS */ #ifdef HAVE_SIGACTION - typedef void LYSigHandlerFunc_t(int); + typedef void LYSigHandlerFunc_t (int); /* implementation in LYUtils.c */ - extern void LYExtSignal(int sig, LYSigHandlerFunc_t * handler); + extern void LYExtSignal(int sig, LYSigHandlerFunc_t *handler); #else #define LYExtSignal(sig,h) signal(sig, h) diff --git a/src/LYUtils.c b/src/LYUtils.c index b82286f4..20d085ad 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYUtils.c,v 1.205 2010/10/31 17:56:21 tom Exp $ + * $LynxId: LYUtils.c,v 1.206 2010/11/07 21:21:08 tom Exp $ */ #include <HTUtils.h> #include <HTTCP.h> @@ -2891,7 +2891,7 @@ BOOLEAN inlocaldomain(void) * ignored anyway.) - kw */ void LYExtSignal(int sig, - LYSigHandlerFunc_t * handler) + LYSigHandlerFunc_t *handler) { #ifdef SIGWINCH /* add more cases to if(condition) if required... */ diff --git a/src/LYmktime.c b/src/LYmktime.c index ca66b200..151feb63 100644 --- a/src/LYmktime.c +++ b/src/LYmktime.c @@ -1,4 +1,4 @@ -/* $LynxId: LYmktime.c,v 1.11 2010/09/25 00:51:53 tom Exp $ */ +/* $LynxId: LYmktime.c,v 1.12 2010/11/07 21:21:08 tom Exp $ */ #include <LYStrings.h> #include <LYUtils.h> @@ -69,7 +69,7 @@ time_t LYmktime(char *string, } if (result != 0) { CTRACE((tfp, "LYmktime: clock=%" PRI_time_t ", ctime=%s", - CAST_time_t(result), + CAST_time_t (result), ctime(&result))); } } @@ -304,7 +304,7 @@ time_t LYmktime(char *string, clock2 = (time_t) 0; if (clock2 > 0) CTRACE((tfp, "LYmktime: clock=%" PRI_time_t ", ctime=%s", - CAST_time_t(clock2), + CAST_time_t (clock2), ctime(&clock2))); return (clock2); @@ -318,8 +318,9 @@ static void test_mktime(char *source) time_t after = parsedate(source, 0); printf("TEST %s\n", source); - printf("\t%" PRI_time_t " %s", CAST_time_t(before), ctime(&before)); - printf("\t%" PRI_time_t " %s", CAST_time_t(after), ctime(&after)); + printf("\t%" PRI_time_t " %s", CAST_time_t (before), ctime(&before)); + printf("\t%" PRI_time_t " %s", CAST_time_t (after), ctime(&after)); + if (before != after) printf("\t****\n"); } diff --git a/src/UCAux.c b/src/UCAux.c index 22cd0ee9..d1f13f97 100644 --- a/src/UCAux.c +++ b/src/UCAux.c @@ -1,5 +1,5 @@ /* - * $LynxId: UCAux.c,v 1.43 2010/09/25 15:36:51 tom Exp $ + * $LynxId: UCAux.c,v 1.44 2010/11/07 21:21:09 tom Exp $ */ #include <HTUtils.h> @@ -464,7 +464,7 @@ void UCSetBoxChars(int cset, #define PUTC(ch) ((*myPutc)(target, (char)(ch))) #define PUTC2(ch) ((*myPutc)(target,(char)(0x80|(0x3f &(ch))))) -BOOL UCPutUtf8_charstring(HTStream *target, putc_func_t * myPutc, UCode_t code) +BOOL UCPutUtf8_charstring(HTStream *target, putc_func_t *myPutc, UCode_t code) { if (code < 128) return NO; /* indicate to caller we didn't handle it */ diff --git a/src/UCdomap.c b/src/UCdomap.c index 89a4cb2f..5072ca71 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -1,5 +1,5 @@ /* - * $LynxId: UCdomap.c,v 1.87 2010/10/31 17:56:22 tom Exp $ + * $LynxId: UCdomap.c,v 1.89 2010/11/07 21:21:09 tom Exp $ * * UCdomap.c * ========= @@ -81,7 +81,7 @@ #include <mnem2_suni.h> /* RFC 1345 Mnemonic */ #include <next_uni.h> /* NeXT character set */ #include <rfc_suni.h> /* RFC 1345 w/o Intro */ -/* #include <utf8_uni.h> *//* UNICODE UTF 8 */ +/* #include <utf8_uni.h> */ /* UNICODE UTF 8 */ #include <viscii_uni.h> /* Vietnamese (VISCII) */ #include <cp866u_uni.h> /* Ukrainian Cyrillic (866) */ #include <koi8u_uni.h> /* Ukrainian Cyrillic (koi8-u */ @@ -978,14 +978,14 @@ int UCTransUniCharStr(char *outbuf, */ HTSprintf0(&tocode, "%s//TRANSLIT", LYCharSet_UC[charset_out].MIMEname); cd = iconv_open(tocode, "UTF-16BE"); - if (cd == (iconv_t) - 1) { + if (cd == (iconv_t) -1) { /* * Try again, without TRANSLIT */ HTSprintf0(&tocode, "%s", LYCharSet_UC[charset_out].MIMEname); cd = iconv_open(tocode, "UTF-16BE"); - if (cd == (iconv_t) - 1) { + if (cd == (iconv_t) -1) { CTRACE((tfp, "Warning: Cannot transcode form charset %s to %s!\n", "UTF-16BE", tocode)); @@ -993,7 +993,7 @@ int UCTransUniCharStr(char *outbuf, } FREE(tocode); - if (cd != (iconv_t) - 1) { + if (cd != (iconv_t) -1) { rc = (int) iconv(cd, (ICONV_CONST char **) &pin, &inleft, &pout, &outleft); iconv_close(cd); @@ -2210,7 +2210,7 @@ void UCInit(void) UC_CHARSET_SETUP_big5; /*** Taipei (Big5) */ UC_CHARSET_SETUP_viscii; /* Vietnamese (VISCII) */ - UC_CHARSET_SETUP; /* us-ascii *//* 7 bit approximations */ + UC_CHARSET_SETUP; /* us-ascii */ /* 7 bit approximations */ UC_CHARSET_SETUP_x_transparent; /*** Transparent */ diff --git a/src/mktime.c b/src/mktime.c index 78b88c2f..961f6b47 100644 --- a/src/mktime.c +++ b/src/mktime.c @@ -58,8 +58,7 @@ static time_t mkgmtime(register struct tm *t) * if tm_isdst >= 0 use it, else compute it */ -time_t -mktime(struct tm * t) +time_t mktime(struct tm * t) { time_t result; diff --git a/src/parsdate.c b/src/parsdate.c index ce271e33..b734a6be 100644 --- a/src/parsdate.c +++ b/src/parsdate.c @@ -17,8 +17,9 @@ static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; #define YYPURE 0 #line 2 "./parsdate.y" + /* - * $LynxId: parsdate.c,v 1.9 2010/09/22 21:18:46 tom Exp $ + * $LynxId: parsdate.c,v 1.10 2010/11/08 01:41:03 tom Exp $ * * This module is adapted and extended from tin, to use for LYmktime(). * @@ -69,7 +70,7 @@ static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; #define IS7BIT(x) ((unsigned) TO_ASCII(x) < 128) #define CTYPE(isXXXXX, c) (IS7BIT(c) && isXXXXX(((unsigned char)c))) -typedef char *PD_STRING; +typedef char *PD_STRING; extern int date_parse(void); @@ -77,7 +78,6 @@ extern int date_parse(void); #define yylex date_lex #define yyerror date_error - /* See the LeapYears table in Convert. */ #define EPOCH 1970 #define END_OF_TIME 2038 @@ -91,7 +91,6 @@ extern int date_parse(void); #define LPAREN '(' #define RPAREN ')' - /* ** Daylight-savings mode: on, off, or not yet known. */ @@ -106,35 +105,35 @@ typedef enum _MERIDIAN { MERam, MERpm, MER24 } MERIDIAN; - /* ** Global variables. We could get rid of most of them by using a yacc ** union, but this is more efficient. (This routine predates the ** yacc %union construct.) */ -static char *yyInput; -static DSTMODE yyDSTmode; -static int yyHaveDate; -static int yyHaveRel; -static int yyHaveTime; -static time_t yyTimezone; -static time_t yyDay; -static time_t yyHour; -static time_t yyMinutes; -static time_t yyMonth; -static time_t yySeconds; -static time_t yyYear; -static MERIDIAN yyMeridian; -static time_t yyRelMonth; -static time_t yyRelSeconds; - -static time_t ToSeconds(time_t, time_t, time_t, MERIDIAN); -static time_t Convert(time_t, time_t, time_t, time_t, time_t, time_t, MERIDIAN, DSTMODE); -static time_t DSTcorrect(time_t, time_t); -static time_t RelativeMonth(time_t, time_t); -static int LookupWord(char *, int); -static int date_lex(void); -static int GetTimeInfo(TIMEINFO *Now); +static char *yyInput; +static DSTMODE yyDSTmode; +static int yyHaveDate; +static int yyHaveRel; +static int yyHaveTime; +static time_t yyTimezone; +static time_t yyDay; +static time_t yyHour; +static time_t yyMinutes; +static time_t yyMonth; +static time_t yySeconds; +static time_t yyYear; +static MERIDIAN yyMeridian; +static time_t yyRelMonth; +static time_t yyRelSeconds; + +static time_t ToSeconds(time_t, time_t, time_t, MERIDIAN); +static time_t Convert(time_t, time_t, time_t, time_t, time_t, time_t, + MERIDIAN, DSTMODE); +static time_t DSTcorrect(time_t, time_t); +static time_t RelativeMonth(time_t, time_t); +static int LookupWord(char *, int); +static int date_lex(void); +static int GetTimeInfo(TIMEINFO * Now); /* * The 'date_error()' function is declared here to work around a defect in @@ -143,18 +142,17 @@ static int GetTimeInfo(TIMEINFO *Now); * 'const' on the parameter to quiet gcc's -Wwrite-strings warning. */ /*ARGSUSED*/ -static void -date_error(const char GCC_UNUSED *s) +static void date_error(const char GCC_UNUSED *s) { - /*NOTREACHED*/ + /*NOTREACHED */ } -#line 136 "./parsdate.y" +#line 134 "./parsdate.y" typedef union { time_t Number; enum _MERIDIAN Meridian; } YYSTYPE; -#line 157 "y.tab.c" +#line 155 "y.tab.c" /* compatibility with bison */ #ifdef YYPARSE_PARAM /* compatibility with FreeBSD */ @@ -388,11 +386,13 @@ YYSTYPE yylval; /* variables for the parser stack */ static YYSTACKDATA yystack; -#line 358 "./parsdate.y" +#line 356 "./parsdate.y" + /* ** An entry in the lexical lookup table. */ +/* *INDENT-OFF* */ typedef struct _TABLE { const char *name; int type; @@ -557,13 +557,9 @@ static const TABLE TimezoneTable[] = { { "hdt", tDAYZONE, HOUR(10) }, /* -- expired 1986 */ #endif /* 0 */ }; +/* *INDENT-ON* */ -static time_t -ToSeconds( - time_t Hours, - time_t Minutes, - time_t Seconds, - MERIDIAN Meridian) +static time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian) { if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 61) return -1; @@ -572,34 +568,29 @@ ToSeconds( return -1; } else { if (Hours < 1 || Hours > 12) - return -1; + return -1; if (Hours == 12) - Hours = 0; + Hours = 0; if (Meridian == MERpm) - Hours += 12; + Hours += 12; } return (Hours * 60L + Minutes) * 60L + Seconds; } - -static time_t -Convert( - time_t Month, - time_t Day, - time_t Year, - time_t Hours, - time_t Minutes, - time_t Seconds, - MERIDIAN Meridian, - DSTMODE dst) +static time_t Convert(time_t Month, time_t Day, time_t Year, time_t Hours, + time_t Minutes, time_t Seconds, MERIDIAN Meridian, + DSTMODE dst) { - static const int DaysNormal[13] = { + static const int DaysNormal[13] = + { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - static const int DaysLeap[13] = { + static const int DaysLeap[13] = + { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - static const int LeapYears[] = { + static const int LeapYears[] = + { 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036 }; @@ -612,7 +603,7 @@ Convert( if (Year < 0) Year = -Year; if (Year < 70) - Year += 2000; + Year += 2000; if (Year < 100) Year += 1900; if (Year < EPOCH) @@ -623,9 +614,10 @@ Convert( break; } if (Year < EPOCH || Year > END_OF_TIME - || Month < 1 || Month > 12 - /* NOSTRICT */ /* conversion from long may lose accuracy */ - || Day < 1 || Day > mp[(int)Month]) { + || Month < 1 || Month > 12 + /* NOSTRICT */ + /* conversion from long may lose accuracy */ + || Day < 1 || Day > mp[(int) Month]) { return -1; } @@ -648,50 +640,40 @@ Convert( return Julian; } - -static time_t -DSTcorrect( - time_t Start, - time_t Future) +static time_t DSTcorrect(time_t Start, time_t Future) { - time_t StartDay; - time_t FutureDay; + time_t StartDay; + time_t FutureDay; StartDay = (localtime(&Start)->tm_hour + 1) % 24; FutureDay = (localtime(&Future)->tm_hour + 1) % 24; return (Future - Start) + (StartDay - FutureDay) * DST_OFFSET * 60 * 60; } - -static time_t -RelativeMonth( - time_t Start, - time_t RelMonth) +static time_t RelativeMonth(time_t Start, time_t RelMonth) { - struct tm *tm; - time_t Month; - time_t Year; + struct tm *tm; + time_t Month; + time_t Year; tm = localtime(&Start); Month = 12 * tm->tm_year + tm->tm_mon + RelMonth; Year = Month / 12 + 1900; Month = Month % 12 + 1; return DSTcorrect(Start, - Convert(Month, (time_t)tm->tm_mday, Year, - (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec, - MER24, DSTmaybe)); + Convert(Month, (time_t) tm->tm_mday, Year, + (time_t) tm->tm_hour, (time_t) tm->tm_min, + (time_t) tm->tm_sec, + MER24, DSTmaybe)); } - -static int -LookupWord( - char *buff, - int length) +static int LookupWord(char *buff, + int length) { - char *p; + char *p; const char *q; const TABLE *tp; - int c; + int c; p = buff; c = p[0]; @@ -717,14 +699,14 @@ LookupWord( /* Try for a timezone. */ for (tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++) { if (c == tp->name[0] && p[1] == tp->name[1] - && strcmp(p, tp->name) == 0) { + && strcmp(p, tp->name) == 0) { yylval.Number = tp->value; return tp->type; } } if (strcmp(buff, "dst") == 0) - return tDST; + return tDST; /* Try the units table. */ for (tp = UnitsTable; tp < ENDOF(UnitsTable); tp++) { @@ -749,7 +731,7 @@ LookupWord( length++; /* Drop out any periods. */ - for (p = buff, q = (PD_STRING)buff; *q; q++) { + for (p = buff, q = (PD_STRING) buff; *q; q++) { if (*q != '.') *p++ = *q; } @@ -772,7 +754,7 @@ LookupWord( c = buff[0]; for (p = buff, tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++) { if (c == tp->name[0] && p[1] == tp->name[1] - && strcmp(p, tp->name) == 0) { + && strcmp(p, tp->name) == 0) { yylval.Number = tp->value; return tp->type; } @@ -784,7 +766,6 @@ LookupWord( return tZONE; } - /* * This returns characters as-is (the ones that are not part of some token), * and codes greater than 256 (the token values). @@ -798,19 +779,18 @@ LookupWord( * * The TO_ASCII() function is the inverse of TO_LOCAL(). */ -static int -date_lex(void) +static int date_lex(void) { - int c; - char *p; - char buff[20]; - int sign; - int i; - int nesting; - - for(;;) { + int c; + char *p; + char buff[20]; + int sign; + int i; + int nesting; + + for (;;) { /* Get first character after the whitespace. */ - for(;;) { + for (;;) { while (CTYPE(isspace, *yyInput)) yyInput++; c = *yyInput; @@ -820,13 +800,13 @@ date_lex(void) break; for (nesting = 1; (c = *++yyInput) != RPAREN || --nesting; - ) { + ) { if (c == LPAREN) { nesting++; } else if (!IS7BIT(c) || c == '\0' || c == '\r' - || (c == '\\' - && ((c = *++yyInput) == '\0' - || !IS7BIT(c)))) { + || (c == '\\' + && ((c = *++yyInput) == '\0' + || !IS7BIT(c)))) { /* Lexical error: bad comment. */ return '?'; } @@ -849,7 +829,7 @@ date_lex(void) } for (p = buff; (c = *yyInput++) != '\0' && CTYPE(isdigit, c); - ) { + ) { if (p < &buff[sizeof buff - 1]) *p++ = (char) c; } @@ -865,7 +845,7 @@ date_lex(void) if (CTYPE(isalpha, c)) { for (p = buff; (c = *yyInput++) == '.' || CTYPE(isalpha, c); - ) { + ) { if (p < &buff[sizeof buff - 1]) *p++ = (char) (CTYPE(isupper, c) ? tolower(c) : c); } @@ -878,31 +858,29 @@ date_lex(void) } } - -static int -GetTimeInfo( - TIMEINFO *Now) +static int GetTimeInfo(TIMEINFO * Now) { - static time_t LastTime; - static long LastTzone; - struct tm *tm; + static time_t LastTime; + static long LastTzone; + struct tm *tm; + #if defined(HAVE_GETTIMEOFDAY) - struct timeval tv; -#endif /* defined(HAVE_GETTIMEOFDAY) */ + struct timeval tv; +#endif /* defined(HAVE_GETTIMEOFDAY) */ #if defined(DONT_HAVE_TM_GMTOFF) - struct tm local; - struct tm gmt; -#endif /* !defined(DONT_HAVE_TM_GMTOFF) */ + struct tm local; + struct tm gmt; +#endif /* !defined(DONT_HAVE_TM_GMTOFF) */ /* Get the basic time. */ #if defined(HAVE_GETTIMEOFDAY) - if (gettimeofday(&tv, (struct timezone *)NULL) == -1) + if (gettimeofday(&tv, (struct timezone *) NULL) == -1) return -1; Now->time = tv.tv_sec; Now->usec = tv.tv_usec; #else /* Can't check for -1 since that might be a time, I guess. */ - (void)time(&Now->time); + (void) time(&Now->time); Now->usec = 0; #endif /* defined(HAVE_GETTIMEOFDAY) */ @@ -932,27 +910,24 @@ GetTimeInfo( LastTzone *= 60; LastTzone += gmt.tm_min - local.tm_min; #else - LastTzone = (0 - tm->tm_gmtoff) / 60; -#endif /* defined(DONT_HAVE_TM_GMTOFF) */ + LastTzone = (0 - tm->tm_gmtoff) / 60; +#endif /* defined(DONT_HAVE_TM_GMTOFF) */ } Now->tzone = LastTzone; return 0; } - -time_t -parsedate( - char *p, - TIMEINFO *now) +time_t parsedate(char *p, + TIMEINFO * now) { - struct tm *tm; - TIMEINFO ti; - time_t Start; + struct tm *tm; + TIMEINFO ti; + time_t Start; yyInput = p; if (now == NULL) { now = &ti; - (void)GetTimeInfo(&ti); + (void) GetTimeInfo(&ti); } tm = localtime(&now->time); @@ -960,8 +935,8 @@ parsedate( yyMonth = tm->tm_mon + 1; yyDay = tm->tm_mday; yyTimezone = now->tzone; - if (tm->tm_isdst) /* Correct timezone offset for DST */ - yyTimezone += DST_OFFSET * 60; + if (tm->tm_isdst) /* Correct timezone offset for DST */ + yyTimezone += DST_OFFSET * 60; yyDSTmode = DSTmaybe; yyHour = 0; yyMinutes = 0; @@ -978,7 +953,7 @@ parsedate( if (yyHaveDate || yyHaveTime) { Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds, - yyMeridian, yyDSTmode); + yyMeridian, yyDSTmode); if (Start < 0) return -1; } else { @@ -995,7 +970,7 @@ parsedate( * from the error return value. (Alternately could set errno on error.) */ return Start == -1 ? 0 : Start; } -#line 998 "y.tab.c" +#line 973 "y.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -1206,7 +1181,7 @@ yyreduce: switch (yyn) { case 3: -#line 154 "./parsdate.y" +#line 152 "./parsdate.y" { yyHaveTime++; #if defined(lint) @@ -1218,27 +1193,27 @@ case 3: } break; case 4: -#line 163 "./parsdate.y" +#line 161 "./parsdate.y" { yyHaveTime++; yyTimezone = yystack.l_mark[0].Number; } break; case 5: -#line 167 "./parsdate.y" +#line 165 "./parsdate.y" { yyHaveDate++; } break; case 6: -#line 170 "./parsdate.y" +#line 168 "./parsdate.y" { yyHaveDate++; yyHaveTime++; } break; case 7: -#line 174 "./parsdate.y" +#line 172 "./parsdate.y" { yyHaveDate++; yyHaveTime++; @@ -1246,13 +1221,13 @@ case 7: } break; case 8: -#line 179 "./parsdate.y" +#line 177 "./parsdate.y" { yyHaveRel = 1; } break; case 9: -#line 184 "./parsdate.y" +#line 182 "./parsdate.y" { if (yystack.l_mark[-1].Number < 100) { yyHour = yystack.l_mark[-1].Number; @@ -1267,7 +1242,7 @@ case 9: } break; case 10: -#line 196 "./parsdate.y" +#line 194 "./parsdate.y" { yyHour = yystack.l_mark[-3].Number; yyMinutes = yystack.l_mark[-1].Number; @@ -1276,7 +1251,7 @@ case 10: } break; case 11: -#line 202 "./parsdate.y" +#line 200 "./parsdate.y" { yyHour = yystack.l_mark[-3].Number; yyMinutes = yystack.l_mark[-1].Number; @@ -1286,7 +1261,7 @@ case 11: } break; case 12: -#line 209 "./parsdate.y" +#line 207 "./parsdate.y" { yyHour = yystack.l_mark[-5].Number; yyMinutes = yystack.l_mark[-3].Number; @@ -1295,7 +1270,7 @@ case 12: } break; case 13: -#line 215 "./parsdate.y" +#line 213 "./parsdate.y" { yyHour = yystack.l_mark[-5].Number; yyMinutes = yystack.l_mark[-3].Number; @@ -1306,28 +1281,28 @@ case 13: } break; case 14: -#line 225 "./parsdate.y" +#line 223 "./parsdate.y" { yyval.Number = yystack.l_mark[0].Number; yyDSTmode = DSToff; } break; case 15: -#line 229 "./parsdate.y" +#line 227 "./parsdate.y" { yyval.Number = yystack.l_mark[0].Number; yyDSTmode = DSTon; } break; case 16: -#line 233 "./parsdate.y" +#line 231 "./parsdate.y" { yyTimezone = yystack.l_mark[-1].Number; yyDSTmode = DSTon; } break; case 17: -#line 237 "./parsdate.y" +#line 235 "./parsdate.y" { /* Only allow "GMT+300" and "GMT-0800" */ if (yystack.l_mark[-1].Number != 0) { @@ -1338,14 +1313,14 @@ case 17: } break; case 18: -#line 245 "./parsdate.y" +#line 243 "./parsdate.y" { yyval.Number = yystack.l_mark[0].Number; yyDSTmode = DSToff; } break; case 19: -#line 251 "./parsdate.y" +#line 249 "./parsdate.y" { int i; @@ -1367,14 +1342,14 @@ case 19: } break; case 20: -#line 272 "./parsdate.y" +#line 270 "./parsdate.y" { yyMonth = yystack.l_mark[-2].Number; yyDay = yystack.l_mark[0].Number; } break; case 21: -#line 276 "./parsdate.y" +#line 274 "./parsdate.y" { if (yystack.l_mark[-4].Number > 100) { yyYear = yystack.l_mark[-4].Number; @@ -1389,14 +1364,14 @@ case 21: } break; case 22: -#line 288 "./parsdate.y" +#line 286 "./parsdate.y" { yyMonth = yystack.l_mark[-1].Number; yyDay = yystack.l_mark[0].Number; } break; case 23: -#line 292 "./parsdate.y" +#line 290 "./parsdate.y" { yyMonth = yystack.l_mark[-3].Number; yyDay = yystack.l_mark[-2].Number; @@ -1404,14 +1379,14 @@ case 23: } break; case 24: -#line 297 "./parsdate.y" +#line 295 "./parsdate.y" { yyDay = yystack.l_mark[-1].Number; yyMonth = yystack.l_mark[0].Number; } break; case 25: -#line 301 "./parsdate.y" +#line 299 "./parsdate.y" { yyDay = yystack.l_mark[-2].Number; yyMonth = yystack.l_mark[-1].Number; @@ -1419,7 +1394,7 @@ case 25: } break; case 26: -#line 306 "./parsdate.y" +#line 304 "./parsdate.y" { yyDay = yystack.l_mark[-2].Number; yyMonth = yystack.l_mark[-1].Number; @@ -1427,7 +1402,7 @@ case 26: } break; case 27: -#line 311 "./parsdate.y" +#line 309 "./parsdate.y" { yyDay = yystack.l_mark[-3].Number; yyMonth = yystack.l_mark[-1].Number; @@ -1435,7 +1410,7 @@ case 27: } break; case 28: -#line 316 "./parsdate.y" +#line 314 "./parsdate.y" { yyDay = yystack.l_mark[-2].Number; yyMonth = -yystack.l_mark[-1].Number; @@ -1445,7 +1420,7 @@ case 28: } break; case 29: -#line 325 "./parsdate.y" +#line 323 "./parsdate.y" { yyMonth = yystack.l_mark[-7].Number; yyDay = yystack.l_mark[-6].Number; @@ -1456,42 +1431,42 @@ case 29: } break; case 30: -#line 335 "./parsdate.y" +#line 333 "./parsdate.y" { yyRelSeconds += yystack.l_mark[-1].Number * yystack.l_mark[0].Number; } break; case 31: -#line 338 "./parsdate.y" +#line 336 "./parsdate.y" { yyRelSeconds += yystack.l_mark[-1].Number * yystack.l_mark[0].Number; } break; case 32: -#line 341 "./parsdate.y" +#line 339 "./parsdate.y" { yyRelMonth += yystack.l_mark[-1].Number * yystack.l_mark[0].Number; } break; case 33: -#line 344 "./parsdate.y" +#line 342 "./parsdate.y" { yyRelMonth += yystack.l_mark[-1].Number * yystack.l_mark[0].Number; } break; case 34: -#line 349 "./parsdate.y" +#line 347 "./parsdate.y" { yyval.Meridian = MER24; } break; case 35: -#line 352 "./parsdate.y" +#line 350 "./parsdate.y" { yyval.Meridian = yystack.l_mark[0].Meridian; } break; -#line 1494 "y.tab.c" +#line 1469 "y.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/src/parsdate.y b/src/parsdate.y index 6942d297..007c6875 100644 --- a/src/parsdate.y +++ b/src/parsdate.y @@ -1,6 +1,7 @@ %{ + /* - * $LynxId: parsdate.y,v 1.13 2010/09/22 21:18:43 tom Exp $ + * $LynxId: parsdate.y,v 1.17 2010/11/07 22:32:51 tom Exp $ * * This module is adapted and extended from tin, to use for LYmktime(). * @@ -51,7 +52,7 @@ #define IS7BIT(x) ((unsigned) TO_ASCII(x) < 128) #define CTYPE(isXXXXX, c) (IS7BIT(c) && isXXXXX(((unsigned char)c))) -typedef char *PD_STRING; +typedef char *PD_STRING; extern int date_parse(void); @@ -59,7 +60,6 @@ extern int date_parse(void); #define yylex date_lex #define yyerror date_error - /* See the LeapYears table in Convert. */ #define EPOCH 1970 #define END_OF_TIME 2038 @@ -73,7 +73,6 @@ extern int date_parse(void); #define LPAREN '(' #define RPAREN ')' - /* ** Daylight-savings mode: on, off, or not yet known. */ @@ -88,35 +87,35 @@ typedef enum _MERIDIAN { MERam, MERpm, MER24 } MERIDIAN; - /* ** Global variables. We could get rid of most of them by using a yacc ** union, but this is more efficient. (This routine predates the ** yacc %union construct.) */ -static char *yyInput; -static DSTMODE yyDSTmode; -static int yyHaveDate; -static int yyHaveRel; -static int yyHaveTime; -static time_t yyTimezone; -static time_t yyDay; -static time_t yyHour; -static time_t yyMinutes; -static time_t yyMonth; -static time_t yySeconds; -static time_t yyYear; -static MERIDIAN yyMeridian; -static time_t yyRelMonth; -static time_t yyRelSeconds; - -static time_t ToSeconds(time_t, time_t, time_t, MERIDIAN); -static time_t Convert(time_t, time_t, time_t, time_t, time_t, time_t, MERIDIAN, DSTMODE); -static time_t DSTcorrect(time_t, time_t); -static time_t RelativeMonth(time_t, time_t); -static int LookupWord(char *, int); -static int date_lex(void); -static int GetTimeInfo(TIMEINFO *Now); +static char *yyInput; +static DSTMODE yyDSTmode; +static int yyHaveDate; +static int yyHaveRel; +static int yyHaveTime; +static time_t yyTimezone; +static time_t yyDay; +static time_t yyHour; +static time_t yyMinutes; +static time_t yyMonth; +static time_t yySeconds; +static time_t yyYear; +static MERIDIAN yyMeridian; +static time_t yyRelMonth; +static time_t yyRelSeconds; + +static time_t ToSeconds(time_t, time_t, time_t, MERIDIAN); +static time_t Convert(time_t, time_t, time_t, time_t, time_t, time_t, + MERIDIAN, DSTMODE); +static time_t DSTcorrect(time_t, time_t); +static time_t RelativeMonth(time_t, time_t); +static int LookupWord(char *, int); +static int date_lex(void); +static int GetTimeInfo(TIMEINFO * Now); /* * The 'date_error()' function is declared here to work around a defect in @@ -125,10 +124,9 @@ static int GetTimeInfo(TIMEINFO *Now); * 'const' on the parameter to quiet gcc's -Wwrite-strings warning. */ /*ARGSUSED*/ -static void -date_error(const char GCC_UNUSED *s) +static void date_error(const char GCC_UNUSED *s) { - /*NOTREACHED*/ + /*NOTREACHED */ } %} @@ -356,9 +354,11 @@ o_merid : /* NULL */ { %% + /* ** An entry in the lexical lookup table. */ +/* *INDENT-OFF* */ typedef struct _TABLE { const char *name; int type; @@ -523,13 +523,9 @@ static const TABLE TimezoneTable[] = { { "hdt", tDAYZONE, HOUR(10) }, /* -- expired 1986 */ #endif /* 0 */ }; +/* *INDENT-ON* */ -static time_t -ToSeconds( - time_t Hours, - time_t Minutes, - time_t Seconds, - MERIDIAN Meridian) +static time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian) { if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 61) return -1; @@ -538,34 +534,29 @@ ToSeconds( return -1; } else { if (Hours < 1 || Hours > 12) - return -1; + return -1; if (Hours == 12) - Hours = 0; + Hours = 0; if (Meridian == MERpm) - Hours += 12; + Hours += 12; } return (Hours * 60L + Minutes) * 60L + Seconds; } - -static time_t -Convert( - time_t Month, - time_t Day, - time_t Year, - time_t Hours, - time_t Minutes, - time_t Seconds, - MERIDIAN Meridian, - DSTMODE dst) +static time_t Convert(time_t Month, time_t Day, time_t Year, time_t Hours, + time_t Minutes, time_t Seconds, MERIDIAN Meridian, + DSTMODE dst) { - static const int DaysNormal[13] = { + static const int DaysNormal[13] = + { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - static const int DaysLeap[13] = { + static const int DaysLeap[13] = + { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - static const int LeapYears[] = { + static const int LeapYears[] = + { 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036 }; @@ -578,7 +569,7 @@ Convert( if (Year < 0) Year = -Year; if (Year < 70) - Year += 2000; + Year += 2000; if (Year < 100) Year += 1900; if (Year < EPOCH) @@ -589,9 +580,10 @@ Convert( break; } if (Year < EPOCH || Year > END_OF_TIME - || Month < 1 || Month > 12 - /* NOSTRICT */ /* conversion from long may lose accuracy */ - || Day < 1 || Day > mp[(int)Month]) { + || Month < 1 || Month > 12 + /* NOSTRICT */ + /* conversion from long may lose accuracy */ + || Day < 1 || Day > mp[(int) Month]) { return -1; } @@ -614,50 +606,40 @@ Convert( return Julian; } - -static time_t -DSTcorrect( - time_t Start, - time_t Future) +static time_t DSTcorrect(time_t Start, time_t Future) { - time_t StartDay; - time_t FutureDay; + time_t StartDay; + time_t FutureDay; StartDay = (localtime(&Start)->tm_hour + 1) % 24; FutureDay = (localtime(&Future)->tm_hour + 1) % 24; return (Future - Start) + (StartDay - FutureDay) * DST_OFFSET * 60 * 60; } - -static time_t -RelativeMonth( - time_t Start, - time_t RelMonth) +static time_t RelativeMonth(time_t Start, time_t RelMonth) { - struct tm *tm; - time_t Month; - time_t Year; + struct tm *tm; + time_t Month; + time_t Year; tm = localtime(&Start); Month = 12 * tm->tm_year + tm->tm_mon + RelMonth; Year = Month / 12 + 1900; Month = Month % 12 + 1; return DSTcorrect(Start, - Convert(Month, (time_t)tm->tm_mday, Year, - (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec, - MER24, DSTmaybe)); + Convert(Month, (time_t) tm->tm_mday, Year, + (time_t) tm->tm_hour, (time_t) tm->tm_min, + (time_t) tm->tm_sec, + MER24, DSTmaybe)); } - -static int -LookupWord( - char *buff, - int length) +static int LookupWord(char *buff, + int length) { - char *p; + char *p; const char *q; const TABLE *tp; - int c; + int c; p = buff; c = p[0]; @@ -683,14 +665,14 @@ LookupWord( /* Try for a timezone. */ for (tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++) { if (c == tp->name[0] && p[1] == tp->name[1] - && strcmp(p, tp->name) == 0) { + && strcmp(p, tp->name) == 0) { yylval.Number = tp->value; return tp->type; } } if (strcmp(buff, "dst") == 0) - return tDST; + return tDST; /* Try the units table. */ for (tp = UnitsTable; tp < ENDOF(UnitsTable); tp++) { @@ -715,7 +697,7 @@ LookupWord( length++; /* Drop out any periods. */ - for (p = buff, q = (PD_STRING)buff; *q; q++) { + for (p = buff, q = (PD_STRING) buff; *q; q++) { if (*q != '.') *p++ = *q; } @@ -738,7 +720,7 @@ LookupWord( c = buff[0]; for (p = buff, tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++) { if (c == tp->name[0] && p[1] == tp->name[1] - && strcmp(p, tp->name) == 0) { + && strcmp(p, tp->name) == 0) { yylval.Number = tp->value; return tp->type; } @@ -750,7 +732,6 @@ LookupWord( return tZONE; } - /* * This returns characters as-is (the ones that are not part of some token), * and codes greater than 256 (the token values). @@ -764,19 +745,18 @@ LookupWord( * * The TO_ASCII() function is the inverse of TO_LOCAL(). */ -static int -date_lex(void) +static int date_lex(void) { - int c; - char *p; - char buff[20]; - int sign; - int i; - int nesting; - - for(;;) { + int c; + char *p; + char buff[20]; + int sign; + int i; + int nesting; + + for (;;) { /* Get first character after the whitespace. */ - for(;;) { + for (;;) { while (CTYPE(isspace, *yyInput)) yyInput++; c = *yyInput; @@ -786,13 +766,13 @@ date_lex(void) break; for (nesting = 1; (c = *++yyInput) != RPAREN || --nesting; - ) { + ) { if (c == LPAREN) { nesting++; } else if (!IS7BIT(c) || c == '\0' || c == '\r' - || (c == '\\' - && ((c = *++yyInput) == '\0' - || !IS7BIT(c)))) { + || (c == '\\' + && ((c = *++yyInput) == '\0' + || !IS7BIT(c)))) { /* Lexical error: bad comment. */ return '?'; } @@ -815,7 +795,7 @@ date_lex(void) } for (p = buff; (c = *yyInput++) != '\0' && CTYPE(isdigit, c); - ) { + ) { if (p < &buff[sizeof buff - 1]) *p++ = (char) c; } @@ -831,7 +811,7 @@ date_lex(void) if (CTYPE(isalpha, c)) { for (p = buff; (c = *yyInput++) == '.' || CTYPE(isalpha, c); - ) { + ) { if (p < &buff[sizeof buff - 1]) *p++ = (char) (CTYPE(isupper, c) ? tolower(c) : c); } @@ -844,31 +824,29 @@ date_lex(void) } } - -static int -GetTimeInfo( - TIMEINFO *Now) +static int GetTimeInfo(TIMEINFO * Now) { - static time_t LastTime; - static long LastTzone; - struct tm *tm; + static time_t LastTime; + static long LastTzone; + struct tm *tm; + #if defined(HAVE_GETTIMEOFDAY) - struct timeval tv; -#endif /* defined(HAVE_GETTIMEOFDAY) */ + struct timeval tv; +#endif /* defined(HAVE_GETTIMEOFDAY) */ #if defined(DONT_HAVE_TM_GMTOFF) - struct tm local; - struct tm gmt; -#endif /* !defined(DONT_HAVE_TM_GMTOFF) */ + struct tm local; + struct tm gmt; +#endif /* !defined(DONT_HAVE_TM_GMTOFF) */ /* Get the basic time. */ #if defined(HAVE_GETTIMEOFDAY) - if (gettimeofday(&tv, (struct timezone *)NULL) == -1) + if (gettimeofday(&tv, (struct timezone *) NULL) == -1) return -1; Now->time = tv.tv_sec; Now->usec = tv.tv_usec; #else /* Can't check for -1 since that might be a time, I guess. */ - (void)time(&Now->time); + (void) time(&Now->time); Now->usec = 0; #endif /* defined(HAVE_GETTIMEOFDAY) */ @@ -898,27 +876,24 @@ GetTimeInfo( LastTzone *= 60; LastTzone += gmt.tm_min - local.tm_min; #else - LastTzone = (0 - tm->tm_gmtoff) / 60; -#endif /* defined(DONT_HAVE_TM_GMTOFF) */ + LastTzone = (0 - tm->tm_gmtoff) / 60; +#endif /* defined(DONT_HAVE_TM_GMTOFF) */ } Now->tzone = LastTzone; return 0; } - -time_t -parsedate( - char *p, - TIMEINFO *now) +time_t parsedate(char *p, + TIMEINFO * now) { - struct tm *tm; - TIMEINFO ti; - time_t Start; + struct tm *tm; + TIMEINFO ti; + time_t Start; yyInput = p; if (now == NULL) { now = &ti; - (void)GetTimeInfo(&ti); + (void) GetTimeInfo(&ti); } tm = localtime(&now->time); @@ -926,8 +901,8 @@ parsedate( yyMonth = tm->tm_mon + 1; yyDay = tm->tm_mday; yyTimezone = now->tzone; - if (tm->tm_isdst) /* Correct timezone offset for DST */ - yyTimezone += DST_OFFSET * 60; + if (tm->tm_isdst) /* Correct timezone offset for DST */ + yyTimezone += DST_OFFSET * 60; yyDSTmode = DSTmaybe; yyHour = 0; yyMinutes = 0; @@ -944,7 +919,7 @@ parsedate( if (yyHaveDate || yyHaveTime) { Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds, - yyMeridian, yyDSTmode); + yyMeridian, yyDSTmode); if (Start < 0) return -1; } else { diff --git a/src/tidy_tls.c b/src/tidy_tls.c index a3d37731..8ca10182 100644 --- a/src/tidy_tls.c +++ b/src/tidy_tls.c @@ -1,5 +1,5 @@ /* - * $LynxId: tidy_tls.c,v 1.5 2010/06/20 19:25:46 tom Exp $ + * $LynxId: tidy_tls.c,v 1.6 2010/11/07 21:21:10 tom Exp $ * Copyright 2008, Thomas E. Dickey * with fix Copyright 2008 by Thomas Viehmann * @@ -27,7 +27,7 @@ static int last_error = 0; gnutls_x509_crt_get_issuer_dn_by_oid(xcert, oid, 0, 0, target, &len) /* thewhat: which DN to get 0 = subject, 1 = issuer */ -static int ExtractCertificate(const gnutls_datum_t * cert, X509_NAME * result, int thewhat) +static int ExtractCertificate(const gnutls_datum_t *cert, X509_NAME * result, int thewhat) { gnutls_x509_crt_t xcert; int rc; diff --git a/userdefs.h b/userdefs.h index 76fde111..abaab7d7 100644 --- a/userdefs.h +++ b/userdefs.h @@ -1,5 +1,5 @@ /* - * $LynxId: userdefs.h,v 1.259 2010/10/04 09:53:59 tom Exp $ + * $LynxId: userdefs.h,v 1.260 2010/11/06 13:34:13 tom Exp $ * * Lynx - Hypertext navigation system * @@ -1184,7 +1184,7 @@ * * NOTE: This can generate A REAL LOT of mail, be warned!!! */ -/* #define ALERTMAIL "webmaster@localhost" *//*error recipient if no owner */ +/* #define ALERTMAIL "webmaster@localhost" */ /*error recipient if no owner */ /********************************* * If CHECKMAIL is set to TRUE, the user will be informed (via a status line |