[svn] pinentry - r177 - in trunk: . assuan pinentry

svn author wk cvs at cvs.gnupg.org
Thu Feb 14 12:39:00 CET 2008


Author: wk
Date: 2008-02-14 12:38:56 +0100 (Thu, 14 Feb 2008)
New Revision: 177

Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/assuan/ChangeLog
   trunk/assuan/assuan.h
   trunk/configure.ac
   trunk/pinentry/pinentry.c
Log:
Add command GETINFO.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-01-10 22:05:38 UTC (rev 176)
+++ trunk/ChangeLog	2008-02-14 11:38:56 UTC (rev 177)
@@ -1,3 +1,10 @@
+2008-02-14  Werner Koch  <wk at g10code.com>
+
+	* configure.ac: Check for -Wno-pointer-sign.
+
+	* pinentry/pinentry.c (cmd_getinfo): New.
+	(register_commands): Register it.
+
 2008-01-02  Marcus Brinkmann  <marcus at g10code.de>
 
 	* configure.ac: Use PKG_CONFIG instead of PKGCONFIG and

Modified: trunk/assuan/ChangeLog
===================================================================
--- trunk/assuan/ChangeLog	2008-01-10 22:05:38 UTC (rev 176)
+++ trunk/assuan/ChangeLog	2008-02-14 11:38:56 UTC (rev 177)
@@ -1,3 +1,7 @@
+2008-02-14  Werner Koch  <wk at g10code.com>
+
+	* assuan.h (ASSUAN_Parameter_Error): Add new alias.
+
 2008-01-10  Marcus Brinkmann  <marcus at g10code.de>
 
 	* assuan-handler.c (dispatch_command): Use Syntax_Error instead of

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2008-01-10 22:05:38 UTC (rev 176)
+++ trunk/NEWS	2008-02-14 11:38:56 UTC (rev 177)
@@ -3,7 +3,9 @@
 
  * Fix cross compilation for Gtk+-2 pinentry.
 
+ * New Assuan command GETINFO with subcommands "version" and "pid".
 
+
 Noteworthy changes in version 0.7.4 (2007-11-29)
 ------------------------------------------------
 

Modified: trunk/assuan/assuan.h
===================================================================
--- trunk/assuan/assuan.h	2008-01-10 22:05:38 UTC (rev 176)
+++ trunk/assuan/assuan.h	2008-02-14 11:38:56 UTC (rev 177)
@@ -67,6 +67,9 @@
 
 } assuan_error_t;
 
+#define ASSUAN_Parameter_Error ASSUAN_Parameter_Conflict
+
+
 typedef assuan_error_t AssuanError; /* Deprecated. */
 
 /* This is a list of pre-registered ASSUAN commands */

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2008-01-10 22:05:38 UTC (rev 176)
+++ trunk/configure.ac	2008-02-14 11:38:56 UTC (rev 177)
@@ -97,6 +97,16 @@
 if test "$GCC" = yes; then
     CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
     CPPFLAGS="$CPPFLAGS -Wall"
+
+    AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
+    _gcc_cflags_save=$CFLAGS
+    CFLAGS="-Wno-pointer-sign"
+    AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
+    AC_MSG_RESULT($_gcc_psign)
+    CFLAGS=$_gcc_cflags_save;
+    if test x"$_gcc_psign" = xyes ; then
+       CFLAGS="$CFLAGS -Wno-pointer-sign"
+    fi
 fi
 
 

Modified: trunk/pinentry/pinentry.c
===================================================================
--- trunk/pinentry/pinentry.c	2008-01-10 22:05:38 UTC (rev 176)
+++ trunk/pinentry/pinentry.c	2008-02-14 11:38:56 UTC (rev 177)
@@ -1,5 +1,5 @@
 /* pinentry.c - The PIN entry support library
-   Copyright (C) 2002, 2003, 2007 g10 Code GmbH
+   Copyright (C) 2002, 2003, 2007, 2008 g10 Code GmbH
    
    This file is part of PINENTRY.
    
@@ -14,9 +14,8 @@
    General Public License for more details.
  
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  
+ */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -895,7 +894,37 @@
                                       : 0);
 }
 
+/* GETINFO <what>
 
+   Multipurpose function to return a variety of information.
+   Supported values for WHAT are:
+
+     version     - Return the version of the program.
+     pid         - Return the process id of the server.
+ */
+static int
+cmd_getinfo (assuan_context_t ctx, char *line)
+{
+  int rc;
+
+  if (!strcmp (line, "version"))
+    {
+      const char *s = VERSION;
+      rc = assuan_send_data (ctx, s, strlen (s));
+    }
+  else if (!strcmp (line, "pid"))
+    {
+      char numbuf[50];
+
+      snprintf (numbuf, sizeof numbuf, "%lu", (unsigned long)getpid ());
+      rc = assuan_send_data (ctx, numbuf, strlen (numbuf));
+    }
+  else
+    rc = ASSUAN_Parameter_Error;
+  return rc;
+}
+
+
 /* Tell the assuan library about our commands.  */
 static int
 register_commands (ASSUAN_CONTEXT ctx)
@@ -917,6 +946,7 @@
       { "MESSAGE",    0,  cmd_message },
       { "SETQUALITYBAR", 0,  cmd_setqualitybar },
       { "SETQUALITYBAR_TT", 0,  cmd_setqualitybar_tt },
+      { "GETINFO",    0,  cmd_getinfo },
       { NULL }
     };
   int i, j, rc;




More information about the Gnupg-commits mailing list