break;
default:
cur.type = FT_UNKNOWN;
- DEBUGP (("UNKOWN; "));
+ DEBUGP (("UNKNOWN; "));
break;
}
cur.name = xstrdup(tok);
DEBUGP(("Name: '%s'\n", cur.name));
- /* First column: mm-dd-yy */
+ /* First column: mm-dd-yy. Should atoi() on the month fail, january
+ will be assumed. */
tok = strtok(line, "-");
- month = atoi(tok);
+ month = atoi(tok) - 1;
+ if (month < 0) month = 0;
tok = strtok(NULL, "-");
day = atoi(tok);
tok = strtok(NULL, " ");
int hour, min, sec;
struct tm timestruct;
- char *line, *tok, *p; /* tokenizer */
+ char *line, *tok; /* tokenizer */
struct fileinfo *dir, *l, cur; /* list creation */
fp = fopen (file, "rb");
}
for (i=0; i<12; i++) if (!strcmp(tok,months[i])) break;
/* Uknown months are mapped to January */
- month = (i%12)+1;
- tok = strtok(NULL, " ");
- year = atoi(tok)-1900;
+ month = i % 12 ;
+ tok = strtok (NULL, " ");
+ year = atoi (tok) - 1900;
DEBUGP(("date parsed\n"));
/* Fourth/Third column: Time hh:mm[:ss] */
{
char *tmpu, *tmpp; /* temporary, clean user and passwd */
- tmpu = CLEANDUP (u->user);
- tmpp = u->passwd ? CLEANDUP (u->passwd) : NULL;
+ tmpu = encode_string (u->user);
+ tmpp = u->passwd ? encode_string (u->passwd) : NULL;
upwd = (char *)xmalloc (strlen (tmpu)
+ (tmpp ? (1 + strlen (tmpp)) : 0) + 2);
sprintf (upwd, "%s%s%s@", tmpu, tmpp ? ":" : "", tmpp ? tmpp : "");