]> git.deb.at Git - pkg/abook.git/commitdiff
quit and print command added
authorJaakko Heinonen <jheinonen@users.sourceforge.net>
Sat, 29 Sep 2001 16:39:02 +0000 (16:39 +0000)
committerJaakko Heinonen <jheinonen@users.sourceforge.net>
Sat, 29 Sep 2001 16:39:02 +0000 (16:39 +0000)
ChangeLog
abook.c
abook.h
configure
configure.in
help.h
ui.c

index 21a87ceb14d4a8c2c9f472209cdb1a9b51df6cb8..b68721ae28889af2f7d3764861963364a89086b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
  - fixed a minor memory leak in pine import filter
  - filter cleanups
  - fixes
+ - "quit and print selected item(s) to stderr" command (Brian Medley)
+ - contrib update
 
 0.4.13
  - major code reorganization (phase 1)
diff --git a/abook.c b/abook.c
index bb0a34792a0f8b313a652102a61472a08272b11c..de333180c757a91bfe6f2bc0b8165aa6400b6f1f 100644 (file)
--- a/abook.c
+++ b/abook.c
@@ -291,6 +291,35 @@ make_mailstr(int item)
        return ret;
 }
 
+void
+print_stderr(int item)
+{
+       char *mailstr = NULL;
+
+       if( is_valid_item(item) )
+               mailstr = make_mailstr(item);
+       else {
+               struct db_enumerator e = init_db_enumerator(ENUM_SELECTED);
+               char *tmp = NULL;
+               db_enumerate_items(e) {
+                       tmp = mailstr;
+                       mailstr = tmp ?
+                               strconcat(tmp, ",", make_mailstr(e.item), NULL):
+                               strconcat(make_mailstr(e.item), NULL);
+                       free(tmp);
+               }
+       }
+
+    fprintf(stderr, "%s", mailstr);
+
+#ifdef DEBUG
+       fprintf(stderr, "mailstr: %s\n", mailstr);
+#endif
+
+       free(mailstr);
+
+}
+
 void
 launch_mutt(int item)
 {
diff --git a/abook.h b/abook.h
index bcebcaab071f680db1aa9a3bd5f67807f341b61d..8fa08cd5f20d1059d9f2db1d8dc699c8b54d2b5b 100644 (file)
--- a/abook.h
+++ b/abook.h
@@ -9,6 +9,7 @@ FILE            *abook_fopen (const char *path, const char *mode);
 void           quit_abook();
 void           launch_wwwbrowser(int item);
 void           launch_mutt(int item);
+void           print_stderr(int item);
 #ifdef _AIX
 int            strcasecmp (const char *, const char *);
 int            strncasecmp (const char *, const char *, size_t);
index c618021725da610bda92053929ddc86f4f97f51d..d35f75284558883aac7b661e16ab807524fc54c9 100755 (executable)
--- a/configure
+++ b/configure
@@ -695,7 +695,7 @@ fi
 
 PACKAGE=abook
 
-VERSION=0.4.14-cvs
+VERSION=0.4.14
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
index 4db766d35605764afd50d539b1f08c9fae3be813..30cc0a33b1664b814ac1e7164ea5b9571678fa0c 100644 (file)
@@ -1,7 +1,7 @@
 dnl abook configure.in
 
 AC_INIT(abook.c)
-AM_INIT_AUTOMAKE(abook, 0.4.14-cvs)
+AM_INIT_AUTOMAKE(abook, 0.4.14)
 AM_CONFIG_HEADER(config.h)
 
 AC_CANONICAL_HOST
diff --git a/help.h b/help.h
index a18f8f2de45f74d70f2d15d253a4e278cd93340c..abb040e85e54e69bf578263589d94321c45b3bcd 100644 (file)
--- a/help.h
+++ b/help.h
@@ -9,6 +9,7 @@ static char *mainhelp[] = {
 
 "      ?               help\n",
 "      q               quit\n",
+"      Q               quit and print selected item(s) to stderr\n",
 "      ^L              refresh screen\n",
 "\n",
 "      arrows / j,k    scroll list\n",
diff --git a/ui.c b/ui.c
index c11c26a18b23c4aa2238de23bd8cfc2f59ce6d1d..1af0ee339be5d1457c15a6b6f4ee92c681eec8fc 100644 (file)
--- a/ui.c
+++ b/ui.c
@@ -410,6 +410,9 @@ get_commands()
                can_resize = FALSE; /* it's not safe to resize anymore */
                switch( ch ) {
                        case 'q': return;
+                       case 'Q': print_stderr(selected_items() ?
+                                                 -1 : list_current_item());
+                                 return;
                        case '?':
                                  display_help(HELP_MAIN);
                                  refresh_screen();