diff options
| author | Mattias Andrée <maandree@operamail.com> | 2015-03-24 19:02:14 +0100 | 
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2015-03-24 19:02:14 +0100 | 
| commit | bf102f6036b9291f0494b253b1558f2dab9ec001 (patch) | |
| tree | 875101861b0b9434419a5875e4301a3bd5d34af0 | |
| parent | fix PASSPHRASE_TEXT (diff) | |
| download | libpassphrase-1427220157.tar.gz libpassphrase-1427220157.tar.bz2 libpassphrase-1427220157.tar.xz | |
m + doc PASSPHRASE_STAR_CHAR, PASSPHRASE_TEXT_EMPTY and PASSPHRASE_TEXT_NOT_EMPTY14272201571.1.4
Signed-off-by: Mattias Andrée <maandree@operamail.com>
| -rw-r--r-- | Makefile | 15 | ||||
| -rw-r--r-- | info/libpassphrase.texinfo | 35 | ||||
| -rw-r--r-- | src/passphrase_helper.h | 14 | ||||
| -rwxr-xr-x | test-all-options.sh | 22 | 
4 files changed, 66 insertions, 20 deletions
| @@ -31,8 +31,8 @@ PKGNAME ?= libpassphrase  # Options with which to compile the library  OPTIONS ?=   # PASSPHRASE_ECHO:       Do not hide the passphrase -# PASSPHRASE_STAR:       Use '*' for each character instead of no echo -# PASSPHRASE_TEXT:       Use '(empty)' and '(not empty)' instead of no echo +# PASSPHRASE_STAR:       Use "*" for each character instead of no echo +# PASSPHRASE_TEXT:       Use "(empty)" and "(not empty)" instead of no echo  # PASSPHRASE_REALLOC:    Soften security by using `realloc`  # PASSPHRASE_MOVE:       Enable move of point  # PASSPHRASE_INSERT:     Enable insert mode @@ -43,6 +43,15 @@ OPTIONS ?=  # DEFAULT_INSERT:        Use insert mode as default  # PASSPHRASE_INVALID:    Prevent duplication of non-initialised memory +# Text to use instead of "*" +PASSPHRASE_STAR_CHAR      ?= \* +# Text to use instead of "(empty)" +PASSPHRASE_TEXT_EMPTY     ?= (empty) +# Text to use instead of "(not empty)" +PASSPHRASE_TEXT_NOT_EMPTY ?= (not empty) + +QUOTED_OPTIONS = PASSPHRASE_STAR_CHAR PASSPHRASE_TEXT_EMPTY PASSPHRASE_TEXT_NOT_EMPTY +  # Optimisation settings for C code compilation  OPTIMISE ?= -Os @@ -61,7 +70,7 @@ WARN = -Wall -Wextra -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include  # The C standard for C code compilation  STD = gnu99  # C preprocessor flags -CPPFLAGS_ = $(foreach D, $(OPTIONS), -D'$(D)=1') +CPPFLAGS_ = $(foreach D, $(OPTIONS), -D'$(D)=1') $(foreach D, $(QUOTED_OPTIONS), -D'$(D)="$($(D))"')  # C compiling flags  CFLAGS_ = -std=$(STD) $(WARN)  # Linking flags diff --git a/info/libpassphrase.texinfo b/info/libpassphrase.texinfo index 7a82f3f..d981a3f 100644 --- a/info/libpassphrase.texinfo +++ b/info/libpassphrase.texinfo @@ -221,10 +221,10 @@ The following options are defined:  @item @code{PASSPHRASE_ECHO}  Do not hide the passphrase. -@item @code{PASSPHRASE_STAR} @footnote{May not be combined with @code{PASSPHRASE_ECHO}.} +@item @code{PASSPHRASE_STAR} @footnote{May not be combined with @code{PASSPHRASE_ECHO} or @code{PASSPHRASE_TEXT}.}  Use `*' for each character instead of disabling echoing. -@item @code{PASSPHRASE_TEXT} @footnote{May not be combined with @code{PASSPHRASE_TEXT}.} +@item @code{PASSPHRASE_TEXT} @footnote{May not be combined with @code{PASSPHRASE_STAR} or @code{PASSPHRASE_ECHO}.}  Use the texts `(empty)' and `(not empty)' to describe whether  anything has been entered or not the instead of disabling echoing. @@ -319,6 +319,37 @@ in @command{valgrind}.  @end table +In addition, you may use the follow flags. + +@table @asis + +@item @code{PASSPHRASE_STAR_CHAR} +The text to print instead of the character `*' when +@code{PASSPHRASE_STAR} is used. For example you may run +@example +make OPTIONS=PASSPHRASE_STAR  \ +     PASSPHRASE_STAR_CHAR="#" +@end example + +@item @code{PASSPHRASE_TEXT_EMPTY} +The text to print instead of the `(empty)' when +@code{PASSPHRASE_TEXT} is used. For example you may run +@example +make OPTIONS=PASSPHRASE_TEXT  \ +     PASSPHRASE_TEXT_EMPTY="there is nothing here" +@end example + +@item @code{PASSPHRASE_TEXT_NOT_EMPTY} +The text to print instead of the `(not empty)' when +@code{PASSPHRASE_TEXT} is used. For example you may run +@example +make OPTIONS=PASSPHRASE_TEXT  \ +     PASSPHRASE_TEXT_NOT_EMPTY="there is something here" +@end example + +@end table + +  @node GNU Free Documentation License  @appendix GNU Free Documentation License diff --git a/src/passphrase_helper.h b/src/passphrase_helper.h index 038ba85..1ba5833 100644 --- a/src/passphrase_helper.h +++ b/src/passphrase_helper.h @@ -25,17 +25,25 @@  #  warning You cannot have both PASSPHRASE_TEXT and PASSPHRASE_STAR  #  undef PASSPHRASE_TEXT  #endif +#if defined(PASSPHRASE_STAR) && defined(PASSPHRASE_ECHO) +#  warning You cannot have both PASSPHRASE_STAR and PASSPHRASE_ECHO +#  undef PASSPHRASE_ECHO +#endif +#if defined(PASSPHRASE_TEXT) && defined(PASSPHRASE_ECHO) +#  warning You cannot have both PASSPHRASE_TEXT and PASSPHRASE_ECHO +#  undef PASSPHRASE_ECHO +#endif  /* Default texts */  #ifndef PASSPHRASE_STAR_CHAR -#  define PASSPHRASE_STAR_CHAR  "*"  /* TODO document */ +#  define PASSPHRASE_STAR_CHAR  "*"  #endif  #ifndef PASSPHRASE_TEXT_EMPTY -#  define PASSPHRASE_TEXT_EMPTY  "(empty)"  /* TODO document */ +#  define PASSPHRASE_TEXT_EMPTY  "(empty)"  #endif  #ifndef PASSPHRASE_TEXT_NOT_EMPTY -#  define PASSPHRASE_TEXT_NOT_EMPTY  "(not empty)"  /* TODO document */ +#  define PASSPHRASE_TEXT_NOT_EMPTY  "(not empty)"  #endif diff --git a/test-all-options.sh b/test-all-options.sh index 8ba5431..9572be2 100755 --- a/test-all-options.sh +++ b/test-all-options.sh @@ -1,17 +1,15 @@  #!/bin/bash -for a in PASSPHRASE_ECHO ""; do -    for b in PASSPHRASE_STAR PASSPHRASE_TEXT ""; do -	for c in PASSPHRASE_REALLOC ""; do -	    for d in PASSPHRASE_MOVE ""; do -		for e in PASSPHRASE_INSERT ""; do -		    for f in PASSPHRASE_OVERRIDE ""; do -			for g in PASSPHRASE_DELETE ""; do -			    for h in PASSPHRASE_CONTROL ""; do -				for i in PASSPHRASE_DEDICATED ""; do -				    for j in DEFAULT_INSERT ""; do -					make libpassphrase -B OPTIONS="$a $b $c $d $e $f $g $h $i $j $k" || exit 1 -				    done +for a in PASSPHRASE_ECHO PASSPHRASE_STAR PASSPHRASE_TEXT ""; do +    for b in PASSPHRASE_REALLOC ""; do +	for c in PASSPHRASE_MOVE ""; do +	    for d in PASSPHRASE_INSERT ""; do +		for e in PASSPHRASE_OVERRIDE ""; do +		    for f in PASSPHRASE_DELETE ""; do +			for g in PASSPHRASE_CONTROL ""; do +			    for h in PASSPHRASE_DEDICATED ""; do +				for i in DEFAULT_INSERT ""; do +				    make libpassphrase -B OPTIONS="$a $b $c $d $e $f $g $h $i" || exit 1  				done  			    done  			done | 
