aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fetchmail.c32
-rw-r--r--fetchmail.h2
2 files changed, 9 insertions, 25 deletions
diff --git a/fetchmail.c b/fetchmail.c
index 42389932..f9f606dc 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -134,43 +134,25 @@ char **argv;
if (implicitmode = (optind >= argc))
{
for (hostp = hostlist; hostp; hostp = hostp->next)
- hostp->active = 1;
+ hostp->active = TRUE;
}
else
for (; optind < argc; optind++)
{
- int found;
-
/*
* If hostname corresponds to a host known from the rc file,
* simply declare it active. Otherwise synthesize a host
* record from command line and defaults
*/
- found = FALSE;
for (hostp = hostlist; hostp; hostp = hostp->next)
if (strcmp(hostp->servername, argv[optind]) == 0)
- {
- found = TRUE;
- break;
- }
+ goto foundit;
- if (found)
- hostp->active = TRUE;
- else
- {
- hostp = (struct hostrec *)xmalloc(sizeof(struct hostrec));
-
- memcpy(hostp, &cmd_opts, sizeof(struct hostrec));
- strcpy(hostp->servername, argv[optind]);
- hostp->active = TRUE;
-
- /* append to end of list */
- if (hosttail != (struct hostrec *) 0)
- hosttail->next = hostp;
- else
- hostlist = hostp;
- hosttail = hostp;
- }
+ hostp = hostalloc(&cmd_opts);
+ strcpy(hostp->servername, argv[optind]);
+
+ foundit:
+ hostp->active = TRUE;
}
/* merge in defaults for empty fields, then lose defaults record */
diff --git a/fetchmail.h b/fetchmail.h
index caa6fee2..cc25f178 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -127,6 +127,7 @@ int doPOP2 (struct hostrec *);
int doPOP3 (struct hostrec *);
int doIMAP (struct hostrec *);
+struct hostrec *hostalloc(struct hostrec *);
int parsecmdline (int, char **, struct hostrec *);
void optmerge(struct hostrec *, struct hostrec *);
char *MD5Digest (char *);
@@ -135,6 +136,7 @@ int daemonize(const char *, void (*)(int));
#else
+struct hostrec *hostinit();
char *MD5Digest ();
void optmerge();