[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev a few LYCookie.c cleanups
From: |
brian j. pardy |
Subject: |
lynx-dev a few LYCookie.c cleanups |
Date: |
Sun, 6 Dec 1998 01:16:41 -0800 |
A couple cleanups to improve the readability of some of my code, and some
things to make the trace file look slightly less cluttered. Nothing big.
diff -cr 2.8.1dev.8/src/LYCookie.c 2.8.1dev.8.bri/src/LYCookie.c
*** 2.8.1dev.8/src/LYCookie.c Fri Dec 4 23:21:11 1998
--- 2.8.1dev.8.bri/src/LYCookie.c Sun Dec 6 01:15:51 1998
***************
*** 1908,1913 ****
--- 1908,1915 ----
if (!cookie_handle)
return;
+ CTRACE(tfp, "LYLoadCookies: reading cookies from %s\n", cookie_file);
+
while (!feof(cookie_handle)) {
cookie *moo;
unsigned i = 0;
***************
*** 1921,1927 ****
continue;
}
-
/*
* Strip out the newline that fgets() puts at the end of a
* cookie.
--- 1923,1928 ----
***************
*** 1942,1952 ****
* '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,
--- 1943,1954 ----
* 'fixed' by using strsep instead of strtok. No idea
* what kind of platform problems this might introduce. - RP
*/
+ CTRACE(tfp, "LYLoadCookies: tokenising %s\n", buf);
tok_ptr = buf;
tok_out = LYstrsep(&tok_ptr, "\t");
for (tok_loop = 0; tok_out && tok_values[tok_loop].s; tok_loop++) {
! CTRACE(tfp, "\t%d:%p:%p:[%s]\n",
! tok_loop, tok_values[tok_loop].s, tok_out, tok_out);
LYstrncpy(tok_values[tok_loop].s, tok_out, tok_values[tok_loop].n);
/*
* It looks like strtok ignores a leading delimiter,
***************
*** 1957,1963 ****
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
--- 1959,1964 ----
***************
*** 1966,1973 ****
* 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);
--- 1967,1975 ----
* domain, what, path, secure, &expires, name, value);
*/
! CTRACE(tfp, "expires:\t%s\n", ctime(&expires));
! /* 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);
***************
*** 2048,2054 ****
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,
--- 2050,2056 ----
if ((co = (cookie *)cl->object) == NULL)
continue;
! CTRACE(tfp, "LYStoreCookies: %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,
***************
*** 2530,2536 ****
{
domain_entry *de = NULL;
domain_entry *de2 = NULL;
! HTList *hl;
char **str = (char **)calloc(1, sizeof(acceptstr));
char *astr = NULL;
char *strsmall = NULL;
--- 2532,2538 ----
{
domain_entry *de = NULL;
domain_entry *de2 = NULL;
! HTList *hl = NULL;
char **str = (char **)calloc(1, sizeof(acceptstr));
char *astr = NULL;
char *strsmall = NULL;
***************
*** 2551,2557 ****
*str = astr;
! for(; (strsmall = LYstrsep(str, ","));) {
if(strsmall == NULL)
break;
--- 2553,2559 ----
*str = astr;
! while(strsmall = LYstrsep(str, ",")) {
if(strsmall == NULL)
break;
***************
*** 2608,2614 ****
{
domain_entry *de = NULL;
domain_entry *de2 = NULL;
! HTList *hl;
char **str = (char **)calloc(1, sizeof(rejectstr));
char *rstr = NULL;
char *strsmall = NULL;
--- 2610,2616 ----
{
domain_entry *de = NULL;
domain_entry *de2 = NULL;
! HTList *hl = NULL;
char **str = (char **)calloc(1, sizeof(rejectstr));
char *rstr = NULL;
char *strsmall = NULL;
***************
*** 2629,2635 ****
*str = rstr;
! for(; (strsmall = LYstrsep(str, ","));) {
if(strsmall == NULL)
break;
--- 2631,2637 ----
*str = rstr;
! while(strsmall = LYstrsep(str, ",")) {
if(strsmall == NULL)
break;
--
Involvement with people is always a very delicate thing --
it requires real maturity to become involved and not get all messed up.
-- Bernard Cooke
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- lynx-dev a few LYCookie.c cleanups,
brian j. pardy <=