#include <sys/file.h>
#include <errno.h>
#define NO_SHORTNAMES /* Tell config not to load remap.h */
-#include "../src/config.h"
+#include <../src/config.h>
#ifdef USG
#include <fcntl.h>
#undef close
char *malloc ();
+char *strcpy ();
char *concat ();
char *xmalloc ();
#ifndef errno
{
char *inname, *outname;
int indesc, outdesc;
- char buf[1024];
int nread;
#ifndef MAIL_USE_FLOCK
}
#ifdef MAIL_USE_POP
- if (!bcmp (inname, "po:", 3))
+ if (!strncmp (inname, "po:", 3))
{
int status; char *user;
- user = (char *) rindex (inname, ':') + 1;
+ for (user = &inname[strlen (inname) - 1]; user >= inname; user--)
+ if (*user == ':')
+ break;
+
status = popmail (user, outname);
exit (status);
}
to bug-gnu-emacs@prep.ai.mit.edu so we can fix it. */
lockname = concat (inname, ".lock", "");
- tempname = (char *) xmalloc (strlen (inname) + 20);
- strcpy (tempname, inname);
+ tempname = strcpy (xmalloc (strlen (inname)+1), inname);
p = tempname + strlen (tempname);
while (p != tempname && p[-1] != '/')
p--;
#endif
#endif /* MAIL_USE_FLOCK */
- while (1)
- {
- nread = read (indesc, buf, sizeof buf);
- if (nread != write (outdesc, buf, nread))
- {
- int saved_errno = errno;
- unlink (outname);
- errno = saved_errno;
- pfatal_with_name (outname);
- }
- if (nread < sizeof buf)
- break;
- }
+ {
+ char buf[1024];
+
+ while (1)
+ {
+ nread = read (indesc, buf, sizeof buf);
+ if (nread != write (outdesc, buf, nread))
+ {
+ int saved_errno = errno;
+ unlink (outname);
+ errno = saved_errno;
+ pfatal_with_name (outname);
+ }
+ if (nread < sizeof buf)
+ break;
+ }
+ }
#ifdef BSD
if (fsync (outdesc) < 0)
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
+#include <pwd.h>
#ifdef USG
#include <fcntl.h>
register int i;
int mbfi;
FILE *mbf;
+ struct passwd *pw = (struct passwd *) getpwuid (getuid ());
+ if (pw == NULL)
+ fatal ("cannot determine user name");
host = getenv ("MAILHOST");
if (host == NULL)
}
if (pop_command ("USER %s", user) == NOTOK
- || pop_command ("RPOP %s", user) == NOTOK)
+ || pop_command ("RPOP %s", pw->pw_name) == NOTOK)
{
pop_command ("QUIT");
fatal (Errmsg);