aboutsummaryrefslogtreecommitdiffstats
path: root/fetchmail.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-07-04 15:39:33 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-07-04 15:39:33 +0000
commit3fdc882c9627f13b63eb087c71e96caf045da05d (patch)
tree6644b48a9142277f5bf35a8c4f036df710a3d442 /fetchmail.c
parent2afc40a88856ba00c517ca9d58ec834a3492aa91 (diff)
downloadfetchmail-3fdc882c9627f13b63eb087c71e96caf045da05d.tar.gz
fetchmail-3fdc882c9627f13b63eb087c71e96caf045da05d.tar.bz2
fetchmail-3fdc882c9627f13b63eb087c71e96caf045da05d.zip
Move environment query stuff to env.c.
svn path=/trunk/; revision=1151
Diffstat (limited to 'fetchmail.c')
-rw-r--r--fetchmail.c58
1 files changed, 2 insertions, 56 deletions
diff --git a/fetchmail.c b/fetchmail.c
index e6e27151..3700b0e8 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -90,49 +90,14 @@ int main (int argc, char **argv)
{
int st, bkgd = FALSE;
int parsestatus, implicitmode = FALSE;
- char *home, *tmpdir, tmpbuf[BUFSIZ];
struct passwd *pw;
struct query *ctl;
FILE *lockfp;
netrc_entry *netrc_list;
- char *netrc_file;
+ char *netrc_file, tmpbuf[BUFSIZ];
pid_t pid;
- if ((program_name = strrchr(argv[0], '/')) != NULL)
- ++program_name;
- else
- program_name = argv[0];
-
- if ((user = getenv("USER")) == (char *)NULL)
- user = getenv("LOGNAME");
-
- if ((user == (char *)NULL) || (home = getenv("HOME")) == (char *)NULL)
- {
- if ((pw = getpwuid(getuid())) != NULL)
- {
- user = pw->pw_name;
- home = pw->pw_dir;
- }
- else
- {
- fprintf(stderr,"fetchmail: can't find your name and home directory!\n");
- exit(PS_UNDEFINED);
- }
- }
-
- /* we'll need this for the SMTP forwarding target and error messages */
- if (gethostname(tmpbuf, sizeof(tmpbuf)))
- {
- fprintf(stderr, "fetchmail: can't determine fetchmail's host!");
- exit(PS_IOERR);
- }
- fetchmailhost = xstrdup(tmpbuf);
-
-#define RCFILE_NAME ".fetchmailrc"
- rcfile = (char *) xmalloc(strlen(home)+strlen(RCFILE_NAME)+2);
- strcpy(rcfile, home);
- strcat(rcfile, "/");
- strcat(rcfile, RCFILE_NAME);
+ envquery(argc, argv);
#define IDFILE_NAME ".fetchids"
idfile = (char *) xmalloc(strlen(home)+strlen(IDFILE_NAME)+2);
@@ -722,25 +687,6 @@ void termhook(int sig)
exit(querystatus);
}
-static char *showproto(int proto)
-/* protocol index to protocol name mapping */
-{
- switch (proto)
- {
- case P_AUTO: return("auto"); break;
-#ifdef POP2_ENABLE
- case P_POP2: return("POP2"); break;
-#endif /* POP2_ENABLE */
- case P_POP3: return("POP3"); break;
- case P_IMAP: return("IMAP"); break;
- case P_IMAP_K4: return("IMAP-K4"); break;
- case P_APOP: return("APOP"); break;
- case P_RPOP: return("RPOP"); break;
- case P_ETRN: return("ETRN"); break;
- default: return("unknown?!?"); break;
- }
-}
-
/*
* Sequence of protocols to try when autoprobing, most capable to least.
*/