Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

fyi> popme version 0.04 (simple pop3 client) (2/3)

15 views
Skip to first unread message

Robin A. Goodfellow

unread,
Oct 10, 1997, 3:00:00 AM10/10/97
to

Submitted-by: r...@earthling.net
Archive-name: popme-0.04/part02

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is part 02 of popme-0.04.
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
shar_touch=touch
else
shar_touch=:
echo 'WARNING: not restoring timestamps'
fi
rm -f 1231235999 $$.touch
#
# ============= popme-0.04/getopt1.c ==============
if test ! -d 'popme-0.04'; then
echo 'x - creating directory popme-0.04'
mkdir 'popme-0.04'
fi
if test -f 'popme-0.04/getopt1.c' && test X"$1" != X"-c"; then
echo 'x - skipping popme-0.04/getopt1.c (File already exists)'
else
echo 'x - extracting popme-0.04/getopt1.c (text)'
sed 's/^X//' << 'United Earthlings, Inc.' > 'popme-0.04/getopt1.c' &&
/* Getopt for GNU.
X Copyright (C) 1987, 88, 89, 90, 91, 1992 Free Software Foundation, Inc.
X
X This program is free software; you can redistribute it and/or modify it
X under the terms of the GNU General Public License as published by the
X Free Software Foundation; either version 2, or (at your option) any
X later version.
X
X This program is distributed in the hope that it will be useful,
X but WITHOUT ANY WARRANTY; without even the implied warranty of
X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X GNU General Public License for more details.
X
X You should have received a copy of the GNU General Public License
X along with this program; if not, write to the Free Software
X Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
X
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
X
#include "getopt.h"
X
#if !__STDC__ && !defined(const)
#define const
#endif
X
#include <stdio.h>
X
/* This needs to come after some library #include
X to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#else
char *getenv ();
#endif
X
#ifndef NULL
#define NULL 0
#endif
X
int
getopt_long (argc, argv, options, long_options, opt_index)
X int argc;
X char *const *argv;
X const char *options;
X const struct option *long_options;
X int *opt_index;
{
X return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
X
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
X If an option that starts with '-' (not '--') doesn't match a long option,
X but does match a short option, it is parsed as a short option
X instead. */
X
int
getopt_long_only (argc, argv, options, long_options, opt_index)
X int argc;
X char *const *argv;
X const char *options;
X const struct option *long_options;
X int *opt_index;
{
X return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}
X
#ifdef TEST
X
#include <stdio.h>
X
int
main (argc, argv)
X int argc;
X char **argv;
{
X int c;
X int digit_optind = 0;
X
X while (1)
X {
X int this_option_optind = optind ? optind : 1;
X int option_index = 0;
X static struct option long_options[] =
X {
X {"add", 1, 0, 0},
X {"append", 0, 0, 0},
X {"delete", 1, 0, 0},
X {"verbose", 0, 0, 0},
X {"create", 0, 0, 0},
X {"file", 1, 0, 0},
X {0, 0, 0, 0}
X };
X
X c = getopt_long (argc, argv, "abc:d:0123456789",
X long_options, &option_index);
X if (c == EOF)
X break;
X
X switch (c)
X {
X case 0:
X printf ("option %s", long_options[option_index].name);
X if (optarg)
X printf (" with arg %s", optarg);
X printf ("\n");
X break;
X
X case '0':
X case '1':
X case '2':
X case '3':
X case '4':
X case '5':
X case '6':
X case '7':
X case '8':
X case '9':
X if (digit_optind != 0 && digit_optind != this_option_optind)
X printf ("digits occur in two different argv-elements.\n");
X digit_optind = this_option_optind;
X printf ("option %c\n", c);
X break;
X
X case 'a':
X printf ("option a\n");
X break;
X
X case 'b':
X printf ("option b\n");
X break;
X
X case 'c':
X printf ("option c with value `%s'\n", optarg);
X break;
X
X case 'd':
X printf ("option d with value `%s'\n", optarg);
X break;
X
X case '?':
X break;
X
X default:
X printf ("?? getopt returned character code 0%o ??\n", c);
X }
X }
X
X if (optind < argc)
X {
X printf ("non-option ARGV-elements: ");
X while (optind < argc)
X printf ("%s ", argv[optind++]);
X printf ("\n");
X }
X
X exit (0);
}
X
#endif /* TEST */
United Earthlings, Inc.
$shar_touch -am 1010102297 'popme-0.04/getopt1.c' &&
chmod 0644 'popme-0.04/getopt1.c' ||
echo 'restore of popme-0.04/getopt1.c failed'
shar_count="`wc -c < 'popme-0.04/getopt1.c'`"
test 3476 -eq "$shar_count" ||
echo "popme-0.04/getopt1.c: original size 3476, current size $shar_count"
fi
# ============= popme-0.04/getopt.h ==============
if test -f 'popme-0.04/getopt.h' && test X"$1" != X"-c"; then
echo 'x - skipping popme-0.04/getopt.h (File already exists)'
else
echo 'x - extracting popme-0.04/getopt.h (text)'
sed 's/^X//' << 'United Earthlings, Inc.' > 'popme-0.04/getopt.h' &&
/* Declarations for getopt.
X Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
X
X This program is free software; you can redistribute it and/or modify it
X under the terms of the GNU General Public License as published by the
X Free Software Foundation; either version 2, or (at your option) any
X later version.
X
X This program is distributed in the hope that it will be useful,
X but WITHOUT ANY WARRANTY; without even the implied warranty of
X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X GNU General Public License for more details.
X
X You should have received a copy of the GNU General Public License
X along with this program; if not, write to the Free Software
X Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
X
#ifndef _GETOPT_H
#define _GETOPT_H 1
X
#ifdef __cplusplus
extern "C" {
#endif
X
/* For communication from `getopt' to the caller.
X When `getopt' finds an option that takes an argument,
X the argument value is returned here.
X Also, when `ordering' is RETURN_IN_ORDER,
X each non-option ARGV-element is returned here. */
X
extern char *optarg;
X
/* Index in ARGV of the next element to be scanned.
X This is used for communication to and from the caller
X and for communication between successive calls to `getopt'.
X
X On entry to `getopt', zero means this is the first call; initialize.
X
X When `getopt' returns EOF, this is the index of the first of the
X non-option elements that the caller should itself scan.
X
X Otherwise, `optind' communicates from one call to the next
X how much of ARGV has been scanned so far. */
X
extern int optind;
X
/* Callers store zero here to inhibit the error message `getopt' prints
X for unrecognized options. */
X
extern int opterr;
X
/* Describe the long-named options requested by the application.
X The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
X of `struct option' terminated by an element containing a name which is
X zero.
X
X The field `has_arg' is:
X no_argument (or 0) if the option does not take an argument,
X required_argument (or 1) if the option requires an argument,
X optional_argument (or 2) if the option takes an optional argument.
X
X If the field `flag' is not NULL, it points to a variable that is set
X to the value given in the field `val' when the option is found, but
X left unchanged if the option is not found.
X
X To have a long-named option do something other than set an `int' to
X a compiled-in constant, such as set a value from `optarg', set the
X option's `flag' field to zero and its `val' field to a nonzero
X value (the equivalent single-letter option character, if there is
X one). For long options that have a zero `flag' field, `getopt'
X returns the contents of the `val' field. */
X
struct option
{
#if __STDC__
X const char *name;
#else
X char *name;
#endif
X /* has_arg can't be an enum because some compilers complain about
X type mismatches in all the code that assumes it is an int. */
X int has_arg;
X int *flag;
X int val;
};
X
/* Names for the values of the `has_arg' field of `struct option'. */
X
#define no_argument 0
#define required_argument 1
#define optional_argument 2
X
#if __STDC__
#if defined(__GNU_LIBRARY__)
/* Many other libraries have conflicting prototypes for getopt, with
X differences in the consts, in stdlib.h. To avoid compilation
X errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt ();
#endif /* not __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
X const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
X const char *shortopts,
X const struct option *longopts, int *longind);
X
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
X const char *shortopts,
X const struct option *longopts, int *longind,
X int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();
X
extern int _getopt_internal ();
#endif /* not __STDC__ */
X
#ifdef __cplusplus
}
#endif
X
#endif /* _GETOPT_H */
United Earthlings, Inc.
$shar_touch -am 1010102297 'popme-0.04/getopt.h' &&
chmod 0644 'popme-0.04/getopt.h' ||
echo 'restore of popme-0.04/getopt.h failed'
shar_count="`wc -c < 'popme-0.04/getopt.h'`"
test 4333 -eq "$shar_count" ||
echo "popme-0.04/getopt.h: original size 4333, current size $shar_count"
fi
# ============= popme-0.04/net.c ==============
if test -f 'popme-0.04/net.c' && test X"$1" != X"-c"; then
echo 'x - skipping popme-0.04/net.c (File already exists)'
else
echo 'x - extracting popme-0.04/net.c (text)'
sed 's/^X//' << 'United Earthlings, Inc.' > 'popme-0.04/net.c' &&
/*
X * Copyright (c) 1997 Sirius Cybernetics Corp. All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X * notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X * notice, this list of conditions and the following disclaimer in the
X * documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X * must display the following acknowledgement:
X * This product includes software developed by SIRIUS CYBERNETICS
X * CORPORATION, AND ITS CONTRIBUTORS.
X * 4. Neither the name of the Company nor the names of its contributors
X * may be used to endorse or promote products derived from this software
X * without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY SIRIUS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL SIRIUS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
#ifndef lint
static char *rcsid = "$Id: net.c,v 1.283 1997/08/13 15:35:18 goodfellow Rel $";
#endif
X
#include <sys/types.h>
#include <stdio.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <termios.h>
#include <unistd.h>
X
X
extern int Make_Connection (/* int port, char *buf */);
extern int debug;
X
int sockfd = -1;
X
#ifdef DEBUG
X
void
net_sendline (buf)
X char *buf;
{
X printf ("%s", buf);
}
X
int
net_connect (host)
X char *host;
{
X return 0;
}
X
void
net_init ()
{
X ;
}
X
int
net_getline (buf, len, timeout)
X char *buf;
X int len;
X long timeout;
{
X char *t;
X
X gets (buf);
X if ((t = strchr (buf, '\n')) != NULL)
X *t = 0;
X return 0;
}
X
#else
X
static int
connect_to (address, port)
X char *address;
X int port;
{
X return (Make_Connection (port, address));
}
X
void
net_init ()
{
X ;
}
X
int
net_sendline (buf)
X char *buf;
{
X if (debug)
X fprintf (stderr, ">%s", buf);
X
X if (write (sockfd, buf, strlen (buf)) != strlen (buf))
X {
X perror ("sendline");
X return (-1);
X }
X
X return 0;
}
X
int
net_connect (host, port)
X char *host;
X int port;
{
X sockfd = connect_to (host, port);
X if (sockfd == -1)
X return (-1);
X
X return 0;
}
X
void
cause_int ()
{
X ;
}
X
int
net_getline (buf, len, timeout)
X char *buf;
X int len;
X long timeout;
{
X int got = 0;
X int err;
X
X signal (SIGALRM, cause_int);
X alarm (timeout);
X while (1)
X {
X if (got == len)
X return (-2);
X err = read (sockfd, &buf[got], 1);
X if (err != 1)
X {
X perror ("getline");
X if (errno != EINTR)
X return -1;
X return -3;
X }
X if (buf[got] == '\n')
X {
X if (got > 0 && buf[got - 1] == '\r')
X buf[got - 1] = 0;
X else
X buf[got] = 0;
X
X if (debug)
X fprintf (stderr, "<%s\n", buf);
X
X return 0;
X }
X got++;
X }
}
#endif /* DEBUG */
United Earthlings, Inc.
$shar_touch -am 1010102297 'popme-0.04/net.c' &&
chmod 0644 'popme-0.04/net.c' ||
echo 'restore of popme-0.04/net.c failed'
shar_count="`wc -c < 'popme-0.04/net.c'`"
test 3767 -eq "$shar_count" ||
echo "popme-0.04/net.c: original size 3767, current size $shar_count"
fi
# ============= popme-0.04/socks.c ==============
if test -f 'popme-0.04/socks.c' && test X"$1" != X"-c"; then
echo 'x - skipping popme-0.04/socks.c (File already exists)'
else
echo 'x - extracting popme-0.04/socks.c (text)'
sed 's/^X//' << 'United Earthlings, Inc.' > 'popme-0.04/socks.c' &&
/*
X * Copyright (c) 1997 Sirius Cybernetics Corp. All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X * notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X * notice, this list of conditions and the following disclaimer in the
X * documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X * must display the following acknowledgement:
X * This product includes software developed by SIRIUS CYBERNETICS
X * CORPORATION, AND ITS CONTRIBUTORS.
X * 4. Neither the name of the Company nor the names of its contributors
X * may be used to endorse or promote products derived from this software
X * without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY SIRIUS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL SIRIUS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
#ifndef lint
static char *rcsid = "$Id: socks.c,v 1.283 1997/08/11 11:15:52 goodfellow Rel $";
#endif
X
/*
X * Set up a socket
X *
X * Alan Cox 1990
X *
X * This software is placed in the public domain
X */
X
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
X
X
/*
X * Create the client socket
X */
X
int
Make_Connection (port, buf)
X int port;
X char *buf;
{
X struct sockaddr_in myaddress;
X struct hostent *host;
X int v;
X
X host = gethostbyname (buf);
X if (host == NULL)
X {
X return (-1);
X }
X myaddress.sin_family = host->h_addrtype;
X myaddress.sin_addr.s_addr = *((long *) host->h_addr);
X myaddress.sin_port = htons (port);
X
X v = socket (AF_INET, SOCK_STREAM, 0);
X if (v == -1)
X {
X return (-1);
X }
X if (connect (v, (struct sockaddr *) &myaddress, sizeof (myaddress)) < 0)
X {
X close (v);
X return (-1);
X }
X
X return (v);
}
United Earthlings, Inc.
$shar_touch -am 1010102397 'popme-0.04/socks.c' &&
chmod 0644 'popme-0.04/socks.c' ||
echo 'restore of popme-0.04/socks.c failed'
shar_count="`wc -c < 'popme-0.04/socks.c'`"
test 2806 -eq "$shar_count" ||
echo "popme-0.04/socks.c: original size 2806, current size $shar_count"
fi
# ============= popme-0.04/popme.c ==============
if test -f 'popme-0.04/popme.c' && test X"$1" != X"-c"; then
echo 'x - skipping popme-0.04/popme.c (File already exists)'
else
echo 'x - extracting popme-0.04/popme.c (text)'
sed 's/^X//' << 'United Earthlings, Inc.' > 'popme-0.04/popme.c' &&
/*
X * Copyright (c) 1997 Sirius Cybernetics Corp. All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X * notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X * notice, this list of conditions and the following disclaimer in the
X * documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X * must display the following acknowledgement:
X * This product includes software developed by SIRIUS CYBERNETICS
X * CORPORATION, AND ITS CONTRIBUTORS.
X * 4. Neither the name of the Company nor the names of its contributors
X * may be used to endorse or promote products derived from this software
X * without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY SIRIUS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL SIRIUS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
#ifndef lint
static char *rcsid = "$Id: popme.c,v 1.283 1997/09/25 15:31:57 goodfellow Rel $";
#endif
X
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <getopt.h>
#include "popme.h"
#include "config.h"
X
X
/* Standard isn't clear if its 512+\r\n or 512 = 515 */
char linebuffer[BUFSIZ];
X
/* program options */
int deletemail = 0; /* send POP3 DELE cmd */
int topmail = 0; /* send POP3 TOP cmd */
int linestotop = 0; /* ltt, how many lines after the POP3 TOP cmd */
int debug = 0;
int verbose = 0;
X
char *pop3_server = NULL;
char *pop3_user = NULL;
char *pop3_passwd = NULL;
int pop3_port = 110;
X
static struct option options[] =
{
X {"server", 1, 0, 's'},
X {"user", 1, 0, 'u'},
X {"passwd", 1, 0, 'p'},
X {"port", 1, 0, 'P'},
X {"delete", 0, 0, 'D'},
X {"top", 1, 0, 'T'},
X {"debug", 0, 0, 'd'},
X {"help", 0, 0, 'h'},
X {"output", 1, 0, 'o'},
X {"verbose", 0, 0, 'v'},
X {"version", 0, 0, 'V'},
X {"warranty", 0, 0, 'W'},
X {0, 0, 0, 0}
};
X
char *program_name; /* pointer to program's name */
char *program_version = VERSION; /* pointer to program's version */
char *program_output; /* pointer to name of output file */
char *program_specs = SPECS;
X
X
void
whoops (error, whatweupto)
X int error;
X char *whatweupto;
{
X if (error == -1)
X {
X fprintf (stderr, "%s: failed while %s: Network error.\n", program_name, whatweupto);
X exit (1);
X }
X if (error == -2)
X {
X fprintf (stderr, "%s: failed while %s: No response after %ld seconds.\n", program_name, whatweupto, IO_TIMEOUT);
X exit (1);
X }
X if (error == -3)
X {
X fprintf (stderr, "%s: was given a stupidly long line while %s by the remote POP3 server.\n", program_name, whatweupto);
X exit (1);
X }
}
X
void
check_all_is_hoopy (whatweupto)
X char *whatweupto;
{
X int error = net_getline (linebuffer, BUFSIZ, IO_TIMEOUT);
X
X if (error < 0)
X whoops (error, whatweupto);
X
X if (verbose)
X fprintf (stderr, "%s: %s...\n", program_name, whatweupto);
X
X if (*linebuffer == '-')
X {
X char *lp = linebuffer;
X while (*lp && !isspace (*lp))
X lp++;
X fprintf (stderr, "%s: was told '%s' while %s and gave up.\n", program_name, lp + 1, whatweupto);
X exit (1);
X }
}
X
void
login_the_user (user, pwd)
X char *user;
X char *pwd;
{
X char buf[BUFSIZ];
X char *name;
X char *pass;
X
X if (user == NULL)
X name = getlogin ();
X else
X name = user;
X if (name == NULL)
X {
X fprintf (stderr, "%s: It's kind of hard to ask for your mail if I don't know who you are!\n", program_name);
X exit (1);
X }
X sprintf (buf, "USER %s\r\n", name);
X net_sendline (buf);
X check_all_is_hoopy ("sending the username");
X
X if (pwd == NULL)
X {
X pass = (char *) getpass ("POP3 Password: ");
X }
X else
X {
X pass = pwd;
X }
X
X sprintf (buf, "PASS %s\r\n", pass);
X net_sendline (buf);
X check_all_is_hoopy ("sending the password");
}
X
X
Message *Messages = NULL;
X
int
get_msg_list ()
{
X Message *m, *last = NULL;
X int error;
X char *lp, *tmp;
X
X net_sendline ("LIST\r\n");
X check_all_is_hoopy ("getting a message list");
X
X while (1)
X {
X error = net_getline (linebuffer, BUFSIZ, IO_TIMEOUT);
X if (error < 0)
X whoops (error, "reading the list of messages");
X
X lp = linebuffer;
X if (*lp == '.')
X {
X if (lp[1] == 0)
X break;
X lp++;
X }
X m = (Message *) malloc (sizeof (Message));
X if (m == NULL)
X {
X fprintf (stderr, "%s: ran out of memory.\n", program_name);
X exit (1);
X }
X m->Next = NULL;
X if (last != NULL)
X last->Next = m;
X else
X Messages = m;
X last = m;
X tmp = lp;
X while (*lp && !isspace (*lp))
X lp++;
X *lp = 0;
X m->Identity = strdup (tmp);
X if (m->Identity == NULL)
X {
X fprintf (stderr, "%s: ran out of memory.\n", program_name);
X exit (1);
X }
X }
X
X return 0;
}
X
int
fetch_message (m)
X Message *m;
{
X char buf[BUFSIZ];
X int error;
X char *lp;
X int past_header = 0;
X
X /* Amateur radio wants to send a single packet of the request
X for those poor 1200 baud people ! */
X if (strlen (m->Identity) > 100)
X {
X net_sendline ("RETR ");
X net_sendline (m->Identity);
X net_sendline ("\r\n");
X }
X else
X {
X sprintf (buf, "RETR %s\r\n", m->Identity);
X net_sendline (buf);
X }
X check_all_is_hoopy ("fetching a message");
X
X while (1)
X {
X error = net_getline (linebuffer, BUFSIZ, IO_TIMEOUT);
X if (error < 0)
X whoops (error, "fetching a message");
X lp = linebuffer;
X if (*lp == '.')
X {
X if (lp[1] == 0)
X break;
X lp++;
X }
X
X /* Quote from lines */
X if (past_header && strncmp (lp, "From", 4) == 0)
X fputc ('>', stdout);
X if (*lp == 0)
X past_header = 1;
X fputs (lp, stdout);
X fputc ('\n', stdout);
X }
X
X if (deletemail)
X {
X if (strlen (m->Identity) > 100)
X {
X net_sendline ("DELE ");
X net_sendline (m->Identity);
X net_sendline ("\r\n");
X }
X else
X {
X sprintf (buf, "DELE %s\r\n", m->Identity);
X net_sendline (buf);
X }
X check_all_is_hoopy ("deleting a message");
X }
X
X return 0;
}
X
int
top_of_message (m, ltt)
X Message *m;
X int ltt;
{
X char buf[BUFSIZ];
X int error;
X char *lp;
X int past_header = 0;
X
X /* Amateur radio wants to send a single packet of the request
X for those poor 1200 baud people ! */
X if (strlen (m->Identity) > 100)
X {
X net_sendline ("TOP ");
X net_sendline (m->Identity);
X net_sendline ("\r\n");
X }
X else
X {
X sprintf (buf, "TOP %s %d\r\n", m->Identity, ltt);
X net_sendline (buf);
X }
X check_all_is_hoopy ("fetching top of a message");
X
X while (1)
X {
X error = net_getline (linebuffer, BUFSIZ, IO_TIMEOUT);
X if (error < 0)
X whoops (error, "fetching top of a message");
X lp = linebuffer;
X if (*lp == '.')
X {
X if (lp[1] == 0)
X break;
X lp++;
X }
X
X /* Quote from lines */
X if (past_header && strncmp (lp, "From", 4) == 0)
X fputc ('>', stdout);
X if (*lp == 0)
X past_header = 1;
X fputs (lp, stdout);
X fputc ('\n', stdout);
X }
X
X return 0;
}
X
/*
X * usage -- print usage information
X */
int
usage ()
{
X fprintf (stderr, "Usage: %s [options] file(s)...\n\
\n\
The options are:\n\
X `--server SERV' or `-s' to set the POP3 server SERV.\n\
X `--user ID' or `-u' to set the POP3 user ID.\n\
X `--passwd PWD' or `-p' to set the POP3 password PWD.\n\
X `--port PORT' or `-P' to set the POP3 server port. Default is 110.\n\
X `--delete' or `-D' to delete mail from server. Default is to keep mail.\n\
X `--top LINES' or `-T' to get only the top LINES of mail.\n\n\
Other options are:\n\
X `--debug' or `-d' to print debugging information.\n\
X `--help' or `-h' to print this information.\n\
X `--output FILE' or `-o FILE'\n\
\tto specify the output file. If you do not specify\n\
\tan output file, the program writes to `stdout'.\n\
X `--verbose' or `-v' to print information about what is being done.\n\
X `--version' or `-V' to print version and COPYRIGHT information.\n\
X `--warranty' or `-W' to print WARRANTY information.\n\n",
X program_name);
X return 0;
}
X
X
/*
X * version -- print version information
X */
int
version ()
{
X fprintf (stderr, "This is %s version %s\n", program_name, program_version);
X fprintf (stderr, "%s\n", program_specs);
X fprintf (stderr, "Copyright (c) 1997 Robin A. Goodfellow. All rights reserved.\n");
X fprintf (stderr, "Type `%s -W' for WARRANTY information, and `%s --help' for HELP.\n", program_name, program_name);
X return 0;
}
X
X
/*
X * warranty -- print warranty information
X */
int
warranty ()
{
X fprintf (stderr, "This program is free software; you can redistribute it and/or modify\n\
it under the terms of the GNU General Public License as published by\n\
the Free Software Foundation; either version 2 of the License, or\n\
(at your option) any later version.\n\
\n\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\
\n\
You should have received a copy of the GNU General Public License\n\
along with this program; if not, write to the Free Software\n\
Foundation, 59 Temple Place--Suite 330, Boston, MA 02111-1307, USA.\n\n");
X return 0;
}
X
X
/*
X * basename -- strip pathname from filename
X */
char *
basename (s)
X char *s;
{
X char *this;
X
X /* no path separator? */
X if ((this = (char *) strrchr (s, '/')) == NULL)
X this = s;
X else
X this++;
X
X return this;
}
X
X
int
main (argc, argv)
X int argc;
X char **argv;
{
X int c, i;
X
X /* whoami ? */
X program_name = basename (argv[0]);
X
X /* parse options */
X while ((c = getopt_long (argc, argv, "s:u:p:P:dDho:vT:VW", options, &i)) != EOF)
X {
X /* a long option? */
X if (c == 0)
X {
X c = options[i].val;
X }
X switch (c)
X {
X case 's':
X pop3_server = optarg;
X break;
X
X case 'u':
X pop3_user = optarg;
X break;
X
X case 'p':
X pop3_passwd = optarg;
X break;
X
X case 'P':
X pop3_port = atoi (optarg);
X break;
X
X case 'd':
X debug = 1;
X break;
X
X case 'D':
X deletemail = 1;
X break;
X
X case 'T':
X topmail = 1;
X linestotop = atoi (optarg);
X break;
X
X case 'o':
X program_output = optarg;
X if (freopen (program_output, "w", stdout) == NULL)
X {
X perror (program_output);
X return 1;
X }
X break;
X
X case 'v':
X verbose = 1;
X break;
X
X case 'V':
X version ();
X return 1;
X break;
X
X case 'W':
X warranty ();
X return 1;
X break;
X
X case 'h':
X default:
X usage ();
X return 1;
X break;
X }
X }
X
X /* okay let's doit... */
X if ((pop3_server != NULL) && (pop3_user != NULL) && (pop3_passwd != NULL))
X {
X net_init ();
X popme ();
X }
X else
X {
X usage ();
X return 1;
X }
X
X return 0;
}
X
int
popme ()
{
X Message *m;
X
X if (net_connect (pop3_server, pop3_port) == -1)
X {
X fprintf (stderr, "%s: cannot connect to `%s'.\n", program_name, pop3_server);
X exit (1);
X }
X
X check_all_is_hoopy ("waiting for the banner to fall");
X login_the_user (pop3_user, pop3_passwd);
X get_msg_list ();
X
X m = Messages;
X if (m == NULL)
X fprintf (stderr, "%s: Sorry, no fish.\n", program_name);
X
X while (m != NULL)
X {
X if (!topmail)
X fetch_message (m);
X else
X top_of_message (m, linestotop);
X m = m->Next;
X }
X
X if (!deletemail)
X {
X net_sendline ("RSET\r\n");
X check_all_is_hoopy ("resetting the server");
X }
X
X net_sendline ("QUIT\r\n");
X check_all_is_hoopy ("logging out");
X
X return 0;
}
United Earthlings, Inc.
$shar_touch -am 1010102397 'popme-0.04/popme.c' &&
chmod 0644 'popme-0.04/popme.c' ||
echo 'restore of popme-0.04/popme.c failed'
shar_count="`wc -c < 'popme-0.04/popme.c'`"
test 12410 -eq "$shar_count" ||
echo "popme-0.04/popme.c: original size 12410, current size $shar_count"
fi
# ============= popme-0.04/popme.h ==============
if test -f 'popme-0.04/popme.h' && test X"$1" != X"-c"; then
echo 'x - skipping popme-0.04/popme.h (File already exists)'
else
echo 'x - extracting popme-0.04/popme.h (text)'
sed 's/^X//' << 'United Earthlings, Inc.' > 'popme-0.04/popme.h' &&
/*
X * Copyright (c) 1997 Sirius Cybernetics Corp. All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X * notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X * notice, this list of conditions and the following disclaimer in the
X * documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X * must display the following acknowledgement:
X * This product includes software developed by SIRIUS CYBERNETICS
X * CORPORATION, AND ITS CONTRIBUTORS.
X * 4. Neither the name of the Company nor the names of its contributors
X * may be used to endorse or promote products derived from this software
X * without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY SIRIUS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL SIRIUS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
#ifndef __POPME_H__
#define __POPME_H__
X
#if defined(__STDC__) || defined(__cplusplus)
# define PP(x) x
#else
# define PP(x) ()
#endif
X
/* 2 minutes - less for non amateur radio! */
/* #define IO_TIMEOUT 120L */
#define IO_TIMEOUT 3L
X
typedef struct _msgent Message;
struct _msgent
X {
X Message *Next;
X char *Identity;
X };
X
/* socks.c */
int Make_Connection PP((int port, const char *buf));
X
/* net.c */
void net_init PP((void));
int net_sendline PP((char *buf));
int net_connect PP((char *host, int port));
void cause_int PP((void));
int net_getline PP((char *buf, int len, long timeout));
X
/* popme.c */
extern int debug;
void whoops PP((int error, char *whatweupto));
void check_all_is_hoopy PP((char *whatweupto));
void login_the_user PP((char *user, char *pwd));
int get_msg_list PP((void));
int fetch_message PP((Message *m));
int top_of_message PP((Message *m, int lines));
int usage PP((void));
int version PP((void));
int warranty PP((void));
char *basename PP((char *s));
int main PP((int argc, char **argv));
int popme PP((void));
X
#undef PP
#endif /* __POPME_H__ */
United Earthlings, Inc.
$shar_touch -am 1010102397 'popme-0.04/popme.h' &&
chmod 0644 'popme-0.04/popme.h' ||
echo 'restore of popme-0.04/popme.h failed'
shar_count="`wc -c < 'popme-0.04/popme.h'`"
test 2880 -eq "$shar_count" ||
echo "popme-0.04/popme.h: original size 2880, current size $shar_count"
fi
# ============= popme-0.04/popme.1 ==============
if test -f 'popme-0.04/popme.1' && test X"$1" != X"-c"; then
echo 'x - skipping popme-0.04/popme.1 (File already exists)'
else
echo 'x - extracting popme-0.04/popme.1 (text)'
sed 's/^X//' << 'United Earthlings, Inc.' > 'popme-0.04/popme.1' &&
X.\" $Id: popme.1,v 1.283 1997/09/30 09:57:19 goodfellow Rel $
X.so version.n
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.TH POPME 1 "\*(UP\&" "Version \*(VE\&" "USER COMMANDS"
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.\"
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.SH NAME
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
popme \- simple mail client for post office protocol version 3
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.SH SYNOPSIS
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.TP
\fBpopme\fR \fB--server\fI SERV\fB --user\fI USER\fB --passwd\fI PWD\fR [options] ...
X.PP
X.TP
The options are:
`--port' or `-P',
`--delete' or `-D',
`--debug' or `-d',
`--help' or `-h',
`--output FILE' or `-o FILE',
`--verbose' or `-v',
`--version' or `-V',
`--warranty' or `-W'.
X.PP
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.SH DESCRIPTION
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.B Popme
is a simple mail client for post office protocol version 3 mail servers.
It lets you specify your POP3 server, your POP3 account name, and your POP3
password to download your email messages. The mail can be left on the
server, or maye be deleted whatever you choose. You can retrieve the full
contents of all messages or only the top N lines. (CAVEAT: If you decide to
download only the top N lines remember NOT to delete the messages;
otherwise they're gone.)
You may also alter the IP port used to connect to the POP3 server;
in cases you use a "hidden" POP3 server or have to circumvent a firewall, or
must use a proxy.
You can also turn on the debugging and verbose options for educational
purposes and see what
X.B popme
is doing and how the POP3 protocol works.
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.SH OPTIONS
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.B popme
recognizes the following options:
X.TP
X.B -s, --server \fISERV\fP
to set the POP3 server \fISERV\fP.
X.TP
X.B -u, --user \fIID\fP
to set the POP3 user \fIID\fP.
X.TP
X.B -p, --passwd \fIPWD\fP
to set the POP3 password \fIPWD\fP.
X.TP
X.B -P, --port \fIPORT\fP
to set the POP3 server port. Default is port 110, per RFC.
X.TP
X.B -D, --delete
to delete mail from server. Default is to keep mail.
X.TP
X.B -T, --top \fILINES\fP
to get only the top \fILINES\fP of mail.
X.TP
X.B -d, --debug
to print debugging information, which may help you understand how POP3
works.
X.TP
X.B -h, --help
to print this information.
X.TP
X.B -o, --output \fIFILE\fR
to specify the output \fIFILE\fR.
If you do not specify an output file, the program writes to
X.I stdout.
X.TP
X.B -v, --verbose
to print information about what is being done.
X.TP
X.B -V, --version
to print version and COPYRIGHT information.
X.TP
X.B -W, --warranty
to print WARRANTY information.
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.SH "SEE ALSO"
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.BR elm (1),
X.BR eudora (1),
X.BR mh (1),
X.BR netscape (1),
X.BR pine (1),
X.BR zmail (1).
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.SH EXAMPLES
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.TP
Show me my email:
example% \fIpopme --server pop3.earthling.net --user rag --passwd foobar\fR
X.TP
Show me my email and delete it from the server:
example% \fIpopme -s pop3.earthling.net -u rag -p foobar -D\fR
X.TP
Save my email in file "mbox" deleting it from the server:
example% \fIpopme -s pop3.earthling.net -u rag -p foobar -D -o mbox\fR
X.TP
Show me the top 5 lines (envelope headers excluded) of my email messages:
example% \fIpopme -s pop3.earthling.net -u rag -p foobar -T 5\fR
X.TP
Save my email in file "mbox" from a server using a non-standard port for POP3 delivery:
example% \fIpopme -s pop3.earthling.net -u rag -p foobar -P 10110 -o mbox\fR
X.PP
In cases when there is no email waiting for you
X.B popme
will prompt you with:
X.PP
X.nf
X \fIpopme: Sorry, no fish.\fR
X.fi
X.PP
After you've sucessfully saved your email to an mbox file, you can process
the mail using your favourite mailreader, like
X.BR elm (1),
X.BR pine (1),
X.BR mh (1).
X.TP
Process my email from "mbox" file using \fBelm\fR(1):
example% \fIelm -f mbox\fR
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.SH BUGS
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Bugs? In my programs? Are you kidding??
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.SH AVAILABILITY
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.LP
X.B Popme
has been cross posted to
X.SM USENET's
X.B alt.sources, comp.sources.unix
and is consequently available from your local netnews archive.
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.SH AUTHOR
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Copyright
X.if t \(co
X.if n (c)
1997
Robin A. Goodfellow. All rights reserved.
X.nf
Send bugs, comments, and all the usual fish to r...@earthling.net
X.fi
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.SH WARRANTY
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X.LP
This program is free software; you can redistribute it and/or modify
it under the terms of the
X.SM GNU
General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
X.PP
This program is distributed in the hope that it will be useful,
but
X.SM WITHOUT ANY WARRANTY;
without even the implied warranty of
X.SM MERCHANTABILITY
or
X.SM FITNESS FOR A PARTICULAR PURPOSE.
See the
X.SM GNU
General Public License for more details.
X.PP
You should have received a copy of the
X.SM GNU
General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place--Suite 330, Boston, MA 02111-1307, USA.
X.\" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
United Earthlings, Inc.
$shar_touch -am 1010103097 'popme-0.04/popme.1' &&
chmod 0644 'popme-0.04/popme.1' ||
echo 'restore of popme-0.04/popme.1 failed'
shar_count="`wc -c < 'popme-0.04/popme.1'`"
test 6232 -eq "$shar_count" ||
echo "popme-0.04/popme.1: original size 6232, current size $shar_count"
fi
# ============= popme-0.04/popme.man ==============
if test -f 'popme-0.04/popme.man' && test X"$1" != X"-c"; then
echo 'x - skipping popme-0.04/popme.man (File already exists)'
else
echo 'x - extracting popme-0.04/popme.man (text)'
sed 's/^X//' << 'United Earthlings, Inc.' > 'popme-0.04/popme.man' &&
X
X
X
POPME(1) USER COMMANDS POPME(1)
X
X
X
NAME
X popme - simple mail client for post office protocol version
X 3
X
SYNOPSIS
X popme --server _ S_ E_ R_ V --user _ U_ S_ E_ R --passwd _ P_ W_ D [options] ...
X
X The options are:
X `--port' or `-P', `--delete' or `-D', `--debug' or `-
X d', `--help' or `-h', `--output FILE' or `-o FILE', `-
X -verbose' or `-v', `--version' or `-V', `--warranty' or
X `-W'.
X
DESCRIPTION
X Popme is a simple mail client for post office protocol ver-
X sion 3 mail servers. It lets you specify your POP3 server,
X your POP3 account name, and your POP3 password to download
X your email messages. The mail can be left on the server, or
X maye be deleted whatever you choose. You can retrieve the
X full contents of all messages or only the top N lines.
X (CAVEAT: If you decide to download only the top N lines
X remember NOT to delete the messages; otherwise they're
X gone.) You may also alter the IP port used to connect to the
X POP3 server; in cases you use a "hidden" POP3 server or have
X to circumvent a firewall, or must use a proxy. You can also
X turn on the debugging and verbose options for educational
X purposes and see what popme is doing and how the POP3 proto-
X col works.
X
OPTIONS
X popme recognizes the following options:
X
X -s, --server _ S_ E_ R_ V
X to set the POP3 server _ S_ E_ R_ V.
X
X -u, --user _ I_ D
X to set the POP3 user _ I_ D.
X
X -p, --passwd _ P_ W_ D
X to set the POP3 password _ P_ W_ D.
X
X -P, --port _ P_ O_ R_ T
X to set the POP3 server port. Default is port 110, per
X RFC.
X
X -D, --delete
X to delete mail from server. Default is to keep mail.
X
X -T, --top _ L_ I_ N_ E_ S
X to get only the top _ L_ I_ N_ E_ S of mail.
X
X -d, --debug
X
X
X
Version 0.04 Last change: October 1997 1
X
X
X
X
X
X
POPME(1) USER COMMANDS POPME(1)
X
X
X
X to print debugging information, which may help you
X understand how POP3 works.
X
X -h, --help
X to print this information.
X
X -o, --output _ F_ I_ L_ E
X to specify the output _ F_ I_ L_ E. If you do not specify an
X output file, the program writes to _ s_ t_ d_ o_ u_ t.
X
X -v, --verbose
X to print information about what is being done.
X
X -V, --version
X to print version and COPYRIGHT information.
X
X -W, --warranty
X to print WARRANTY information.
X
SEE ALSO
X elm(1), eudora(1), mh(1), netscape(1), pine(1), zmail(1).
X
EXAMPLES
X Show me my email:
X example% _ p_ o_ p_ m_ e --_ s_ e_ r_ v_ e_ r _ p_ o_ p_ 3._ e_ a_ r_ t_ h_ l_ i_ n_ g._ n_ e_ t --_ u_ s_ e_ r _ r_ a_ g
X --_ p_ a_ s_ s_ w_ d _ f_ o_ o_ b_ a_ r
X
X Show me my email and delete it from the server:
X example% _ p_ o_ p_ m_ e -_ s _ p_ o_ p_ 3._ e_ a_ r_ t_ h_ l_ i_ n_ g._ n_ e_ t -_ u _ r_ a_ g -_ p _ f_ o_ o_ b_ a_ r
X -_ D
X
X Save my email in file "mbox" deleting it from the server:
X example% _ p_ o_ p_ m_ e -_ s _ p_ o_ p_ 3._ e_ a_ r_ t_ h_ l_ i_ n_ g._ n_ e_ t -_ u _ r_ a_ g -_ p _ f_ o_ o_ b_ a_ r
X -_ D -_ o _ m_ b_ o_ x
X
messages:
X Show me the top 5 lines (envelope headers excluded) of my email
X example% _ p_ o_ p_ m_ e -_ s _ p_ o_ p_ 3._ e_ a_ r_ t_ h_ l_ i_ n_ g._ n_ e_ t -_ u _ r_ a_ g -_ p _ f_ o_ o_ b_ a_ r
X -_ T _ 5
X
port for POP3 delivery:
X Save my email in file "mbox" from a server using a non-
X standard
X example% _ p_ o_ p_ m_ e -_ s _ p_ o_ p_ 3._ e_ a_ r_ t_ h_ l_ i_ n_ g._ n_ e_ t -_ u _ r_ a_ g -_ p _ f_ o_ o_ b_ a_ r
X -_ P _ 1_ 0_ 1_ 1_ 0 -_ o _ m_ b_ o_ x
X
X In cases when there is no email waiting for you popme will
X prompt you with:
X
X _ p_ o_ p_ m_ e: _ S_ o_ r_ r_ y, _ n_ o _ f_ i_ s_ h.
X
X
X
X
X
Version 0.04 Last change: October 1997 2
X
X
X
X
X
X
POPME(1) USER COMMANDS POPME(1)
X
X
X
X After you've sucessfully saved your email to an mbox file,
X you can process the mail using your favourite mailreader,
X like elm(1), pine(1), mh(1).
X
X Process my email from "mbox" file using elm(1):
X example% _ e_ l_ m -_ f _ m_ b_ o_ x
X
BUGS
X Bugs? In my programs? Are you kidding??
X
AVAILABILITY
X Popme has been cross posted to USENET's alt.sources,
X comp.sources.unix and is consequently available from your
X local netnews archive.
X
AUTHOR
X Copyright (c) 1997 Robin A. Goodfellow. All rights reserved.
X Send bugs, comments, and all the usual fish to r...@earthling.net
X
WARRANTY
X This program is free software; you can redistribute it
X and/or modify it under the terms of the GNU General Public
X License as published by the Free Software Foundation; either
X version 2 of the License, or (at your option) any later ver-
X sion.
X
X This program is distributed in the hope that it will be use-
X ful, but WITHOUT ANY WARRANTY; without even the implied war-
X ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR-
X POSE. See the GNU General Public License for more details.
X
X You should have received a copy of the GNU General Public
X License along with this program; if not, write to the Free
X Software Foundation, 59 Temple Place--Suite 330, Boston, MA
X 02111-1307, USA.
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
Version 0.04 Last change: October 1997 3
X
X
X
United Earthlings, Inc.
$shar_touch -am 1010103197 'popme-0.04/popme.man' &&
chmod 0644 'popme-0.04/popme.man' ||
echo 'restore of popme-0.04/popme.man failed'
shar_count="`wc -c < 'popme-0.04/popme.man'`"
test 5660 -eq "$shar_count" ||
echo "popme-0.04/popme.man: original size 5660, current size $shar_count"
fi
: || echo 'restore of popme-0.04/popme.ps failed'
echo 'End of part 2, continue with part 3'
exit 0
--
Choose life, -rag

Robin A. Goodfellow
Philosopher, Thinker, Hacker. "The structure is that there
United Earthlings, Inc. is no structure at all."
r...@earthling.net --Andrew S. Tanenbaum

0 new messages