if (home)
{
int err;
- struct stat buf;
+ struct_stat buf;
char *path = (char *)alloca (strlen (home) + 1
+ strlen (NETRC_FILE_NAME) + 1);
sprintf (path, "%s/%s", home, NETRC_FILE_NAME);
if (a && ! a->acc)
{
/* Free any allocated space. */
- xfree (a->host);
- xfree (a->acc);
- xfree (a->passwd);
+ xfree_null (a->host);
+ xfree_null (a->acc);
+ xfree_null (a->passwd);
}
else
{
parse_netrc (const char *path)
{
FILE *fp;
- char *line, *p, *tok, *premature_token;
+ char *line, *p, *tok;
+ const char *premature_token;
acc_t *current, *retval;
int ln, quote;
p ++;
}
- /* if field was quoted, squash the trailing quotation mark */
+ /* If field was quoted, squash the trailing quotation mark
+ and reset quote flag. */
if (quote)
- shift_left(p);
+ {
+ shift_left (p);
+ quote = 0;
+ }
/* Null-terminate the token, if it isn't already. */
if (*p)
while (l)
{
t = l->next;
- FREE_MAYBE (l->acc);
- FREE_MAYBE (l->passwd);
- FREE_MAYBE (l->host);
+ xfree_null (l->acc);
+ xfree_null (l->passwd);
+ xfree_null (l->host);
xfree (l);
l = t;
}
int
main (int argc, char **argv)
{
- struct stat sb;
+ struct_stat sb;
char *program_name, *file, *target;
acc_t *head, *a;