comparison lib-src/movemail.c @ 26794:535af4b15059

(popmail): Allow mailbox specifications of the form `po:username:hostname'.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 10 Dec 1999 09:53:01 +0000
parents 134b57acef68
children b88db4a14d76
comparison
equal deleted inserted replaced
26793:ddb7b0201ffb 26794:535af4b15059
683 FILE *sfo; 683 FILE *sfo;
684 char ibuffer[BUFSIZ]; 684 char ibuffer[BUFSIZ];
685 char obuffer[BUFSIZ]; 685 char obuffer[BUFSIZ];
686 char Errmsg[80]; 686 char Errmsg[80];
687 687
688 popmail (user, outfile, preserve, password, reverse_order) 688 /*
689 char *user; 689 * The full legal syntax for a POP mailbox specification for movemail
690 * is "po:username:hostname". The ":hostname" is optional; if it is
691 * omitted, the MAILHOST environment variable will be consulted. Note
692 * that by the time popmail() is called the "po:" has been stripped
693 * off of the front of the mailbox name.
694 *
695 * If the mailbox is in the form "po:username:hostname", then it is
696 * modified by this function -- the second colon is replaced by a
697 * null.
698 */
699
700 popmail (mailbox, outfile, preserve, password, reverse_order)
701 char *mailbox;
690 char *outfile; 702 char *outfile;
691 int preserve; 703 int preserve;
692 char *password; 704 char *password;
693 int reverse_order; 705 int reverse_order;
694 { 706 {
697 int mbfi; 709 int mbfi;
698 FILE *mbf; 710 FILE *mbf;
699 char *getenv (); 711 char *getenv ();
700 popserver server; 712 popserver server;
701 int start, end, increment; 713 int start, end, increment;
702 714 char *user, *hostname;
703 server = pop_open (0, user, password, POP_NO_GETPASS); 715
716 user = mailbox;
717 if ((hostname = index(mailbox, ':')))
718 *hostname++ = '\0';
719
720 server = pop_open (hostname, user, password, POP_NO_GETPASS);
704 if (! server) 721 if (! server)
705 { 722 {
706 error ("Error connecting to POP server: %s", pop_error); 723 error ("Error connecting to POP server: %s", pop_error);
707 return (1); 724 return (1);
708 } 725 }