c user the getpass command to get the users password as it is secure. modified getstr so is the field is secure and there is an existing string a - will remove the data
e
s 00000/00013/00052
d D 1.2 95/07/06 14:12:39 tim 2 1
c getuname moved from talktopopconfig to talktopopconf so it is available to
c talktopop
e
s 00065/00000/00000
d D 1.1 95/07/06 14:00:30 tim 1 0
c
e
u
U
f e 0
t
T
I 1
/* this program builds up a talktopop config file.
If the file exists it uses the information if there as a default,
otherwise it tries to give some sensible information */
#include "talktopop.h"
#include <stdio.h>
#include <string.h>
#include <pwd.h>
char popserver[100] ;
char popname [100] ;
char protname [100] ;
char uname[100] ;
char passwd[100] ;
int filestartno = 0 ;
int dodel = FALSE ;
int direction = FALSE ;
int verbose = FALSE ;
int maxsize = MAXSIZE ;
int maxemail = MAXCOUNT ;
int hnset, pwset, unset ;
main ()
{
confinit() ;
readconf() ;
newconf() ;
writeconf() ;
}
newconf()
{
char tmp[1024] ;
/* say hi etc. */
printf("This program builds or modifies you %s configuration file\n", POPCONF) ;
printf("If the %s file exists it uses the data in that file for defaults\n") ;
printf("Otherwise it provides its own.\n") ;
printf("Where a value is given in brackets (e.g. [tim]) you just have to\n") ;
printf("hit return to accept this of enter a new value if you want to change it\n") ;
I 3
printf("In the password field if there is an existing value you want to remove just enter -\n") ;
E 3
/* get the users name */
getuname(uname) ;
getstr(uname, "your username", FALSE) ;
printf("WARNING. If you enter a password it will be stored in clear\ntext format in a configuration file. This is a potential security\nhole. If you chose not to enter a password you will be prompted\nfor it each time you run talktopop\n") ;
getstr(passwd, "your password", TRUE) ;
getstr(popserver, "the name of the machine running the POP-3 server", FALSE) ;
getno(&filestartno, "the number you want to use as the starting point for retrieved file names") ;
getyn("true if you want talktopop to delete emails from the mailbox once they are downloaded, false if you want them to be kept", &dodel) ;
getyn("true if you want talktopop to retrieve emails from the start of your mailbox, false if you want it to retrieve them from the end", &direction) ;
getyn("true if you want talktopop to be verbose, false otherwise", &verbose) ;
getno(&maxsize, "the maximum email size (in bytes) to be downloaded") ;
getno(&maxemail, "the maximum number of emails to be downloaded to the psion") ;
getstr(popname, "the name of the pop-3 server in the services file / map", FALSE) ;
getstr(protname, "the name of the transport mechanism used to talk to pop (Leave as tcp unless you REALY know better)", FALSE) ;