aboutsummaryrefslogtreecommitdiffstats
path: root/env.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-09-16 23:24:18 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-09-16 23:24:18 +0000
commit763d1ace340134df6a237469bb5b76bc86cbbbec (patch)
tree35e2807b4c60c9e7719a5635c48780fea1d14e64 /env.c
parent54f14b712e3e8f6007192dfdc2c94d6aec369946 (diff)
downloadfetchmail-763d1ace340134df6a237469bb5b76bc86cbbbec.tar.gz
fetchmail-763d1ace340134df6a237469bb5b76bc86cbbbec.tar.bz2
fetchmail-763d1ace340134df6a237469bb5b76bc86cbbbec.zip
improved ETRN handling.
svn path=/trunk/; revision=1358
Diffstat (limited to 'env.c')
-rw-r--r--env.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/env.c b/env.c
index fd46df10..06f9da67 100644
--- a/env.c
+++ b/env.c
@@ -16,6 +16,9 @@
#include <pwd.h>
#include <string.h>
#include <ctype.h>
+#ifdef HAVE_GETHOSTBYNAME
+#include <netdb.h>
+#endif /* HAVE_GETHOSTBYNAME */
extern char *getenv(); /* needed on sysV68 R3V7.1. */
@@ -60,6 +63,21 @@ void envquery(int argc, char **argv)
fprintf(stderr, "%s: can't determine your host!", program_name);
exit(PS_IOERR);
}
+#ifdef HAVE_GETHOSTBYNAME
+ {
+ struct hostent *hp;
+
+ /* in case we got a basename (as we do in Linux) make a FQDN of it */
+ hp = gethostbyname(tmpbuf);
+ if (hp == (struct hostent *) NULL)
+ {
+ /* exit with error message */
+ fprintf(stderr, "gethostbyname failed for %s", tmpbuf);
+ exit(PS_DNS);
+ }
+ strcpy(tmpbuf, hp->h_name);
+ }
+#endif /* HAVE_GETHOSTBYNAME */
fetchmailhost = xstrdup(tmpbuf);
#define RCFILE_NAME ".fetchmailrc"