diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1999-06-08 18:30:42 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1999-06-08 18:30:42 +0000 |
commit | 9b47f0be31e3ca3c48146893048efefdb22aaf75 (patch) | |
tree | aefb4a2eb5c88bfe90f4d68306ec7638f2c1a7d4 | |
parent | 8d759499d955cbe63ba49103cf798dfc9460d247 (diff) |
Portability patches for SunOS 4.1. From Lars Hecking.
-rw-r--r-- | acconfig.h | 6 | ||||
-rw-r--r-- | configure.in | 26 | ||||
-rw-r--r-- | pgppubring.c | 39 | ||||
-rw-r--r-- | protos.h | 4 |
4 files changed, 64 insertions, 11 deletions
@@ -120,6 +120,9 @@ /* Does your system have the fchdir() call? */ #undef HAVE_FCHDIR +/* getopt() is available, but not declared in any header */ +#undef HAVE_GETOPT_DECL + /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES @@ -144,3 +147,6 @@ /* Where are the character set definitions located? */ #undef CHARMAPS_DIR +/* Define to `int' if <signal.h> doesn't define. */ +#undef sig_atomic_t + diff --git a/configure.in b/configure.in index 2a4ce27c..556140fb 100644 --- a/configure.in +++ b/configure.in @@ -202,10 +202,15 @@ main () AC_HEADER_STDC -AC_CHECK_HEADERS(stdarg.h sys/ioctl.h sysexits.h getopt.h) +AC_CHECK_HEADERS(stdarg.h sys/ioctl.h sysexits.h) AC_TYPE_SIGNAL +AC_MSG_CHECKING(for sig_atomic_t in signal.h) +AC_EGREP_HEADER(sig_atomic_t,signal.h,dnl + [ ac_cv_type_sig_atomic_t=yes; AC_MSG_RESULT(yes) ],dnl + AC_MSG_RESULT(no); AC_CHECK_TYPE(sig_atomic_t, int)) + AC_DECL_SYS_SIGLIST dnl need this for DEC alpha @@ -213,10 +218,27 @@ AC_CHECK_SIZEOF(long) AC_TYPE_PID_T -AC_CHECK_FUNCS(setegid srand48 strerror) +AC_CHECK_FUNCS(fgetpos memmove setegid srand48 strerror) AC_REPLACE_FUNCS(strcasecmp) +AC_CHECK_FUNC(getopt) +if test $ac_cv_func_getopt = yes; then + AC_CHECK_HEADERS(getopt.h) + if test $ac_cv_header_getopt_h = no; then + AC_MSG_CHECKING(for getopt declaration in stdio.h) + AC_EGREP_HEADER(getopt,stdio.h,dnl + [ AC_DEFINE(HAVE_GETOPT_DECL) + AC_MSG_RESULT(yes) ],dnl + AC_MSG_RESULT(no) + AC_MSG_CHECKING(for getopt declaration in stdlib.h) + AC_EGREP_HEADER(getopt,stdlib.h,dnl + [ AC_DEFINE(HAVE_GETOPT_DECL) + AC_MSG_RESULT(yes) ],dnl + AC_MSG_RESULT(no))) + fi +fi + mutt_cv_snprintf=no SNPRINTFOBJS="" AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)], [mutt_cv_snprintf=yes]) diff --git a/pgppubring.c b/pgppubring.c index 0e79a913..43af4533 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -44,12 +44,25 @@ #include <time.h> #ifdef HAVE_GETOPT_H # include <getopt.h> +#else +# ifndef HAVE_GETOPT_DECL +extern char *optarg; +extern int optind; +# endif #endif #include "sha.h" #include "lib.h" #include "pgplib.h" +#ifdef HAVE_FGETPOS +#define FGETPOS(fp,pos) fgetpos((fp),&(pos)) +#define FSETPOS(fp,pos) fsetpos((fp),&(pos)) +#else +#define FGETPOS(fp,pos) pos=ftell((fp)); +#define FSETPOS(fp,pos) fseek((fp),(pos),SEEK_SET) +#endif + #define CHUNKSIZE 1024 static unsigned char *pbuf = NULL; @@ -731,15 +744,19 @@ static pgp_key_t *pgp_parse_keyblock (FILE * fp) size_t l; short err = 0; +#ifdef HAVE_FGETPOS fpos_t pos; - +#else + long pos; +#endif + pgp_key_t *root = NULL; pgp_key_t **last = &root; pgp_key_t *p = NULL; pgp_uid_t *uid = NULL; pgp_uid_t **addr = NULL; - - fgetpos (fp, &pos); + + FGETPOS(fp,pos); while (!err && (buff = pgp_read_packet (fp, &l)) != NULL) { @@ -750,7 +767,7 @@ static pgp_key_t *pgp_parse_keyblock (FILE * fp) if ((pt == PT_SECKEY || pt == PT_PUBKEY) && root) { - fsetpos (fp, &pos); + FSETPOS(fp, pos); return root; } @@ -841,7 +858,7 @@ static pgp_key_t *pgp_parse_keyblock (FILE * fp) } } - fgetpos (fp, &pos); + FGETPOS(fp,pos); } if (err) @@ -874,7 +891,11 @@ static int pgpring_string_matches_hint (const char *s, const char *hints[], int static void pgpring_find_candidates (char *ringfile, const char *hints[], int nhints) { FILE *rfp; +#ifdef HAVE_FGETPOS fpos_t pos, keypos; +#else + long pos, keypos; +#endif unsigned char *buff = NULL; unsigned char pt = 0; @@ -888,8 +909,8 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], int nh return; } - fgetpos (rfp, &pos); - fgetpos (rfp, &keypos); + FGETPOS(rfp,pos); + FGETPOS(rfp,keypos); while (!err && (buff = pgp_read_packet (rfp, &l)) != NULL) { @@ -915,7 +936,7 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], int nh { pgp_key_t *p; - fsetpos (rfp, &keypos); + FSETPOS(rfp, keypos); /* Not bailing out here would lead us into an endless loop. */ @@ -929,7 +950,7 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], int nh safe_free ((void **) &tmp); } - fgetpos (rfp, &pos); + FGETPOS(rfp,pos); } fclose (rfp); @@ -341,6 +341,10 @@ extern char *sys_errlist[]; #define strerror(x) ((x) > 0 && (x) < sys_nerr) ? sys_errlist[(x)] : 0 #endif /* !HAVE_STRERROR */ +#ifndef HAVE_MEMMOVE +#define memmove(d,s,n) bcopy((s),(d),(n)) +#endif + /* AIX doesn't define these in any headers (sigh) */ int strcasecmp (const char *, const char *); int strncasecmp (const char *, const char *, size_t); |