/[winpt]/trunk/Src/wptGPG.cpp
ViewVC logotype

Diff of /trunk/Src/wptGPG.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 136 by twoaday, Mon Jan 9 09:15:29 2006 UTC revision 137 by twoaday, Mon Jan 9 14:01:51 2006 UTC
# Line 325  check_gnupg_prog (void) Line 325  check_gnupg_prog (void)
325    
326    
327  static int  static int
328  parse_version_nr (const char * buf, int *major, int *minor, int *patch)  parse_version_nr (const char *buf, int *major, int *minor, int *patch)
329  {  {
330      char tmp[8];      char tmp[8];
331      int i;      int i;
# Line 353  parse_version_nr (const char * buf, int Line 353  parse_version_nr (const char * buf, int
353     version given in @r_major.@r_minor.@r_patch. On success these     version given in @r_major.@r_minor.@r_patch. On success these
354     variables contain the GPG version which is installed. */     variables contain the GPG version which is installed. */
355  int  int
356  check_gnupg_engine (int *r_major, int *r_minor, int *r_patch)  check_gnupg_engine (const char *need_gpg_ver,
357                        int *r_major, int *r_minor, int *r_patch)
358  {  {
359      gpgme_ctx_t ctx;      gpgme_ctx_t ctx;
360      gpgme_engine_info_t inf;      gpgme_engine_info_t inf;
361      char *eng = NULL;      char *eng = NULL;
362      int major=0, minor=0, patch=0;      int major=0, minor=0, patch=0;
363        int need_major = 0, need_minor = 0, need_patch = 0;
364      int rc = 1;      int rc = 1;
365            
366        /* Convert the needed GPG version to the integer format. */
367        rc = parse_version_nr (need_gpg_ver,
368                               &need_major, &need_minor, &need_patch);
369        if (rc)
370            return rc;
371        
372      gpgme_new (&ctx);      gpgme_new (&ctx);
373      inf = gpgme_ctx_get_engine_info (ctx);      inf = gpgme_ctx_get_engine_info (ctx);
374      if (!inf) {      if (!inf) {
# Line 380  check_gnupg_engine (int *r_major, int *r Line 388  check_gnupg_engine (int *r_major, int *r
388          return rc;          return rc;
389      }      }
390    
391      if (major > *r_major)      if (major > need_major)
392          rc = 0;          rc = 0;
393      else if (major == *r_major && minor > *r_minor)                else if (major == need_major && minor > need_minor)      
394          rc = 0;          rc = 0;
395      else if (major == *r_major && minor == *r_minor &&      else if (major == need_major && minor == need_minor &&
396               patch >= *r_patch)               patch >= need_patch)
397          rc = 0;          rc = 0;
398    
399        /* Return the current GPG version. */
400      *r_major = major;      *r_major = major;
401      *r_minor = minor;      *r_minor = minor;
402      *r_patch = patch;      *r_patch = patch;

Legend:
Removed from v.136  
changed lines
  Added in v.137

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26