From: msf Date: Wed, 5 Jul 2000 20:45:19 +0000 (+0000) Subject: bump version - added NEWT_FLAG_PASSWORD flag to put asterix in entry when typing X-Git-Tag: r0-50-14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20fb366aa0a5b6bfdcca6be00043fccc8ba9d961;p=thirdparty%2Fnewt.git bump version - added NEWT_FLAG_PASSWORD flag to put asterix in entry when typing --- diff --git a/configure.in b/configure.in index 8ab471e..305990d 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(newt_pr.h) AC_CONFIG_HEADER(config.h) -VERSION=0.50.13 +VERSION=0.50.14 SONAME=0.50 AC_SUBST(VERSION) AC_SUBST(SONAME) diff --git a/entry.c b/entry.c index 6ac48de..154edba 100644 --- a/entry.c +++ b/entry.c @@ -138,6 +138,17 @@ static void entryDraw(newtComponent co) { } chptr = en->buf + en->firstChar; + + if (en->flags & NEWT_FLAG_PASSWORD) { + char *tmpptr, *p; + + tmpptr = alloca(strlen(chptr+2)); + strcpy(tmpptr, chptr); + for (p = tmpptr; *p; p++) + *p = '*'; + chptr = tmpptr; + } + len = strlen(chptr); if (len <= co->width) { diff --git a/newt.h b/newt.h index 1f16287..58ad90a 100644 --- a/newt.h +++ b/newt.h @@ -72,7 +72,7 @@ enum newtFlagsSense { NEWT_FLAGS_SET, NEWT_FLAGS_RESET, NEWT_FLAGS_TOGGLE }; #define NEWT_FLAG_MULTIPLE (1 << 8) #define NEWT_FLAG_SELECTED (1 << 9) #define NEWT_FLAG_CHECKBOX (1 << 10) - +#define NEWT_FLAG_PASSWORD (1 << 11) /* draw '*' of chars in entrybox */ #define NEWT_FD_READ (1 << 0) #define NEWT_FD_WRITE (1 << 1) diff --git a/newt.spec b/newt.spec index 9442459..d86bf2a 100644 --- a/newt.spec +++ b/newt.spec @@ -1,6 +1,6 @@ Summary: A development library for text mode user interfaces. Name: newt -%define version 0.50.13 +%define version 0.50.14 Version: %{version} Release: 1 Copyright: LGPL @@ -57,6 +57,9 @@ rm -rf $RPM_BUILD_ROOT %postun -p /sbin/ldconfig %changelog +* Wed Jul 05 2000 Michael Fulbright +- added NEWT_FLAG_PASSWORD for entering passwords and having asterix echo'd + * Fri Jun 16 2000 Matt Wilson - build for new release diff --git a/snack.py b/snack.py index 4781b6e..aed70e7 100644 --- a/snack.py +++ b/snack.py @@ -137,9 +137,9 @@ class Entry(Widget): def setFlags (self, flag, sense): return self.w.entrySetFlags(flag, sense) - def __init__(self, width, text = "", hidden = 0, scroll = 1, + def __init__(self, width, text = "", hidden = 0, password = 0, scroll = 1, returnExit = 0): - self.w = _snack.entry(width, text, hidden, scroll, returnExit) + self.w = _snack.entry(width, text, hidden, password, scroll, returnExit) # Form uses hotkeys diff --git a/snackmodule.c b/snackmodule.c index cdf5d04..b0c32d1 100644 --- a/snackmodule.c +++ b/snackmodule.c @@ -674,14 +674,15 @@ static snackWidget * entryWidget(PyObject * s, PyObject * args) { snackWidget * widget; int width; char * initial; - int isHidden, isScrolled, returnExit; + int isHidden, isScrolled, returnExit, isPassword; - if (!PyArg_ParseTuple(args, "isiii", &width, &initial, - &isHidden, &isScrolled, &returnExit)) return NULL; + if (!PyArg_ParseTuple(args, "isiiii", &width, &initial, + &isHidden, &isPassword, &isScrolled, &returnExit)) return NULL; widget = snackWidgetNew (); widget->co = newtEntry(-1, -1, initial, width, (char **) &widget->apointer, (isHidden ? NEWT_FLAG_HIDDEN : 0) | + (isPassword ? NEWT_FLAG_PASSWORD : 0) | (returnExit ? NEWT_FLAG_RETURNEXIT : 0) | (isScrolled ? NEWT_FLAG_SCROLL : 0)); diff --git a/test.c b/test.c index 16758e4..04ccc03 100644 --- a/test.c +++ b/test.c @@ -83,7 +83,8 @@ int main(void) { l3 = newtLabel(3, 8, "Hidden:"); e1 = newtEntry(12, 6, "", 20, &scaleVal, 0); e2 = newtEntry(12, 7, "Default", 20, &enr2, NEWT_FLAG_SCROLL); - e3 = newtEntry(12, 8, NULL, 20, &enr3, NEWT_FLAG_HIDDEN); +/* e3 = newtEntry(12, 8, NULL, 20, &enr3, NEWT_FLAG_HIDDEN); */ + e3 = newtEntry(12, 8, NULL, 20, &enr3, NEWT_FLAG_PASSWORD); cbis[0].state = &results[0]; cbis[0].en = e1;