/[winpt]/trunk/MyGPGME/version.c
ViewVC logotype

Annotation of /trunk/MyGPGME/version.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Mon Jan 31 11:02:21 2005 UTC (20 years, 1 month ago) by twoaday
File MIME type: text/plain
File size: 2095 byte(s)
WinPT initial checkin.


1 twoaday 2 /* version.c
2     * Copyright (C) 2001, 2002, 2003 Timo Schulz
3     *
4     * This file is part of MyGPGME.
5     *
6     * MyGPGME is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * MyGPGME is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19     */
20    
21     #include "util.h"
22     #include "context.h"
23     #include "ops.h"
24    
25     static gpgme_error_t
26     version_start (gpgme_ctx_t ctx, gpgme_data_t info)
27     {
28     gpgme_error_t rc = 0;
29    
30     _gpgme_gpg_release( &ctx->gpg );
31     rc = _gpgme_gpg_new( &ctx->gpg );
32     if( rc )
33     goto leave;
34     _gpgme_gpg_add_arg( ctx->gpg, "--version" );
35     _gpgme_data_set_mode( info, GPGME_DATA_MODE_IN );
36     _gpgme_gpg_add_arg( ctx->gpg, "--output" );
37     _gpgme_gpg_add_arg( ctx->gpg, "-" );
38     _gpgme_gpg_add_data( ctx->gpg, info, 1 );
39    
40     rc = _gpgme_gpg_spawn( ctx->gpg, ctx );
41     leave:
42     if( rc ) {
43     ctx->pending = 0;
44     _gpgme_gpg_release( &ctx->gpg );
45     }
46     return rc;
47     } /* gpgme_op_version_start */
48    
49    
50     gpgme_error_t
51     gpgme_op_version( char **r_info )
52     {
53     gpgme_error_t rc;
54     gpgme_ctx_t ctx = NULL;
55     gpgme_data_t dh = NULL;
56    
57     if( !r_info )
58     return mk_error( Invalid_Value );
59    
60     rc = gpgme_new( &ctx );
61     if( !rc )
62     rc = gpgme_data_new( &dh );
63     if( !rc )
64     rc = version_start( ctx, dh );
65     if( !rc ) {
66     gpgme_wait( ctx, 1 );
67     ctx->pending = 0;
68     }
69     *r_info = _gpgme_data_release_and_return_string( dh );
70     gpgme_release( ctx );
71     return rc;
72     } /* gpgme_op_version */
73    

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26