Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Removing compiler warnings.

* Using getopt().
* Supporting RISC OS.
        Stefan Bellon <sbellon>
* Correct casting for Bzip2.
        Stefan Bellon <sbellon>
* Prepared os/riscos/{config.h,Makefile} since "sh" does not exist on
  RISC OS.
        Stefan Bellon <sbellon>
  • Loading branch information...
commit 82dafed9e20dea67fd557c3b16630d7f2739df84 1 parent 1af1c15
@kazu-yamamoto authored
View
12 CHANGES
@@ -1,5 +1,17 @@
Change Log
+0.21 2004/01/13
+
+* Removing compiler warnings.
+* Using getopt().
+* Supporting RISC OS.
+ Stefan Bellon <sbellon>
+* Correct casting for Bzip2.
+ Stefan Bellon <sbellon>
+* Prepared os/riscos/{config.h,Makefile} since "sh" does not exist on
+ RISC OS.
+ Stefan Bellon <sbellon>
+
0.20 2003/12/08
* Catching up to 2440bis-09. Bzip2 was supported.
View
6 buffer.c
@@ -254,13 +254,13 @@ inflate_bzip2(byte *p, unsigned int max)
if (done == YES) return 0;
- bz.next_out = p;
+ bz.next_out = (char *)p;
bz.avail_out = max;
while (bz.avail_out != 0) {
if (bz.avail_in == 0) {
size = (*d_func2)(d_buf2, sizeof(d_buf2));
- bz.next_in = d_buf2;
+ bz.next_in = (char *)d_buf2;
bz.avail_in = size;
}
@@ -411,7 +411,7 @@ Compressed_Data_Packet(int len)
z.avail_out = sizeof(d_buf2);
#endif /* HAVE_LIBZ */
#ifdef HAVE_LIBBZ2
- bz.next_in = d_buf2;
+ bz.next_in = (char *)d_buf2;
bz.avail_in = AVAIL_COUNT;
bz.next_out = 0;
bz.avail_out = sizeof(d_buf2);
View
5 config.h.in
@@ -1,5 +1,7 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
+#undef PATH_SEPARATOR
+
/* Define if you don't have tm_zone but do have the external array
tzname. */
#undef HAVE_TZNAME
@@ -22,6 +24,9 @@
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
+/* Define if you have the <unixlib/local.h> header file. */
+#undef HAVE_UNIXLIB_LOCAL_H
+
/* Define if your struct tm has tm_zone. */
#undef HAVE_STRUCT_TM_TM_ZONE
View
143 configure
@@ -2869,7 +2869,6 @@ fi
done
-
for ac_header in sys/time.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -3011,6 +3010,148 @@ fi
done
+
+for ac_header in unixlib/local.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
if test "${ac_cv_header_time+set}" = set; then
View
2  configure.in
@@ -12,8 +12,8 @@ dnl Checks for header files.
AC_CONFIG_HEADER(config.h)
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
-
AC_CHECK_HEADERS(sys/time.h)
+AC_CHECK_HEADERS(unixlib/local.h)
AC_HEADER_TIME
dnl Checks for typedefs, structures, and compiler characteristics.
View
56 os/riscos/Makefile
@@ -0,0 +1,56 @@
+# Makefile for RISC OS pgpdump
+
+PGPDUMP=pgpdump-0/20
+ZLIB=^.zlib-1/1/4
+LIBBZIP2=^.bzip2-1/0/2
+
+CC=cc
+LINK=link
+MAKE=amu
+
+DEPEND=-depend !Depend
+CC_FLAGS=-Wp -throwback -Otime -I$(ZLIB),$(LIBBZIP2),Unix: -JUnix: -D__riscos__ -DHAVE_CONFIG_H
+LD_FLAGS=
+UNIXLIB=Unix:o.UnixLib
+
+PGPDUMP_OBJS=buffer.o \
+ keys.o \
+ packet.o \
+ pgpdump.o \
+ signature.o \
+ subfunc.o \
+ tagfuncs.o \
+ types.o \
+ uatfunc.o
+
+.INIT:
+ -cdir o
+
+## Rule Patterns ##
+
+.SUFFIXES: .c .o
+
+.c.o:
+ $(CC) $(CC_FLAGS) $(DEPEND) -c -o $@ $<
+
+# Static dependencies:
+
+pgpdump: $(PGPDUMP_OBJS) $(ZLIB).zlib $(LIBBZIP2).libbzip2
+ $(LINK) $(LD_FLAGS) -o pgpdump $(PGPDUMP_OBJS) $(ZLIB).zlib $(LIBBZIP2).libbzip2 $(UNIXLIB)
+ -squeeze pgpdump
+
+$(ZLIB).zlib:
+ dir $(ZLIB)
+ amu
+ dir ^.$(PGPDUMP)
+
+$(LIBBZIP2).libbzip2:
+ dir $(LIBBZIP2)
+ amu
+ dir ^.$(PGPDUMP)
+
+clean:
+ -ifthere pgpdump then wipe pgpdump ~CFR~V
+ -ifthere o.* then wipe o.* ~CFR~V
+
+# Dynamic dependencies:
View
31 os/riscos/config.h
@@ -0,0 +1,31 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+#undef PATH_SEPARATOR
+
+/* Define if you don't have tm_zone but do have the external array
+ tzname. */
+/* #undef HAVE_TZNAME */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the z library (-lz). */
+#define HAVE_LIBZ 1
+
+/* Define if you have the z library (-lbz2). */
+#define HAVE_LIBBZ2 1
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define if you have the <unixlib/local.h> header file. */
+#define HAVE_UNIXLIB_LOCAL_H 1
+
+/* Define if your struct tm has tm_zone. */
+#define HAVE_STRUCT_TM_TM_ZONE 1
View
122 pgpdump.c
@@ -13,15 +13,40 @@ int mflag;
int pflag;
int uflag;
-private char *pgpdump_version = "0.20, Copyright (C) 1998-2003 Kazu Yamamoto";
+private char *pgpdump_version = "0.21, Copyright (C) 1998-2004 Kazu Yamamoto";
private char *prog;
+private char *getprog(void);
+private void setprog(char *);
+
private void usage(void);
private void version(void);
-
+
+private char *
+getprog() {
+ return prog;
+}
+
+#ifdef HAVE_UNIXLIB_LOCAL_H
+#include <unixlib/local.h>
+int __riscosify_control = __RISCOSIFY_NO_PROCESS;
+#define PATH_SEPC '.'
+#else /* HAVE_UNIXLIB_LOCAL_H */
+#define PATH_SEPC '/'
+#endif /* HAVE_UNIXLIB_LOCAL_H */
+
+private void
+setprog(char *p) {
+ if ((prog = strrchr(p, PATH_SEPC)) == NULL)
+ prog = p;
+ else
+ prog++;
+}
+
private void
usage(void)
{
+ char *prog = getprog();
fprintf(stderr, "%s -h|-v\n", prog);
fprintf(stderr, "%s [-agilmpu] [PGPfile]\n", prog);
fprintf(stderr, "\t -h -- displays this help\n");
@@ -33,7 +58,7 @@ usage(void)
fprintf(stderr, "\t -m -- dumps marker packets\n");
fprintf(stderr, "\t -p -- dumps private packets\n");
fprintf(stderr, "\t -u -- displays UTC time\n");
- exit(SUCCESS);
+ exit(EXIT_SUCCESS);
}
public void
@@ -41,8 +66,7 @@ warning(const char *fmt, ...)
{
va_list ap;
- if (prog != NULL)
- fprintf(stderr, "%s: ", prog);
+ fprintf(stderr, "%s: ", getprog());
va_start(ap, fmt);
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
@@ -55,29 +79,27 @@ warn_exit(const char *fmt, ...)
{
va_list ap;
- if (prog != NULL)
- fprintf(stderr, "%s: ", prog);
+ fprintf(stderr, "%s: ", getprog());
va_start(ap, fmt);
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
- exit(ERROR);
+ exit(EXIT_FAILURE);
}
private void
version(void)
{
- fprintf(stderr, "%s version %s\n", prog, pgpdump_version);
- exit(SUCCESS);
+ fprintf(stderr, "%s version %s\n", getprog(), pgpdump_version);
+ exit(EXIT_SUCCESS);
}
int
main(int argc, char *argv[])
{
int c;
-
aflag = 0;
gflag = 0;
iflag = 0;
@@ -85,47 +107,43 @@ main(int argc, char *argv[])
mflag = 0;
pflag = 0;
uflag = 0;
-
- if ((prog = strrchr(argv[0], '/')) == NULL)
- prog = argv[0];
- else
- prog++;
- while (--argc > 0 && (*++argv)[0] == '-') {
- while (c = *++argv[0]) {
- switch (c){
- case 'h':
- usage();
- break;
- case 'v':
- version();
- break;
- case 'a':
- aflag++;
- break;
- case 'g':
- gflag++;
- break;
- case 'i':
- iflag++;
- break;
- case 'l':
- lflag++;
- break;
- case 'm':
- mflag++;
- break;
- case 'p':
- pflag++;
- break;
- case 'u':
- uflag++;
- break;
- default:
- usage();
- }
- }
- }
+ setprog(argv[0]);
+
+ while ((c = getopt(argc, argv, "hvagilmpu")) != -1)
+ switch (c){
+ case 'h':
+ usage();
+ break;
+ case 'v':
+ version();
+ break;
+ case 'a':
+ aflag++;
+ break;
+ case 'g':
+ gflag++;
+ break;
+ case 'i':
+ iflag++;
+ break;
+ case 'l':
+ lflag++;
+ break;
+ case 'm':
+ mflag++;
+ break;
+ case 'p':
+ pflag++;
+ break;
+ case 'u':
+ uflag++;
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
if (argc > 0) {
char *target = argv[0];
@@ -134,7 +152,7 @@ main(int argc, char *argv[])
}
parse_packet();
- exit(SUCCESS);
+ exit(EXIT_SUCCESS);
}
public void skip(int len)
View
4 pgpdump.h
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <ctype.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
@@ -17,9 +18,6 @@
#define public extern
#define private static
-#define SUCCESS 0
-#define ERROR 1
-
#define YES 1
#define NO 0
Please sign in to comment.
Something went wrong with that request. Please try again.