1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-05-24 13:42:42 +00:00

Procan prints some C-defines in oct and hex

This commit is contained in:
Gerhard 2025-02-10 22:24:56 +01:00
parent 699da5f522
commit 3339885f5b
2 changed files with 31 additions and 30 deletions

View file

@ -102,6 +102,7 @@ Features:
the saved set-user-ID.
Procan prints more C-defines, esp.O_*, AI_*, EAI_*; __GLIBC__;
prints some C-defines in oct and hex;
added option -V
Procan tells if char is signed or unsigned

View file

@ -39,58 +39,58 @@ int procan_cdefs(FILE *outfile) {
fprintf(outfile, "#define O_RDWR %u\n", O_RDWR);
#endif
#ifdef O_CREAT
fprintf(outfile, "#define O_CREAT 0x%06x\n", O_CREAT);
fprintf(outfile, "#define O_CREAT 0x%06x /* 0%08o */\n", O_CREAT, O_CREAT);
#endif
#ifdef O_EXCL
fprintf(outfile, "#define O_EXCL 0x%06x\n", O_EXCL);
fprintf(outfile, "#define O_EXCL 0x%06x /* 0%08o */\n", O_EXCL, O_EXCL);
#endif
#ifdef O_NOCTTY
fprintf(outfile, "#define O_NOCTTY 0x%06x\n", O_NOCTTY);
fprintf(outfile, "#define O_NOCTTY 0x%06x /* 0%08o */\n", O_NOCTTY, O_NOCTTY);
#endif
#ifdef O_TRUNC
fprintf(outfile, "#define O_TRUNC 0x%06x\n", O_TRUNC);
fprintf(outfile, "#define O_TRUNC 0x%06x /* 0%08o */\n", O_TRUNC, O_TRUNC);
#endif
#ifdef O_APPEND
fprintf(outfile, "#define O_APPEND 0x%06x\n", O_APPEND);
fprintf(outfile, "#define O_APPEND 0x%06x /* 0%08o */\n", O_APPEND, O_APPEND);
#endif
#ifdef O_NONBLOCK
fprintf(outfile, "#define O_NONBLOCK 0x%06x\n", O_NONBLOCK);
fprintf(outfile, "#define O_NONBLOCK 0x%06x /* 0%08o */\n", O_NONBLOCK, O_NONBLOCK);
#endif
#ifdef O_NDELAY
fprintf(outfile, "#define O_NDELAY 0x%06x\n", O_NDELAY);
fprintf(outfile, "#define O_NDELAY 0x%06x /* 0%08o */\n", O_NDELAY, O_NDELAY);
#endif
#ifdef O_SYNC
fprintf(outfile, "#define O_SYNC 0x%06x\n", O_SYNC);
fprintf(outfile, "#define O_SYNC 0x%06x /* 0%08o */\n", O_SYNC, O_SYNC);
#endif
#ifdef O_FSYNC
fprintf(outfile, "#define O_FSYNC 0x%06x\n", O_FSYNC);
fprintf(outfile, "#define O_FSYNC 0x%06x /* 0%08o */\n", O_FSYNC, O_FSYNC);
#endif
#ifdef O_LARGEFILE
fprintf(outfile, "#define O_LARGEFILE 0x%06x\n", O_LARGEFILE);
fprintf(outfile, "#define O_LARGEFILE 0x%06x /* 0%08o */\n", O_LARGEFILE, O_LARGEFILE);
#endif
#ifdef O_DIRECTORY
fprintf(outfile, "#define O_DIRECTORY 0x%06x\n", O_DIRECTORY);
fprintf(outfile, "#define O_DIRECTORY 0x%06x /* 0%08o */\n", O_DIRECTORY, O_DIRECTORY);
#endif
#ifdef O_NOFOLLOW
fprintf(outfile, "#define O_NOFOLLOW 0x%06x\n", O_NOFOLLOW);
fprintf(outfile, "#define O_NOFOLLOW 0x%06x /* 0%08o */\n", O_NOFOLLOW, O_NOFOLLOW);
#endif
#ifdef O_CLOEXEC
fprintf(outfile, "#define O_CLOEXEC 0x%06x\n", O_CLOEXEC);
fprintf(outfile, "#define O_CLOEXEC 0x%06x /* 0%08o */\n", O_CLOEXEC, O_CLOEXEC);
#endif
#ifdef O_DIRECT
fprintf(outfile, "#define O_DIRECT 0x%06x\n", O_DIRECT);
fprintf(outfile, "#define O_DIRECT 0x%06x /* 0%08o */\n", O_DIRECT, O_DIRECT);
#endif
#ifdef O_NOATIME
fprintf(outfile, "#define O_NOATIME 0x%06x\n", O_NOATIME);
fprintf(outfile, "#define O_NOATIME 0x%06x /* 0%08o */\n", O_NOATIME, O_NOATIME);
#endif
#ifdef O_PATH
fprintf(outfile, "#define O_PATH 0x%06x\n", O_PATH);
fprintf(outfile, "#define O_PATH 0x%06x /* 0%08o */\n", O_PATH, O_PATH);
#endif
#ifdef O_DSYNC
fprintf(outfile, "#define O_DSYNC 0x%06x\n", O_SYNC);
fprintf(outfile, "#define O_DSYNC 0x%06x /* 0%08o */\n", O_SYNC, O_SYNC);
#endif
#ifdef O_TMPFILE
fprintf(outfile, "#define O_TMPFILE 0x%06x\n", O_TMPFILE);
fprintf(outfile, "#define O_TMPFILE 0x%06x /* 0%08o */\n", O_TMPFILE, O_TMPFILE);
#endif
#ifdef SHUT_RD
fprintf(outfile, "#define SHUT_RD %u\n", SHUT_RD);
@ -112,40 +112,40 @@ int procan_cdefs(FILE *outfile) {
/* termios constants */
#ifdef CRDLY
fprintf(outfile, "#define CRDLY 0%011o\n", CRDLY);
fprintf(outfile, "#define CRDLY 0x%08x /* 0%011o */\n", CRDLY, CRDLY);
#endif
#ifdef CR0
fprintf(outfile, "#define CR0 0%011o\n", CR0);
fprintf(outfile, "#define CR0 0x%08x /* 0%011o */\n", CR0, CR0);
#endif
#ifdef CR1
fprintf(outfile, "#define CR1 0%011o\n", CR1);
fprintf(outfile, "#define CR1 0x%08x /* 0%011o */\n", CR1, CR1);
#endif
#ifdef CR2
fprintf(outfile, "#define CR2 0%011o\n", CR2);
fprintf(outfile, "#define CR2 0x%08x /* 0%011o */\n", CR2, CR2);
#endif
#ifdef CR3
fprintf(outfile, "#define CR3 0%011o\n", CR3);
fprintf(outfile, "#define CR3 0x%08x /* 0%011o */\n", CR3, CR3);
#endif
#ifdef TABDLY
fprintf(outfile, "#define TABDLY 0%011o\n", TABDLY);
fprintf(outfile, "#define TABDLY 0x%08x /* 0%011o */\n", TABDLY, TABDLY);
#endif
#ifdef TAB0
fprintf(outfile, "#define TAB0 0%011o\n", TAB0);
fprintf(outfile, "#define TAB0 0x%08x /* 0%011o */\n", TAB0, TAB0);
#endif
#ifdef TAB1
fprintf(outfile, "#define TAB1 0%011o\n", TAB1);
fprintf(outfile, "#define TAB1 0x%08x /* 0%011o */\n", TAB1, TAB1);
#endif
#ifdef TAB2
fprintf(outfile, "#define TAB2 0%011o\n", TAB2);
fprintf(outfile, "#define TAB2 0x%08x /* 0%011o */\n", TAB2, TAB2);
#endif
#ifdef TAB3
fprintf(outfile, "#define TAB3 0%011o\n", TAB3);
fprintf(outfile, "#define TAB3 0x%08x /* 0%011o */\n", TAB3, TAB3);
#endif
#ifdef CSIZE
fprintf(outfile, "#define CSIZE 0%011o\n", CSIZE);
fprintf(outfile, "#define CSIZE 0x%08x /* 0%011o */\n", CSIZE, CSIZE);
#endif
#ifdef TIOCEXCL
fprintf(outfile, "#define TIOCEXCL 0x%lx\n", (unsigned long)TIOCEXCL);
fprintf(outfile, "#define TIOCEXCL 0x%lx\n", (unsigned long)TIOCEXCL);
#endif
/* stdio constants */