From dd49e2a559ec49086c1061b456c919819fc08f73 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 23 Sep 1996 05:19:19 +0000 Subject: Add code to copy command line, so appending servers doesn't stomp on the environment space. svn path=/trunk/; revision=104 --- fetchmail.c | 20 +++++++++++++------- fetchmail.h | 2 +- options.c | 1 + 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/fetchmail.c b/fetchmail.c index 95e41013..3b9dfc1c 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -90,17 +90,22 @@ main (argc,argv) int argc; char **argv; { - int mboxfd, st; + int mboxfd, st, sargc; struct hostrec cmd_opts, def_opts; int parsestatus; - char *servername, *user, *tmpdir, tmpbuf[256]; + char *servername, *user, *tmpdir, tmpbuf[256], *sargv[64]; FILE *tmpfp; pid_t pid; if (setdefaults(&def_opts) != 0) exit(PS_UNDEFINED); - if ((parsestatus = parsecmdline(argc,argv,&cmd_opts)) < 0) + if (argc > sizeof(sargv)) + exit(PS_SYNTAX); + for (sargc = 0; sargc < argc; sargc++) + sargv[sargc] = argv[sargc]; + + if ((parsestatus = parsecmdline(sargc,sargv,&cmd_opts)) < 0) exit(PS_SYNTAX); if (versioninfo) @@ -110,10 +115,10 @@ char **argv; exit(PS_SYNTAX); if (optind >= argc) - append_server_names(&argc, argv); + append_server_names(&sargc, sargv, sizeof(sargv)); /* build in-core data list on all hosts */ - while ((servername = getnextserver(argc, argv, &parsestatus)) != (char *)0) + while ((servername = getnextserver(sargc, sargv, &parsestatus)) != (char *)0) { if (strcmp(servername, "defaults") == 0) continue; @@ -151,7 +156,8 @@ char **argv; printf(" Lockfile at %s\n", tmpbuf); } if (hostlist == NULL) - (void) printf("No mailservers set up -- perhaps %s is missing?\n", + (void) fprintf(stderr, + "No mailservers set up -- perhaps %s is missing?\n", poprcfile); exit(0); } @@ -386,7 +392,7 @@ struct hostrec *queryctl; char *cp; printf(" Username = '%s'\n", queryctl->remotename); - if (queryctl->password) + if (queryctl->password && outlevel == O_VERBOSE) printf(" Password = '%s'\n", queryctl->password); if (queryctl->rpopid) printf(" RPOP id = '%s'\n", queryctl->rpopid); diff --git a/fetchmail.h b/fetchmail.h index 43d34868..7bfb1921 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -131,7 +131,7 @@ int closeuserfolder (int); int openmailpipe (struct hostrec *); int closemailpipe (int); char *MD5Digest (char *); -void append_server_names(int *, char **); +void append_server_names(int *, char **, int); int daemonize(const char *, void (*)(int)); #else diff --git a/options.c b/options.c index 188464b0..8329b883 100644 --- a/options.c +++ b/options.c @@ -220,6 +220,7 @@ struct hostrec *queryctl; break; case 'm': case LA_MDA: + queryctl->output = TO_MDA; strncpy(queryctl->mda,optarg,sizeof(queryctl->mda)-1); break; case 'P': -- cgit v1.2.3