#include <h/tws.h>
#include <pwd.h>
-#ifdef POP
-# include <h/popsbr.h>
-#endif
-
-#ifndef POP
-# define POPminc(a) (a)
-#else
-# define POPminc(a) 0
-#endif
+#include <h/popsbr.h>
#ifndef CYRUS_SASL
# define SASLminc(a) (a)
#define NNOTESW 3
{ "nonotify type", 0 },
#define HOSTSW 4
- { "host hostname", POPminc (-4) },
+ { "host hostname", 0 },
#define USERSW 5
- { "user username", POPminc (-4) },
-#define PORTSW 8
- { "port name/number", POPminc(-4) },
-#define VERSIONSW 10
+ { "user username", 0 },
+#define PORTSW 6
+ { "port name/number", 0 },
+#define VERSIONSW 7
{ "version", 0 },
-#define HELPSW 11
+#define HELPSW 8
{ "help", 0 },
-#define SNOOPSW 12
+#define SNOOPSW 9
{ "snoop", -5 },
-#define SASLSW 14
+#define SASLSW 10
{ "sasl", SASLminc(-4) },
-#define SASLMECHSW 15
+#define SASLMECHSW 11
{ "saslmech", SASLminc(-5) },
-#define PROXYSW 16
- { "proxy command", POPminc(-5) },
+#define PROXYSW 12
+ { "proxy command", 0 },
{ NULL, 0 }
};
#define MAXVEC 51
#define NT_NONE 0x0
+#ifdef NT_NONE
+#endif /* Use NT_NONE to prevent warning from gcc -Wunused-macros. */
#define NT_MAIL 0x1
#define NT_NMAI 0x2
#define NT_ALL (NT_MAIL | NT_NMAI)
*/
static int donote (char *, int);
static int checkmail (char *, char *, int, int, int);
-
-#ifdef POP
static int remotemail (char *, char *, char *, char *, int, int, int, int,
char *);
-#endif
int
int datesw = 1, notifysw = NT_ALL;
int status = 0, sasl = 0;
int snoop = 0, vecp = 0;
- uid_t uid;
char *cp, *host = NULL, *port = NULL, *user, *proxy = NULL;
char buf[BUFSIZ], *saslmech = NULL;
char **argp, **arguments, *vec[MAXVEC];
struct passwd *pw;
-#ifdef HESIOD
- struct hes_postoffice *po;
- char *tmphost;
-#endif
-
#ifdef LOCALE
setlocale(LC_ALL, "");
#endif
context_read();
mts_init (invo_name);
- uid = getuid ();
user = getusername();
arguments = getarguments (invo_name, argc, argv, 1);
argp = arguments;
-#ifdef POP
- if ((cp = getenv ("MHPOPDEBUG")) && *cp)
- snoop++;
-#endif
-
while ((cp = *argp++)) {
if (*cp == '-') {
switch (smatch (++cp, switches)) {
snprintf (buf, sizeof(buf), "%s [switches] [users ...]",
invo_name);
print_help (buf, switches, 1);
- done (1);
+ done (0);
case VERSIONSW:
print_version(invo_name);
- done (1);
+ done (0);
case DATESW:
datesw++;
vec[vecp++] = cp;
}
-#ifdef POP
/*
* If -host is not specified by user
*/
}
if (!host || !*host)
host = NULL;
-#endif /* POP */
if (vecp != 0)
vec[vecp] = NULL;
-#ifdef POP
if (host) {
if (vecp == 0) {
status = remotemail (host, port, user, proxy, notifysw, 1,
snoop, sasl, saslmech);
}
} else {
-#endif /* POP */
if (vecp == 0) {
char *home;
advise (NULL, "no such user as %s", vec[vecp]);
}
}
-#ifdef POP
} /* host == NULL */
-#endif
done (status);
return 1;
}
-#ifdef POP
extern char response[];
static int
ruserpass (host, &user, &pass);
/* open the POP connection */
- if (pop_init (host, user, port, pass, proxy, snoop, sasl, saslmech) == NOTOK
+ if (pop_init (host, port, user, pass, proxy, snoop, sasl, saslmech) == NOTOK
|| pop_stat (&nmsgs, &nbytes) == NOTOK /* check for messages */
|| pop_quit () == NOTOK) { /* quit POP connection */
advise (NULL, "%s", response);
return status;
}
-#endif /* POP */