diff --git a/CHANGES b/CHANGES index ae8ab5a..778677a 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,8 @@ corrections: corrected some bugs and typos in doc/socat.yo, EXAMPLES, C comments further changes: + procan -c prints C defines important for socat + added test OPENSSLEOF for OpenSSL half close ####################### V 1.6.0.0: diff --git a/Makefile.in b/Makefile.in index 335caf9..100e390 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,5 @@ # source: Makefile.in -# Copyright Gerhard Rieger 2001-2007 +# Copyright Gerhard Rieger 2001-2008 # Published under the GNU General Public License V.2, see file COPYING # note: @...@ forms are filled in by configure script @@ -50,7 +50,7 @@ XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \ xio-pty.c xio-openssl.c \ xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c XIOOBJS = $(XIOSRCS:.c=.o) -UTLSRCS = error.c dalan.c procan.c hostan.c fdname.c sysutils.c utils.c nestlex.c @FILAN@ @SYCLS@ @SSLCLS@ +UTLSRCS = error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c @FILAN@ @SYCLS@ @SSLCLS@ UTLOBJS = $(UTLSRCS:.c=.o) CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c OFILES = $(CFILES:.c=.o) @@ -107,7 +107,7 @@ depend: $(CFILES) $(HFILES) socat: socat.o libxio.a $(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS) -PROCAN_OBJS=procan_main.o procan.o hostan.o error.o sycls.o sysutils.o utils.o +PROCAN_OBJS=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o procan: $(PROCAN_OBJS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS) diff --git a/procan-cdefs.c b/procan-cdefs.c new file mode 100644 index 0000000..039a682 --- /dev/null +++ b/procan-cdefs.c @@ -0,0 +1,84 @@ +/* source: procan.c */ +/* Copyright Gerhard Rieger 2008 */ +/* Published under the GNU General Public License V.2, see file COPYING */ + +/* a function that prints compile time parameters */ +/* the set of parameters is only a small subset of the available defines and + will be extended on demand */ + + +#include "xiosysincludes.h" +#include "mytypes.h" +#include "compat.h" +#include "error.h" + +#include "procan.h" + +int procan_cdefs(FILE *outfile) { + /* basic C/system constants */ +#ifdef FD_SETSIZE + fprintf(outfile, "#define FD_SETSIZE %u\n", FD_SETSIZE); +#endif +#ifdef NFDBITS + fprintf(outfile, "#define NFDBITS %u\n", NFDBITS); +#endif +#ifdef O_RDONLY + fprintf(outfile, "#define O_RDONLY %u\n", O_RDONLY); +#endif +#ifdef O_WRONLY + fprintf(outfile, "#define O_WRONLY %u\n", O_WRONLY); +#endif +#ifdef O_RDWR + fprintf(outfile, "#define O_RDWR %u\n", O_RDWR); +#endif +#ifdef SHUT_RD + fprintf(outfile, "#define SHUT_RD %u\n", SHUT_RD); +#endif +#ifdef SHUT_WR + fprintf(outfile, "#define SHUT_WR %u\n", SHUT_WR); +#endif +#ifdef SHUT_RDWR + fprintf(outfile, "#define SHUT_RDWR %u\n", SHUT_RDWR); +#endif + + /* termios constants */ +#ifdef CRDLY + fprintf(outfile, "#define CRDLY 0%011o\n", CRDLY); +#endif +#ifdef CR0 + fprintf(outfile, "#define CR0 0%011o\n", CR0); +#endif +#ifdef CR1 + fprintf(outfile, "#define CR1 0%011o\n", CR1); +#endif +#ifdef CR2 + fprintf(outfile, "#define CR2 0%011o\n", CR2); +#endif +#ifdef CR3 + fprintf(outfile, "#define CR3 0%011o\n", CR3); +#endif +#ifdef TABDLY + fprintf(outfile, "#define TABDLY 0%011o\n", TABDLY); +#endif +#ifdef TAB0 + fprintf(outfile, "#define TAB0 0%011o\n", TAB0); +#endif +#ifdef TAB1 + fprintf(outfile, "#define TAB1 0%011o\n", TAB1); +#endif +#ifdef TAB2 + fprintf(outfile, "#define TAB2 0%011o\n", TAB2); +#endif +#ifdef TAB3 + fprintf(outfile, "#define TAB3 0%011o\n", TAB3); +#endif +#ifdef CSIZE + fprintf(outfile, "#define CSIZE 0%011o\n", CSIZE); +#endif + + /* stdio constants */ +#ifdef FOPEN_MAX + fprintf(outfile, "#define FOPEN_MAX %u\n", FOPEN_MAX); +#endif + return 0; +} diff --git a/procan.h b/procan.h index 9a68c0c..4fd8e06 100644 --- a/procan.h +++ b/procan.h @@ -1,10 +1,11 @@ /* source: procan.h */ -/* Copyright Gerhard Rieger 2001 */ +/* Copyright Gerhard Rieger 2001-2008 */ /* Published under the GNU General Public License V.2, see file COPYING */ #ifndef __procan_h_included #define __procan_h_included 1 extern int procan(FILE *outfile); +extern int procan_cdefs(FILE *outfile); #endif /* !defined(__procan_h_included) */ diff --git a/procan_main.c b/procan_main.c index ed6390a..699c05c 100644 --- a/procan_main.c +++ b/procan_main.c @@ -32,6 +32,7 @@ int main(int argc, const char *argv[]) { #if WITH_HELP case '?': case 'h': procan_usage(stdout); exit(0); #endif /* WITH_HELP */ + case 'c': procan_cdefs(stdout); exit(0); #if LATER case 'V': procan_version(stdout); exit(0); case 'l': diag_set(arg1[0][2], &arg1[0][3]); break; @@ -79,6 +80,7 @@ static void procan_usage(FILE *fd) { #if WITH_HELP fputs(" -?|-h print a help text describing command line options\n", fd); #endif + fputs(" -c print values of compile time C defines\n", fd); #if LATER fputs(" -d increase verbosity (use up to 4 times; 2 are recommended)\n", fd); #endif