diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-05-09 10:55:36 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-05-09 10:55:36 +0000 |
commit | dde73ecb9ebe26eee6db660373b7ee8bb9e3bae2 (patch) | |
tree | cea035c022ed5f5a138dc3d8d5f90e70f69a230f | |
parent | 467eac6072252e67384b23bc2aebb443540d231d (diff) | |
download | gdbm-dde73ecb9ebe26eee6db660373b7ee8bb9e3bae2.tar.gz gdbm-dde73ecb9ebe26eee6db660373b7ee8bb9e3bae2.tar.bz2 |
Add new prompt escapes.
* src/testgdbm.c: New prompt escapes: %p, %P, %v, %_.
Change default prompt to %p>%_.
* doc/gdbmtool.1: Document new prompt escapes.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | doc/gdbmtool.1 | 8 | ||||
-rw-r--r-- | src/testgdbm.c | 30 |
3 files changed, 37 insertions, 3 deletions
@@ -1,7 +1,7 @@ 2013-05-08 Sergey Poznyakoff <gray@gnu.org.ua> Rename testgdbm to gdbmtool. Improve documentation. - + * configure.ac: Fix a typo. * src/.cvsignore: Add gdbmtool * src/Makefile.am: Rename testgdbm to gdbmtool. Source diff --git a/doc/gdbmtool.1 b/doc/gdbmtool.1 index e6a8f2a..1c2d2c4 100644 --- a/doc/gdbmtool.1 +++ b/doc/gdbmtool.1 @@ -13,7 +13,7 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with GDBM. If not, see <http://www.gnu.org/licenses/>. */ -.TH GDBM_DUMP 1 "May 8, 2013" "GDBM" "GDBM User Reference" +.TH GDBM_DUMP 1 "May 9, 2013" "GDBM" "GDBM User Reference" .SH NAME gdbmtool \- examine and modify a GDBM database .SH SYNOPSIS @@ -189,8 +189,14 @@ replaced in the generated prompt as follows: .ul Sequence Expansion \fB%f\fR name of the db file + \fB%p\fR program name + \fB%P\fR package name (\fBgdbm\fR) + \fB%_\fR horizontal space (\fBASCII\fR 32) + \fB%v\fR program version \fB%%\fR \fB%\fR .fi +.sp +The default prompt is \fB%p>%_\fR. .TP .BR quit ", " q Close the database and quit the utility. diff --git a/src/testgdbm.c b/src/testgdbm.c index 155c69e..5214526 100644 --- a/src/testgdbm.c +++ b/src/testgdbm.c @@ -36,7 +36,7 @@ const char *progname; /* Program name */ -#define DEFAULT_PROMPT "gdbmtool> " +#define DEFAULT_PROMPT "%p>%_" char *prompt; char *file_name = NULL; /* Database file name */ @@ -808,6 +808,30 @@ pe_file_name (struct prompt_exp *p) fwrite (file_name, strlen (file_name), 1, stdout); } +void +pe_program_name (struct prompt_exp *p) +{ + fwrite (progname, strlen (progname), 1, stdout); +} + +void +pe_package_name (struct prompt_exp *p) +{ + fwrite (PACKAGE_NAME, sizeof (PACKAGE_NAME) - 1, 1, stdout); +} + +void +pe_program_version (struct prompt_exp *p) +{ + fwrite (PACKAGE_VERSION, sizeof (PACKAGE_VERSION) - 1, 1, stdout); +} + +void +pe_space (struct prompt_exp *p) +{ + fwrite (" ", 1, 1, stdout); +} + struct prompt_exp { int ch; @@ -817,6 +841,10 @@ struct prompt_exp struct prompt_exp prompt_exp[] = { { 'f', pe_file_name }, + { 'p', pe_program_name }, + { 'P', pe_package_name }, + { 'v', pe_program_version }, + { '_', pe_space }, { 0 } }; |