diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-09-23 05:19:19 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-09-23 05:19:19 +0000 |
commit | dd49e2a559ec49086c1061b456c919819fc08f73 (patch) | |
tree | ec8abf5d121add0e2e584f2c7325ca178927dd27 | |
parent | 549fd99a49ad6decf6638f30e3a3be22cc1a89db (diff) | |
download | fetchmail-dd49e2a559ec49086c1061b456c919819fc08f73.tar.gz fetchmail-dd49e2a559ec49086c1061b456c919819fc08f73.tar.bz2 fetchmail-dd49e2a559ec49086c1061b456c919819fc08f73.zip |
Add code to copy command line, so appending servers doesn't stomp on
the environment space.
svn path=/trunk/; revision=104
-rw-r--r-- | fetchmail.c | 20 | ||||
-rw-r--r-- | fetchmail.h | 2 | ||||
-rw-r--r-- | 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 @@ -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': |