From b33ba7a7953d06a123ee59811903f0eb7f69e120 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Sat, 8 Dec 2012 11:15:12 +0100 Subject: [PATCH] sbr/getpass.c: Removed nmh_getpass() for it is not used anymore. --- h/prototypes.h | 1 - sbr/Makefile.in | 2 +- sbr/getpass.c | 89 ------------------------------------------------------- 3 files changed, 1 insertion(+), 91 deletions(-) delete mode 100644 sbr/getpass.c diff --git a/h/prototypes.h b/h/prototypes.h index a9e081d..a22eac6 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -72,7 +72,6 @@ char *m_mktemp(const char *, int *, FILE **); char *m_mktemp2(const char *, const char *, int *, FILE **); void thisisanmbox(FILE *); int makedir(char *); -char *nmh_getpass(const char *); char *norm_charmap(char *); char *new_fs(char *, char *); int pidwait(pid_t, int); diff --git a/sbr/Makefile.in b/sbr/Makefile.in index c6801b3..5da6f89 100644 --- a/sbr/Makefile.in +++ b/sbr/Makefile.in @@ -52,7 +52,7 @@ SRCS = addrsbr.c ambigsw.c brkstring.c \ error.c ext_hook.c folder_addmsg.c folder_delmsgs.c \ folder_free.c folder_read.c \ folder_realloc.c gans.c getans.c getanswer.c \ - getarguments.c getcpy.c getpass.c \ + getarguments.c getcpy.c \ fmt_addr.c fmt_compile.c fmt_new.c fmt_rfc2047.c \ fmt_scan.c lock_file.c m_atoi.c \ m_convert.c m_draft.c m_getfld.c m_gmprot.c \ diff --git a/sbr/getpass.c b/sbr/getpass.c deleted file mode 100644 index 3fd4528..0000000 --- a/sbr/getpass.c +++ /dev/null @@ -1,89 +0,0 @@ -/* -** Portions of this code are Copyright (c) 1988, 1993 -** The Regents of the University of California. All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. All advertising materials mentioning features or use of this software -** must display the following acknowledgement: -** This product includes software developed by the University of -** California, Berkeley and its contributors. -** 4. Neither the name of the University nor the names of its contributors -** may be used to endorse or promote products derived from this software -** without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -** SUCH DAMAGE. -*/ - -#include -#include -#include /* for isatty() */ -#include "h/mh.h" /* for adios() */ - -/* -** We don't use MAX_PASS here because the maximum password length on a remote -** POP daemon will have nothing to do with the length on our OS. 256 is -** arbitrary but hopefully big enough to accomodate everyone. -*/ -#define MAX_PASSWORD_LEN 256 - -#ifndef TCSANOW -# define TCSANOW 0 -#endif - -char * -nmh_getpass(const char *prompt) -{ - struct termios oterm, term; - int ch; - char *p; - FILE *fout, *fin; - static char buf[MAX_PASSWORD_LEN + 1]; - int istty = isatty(fileno(stdin)); - - /* - ** Find if stdin is connect to a terminal. If so, read directly from - ** the terminal, and turn off echo. Otherwise read from stdin. - */ - - if (!istty || !(fout = fin = fopen("/dev/tty", "w+"))) { - fout = stderr; - fin = stdin; - } else { /* Reading directly from terminal here */ - tcgetattr(fileno(fin), &oterm); - term = oterm; /* Save original info */ - term.c_lflag &= ~ECHO; - fputs(prompt, fout); - rewind(fout); /* implied flush */ - tcsetattr(fileno(fin), TCSANOW, &term); - } - - for (p = buf; (ch = getc(fin)) != EOF && ch != '\n' && - p < buf + MAX_PASSWORD_LEN;) - *p++ = ch; - *p = '\0'; - - if (istty) { - tcsetattr(fileno(fin), TCSANOW, &oterm); - rewind(fout); - fputc('\n', fout); - fclose(fin); - } - return buf; -} -- 1.7.10.4