Back to index

courier  0.68.2
options.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 2004 Double Precision, Inc.  See COPYING for
00003 ** distribution information.
00004 */
00005 
00006 
00007 #include "config.h"
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 #include <string.h>
00011 #include <errno.h>
00012 #include <unistd.h>
00013 #include "gpg.h"
00014 
00015 char *libmail_gpg_options(const char *p)
00016 {
00017        if (!p || !*p)
00018               p=getenv("GNUPGHOME");
00019 
00020        if (p && *p)
00021        {
00022               char *s=malloc(strlen(p)+sizeof("/options"));
00023 
00024               if (s)
00025                      return (strcat(strcpy(s, p), "/options"));
00026        }
00027        else
00028        {
00029               p=getenv("HOME");
00030 
00031               if (p && *p)
00032               {
00033                      char *s=malloc(strlen(p)+sizeof("/.gnupg/options"));
00034 
00035                      if (s)
00036                             return (strcat(strcpy(s, p),
00037                                           "/.gnupg/options"));
00038               }
00039        }
00040        return NULL;
00041 }