From 7f52702a7fd4711e863af33beee1f370e4eccdbf Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 28 Nov 1996 17:42:08 +0000 Subject: Abolish servername mamber, go to servernames list. svn path=/trunk/; revision=582 --- uid.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'uid.c') diff --git a/uid.c b/uid.c index 8797c299..15a06ba3 100644 --- a/uid.c +++ b/uid.c @@ -84,7 +84,7 @@ void initialize_saved_lists(struct query *hostlist, const char *idfile) { for (ctl = hostlist; ctl; ctl = ctl->next) { - if (strcmp(host, ctl->servername) == 0 + if (strcmp(host, ctl->servernames->id) == 0 && strcmp(user, ctl->remotename) == 0) { save_uid(&ctl->oldsaved, -1, id); @@ -104,15 +104,18 @@ void initialize_saved_lists(struct query *hostlist, const char *idfile) struct idlist *save_uid(struct idlist **idl, int num, const char *str) /* save a number/UID pair on the given UID list */ { - struct idlist *new; + struct idlist **end; - new = (struct idlist *)xmalloc(sizeof(struct idlist)); - new->val.num = num; - new->id = xstrdup(str); - new->next = *idl; - *idl = new; + /* do it nonrecursively so the list is in the right order */ + for (end = idl; *end; end = &(*end)->next) + continue; + + *end = (struct idlist *)xmalloc(sizeof(struct idlist)); + (*end)->val.num = num; + (*end)->id = xstrdup(str); + (*end)->next = NULL; - return(new); + return(*end); } void free_uid_list(struct idlist **idl) @@ -251,7 +254,7 @@ void write_saved_lists(struct query *hostlist, const char *idfile) for (ctl = hostlist; ctl; ctl = ctl->next) { for (idp = ctl->oldsaved; idp; idp = idp->next) fprintf(tmpfp, "%s@%s %s\n", - ctl->remotename, ctl->servername, idp->id); + ctl->remotename, ctl->servernames->id, idp->id); } for (idp = scratchlist; idp; idp = idp->next) fputs(idp->id, tmpfp); -- cgit v1.2.3