From 32677da976f43cbc2ee2c04814699f622c18ae09 Mon Sep 17 00:00:00 2001 From: Michael Elkins Date: Mon, 8 Jan 2001 09:45:35 +0000 Subject: [PATCH] patch from Hugo Haas -c was not specified in the getopt*() calls set global password to the one the user inputs and use that as the default for remaining mailboxes --- Makefile.am | 2 +- main.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index bbe8dd5..0c1d603 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ bin_PROGRAMS=isync isync_SOURCES=main.c imap.c sync.c maildir.c isync.h list.c cram.c man_MANS=isync.1 EXTRA_DIST=sample.isyncrc $(man_MANS) -CPPFLAGS=$(RPM_OPT_FLAGS) +INCLUDES=$(RPM_OPT_FLAGS) log: rcs2log -h sigipe.org | sed 's;/home/cvs/isync/;;g' > ChangeLog diff --git a/main.c b/main.c index a9807e3..86177e3 100644 --- a/main.c +++ b/main.c @@ -341,9 +341,9 @@ main (int argc, char **argv) #endif #if HAVE_GETOPT_LONG - while ((i = getopt_long (argc, argv, "defhp:u:r:s:vV", Opts, NULL)) != -1) + while ((i = getopt_long (argc, argv, "c:defhp:u:r:s:vV", Opts, NULL)) != -1) #else - while ((i = getopt (argc, argv, "defhp:u:r:s:vV")) != -1) + while ((i = getopt (argc, argv, "c:defhp:u:r:s:vV")) != -1) #endif { switch (i) @@ -412,14 +412,19 @@ main (int argc, char **argv) if (!box->pass) { - char *pass = getpass ("Password:"); - - if (!pass) + /* if we don't have a global password set, prompt the user for + * it now. + */ + if (!global.pass) { - puts ("Aborting, no password"); - exit (1); + global.pass = getpass ("Password:"); + if (!global.pass) + { + puts ("Aborting, no password"); + exit (1); + } } - box->pass = strdup (pass); + box->pass = strdup (global.pass); } printf ("Reading %s\n", box->path);