procan prints C defines important for socat

This commit is contained in:
Gerhard Rieger 2008-01-31 21:41:13 +01:00
parent 706e3a6863
commit 989790c57f
5 changed files with 93 additions and 4 deletions

View file

@ -21,6 +21,8 @@ corrections:
corrected some bugs and typos in doc/socat.yo, EXAMPLES, C comments corrected some bugs and typos in doc/socat.yo, EXAMPLES, C comments
further changes: further changes:
procan -c prints C defines important for socat
added test OPENSSLEOF for OpenSSL half close added test OPENSSLEOF for OpenSSL half close
####################### V 1.6.0.0: ####################### V 1.6.0.0:

View file

@ -1,5 +1,5 @@
# source: Makefile.in # 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 # Published under the GNU General Public License V.2, see file COPYING
# note: @...@ forms are filled in by configure script # 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-pty.c xio-openssl.c \
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
XIOOBJS = $(XIOSRCS:.c=.o) 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) UTLOBJS = $(UTLSRCS:.c=.o)
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
OFILES = $(CFILES:.c=.o) OFILES = $(CFILES:.c=.o)
@ -107,7 +107,7 @@ depend: $(CFILES) $(HFILES)
socat: socat.o libxio.a socat: socat.o libxio.a
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS) $(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) procan: $(PROCAN_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)

84
procan-cdefs.c Normal file
View file

@ -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;
}

View file

@ -1,10 +1,11 @@
/* source: procan.h */ /* source: procan.h */
/* Copyright Gerhard Rieger 2001 */ /* Copyright Gerhard Rieger 2001-2008 */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
#ifndef __procan_h_included #ifndef __procan_h_included
#define __procan_h_included 1 #define __procan_h_included 1
extern int procan(FILE *outfile); extern int procan(FILE *outfile);
extern int procan_cdefs(FILE *outfile);
#endif /* !defined(__procan_h_included) */ #endif /* !defined(__procan_h_included) */

View file

@ -32,6 +32,7 @@ int main(int argc, const char *argv[]) {
#if WITH_HELP #if WITH_HELP
case '?': case 'h': procan_usage(stdout); exit(0); case '?': case 'h': procan_usage(stdout); exit(0);
#endif /* WITH_HELP */ #endif /* WITH_HELP */
case 'c': procan_cdefs(stdout); exit(0);
#if LATER #if LATER
case 'V': procan_version(stdout); exit(0); case 'V': procan_version(stdout); exit(0);
case 'l': diag_set(arg1[0][2], &arg1[0][3]); break; case 'l': diag_set(arg1[0][2], &arg1[0][3]); break;
@ -79,6 +80,7 @@ static void procan_usage(FILE *fd) {
#if WITH_HELP #if WITH_HELP
fputs(" -?|-h print a help text describing command line options\n", fd); fputs(" -?|-h print a help text describing command line options\n", fd);
#endif #endif
fputs(" -c print values of compile time C defines\n", fd);
#if LATER #if LATER
fputs(" -d increase verbosity (use up to 4 times; 2 are recommended)\n", fd); fputs(" -d increase verbosity (use up to 4 times; 2 are recommended)\n", fd);
#endif #endif