From 9196b79a8c9465a3d5ad6a3e98c3562cc332c259 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Fri, 2 Jun 2023 15:55:42 +0200 Subject: [PATCH 01/83] add -P option, to pass the script via pipe instead of command line --- src/shc.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/src/shc.c b/src/shc.c index 2475311..61e80a6 100644 --- a/src/shc.c +++ b/src/shc.c @@ -68,7 +68,7 @@ static const char * abstract[] = { 0}; static const char usage[] = -"Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHCAB2h] -f script"; +"Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHPCAB2h] -f script"; static const char * help[] = { "", @@ -86,6 +86,7 @@ static const char * help[] = { " -U Make binary untraceable [no]", " -H Hardening : extra security protection [no]", " Require bourne shell (sh) and parameters are not supported", +" -P Submit script as a pipe [no]", " -C Display license and exit", " -A Display abstract and exit", " -B Compile for busybox", @@ -149,6 +150,9 @@ static int MMAP2_flag = 0; static const char BUSYBOXON_line[] = "#define BUSYBOXON %d /* Define as 1 to enable work with busybox */\n"; static int BUSYBOXON_flag = 0; +static const char PIPESCRIPT_line[] = +"#define PIPESCRIPT %d /* Define as 1 to submit script as a pipe */\n"; +static int PIPESCRIPT_flag; static const char * RTC[] = { "", @@ -236,6 +240,7 @@ static const char * RTC[] = { "", "#include ", "#include ", +"#include ", "", "#include ", "#include ", @@ -243,6 +248,7 @@ static const char * RTC[] = { "#include ", "#include ", "#include ", +"#include ", "", "/* 'Alleged RC4' */", "", @@ -714,6 +720,38 @@ static const char * RTC[] = { "#else", " varg[j++] = argv[0]; /* My own name at execution */", "#endif", +" if(PIPESCRIPT && ret) {", +" char tnm[128];", +" int l=100;", +" for(i=getpid(); l--; ) {", +" i = (i*1436856257)%1436856259;", +" sprintf(tnm, \"/tmp/%08x\", i);", +" if(!mkfifo(tnm, S_IWUSR|S_IRUSR)) break;", +" }", +" if(l<0) exit(1);", +" if((i=fork())) {", +" waitpid(i, 0, 0);", +" } else if(fork()) {", +" _exit(0);", +" } else {", +" int w,", +" fd;", +" close(0);", +" close(1);", +" close(2);", +" fd = open(tnm, O_WRONLY);", +" unlink(tnm);", +" for(i=0, l=strlen(text); iBUFSIZ) w=BUFSIZ;", +" if((w=write(fd, text+i, w))<0) break;", +" memset(text+i, 0, w);", +" }", +" _exit(0);", +" }", +" varg[j++] = tnm;", +" i = (ret > 1) ? ret : 1;/* Args numbering correction */", +" goto xec;", +" }", " if (ret && *opts)", " varg[j++] = opts; /* Options on 1st line of code */", " if (*inlo)", @@ -722,6 +760,7 @@ static const char * RTC[] = { " if (*lsto)", " varg[j++] = lsto; /* Option meaning last option */", " i = (ret > 1) ? ret : 0; /* Args numbering correction */", +"xec:", " while (i < argc)", " varg[j++] = argv[i++]; /* Main run-time arguments */", " varg[j] = 0; /* NULL terminated array */", @@ -759,7 +798,7 @@ static const char * RTC[] = { static int parse_an_arg(int argc, char * argv[]) { extern char * optarg; - const char * opts = "e:m:f:i:x:l:o:rvDSUHCAB2h"; + const char * opts = "e:m:f:i:x:l:o:rvDSUHPCAB2h"; struct tm tmp[1]; time_t expdate; int cnt, l; @@ -823,6 +862,9 @@ static int parse_an_arg(int argc, char * argv[]) case 'U': TRACEABLE_flag = 0; break; + case 'P': + PIPESCRIPT_flag = 1; + break; case 'H': HARDENING_flag = 1; break; @@ -1102,7 +1144,7 @@ char * read_script(char * file) text[l] = '\0'; /* Check current System ARG_MAX limit. */ - if (l > 0.80 * (cnt = sysconf(_SC_ARG_MAX))) { + if (!PIPESCRIPT_flag && l > 0.80 * (cnt = sysconf(_SC_ARG_MAX))) { fprintf(stderr, "%s: WARNING!!\n" " Scripts of length near to (or higher than) the current System limit on\n" " \"maximum size of arguments to EXEC\", could comprise its binary execution.\n" @@ -1286,8 +1328,9 @@ int write_C(char * file, char * argv[]) fprintf(o, SETUID_line, SETUID_flag); fprintf(o, DEBUGEXEC_line, DEBUGEXEC_flag); fprintf(o, TRACEABLE_line, TRACEABLE_flag); + fprintf(o, PIPESCRIPT_line, PIPESCRIPT_flag); fprintf(o, HARDENING_line, HARDENING_flag); - fprintf(o, BUSYBOXON_line, BUSYBOXON_flag); + fprintf(o, BUSYBOXON_line, BUSYBOXON_flag); fprintf(o, MMAP2_line, MMAP2_flag); for (indx = 0; RTC[indx]; indx++) fprintf(o, "%s\n", RTC[indx]); @@ -1312,12 +1355,12 @@ int make(void) if (!ldflags) ldflags = ""; -if(!file2){ -file2=(char*)realloc(file2,strlen(file)+3); -strcpy(file2,file); -file2=strcat(file2,".x"); + if(!file2){ + file2=(char*)realloc(file2,strlen(file)+3); + strcpy(file2,file); + file2=strcat(file2,".x"); -} + } sprintf(cmd, "%s %s %s %s.x.c -o %s", cc, cflags, ldflags, file, file2); if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); if (system(cmd)) From a0cbfd99c3aff9c39822a68fbe5016ed7999cbc4 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Fri, 2 Jun 2023 16:07:54 +0200 Subject: [PATCH 02/83] modified untraceable() to avoid occasional freeze with zombie --- src/shc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/shc.c b/src/shc.c index 61e80a6..64eb960 100644 --- a/src/shc.c +++ b/src/shc.c @@ -628,14 +628,15 @@ static const char * RTC[] = { "#endif", " close(0);", " mine = !open(proc, O_RDWR|O_EXCL);", -" if (!mine && errno != EBUSY)", -" mine = !ptrace(PT_ATTACHEXC, pid, 0, 0);", -" if (mine) {", -" kill(pid, SIGCONT);", -" } else {", -/*" fprintf(stderr, \"%s is being traced!\\n\", argv0);",*/ +" if (!mine && errno != EBUSY) {", +" if((mine=2*!ptrace(PT_ATTACHEXC, pid, 0, 0)))wait(0);", +" }", +" if (!mine) {", " perror(argv0);", " kill(pid, SIGKILL);", +/*" fprintf(stderr, \"%s is being traced!\\n\", argv0);",*/ +" } else if(mine>1) {", +" ptrace(PTRACE_DETACH, pid, 0, 0);", " }", " _exit(mine);", " case -1:", From 9c77773b8dec5751791e2d11110e5949455c46be Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Fri, 2 Jun 2023 16:25:04 +0200 Subject: [PATCH 03/83] add support for python* --- src/shc.c | 3 +++ test/test.py | 5 +++++ 2 files changed, 8 insertions(+) create mode 100755 test/test.py diff --git a/src/shc.c b/src/shc.c index 64eb960..29a0e4e 100644 --- a/src/shc.c +++ b/src/shc.c @@ -1048,6 +1048,9 @@ struct { { "ash", "-c", "--", "exec '%s' \"$@\"" }, /* Linux */ { "csh", "-c", "-b", "exec '%s' $argv" }, /* AIX: No file for $0 */ { "tcsh", "-c", "-b", "exec '%s' $argv" }, + { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv)" }, + { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv)" }, + { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv)" }, { NULL, NULL, NULL, NULL }, }; diff --git a/test/test.py b/test/test.py new file mode 100755 index 0000000..c440775 --- /dev/null +++ b/test/test.py @@ -0,0 +1,5 @@ +#!/usr/bin/python3 + +import os, sys +print(os.environ["_"]) +print(sys.argv) From 6242bf5b0071a2efec6eacd2524d9964718e0ec7 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Mon, 5 Jun 2023 10:11:02 +0200 Subject: [PATCH 04/83] initialize pipe flag to 0 --- src/shc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shc.c b/src/shc.c index 29a0e4e..9b1a112 100644 --- a/src/shc.c +++ b/src/shc.c @@ -152,7 +152,7 @@ static const char BUSYBOXON_line[] = static int BUSYBOXON_flag = 0; static const char PIPESCRIPT_line[] = "#define PIPESCRIPT %d /* Define as 1 to submit script as a pipe */\n"; -static int PIPESCRIPT_flag; +static int PIPESCRIPT_flag = 0; static const char * RTC[] = { "", From 6dc86a0ab377ef69a00b4a236bcb821176e28ee5 Mon Sep 17 00:00:00 2001 From: ergoucao <54965164+ergoucao@users.noreply.github.com> Date: Thu, 7 Sep 2023 22:24:56 +0800 Subject: [PATCH 05/83] Fix script file names containing spaces and other special characters. --- src/shc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shc.c b/src/shc.c index 2475311..ca13618 100644 --- a/src/shc.c +++ b/src/shc.c @@ -1318,7 +1318,7 @@ strcpy(file2,file); file2=strcat(file2,".x"); } - sprintf(cmd, "%s %s %s %s.x.c -o %s", cc, cflags, ldflags, file, file2); + sprintf(cmd, "%s %s %s \'%s.x.c\' -o %s", cc, cflags, ldflags, file, file2); if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); if (system(cmd)) return -1; From defa47bf71df36c39fbbf44f2a10ad1ca5325db3 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 5 Jan 2024 20:17:29 +0100 Subject: [PATCH 06/83] Fix files with linting & formatting tools + spelling correction --- man.md | 1 - src/shc.c | 21 ++++++++++----------- test/pru.sh | 5 +++-- test/ttest.sh | 5 +++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/man.md b/man.md index 6c3dd90..a7b3462 100644 --- a/man.md +++ b/man.md @@ -127,4 +127,3 @@ Md Jahidul Hamid # REPORT BUGS TO https://github.com/neurobin/shc/issues - diff --git a/src/shc.c b/src/shc.c index 2475311..04475a4 100644 --- a/src/shc.c +++ b/src/shc.c @@ -21,9 +21,9 @@ static const char version[] = "Version 4.0.3"; static const char subject[] = "Generic Shell Script Compiler"; static const char cpright[] = "GNU GPL Version 3"; static const struct { const char * f, * s, * e; } - provider = { "Md Jahidul", "Hamid", "" }; + provider = { "Md Jahidul", "Hamid", "" }; -/* +/* static const struct { const char * f, * s, * e; } author = { "Francisco", "Garcia", "" }; */ @@ -57,7 +57,7 @@ static const char * abstract[] = { " of the script specified at command line.", "", " Binary version will be saved with a .x extension by default.", -" You can specify output file name too with [-o filname] option.", +" You can specify output file name too with [-o outfile] option.", "", " You can specify expiration date [-e] too, after which binary will", " refuse to be executed, displaying \"[-m]\" instead.", @@ -67,7 +67,7 @@ static const char * abstract[] = { "", 0}; -static const char usage[] = +static const char usage[] = "Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHCAB2h] -f script"; static const char * help[] = { @@ -279,7 +279,7 @@ static const char * RTC[] = { "}", "", "/*", -" * Crypt data. ", +" * Encrypt data. ", " */", "void arc4(void * str, int len)", "{", @@ -895,7 +895,7 @@ static void parse_args(int argc, char * argv[]) if (ret == -1) err++; } while (ret); - + if (err) { fprintf(stderr, "\n%s %s\n\n", my_name, usage); exit(1); @@ -907,7 +907,7 @@ static void parse_args(int argc, char * argv[]) static unsigned char stte[256], indx, jndx, kndx; /* - * Reset arc4 stte. + * Reset arc4 stte. */ void stte_0(void) { @@ -918,7 +918,7 @@ void stte_0(void) } /* - * Set key. Can be used more than once. + * Set key. Can be used more than once. */ void key(void * str, int len) { @@ -937,7 +937,7 @@ void key(void * str, int len) } /* - * Crypt data. + * Encrypt data. */ void arc4(void * str, int len) { @@ -1167,7 +1167,7 @@ void prnt_array(FILE * o, void * ptr, char * name, int l, char * cast) int m = rand_mod(1+l/4); /* Random amount of random pre padding (offset) */ int n = rand_mod(1+l/4); /* Random amount of random post padding (tail) */ int a = (offset+m)%l; - if (cast && a) m += l - a; /* Type alignement. */ + if (cast && a) m += l - a; /* Type alignment. */ fprintf(o, "\n"); fprintf(o, "#define %s_z %d", name, l); fprintf(o, "\n"); @@ -1361,4 +1361,3 @@ int main(int argc, char * argv[]) exit(1); return 1; } - diff --git a/test/pru.sh b/test/pru.sh index bc7d798..341a474 100644 --- a/test/pru.sh +++ b/test/pru.sh @@ -3,5 +3,6 @@ echo "$0" "$@" ps $$ ps wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww $$ cat /proc/$$/cmdline -touch $0.kk -read ENTER +touch "$0.kk" +# shellcheck disable=SC2034 +read -r ENTER diff --git a/test/ttest.sh b/test/ttest.sh index dbab360..9cb72ad 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -16,13 +16,14 @@ pc=0 fc=0 echo echo "== Running tests ..." -for shell in ${shells[@]}; do +for shell in "${shells[@]}"; do for opt in "${check_opts[@]}"; do tmpd=$(mktemp -d) - tmpf="$tmpd/test.$(basename $shell)" + tmpf="$tmpd/test.$(basename "$shell")" echo '#!'"$shell echo 'Hello World fp:'\$1 sp:\$2 " > "$tmpf" + # shellcheck disable=SC2086 "$shc" $opt -f "$tmpf" -o "$tmpd/a.out" out=$("$tmpd/a.out" first second) #~ echo " Output: $out" From d23e9a90d2e3353771c211763bceb7d47ebbb2dd Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 5 Jan 2024 21:15:52 +0100 Subject: [PATCH 07/83] minor: Fix spelling require->requires --- man.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man.md b/man.md index 6c3dd90..9db7fe2 100644 --- a/man.md +++ b/man.md @@ -71,7 +71,7 @@ You can use it if you wish to distribute your scripts but don't want them to be : Make binary to be untraceable (using *strace*, *ptrace*, *truss*, etc.) -H -: Hardening. Extra security flag without root access requirement that protects against dumping, code injection, `cat /proc/pid/cmdline`, ptrace, etc.. This feature is **experimental** and may not work on all systems. it require bourne shell (sh) scripts +: Hardening. Extra security flag without root access requirement that protects against dumping, code injection, `cat /proc/pid/cmdline`, ptrace, etc.. This feature is **experimental** and may not work on all systems. it requires bourne shell (sh) scripts -C : Display license and exit From c5736c3dbbb9f98dc2d66b89bd4300a31c38b136 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 5 Jan 2024 21:41:20 +0100 Subject: [PATCH 08/83] Improve format hinting --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3e2a978..39ff793 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A generic shell script compiler. Shc takes a script, which is specified on the command line and produces C source code. The generated source code is then compiled and linked to produce a stripped binary executable. -The compiled binary will still be dependent on the shell specified in the first line of the shell code (i.e shebang) (i.e. #!/bin/sh), thus shc does not create completely independent binaries. +The compiled binary will still be dependent on the shell specified in the first line of the shell code (i.e shebang) (i.e. `#!/bin/sh`), thus shc does not create completely independent binaries. shc itself is not a compiler such as cc, it rather encodes and encrypts a shell script and generates C source code with the added expiration capability. It then uses the system compiler to compile a stripped binary which behaves exactly like the original script. Upon execution, the compiled binary will decrypt and execute the code with the shell -c option. @@ -23,7 +23,7 @@ sudo make install ### Ubuntu-specific -``` +```bash sudo add-apt-repository ppa:neurobin/ppa sudo apt-get update sudo apt-get install shc @@ -33,7 +33,7 @@ If the above installation method seems like too much work, then just download a ## Usage -``` +```bash shc [options] shc -f script.sh -o binary shc -U -f script.sh -o binary # Untraceable binary (prevent strace, ptrace etc..) @@ -56,15 +56,15 @@ make check ## Known limitations -The one (and I hope the only) limitation using shc is the _SC_ARG_MAX system configuration parameter. +The one (and I hope the only) limitation using shc is the `_SC_ARG_MAX` system configuration parameter. It limits the maximum length of the arguments to the exec function, limiting the maximum length of the runnable script of shc. !! - CHECK YOUR RESULTS CAREFULLY BEFORE USING - !! ## Links -1. [Man Page](http://neurobin.github.io/shc/man.html) -2. [Web Page](http://neurobin.github.io/shc) +1. [Man Page](https://neurobin.github.io/shc/man.html) +2. [Web Page](https://neurobin.github.io/shc) # Contributing From 37b7189435d246ceed99215e3d9b463f94616839 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 5 Jan 2024 20:26:24 +0100 Subject: [PATCH 09/83] Make script executable --- ChangeLog | 27 +++++++++++++-------------- test/pru.sh | 0 2 files changed, 13 insertions(+), 14 deletions(-) mode change 100644 => 100755 test/pru.sh diff --git a/ChangeLog b/ChangeLog index 69432b7..2e935a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,29 +44,29 @@ CHANGES * zsh support * Fix issue #13 (https://github.com/neurobin/shc/issues/13) - + 3.9.2 Fri Aug 21 16:12:33 BDT 2015 - + Added BusyBox support with patch taken from: https://onedrive.live.com/prev?cid=18a41d08a9f3c543&id=18A41D08A9F3C543!231&authkey=!AJQ6Iah_5D3WJ60&v=TextFileEditor as suggested by https://github.com/marcoburatto 3.9.1 Fri Apr 03 00:22:11 GMT 2015 - + Renamed option -T to -U and reversed it's logic. So now, the executable prepared will execute without using sudo, by default. -3.9.0 Wed Apr 01 08:35:22 AM GMT 2015 +3.9.0 Wed Apr 01 08:35:22 AM GMT 2015 (http://github.com/neurobin) Added output file option with [-o filename] and fixed bug on make install (manual install failed) Now you can access manual by entering command: man shc in a terminal. - + 3.8.9 Wed Apr 25 09:24:25 CEST 2012 @@ -122,8 +122,8 @@ CHANGES - Fixed bug: "rlax" used after encryption. Thanks to Nalneesh Gaur for: - - Read permision of the script.x exposes it to disassembling. - - Group and others read permision is now removed by default. + - Read permission of the script.x exposes it to disassembling. + - Group and others read permission is now removed by default. @@ -227,16 +227,15 @@ SCO, both not used now. 3.0b1 Wed Feb 26 14:27:22 WET 1997 The main difference with 2.4 is that in it the script was -compressed an then shuffle around, now int 3.0 the script is encripted -with an inline code, so not needend any external comand to work, and been -faster at startup. Other related adventage is that the only information -not encripted in .x.c is an stamp, expiration date and provider email +compressed an then shuffle around, now int 3.0 the script is encrypted +with an inline code, so not needing any external command to work, and been +faster at startup. Other related advantage is that the only information +not encrypted in .x.c is an stamp, expiration date and provider email address. - Something equivalent to cheksums have been used to enforced at + Something equivalent to checksums have been used to enforced at execution that the executing shell has not been modified from the time -the script was compiled. If anybody tries to change the excuting shell, +the script was compiled. If anybody tries to change the executing shell, .x will refuse to execute. The generated .x.c source code is now readable. - diff --git a/test/pru.sh b/test/pru.sh old mode 100644 new mode 100755 From 727c60e7c3ce7db61e2edc2fb20030d8e4b82b86 Mon Sep 17 00:00:00 2001 From: Luca Baffa Date: Thu, 25 Jan 2024 12:17:31 +0000 Subject: [PATCH 10/83] add install procedure for Debian and Ubuntu systems in the README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 3e2a978..f6c5e71 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,12 @@ sudo make install **Note** If `make` fails due to *automake* version, run `./autogen.sh` before running the above commands. +### Debian GNU/Linux and Ubuntu systems + +```bash +sudo apt-get install shc +``` + ### Ubuntu-specific ``` From a280a4da8dac74acbc091d307f372c85cb4dbc23 Mon Sep 17 00:00:00 2001 From: Luca Baffa Date: Thu, 25 Jan 2024 12:22:07 +0000 Subject: [PATCH 11/83] reword the 'Ubuntu-specific' heading to make it more specific --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6c5e71..ed2d1b3 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ sudo make install sudo apt-get install shc ``` -### Ubuntu-specific +### Ubuntu systems (via PPA repository) ``` sudo add-apt-repository ppa:neurobin/ppa From 8dec14212727c163d7341a1c024919de50c6bb29 Mon Sep 17 00:00:00 2001 From: Luca Baffa Date: Thu, 25 Jan 2024 12:23:05 +0000 Subject: [PATCH 12/83] add code block hinting for the Ubuntu PPA install procedure --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ed2d1b3..7dece7a 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ sudo apt-get install shc ### Ubuntu systems (via PPA repository) -``` +```bash sudo add-apt-repository ppa:neurobin/ppa sudo apt-get update sudo apt-get install shc From 5a3eb513e61d0ca21ee03e0ae31968eb83a5a5dc Mon Sep 17 00:00:00 2001 From: ashamedbit Date: Sun, 28 Jan 2024 18:48:52 -0500 Subject: [PATCH 13/83] Fix memory leaks in write_c and eval_shell --- src/shc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/shc.c b/src/shc.c index 2475311..a1147d6 100644 --- a/src/shc.c +++ b/src/shc.c @@ -1030,6 +1030,7 @@ int eval_shell(char * text) i = sscanf(ptr, " #!%s%s %c", shll, opts, opts); if (i < 1 || i > 2) { fprintf(stderr, "%s: invalid first line in script: %s\n", my_name, ptr); + free(ptr); return -1; } free(ptr); @@ -1181,6 +1182,18 @@ void dump_array(FILE * o, void * ptr, char * name, int l, char * cast) prnt_array(o, ptr, name, l, cast); } +void cleanup_write_c(char* msg1, char* msg2, char* chk1, char* chk2, char* tst1, char* tst2, char* kwsh, char* name) +{ + if (msg1) free(msg1); + if (msg2) free(msg2); + if (chk1) free(chk1); + if (chk2) free(chk2); + if (tst1) free(tst1); + if (tst2) free(tst2); + if (kwsh) free(kwsh); + if (name) free(name); +} + int write_C(char * file, char * argv[]) { char pswd[256]; @@ -1234,6 +1247,7 @@ int write_C(char * file, char * argv[]) if (indx && key_with_file(kwsh)) { fprintf(stderr, "%s: invalid file name: %s ", my_name, kwsh); perror(""); + cleanup_write_c(msg1, msg2, chk1, chk2, tst1, tst2, kwsh, name); exit(1); } arc4(opts, opts_z); numd++; @@ -1248,6 +1262,7 @@ int write_C(char * file, char * argv[]) if (!o) { fprintf(stderr, "%s: creating output file: %s ", my_name, name); perror(""); + cleanup_write_c(msg1, msg2, chk1, chk2, tst1, tst2, kwsh, name); exit(1); } fprintf(o, "#if 0\n"); @@ -1281,6 +1296,7 @@ int write_C(char * file, char * argv[]) indx = 0; } while (!done); } while (numd+=done); + cleanup_write_c(msg1, msg2, chk1, chk2, tst1, tst2, kwsh, name); fprintf(o, "/* End of data[] */;\n"); fprintf(o, "#define %s_z %d\n", "hide", 1<<12); fprintf(o, SETUID_line, SETUID_flag); From 4bd412eefcbe72ed21391ba7e424aaa50866e99d Mon Sep 17 00:00:00 2001 From: Dominik Viererbe Date: Tue, 16 Jul 2024 10:00:24 +0300 Subject: [PATCH 14/83] Remove ash dependency The ash binary package was dropped in Debian unstable, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=920644 Signed-off-by: Dominik Viererbe --- .travis.yml | 2 +- src/shc.c | 1 - test/ttest.sh | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95a1d36..789a829 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: required language: c before_install: - sudo apt-get update -q - - sudo apt install dash bash ash ksh zsh tcsh csh rc + - sudo apt install dash bash ksh zsh tcsh csh rc script: - ./autogen.sh - ./configure diff --git a/src/shc.c b/src/shc.c index 2475311..8865f47 100644 --- a/src/shc.c +++ b/src/shc.c @@ -1002,7 +1002,6 @@ struct { { "Rsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ { "ksh", "-c", "", "exec '%s' \"$@\"" }, /* OK on Solaris, AIX and Linux (THX ) */ { "tsh", "-c", "--", "exec '%s' \"$@\"" }, /* AIX */ - { "ash", "-c", "--", "exec '%s' \"$@\"" }, /* Linux */ { "csh", "-c", "-b", "exec '%s' $argv" }, /* AIX: No file for $0 */ { "tcsh", "-c", "-b", "exec '%s' $argv" }, { NULL, NULL, NULL, NULL }, diff --git a/test/ttest.sh b/test/ttest.sh index dbab360..6075175 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -1,7 +1,7 @@ #!/bin/bash -shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc') -## Install: sudo apt install dash bash ash ksh zsh tcsh csh rc +shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc') +## Install: sudo apt install dash bash ksh zsh tcsh csh rc check_opts=('' '-r' '-v' '-D' '-S') From c2c263ae9d5e7ccd670434c290a1a31fe5e0b34f Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 5 Jan 2024 20:00:40 +0100 Subject: [PATCH 15/83] ci: pre-commit & generate actions --- .github/workflows/generate.yml | 39 ++++++++++++++ .github/workflows/pre-commit.yml | 49 +++++++++++++++++ .pre-commit-config.yaml | 91 ++++++++++++++++++++++++++++++++ pyproject.toml | 18 +++++++ 4 files changed, 197 insertions(+) create mode 100644 .github/workflows/generate.yml create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml new file mode 100644 index 0000000..2d89ffc --- /dev/null +++ b/.github/workflows/generate.yml @@ -0,0 +1,39 @@ +--- +name: Generate files (documentation, autotools) +on: + push: + paths: [man.md, aclocal.m4, configure.ac] + workflow_dispatch: +jobs: + convert_via_pandoc: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: changes + with: + filters: | + man: + - 'man.md' + autotools: + - 'aclocal.m4' + - 'configure.ac' + - uses: docker://pandoc/core:2.17 + if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' }} + with: + args: -s man.md -t man -o shc.1 + - uses: docker://pandoc/core:2.17 + if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' }} + with: + args: -s man.md -t html -o man.html + - run: |- + ./autogen.sh + if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.autotools == 'true' }} + - name: Commit changes + if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' || steps.changes.outputs.autotools }} + run: |- + for r in $(git remote) ; do git remote get-url --all $r ; done + git config user.name github-actions + git config user.email github-actions@github.com + git commit -a -m "ci: Github Action Generate Files" + git push diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..5f4bad5 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,49 @@ +--- +name: pre-commit +on: + pull_request: + push: +jobs: + pre-commit: + runs-on: ubuntu-latest + env: + RAW_LOG: pre-commit.log + CS_XML: pre-commit.xml + steps: + - run: sudo apt-get update && sudo apt-get install cppcheck + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + cache: pip + python-version: "3.12.1" + - run: python -m pip install pre-commit + - uses: actions/cache/restore@v4 + with: + path: ~/.cache/pre-commit/ + key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') + }} + - name: Run pre-commit hooks + run: | + set -o pipefail + pre-commit gc + pre-commit run --show-diff-on-failure --color=always --all-files | tee ${RAW_LOG} + - name: Convert Raw Log to Annotations + uses: mdeweerd/logToCheckStyle@v2024.3.5 + if: ${{ failure() }} + with: + in: ${{ env.RAW_LOG }} + - uses: actions/cache/save@v4 + if: ${{ ! cancelled() }} + with: + path: ~/.cache/pre-commit/ + key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') + }} + - name: Provide log as artifact + uses: actions/upload-artifact@v4 + if: ${{ ! cancelled() }} + with: + name: precommit-logs + path: | + ${{ env.RAW_LOG }} + ${{ env.CS_XML }} + retention-days: 2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..efaca4d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,91 @@ +--- +exclude: + (?x)^( + configure\..*| + .cache/.* + )$ +repos: + - repo: https://github.com/executablebooks/mdformat + # Do this before other tools "fixing" the line endings + rev: 0.7.17 + hooks: + - id: mdformat + name: Format Markdown + stages: [manual] + entry: mdformat # Executable to run, with fixed options + language: python + types: [markdown] + args: [--wrap, '75', --number] + additional_dependencies: + - mdformat-toc + - mdformat-gfm + - mdformat-beautysh + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + # - id: no-commit-to-branch + # args: [--branch, main] + - id: debug-statements + - id: end-of-file-fixer + exclude: ^(test/.*)$ + - id: trailing-whitespace + exclude: .*\.md$ + - id: check-json + - id: mixed-line-ending + - id: check-builtin-literals + args: [--ignore=dict] + - id: check-ast + - id: check-merge-conflict + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + exclude: ^(test/.*)$ + - id: check-docstring-first + - id: fix-byte-order-marker + - id: check-case-conflict + - id: check-toml + - repo: https://github.com/lovesegfault/beautysh.git + rev: v6.2.1 + hooks: + - id: beautysh + exclude: ^(test/.*)$ + additional_dependencies: + - setuptools + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + args: + - --toml + - pyproject.toml + additional_dependencies: + - tomli + - repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + # Install dependencies on windows: + # choco install llvm uncrustify cppcheck + hooks: + - id: uncrustify + stages: [manual] + args: [--replace, --no-backup, -c, uncrustify.cfg] + - id: cppcheck + args: + - --force + #- --std=c99 + - --language=c + #- -IInc + - '--template={file}({line}): {severity} ({id}): {message}' + - id: cpplint + args: ["--filter=-build/header_guard,-build/include,-build/include_subdir,-legal/copyright,-readbility/casting,-readability/fn_size,-whitespace/blank_line,-whitespace/braces,-whitespace/comma,-whitespace/comments,-whitespace/line_length,-whitespace/newline,-whitespace/operators,-whitespace/parens,-whitespace/semicolon,-whitespace/tab,-whitespace/todo"] + additional_dependencies: + - cpplint>=1.6.1 + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 + hooks: + - id: shellcheck + # args: [-x,-e1007,-e1009,-e1072,-e1073] + - repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + hooks: + - id: clang-format + stages: [manual] + args: [-i] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..07d179c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "setuptools.build_meta" + +[project] +dynamic = ["version"] + +[tool.codespell] +ignore-words-list = """ +stdio,master,scrpt +""" +skip = """./.*,*/.metadata,*.xml,configure,*Makefile*,config*,*.m4,man.html""" +quiet-level=2 +ignore-regex = '\\[fnrstv]' +builtin = "clear,rare,informal,usage,code,names" + +[tool.setuptools] +include-package-data = false From 6098fee2fd363caeca801841f260616cdd5e37b4 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 19:05:00 +0200 Subject: [PATCH 16/83] Spelling updates, regenerate man --- ChangeLog | 16 +- man.html | 494 +++++++++++++++++++++++++++++++++++++++++++----------- shc.1 | 301 +++++++++++++++++---------------- src/shc.c | 6 +- 4 files changed, 562 insertions(+), 255 deletions(-) diff --git a/ChangeLog b/ChangeLog index 69432b7..00776ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -122,8 +122,8 @@ CHANGES - Fixed bug: "rlax" used after encryption. Thanks to Nalneesh Gaur for: - - Read permision of the script.x exposes it to disassembling. - - Group and others read permision is now removed by default. + - Read permission of the script.x exposes it to disassembling. + - Group and others read permission is now removed by default. @@ -227,15 +227,15 @@ SCO, both not used now. 3.0b1 Wed Feb 26 14:27:22 WET 1997 The main difference with 2.4 is that in it the script was -compressed an then shuffle around, now int 3.0 the script is encripted -with an inline code, so not needend any external comand to work, and been -faster at startup. Other related adventage is that the only information -not encripted in .x.c is an stamp, expiration date and provider email +compressed an then shuffle around, now int 3.0 the script is encrypted +with an inline code, so not needend any external command to work, and been +faster at startup. Other related advantage is that the only information +not encrypted in .x.c is an stamp, expiration date and provider email address. - Something equivalent to cheksums have been used to enforced at + Something equivalent to checksums has been used to enforce at execution that the executing shell has not been modified from the time -the script was compiled. If anybody tries to change the excuting shell, +the script was compiled. If anybody tries to change the executing shell, .x will refuse to execute. The generated .x.c source code is now readable. diff --git a/man.html b/man.html index 3b7af51..10970bd 100644 --- a/man.html +++ b/man.html @@ -1,97 +1,397 @@ - - - - - - - - shc(1) shc user manual - - - - - -
- -

NAME

-

shc - Generic shell script compiler

-

SYNOPSIS

-

shc [ -e date ] [ -m addr ] [ -i iopt ] [ -x cmnd ] [ -l lopt ] [ -o outfile ] [ -ABCDhUHsvSr ] -f script

-

DESCRIPTION

-

shc creates a stripped binary executable version of the script specified with -f on the command line.

-

The binary version will get a .x extension appended by default if outfile is not defined with [-o outfile] option and will usually be a bit larger in size than the original ascii code. Generated C source code is saved in a file with the extension .x.c or in a file specified with appropriate option.

-

If you supply an expiration date with the -e option, the compiled binary will refuse to run after the date specified. The message Please contact your provider will be displayed instead. This message can be changed with the -m option.

-

You can compile any kind of shell script, but you need to supply valid -i, -x and -l options.

-

The compiled binary will still be dependent on the shell specified in the first line of the shell code (i.e. #!/bin/sh), thus shc does not create completely independent binaries.

-

shc itself is not a compiler such as cc, it rather encodes and encrypts a shell script and generates C source code with the added expiration capability. It then uses the system compiler to compile a stripped binary which behaves exactly like the original script. Upon execution, the compiled binary will decrypt and execute the code with the shell -c option. Unfortunately, it will not give you any speed improvement as a real C program would.

-

shc's main purpose is to protect your shell scripts from modification or inspection. You can use it if you wish to distribute your scripts but don't want them to be easily readable by other people.

-

OPTIONS

-

-e date : Expiration date in dd/mm/yyyy format [none]

-

-m message : message to display upon expiration ["Please contact your provider"]

-

-f script_name : File path of the script to compile

-

-i inline_option : Inline option for the shell interpreter i.e: -e

-

-x command : eXec command, as a printf format i.e: exec(\\'%s\\',@ARGV);

-

-l last_option : Last shell option i.e: --

-

-o outfile : output to the file specified by outfile

-

-r : Relax security. Make a redistributable binary which executes on different systems running the same operating system. You can release your binary with this option for others to use

-

-v : Verbose compilation

-

-S : Switch ON setuid for root callable programs [OFF]

-

-D : Switch on debug exec calls

-

-U : Make binary to be untraceable (using strace, ptrace, truss, etc.)

-

-H : Hardening. Extra security flag without root access requirement that protects against dumping, code injection, cat /proc/pid/cmdline, ptrace, etc.. This feature is experimental and may not work on all systems. This option currently only works with Bourne shell (sh) scripts without any positional parameters.

-

-s : Hardening with single process. Requires -H option, runs the binary in a single process, shell is called in the main process otherwise its called in a child process. This feature is experimental (may hang) and may not work on all systems. This option currently only works with Bourne shell (sh) scripts without any positional parameters.

-

-C : Display license and exit

-

-A : Display abstract and exit

-

-B : Compile for BusyBox

-

-h : Display help and exit

-

ENVIRONMENT VARIABLES

-

CC : C compiler command [cc]

-

CFLAGS : C compiler flags [none]

-

LDFLAGS : Linker flags [none]

-

EXAMPLES

-

Compile a script which can be run on other systems with the trace option enabled (without -U flag):

-
shc -f myscript -o mybinary
-

Compile an untraceable binary:

-
shc -Uf myscript -o mybinary
-

Compile an untraceable binary that doesn't require root access (experimental):

-
shc -Hf myscript -o mybinary
-

LIMITATIONS

-

The maximum size of the script that could be executed once compiled is limited by the operating system configuration parameter _SC_ARG_MAX (see sysconf(2))

-

AUTHORS

-

Francisco Rosales

-

Md Jahidul Hamid

-

REPORT BUGS TO

-

https://github.com/neurobin/shc/issues

- - + + + + + + + + + shc(1) shc user manual + + + +
+

shc(1) shc user manual

+

+

January 14, 2019

+
+
+

NAME

+

shc - Generic shell script compiler

+

SYNOPSIS

+

shc [ -e date ] [ -m addr ] [ -i +iopt ] [ -x cmnd ] [ -l lopt ] [ -o +outfile ] [ -ABCDhUHvSr ] -f script

+

DESCRIPTION

+

shc creates a stripped binary executable version of +the script specified with -f on the command line.

+

The binary version will get a .x extension appended by +default if outfile is not defined with [-o outfile] +option and will usually be a bit larger in size than the original ascii +code. Generated C source code is saved in a file with the extension +.x.c or in a file specified with appropriate option.

+

If you supply an expiration date with the -e option, the +compiled binary will refuse to run after the date specified. The message +Please contact your provider will be displayed instead. +This message can be changed with the -m option.

+

You can compile any kind of shell script, but you need to supply +valid -i, -x and -l options.

+

The compiled binary will still be dependent on the shell specified in +the first line of the shell code (i.e. #!/bin/sh), thus +shc does not create completely independent +binaries.

+

shc itself is not a compiler such as cc, it rather +encodes and encrypts a shell script and generates C source code with the +added expiration capability. It then uses the system compiler to compile +a stripped binary which behaves exactly like the original script. Upon +execution, the compiled binary will decrypt and execute the code with +the shell -c option. Unfortunately, it will not give you +any speed improvement as a real C program would.

+

shc’s main purpose is to protect your shell scripts +from modification or inspection. You can use it if you wish to +distribute your scripts but don’t want them to be easily readable by +other people.

+

OPTIONS

+
+
-e date
+
+Expiration date in dd/mm/yyyy format [none] +
+
-m message
+
+message to display upon expiration +["Please contact your provider"] +
+
-f script_name
+
+File path of the script to compile +
+
-i inline_option
+
+Inline option for the shell interpreter i.e: -e +
+
-x command
+
+eXec command, as a printf format i.e: exec(\\'%s\\',@ARGV); +
+
-l last_option
+
+Last shell option i.e: -- +
+
-o outfile
+
+output to the file specified by outfile +
+
-r
+
+Relax security. Make a redistributable binary which executes on +different systems running the same operating system. You can release +your binary with this option for others to use +
+
-v
+
+Verbose compilation +
+
-S
+
+Switch ON setuid for root callable programs [OFF] +
+
-D
+
+Switch on debug exec calls +
+
-U
+
+Make binary to be untraceable (using strace, ptrace, +truss, etc.) +
+
-H
+
+Hardening. Extra security flag without root access requirement that +protects against dumping, code injection, +cat /proc/pid/cmdline, ptrace, etc.. This feature is +experimental and may not work on all systems. it +requires bourne shell (sh) scripts +
+
-C
+
+Display license and exit +
+
-A
+
+Display abstract and exit +
+
-B
+
+Compile for BusyBox +
+
-h
+
+Display help and exit +
+
+

ENVIRONMENT VARIABLES

+
+
CC
+
+C compiler command [cc] +
+
CFLAGS
+
+C compiler flags [none] +
+
LDFLAGS
+
+Linker flags [none] +
+
+

EXAMPLES

+

Compile a script which can be run on other systems with the trace +option enabled (without -U flag):

+
shc -f myscript -o mybinary
+

Compile an untraceable binary:

+
shc -Uf myscript -o mybinary
+

Compile an untraceable binary that doesn’t require root access +(experimental):

+
shc -Hf myscript -o mybinary
+

LIMITATIONS

+

The maximum size of the script that could be executed once compiled +is limited by the operating system configuration parameter +_SC_ARG_MAX (see sysconf(2))

+

AUTHORS

+

Francisco Rosales frosal@fi.upm.es

+

Md Jahidul Hamid jahidulhamid@yahoo.com

+

REPORT BUGS TO

+

https://github.com/neurobin/shc/issues

+ + diff --git a/shc.1 b/shc.1 index ae9d47a..34fc9cc 100644 --- a/shc.1 +++ b/shc.1 @@ -1,147 +1,154 @@ -.TH "shc" "1" "January 14, 2019" "shc user manual" "" -.SH NAME -.PP -shc \- Generic shell script compiler -.SH SYNOPSIS -.PP -\f[B]shc\f[] [ \-e \f[I]date\f[] ] [ \-m \f[I]addr\f[] ] [ \-i -\f[I]iopt\f[] ] [ \-x \f[I]cmnd\f[] ] [ \-l \f[I]lopt\f[] ] [ \-o -\f[I]outfile\f[] ] [ \-ABCDhUHvSr ] \-f \f[I]script\f[] -.SH DESCRIPTION -.PP -\f[B]shc\f[] creates a stripped binary executable version of the script -specified with \f[C]\-f\f[] on the command line. -.PP -The binary version will get a \f[C]\&.x\f[] extension appended by -default if \f[I]outfile\f[] is not defined with [\-o \f[I]outfile\f[]] -option and will usually be a bit larger in size than the original ascii -code. -Generated C source code is saved in a file with the extension -\f[C]\&.x.c\f[] or in a file specified with appropriate option. -.PP -If you supply an expiration date with the \f[C]\-e\f[] option, the -compiled binary will refuse to run after the date specified. -The message \f[B]Please contact your provider\f[] will be displayed -instead. -This message can be changed with the \f[C]\-m\f[] option. -.PP -You can compile any kind of shell script, but you need to supply valid -\f[C]\-i\f[], \f[C]\-x\f[] and \f[C]\-l\f[] options. -.PP -The compiled binary will still be dependent on the shell specified in -the first line of the shell code (i.e. -\f[C]#!/bin/sh\f[]), thus \f[B]shc\f[] does not create completely -independent binaries. -.PP -\f[B]shc\f[] itself is not a compiler such as cc, it rather encodes and -encrypts a shell script and generates C source code with the added -expiration capability. -It then uses the system compiler to compile a stripped binary which -behaves exactly like the original script. -Upon execution, the compiled binary will decrypt and execute the code -with the shell \f[C]\-c\f[] option. -Unfortunately, it will not give you any speed improvement as a real C -program would. -.PP -\f[B]shc\f[]\[aq]s main purpose is to protect your shell scripts from -modification or inspection. -You can use it if you wish to distribute your scripts but don\[aq]t want -them to be easily readable by other people. -.SH OPTIONS -.PP -\-e \f[I]date\f[] : Expiration date in \f[I]dd/mm/yyyy\f[] format -\f[C][none]\f[] -.PP -\-m \f[I]message\f[] : message to display upon expiration -\f[C]["Please\ contact\ your\ provider"]\f[] -.PP -\-f \f[I]script_name\f[] : File path of the script to compile -.PP -\-i \f[I]inline_option\f[] : Inline option for the shell interpreter -i.e: \f[C]\-e\f[] -.PP -\-x \f[I]command\f[] : eXec command, as a printf format i.e: -\f[C]exec(\\\\\[aq]%s\\\\\[aq],\@ARGV);\f[] -.PP -\-l \f[I]last_option\f[] : Last shell option i.e: \f[C]\-\-\f[] -.PP -\-o \f[I]outfile\f[] : output to the file specified by outfile -.PP -\-r : Relax security. -Make a redistributable binary which executes on different systems -running the same operating system. -You can release your binary with this option for others to use -.PP -\-v : Verbose compilation -.PP -\-S : Switch ON setuid for root callable programs [OFF] -.PP -\-D : Switch on debug exec calls -.PP -\-U : Make binary to be untraceable (using \f[I]strace\f[], -\f[I]ptrace\f[], \f[I]truss\f[], etc.) -.PP -\-H : Hardening. -Extra security flag without root access requirement that protects -against dumping, code injection, \f[C]cat\ /proc/pid/cmdline\f[], -ptrace, etc.. -This feature is \f[B]experimental\f[] and may not work on all systems. -it require bourne shell (sh) scripts -any positional parameters. -.PP -\-C : Display license and exit -.PP -\-A : Display abstract and exit -.PP -\-B : Compile for BusyBox -.PP -\-h : Display help and exit -.SH ENVIRONMENT VARIABLES -.PP -CC : C compiler command \f[C][cc]\f[] -.PP -CFLAGS : C compiler flags \f[C][none]\f[] -.PP -LDFLAGS : Linker flags \f[C][none]\f[] -.SH EXAMPLES -.PP -Compile a script which can be run on other systems with the trace option -enabled (without \f[C]\-U\f[] flag): -.IP -.nf -\f[C] -shc\ \-f\ myscript\ \-o\ mybinary -\f[] -.fi -.PP -Compile an untraceable binary: -.IP -.nf -\f[C] -shc\ \-Uf\ myscript\ \-o\ mybinary -\f[] -.fi -.PP -Compile an untraceable binary that doesn\[aq]t require root access -(experimental): -.IP -.nf -\f[C] -shc\ \-Hf\ myscript\ \-o\ mybinary -\f[] -.fi -.SH LIMITATIONS -.PP -The maximum size of the script that could be executed once compiled is -limited by the operating system configuration parameter -\f[C]_SC_ARG_MAX\f[] (see sysconf(2)) -.SH AUTHORS -.PP -Francisco Rosales -.PP -intika -.PP -Md Jahidul Hamid -.SH REPORT BUGS TO -.PP -https://github.com/neurobin/shc/issues +.\" Automatically generated by Pandoc 3.1.13 +.\" +.TH "shc" "1" "January 14, 2019" "shc user manual" "" +.SH NAME +shc \- Generic shell script compiler +.SH SYNOPSIS +\f[B]shc\f[R] [ \-e \f[I]date\f[R] ] [ \-m \f[I]addr\f[R] ] [ \-i +\f[I]iopt\f[R] ] [ \-x \f[I]cmnd\f[R] ] [ \-l \f[I]lopt\f[R] ] [ \-o +\f[I]outfile\f[R] ] [ \-ABCDhUHvSr ] \-f \f[I]script\f[R] +.SH DESCRIPTION +\f[B]shc\f[R] creates a stripped binary executable version of the script +specified with \f[CR]\-f\f[R] on the command line. +.PP +The binary version will get a \f[CR].x\f[R] extension appended by +default if \f[I]outfile\f[R] is not defined with [\-o \f[I]outfile\f[R]] +option and will usually be a bit larger in size than the original ascii +code. +Generated C source code is saved in a file with the extension +\f[CR].x.c\f[R] or in a file specified with appropriate option. +.PP +If you supply an expiration date with the \f[CR]\-e\f[R] option, the +compiled binary will refuse to run after the date specified. +The message \f[B]Please contact your provider\f[R] will be displayed +instead. +This message can be changed with the \f[CR]\-m\f[R] option. +.PP +You can compile any kind of shell script, but you need to supply valid +\f[CR]\-i\f[R], \f[CR]\-x\f[R] and \f[CR]\-l\f[R] options. +.PP +The compiled binary will still be dependent on the shell specified in +the first line of the shell code (i.e.\ \f[CR]#!/bin/sh\f[R]), thus +\f[B]shc\f[R] does not create completely independent binaries. +.PP +\f[B]shc\f[R] itself is not a compiler such as cc, it rather encodes and +encrypts a shell script and generates C source code with the added +expiration capability. +It then uses the system compiler to compile a stripped binary which +behaves exactly like the original script. +Upon execution, the compiled binary will decrypt and execute the code +with the shell \f[CR]\-c\f[R] option. +Unfortunately, it will not give you any speed improvement as a real C +program would. +.PP +\f[B]shc\f[R]\[cq]s main purpose is to protect your shell scripts from +modification or inspection. +You can use it if you wish to distribute your scripts but don\[cq]t want +them to be easily readable by other people. +.SH OPTIONS +.TP +\-e \f[I]date\f[R] +Expiration date in \f[I]dd/mm/yyyy\f[R] format \f[CR][none]\f[R] +.TP +\-m \f[I]message\f[R] +message to display upon expiration +\f[CR][\[dq]Please contact your provider\[dq]]\f[R] +.TP +\-f \f[I]script_name\f[R] +File path of the script to compile +.TP +\-i \f[I]inline_option\f[R] +Inline option for the shell interpreter i.e: \f[CR]\-e\f[R] +.TP +\-x \f[I]command\f[R] +eXec command, as a printf format i.e: +\f[CR]exec(\[rs]\[rs]\[aq]%s\[rs]\[rs]\[aq],\[at]ARGV);\f[R] +.TP +\-l \f[I]last_option\f[R] +Last shell option i.e: \f[CR]\-\-\f[R] +.TP +\-o \f[I]outfile\f[R] +output to the file specified by outfile +.TP +\-r +Relax security. +Make a redistributable binary which executes on different systems +running the same operating system. +You can release your binary with this option for others to use +.TP +\-v +Verbose compilation +.TP +\-S +Switch ON setuid for root callable programs [OFF] +.TP +\-D +Switch on debug exec calls +.TP +\-U +Make binary to be untraceable (using \f[I]strace\f[R], \f[I]ptrace\f[R], +\f[I]truss\f[R], etc.) +.TP +\-H +Hardening. +Extra security flag without root access requirement that protects +against dumping, code injection, \f[CR]cat /proc/pid/cmdline\f[R], +ptrace, etc.. +This feature is \f[B]experimental\f[R] and may not work on all systems. +it requires bourne shell (sh) scripts +.TP +\-C +Display license and exit +.TP +\-A +Display abstract and exit +.TP +\-B +Compile for BusyBox +.TP +\-h +Display help and exit +.SH ENVIRONMENT VARIABLES +.TP +CC +C compiler command \f[CR][cc]\f[R] +.TP +CFLAGS +C compiler flags \f[CR][none]\f[R] +.TP +LDFLAGS +Linker flags \f[CR][none]\f[R] +.SH EXAMPLES +Compile a script which can be run on other systems with the trace option +enabled (without \f[CR]\-U\f[R] flag): +.IP +.EX +shc \-f myscript \-o mybinary +.EE +.PP +Compile an untraceable binary: +.IP +.EX +shc \-Uf myscript \-o mybinary +.EE +.PP +Compile an untraceable binary that doesn\[cq]t require root access +(experimental): +.IP +.EX +shc \-Hf myscript \-o mybinary +.EE +.SH LIMITATIONS +The maximum size of the script that could be executed once compiled is +limited by the operating system configuration parameter +\f[CR]_SC_ARG_MAX\f[R] (see sysconf(2)) +.SH AUTHORS +Francisco Rosales \c +.MT frosal@fi.upm.es +.ME \c +.PP +Md Jahidul Hamid \c +.MT jahidulhamid@yahoo.com +.ME \c +.SH REPORT BUGS TO +https://github.com/neurobin/shc/issues diff --git a/src/shc.c b/src/shc.c index 2475311..f975c1e 100644 --- a/src/shc.c +++ b/src/shc.c @@ -46,7 +46,7 @@ static const char * copying[] = { " along with this program; if not, write to the Free Software", " @Neurobin, Dhaka, Bangladesh", "", -" Report problems and questions to:http://github.com/neurobin/shc", +" Report problems and questions to:https://github.com/neurobin/shc", "", 0}; @@ -57,7 +57,7 @@ static const char * abstract[] = { " of the script specified at command line.", "", " Binary version will be saved with a .x extension by default.", -" You can specify output file name too with [-o filname] option.", +" You can specify output file name too with [-o FILENAME] option.", "", " You can specify expiration date [-e] too, after which binary will", " refuse to be executed, displaying \"[-m]\" instead.", @@ -1167,7 +1167,7 @@ void prnt_array(FILE * o, void * ptr, char * name, int l, char * cast) int m = rand_mod(1+l/4); /* Random amount of random pre padding (offset) */ int n = rand_mod(1+l/4); /* Random amount of random post padding (tail) */ int a = (offset+m)%l; - if (cast && a) m += l - a; /* Type alignement. */ + if (cast && a) m += l - a; /* Type alignment. */ fprintf(o, "\n"); fprintf(o, "#define %s_z %d", name, l); fprintf(o, "\n"); From 3385b79cd1335c0edab924c717234075c59bfee4 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 20:14:24 +0200 Subject: [PATCH 17/83] Add exceptions for test, and possibility to exclude cppchecks --- .pre-commit-config.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index efaca4d..eea2162 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,7 @@ --- exclude: (?x)^( + configure| configure\..*| .cache/.* )$ @@ -47,7 +48,7 @@ repos: rev: v6.2.1 hooks: - id: beautysh - exclude: ^(test/.*)$ + exclude: (?x)^(test/.*)$ additional_dependencies: - setuptools - repo: https://github.com/codespell-project/codespell @@ -74,6 +75,7 @@ repos: - --language=c #- -IInc - '--template={file}({line}): {severity} ({id}): {message}' + - --inline-suppr - id: cpplint args: ["--filter=-build/header_guard,-build/include,-build/include_subdir,-legal/copyright,-readbility/casting,-readability/fn_size,-whitespace/blank_line,-whitespace/braces,-whitespace/comma,-whitespace/comments,-whitespace/line_length,-whitespace/newline,-whitespace/operators,-whitespace/parens,-whitespace/semicolon,-whitespace/tab,-whitespace/todo"] additional_dependencies: @@ -82,6 +84,7 @@ repos: rev: v0.10.0.1 hooks: - id: shellcheck + exclude: (?x)^(test/.*)$ # args: [-x,-e1007,-e1009,-e1072,-e1073] - repo: https://github.com/pocc/pre-commit-hooks rev: v1.3.5 From 6e5fe3570568238cb050c84564d357b12c65bd8a Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 20:23:29 +0200 Subject: [PATCH 18/83] Exclude readability/casting because this is c-code --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eea2162..2fe04f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -77,7 +77,7 @@ repos: - '--template={file}({line}): {severity} ({id}): {message}' - --inline-suppr - id: cpplint - args: ["--filter=-build/header_guard,-build/include,-build/include_subdir,-legal/copyright,-readbility/casting,-readability/fn_size,-whitespace/blank_line,-whitespace/braces,-whitespace/comma,-whitespace/comments,-whitespace/line_length,-whitespace/newline,-whitespace/operators,-whitespace/parens,-whitespace/semicolon,-whitespace/tab,-whitespace/todo"] + args: ["--filter=-build/header_guard,-build/include,-build/include_subdir,-legal/copyright,-readability/casting,-readability/fn_size,-whitespace/blank_line,-whitespace/braces,-whitespace/comma,-whitespace/comments,-whitespace/line_length,-whitespace/newline,-whitespace/operators,-whitespace/parens,-whitespace/semicolon,-whitespace/tab,-whitespace/todo"] additional_dependencies: - cpplint>=1.6.1 - repo: https://github.com/shellcheck-py/shellcheck-py From 819b7aeb4450ea663e9f3477c9720505b23f2e04 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 20:41:28 +0200 Subject: [PATCH 19/83] Ignore several external files for checks --- .pre-commit-config.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2fe04f2..fe468c0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,8 +3,15 @@ exclude: (?x)^( configure| configure\..*| - .cache/.* - )$ + .cache/.*| + .*Makefile.in| + autogen.sh| + config/install-sh| + config/depcomp| + config/compile| + config/missing| + aclocal.m4| + __NONE__)$ repos: - repo: https://github.com/executablebooks/mdformat # Do this before other tools "fixing" the line endings @@ -48,7 +55,7 @@ repos: rev: v6.2.1 hooks: - id: beautysh - exclude: (?x)^(test/.*)$ + exclude: (?x)^(test/.*|config/missing|configure|autogen.sh)$ additional_dependencies: - setuptools - repo: https://github.com/codespell-project/codespell From dbbe389338d1027210e95f9da8e77feee1a2c56f Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 20:42:45 +0200 Subject: [PATCH 20/83] Cleanup INSTALL --- INSTALL | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/INSTALL b/INSTALL index 8865734..e82fd21 100644 --- a/INSTALL +++ b/INSTALL @@ -1,8 +1,8 @@ Installation Instructions ************************* - Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software -Foundation, Inc. + Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free +Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -225,7 +225,7 @@ order to use an ANSI C compiler: and if that doesn't work, install pre-built binaries of GCC for HP-UX. - HP-UX 'make' updates targets which have the same time stamps as their + HP-UX 'make' updates targets which have the same timestamps as their prerequisites, which makes it generally unusable when shipped generated files such as 'configure' are involved. Use GNU 'make' instead. From 7791306e16c803f81090adc95341b2c1e746974f Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 20:44:18 +0200 Subject: [PATCH 21/83] Cleanup .travis.yml --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 789a829..95ab77c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,8 @@ language: c before_install: - sudo apt-get update -q - sudo apt install dash bash ksh zsh tcsh csh rc -script: +script: - ./autogen.sh - ./configure - make - make test - - From d62dd17d8ca1613dfa079f9332298853cf05a69f Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 20:49:11 +0200 Subject: [PATCH 22/83] Add ci (replace travis) --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b9bf787 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apt-get update -q && sudo apt install -y dash bash ksh zsh tcsh csh rc + + - name: Build and Test + run: | + ./autogen.sh + ./configure + make + make test From 53aad7ee81e5521eb63bb2cd171c70cda66202ab Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 11 Aug 2024 17:49:49 +0000 Subject: [PATCH 23/83] ci: Github Action Generate Files --- man.html | 783 +++++++++++++++++++++++++++---------------------------- shc.1 | 331 ++++++++++++----------- 2 files changed, 563 insertions(+), 551 deletions(-) diff --git a/man.html b/man.html index 10970bd..3a2a430 100644 --- a/man.html +++ b/man.html @@ -1,397 +1,386 @@ - - - - - - - - - shc(1) shc user manual - - - -
-

shc(1) shc user manual

-

-

January 14, 2019

-
-
-

NAME

-

shc - Generic shell script compiler

-

SYNOPSIS

-

shc [ -e date ] [ -m addr ] [ -i -iopt ] [ -x cmnd ] [ -l lopt ] [ -o -outfile ] [ -ABCDhUHvSr ] -f script

-

DESCRIPTION

-

shc creates a stripped binary executable version of -the script specified with -f on the command line.

-

The binary version will get a .x extension appended by -default if outfile is not defined with [-o outfile] -option and will usually be a bit larger in size than the original ascii -code. Generated C source code is saved in a file with the extension -.x.c or in a file specified with appropriate option.

-

If you supply an expiration date with the -e option, the -compiled binary will refuse to run after the date specified. The message -Please contact your provider will be displayed instead. -This message can be changed with the -m option.

-

You can compile any kind of shell script, but you need to supply -valid -i, -x and -l options.

-

The compiled binary will still be dependent on the shell specified in -the first line of the shell code (i.e. #!/bin/sh), thus -shc does not create completely independent -binaries.

-

shc itself is not a compiler such as cc, it rather -encodes and encrypts a shell script and generates C source code with the -added expiration capability. It then uses the system compiler to compile -a stripped binary which behaves exactly like the original script. Upon -execution, the compiled binary will decrypt and execute the code with -the shell -c option. Unfortunately, it will not give you -any speed improvement as a real C program would.

-

shc’s main purpose is to protect your shell scripts -from modification or inspection. You can use it if you wish to -distribute your scripts but don’t want them to be easily readable by -other people.

-

OPTIONS

-
-
-e date
-
-Expiration date in dd/mm/yyyy format [none] -
-
-m message
-
-message to display upon expiration -["Please contact your provider"] -
-
-f script_name
-
-File path of the script to compile -
-
-i inline_option
-
-Inline option for the shell interpreter i.e: -e -
-
-x command
-
-eXec command, as a printf format i.e: exec(\\'%s\\',@ARGV); -
-
-l last_option
-
-Last shell option i.e: -- -
-
-o outfile
-
-output to the file specified by outfile -
-
-r
-
-Relax security. Make a redistributable binary which executes on -different systems running the same operating system. You can release -your binary with this option for others to use -
-
-v
-
-Verbose compilation -
-
-S
-
-Switch ON setuid for root callable programs [OFF] -
-
-D
-
-Switch on debug exec calls -
-
-U
-
-Make binary to be untraceable (using strace, ptrace, -truss, etc.) -
-
-H
-
-Hardening. Extra security flag without root access requirement that -protects against dumping, code injection, -cat /proc/pid/cmdline, ptrace, etc.. This feature is -experimental and may not work on all systems. it -requires bourne shell (sh) scripts -
-
-C
-
-Display license and exit -
-
-A
-
-Display abstract and exit -
-
-B
-
-Compile for BusyBox -
-
-h
-
-Display help and exit -
-
-

ENVIRONMENT VARIABLES

-
-
CC
-
-C compiler command [cc] -
-
CFLAGS
-
-C compiler flags [none] -
-
LDFLAGS
-
-Linker flags [none] -
-
-

EXAMPLES

-

Compile a script which can be run on other systems with the trace -option enabled (without -U flag):

-
shc -f myscript -o mybinary
-

Compile an untraceable binary:

-
shc -Uf myscript -o mybinary
-

Compile an untraceable binary that doesn’t require root access -(experimental):

-
shc -Hf myscript -o mybinary
-

LIMITATIONS

-

The maximum size of the script that could be executed once compiled -is limited by the operating system configuration parameter -_SC_ARG_MAX (see sysconf(2))

-

AUTHORS

-

Francisco Rosales frosal@fi.upm.es

-

Md Jahidul Hamid jahidulhamid@yahoo.com

-

REPORT BUGS TO

-

https://github.com/neurobin/shc/issues

- - + + + + + + + + + shc(1) shc user manual + + + + +
+

shc(1) shc user manual

+

+

January 14, 2019

+
+
+

NAME

+

shc - Generic shell script compiler

+

SYNOPSIS

+

shc [ -e date ] [ -m addr ] [ -i +iopt ] [ -x cmnd ] [ -l lopt ] [ -o +outfile ] [ -ABCDhUHvSr ] -f script

+

DESCRIPTION

+

shc creates a stripped binary executable version of +the script specified with -f on the command line.

+

The binary version will get a .x extension appended by +default if outfile is not defined with [-o outfile] +option and will usually be a bit larger in size than the original ascii +code. Generated C source code is saved in a file with the extension +.x.c or in a file specified with appropriate option.

+

If you supply an expiration date with the -e option, the +compiled binary will refuse to run after the date specified. The message +Please contact your provider will be displayed instead. +This message can be changed with the -m option.

+

You can compile any kind of shell script, but you need to supply +valid -i, -x and -l options.

+

The compiled binary will still be dependent on the shell specified in +the first line of the shell code (i.e. #!/bin/sh), thus +shc does not create completely independent +binaries.

+

shc itself is not a compiler such as cc, it rather +encodes and encrypts a shell script and generates C source code with the +added expiration capability. It then uses the system compiler to compile +a stripped binary which behaves exactly like the original script. Upon +execution, the compiled binary will decrypt and execute the code with +the shell -c option. Unfortunately, it will not give you +any speed improvement as a real C program would.

+

shc’s main purpose is to protect your shell scripts +from modification or inspection. You can use it if you wish to +distribute your scripts but don’t want them to be easily readable by +other people.

+

OPTIONS

+
+
-e date
+
+Expiration date in dd/mm/yyyy format [none] +
+
-m message
+
+message to display upon expiration +["Please contact your provider"] +
+
-f script_name
+
+File path of the script to compile +
+
-i inline_option
+
+Inline option for the shell interpreter i.e: -e +
+
-x command
+
+eXec command, as a printf format i.e: exec(\\'%s\\',@ARGV); +
+
-l last_option
+
+Last shell option i.e: -- +
+
-o outfile
+
+output to the file specified by outfile +
+
-r
+
+Relax security. Make a redistributable binary which executes on +different systems running the same operating system. You can release +your binary with this option for others to use +
+
-v
+
+Verbose compilation +
+
-S
+
+Switch ON setuid for root callable programs [OFF] +
+
-D
+
+Switch on debug exec calls +
+
-U
+
+Make binary to be untraceable (using strace, ptrace, +truss, etc.) +
+
-H
+
+Hardening. Extra security flag without root access requirement that +protects against dumping, code injection, +cat /proc/pid/cmdline, ptrace, etc.. This feature is +experimental and may not work on all systems. it +requires bourne shell (sh) scripts +
+
-C
+
+Display license and exit +
+
-A
+
+Display abstract and exit +
+
-B
+
+Compile for BusyBox +
+
-h
+
+Display help and exit +
+
+

ENVIRONMENT VARIABLES

+
+
CC
+
+C compiler command [cc] +
+
CFLAGS
+
+C compiler flags [none] +
+
LDFLAGS
+
+Linker flags [none] +
+
+

EXAMPLES

+

Compile a script which can be run on other systems with the trace +option enabled (without -U flag):

+
shc -f myscript -o mybinary
+

Compile an untraceable binary:

+
shc -Uf myscript -o mybinary
+

Compile an untraceable binary that doesn’t require root access +(experimental):

+
shc -Hf myscript -o mybinary
+

LIMITATIONS

+

The maximum size of the script that could be executed once compiled +is limited by the operating system configuration parameter +_SC_ARG_MAX (see sysconf(2))

+

AUTHORS

+

Francisco Rosales frosal@fi.upm.es

+

Md Jahidul Hamid jahidulhamid@yahoo.com

+

REPORT BUGS TO

+

https://github.com/neurobin/shc/issues

+ + diff --git a/shc.1 b/shc.1 index 34fc9cc..6184e94 100644 --- a/shc.1 +++ b/shc.1 @@ -1,154 +1,177 @@ -.\" Automatically generated by Pandoc 3.1.13 -.\" -.TH "shc" "1" "January 14, 2019" "shc user manual" "" -.SH NAME -shc \- Generic shell script compiler -.SH SYNOPSIS -\f[B]shc\f[R] [ \-e \f[I]date\f[R] ] [ \-m \f[I]addr\f[R] ] [ \-i -\f[I]iopt\f[R] ] [ \-x \f[I]cmnd\f[R] ] [ \-l \f[I]lopt\f[R] ] [ \-o -\f[I]outfile\f[R] ] [ \-ABCDhUHvSr ] \-f \f[I]script\f[R] -.SH DESCRIPTION -\f[B]shc\f[R] creates a stripped binary executable version of the script -specified with \f[CR]\-f\f[R] on the command line. -.PP -The binary version will get a \f[CR].x\f[R] extension appended by -default if \f[I]outfile\f[R] is not defined with [\-o \f[I]outfile\f[R]] -option and will usually be a bit larger in size than the original ascii -code. -Generated C source code is saved in a file with the extension -\f[CR].x.c\f[R] or in a file specified with appropriate option. -.PP -If you supply an expiration date with the \f[CR]\-e\f[R] option, the -compiled binary will refuse to run after the date specified. -The message \f[B]Please contact your provider\f[R] will be displayed -instead. -This message can be changed with the \f[CR]\-m\f[R] option. -.PP -You can compile any kind of shell script, but you need to supply valid -\f[CR]\-i\f[R], \f[CR]\-x\f[R] and \f[CR]\-l\f[R] options. -.PP -The compiled binary will still be dependent on the shell specified in -the first line of the shell code (i.e.\ \f[CR]#!/bin/sh\f[R]), thus -\f[B]shc\f[R] does not create completely independent binaries. -.PP -\f[B]shc\f[R] itself is not a compiler such as cc, it rather encodes and -encrypts a shell script and generates C source code with the added -expiration capability. -It then uses the system compiler to compile a stripped binary which -behaves exactly like the original script. -Upon execution, the compiled binary will decrypt and execute the code -with the shell \f[CR]\-c\f[R] option. -Unfortunately, it will not give you any speed improvement as a real C -program would. -.PP -\f[B]shc\f[R]\[cq]s main purpose is to protect your shell scripts from -modification or inspection. -You can use it if you wish to distribute your scripts but don\[cq]t want -them to be easily readable by other people. -.SH OPTIONS -.TP -\-e \f[I]date\f[R] -Expiration date in \f[I]dd/mm/yyyy\f[R] format \f[CR][none]\f[R] -.TP -\-m \f[I]message\f[R] -message to display upon expiration -\f[CR][\[dq]Please contact your provider\[dq]]\f[R] -.TP -\-f \f[I]script_name\f[R] -File path of the script to compile -.TP -\-i \f[I]inline_option\f[R] -Inline option for the shell interpreter i.e: \f[CR]\-e\f[R] -.TP -\-x \f[I]command\f[R] -eXec command, as a printf format i.e: -\f[CR]exec(\[rs]\[rs]\[aq]%s\[rs]\[rs]\[aq],\[at]ARGV);\f[R] -.TP -\-l \f[I]last_option\f[R] -Last shell option i.e: \f[CR]\-\-\f[R] -.TP -\-o \f[I]outfile\f[R] -output to the file specified by outfile -.TP -\-r -Relax security. -Make a redistributable binary which executes on different systems -running the same operating system. -You can release your binary with this option for others to use -.TP -\-v -Verbose compilation -.TP -\-S -Switch ON setuid for root callable programs [OFF] -.TP -\-D -Switch on debug exec calls -.TP -\-U -Make binary to be untraceable (using \f[I]strace\f[R], \f[I]ptrace\f[R], -\f[I]truss\f[R], etc.) -.TP -\-H -Hardening. -Extra security flag without root access requirement that protects -against dumping, code injection, \f[CR]cat /proc/pid/cmdline\f[R], -ptrace, etc.. -This feature is \f[B]experimental\f[R] and may not work on all systems. -it requires bourne shell (sh) scripts -.TP -\-C -Display license and exit -.TP -\-A -Display abstract and exit -.TP -\-B -Compile for BusyBox -.TP -\-h -Display help and exit -.SH ENVIRONMENT VARIABLES -.TP -CC -C compiler command \f[CR][cc]\f[R] -.TP -CFLAGS -C compiler flags \f[CR][none]\f[R] -.TP -LDFLAGS -Linker flags \f[CR][none]\f[R] -.SH EXAMPLES -Compile a script which can be run on other systems with the trace option -enabled (without \f[CR]\-U\f[R] flag): -.IP -.EX -shc \-f myscript \-o mybinary -.EE -.PP -Compile an untraceable binary: -.IP -.EX -shc \-Uf myscript \-o mybinary -.EE -.PP -Compile an untraceable binary that doesn\[cq]t require root access -(experimental): -.IP -.EX -shc \-Hf myscript \-o mybinary -.EE -.SH LIMITATIONS -The maximum size of the script that could be executed once compiled is -limited by the operating system configuration parameter -\f[CR]_SC_ARG_MAX\f[R] (see sysconf(2)) -.SH AUTHORS -Francisco Rosales \c -.MT frosal@fi.upm.es -.ME \c -.PP -Md Jahidul Hamid \c -.MT jahidulhamid@yahoo.com -.ME \c -.SH REPORT BUGS TO -https://github.com/neurobin/shc/issues +.\" Automatically generated by Pandoc 2.17.1.1 +.\" +.\" Define V font for inline verbatim, using C font in formats +.\" that render this, and otherwise B font. +.ie "\f[CB]x\f[]"x" \{\ +. ftr V B +. ftr VI BI +. ftr VB B +. ftr VBI BI +.\} +.el \{\ +. ftr V CR +. ftr VI CI +. ftr VB CB +. ftr VBI CBI +.\} +.TH "shc" "1" "January 14, 2019" "shc user manual" "" +.hy +.SH NAME +.PP +shc - Generic shell script compiler +.SH SYNOPSIS +.PP +\f[B]shc\f[R] [ -e \f[I]date\f[R] ] [ -m \f[I]addr\f[R] ] [ -i +\f[I]iopt\f[R] ] [ -x \f[I]cmnd\f[R] ] [ -l \f[I]lopt\f[R] ] [ -o +\f[I]outfile\f[R] ] [ -ABCDhUHvSr ] -f \f[I]script\f[R] +.SH DESCRIPTION +.PP +\f[B]shc\f[R] creates a stripped binary executable version of the script +specified with \f[V]-f\f[R] on the command line. +.PP +The binary version will get a \f[V].x\f[R] extension appended by default +if \f[I]outfile\f[R] is not defined with [-o \f[I]outfile\f[R]] option +and will usually be a bit larger in size than the original ascii code. +Generated C source code is saved in a file with the extension +\f[V].x.c\f[R] or in a file specified with appropriate option. +.PP +If you supply an expiration date with the \f[V]-e\f[R] option, the +compiled binary will refuse to run after the date specified. +The message \f[B]Please contact your provider\f[R] will be displayed +instead. +This message can be changed with the \f[V]-m\f[R] option. +.PP +You can compile any kind of shell script, but you need to supply valid +\f[V]-i\f[R], \f[V]-x\f[R] and \f[V]-l\f[R] options. +.PP +The compiled binary will still be dependent on the shell specified in +the first line of the shell code (i.e.\ \f[V]#!/bin/sh\f[R]), thus +\f[B]shc\f[R] does not create completely independent binaries. +.PP +\f[B]shc\f[R] itself is not a compiler such as cc, it rather encodes and +encrypts a shell script and generates C source code with the added +expiration capability. +It then uses the system compiler to compile a stripped binary which +behaves exactly like the original script. +Upon execution, the compiled binary will decrypt and execute the code +with the shell \f[V]-c\f[R] option. +Unfortunately, it will not give you any speed improvement as a real C +program would. +.PP +\f[B]shc\f[R]\[cq]s main purpose is to protect your shell scripts from +modification or inspection. +You can use it if you wish to distribute your scripts but don\[cq]t want +them to be easily readable by other people. +.SH OPTIONS +.TP +-e \f[I]date\f[R] +Expiration date in \f[I]dd/mm/yyyy\f[R] format \f[V][none]\f[R] +.TP +-m \f[I]message\f[R] +message to display upon expiration +\f[V][\[dq]Please contact your provider\[dq]]\f[R] +.TP +-f \f[I]script_name\f[R] +File path of the script to compile +.TP +-i \f[I]inline_option\f[R] +Inline option for the shell interpreter i.e: \f[V]-e\f[R] +.TP +-x \f[I]command\f[R] +eXec command, as a printf format i.e: +\f[V]exec(\[rs]\[rs]\[aq]%s\[rs]\[rs]\[aq],\[at]ARGV);\f[R] +.TP +-l \f[I]last_option\f[R] +Last shell option i.e: \f[V]--\f[R] +.TP +-o \f[I]outfile\f[R] +output to the file specified by outfile +.TP +-r +Relax security. +Make a redistributable binary which executes on different systems +running the same operating system. +You can release your binary with this option for others to use +.TP +-v +Verbose compilation +.TP +-S +Switch ON setuid for root callable programs [OFF] +.TP +-D +Switch on debug exec calls +.TP +-U +Make binary to be untraceable (using \f[I]strace\f[R], \f[I]ptrace\f[R], +\f[I]truss\f[R], etc.) +.TP +-H +Hardening. +Extra security flag without root access requirement that protects +against dumping, code injection, \f[V]cat /proc/pid/cmdline\f[R], +ptrace, etc.. +This feature is \f[B]experimental\f[R] and may not work on all systems. +it requires bourne shell (sh) scripts +.TP +-C +Display license and exit +.TP +-A +Display abstract and exit +.TP +-B +Compile for BusyBox +.TP +-h +Display help and exit +.SH ENVIRONMENT VARIABLES +.TP +CC +C compiler command \f[V][cc]\f[R] +.TP +CFLAGS +C compiler flags \f[V][none]\f[R] +.TP +LDFLAGS +Linker flags \f[V][none]\f[R] +.SH EXAMPLES +.PP +Compile a script which can be run on other systems with the trace option +enabled (without \f[V]-U\f[R] flag): +.IP +.nf +\f[C] +shc -f myscript -o mybinary +\f[R] +.fi +.PP +Compile an untraceable binary: +.IP +.nf +\f[C] +shc -Uf myscript -o mybinary +\f[R] +.fi +.PP +Compile an untraceable binary that doesn\[cq]t require root access +(experimental): +.IP +.nf +\f[C] +shc -Hf myscript -o mybinary +\f[R] +.fi +.SH LIMITATIONS +.PP +The maximum size of the script that could be executed once compiled is +limited by the operating system configuration parameter +\f[V]_SC_ARG_MAX\f[R] (see sysconf(2)) +.SH AUTHORS +.PP +Francisco Rosales +.PP +Md Jahidul Hamid +.SH REPORT BUGS TO +.PP +https://github.com/neurobin/shc/issues From 684fa070d5e46833bbb662a08483ea05847569f5 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 22:41:26 +0200 Subject: [PATCH 24/83] Fix cpplint/cppcheck --- src/shc.c | 113 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 39 deletions(-) diff --git a/src/shc.c b/src/shc.c index 439f8f6..e5631ca 100644 --- a/src/shc.c +++ b/src/shc.c @@ -780,7 +780,7 @@ static int parse_an_arg(int argc, char * argv[]) my_name, optarg); return -1; } - sprintf(date, "%lld", (long long)expdate); + snprintf(date, sizeof(date), "%lld", (long long)expdate); // NOLINT if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); expdate = atoll(date); if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); @@ -941,8 +941,9 @@ void key(void * str, int len) */ void arc4(void * str, int len) { - unsigned char tmp, * ptr = (unsigned char *)str; + unsigned char * ptr = (unsigned char *)str; while (len > 0) { + unsigned char tmp; indx++; tmp = stte[indx]; jndx += tmp; @@ -1011,6 +1012,7 @@ int eval_shell(char * text) { int i; char * ptr; + char * tmp_realloc; ptr = strchr(text, (int)'\n'); if (!ptr) @@ -1020,12 +1022,17 @@ int eval_shell(char * text) ptr = malloc(i + 1); shll = malloc(i + 1); opts = malloc(i + 1); - if (!ptr || !shll || !opts) + if (!ptr || !shll || !opts) { + ptr && (free(ptr), 1); + shll && (free(shll), 1); + opts && (free(opts), 1); return -1; + } strncpy(ptr, text, i); ptr[i] = '\0'; *opts = '\0'; + // cppcheck-suppress invalidscanf // (required memory checked above) i = sscanf(ptr, " #!%s%s %c", shll, opts, opts); if (i < 1 || i > 2) { fprintf(stderr, "%s: invalid first line in script: %s\n", my_name, ptr); @@ -1034,7 +1041,13 @@ int eval_shell(char * text) } free(ptr); - shll = realloc(shll, strlen(shll) + 1); + tmp_realloc = realloc(shll, strlen(shll) + 1); + if (!tmp_realloc) { + fprintf(stderr, "%s: Realloc issue\n", my_name); + free(shll); + return -1; + } + shll = tmp_realloc; ptr = strrchr(shll, (int)'/'); if (!ptr) { fprintf(stderr, "%s: invalid shll\n", my_name); @@ -1042,7 +1055,7 @@ int eval_shell(char * text) } if (*ptr == '/') ptr++; - if (verbose) fprintf(stderr, "%s shll=%s\n", my_name, ptr); + if (verbose) fprintf(stderr, "%s: shll=%s\n", my_name, ptr); for(i=0; shellsDB[i].shll; i++) { if(!strcmp(ptr, shellsDB[i].shll)) { @@ -1062,7 +1075,12 @@ int eval_shell(char * text) if (verbose) fprintf(stderr, "%s [-x]=%s\n", my_name, xecc); if (verbose) fprintf(stderr, "%s [-l]=%s\n", my_name, lsto); - opts = realloc(opts, strlen(opts) + 1); + tmp_realloc = realloc(opts, strlen(opts) + 1); + if (!tmp_realloc) { + free(opts); + return -1; + } + opts = tmp_realloc; if (*opts && !strcmp(opts, lsto)) { fprintf(stderr, "%s opts=%s : Is equal to [-l]. Removing opts\n", my_name, opts); *opts = '\0'; @@ -1077,29 +1095,39 @@ int eval_shell(char * text) char * read_script(char * file) { FILE * i; - char * text; + char * l_text; + char * tmp_realloc; int cnt, l; - text = malloc(SIZE); - if (!text) + l_text = malloc(SIZE); + if (!l_text) return NULL; i = fopen(file, "r"); - if (!i) + if (!i) { + free(l_text); return NULL; + } for (l = 0;;) { - text = realloc(text, l + SIZE); - if (!text) + tmp_realloc = realloc(l_text, l + SIZE); + if (!tmp_realloc) { + free (l_text); + fclose(i); return NULL; - cnt = fread(&text[l], 1, SIZE, i); + } + l_text = tmp_realloc; + cnt = fread(&l_text[l], 1, SIZE, i); if (!cnt) break; l += cnt; } fclose(i); - text = realloc(text, l + 1); - if (!text) + tmp_realloc = realloc(l_text, l + 1); + if (!tmp_realloc) { + free (l_text); return NULL; - text[l] = '\0'; + } + l_text = tmp_realloc; + l_text[l] = '\0'; /* Check current System ARG_MAX limit. */ if (l > 0.80 * (cnt = sysconf(_SC_ARG_MAX))) { @@ -1110,7 +1138,7 @@ char * read_script(char * file) " and your script \"%s\" is %d bytes length.\n", my_name, cnt, file, l); } - return text; + return l_text; } unsigned rand_mod(unsigned mod) @@ -1118,7 +1146,7 @@ unsigned rand_mod(unsigned mod) /* Without skew */ unsigned rnd, top = RAND_MAX; top -= top % mod; - while (top <= (rnd = rand())) + while (top <= (rnd = rand())) // NOLINT continue; /* Using high-order bits. */ rnd = 1.0*mod*rnd/(1.0+top); @@ -1135,9 +1163,9 @@ int noise(char * ptr, unsigned min, unsigned xtra, int str) if (xtra) xtra = rand_mod(xtra); xtra += min; for (min = 0; min < xtra; min++, ptr++) - do + do { *ptr = rand_chr(); - while (str && !isalnum((int)*ptr)); + } while (str && !isalnum((int)*ptr)); if (str) *ptr = '\0'; return xtra; } @@ -1166,7 +1194,7 @@ void prnt_array(FILE * o, void * ptr, char * name, int l, char * cast) { int m = rand_mod(1+l/4); /* Random amount of random pre padding (offset) */ int n = rand_mod(1+l/4); /* Random amount of random post padding (tail) */ - int a = (offset+m)%l; + int a = l?(offset+m)%l:0; if (cast && a) m += l - a; /* Type alignment. */ fprintf(o, "\n"); fprintf(o, "#define %s_z %d", name, l); @@ -1220,7 +1248,7 @@ int write_C(char * file, char * argv[]) int chk2_z = tst2_z; char* name = strdup(file); FILE * o; - int indx; + int l_idx; int numd = 0; int done = 0; @@ -1230,7 +1258,8 @@ int write_C(char * file, char * argv[]) stte_0(); key(pswd, pswd_z); msg1_z += strlen(mail); - msg1 = strcat(realloc(msg1, msg1_z), mail); + // cppcheck-suppress invalidFunctionArg // msg1_z is positive + msg1 = strcat(realloc(msg1, msg1_z), mail); // NOLINT arc4(msg1, msg1_z); numd++; arc4(date, date_z); numd++; arc4(shll, shll_z); numd++; @@ -1241,9 +1270,9 @@ int write_C(char * file, char * argv[]) key(chk1, chk1_z); arc4(chk1, chk1_z); numd++; arc4(msg2, msg2_z); numd++; - indx = !rlax[0]; + l_idx = !rlax[0]; arc4(rlax, rlax_z); numd++; - if (indx && key_with_file(kwsh)) { + if (l_idx && key_with_file(kwsh)) { fprintf(stderr, "%s: invalid file name: %s ", my_name, kwsh); perror(""); cleanup_write_c(msg1, msg2, chk1, chk2, tst1, tst2, kwsh, name); @@ -1256,7 +1285,7 @@ int write_C(char * file, char * argv[]) arc4(chk2, chk2_z); numd++; /* Output */ - name = strcat(realloc(name, strlen(name)+5), ".x.c"); + name = strcat(realloc(name, strlen(name)+5), ".x.c"); // NOLINT o = fopen(name, "w"); if (!o) { fprintf(stderr, "%s: creating output file: %s ", my_name, name); @@ -1267,15 +1296,15 @@ int write_C(char * file, char * argv[]) fprintf(o, "#if 0\n"); fprintf(o, "\t%s %s, %s\n", my_name, version, subject); fprintf(o, "\t%s %s %s %s\n\n\t", cpright, provider.f, provider.s, provider.e); - for (indx = 0; argv[indx]; indx++) - fprintf(o, "%s ", argv[indx]); + for (l_idx = 0; argv[l_idx]; l_idx++) + fprintf(o, "%s ", argv[l_idx]); fprintf(o, "\n#endif\n\n"); fprintf(o, "static char data [] = "); do { done = 0; - indx = rand_mod(15); + l_idx = rand_mod(15); do { - switch (indx) { + switch (l_idx) { case 0: if (pswd_z>=0) {prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z=done=-1; break;} case 1: if (msg1_z>=0) {prnt_array(o, msg1, "msg1", msg1_z, 0); msg1_z=done=-1; break;} case 2: if (date_z>=0) {prnt_array(o, date, "date", date_z, 0); date_z=done=-1; break;} @@ -1292,7 +1321,7 @@ int write_C(char * file, char * argv[]) case 13: if (tst2_z>=0) {prnt_array(o, tst2, "tst2", tst2_z, 0); tst2_z=done=-1; break;} case 14: if (chk2_z>=0) {prnt_array(o, chk2, "chk2", chk2_z, 0); chk2_z=done=-1; break;} } - indx = 0; + l_idx = 0; } while (!done); } while (numd+=done); cleanup_write_c(msg1, msg2, chk1, chk2, tst1, tst2, kwsh, name); @@ -1304,8 +1333,8 @@ int write_C(char * file, char * argv[]) fprintf(o, HARDENING_line, HARDENING_flag); fprintf(o, BUSYBOXON_line, BUSYBOXON_flag); fprintf(o, MMAP2_line, MMAP2_flag); - for (indx = 0; RTC[indx]; indx++) - fprintf(o, "%s\n", RTC[indx]); + for (l_idx = 0; RTC[l_idx]; l_idx++) + fprintf(o, "%s\n", RTC[l_idx]); fflush(o); fclose(o); @@ -1328,23 +1357,29 @@ int make(void) ldflags = ""; if(!file2){ -file2=(char*)realloc(file2,strlen(file)+3); -strcpy(file2,file); -file2=strcat(file2,".x"); +char * tmp_realloc; +tmp_realloc=(char*)realloc(file2,strlen(file)+3); +if (!tmp_realloc) { + free(file2); + return -1; +} +file2=tmp_realloc; +strcpy(file2,file); // NOLINT +file2=strcat(file2,".x"); // NOLINT } - sprintf(cmd, "%s %s %s \'%s.x.c\' -o %s", cc, cflags, ldflags, file, file2); + snprintf(cmd, SIZE, "%s %s %s \'%s.x.c\' -o %s", cc, cflags, ldflags, file, file2); if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); if (system(cmd)) return -1; char* strip = getenv("STRIP"); if (!strip) strip = "strip"; - sprintf(cmd, "%s %s", strip, file2); + snprintf(cmd, SIZE, "%s %s", strip, file2); if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); if (system(cmd)) fprintf(stderr, "%s: never mind\n", my_name); - sprintf(cmd, "chmod ug=rwx,o=rx %s", file2); + snprintf(cmd, SIZE, "chmod ug=rwx,o=rx %s", file2); if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); if (system(cmd)) fprintf(stderr, "%s: remove read permission\n", my_name); From ab1b51deee284f947f97c596d0e899baf1eb3198 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 22:41:55 +0200 Subject: [PATCH 25/83] Do test with sanitize on --- .github/workflows/ci.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9bf787..07c0f67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,9 +13,34 @@ jobs: - name: Install dependencies run: sudo apt-get update -q && sudo apt install -y dash bash ksh zsh tcsh csh rc - - name: Build and Test + - name: Build and Test (with sanitize) run: | + SANITIZE="${SANITIZE} -fsanitize=address" + #SANITIZE="${SANITIZE} -fsanitize=thread" + SANITIZE="${SANITIZE} -fsanitize=leak" + SANITIZE="${SANITIZE} -fsanitize=undefined" + SANITIZE="${SANITIZE} -fsanitize=integer-divide-by-zero" + # SANITIZE="${SANITIZE} -fsanitize=vla-bound" + SANITIZE="${SANITIZE} -fsanitize=null" + SANITIZE="${SANITIZE} -fsanitize=signed-integer-overflow" + SANITIZE="${SANITIZE} -fsanitize=bounds" + #SANITIZE="${SANITIZE} -fsanitize=bounds-strict" + SANITIZE="${SANITIZE} -fsanitize=bool" + SANITIZE="${SANITIZE} -fsanitize=enum" + SANITIZE="${SANITIZE} -fsanitize-recover" # will try to continue running the program + #SANITIZE_LINK="-static-libasan -static -lasan -static -lubsan -ldl -lm" + SANITIZE_LINK="-l:libasan.a -l:libubsan.a -ldl -lm" + SANITIZE="${SANITIZE} -fno-sanitize=alignment" ./autogen.sh ./configure + make clean + make CFLAGS="${SANITIZE} -g -O2" LDFLAGS="${SANITIZE_LINK}" + make CC=gcc CFLAGS="${SANITIZE} -g -O2" LDFLAGS="${SANITIZE_LINK}" test + + - name: Build and Test (Normal) + run: | + ./autogen.sh + ./configure + make clean make make test From a984badcc758244e7a0f08cb1a81303226686d2e Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 22:41:55 +0200 Subject: [PATCH 26/83] Do test with sanitize on --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..07c0f67 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apt-get update -q && sudo apt install -y dash bash ksh zsh tcsh csh rc + + - name: Build and Test (with sanitize) + run: | + SANITIZE="${SANITIZE} -fsanitize=address" + #SANITIZE="${SANITIZE} -fsanitize=thread" + SANITIZE="${SANITIZE} -fsanitize=leak" + SANITIZE="${SANITIZE} -fsanitize=undefined" + SANITIZE="${SANITIZE} -fsanitize=integer-divide-by-zero" + # SANITIZE="${SANITIZE} -fsanitize=vla-bound" + SANITIZE="${SANITIZE} -fsanitize=null" + SANITIZE="${SANITIZE} -fsanitize=signed-integer-overflow" + SANITIZE="${SANITIZE} -fsanitize=bounds" + #SANITIZE="${SANITIZE} -fsanitize=bounds-strict" + SANITIZE="${SANITIZE} -fsanitize=bool" + SANITIZE="${SANITIZE} -fsanitize=enum" + SANITIZE="${SANITIZE} -fsanitize-recover" # will try to continue running the program + #SANITIZE_LINK="-static-libasan -static -lasan -static -lubsan -ldl -lm" + SANITIZE_LINK="-l:libasan.a -l:libubsan.a -ldl -lm" + SANITIZE="${SANITIZE} -fno-sanitize=alignment" + ./autogen.sh + ./configure + make clean + make CFLAGS="${SANITIZE} -g -O2" LDFLAGS="${SANITIZE_LINK}" + make CC=gcc CFLAGS="${SANITIZE} -g -O2" LDFLAGS="${SANITIZE_LINK}" test + + - name: Build and Test (Normal) + run: | + ./autogen.sh + ./configure + make clean + make + make test From f9da88e99ee836de7ca35b088271f88c30fbc137 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 22:58:06 +0200 Subject: [PATCH 27/83] Also ignore Makefile.am for file formatting --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fe468c0..38a4449 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,6 +5,7 @@ exclude: configure\..*| .cache/.*| .*Makefile.in| + .*Makefile.am| autogen.sh| config/install-sh| config/depcomp| From 52b7f6b0254c940b0f384bd3474a8292d16eb8a7 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 23:03:29 +0200 Subject: [PATCH 28/83] Sanitizer: stop the program when a leak is detected --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07c0f67..01eba61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: #SANITIZE="${SANITIZE} -fsanitize=bounds-strict" SANITIZE="${SANITIZE} -fsanitize=bool" SANITIZE="${SANITIZE} -fsanitize=enum" - SANITIZE="${SANITIZE} -fsanitize-recover" # will try to continue running the program + #SANITIZE="${SANITIZE} -fsanitize-recover" # will try to continue running the program #SANITIZE_LINK="-static-libasan -static -lasan -static -lubsan -ldl -lm" SANITIZE_LINK="-l:libasan.a -l:libubsan.a -ldl -lm" SANITIZE="${SANITIZE} -fno-sanitize=alignment" From be20a386c28d06837cf4f4fa2842d5afa8f95282 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 11 Aug 2024 23:40:57 +0200 Subject: [PATCH 29/83] Avoid warning about not using the return value of setuid --- src/shc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shc.c b/src/shc.c index e5631ca..1c46d92 100644 --- a/src/shc.c +++ b/src/shc.c @@ -735,7 +735,7 @@ static const char * RTC[] = { "int main(int argc, char ** argv)", "{", "#if SETUID", -" setuid(0);", +" (void) setuid(0);", "#endif", "#if DEBUGEXEC", " debugexec(\"main\", argc, argv);", From 7be5e33fb7d3a2d267884a19293053b3f5c4053c Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 12 Aug 2024 00:10:37 +0200 Subject: [PATCH 30/83] Upgrade pandoc workflow --- .github/workflows/generate.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 2d89ffc..bf65d7e 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -6,9 +6,9 @@ on: workflow_dispatch: jobs: convert_via_pandoc: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dorny/paths-filter@v2 id: changes with: @@ -18,11 +18,11 @@ jobs: autotools: - 'aclocal.m4' - 'configure.ac' - - uses: docker://pandoc/core:2.17 + - uses: docker://pandoc/core:3.3 if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' }} with: args: -s man.md -t man -o shc.1 - - uses: docker://pandoc/core:2.17 + - uses: docker://pandoc/core:3.3 if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' }} with: args: -s man.md -t html -o man.html From c61eb85f201670e84a69f79cddf33bb8f59d3ddb Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 11 Aug 2024 22:11:26 +0000 Subject: [PATCH 31/83] ci: Github Action Generate Files --- INSTALL | 0 Makefile.in | 47 +- aclocal.m4 | 79 +- config/compile | 6 +- config/depcomp | 2 +- config/install-sh | 161 ++- config/missing | 2 +- configure | 3476 ++++++++++++++++++++++++--------------------- man.html | 43 +- shc.1 | 143 +- src/Makefile.in | 24 +- 11 files changed, 2135 insertions(+), 1848 deletions(-) mode change 100644 => 100755 INSTALL diff --git a/INSTALL b/INSTALL old mode 100644 new mode 100755 diff --git a/Makefile.in b/Makefile.in index 5a6b6ef..b3721bb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -85,6 +85,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac @@ -180,15 +182,14 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \ - $(top_srcdir)/config/compile $(top_srcdir)/config/install-sh \ - $(top_srcdir)/config/missing AUTHORS COPYING ChangeLog INSTALL \ - NEWS README config/compile config/depcomp config/install-sh \ - config/missing + $(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \ + $(top_srcdir)/config/config.sub \ + $(top_srcdir)/config/install-sh $(top_srcdir)/config/missing \ + AUTHORS COPYING ChangeLog INSTALL NEWS README config/compile \ + config/config.guess config/config.sub config/depcomp \ + config/install-sh config/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -227,6 +228,8 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -241,17 +244,17 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -287,14 +290,22 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ +build = @build@ build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +host = @host@ host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ @@ -310,6 +321,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -508,7 +520,6 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -592,6 +603,10 @@ dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -634,6 +649,8 @@ distcheck: dist eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -649,7 +666,7 @@ distcheck: dist $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -815,7 +832,7 @@ uninstall-man: uninstall-man1 am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-generic distclean-tags \ + dist-zstd distcheck distclean distclean-generic distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ diff --git a/aclocal.m4 b/aclocal.m4 index 8c6b78f..2154e6d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,13 +14,13 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.1], [], +m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.1])dnl +[AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -371,7 +371,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi @@ -398,7 +400,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -426,6 +428,10 @@ m4_defn([AC_PROG_CC]) # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -462,7 +468,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl @@ -514,6 +520,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This @@ -595,7 +615,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -616,7 +636,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -637,7 +657,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -680,7 +700,7 @@ AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -701,12 +721,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -719,7 +734,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -748,7 +763,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -795,7 +810,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -814,7 +829,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -895,7 +910,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -955,7 +970,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -983,7 +998,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1002,7 +1017,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2018 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/config/compile b/config/compile index 99e5052..df363c8 100755 --- a/config/compile +++ b/config/compile @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) diff --git a/config/depcomp b/config/depcomp index 65cbf70..715e343 100755 --- a/config/depcomp +++ b/config/depcomp @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/config/install-sh b/config/install-sh index 8175c64..ec298b5 100755 --- a/config/install-sh +++ b/config/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2018-03-11.20; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ posix_mkdir= # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ Options: --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ while test $# -ne 0; do -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ do dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -301,22 +325,6 @@ do if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -326,52 +334,49 @@ do fi posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # Note that $RANDOM variable is not portable (e.g. dash); Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p' feature. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; esac if @@ -382,7 +387,7 @@ do then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. @@ -411,7 +416,7 @@ do prefixes= else if $posix_mkdir; then - (umask=$mkdir_umask && + (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 @@ -451,7 +456,18 @@ do trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -477,6 +493,13 @@ do then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -491,9 +514,9 @@ do # file should still install successfully. { test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || + $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 diff --git a/config/missing b/config/missing index 625aeb1..1fe1611 100755 --- a/config/missing +++ b/config/missing @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify diff --git a/configure b/configure index 6b60fa7..11dcba6 100755 --- a/configure +++ b/configure @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for shc 4.0.3. +# Generated by GNU Autoconf 2.71 for shc 4.0.3. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,42 +169,52 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -230,14 +222,21 @@ fi esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -255,18 +254,19 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: http://github.com/neurobin/shc/issues about your $0: system, including any error possibly output before this $0: message. Then install a modern shell, or manually run @@ -294,6 +294,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -311,6 +312,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -325,7 +334,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -334,7 +343,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -373,12 +382,13 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -390,18 +400,27 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -413,9 +432,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -442,7 +461,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -486,7 +505,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -500,6 +519,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -513,6 +536,13 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -588,49 +618,49 @@ PACKAGE_URL='' ac_unique_file="src/shc.c" # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" -ac_header_list= -ac_func_list= +ac_header_c_list= +ac_func_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS -EGREP -GREP -CPP +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -651,6 +681,9 @@ AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +CSCOPE +ETAGS +CTAGS am__untar am__tar AMTAR @@ -693,6 +726,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -726,8 +760,7 @@ CC CFLAGS LDFLAGS LIBS -CPPFLAGS -CPP' +CPPFLAGS' # Initialize some variables set by options. @@ -766,6 +799,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -795,8 +829,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -837,9 +869,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -863,9 +895,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1018,6 +1050,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1067,9 +1108,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1083,9 +1124,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1129,9 +1170,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1147,7 +1188,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1155,7 +1196,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1211,7 +1252,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1308,6 +1349,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1329,6 +1371,10 @@ Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi @@ -1357,7 +1403,6 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1378,9 +1423,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1408,7 +1453,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1416,7 +1462,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1426,9 +1472,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF shc configure 4.0.3 -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1445,14 +1491,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1460,14 +1506,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1477,176 +1524,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------------------------- ## -## Report this to http://github.com/neurobin/shc/issues ## -## ---------------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1654,26 +1531,28 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1685,16 +1564,17 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +printf %s "checking for $2.$3... " >&6; } +if eval test \${$4+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main () +main (void) { static $2 ac_aggr; if (ac_aggr.$3) @@ -1703,14 +1583,15 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$4=yes" -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main () +main (void) { static $2 ac_aggr; if (sizeof ac_aggr.$3) @@ -1719,36 +1600,80 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$4=yes" -else +else $as_nop eval "$4=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1756,17 +1681,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1787,11 +1713,12 @@ fi ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -1799,16 +1726,9 @@ else #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -1826,35 +1746,56 @@ choke me #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by shc $as_me 4.0.3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -1887,8 +1828,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -1923,7 +1868,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -1958,11 +1903,13 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -1973,8 +1920,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -1998,7 +1945,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2006,14 +1953,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2021,15 +1968,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2037,8 +1984,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2052,63 +1999,48 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2118,64 +2050,478 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -as_fn_append ac_header_list " sys/time.h" -as_fn_append ac_header_list " unistd.h" -as_fn_append ac_func_list " alarm" -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H" +as_fn_append ac_func_c_list " alarm HAVE_ALARM" + +# Auxiliary files required by this configure script. +ac_aux_files="config.guess config.sub compile missing install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/config" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -2185,11 +2531,12 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2202,34 +2549,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_aux_dir= -for ac_dir in config "$srcdir"/config; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - #prefix="/usr" @@ -2237,7 +2556,9 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.16' -# Find a good install program. We prefer a C program (faster), + + + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install @@ -2251,20 +2572,25 @@ am__api_version='1.16' # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -2274,13 +2600,13 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -2288,12 +2614,12 @@ case $as_dir/ in #(( echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -2309,7 +2635,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test "${ac_cv_path_install+set}" = set; then + if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -2319,8 +2645,8 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -2330,8 +2656,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -2385,8 +2711,8 @@ else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= @@ -2405,26 +2731,23 @@ test "$program_suffix" != NONE && # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then @@ -2444,11 +2767,12 @@ if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -2456,11 +2780,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2471,11 +2799,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2484,11 +2812,12 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -2496,11 +2825,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2511,11 +2844,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -2523,8 +2856,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -2536,25 +2869,31 @@ fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done @@ -2565,7 +2904,7 @@ IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then + if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a @@ -2575,18 +2914,19 @@ fi MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -2594,11 +2934,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2609,24 +2953,25 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -2642,12 +2987,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2661,7 +3006,8 @@ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -2671,12 +3017,13 @@ case $enable_silent_rules in # ((( *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -2688,8 +3035,8 @@ else am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -2724,14 +3071,10 @@ fi VERSION='4.0.3' -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. @@ -2771,6 +3114,20 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -2816,6 +3173,15 @@ fi # Checks for programs. + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2824,11 +3190,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2836,11 +3203,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2851,11 +3222,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2864,11 +3235,12 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2876,11 +3248,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2891,11 +3267,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -2903,8 +3279,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2917,11 +3293,12 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2929,11 +3306,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2944,11 +3325,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2957,11 +3338,12 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2970,15 +3352,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2994,18 +3380,18 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3016,11 +3402,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3028,11 +3415,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3043,11 +3434,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3060,11 +3451,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3072,11 +3464,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3087,11 +3483,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3103,34 +3499,138 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi +else + CC="$ac_cv_prog_CC" fi fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3140,7 +3640,7 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -3148,7 +3648,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3160,9 +3660,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -3183,11 +3683,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -3204,7 +3705,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -3220,44 +3721,46 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -3271,15 +3774,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -3288,7 +3791,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -3300,8 +3803,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -3309,10 +3812,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -3320,39 +3823,40 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3366,11 +3870,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -3379,31 +3884,32 @@ $as_echo "$ac_try_echo"; } >&5 break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -3413,29 +3919,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -3444,57 +3954,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -3509,94 +4022,144 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -3605,21 +4168,23 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_ext=c + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3647,8 +4212,8 @@ _ACEOF rm -f core conftest* unset am_i fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. @@ -3667,8 +4232,8 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out @@ -3704,11 +4269,12 @@ esac fi done rm -f confinc.* confmf.* -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -$as_echo "${_am_result}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : +if test ${enable_dependency_tracking+y} +then : enableval=$enable_dependency_tracking; fi @@ -3729,11 +4295,12 @@ fi depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -3805,525 +4372,240 @@ else # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - - -# Checks for libraries. - -# Checks for header files. - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi + cd .. + rm -rf conftest.dir else - ac_cv_path_GREP=$GREP + am_cv_CC_dependencies_compiler_type=none fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' else - ac_cv_path_EGREP=$EGREP + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -int -main () -{ +# Checks for libraries. - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Checks for header files. -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : -else - ac_cv_header_stdc=no -fi -rm -f conftest* -fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : -else - ac_cv_header_stdc=no -fi -rm -f conftest* -fi -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext fi +ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" +if test "x$ac_cv_header_fcntl_h" = xyes +then : + printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes +then : + printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes +then : + printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h fi - -done - - -for ac_header in fcntl.h stdlib.h string.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" +if test "x$ac_cv_header_unistd_h" = xyes +then : + printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h fi -done - # Checks for typedefs, structures, and compiler characteristics. ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_rdev" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_RDEV 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_RDEV 1" >>confdefs.h fi # Checks for library functions. -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi -done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if ${ac_cv_func_malloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_malloc_0_nonnull=no -else + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +printf %s "checking for GNU libc compatible malloc... " >&6; } +if test ${ac_cv_func_malloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_malloc_0_nonnull=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_malloc_0_nonnull=no ;; + esac +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif +#include int -main () +main (void) { -return ! malloc (0); +void *p = malloc (0); + int result = !p; + free (p); + return result; ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_malloc_0_nonnull=yes -else +else $as_nop ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -4331,14 +4613,15 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes +then : -$as_echo "#define HAVE_MALLOC 1" >>confdefs.h +printf "%s\n" "#define HAVE_MALLOC 1" >>confdefs.h -else - $as_echo "#define HAVE_MALLOC 0" >>confdefs.h +else $as_nop + printf "%s\n" "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; @@ -4347,106 +4630,43 @@ else esac -$as_echo "#define malloc rpl_malloc" >>confdefs.h - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - -fi - - - - - for ac_header in $ac_header_list -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +printf "%s\n" "#define malloc rpl_malloc" >>confdefs.h fi -done - - - - - - - for ac_func in $ac_func_list -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi +ac_func= +for ac_item in $ac_func_c_list +do + if test $ac_func; then + ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func + if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then + echo "#define $ac_item 1" >> confdefs.h + fi + ac_func= + else + ac_func=$ac_item + fi done - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mktime" >&5 -$as_echo_n "checking for working mktime... " >&6; } -if ${ac_cv_func_working_mktime+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working mktime" >&5 +printf %s "checking for working mktime... " >&6; } +if test ${ac_cv_func_working_mktime+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_func_working_mktime=no -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Test program from Paul Eggert and Tony Leneis. */ -#ifdef TIME_WITH_SYS_TIME +#include +#ifdef HAVE_SYS_TIME_H # include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif #endif #include @@ -4585,7 +4805,7 @@ year_2050_test () } int -main () +main (void) { time_t t, delta; int i, j; @@ -4629,9 +4849,10 @@ main () return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_working_mktime=yes -else +else $as_nop ac_cv_func_working_mktime=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -4639,8 +4860,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_working_mktime" >&5 -$as_echo "$ac_cv_func_working_mktime" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_working_mktime" >&5 +printf "%s\n" "$ac_cv_func_working_mktime" >&6; } if test $ac_cv_func_working_mktime = no; then case " $LIBOBJS " in *" mktime.$ac_objext "* ) ;; @@ -4650,45 +4871,42 @@ esac fi -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 -$as_echo_n "checking for GNU libc compatible realloc... " >&6; } -if ${ac_cv_func_realloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_realloc_0_nonnull=no -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 +printf %s "checking for GNU libc compatible realloc... " >&6; } +if test ${ac_cv_func_realloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_realloc_0_nonnull=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_realloc_0_nonnull=no ;; + esac +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *realloc (); -#endif +#include int -main () +main (void) { -return ! realloc (0, 0); +void *p = realloc (0, 0); + int result = !p; + free (p); + return result; ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_realloc_0_nonnull=yes -else +else $as_nop ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -4696,14 +4914,15 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } -if test $ac_cv_func_realloc_0_nonnull = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_realloc_0_nonnull" >&6; } +if test $ac_cv_func_realloc_0_nonnull = yes +then : -$as_echo "#define HAVE_REALLOC 1" >>confdefs.h +printf "%s\n" "#define HAVE_REALLOC 1" >>confdefs.h -else - $as_echo "#define HAVE_REALLOC 0" >>confdefs.h +else $as_nop + printf "%s\n" "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; @@ -4712,22 +4931,41 @@ else esac -$as_echo "#define realloc rpl_realloc" >>confdefs.h +printf "%s\n" "#define realloc rpl_realloc" >>confdefs.h fi -for ac_func in memset putenv strchr strdup strrchr -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" +if test "x$ac_cv_func_memset" = xyes +then : + printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "putenv" "ac_cv_func_putenv" +if test "x$ac_cv_func_putenv" = xyes +then : + printf "%s\n" "#define HAVE_PUTENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" +if test "x$ac_cv_func_strchr" = xyes +then : + printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" +if test "x$ac_cv_func_strdup" = xyes +then : + printf "%s\n" "#define HAVE_STRDUP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strrchr" "ac_cv_func_strrchr" +if test "x$ac_cv_func_strrchr" = xyes +then : + printf "%s\n" "#define HAVE_STRRCHR 1" >>confdefs.h fi -done @@ -4760,8 +4998,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -4791,15 +5029,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -4813,8 +5051,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -4867,7 +5105,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -4878,14 +5116,14 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -4907,8 +5145,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -4931,14 +5169,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -4948,46 +5188,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -4996,13 +5236,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -5011,8 +5244,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -5024,30 +5261,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -5060,13 +5277,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -5093,18 +5311,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -5116,12 +5336,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -5152,7 +5373,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -5174,6 +5395,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -5187,6 +5412,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -5228,7 +5459,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -5237,7 +5468,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5300,7 +5531,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by shc $as_me 4.0.3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5353,14 +5584,16 @@ $config_commands Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ shc config.status 4.0.3 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -5400,21 +5633,21 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -5442,7 +5675,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -5456,7 +5689,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -5488,8 +5721,8 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -5717,7 +5950,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -5725,17 +5958,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -5752,7 +5985,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5776,9 +6009,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -5840,8 +6073,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -5885,9 +6118,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -5899,8 +6132,8 @@ which seems to be undefined. Please make sure it is defined" >&2;} ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -5926,7 +6159,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -5938,7 +6171,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5960,7 +6193,7 @@ $as_echo X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -5985,10 +6218,12 @@ $as_echo X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -6034,7 +6269,8 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + diff --git a/man.html b/man.html index 3a2a430..ac3610d 100644 --- a/man.html +++ b/man.html @@ -9,9 +9,6 @@ shc(1) shc user manual -
diff --git a/shc.1 b/shc.1 index 6184e94..480ba5e 100644 --- a/shc.1 +++ b/shc.1 @@ -1,51 +1,34 @@ -.\" Automatically generated by Pandoc 2.17.1.1 +.\" Automatically generated by Pandoc 3.3 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} -.TH "shc" "1" "January 14, 2019" "shc user manual" "" -.hy +.TH "shc" "1" "January 14, 2019" "shc user manual" .SH NAME -.PP -shc - Generic shell script compiler +shc \- Generic shell script compiler .SH SYNOPSIS -.PP -\f[B]shc\f[R] [ -e \f[I]date\f[R] ] [ -m \f[I]addr\f[R] ] [ -i -\f[I]iopt\f[R] ] [ -x \f[I]cmnd\f[R] ] [ -l \f[I]lopt\f[R] ] [ -o -\f[I]outfile\f[R] ] [ -ABCDhUHvSr ] -f \f[I]script\f[R] +\f[B]shc\f[R] [ \-e \f[I]date\f[R] ] [ \-m \f[I]addr\f[R] ] [ \-i +\f[I]iopt\f[R] ] [ \-x \f[I]cmnd\f[R] ] [ \-l \f[I]lopt\f[R] ] [ \-o +\f[I]outfile\f[R] ] [ \-ABCDhUHvSr ] \-f \f[I]script\f[R] .SH DESCRIPTION -.PP \f[B]shc\f[R] creates a stripped binary executable version of the script -specified with \f[V]-f\f[R] on the command line. +specified with \f[CR]\-f\f[R] on the command line. .PP -The binary version will get a \f[V].x\f[R] extension appended by default -if \f[I]outfile\f[R] is not defined with [-o \f[I]outfile\f[R]] option -and will usually be a bit larger in size than the original ascii code. +The binary version will get a \f[CR].x\f[R] extension appended by +default if \f[I]outfile\f[R] is not defined with [\-o \f[I]outfile\f[R]] +option and will usually be a bit larger in size than the original ascii +code. Generated C source code is saved in a file with the extension -\f[V].x.c\f[R] or in a file specified with appropriate option. +\f[CR].x.c\f[R] or in a file specified with appropriate option. .PP -If you supply an expiration date with the \f[V]-e\f[R] option, the +If you supply an expiration date with the \f[CR]\-e\f[R] option, the compiled binary will refuse to run after the date specified. The message \f[B]Please contact your provider\f[R] will be displayed instead. -This message can be changed with the \f[V]-m\f[R] option. +This message can be changed with the \f[CR]\-m\f[R] option. .PP You can compile any kind of shell script, but you need to supply valid -\f[V]-i\f[R], \f[V]-x\f[R] and \f[V]-l\f[R] options. +\f[CR]\-i\f[R], \f[CR]\-x\f[R] and \f[CR]\-l\f[R] options. .PP The compiled binary will still be dependent on the shell specified in -the first line of the shell code (i.e.\ \f[V]#!/bin/sh\f[R]), thus +the first line of the shell code (i.e.\ \f[CR]#!/bin/sh\f[R]), thus \f[B]shc\f[R] does not create completely independent binaries. .PP \f[B]shc\f[R] itself is not a compiler such as cc, it rather encodes and @@ -54,7 +37,7 @@ expiration capability. It then uses the system compiler to compile a stripped binary which behaves exactly like the original script. Upon execution, the compiled binary will decrypt and execute the code -with the shell \f[V]-c\f[R] option. +with the shell \f[CR]\-c\f[R] option. Unfortunately, it will not give you any speed improvement as a real C program would. .PP @@ -64,114 +47,108 @@ You can use it if you wish to distribute your scripts but don\[cq]t want them to be easily readable by other people. .SH OPTIONS .TP --e \f[I]date\f[R] -Expiration date in \f[I]dd/mm/yyyy\f[R] format \f[V][none]\f[R] +\-e \f[I]date\f[R] +Expiration date in \f[I]dd/mm/yyyy\f[R] format \f[CR][none]\f[R] .TP --m \f[I]message\f[R] +\-m \f[I]message\f[R] message to display upon expiration -\f[V][\[dq]Please contact your provider\[dq]]\f[R] +\f[CR][\[dq]Please contact your provider\[dq]]\f[R] .TP --f \f[I]script_name\f[R] +\-f \f[I]script_name\f[R] File path of the script to compile .TP --i \f[I]inline_option\f[R] -Inline option for the shell interpreter i.e: \f[V]-e\f[R] +\-i \f[I]inline_option\f[R] +Inline option for the shell interpreter i.e: \f[CR]\-e\f[R] .TP --x \f[I]command\f[R] +\-x \f[I]command\f[R] eXec command, as a printf format i.e: -\f[V]exec(\[rs]\[rs]\[aq]%s\[rs]\[rs]\[aq],\[at]ARGV);\f[R] +\f[CR]exec(\[rs]\[rs]\[aq]%s\[rs]\[rs]\[aq],\[at]ARGV);\f[R] .TP --l \f[I]last_option\f[R] -Last shell option i.e: \f[V]--\f[R] +\-l \f[I]last_option\f[R] +Last shell option i.e: \f[CR]\-\-\f[R] .TP --o \f[I]outfile\f[R] +\-o \f[I]outfile\f[R] output to the file specified by outfile .TP --r +\-r Relax security. Make a redistributable binary which executes on different systems running the same operating system. You can release your binary with this option for others to use .TP --v +\-v Verbose compilation .TP --S +\-S Switch ON setuid for root callable programs [OFF] .TP --D +\-D Switch on debug exec calls .TP --U +\-U Make binary to be untraceable (using \f[I]strace\f[R], \f[I]ptrace\f[R], \f[I]truss\f[R], etc.) .TP --H +\-H Hardening. Extra security flag without root access requirement that protects -against dumping, code injection, \f[V]cat /proc/pid/cmdline\f[R], +against dumping, code injection, \f[CR]cat /proc/pid/cmdline\f[R], ptrace, etc.. This feature is \f[B]experimental\f[R] and may not work on all systems. it requires bourne shell (sh) scripts .TP --C +\-C Display license and exit .TP --A +\-A Display abstract and exit .TP --B +\-B Compile for BusyBox .TP --h +\-h Display help and exit .SH ENVIRONMENT VARIABLES .TP CC -C compiler command \f[V][cc]\f[R] +C compiler command \f[CR][cc]\f[R] .TP CFLAGS -C compiler flags \f[V][none]\f[R] +C compiler flags \f[CR][none]\f[R] .TP LDFLAGS -Linker flags \f[V][none]\f[R] +Linker flags \f[CR][none]\f[R] .SH EXAMPLES -.PP Compile a script which can be run on other systems with the trace option -enabled (without \f[V]-U\f[R] flag): +enabled (without \f[CR]\-U\f[R] flag): .IP -.nf -\f[C] -shc -f myscript -o mybinary -\f[R] -.fi +.EX +shc \-f myscript \-o mybinary +.EE .PP Compile an untraceable binary: .IP -.nf -\f[C] -shc -Uf myscript -o mybinary -\f[R] -.fi +.EX +shc \-Uf myscript \-o mybinary +.EE .PP Compile an untraceable binary that doesn\[cq]t require root access (experimental): .IP -.nf -\f[C] -shc -Hf myscript -o mybinary -\f[R] -.fi +.EX +shc \-Hf myscript \-o mybinary +.EE .SH LIMITATIONS -.PP The maximum size of the script that could be executed once compiled is limited by the operating system configuration parameter -\f[V]_SC_ARG_MAX\f[R] (see sysconf(2)) +\f[CR]_SC_ARG_MAX\f[R] (see sysconf(2)) .SH AUTHORS +Francisco Rosales \c +.MT frosal@fi.upm.es +.ME \c .PP -Francisco Rosales -.PP -Md Jahidul Hamid +Md Jahidul Hamid \c +.MT jahidulhamid@yahoo.com +.ME \c .SH REPORT BUGS TO -.PP https://github.com/neurobin/shc/issues diff --git a/src/Makefile.in b/src/Makefile.in index 75462ab..3a4f1a5 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -86,6 +86,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ bin_PROGRAMS = shc$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -154,8 +156,6 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -168,17 +168,17 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -214,14 +214,22 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ +build = @build@ build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +host = @host@ host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ @@ -237,6 +245,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -405,7 +414,6 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am From 489e8ddebdd7ac2e4ea628fe2f361d8017e06d5f Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 12 Aug 2024 13:30:09 +0200 Subject: [PATCH 32/83] Add uncrustify configuration, apply it The uncrustify configuration was set up to match the existing layout quite closely while adding braces and indenting where missing --- .github/workflows/pre-commit.yml | 2 + .pre-commit-config.yaml | 1 - src/shc.c | 1766 +++++++++++++++--------------- uncrustify.cfg | 1579 ++++++++++++++++++++++++++ 4 files changed, 2481 insertions(+), 867 deletions(-) create mode 100644 uncrustify.cfg diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 5f4bad5..63e17e9 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -23,6 +23,8 @@ jobs: key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} - name: Run pre-commit hooks + env: + SKIP: uncrustify run: | set -o pipefail pre-commit gc diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 38a4449..bd69aee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,7 +74,6 @@ repos: # choco install llvm uncrustify cppcheck hooks: - id: uncrustify - stages: [manual] args: [--replace, --no-backup, -c, uncrustify.cfg] - id: cppcheck args: diff --git a/src/shc.c b/src/shc.c index 1c46d92..20ed4c3 100644 --- a/src/shc.c +++ b/src/shc.c @@ -12,99 +12,100 @@ * Date: 21 May 1996 10:49:37 -0400 * And it is licensed also under GPL. * - *That's where I got it, now I am going to do some work on it - *It will reside here: http://github.com/neurobin/shc + * That's where I got it, now I am going to do some work on it + * It will reside here: http://github.com/neurobin/shc */ static const char my_name[] = "shc"; static const char version[] = "Version 4.0.3"; static const char subject[] = "Generic Shell Script Compiler"; static const char cpright[] = "GNU GPL Version 3"; -static const struct { const char * f, * s, * e; } - provider = { "Md Jahidul", "Hamid", "" }; +static const struct {const char *f, *s, *e;} +provider = { "Md Jahidul", "Hamid", "" }; /* -static const struct { const char * f, * s, * e; } - author = { "Francisco", "Garcia", "" }; -*/ + static const struct { const char * f, * s, * e; } + author = { "Francisco", "Garcia", "" }; + */ /*This is the original author who first came up with this*/ -static const char * copying[] = { -"Copying:", -"", -" This program is free software; you can redistribute it and/or modify", -" it under the terms of the GNU General Public License as published by", -" the Free Software Foundation; either version 3 of the License, or", -" (at your option) any later version.", -"", -" This program is distributed in the hope that it will be useful,", -" but WITHOUT ANY WARRANTY; without even the implied warranty of", -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", -" GNU General Public License for more details.", -"", -" You should have received a copy of the GNU General Public License", -" along with this program; if not, write to the Free Software", -" @Neurobin, Dhaka, Bangladesh", -"", -" Report problems and questions to:https://github.com/neurobin/shc", -"", -0}; +static const char *copying[] = { + "Copying:", + "", + " This program is free software; you can redistribute it and/or modify", + " it under the terms of the GNU General Public License as published by", + " the Free Software Foundation; either version 3 of the License, or", + " (at your option) any later version.", + "", + " This program is distributed in the hope that it will be useful,", + " but WITHOUT ANY WARRANTY; without even the implied warranty of", + " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", + " GNU General Public License for more details.", + "", + " You should have received a copy of the GNU General Public License", + " along with this program; if not, write to the Free Software", + " @Neurobin, Dhaka, Bangladesh", + "", + " Report problems and questions to:https://github.com/neurobin/shc", + "", + 0 +}; -static const char * abstract[] = { -"Abstract:", -"", -" This tool generates a stripped binary executable version", -" of the script specified at command line.", -"", -" Binary version will be saved with a .x extension by default.", -" You can specify output file name too with [-o OUTFILE] option.", -"", -" You can specify expiration date [-e] too, after which binary will", -" refuse to be executed, displaying \"[-m]\" instead.", -"", -" You can compile whatever interpreted script, but valid [-i], [-x]", -" and [-l] options must be given.", -"", -0}; +static const char *abstract[] = { + "Abstract:", + "", + " This tool generates a stripped binary executable version", + " of the script specified at command line.", + "", + " Binary version will be saved with a .x extension by default.", + " You can specify output file name too with [-o OUTFILE] option.", + "", + " You can specify expiration date [-e] too, after which binary will", + " refuse to be executed, displaying \"[-m]\" instead.", + "", + " You can compile whatever interpreted script, but valid [-i], [-x]", + " and [-l] options must be given.", + "", + 0 +}; static const char usage[] = -"Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHCAB2h] -f script"; + "Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHCAB2h] -f script"; -static const char * help[] = { -"", -" -e %s Expiration date in dd/mm/yyyy format [none]", -" -m %s Message to display upon expiration [\"Please contact your provider\"]", -" -f %s File name of the script to compile", -" -i %s Inline option for the shell interpreter i.e: -e", -" -x %s eXec command, as a printf format i.e: exec('%s',@ARGV);", -" -l %s Last shell option i.e: --", -" -o %s output filename", -" -r Relax security. Make a redistributable binary", -" -v Verbose compilation", -" -S Switch ON setuid for root callable programs [OFF]", -" -D Switch ON debug exec calls [OFF]", -" -U Make binary untraceable [no]", -" -H Hardening : extra security protection [no]", -" Require bourne shell (sh) and parameters are not supported", -" -C Display license and exit", -" -A Display abstract and exit", -" -B Compile for busybox", -" -2 Use the system call mmap2", -" -h Display help and exit", -"", -" Environment variables used:", -" Name Default Usage", -" CC cc C compiler command", -" STRIP strip Strip command", -" CFLAGS C compiler flags", -" LDFLAGS Linker flags", -"", -" Please consult the shc man page.", -"", -0}; +static const char *help[] = { + "", + " -e %s Expiration date in dd/mm/yyyy format [none]", + " -m %s Message to display upon expiration [\"Please contact your provider\"]", + " -f %s File name of the script to compile", + " -i %s Inline option for the shell interpreter i.e: -e", + " -x %s eXec command, as a printf format i.e: exec('%s',@ARGV);", + " -l %s Last shell option i.e: --", + " -o %s output filename", + " -r Relax security. Make a redistributable binary", + " -v Verbose compilation", + " -S Switch ON setuid for root callable programs [OFF]", + " -D Switch ON debug exec calls [OFF]", + " -U Make binary untraceable [no]", + " -H Hardening : extra security protection [no]", + " Require bourne shell (sh) and parameters are not supported", + " -C Display license and exit", + " -A Display abstract and exit", + " -B Compile for busybox", + " -2 Use the system call mmap2", + " -h Display help and exit", + "", + " Environment variables used:", + " Name Default Usage", + " CC cc C compiler command", + " STRIP strip Strip command", + " CFLAGS C compiler flags", + " LDFLAGS Linker flags", + "", + " Please consult the shc man page.", + "", + 0 +}; -#include -#include #include #include #include @@ -114,652 +115,655 @@ static const char * help[] = { #include #include #include +#include +#include #include #include #define SIZE 4096 -static char * file; -static char * file2; -static char date[21]; -static char * mail = "Please contact your provider jahidulhamid@yahoo.com"; -static char rlax[1]; -static char * shll; -static char * inlo; -static char * xecc; -static char * lsto; -static char * opts; -static char * text; +static char *file; +static char *file2; +static char date[21]; +static char *mail = "Please contact your provider jahidulhamid@yahoo.com"; +static char rlax[1]; +static char *shll; +static char *inlo; +static char *xecc; +static char *lsto; +static char *opts; +static char *text; static int verbose; static const char SETUID_line[] = -"#define SETUID %d /* Define as 1 to call setuid(0) at start of script */\n"; + "#define SETUID %d /* Define as 1 to call setuid(0) at start of script */\n"; static int SETUID_flag = 0; static const char DEBUGEXEC_line[] = -"#define DEBUGEXEC %d /* Define as 1 to debug execvp calls */\n"; + "#define DEBUGEXEC %d /* Define as 1 to debug execvp calls */\n"; static int DEBUGEXEC_flag = 0; static const char TRACEABLE_line[] = -"#define TRACEABLE %d /* Define as 1 to enable ptrace the executable */\n"; + "#define TRACEABLE %d /* Define as 1 to enable ptrace the executable */\n"; static int TRACEABLE_flag = 1; static const char HARDENING_line[] = -"#define HARDENING %d /* Define as 1 to disable ptrace/dump the executable */\n"; + "#define HARDENING %d /* Define as 1 to disable ptrace/dump the executable */\n"; static int HARDENING_flag = 0; static const char MMAP2_line[] = -"#define MMAP2 %d /* Define as 1 to use syscall mmap2 */\n"; + "#define MMAP2 %d /* Define as 1 to use syscall mmap2 */\n"; static int MMAP2_flag = 0; static const char BUSYBOXON_line[] = -"#define BUSYBOXON %d /* Define as 1 to enable work with busybox */\n"; + "#define BUSYBOXON %d /* Define as 1 to enable work with busybox */\n"; static int BUSYBOXON_flag = 0; -static const char * RTC[] = { -"", -"#if HARDENING", -"static const char * shc_x[] = {", -"\"/*\",", -"\" * Copyright 2019 - Intika \",", -"\" * Replace ******** with secret read from fd 21\",", -"\" * Also change arguments location of sub commands (sh script commands)\",", -"\" * gcc -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",", -"\" */\",", -"\"\",", -"\"#define _GNU_SOURCE /* needed to get RTLD_NEXT defined in dlfcn.h */\",", -"\"#define PLACEHOLDER \\\"********\\\"\",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"\",", -"\"static char secret[128000]; //max size\",", -"\"typedef int (*pfi)(int, char **, char **);\",", -"\"static pfi real_main;\",", -"\"\",", -"\"// copy argv to new location\",", -"\"char **copyargs(int argc, char** argv){\",", -"\" char **newargv = malloc((argc+1)*sizeof(*argv));\",", -"\" char *from,*to;\",", -"\" int i,len;\",", -"\"\",", -"\" for(i = 0; i 0) {\",", -"\" int i;\",", -"\"\",", -"\" if (secret[n - 1] == '\\\\n') secret[--n] = '\\\\0';\",", -"\" for (i = 1; i < argc; i++)\",", -"\" if (strcmp(argv[i], PLACEHOLDER) == 0)\",", -"\" argv[i] = secret;\",", -"\" }\",", -"\"\",", -"\" real_main = main;\",", -"\"\",", -"\" return real___libc_start_main(mymain, argc, argv, init, fini, rtld_fini, stack_end);\",", -"\"}\",", -"\"\",", -"0};", -"#endif /* HARDENING */", -"", -"/* rtc.c */", -"", -"#include ", -"#include ", -"", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"/* 'Alleged RC4' */", -"", -"static unsigned char stte[256], indx, jndx, kndx;", -"", -"/*", -" * Reset arc4 stte. ", -" */", -"void stte_0(void)", -"{", -" indx = jndx = kndx = 0;", -" do {", -" stte[indx] = indx;", -" } while (++indx);", -"}", -"", -"/*", -" * Set key. Can be used more than once. ", -" */", -"void key(void * str, int len)", -"{", -" unsigned char tmp, * ptr = (unsigned char *)str;", -" while (len > 0) {", -" do {", -" tmp = stte[indx];", -" kndx += tmp;", -" kndx += ptr[(int)indx % len];", -" stte[indx] = stte[kndx];", -" stte[kndx] = tmp;", -" } while (++indx);", -" ptr += 256;", -" len -= 256;", -" }", -"}", -"", -"/*", -" * Encrypt data. ", -" */", -"void arc4(void * str, int len)", -"{", -" unsigned char tmp, * ptr = (unsigned char *)str;", -" while (len > 0) {", -" indx++;", -" tmp = stte[indx];", -" jndx += tmp;", -" stte[indx] = stte[jndx];", -" stte[jndx] = tmp;", -" tmp += stte[indx];", -" *ptr ^= stte[tmp];", -" ptr++;", -" len--;", -" }", -"}", -"", -"/* End of ARC4 */", -"", -"#if HARDENING", -"", -"#include ", -"#include ", -"#include ", -"#include ", -"#define PR_SET_PTRACER 0x59616d61", -"", -"/* Seccomp Sandboxing Init */", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"#include ", -"#include ", -"#include ", -"", -"#define ArchField offsetof(struct seccomp_data, arch)", -"", -"#define Allow(syscall) \\", -" BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, SYS_##syscall, 0, 1), \\", -" BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW)", -"", -"struct sock_filter filter[] = {", -" /* validate arch */", -" BPF_STMT(BPF_LD+BPF_W+BPF_ABS, ArchField),", -" BPF_JUMP( BPF_JMP+BPF_JEQ+BPF_K, AUDIT_ARCH_X86_64, 1, 0),", -" BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", -"", -" /* load syscall */", -" BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, nr)),", -"", -" /* list of allowed syscalls */", -" Allow(exit_group), /* exits a process */", -" Allow(brk), /* for malloc(), inside libc */", -"#if MMAP2", -" Allow(mmap2), /* also for malloc() */", -"#else", -" Allow(mmap), /* also for malloc() */", -"#endif", -" Allow(munmap), /* for free(), inside libc */", -"", -" /* and if we don't match above, die */", -" BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", -"};", -"struct sock_fprog filterprog = {", -" .len = sizeof(filter)/sizeof(filter[0]),", -" .filter = filter", -"};", -"", -"/* Seccomp Sandboxing - Set up the restricted environment */", -"void seccomp_hardening() {", -" if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {", -" perror(\"Could not start seccomp:\");", -" exit(1);", -" }", -" if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &filterprog) == -1) {", -" perror(\"Could not start seccomp:\");", -" exit(1);", -" }", -"} ", -"/* End Seccomp Sandboxing Init */", -"", -"void shc_x_file() {", -" FILE *fp;", -" int line = 0;", -"", -" if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}", -" for (line = 0; shc_x[line]; line++) fprintf(fp, \"%s\\n\", shc_x[line]);", -" fflush(fp);fclose(fp);", -"}", -"", -"int make() {", -" char * cc, * cflags, * ldflags;", -" char cmd[4096];", -"", -" cc = getenv(\"CC\");", -" if (!cc) cc = \"cc\";", -"", -" sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");", -" if (system(cmd)) {remove(\"/tmp/shc_x.c\"); return -1;}", -" remove(\"/tmp/shc_x.c\"); return 0;", -"}", -"", -"void arc4_hardrun(void * str, int len) {", -" //Decode locally", -" char tmp2[len];", -" char tmp3[len+1024];", -" memcpy(tmp2, str, len);", -"", -" unsigned char tmp, * ptr = (unsigned char *)tmp2;", -" int lentmp = len;", -" int pid, status;", -" pid = fork();", -"", -" shc_x_file();", -" if (make()) {exit(1);}", -"", -" setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);", -"", -" if(pid==0) {", -"", -" //Start tracing to protect from dump & trace", -" if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {", -" kill(getpid(), SIGKILL);", -" _exit(1);", -" }", -"", -" //Decode Bash", -" while (len > 0) {", -" indx++;", -" tmp = stte[indx];", -" jndx += tmp;", -" stte[indx] = stte[jndx];", -" stte[jndx] = tmp;", -" tmp += stte[indx];", -" *ptr ^= stte[tmp];", -" ptr++;", -" len--;", -" }", -"", -" //Do the magic", -" sprintf(tmp3, \"%s %s\", \"'********' 21<<<\", tmp2);", -"", -" //Exec bash script //fork execl with 'sh -c'", -" system(tmp2);", -"", -" //Empty script variable", -" memcpy(tmp2, str, lentmp);", -"", -" //Clean temp", -" remove(\"/tmp/shc_x.so\");", -"", -" //Sinal to detach ptrace", -" ptrace(PTRACE_DETACH, 0, 0, 0);", -" exit(0);", -" }", -" else {wait(&status);}", -"", -" /* Seccomp Sandboxing - Start */", -" seccomp_hardening();", -"", -" exit(0);", -"}", -"#endif /* HARDENING */", -"", -"/*", -" * Key with file invariants. ", -" */", -"int key_with_file(char * file)", -"{", -" struct stat statf[1];", -" struct stat control[1];", -"", -" if (stat(file, statf) < 0)", -" return -1;", -"", -" /* Turn on stable fields */", -" memset(control, 0, sizeof(control));", -" control->st_ino = statf->st_ino;", -" control->st_dev = statf->st_dev;", -" control->st_rdev = statf->st_rdev;", -" control->st_uid = statf->st_uid;", -" control->st_gid = statf->st_gid;", -" control->st_size = statf->st_size;", -" control->st_mtime = statf->st_mtime;", -" control->st_ctime = statf->st_ctime;", -" key(control, sizeof(control));", -" return 0;", -"}", -"", -"#if DEBUGEXEC", -"void debugexec(char * sh11, int argc, char ** argv)", -"{", -" int i;", -" fprintf(stderr, \"shll=%s\\n\", sh11 ? sh11 : \"\");", -" fprintf(stderr, \"argc=%d\\n\", argc);", -" if (!argv) {", -" fprintf(stderr, \"argv=\\n\");", -" } else { ", -" for (i = 0; i <= argc ; i++)", -" fprintf(stderr, \"argv[%d]=%.60s\\n\", i, argv[i] ? argv[i] : \"\");", -" }", -"}", -"#endif /* DEBUGEXEC */", -"", -"void rmarg(char ** argv, char * arg)", -"{", -" for (; argv && *argv && *argv != arg; argv++);", -" for (; argv && *argv; argv++)", -" *argv = argv[1];", -"}", -"", -"void chkenv_end(void);", -"", -"int chkenv(int argc)", -"{", -" char buff[512];", -" unsigned long mask, m;", -" int l, a, c;", -" char * string;", -" extern char ** environ;", -"", -" mask = (unsigned long)getpid();", -" stte_0();", -" key(&chkenv, (void*)&chkenv_end - (void*)&chkenv);", -" key(&data, sizeof(data));", -" key(&mask, sizeof(mask));", -" arc4(&mask, sizeof(mask));", -" sprintf(buff, \"x%lx\", mask);", -" string = getenv(buff);", -"#if DEBUGEXEC", -" fprintf(stderr, \"getenv(%s)=%s\\n\", buff, string ? string : \"\");", -"#endif", -" l = strlen(buff);", -" if (!string) {", -" /* 1st */", -" sprintf(&buff[l], \"=%lu %d\", mask, argc);", -" putenv(strdup(buff));", -" return 0;", -" }", -" c = sscanf(string, \"%lu %d%c\", &m, &a, buff);", -" if (c == 2 && m == mask) {", -" /* 3rd */", -" rmarg(environ, &string[-l - 1]);", -" return 1 + (argc - a);", -" }", -" return -1;", -"}", -"", -"void chkenv_end(void){}", -"", -"#if HARDENING", -"", -"static void gets_process_name(const pid_t pid, char * name) {", -" char procfile[BUFSIZ];", -" sprintf(procfile, \"/proc/%d/cmdline\", pid);", -" FILE* f = fopen(procfile, \"r\");", -" if (f) {", -" size_t size;", -" size = fread(name, sizeof (char), sizeof (procfile), f);", -" if (size > 0) {", -" if ('\\n' == name[size - 1])", -" name[size - 1] = '\\0';", -" }", -" fclose(f);", -" }", -"}", -"", -"void hardening() {", -" prctl(PR_SET_DUMPABLE, 0);", -" prctl(PR_SET_PTRACER, -1);", -"", -" int pid = getppid();", -" char name[256] = {0};", -" gets_process_name(pid, name);", -"", -" if ( (strcmp(name, \"bash\") != 0) ", -" && (strcmp(name, \"/bin/bash\") != 0) ", -" && (strcmp(name, \"sh\") != 0) ", -" && (strcmp(name, \"/bin/sh\") != 0) ", -" && (strcmp(name, \"sudo\") != 0) ", -" && (strcmp(name, \"/bin/sudo\") != 0) ", -" && (strcmp(name, \"/usr/bin/sudo\") != 0)", -" && (strcmp(name, \"gksudo\") != 0) ", -" && (strcmp(name, \"/bin/gksudo\") != 0) ", -" && (strcmp(name, \"/usr/bin/gksudo\") != 0) ", -" && (strcmp(name, \"kdesu\") != 0) ", -" && (strcmp(name, \"/bin/kdesu\") != 0) ", -" && (strcmp(name, \"/usr/bin/kdesu\") != 0) ", -" )", -" {", -" printf(\"Operation not permitted\\n\");", -" kill(getpid(), SIGKILL);", -" exit(1);", -" }", -"}", -"", -"#endif /* HARDENING */", -"", -"#if !TRACEABLE", -"", -"#define _LINUX_SOURCE_COMPAT", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"#if !defined(PT_ATTACHEXC) /* New replacement for PT_ATTACH */", -" #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)", -" #define PT_ATTACHEXC PT_ATTACH", -" #elif defined(PTRACE_ATTACH)", -" #define PT_ATTACHEXC PTRACE_ATTACH", -" #endif", -"#endif", -"", -"void untraceable(char * argv0)", -"{", -" char proc[80];", -" int pid, mine;", -"", -" switch(pid = fork()) {", -" case 0:", -" pid = getppid();", -" /* For problematic SunOS ptrace */", -"#if defined(__FreeBSD__)", -" sprintf(proc, \"/proc/%d/mem\", (int)pid);", -"#else", -" sprintf(proc, \"/proc/%d/as\", (int)pid);", -"#endif", -" close(0);", -" mine = !open(proc, O_RDWR|O_EXCL);", -" if (!mine && errno != EBUSY)", -" mine = !ptrace(PT_ATTACHEXC, pid, 0, 0);", -" if (mine) {", -" kill(pid, SIGCONT);", -" } else {", +static const char *RTC[] = { + "", + "#if HARDENING", + "static const char * shc_x[] = {", + "\"/*\",", + "\" * Copyright 2019 - Intika \",", + "\" * Replace ******** with secret read from fd 21\",", + "\" * Also change arguments location of sub commands (sh script commands)\",", + "\" * gcc -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",", + "\" */\",", + "\"\",", + "\"#define _GNU_SOURCE /* needed to get RTLD_NEXT defined in dlfcn.h */\",", + "\"#define PLACEHOLDER \\\"********\\\"\",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"\",", + "\"static char secret[128000]; //max size\",", + "\"typedef int (*pfi)(int, char **, char **);\",", + "\"static pfi real_main;\",", + "\"\",", + "\"// copy argv to new location\",", + "\"char **copyargs(int argc, char** argv){\",", + "\" char **newargv = malloc((argc+1)*sizeof(*argv));\",", + "\" char *from,*to;\",", + "\" int i,len;\",", + "\"\",", + "\" for(i = 0; i 0) {\",", + "\" int i;\",", + "\"\",", + "\" if (secret[n - 1] == '\\\\n') secret[--n] = '\\\\0';\",", + "\" for (i = 1; i < argc; i++)\",", + "\" if (strcmp(argv[i], PLACEHOLDER) == 0)\",", + "\" argv[i] = secret;\",", + "\" }\",", + "\"\",", + "\" real_main = main;\",", + "\"\",", + "\" return real___libc_start_main(mymain, argc, argv, init, fini, rtld_fini, stack_end);\",", + "\"}\",", + "\"\",", + "0};", + "#endif /* HARDENING */", + "", + "/* rtc.c */", + "", + "#include ", + "#include ", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "/* 'Alleged RC4' */", + "", + "static unsigned char stte[256], indx, jndx, kndx;", + "", + "/*", + " * Reset arc4 stte. ", + " */", + "void stte_0(void)", + "{", + " indx = jndx = kndx = 0;", + " do {", + " stte[indx] = indx;", + " } while (++indx);", + "}", + "", + "/*", + " * Set key. Can be used more than once. ", + " */", + "void key(void * str, int len)", + "{", + " unsigned char tmp, * ptr = (unsigned char *)str;", + " while (len > 0) {", + " do {", + " tmp = stte[indx];", + " kndx += tmp;", + " kndx += ptr[(int)indx % len];", + " stte[indx] = stte[kndx];", + " stte[kndx] = tmp;", + " } while (++indx);", + " ptr += 256;", + " len -= 256;", + " }", + "}", + "", + "/*", + " * Encrypt data. ", + " */", + "void arc4(void * str, int len)", + "{", + " unsigned char tmp, * ptr = (unsigned char *)str;", + " while (len > 0) {", + " indx++;", + " tmp = stte[indx];", + " jndx += tmp;", + " stte[indx] = stte[jndx];", + " stte[jndx] = tmp;", + " tmp += stte[indx];", + " *ptr ^= stte[tmp];", + " ptr++;", + " len--;", + " }", + "}", + "", + "/* End of ARC4 */", + "", + "#if HARDENING", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "#define PR_SET_PTRACER 0x59616d61", + "", + "/* Seccomp Sandboxing Init */", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#include ", + "#include ", + "#include ", + "", + "#define ArchField offsetof(struct seccomp_data, arch)", + "", + "#define Allow(syscall) \\", + " BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, SYS_##syscall, 0, 1), \\", + " BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW)", + "", + "struct sock_filter filter[] = {", + " /* validate arch */", + " BPF_STMT(BPF_LD+BPF_W+BPF_ABS, ArchField),", + " BPF_JUMP( BPF_JMP+BPF_JEQ+BPF_K, AUDIT_ARCH_X86_64, 1, 0),", + " BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", + "", + " /* load syscall */", + " BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, nr)),", + "", + " /* list of allowed syscalls */", + " Allow(exit_group), /* exits a process */", + " Allow(brk), /* for malloc(), inside libc */", + "#if MMAP2", + " Allow(mmap2), /* also for malloc() */", + "#else", + " Allow(mmap), /* also for malloc() */", + "#endif", + " Allow(munmap), /* for free(), inside libc */", + "", + " /* and if we don't match above, die */", + " BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", + "};", + "struct sock_fprog filterprog = {", + " .len = sizeof(filter)/sizeof(filter[0]),", + " .filter = filter", + "};", + "", + "/* Seccomp Sandboxing - Set up the restricted environment */", + "void seccomp_hardening() {", + " if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {", + " perror(\"Could not start seccomp:\");", + " exit(1);", + " }", + " if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &filterprog) == -1) {", + " perror(\"Could not start seccomp:\");", + " exit(1);", + " }", + "} ", + "/* End Seccomp Sandboxing Init */", + "", + "void shc_x_file() {", + " FILE *fp;", + " int line = 0;", + "", + " if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}", + " for (line = 0; shc_x[line]; line++) fprintf(fp, \"%s\\n\", shc_x[line]);", + " fflush(fp);fclose(fp);", + "}", + "", + "int make() {", + " char * cc, * cflags, * ldflags;", + " char cmd[4096];", + "", + " cc = getenv(\"CC\");", + " if (!cc) cc = \"cc\";", + "", + " sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");", + " if (system(cmd)) {remove(\"/tmp/shc_x.c\"); return -1;}", + " remove(\"/tmp/shc_x.c\"); return 0;", + "}", + "", + "void arc4_hardrun(void * str, int len) {", + " //Decode locally", + " char tmp2[len];", + " char tmp3[len+1024];", + " memcpy(tmp2, str, len);", + "", + " unsigned char tmp, * ptr = (unsigned char *)tmp2;", + " int lentmp = len;", + " int pid, status;", + " pid = fork();", + "", + " shc_x_file();", + " if (make()) {exit(1);}", + "", + " setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);", + "", + " if(pid==0) {", + "", + " //Start tracing to protect from dump & trace", + " if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {", + " kill(getpid(), SIGKILL);", + " _exit(1);", + " }", + "", + " //Decode Bash", + " while (len > 0) {", + " indx++;", + " tmp = stte[indx];", + " jndx += tmp;", + " stte[indx] = stte[jndx];", + " stte[jndx] = tmp;", + " tmp += stte[indx];", + " *ptr ^= stte[tmp];", + " ptr++;", + " len--;", + " }", + "", + " //Do the magic", + " sprintf(tmp3, \"%s %s\", \"'********' 21<<<\", tmp2);", + "", + " //Exec bash script //fork execl with 'sh -c'", + " system(tmp2);", + "", + " //Empty script variable", + " memcpy(tmp2, str, lentmp);", + "", + " //Clean temp", + " remove(\"/tmp/shc_x.so\");", + "", + " //Sinal to detach ptrace", + " ptrace(PTRACE_DETACH, 0, 0, 0);", + " exit(0);", + " }", + " else {wait(&status);}", + "", + " /* Seccomp Sandboxing - Start */", + " seccomp_hardening();", + "", + " exit(0);", + "}", + "#endif /* HARDENING */", + "", + "/*", + " * Key with file invariants. ", + " */", + "int key_with_file(char * file)", + "{", + " struct stat statf[1];", + " struct stat control[1];", + "", + " if (stat(file, statf) < 0)", + " return -1;", + "", + " /* Turn on stable fields */", + " memset(control, 0, sizeof(control));", + " control->st_ino = statf->st_ino;", + " control->st_dev = statf->st_dev;", + " control->st_rdev = statf->st_rdev;", + " control->st_uid = statf->st_uid;", + " control->st_gid = statf->st_gid;", + " control->st_size = statf->st_size;", + " control->st_mtime = statf->st_mtime;", + " control->st_ctime = statf->st_ctime;", + " key(control, sizeof(control));", + " return 0;", + "}", + "", + "#if DEBUGEXEC", + "void debugexec(char * sh11, int argc, char ** argv)", + "{", + " int i;", + " fprintf(stderr, \"shll=%s\\n\", sh11 ? sh11 : \"\");", + " fprintf(stderr, \"argc=%d\\n\", argc);", + " if (!argv) {", + " fprintf(stderr, \"argv=\\n\");", + " } else { ", + " for (i = 0; i <= argc ; i++)", + " fprintf(stderr, \"argv[%d]=%.60s\\n\", i, argv[i] ? argv[i] : \"\");", + " }", + "}", + "#endif /* DEBUGEXEC */", + "", + "void rmarg(char ** argv, char * arg)", + "{", + " for (; argv && *argv && *argv != arg; argv++);", + " for (; argv && *argv; argv++)", + " *argv = argv[1];", + "}", + "", + "void chkenv_end(void);", + "", + "int chkenv(int argc)", + "{", + " char buff[512];", + " unsigned long mask, m;", + " int l, a, c;", + " char * string;", + " extern char ** environ;", + "", + " mask = (unsigned long)getpid();", + " stte_0();", + " key(&chkenv, (void*)&chkenv_end - (void*)&chkenv);", + " key(&data, sizeof(data));", + " key(&mask, sizeof(mask));", + " arc4(&mask, sizeof(mask));", + " sprintf(buff, \"x%lx\", mask);", + " string = getenv(buff);", + "#if DEBUGEXEC", + " fprintf(stderr, \"getenv(%s)=%s\\n\", buff, string ? string : \"\");", + "#endif", + " l = strlen(buff);", + " if (!string) {", + " /* 1st */", + " sprintf(&buff[l], \"=%lu %d\", mask, argc);", + " putenv(strdup(buff));", + " return 0;", + " }", + " c = sscanf(string, \"%lu %d%c\", &m, &a, buff);", + " if (c == 2 && m == mask) {", + " /* 3rd */", + " rmarg(environ, &string[-l - 1]);", + " return 1 + (argc - a);", + " }", + " return -1;", + "}", + "", + "void chkenv_end(void){}", + "", + "#if HARDENING", + "", + "static void gets_process_name(const pid_t pid, char * name) {", + " char procfile[BUFSIZ];", + " sprintf(procfile, \"/proc/%d/cmdline\", pid);", + " FILE* f = fopen(procfile, \"r\");", + " if (f) {", + " size_t size;", + " size = fread(name, sizeof (char), sizeof (procfile), f);", + " if (size > 0) {", + " if ('\\n' == name[size - 1])", + " name[size - 1] = '\\0';", + " }", + " fclose(f);", + " }", + "}", + "", + "void hardening() {", + " prctl(PR_SET_DUMPABLE, 0);", + " prctl(PR_SET_PTRACER, -1);", + "", + " int pid = getppid();", + " char name[256] = {0};", + " gets_process_name(pid, name);", + "", + " if ( (strcmp(name, \"bash\") != 0) ", + " && (strcmp(name, \"/bin/bash\") != 0) ", + " && (strcmp(name, \"sh\") != 0) ", + " && (strcmp(name, \"/bin/sh\") != 0) ", + " && (strcmp(name, \"sudo\") != 0) ", + " && (strcmp(name, \"/bin/sudo\") != 0) ", + " && (strcmp(name, \"/usr/bin/sudo\") != 0)", + " && (strcmp(name, \"gksudo\") != 0) ", + " && (strcmp(name, \"/bin/gksudo\") != 0) ", + " && (strcmp(name, \"/usr/bin/gksudo\") != 0) ", + " && (strcmp(name, \"kdesu\") != 0) ", + " && (strcmp(name, \"/bin/kdesu\") != 0) ", + " && (strcmp(name, \"/usr/bin/kdesu\") != 0) ", + " )", + " {", + " printf(\"Operation not permitted\\n\");", + " kill(getpid(), SIGKILL);", + " exit(1);", + " }", + "}", + "", + "#endif /* HARDENING */", + "", + "#if !TRACEABLE", + "", + "#define _LINUX_SOURCE_COMPAT", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#if !defined(PT_ATTACHEXC) /* New replacement for PT_ATTACH */", + " #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)", + " #define PT_ATTACHEXC PT_ATTACH", + " #elif defined(PTRACE_ATTACH)", + " #define PT_ATTACHEXC PTRACE_ATTACH", + " #endif", + "#endif", + "", + "void untraceable(char * argv0)", + "{", + " char proc[80];", + " int pid, mine;", + "", + " switch(pid = fork()) {", + " case 0:", + " pid = getppid();", + " /* For problematic SunOS ptrace */", + "#if defined(__FreeBSD__)", + " sprintf(proc, \"/proc/%d/mem\", (int)pid);", + "#else", + " sprintf(proc, \"/proc/%d/as\", (int)pid);", + "#endif", + " close(0);", + " mine = !open(proc, O_RDWR|O_EXCL);", + " if (!mine && errno != EBUSY)", + " mine = !ptrace(PT_ATTACHEXC, pid, 0, 0);", + " if (mine) {", + " kill(pid, SIGCONT);", + " } else {", /*" fprintf(stderr, \"%s is being traced!\\n\", argv0);",*/ -" perror(argv0);", -" kill(pid, SIGKILL);", -" }", -" _exit(mine);", -" case -1:", -" break;", -" default:", -" if (pid == waitpid(pid, 0, 0))", -" return;", -" }", -" perror(argv0);", -" _exit(1);", -"}", -"#endif /* !TRACEABLE */", -"", -"char * xsh(int argc, char ** argv)", -"{", -" char * scrpt;", -" int ret, i, j;", -" char ** varg;", -" char * me = argv[0];", -" if (me == NULL) { me = getenv(\"_\"); }", -" if (me == 0) { fprintf(stderr, \"E: neither argv[0] nor $_ works.\"); exit(1); }", -"", -" ret = chkenv(argc);", -" stte_0();", -" key(pswd, pswd_z);", -" arc4(msg1, msg1_z);", -" arc4(date, date_z);", -" if (date[0] && (atoll(date) 1) ? ret : 0; /* Args numbering correction */", -" while (i < argc)", -" varg[j++] = argv[i++]; /* Main run-time arguments */", -" varg[j] = 0; /* NULL terminated array */", -"#if DEBUGEXEC", -" debugexec(shll, j, varg);", -"#endif", -" execvp(shll, varg);", -" return shll;", -"}", -"", -"int main(int argc, char ** argv)", -"{", -"#if SETUID", -" (void) setuid(0);", -"#endif", -"#if DEBUGEXEC", -" debugexec(\"main\", argc, argv);", -"#endif", -"#if HARDENING", -" hardening();", -"#endif", -"#if !TRACEABLE", -" untraceable(argv[0]);", -"#endif", -" argv[1] = xsh(argc, argv);", -" fprintf(stderr, \"%s%s%s: %s\\n\", argv[0],", -" errno ? \": \" : \"\",", -" errno ? strerror(errno) : \"\",", -" argv[1] ? argv[1] : \"\"", -" );", -" return 1;", -"}", -0}; + " perror(argv0);", + " kill(pid, SIGKILL);", + " }", + " _exit(mine);", + " case -1:", + " break;", + " default:", + " if (pid == waitpid(pid, 0, 0))", + " return;", + " }", + " perror(argv0);", + " _exit(1);", + "}", + "#endif /* !TRACEABLE */", + "", + "char * xsh(int argc, char ** argv)", + "{", + " char * scrpt;", + " int ret, i, j;", + " char ** varg;", + " char * me = argv[0];", + " if (me == NULL) { me = getenv(\"_\"); }", + " if (me == 0) { fprintf(stderr, \"E: neither argv[0] nor $_ works.\"); exit(1); }", + "", + " ret = chkenv(argc);", + " stte_0();", + " key(pswd, pswd_z);", + " arc4(msg1, msg1_z);", + " arc4(date, date_z);", + " if (date[0] && (atoll(date) 1) ? ret : 0; /* Args numbering correction */", + " while (i < argc)", + " varg[j++] = argv[i++]; /* Main run-time arguments */", + " varg[j] = 0; /* NULL terminated array */", + "#if DEBUGEXEC", + " debugexec(shll, j, varg);", + "#endif", + " execvp(shll, varg);", + " return shll;", + "}", + "", + "int main(int argc, char ** argv)", + "{", + "#if SETUID", + " (void) setuid(0);", + "#endif", + "#if DEBUGEXEC", + " debugexec(\"main\", argc, argv);", + "#endif", + "#if HARDENING", + " hardening();", + "#endif", + "#if !TRACEABLE", + " untraceable(argv[0]);", + "#endif", + " argv[1] = xsh(argc, argv);", + " fprintf(stderr, \"%s%s%s: %s\\n\", argv[0],", + " errno ? \": \" : \"\",", + " errno ? strerror(errno) : \"\",", + " argv[1] ? argv[1] : \"\"", + " );", + " return 1;", + "}", + 0 +}; -static int parse_an_arg(int argc, char * argv[]) +static int parse_an_arg(int argc, char *argv[]) { - extern char * optarg; - const char * opts = "e:m:f:i:x:l:o:rvDSUHCAB2h"; + extern char *optarg; + const char *opts = "e:m:f:i:x:l:o:rvDSUHCAB2h"; struct tm tmp[1]; time_t expdate; int cnt, l; @@ -767,7 +771,7 @@ static int parse_an_arg(int argc, char * argv[]) switch (getopt(argc, argv, opts)) { case 'e': - memset(tmp, 0, sizeof(tmp)); + memset(tmp, 0, sizeof (tmp)); cnt = sscanf(optarg, "%2d/%2d/%4d%c", &tmp->tm_mday, &tmp->tm_mon, &tmp->tm_year, &ctrl); if (cnt == 3) { @@ -775,15 +779,15 @@ static int parse_an_arg(int argc, char * argv[]) tmp->tm_year -= 1900; expdate = mktime(tmp); } - if (cnt != 3 || expdate <= 0) { + if ((cnt != 3) || (expdate <= 0)) { fprintf(stderr, "%s parse(-e %s): Not a valid value\n", - my_name, optarg); + my_name, optarg); return -1; } - snprintf(date, sizeof(date), "%lld", (long long)expdate); // NOLINT - if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); + snprintf(date, sizeof (date), "%lld", (long long)expdate); // NOLINT + if (verbose) { fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); } expdate = atoll(date); - if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); + if (verbose) { fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); } break; case 'm': mail = optarg; @@ -816,7 +820,7 @@ static int parse_an_arg(int argc, char * argv[]) break; case 'S': SETUID_flag = 1; - break; + break; case 'D': DEBUGEXEC_flag = 1; break; @@ -830,8 +834,9 @@ static int parse_an_arg(int argc, char * argv[]) fprintf(stderr, "%s %s, %s\n", my_name, version, subject); fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e); fprintf(stderr, "%s ", my_name); - for (l = 0; copying[l]; l++) + for (l = 0; copying[l]; l++) { fprintf(stderr, "%s\n", copying[l]); + } fprintf(stderr, " %s %s %s\n\n", provider.f, provider.s, provider.e); exit(0); break; @@ -839,16 +844,18 @@ static int parse_an_arg(int argc, char * argv[]) fprintf(stderr, "%s %s, %s\n", my_name, version, subject); fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e); fprintf(stderr, "%s ", my_name); - for (l = 0; abstract[l]; l++) + for (l = 0; abstract[l]; l++) { fprintf(stderr, "%s\n", abstract[l]); + } exit(0); break; case 'h': fprintf(stderr, "%s %s, %s\n", my_name, version, subject); fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e); fprintf(stderr, "%s %s\n", my_name, usage); - for (l = 0; help[l]; l++) + for (l = 0; help[l]; l++) { fprintf(stderr, "%s\n", help[l]); + } exit(0); break; case -1: @@ -877,23 +884,25 @@ static int parse_an_arg(int argc, char * argv[]) return 1; } -static void parse_args(int argc, char * argv[]) +static void parse_args(int argc, char *argv[]) { int err = 0; int ret; #if 0 my_name = strrchr(argv[0], '/'); - if (my_name) + if (my_name) { my_name++; - else + } else { my_name = argv[0]; + } #endif do { ret = parse_an_arg(argc, argv); - if (ret == -1) + if (ret == -1) { err++; + } } while (ret); if (err) { @@ -920,9 +929,9 @@ void stte_0(void) /* * Set key. Can be used more than once. */ -void key(void * str, int len) +void key(void *str, int len) { - unsigned char tmp, * ptr = (unsigned char *)str; + unsigned char tmp, *ptr = (unsigned char *)str; while (len > 0) { do { tmp = stte[indx]; @@ -939,9 +948,9 @@ void key(void * str, int len) /* * Encrypt data. */ -void arc4(void * str, int len) +void arc4(void *str, int len) { - unsigned char * ptr = (unsigned char *)str; + unsigned char *ptr = (unsigned char *)str; while (len > 0) { unsigned char tmp; indx++; @@ -961,16 +970,17 @@ void arc4(void * str, int len) /* * Key with file invariants. */ -int key_with_file(char * file) +int key_with_file(char *file) { struct stat statf[1]; struct stat control[1]; - if (stat(file, statf) < 0) + if (stat(file, statf) < 0) { return -1; + } /* Turn on stable fields */ - memset(control, 0, sizeof(control)); + memset(control, 0, sizeof (control)); control->st_ino = statf->st_ino; control->st_dev = statf->st_dev; control->st_rdev = statf->st_rdev; @@ -979,7 +989,7 @@ int key_with_file(char * file) control->st_size = statf->st_size; control->st_mtime = statf->st_mtime; control->st_ctime = statf->st_ctime; - key(control, sizeof(control)); + key(control, sizeof (control)); return 0; } @@ -988,38 +998,39 @@ int key_with_file(char * file) * environment variables with characters as "=|#:*?$ ". */ struct { - char * shll; - char * inlo; - char * lsto; - char * xecc; + char * shll; + char * inlo; + char * lsto; + char * xecc; } shellsDB[] = { { "perl", "-e", "--", "exec('%s',@ARGV);" }, - { "rc", "-c", "", "builtin exec %s $*" }, - { "sh", "-c", "", "exec '%s' \"$@\"" }, /* IRIX_nvi */ - { "dash", "-c", "", "exec '%s' \"$@\"" }, - { "bash", "-c", "", "exec '%s' \"$@\"" }, - { "zsh", "-c", "", "exec '%s' \"$@\"" }, - { "bsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ - { "Rsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ - { "ksh", "-c", "", "exec '%s' \"$@\"" }, /* OK on Solaris, AIX and Linux (THX ) */ - { "tsh", "-c", "--", "exec '%s' \"$@\"" }, /* AIX */ - { "csh", "-c", "-b", "exec '%s' $argv" }, /* AIX: No file for $0 */ + { "rc", "-c", "", "builtin exec %s $*" }, + { "sh", "-c", "", "exec '%s' \"$@\"" }, /* IRIX_nvi */ + { "dash", "-c", "", "exec '%s' \"$@\"" }, + { "bash", "-c", "", "exec '%s' \"$@\"" }, + { "zsh", "-c", "", "exec '%s' \"$@\"" }, + { "bsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ + { "Rsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ + { "ksh", "-c", "", "exec '%s' \"$@\"" }, /* OK on Solaris, AIX and Linux (THX ) */ + { "tsh", "-c", "--", "exec '%s' \"$@\"" }, /* AIX */ + { "csh", "-c", "-b", "exec '%s' $argv" }, /* AIX: No file for $0 */ { "tcsh", "-c", "-b", "exec '%s' $argv" }, - { NULL, NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL }, }; -int eval_shell(char * text) +int eval_shell(char *text) { int i; - char * ptr; - char * tmp_realloc; + char *ptr; + char *tmp_realloc; ptr = strchr(text, (int)'\n'); - if (!ptr) + if (!ptr) { i = strlen(text); - else + } else { i = ptr - text; - ptr = malloc(i + 1); + } + ptr = malloc(i + 1); shll = malloc(i + 1); opts = malloc(i + 1); if (!ptr || !shll || !opts) { @@ -1034,7 +1045,7 @@ int eval_shell(char * text) *opts = '\0'; // cppcheck-suppress invalidscanf // (required memory checked above) i = sscanf(ptr, " #!%s%s %c", shll, opts, opts); - if (i < 1 || i > 2) { + if ((i < 1) || (i > 2)) { fprintf(stderr, "%s: invalid first line in script: %s\n", my_name, ptr); free(ptr); return -1; @@ -1048,32 +1059,36 @@ int eval_shell(char * text) return -1; } shll = tmp_realloc; - ptr = strrchr(shll, (int)'/'); + ptr = strrchr(shll, (int)'/'); if (!ptr) { fprintf(stderr, "%s: invalid shll\n", my_name); return -1; } - if (*ptr == '/') + if (*ptr == '/') { ptr++; - if (verbose) fprintf(stderr, "%s: shll=%s\n", my_name, ptr); + } + if (verbose) { fprintf(stderr, "%s: shll=%s\n", my_name, ptr); } - for(i=0; shellsDB[i].shll; i++) { - if(!strcmp(ptr, shellsDB[i].shll)) { - if (!inlo) + for (i = 0; shellsDB[i].shll; i++) { + if (!strcmp(ptr, shellsDB[i].shll)) { + if (!inlo) { inlo = strdup(shellsDB[i].inlo); - if (!xecc) + } + if (!xecc) { xecc = strdup(shellsDB[i].xecc); - if (!lsto) + } + if (!lsto) { lsto = strdup(shellsDB[i].lsto); + } } } if (!inlo || !xecc || !lsto) { fprintf(stderr, "%s Unknown shell (%s): specify [-i][-x][-l]\n", my_name, ptr); return -1; } - if (verbose) fprintf(stderr, "%s [-i]=%s\n", my_name, inlo); - if (verbose) fprintf(stderr, "%s [-x]=%s\n", my_name, xecc); - if (verbose) fprintf(stderr, "%s [-l]=%s\n", my_name, lsto); + if (verbose) { fprintf(stderr, "%s [-i]=%s\n", my_name, inlo); } + if (verbose) { fprintf(stderr, "%s [-x]=%s\n", my_name, xecc); } + if (verbose) { fprintf(stderr, "%s [-l]=%s\n", my_name, lsto); } tmp_realloc = realloc(opts, strlen(opts) + 1); if (!tmp_realloc) { @@ -1088,20 +1103,21 @@ int eval_shell(char * text) fprintf(stderr, "%s opts=%s : No real one. Removing opts\n", my_name, opts); *opts = '\0'; } - if (verbose) fprintf(stderr, "%s opts=%s\n", my_name, opts); + if (verbose) { fprintf(stderr, "%s opts=%s\n", my_name, opts); } return 0; } -char * read_script(char * file) +char*read_script(char *file) { - FILE * i; - char * l_text; - char * tmp_realloc; + FILE *i; + char *l_text; + char *tmp_realloc; int cnt, l; l_text = malloc(SIZE); - if (!l_text) + if (!l_text) { return NULL; + } i = fopen(file, "r"); if (!i) { free(l_text); @@ -1110,20 +1126,21 @@ char * read_script(char * file) for (l = 0;;) { tmp_realloc = realloc(l_text, l + SIZE); if (!tmp_realloc) { - free (l_text); + free(l_text); fclose(i); return NULL; } l_text = tmp_realloc; cnt = fread(&l_text[l], 1, SIZE, i); - if (!cnt) + if (!cnt) { break; + } l += cnt; } fclose(i); tmp_realloc = realloc(l_text, l + 1); if (!tmp_realloc) { - free (l_text); + free(l_text); return NULL; } l_text = tmp_realloc; @@ -1132,11 +1149,11 @@ char * read_script(char * file) /* Check current System ARG_MAX limit. */ if (l > 0.80 * (cnt = sysconf(_SC_ARG_MAX))) { fprintf(stderr, "%s: WARNING!!\n" -" Scripts of length near to (or higher than) the current System limit on\n" -" \"maximum size of arguments to EXEC\", could comprise its binary execution.\n" -" In the current System the call sysconf(_SC_ARG_MAX) returns %d bytes\n" -" and your script \"%s\" is %d bytes length.\n", - my_name, cnt, file, l); + " Scripts of length near to (or higher than) the current System limit on\n" + " \"maximum size of arguments to EXEC\", could comprise its binary execution.\n" + " In the current System the call sysconf(_SC_ARG_MAX) returns %d bytes\n" + " and your script \"%s\" is %d bytes length.\n", + my_name, cnt, file, l); } return l_text; } @@ -1146,117 +1163,122 @@ unsigned rand_mod(unsigned mod) /* Without skew */ unsigned rnd, top = RAND_MAX; top -= top % mod; - while (top <= (rnd = rand())) // NOLINT + while (top <= (rnd = rand())) { // NOLINT continue; + } /* Using high-order bits. */ - rnd = 1.0*mod*rnd/(1.0+top); + rnd = 1.0 * mod * rnd / (1.0 + top); return rnd; } char rand_chr(void) { - return (char)rand_mod(1<<(sizeof(char)<<3)); + return (char)rand_mod(1 << (sizeof (char) << 3)); } -int noise(char * ptr, unsigned min, unsigned xtra, int str) +int noise(char *ptr, unsigned min, unsigned xtra, int str) { - if (xtra) xtra = rand_mod(xtra); + if (xtra) { xtra = rand_mod(xtra); } xtra += min; - for (min = 0; min < xtra; min++, ptr++) + for (min = 0; min < xtra; min++, ptr++) { do { *ptr = rand_chr(); } while (str && !isalnum((int)*ptr)); - if (str) *ptr = '\0'; + } + if (str) { *ptr = '\0'; } return xtra; } static int offset; -void prnt_bytes(FILE * o, char * ptr, int m, int l, int n) +void prnt_bytes(FILE *o, char *ptr, int m, int l, int n) { int i; l += m; n += l; for (i = 0; i < n; i++) { - if ((i & 0xf) == 0) + if ((i & 0xf) == 0) { fprintf(o, "\n\t\""); - fprintf(o, "\\%03o", (unsigned char)((i>=m) && (i= m) && (i < l) ? ptr[i - m] : rand_chr())); + if ((i & 0xf) == 0xf) { fprintf(o, "\""); + } } - if ((i & 0xf) != 0) + if ((i & 0xf) != 0) { fprintf(o, "\""); + } offset += n; } -void prnt_array(FILE * o, void * ptr, char * name, int l, char * cast) +void prnt_array(FILE *o, void *ptr, char *name, int l, char *cast) { - int m = rand_mod(1+l/4); /* Random amount of random pre padding (offset) */ - int n = rand_mod(1+l/4); /* Random amount of random post padding (tail) */ - int a = l?(offset+m)%l:0; - if (cast && a) m += l - a; /* Type alignment. */ + int m = rand_mod(1 + l / 4); /* Random amount of random pre padding (offset) */ + int n = rand_mod(1 + l / 4); /* Random amount of random post padding (tail) */ + int a = l?(offset + m) % l : 0; + if (cast && a) { m += l - a; } /* Type alignment. */ fprintf(o, "\n"); fprintf(o, "#define %s_z %d", name, l); fprintf(o, "\n"); - fprintf(o, "#define %s (%s(&data[%d]))", name, cast?cast:"", offset+m); + fprintf(o, "#define %s (%s(&data[%d]))", name, cast?cast : "", offset + m); prnt_bytes(o, ptr, m, l, n); } -void dump_array(FILE * o, void * ptr, char * name, int l, char * cast) +void dump_array(FILE *o, void *ptr, char *name, int l, char *cast) { arc4(ptr, l); prnt_array(o, ptr, name, l, cast); } -void cleanup_write_c(char* msg1, char* msg2, char* chk1, char* chk2, char* tst1, char* tst2, char* kwsh, char* name) +void cleanup_write_c(char *msg1, char *msg2, char *chk1, char *chk2, char *tst1, char *tst2, char *kwsh, char *name) { - if (msg1) free(msg1); - if (msg2) free(msg2); - if (chk1) free(chk1); - if (chk2) free(chk2); - if (tst1) free(tst1); - if (tst2) free(tst2); - if (kwsh) free(kwsh); - if (name) free(name); + if (msg1) { free(msg1); } + if (msg2) { free(msg2); } + if (chk1) { free(chk1); } + if (chk2) { free(chk2); } + if (tst1) { free(tst1); } + if (tst2) { free(tst2); } + if (kwsh) { free(kwsh); } + if (name) { free(name); } } -int write_C(char * file, char * argv[]) +int write_C(char *file, char *argv[]) { char pswd[256]; - int pswd_z = sizeof(pswd); - char* msg1 = strdup("has expired!\n"); + int pswd_z = sizeof (pswd); + char *msg1 = strdup("has expired!\n"); int msg1_z = strlen(msg1) + 1; int date_z = strlen(date) + 1; - char* kwsh = strdup(shll); + char *kwsh = strdup(shll); int shll_z = strlen(shll) + 1; int inlo_z = strlen(inlo) + 1; int xecc_z = strlen(xecc) + 1; int lsto_z = strlen(lsto) + 1; - char* tst1 = strdup("location has changed!"); + char *tst1 = strdup("location has changed!"); int tst1_z = strlen(tst1) + 1; - char* chk1 = strdup(tst1); + char *chk1 = strdup(tst1); int chk1_z = tst1_z; - char* msg2 = strdup("abnormal behavior!"); + char *msg2 = strdup("abnormal behavior!"); int msg2_z = strlen(msg2) + 1; - int rlax_z = sizeof(rlax); + int rlax_z = sizeof (rlax); int opts_z = strlen(opts) + 1; int text_z = strlen(text) + 1; - char* tst2 = strdup("shell has changed!"); + char *tst2 = strdup("shell has changed!"); int tst2_z = strlen(tst2) + 1; - char* chk2 = strdup(tst2); + char *chk2 = strdup(tst2); int chk2_z = tst2_z; - char* name = strdup(file); - FILE * o; + char *name = strdup(file); + FILE *o; int l_idx; int numd = 0; int done = 0; /* Encrypt */ - srand((unsigned)time(NULL)^(unsigned)getpid()); + srand((unsigned)time(NULL) ^ (unsigned)getpid()); pswd_z = noise(pswd, pswd_z, 0, 0); numd++; stte_0(); - key(pswd, pswd_z); + key(pswd, pswd_z); msg1_z += strlen(mail); // cppcheck-suppress invalidFunctionArg // msg1_z is positive msg1 = strcat(realloc(msg1, msg1_z), mail); // NOLINT @@ -1267,7 +1289,7 @@ int write_C(char * file, char * argv[]) arc4(xecc, xecc_z); numd++; arc4(lsto, lsto_z); numd++; arc4(tst1, tst1_z); numd++; - key(chk1, chk1_z); + key(chk1, chk1_z); arc4(chk1, chk1_z); numd++; arc4(msg2, msg2_z); numd++; l_idx = !rlax[0]; @@ -1281,11 +1303,11 @@ int write_C(char * file, char * argv[]) arc4(opts, opts_z); numd++; arc4(text, text_z); numd++; arc4(tst2, tst2_z); numd++; - key(chk2, chk2_z); + key(chk2, chk2_z); arc4(chk2, chk2_z); numd++; /* Output */ - name = strcat(realloc(name, strlen(name)+5), ".x.c"); // NOLINT + name = strcat(realloc(name, strlen(name) + 5), ".x.c"); // NOLINT o = fopen(name, "w"); if (!o) { fprintf(stderr, "%s: creating output file: %s ", my_name, name); @@ -1296,8 +1318,9 @@ int write_C(char * file, char * argv[]) fprintf(o, "#if 0\n"); fprintf(o, "\t%s %s, %s\n", my_name, version, subject); fprintf(o, "\t%s %s %s %s\n\n\t", cpright, provider.f, provider.s, provider.e); - for (l_idx = 0; argv[l_idx]; l_idx++) + for (l_idx = 0; argv[l_idx]; l_idx++) { fprintf(o, "%s ", argv[l_idx]); + } fprintf(o, "\n#endif\n\n"); fprintf(o, "static char data [] = "); do { @@ -1305,36 +1328,37 @@ int write_C(char * file, char * argv[]) l_idx = rand_mod(15); do { switch (l_idx) { - case 0: if (pswd_z>=0) {prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z=done=-1; break;} - case 1: if (msg1_z>=0) {prnt_array(o, msg1, "msg1", msg1_z, 0); msg1_z=done=-1; break;} - case 2: if (date_z>=0) {prnt_array(o, date, "date", date_z, 0); date_z=done=-1; break;} - case 3: if (shll_z>=0) {prnt_array(o, shll, "shll", shll_z, 0); shll_z=done=-1; break;} - case 4: if (inlo_z>=0) {prnt_array(o, inlo, "inlo", inlo_z, 0); inlo_z=done=-1; break;} - case 5: if (xecc_z>=0) {prnt_array(o, xecc, "xecc", xecc_z, 0); xecc_z=done=-1; break;} - case 6: if (lsto_z>=0) {prnt_array(o, lsto, "lsto", lsto_z, 0); lsto_z=done=-1; break;} - case 7: if (tst1_z>=0) {prnt_array(o, tst1, "tst1", tst1_z, 0); tst1_z=done=-1; break;} - case 8: if (chk1_z>=0) {prnt_array(o, chk1, "chk1", chk1_z, 0); chk1_z=done=-1; break;} - case 9: if (msg2_z>=0) {prnt_array(o, msg2, "msg2", msg2_z, 0); msg2_z=done=-1; break;} - case 10: if (rlax_z>=0) {prnt_array(o, rlax, "rlax", rlax_z, 0); rlax_z=done=-1; break;} - case 11: if (opts_z>=0) {prnt_array(o, opts, "opts", opts_z, 0); opts_z=done=-1; break;} - case 12: if (text_z>=0) {prnt_array(o, text, "text", text_z, 0); text_z=done=-1; break;} - case 13: if (tst2_z>=0) {prnt_array(o, tst2, "tst2", tst2_z, 0); tst2_z=done=-1; break;} - case 14: if (chk2_z>=0) {prnt_array(o, chk2, "chk2", chk2_z, 0); chk2_z=done=-1; break;} + case 0: if (pswd_z >= 0) { prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z = done = -1; break; } + case 1: if (msg1_z >= 0) { prnt_array(o, msg1, "msg1", msg1_z, 0); msg1_z = done = -1; break; } + case 2: if (date_z >= 0) { prnt_array(o, date, "date", date_z, 0); date_z = done = -1; break; } + case 3: if (shll_z >= 0) { prnt_array(o, shll, "shll", shll_z, 0); shll_z = done = -1; break; } + case 4: if (inlo_z >= 0) { prnt_array(o, inlo, "inlo", inlo_z, 0); inlo_z = done = -1; break; } + case 5: if (xecc_z >= 0) { prnt_array(o, xecc, "xecc", xecc_z, 0); xecc_z = done = -1; break; } + case 6: if (lsto_z >= 0) { prnt_array(o, lsto, "lsto", lsto_z, 0); lsto_z = done = -1; break; } + case 7: if (tst1_z >= 0) { prnt_array(o, tst1, "tst1", tst1_z, 0); tst1_z = done = -1; break; } + case 8: if (chk1_z >= 0) { prnt_array(o, chk1, "chk1", chk1_z, 0); chk1_z = done = -1; break; } + case 9: if (msg2_z >= 0) { prnt_array(o, msg2, "msg2", msg2_z, 0); msg2_z = done = -1; break; } + case 10: if (rlax_z >= 0) { prnt_array(o, rlax, "rlax", rlax_z, 0); rlax_z = done = -1; break; } + case 11: if (opts_z >= 0) { prnt_array(o, opts, "opts", opts_z, 0); opts_z = done = -1; break; } + case 12: if (text_z >= 0) { prnt_array(o, text, "text", text_z, 0); text_z = done = -1; break; } + case 13: if (tst2_z >= 0) { prnt_array(o, tst2, "tst2", tst2_z, 0); tst2_z = done = -1; break; } + case 14: if (chk2_z >= 0) { prnt_array(o, chk2, "chk2", chk2_z, 0); chk2_z = done = -1; break; } } l_idx = 0; } while (!done); - } while (numd+=done); + } while (numd += done); cleanup_write_c(msg1, msg2, chk1, chk2, tst1, tst2, kwsh, name); fprintf(o, "/* End of data[] */;\n"); - fprintf(o, "#define %s_z %d\n", "hide", 1<<12); + fprintf(o, "#define %s_z %d\n", "hide", 1 << 12); fprintf(o, SETUID_line, SETUID_flag); fprintf(o, DEBUGEXEC_line, DEBUGEXEC_flag); fprintf(o, TRACEABLE_line, TRACEABLE_flag); fprintf(o, HARDENING_line, HARDENING_flag); - fprintf(o, BUSYBOXON_line, BUSYBOXON_flag); + fprintf(o, BUSYBOXON_line, BUSYBOXON_flag); fprintf(o, MMAP2_line, MMAP2_flag); - for (l_idx = 0; RTC[l_idx]; l_idx++) + for (l_idx = 0; RTC[l_idx]; l_idx++) { fprintf(o, "%s\n", RTC[l_idx]); + } fflush(o); fclose(o); @@ -1343,66 +1367,76 @@ int write_C(char * file, char * argv[]) int make(void) { - char * cc, * cflags, * ldflags; + char *cc, *cflags, *ldflags; char cmd[SIZE]; cc = getenv("CC"); - if (!cc) + if (!cc) { cc = "cc"; + } cflags = getenv("CFLAGS"); - if (!cflags) + if (!cflags) { cflags = ""; + } ldflags = getenv("LDFLAGS"); - if (!ldflags) + if (!ldflags) { ldflags = ""; + } -if(!file2){ -char * tmp_realloc; -tmp_realloc=(char*)realloc(file2,strlen(file)+3); -if (!tmp_realloc) { - free(file2); - return -1; -} -file2=tmp_realloc; -strcpy(file2,file); // NOLINT -file2=strcat(file2,".x"); // NOLINT - -} + if (!file2) { + char *tmp_realloc; + tmp_realloc = (char *)realloc(file2, strlen(file) + 3); + if (!tmp_realloc) { + free(file2); + return -1; + } + file2 = tmp_realloc; + strcpy(file2, file); // NOLINT + file2 = strcat(file2, ".x"); // NOLINT + } snprintf(cmd, SIZE, "%s %s %s \'%s.x.c\' -o %s", cc, cflags, ldflags, file, file2); - if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); - if (system(cmd)) + if (verbose) { fprintf(stderr, "%s: %s\n", my_name, cmd); } + if (system(cmd)) { return -1; - char* strip = getenv("STRIP"); - if (!strip) + } + char *strip = getenv("STRIP"); + if (!strip) { strip = "strip"; + } snprintf(cmd, SIZE, "%s %s", strip, file2); - if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); - if (system(cmd)) + if (verbose) { fprintf(stderr, "%s: %s\n", my_name, cmd); } + if (system(cmd)) { fprintf(stderr, "%s: never mind\n", my_name); + } snprintf(cmd, SIZE, "chmod ug=rwx,o=rx %s", file2); - if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); - if (system(cmd)) + if (verbose) { fprintf(stderr, "%s: %s\n", my_name, cmd); } + if (system(cmd)) { fprintf(stderr, "%s: remove read permission\n", my_name); + } return 0; } -void do_all(int argc, char * argv[]) +void do_all(int argc, char *argv[]) { parse_args(argc, argv); text = read_script(file); - if (!text) + if (!text) { return; - if (eval_shell(text)) + } + if (eval_shell(text)) { return; - if (write_C(file, argv)) + } + if (write_C(file, argv)) { return; - if (make()) + } + if (make()) { return; + } exit(0); } -int main(int argc, char * argv[]) +int main(int argc, char *argv[]) { putenv("LANG="); do_all(argc, argv); diff --git a/uncrustify.cfg b/uncrustify.cfg new file mode 100644 index 0000000..56a5883 --- /dev/null +++ b/uncrustify.cfg @@ -0,0 +1,1579 @@ +# Uncrustify 0.60 + +# +# General options +# + +# The type of line endings +newlines = auto # auto/lf/crlf/cr + +# The original size of tabs in the input +input_tab_size = 4 # number + +# The size of tabs in the output (only used if align_with_tabs=true) +output_tab_size = 4 # number + +# The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) +string_escape_char = 92 # number + +# Alternate string escape char for Pawn. Only works right before the quote char. +string_escape_char2 = 0 # number + +# Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. +# If true (default), 'assert(x<0 && y>=3)' will be broken. +# Improvements to template detection may make this option obsolete. +tok_split_gte = false # false/true + +# Control what to do with the UTF-8 BOM (recommend 'remove') +utf8_bom = ignore # ignore/add/remove/force + +# If the file contains bytes with values between 128 and 255, but is not UTF-8, then output as UTF-8 +utf8_byte = true # false/true + +# Force the output encoding to UTF-8 +utf8_force = true # false/true + +# +# Indenting +# + +# The number of columns to indent per level. +# Usually 2, 3, 4, or 8. +indent_columns = 4 # number + +# The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. +# For FreeBSD, this is set to 4. Negative value is absolute and not increased for each ( level +indent_continue = 0 # number + +# How to use tabs when indenting code +# 0=spaces only +# 1=indent with tabs to brace level, align with spaces +# 2=indent and align with tabs, using spaces when not on a tabstop +indent_with_tabs = 2 # number + +# Comments that are not a brace level are indented with tabs on a tabstop. +# Requires indent_with_tabs=2. If false, will use spaces. +indent_cmt_with_tabs = false # false/true + +# Whether to indent strings broken by '\' so that they line up +indent_align_string = false # false/true + +# The number of spaces to indent multi-line XML strings. +# Requires indent_align_string=True +indent_xml_string = 0 # number + +# Spaces to indent '{' from level +indent_brace = 0 # number + +# Whether braces are indented to the body level +indent_braces = false # false/true + +# Disabled indenting function braces if indent_braces is true +indent_braces_no_func = false # false/true + +# Disabled indenting class braces if indent_braces is true +indent_braces_no_class = false # false/true + +# Disabled indenting struct braces if indent_braces is true +indent_braces_no_struct = false # false/true + +# Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. +indent_brace_parent = false # false/true + +# Whether the 'namespace' body is indented +indent_namespace = false # false/true + +# The number of spaces to indent a namespace block +indent_namespace_level = 0 # number + +# If the body of the namespace is longer than this number, it won't be indented. +# Requires indent_namespace=true. Default=0 (no limit) +indent_namespace_limit = 0 # number + +# Whether the 'extern "C"' body is indented +indent_extern = false # false/true + +# Whether the 'class' body is indented +indent_class = true # false/true + +# Whether to indent the stuff after a leading class colon +indent_class_colon = true # false/true + +# Virtual indent from the ':' for member initializers. Default is 2 +indent_ctor_init_leading = 2 # number + +# forceitional indenting for constructor initializer list +indent_ctor_init = 0 # number + +# False=treat 'else\nif' as 'else if' for indenting purposes +# True=indent the 'if' one level +indent_else_if = false # false/true + +# Amount to indent variable declarations after a open brace. neg=relative, pos=absolute +indent_var_def_blk = 0 # number + +# Indent continued variable declarations instead of aligning. +indent_var_def_cont = false # false/true + +# True: force indentation of function definition to start in column 1 +# False: use the default behavior +indent_func_def_force_col1 = false # false/true + +# True: indent continued function call parameters one indent level +# False: align parameters under the open paren +indent_func_call_param = true # false/true + +# Same as indent_func_call_param, but for function defs +indent_func_def_param = true # false/true + +# Same as indent_func_call_param, but for function protos +indent_func_proto_param = true # false/true + +# Same as indent_func_call_param, but for class declarations +indent_func_class_param = true # false/true + +# Same as indent_func_call_param, but for class variable constructors +indent_func_ctor_var_param = true # false/true + +# Same as indent_func_call_param, but for templates +indent_template_param = true # false/true + +# Double the indent for indent_func_xxx_param options +indent_func_param_double = false # false/true + +# Indentation column for standalone 'const' function decl/proto qualifier +indent_func_const = 0 # number + +# Indentation column for standalone 'throw' function decl/proto qualifier +indent_func_throw = 0 # number + +# The number of spaces to indent a continued '->' or '.' +# Usually set to 0, 1, or indent_columns. +indent_member = 0 # number + +# Spaces to indent single line ('//') comments on lines before code +indent_single_line_comments_before = 0 # number + +# If set, will indent trailing single line ('//') comments relative +# to the code instead of trying to keep the same absolute column +indent_relative_single_line_comments = false # false/true + +# Spaces to indent 'case' from 'switch' +# Usually 0 or indent_columns. +indent_switch_case = 0 # number + +# Spaces to shift the 'case' line, without affecting any other lines +# Usually 0. +indent_case_shift = 0 # number + +# Spaces to indent '{' from 'case'. +# By default, the brace will appear under the 'c' in case. +# Usually set to 0 or indent_columns. +indent_case_brace = 0 # number + +# Whether to indent comments found in first column +indent_col1_comment = false # false/true + +# How to indent goto labels +# >0 : absolute column where 1 is the leftmost column +# <=0 : subtract from brace indent +indent_label = 1 # number + +# Same as indent_label, but for access specifiers that are followed by a colon +indent_access_spec = 1 # number + +# Indent the code after an access specifier by one level. +# If set, this option forces 'indent_access_spec=0' +indent_access_spec_body = true # false/true + +# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) +indent_paren_nl = false # false/true + +# Controls the indent of a close paren after a newline. +# 0: Indent to body level +# 1: Align under the open paren +# 2: Indent to the brace level +indent_paren_close = 0 # number + +# Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren +indent_comma_paren = 0 # false/true + +# Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren +indent_bool_paren = 0 + +# If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones +indent_first_bool_expr = false # false/true + +# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) +indent_square_nl = false # false/true + +# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies +indent_preserve_sql = false # false/true + +# Align continued statements at the '='. Default=True +# If FALSE or the '=' is followed by a newline, the next line is indent one tab. +indent_align_assign = true # false/true + +# Indent OC blocks at brace level instead of usual rules. +indent_oc_block = false # false/true + +# Indent OC blocks in a message relative to the parameter name. +# 0=use indent_oc_block rules, 1+=spaces to indent +indent_oc_block_msg = 0 # number + +# Minimum indent for subsequent parameters +indent_oc_msg_colon = 0 # number + +# +# Spacing options +# + +# force or remove space around arithmetic operator '+', '-', '/', '*', etc +sp_arith = force # ignore/add/remove/force + +# force or remove space around assignment operator '=', '+=', etc +sp_assign = force # ignore/add/remove/force + +# force or remove space around '=' in C++11 lambda capture specifications. Overrides sp_assign +sp_cpp_lambda_assign = force # ignore/add/remove/force + +# force or remove space after the capture specification in C++11 lambda. +sp_cpp_lambda_square_paren = force # ignore/add/remove/force + +# force or remove space around assignment operator '=' in a prototype +sp_assign_default = force # ignore/add/remove/force + +# force or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. +sp_before_assign = force # ignore/add/remove/force + +# force or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. +sp_after_assign = force # ignore/add/remove/force + +# force or remove space around assignment '=' in enum +sp_enum_assign = force # ignore/add/remove/force + +# force or remove space before assignment '=' in enum. Overrides sp_enum_assign. +sp_enum_before_assign = force # ignore/add/remove/force + +# force or remove space after assignment '=' in enum. Overrides sp_enum_assign. +sp_enum_after_assign = force # ignore/add/remove/force + +# force or remove space around preprocessor '##' concatenation operator. Default=Add +sp_pp_concat = force # ignore/add/remove/force + +# force or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. +sp_pp_stringify = force # ignore/add/remove/force + +# force or remove space before preprocessor '#' stringify operator as in '#define x(y) L#y'. +sp_before_pp_stringify = force # ignore/add/remove/force + +# force or remove space around boolean operators '&&' and '||' +sp_bool = force # ignore/add/remove/force + +# force or remove space around compare operator '<', '>', '==', etc +sp_compare = force # ignore/add/remove/force + +# force or remove space inside '(' and ')' +sp_inside_paren = remove # ignore/add/remove/force + +# force or remove space between nested parens +sp_paren_paren = remove # ignore/add/remove/force + +# Whether to balance spaces inside nested parens +sp_balance_nested_parens = false # false/true + +# force or remove space between ')' and '{' +sp_paren_brace = force # ignore/add/remove/force + +# force or remove space before pointer star '*' +sp_before_ptr_star = force # ignore/add/remove/force + +# force or remove space before pointer star '*' that isn't followed by a variable name +# If set to 'ignore', sp_before_ptr_star is used instead. +sp_before_unnamed_ptr_star = force # ignore/add/remove/force + +# force or remove space between pointer stars '*' +sp_between_ptr_star = remove # ignore/add/remove/force + +# force or remove space after pointer star '*', if followed by a word. +sp_after_ptr_star = remove # ignore/add/remove/force + +# force or remove space after a pointer star '*', if followed by a func proto/def. +sp_after_ptr_star_func = remove # ignore/add/remove/force + +# force or remove space after a pointer star '*', if followed by an open paren (function types). +sp_ptr_star_paren = remove # ignore/add/remove/force + +# force or remove space before a pointer star '*', if followed by a func proto/def. +sp_before_ptr_star_func = remove # ignore/add/remove/force + +# force or remove space before a reference sign '&' +sp_before_byref = force # ignore/add/remove/force + +# force or remove space before a reference sign '&' that isn't followed by a variable name +# If set to 'ignore', sp_before_byref is used instead. +sp_before_unnamed_byref = force # ignore/add/remove/force + +# force or remove space after reference sign '&', if followed by a word. +sp_after_byref = remove # ignore/add/remove/force + +# force or remove space after a reference sign '&', if followed by a func proto/def. +sp_after_byref_func = remove # ignore/add/remove/force + +# force or remove space before a reference sign '&', if followed by a func proto/def. +sp_before_byref_func = remove # ignore/add/remove/force + +# force or remove space between type and word. Default=Force +sp_after_type = force # ignore/add/remove/force + +# force or remove space before the paren in the D constructs 'template Foo(' and 'class Foo('. +sp_before_template_paren = ignore # ignore/add/remove/force + +# force or remove space in 'template <' vs 'template<'. +# If set to ignore, sp_before_angle is used. +sp_template_angle = remove # ignore/add/remove/force + +# force or remove space before '<>' +sp_before_angle = remove # ignore/add/remove/force + +# force or remove space inside '<' and '>' +sp_inside_angle = remove # ignore/add/remove/force + +# force or remove space after '<>' +sp_after_angle = force # ignore/add/remove/force + +# force or remove space between '<>' and '(' as found in 'new List();' +sp_angle_paren = remove # ignore/add/remove/force + +# force or remove space between '<>' and a word as in 'List m;' +sp_angle_word = force # ignore/add/remove/force + +# force or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add +sp_angle_shift = force # ignore/add/remove/force + +# Permit removal of the space between '>>' in 'foo >' (C++11 only). Default=False +# sp_angle_shift cannot remove the space without this option. +sp_permit_cpp11_shift = false # false/true + +# force or remove space before '(' of 'if', 'for', 'switch', and 'while' +sp_before_sparen = force # ignore/add/remove/force + +# force or remove space inside if-condition '(' and ')' +sp_inside_sparen = remove # ignore/add/remove/force + +# force or remove space before if-condition ')'. Overrides sp_inside_sparen. +sp_inside_sparen_close = remove # ignore/add/remove/force + +# force or remove space before if-condition '('. Overrides sp_inside_sparen. +sp_inside_sparen_open = remove # ignore/add/remove/force + +# force or remove space after ')' of 'if', 'for', 'switch', and 'while' +sp_after_sparen = force # ignore/add/remove/force + +# force or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' +sp_sparen_brace = force # ignore/add/remove/force + +# force or remove space between 'invariant' and '(' in the D language. +sp_invariant_paren = force # ignore/add/remove/force + +# force or remove space after the ')' in 'invariant (C) c' in the D language. +sp_after_invariant_paren = force # ignore/add/remove/force + +# force or remove space before empty statement ';' on 'if', 'for' and 'while' +sp_special_semi = remove # ignore/add/remove/force + +# force or remove space before ';'. Default=Remove +sp_before_semi = remove # ignore/add/remove/force + +# force or remove space before ';' in non-empty 'for' statements +sp_before_semi_for = remove # ignore/add/remove/force + +# force or remove space before a semicolon of an empty part of a for statement. +sp_before_semi_for_empty = remove # ignore/add/remove/force + +# force or remove space after ';', except when followed by a comment. Default=Add +sp_after_semi = force # ignore/add/remove/force + +# force or remove space after ';' in non-empty 'for' statements. Default=Force +sp_after_semi_for = force # ignore/add/remove/force + +# force or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). +sp_after_semi_for_empty = remove # ignore/add/remove/force + +# force or remove space before '[' (except '[]') +sp_before_square = remove # ignore/add/remove/force + +# force or remove space before '[]' +sp_before_squares = remove # ignore/add/remove/force + +# force or remove space inside a non-empty '[' and ']' +sp_inside_square = remove # ignore/add/remove/force + +# force or remove space after ',' +sp_after_comma = force # ignore/add/remove/force + +# force or remove space before ',' +sp_before_comma = remove # ignore/add/remove/force + +# force or remove space between an open paren and comma: '(,' vs '( ,' +sp_paren_comma = force # ignore/add/remove/force + +# force or remove space before the variadic '...' when preceded by a non-punctuator +sp_before_ellipsis = remove # ignore/add/remove/force + +# force or remove space after class ':' +sp_after_class_colon = force # ignore/add/remove/force + +# force or remove space before class ':' +sp_before_class_colon = force # ignore/add/remove/force + +# force or remove space before case ':'. Default=Remove +sp_before_case_colon = remove # ignore/add/remove/force + +# force or remove space between 'operator' and operator sign +sp_after_operator = remove # ignore/add/remove/force + +# force or remove space between the operator symbol and the open paren, as in 'operator ++(' +sp_after_operator_sym = remove # ignore/add/remove/force + +# force or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' +sp_after_cast = remove # ignore/add/remove/force + +# force or remove spaces inside cast parens +sp_inside_paren_cast = remove # ignore/add/remove/force + +# force or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' +sp_cpp_cast_paren = force # ignore/add/remove/force + +# force or remove space between 'sizeof' and '(' +sp_sizeof_paren = force # ignore/add/remove/force + +# force or remove space after the tag keyword (Pawn) +sp_after_tag = ignore # ignore/add/remove/force + +# force or remove space inside enum '{' and '}' +sp_inside_braces_enum = remove # ignore/add/remove/force + +# force or remove space inside struct/union '{' and '}' +sp_inside_braces_struct = remove # ignore/add/remove/force + +# force or remove space inside '{' and '}' +sp_inside_braces = force # ignore/add/remove/force + +# force or remove space inside '{}' +sp_inside_braces_empty = remove # ignore/add/remove/force + +# force or remove space between return type and function name +# A minimum of 1 is forced except for pointer return types. +sp_type_func = force # ignore/add/remove/force + +# force or remove space between function name and '(' on function declaration +sp_func_proto_paren = remove # ignore/add/remove/force + +# force or remove space between function name and '(' on function definition +sp_func_def_paren = remove # ignore/add/remove/force + +# force or remove space inside empty function '()' +sp_inside_fparens = remove # ignore/add/remove/force + +# force or remove space inside function '(' and ')' +sp_inside_fparen = remove # ignore/add/remove/force + +# force or remove space inside the first parens in the function type: 'void (*x)(...)' +sp_inside_tparen = remove # ignore/add/remove/force + +# force or remove between the parens in the function type: 'void (*x)(...)' +sp_after_tparen_close = remove # ignore/add/remove/force + +# force or remove space between ']' and '(' when part of a function call. +sp_square_fparen = remove # ignore/add/remove/force + +# force or remove space between ')' and '{' of function +sp_fparen_brace = force # ignore/add/remove/force + +# force or remove space between function name and '(' on function calls +sp_func_call_paren = remove # ignore/add/remove/force + +# force or remove space between function name and '()' on function calls without parameters. +# If set to 'ignore' (the default), sp_func_call_paren is used. +sp_func_call_paren_empty = remove # ignore/add/remove/force + +# force or remove space between the user function name and '(' on function calls +# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. +sp_func_call_user_paren = ignore # ignore/add/remove/force + +# force or remove space between a constructor/destructor and the open paren +sp_func_class_paren = remove # ignore/add/remove/force + +# force or remove space between 'return' and '(' +sp_return_paren = force # ignore/add/remove/force + +# force or remove space between '__attribute__' and '(' +sp_attribute_paren = remove # ignore/add/remove/force + +# force or remove space between 'defined' and '(' in '#if defined (FOO)' +sp_defined_paren = remove # ignore/add/remove/force + +# force or remove space between 'throw' and '(' in 'throw (something)' +sp_throw_paren = remove # ignore/add/remove/force + +# force or remove space between 'throw' and anything other than '(' as in '@throw [...];' +sp_after_throw = remove # ignore/add/remove/force + +# force or remove space between 'catch' and '(' in 'catch (something) { }' +# If set to ignore, sp_before_sparen is used. +sp_catch_paren = ignore # ignore/add/remove/force + +# force or remove space between 'version' and '(' in 'version (something) { }' (D language) +# If set to ignore, sp_before_sparen is used. +sp_version_paren = ignore # ignore/add/remove/force + +# force or remove space between 'scope' and '(' in 'scope (something) { }' (D language) +# If set to ignore, sp_before_sparen is used. +sp_scope_paren = ignore # ignore/add/remove/force + +# force or remove space between macro and value +sp_macro = ignore # ignore/add/remove/force + +# force or remove space between macro function ')' and value +sp_macro_func = ignore # ignore/add/remove/force + +# force or remove space between 'else' and '{' if on the same line +sp_else_brace = force # ignore/add/remove/force + +# force or remove space between '}' and 'else' if on the same line +sp_brace_else = force # ignore/add/remove/force + +# force or remove space between '}' and the name of a typedef on the same line +sp_brace_typedef = force # ignore/add/remove/force + +# force or remove space between 'catch' and '{' if on the same line +sp_catch_brace = force # ignore/add/remove/force + +# force or remove space between '}' and 'catch' if on the same line +sp_brace_catch = force # ignore/add/remove/force + +# force or remove space between 'finally' and '{' if on the same line +sp_finally_brace = force # ignore/add/remove/force + +# force or remove space between '}' and 'finally' if on the same line +sp_brace_finally = force # ignore/add/remove/force + +# force or remove space between 'try' and '{' if on the same line +sp_try_brace = force # ignore/add/remove/force + +# force or remove space between get/set and '{' if on the same line +sp_getset_brace = ignore # ignore/add/remove/force + +# force or remove space before the '::' operator +sp_before_dc = remove # ignore/add/remove/force + +# force or remove space after the '::' operator +sp_after_dc = remove # ignore/add/remove/force + +# force or remove around the D named array initializer ':' operator +sp_d_array_colon = ignore # ignore/add/remove/force + +# force or remove space after the '!' (not) operator. Default=Remove +sp_not = remove # ignore/add/remove/force + +# force or remove space after the '~' (invert) operator. Default=Remove +sp_inv = remove # ignore/add/remove/force + +# force or remove space after the '&' (address-of) operator. Default=Remove +# This does not affect the spacing after a '&' that is part of a type. +sp_addr = remove # ignore/add/remove/force + +# force or remove space around the '.' or '->' operators. Default=Remove +sp_member = remove # ignore/add/remove/force + +# force or remove space after the '*' (dereference) operator. Default=Remove +# This does not affect the spacing after a '*' that is part of a type. +sp_deref = remove # ignore/add/remove/force + +# force or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove +sp_sign = remove # ignore/add/remove/force + +# force or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove +sp_incdec = remove # ignore/add/remove/force + +# force or remove space before a backslash-newline at the end of a line. Default=Add +sp_before_nl_cont = force # ignore/add/remove/force + +# force or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' +sp_after_oc_scope = ignore # ignore/add/remove/force + +# force or remove space after the colon in message specs +# '-(int) f:(int) x;' vs '-(int) f: (int) x;' +sp_after_oc_colon = ignore # ignore/add/remove/force + +# force or remove space before the colon in message specs +# '-(int) f: (int) x;' vs '-(int) f : (int) x;' +sp_before_oc_colon = ignore # ignore/add/remove/force + +# force or remove space after the colon in immutable dictionary expression +# 'NSDictionary *test = @{@"foo" :@"bar"};' +sp_after_oc_dict_colon = ignore # ignore/add/remove/force + +# force or remove space before the colon in immutable dictionary expression +# 'NSDictionary *test = @{@"foo" :@"bar"};' +sp_before_oc_dict_colon = ignore # ignore/add/remove/force + +# force or remove space after the colon in message specs +# '[object setValue:1];' vs '[object setValue: 1];' +sp_after_send_oc_colon = ignore # ignore/add/remove/force + +# force or remove space before the colon in message specs +# '[object setValue:1];' vs '[object setValue :1];' +sp_before_send_oc_colon = ignore # ignore/add/remove/force + +# force or remove space after the (type) in message specs +# '-(int)f: (int) x;' vs '-(int)f: (int)x;' +sp_after_oc_type = ignore # ignore/add/remove/force + +# force or remove space after the first (type) in message specs +# '-(int) f:(int)x;' vs '-(int)f:(int)x;' +sp_after_oc_return_type = ignore # ignore/add/remove/force + +# force or remove space between '@selector' and '(' +# '@selector(msgName)' vs '@selector (msgName)' +# Also applies to @protocol() constructs +sp_after_oc_at_sel = ignore # ignore/add/remove/force + +# force or remove space between '@selector(x)' and the following word +# '@selector(foo) a:' vs '@selector(foo)a:' +sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force + +# force or remove space inside '@selector' parens +# '@selector(foo)' vs '@selector( foo )' +# Also applies to @protocol() constructs +sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force + +# force or remove space before a block pointer caret +# '^int (int arg){...}' vs. ' ^int (int arg){...}' +sp_before_oc_block_caret = ignore # ignore/add/remove/force + +# force or remove space after a block pointer caret +# '^int (int arg){...}' vs. '^ int (int arg){...}' +sp_after_oc_block_caret = ignore # ignore/add/remove/force + +# force or remove space between the receiver and selector in a message. +# '[receiver selector ...]' +sp_after_oc_msg_receiver = ignore # ignore/add/remove/force + +# force or remove space after @property. +sp_after_oc_property = ignore # ignore/add/remove/force + +# force or remove space around the ':' in 'b ? t : f' +sp_cond_colon = force # ignore/add/remove/force + +# force or remove space around the '?' in 'b ? t : f' +sp_cond_question = ignore # ignore/add/remove/force + +# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. +sp_case_label = force # ignore/add/remove/force + +# Control the space around the D '..' operator. +sp_range = ignore # ignore/add/remove/force + +# Control the spacing after ':' in 'for (TYPE VAR : EXPR)' (Java) +sp_after_for_colon = ignore # ignore/add/remove/force + +# Control the spacing before ':' in 'for (TYPE VAR : EXPR)' (Java) +sp_before_for_colon = ignore # ignore/add/remove/force + +# Control the spacing in 'extern (C)' (D) +sp_extern_paren = ignore # ignore/add/remove/force + +# Control the space after the opening of a C++ comment '// A' vs '//A' +sp_cmt_cpp_start = force # ignore/add/remove/force + +# Controls the spaces between #else or #endif and a trailing comment +sp_endif_cmt = force # ignore/add/remove/force + +# Controls the spaces after 'new', 'delete', and 'delete[]' +sp_after_new = ignore # ignore/add/remove/force + +# Controls the spaces before a trailing or embedded comment +sp_before_tr_cmt = force # ignore/add/remove/force + +# Number of spaces before a trailing or embedded comment +sp_num_before_tr_cmt = 2 # number + +# Control space between a Java annotation and the open paren. +sp_annotation_paren = ignore # ignore/add/remove/force + +# +# Code alignment (not left column spaces/tabs) +# + +# Whether to keep non-indenting tabs +align_keep_tabs = false # false/true + +# Whether to use tabs for aligning +align_with_tabs = true # false/true + +# Whether to bump out to the next tab when aligning +align_on_tabstop = true # false/true + +# Whether to left-align numbers +# align_number_left = false # false/true + +# Align variable definitions in prototypes and functions +align_func_params = false # false/true + +# Align parameters in single-line functions that have the same name. +# The function names must already be aligned with each other. +align_same_func_call_params = false # false/true + +# The span for aligning variable definitions (0=don't align) +align_var_def_span = 0 # number + +# How to align the star in variable definitions. +# 0=Part of the type 'void * foo;' +# 1=Part of the variable 'void *foo;' +# 2=Dangling 'void *foo;' +align_var_def_star_style = 0 # number + +# How to align the '&' in variable definitions. +# 0=Part of the type +# 1=Part of the variable +# 2=Dangling +align_var_def_amp_style = 0 # number + +# The threshold for aligning variable definitions (0=no limit) +align_var_def_thresh = 0 # number + +# The gap for aligning variable definitions +align_var_def_gap = 0 # number + +# Whether to align the colon in struct bit fields +align_var_def_colon = false # false/true + +# Whether to align any attribute after the variable name +align_var_def_attribute = false # false/true + +# Whether to align inline struct/enum/union variable definitions +align_var_def_inline = false # false/true + +# The span for aligning on '=' in assignments (0=don't align) +align_assign_span = 0 # number + +# The threshold for aligning on '=' in assignments (0=no limit) +align_assign_thresh = 0 # number + +# The span for aligning on '=' in enums (0=don't align) +align_enum_equ_span = 1 # number + +# The threshold for aligning on '=' in enums (0=no limit) +align_enum_equ_thresh = 0 # number + +# The span for aligning struct/union (0=don't align) +align_var_struct_span = 20 # number + +# The threshold for aligning struct/union member definitions (0=no limit) +align_var_struct_thresh = 0 # number + +# The gap for aligning struct/union member definitions +align_var_struct_gap = 0 # number + +# The span for aligning struct initializer values (0=don't align) +align_struct_init_span = 0 # number + +# The minimum space between the type and the synonym of a typedef +align_typedef_gap = 0 # number + +# The span for aligning single-line typedefs (0=don't align) +align_typedef_span = 0 # number + +# How to align typedef'd functions with other typedefs +# 0: Don't mix them at all +# 1: align the open paren with the types +# 2: align the function type name with the other type names +align_typedef_func = 0 # number + +# Controls the positioning of the '*' in typedefs. Just try it. +# 0: Align on typedef type, ignore '*' +# 1: The '*' is part of type name: typedef int *pint; +# 2: The '*' is part of the type, but dangling: typedef int *pint; +align_typedef_star_style = 0 # number + +# Controls the positioning of the '&' in typedefs. Just try it. +# 0: Align on typedef type, ignore '&' +# 1: The '&' is part of type name: typedef int &pint; +# 2: The '&' is part of the type, but dangling: typedef int &pint; +align_typedef_amp_style = 0 # number + +# The span for aligning comments that end lines (0=don't align) +align_right_cmt_span = 2 # number + +# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment +align_right_cmt_mix = false # false/true + +# If a trailing comment is more than this number of columns away from the text it follows, +# it will qualify for being aligned. This has to be > 0 to do anything. +align_right_cmt_gap = 0 # number + +# Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) +align_right_cmt_at_col = 0 # number + +# The span for aligning function prototypes (0=don't align) +align_func_proto_span = 0 # number + +# Minimum gap between the return type and the function name. +align_func_proto_gap = 0 # number + +# Align function protos on the 'operator' keyword instead of what follows +align_on_operator = false # false/true + +# Whether to mix aligning prototype and variable declarations. +# If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. +align_mix_var_proto = false # false/true + +# Align single-line functions with function prototypes, uses align_func_proto_span +align_single_line_func = false # false/true + +# Aligning the open brace of single-line functions. +# Requires align_single_line_func=true, uses align_func_proto_span +align_single_line_brace = false # false/true + +# Gap for align_single_line_brace. +align_single_line_brace_gap = 0 # number + +# The span for aligning ObjC msg spec (0=don't align) +align_oc_msg_spec_span = 0 # number + +# Whether to align macros wrapped with a backslash and a newline. +# This will not work right if the macro contains a multi-line comment. +#align_nl_cont = false # false/true + +# # Align macro functions and variables together +align_pp_define_together = false # false/true + +# The minimum space between label and value of a preprocessor define +align_pp_define_gap = 1 # number + +# The span for aligning on '#define' bodies (0=don't align) +align_pp_define_span = 0 # number + +# Align lines that start with '<<' with previous '<<'. Default=true +align_left_shift = true # false/true + +# Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) +align_oc_msg_colon_span = 0 # number + +# If true, always align with the first parameter, even if it is too short. +align_oc_msg_colon_first = false # false/true + +# Aligning parameters in an Obj-C '+' or '-' declaration on the ':' +align_oc_decl_colon = false # false/true + +# +# Newline forceing and removing options +# + +# Whether to collapse empty blocks between '{' and '}' +nl_collapse_empty_body = false # false/true + +# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' +nl_assign_leave_one_liners = true # false/true + +# Don't split one-line braced statements inside a class xx { } body +nl_class_leave_one_liners = true # false/true + +# Don't split one-line enums: 'enum foo { BAR = 15 };' +nl_enum_leave_one_liners = true # false/true + +# Don't split one-line get or set functions +nl_getset_leave_one_liners = true # false/true + +# Don't split one-line function definitions - 'int foo() { return 0; }' +nl_func_leave_one_liners = true # false/true + +# Don't split one-line if/else statements - 'if(a) b++;' +nl_if_leave_one_liners = true # false/true + +# Don't split one-line OC messages +nl_oc_msg_leave_one_liner = false # false/true + +# force or remove newlines at the start of the file +nl_start_of_file = remove # ignore/add/remove/force + +# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' +nl_start_of_file_min = 0 # number + +# force or remove newline at the end of the file +nl_end_of_file = force # ignore/add/remove/force + +# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') +nl_end_of_file_min = 1 # number + +# force or remove newline between '=' and '{' +nl_assign_brace = remove # ignore/add/remove/force + +# force or remove newline between '=' and '[' (D only) +nl_assign_square = remove # ignore/add/remove/force + +# force or remove newline after '= [' (D only). Will also affect the newline before the ']' +nl_after_square_assign = ignore # ignore/add/remove/force + +# The number of blank lines after a block of variable definitions at the top of a function body +# 0 = No change (default) +# nl_func_var_def_blk = 0 # number +nl_var_def_blk_end_func_top = 0 + +# The number of newlines before a block of typedefs +# 0 = No change (default) +nl_typedef_blk_start = 0 # number + +# The number of newlines after a block of typedefs +# 0 = No change (default) +nl_typedef_blk_end = 0 # number + +# The maximum consecutive newlines within a block of typedefs +# 0 = No change (default) +nl_typedef_blk_in = 0 # number + +# The number of newlines before a block of variable definitions not at the top of a function body +# 0 = No change (default) +nl_var_def_blk_start = 0 # number + +# The number of newlines after a block of variable definitions not at the top of a function body +# 0 = No change (default) +nl_var_def_blk_end = 0 # number + +# The maximum consecutive newlines within a block of variable definitions +# 0 = No change (default) +nl_var_def_blk_in = 0 # number + +# force or remove newline between a function call's ')' and '{', as in: +# list_for_each(item, &list) { } +nl_fcall_brace = remove # ignore/add/remove/force + +# force or remove newline between 'enum' and '{' +nl_enum_brace = remove # ignore/add/remove/force + +# force or remove newline between 'struct and '{' +nl_struct_brace = remove # ignore/add/remove/force + +# force or remove newline between 'union' and '{' +nl_union_brace = remove # ignore/add/remove/force + +# force or remove newline between 'if' and '{' +nl_if_brace = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'else' +nl_brace_else = remove # ignore/add/remove/force + +# force or remove newline between 'else if' and '{' +# If set to ignore, nl_if_brace is used instead +nl_elseif_brace = remove # ignore/add/remove/force + +# force or remove newline between 'else' and '{' +nl_else_brace = remove # ignore/add/remove/force + +# force or remove newline between 'else' and 'if' +nl_else_if = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'finally' +nl_brace_finally = remove # ignore/add/remove/force + +# force or remove newline between 'finally' and '{' +nl_finally_brace = remove # ignore/add/remove/force + +# force or remove newline between 'try' and '{' +nl_try_brace = remove # ignore/add/remove/force + +# force or remove newline between get/set and '{' +nl_getset_brace = ignore # ignore/add/remove/force + +# force or remove newline between 'for' and '{' +nl_for_brace = remove # ignore/add/remove/force + +# force or remove newline between 'catch' and '{' +nl_catch_brace = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'catch' +nl_brace_catch = remove # ignore/add/remove/force + +# force or remove newline between 'while' and '{' +nl_while_brace = remove # ignore/add/remove/force + +# force or remove newline between 'scope (x)' and '{' (D) +nl_scope_brace = remove # ignore/add/remove/force + +# force or remove newline between 'unittest' and '{' (D) +nl_unittest_brace = remove # ignore/add/remove/force + +# force or remove newline between 'version (x)' and '{' (D) +nl_version_brace = remove # ignore/add/remove/force + +# force or remove newline between 'using' and '{' +nl_using_brace = remove # ignore/add/remove/force + +# force or remove newline between two open or close braces. +# Due to general newline/brace handling, REMOVE may not work. +nl_brace_brace = force # ignore/add/remove/force + +# force or remove newline between 'do' and '{' +nl_do_brace = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'while' of 'do' statement +nl_brace_while = remove # ignore/add/remove/force + +# force or remove newline between 'switch' and '{' +nl_switch_brace = remove # ignore/add/remove/force + +# force a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. +# Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. +nl_multi_line_cond = false # false/true + +# Force a newline in a define after the macro name for multi-line defines. +nl_multi_line_define = false # false/true + +# Whether to put a newline before 'case' statement +nl_before_case = false # false/true + +# force or remove newline between ')' and 'throw' +nl_before_throw = remove # ignore/add/remove/force + +# Whether to put a newline after 'case' statement +nl_after_case = false # false/true + +# force or remove a newline between a case ':' and '{'. Overrides nl_after_case. +nl_case_colon_brace = remove # ignore/add/remove/force + +# Newline between namespace and { +nl_namespace_brace = remove # ignore/add/remove/force + +# force or remove newline between 'template<>' and whatever follows. +nl_template_class = force # ignore/add/remove/force + +# force or remove newline between 'class' and '{' +nl_class_brace = force # ignore/add/remove/force + +# force or remove newline after each ',' in the constructor member initialization +nl_class_init_args = ignore # ignore/add/remove/force + +# force or remove newline between return type and function name in a function definition +nl_func_type_name = ignore # ignore/add/remove/force + +# force or remove newline between return type and function name inside a class {} +# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. +nl_func_type_name_class = ignore # ignore/add/remove/force + +# force or remove newline between function scope and name in a definition +# Controls the newline after '::' in 'void A::f() { }' +nl_func_scope_name = ignore # ignore/add/remove/force + +# force or remove newline between return type and function name in a prototype +nl_func_proto_type_name = ignore # ignore/add/remove/force + +# force or remove newline between a function name and the opening '(' +nl_func_paren = ignore # ignore/add/remove/force + +# force or remove newline between a function name and the opening '(' in the definition +nl_func_def_paren = ignore # ignore/add/remove/force + +# force or remove newline after '(' in a function declaration +nl_func_decl_start = ignore # ignore/add/remove/force + +# force or remove newline after '(' in a function definition +nl_func_def_start = ignore # ignore/add/remove/force + +# Overrides nl_func_decl_start when there is only one parameter. +nl_func_decl_start_single = ignore # ignore/add/remove/force + +# Overrides nl_func_def_start when there is only one parameter. +nl_func_def_start_single = ignore # ignore/add/remove/force + +# force or remove newline after each ',' in a function declaration +nl_func_decl_args = ignore # ignore/add/remove/force + +# force or remove newline after each ',' in a function definition +nl_func_def_args = ignore # ignore/add/remove/force + +# force or remove newline before the ')' in a function declaration +nl_func_decl_end = remove # ignore/add/remove/force + +# force or remove newline before the ')' in a function definition +nl_func_def_end = remove # ignore/add/remove/force + +# Overrides nl_func_decl_end when there is only one parameter. +nl_func_decl_end_single = ignore # ignore/add/remove/force + +# Overrides nl_func_def_end when there is only one parameter. +nl_func_def_end_single = ignore # ignore/add/remove/force + +# force or remove newline between '()' in a function declaration. +nl_func_decl_empty = remove # ignore/add/remove/force + +# force or remove newline between '()' in a function definition. +nl_func_def_empty = remove # ignore/add/remove/force + +# Whether to put each OC message parameter on a separate line +# See nl_oc_msg_leave_one_liner +nl_oc_msg_args = false # false/true + +# force or remove newline between function signature and '{' +nl_fdef_brace = add # ignore/add/remove/force + +# force or remove a newline between the return keyword and return expression. +nl_return_expr = ignore # ignore/add/remove/force + +# Whether to put a newline after semicolons, except in 'for' statements +nl_after_semicolon = false # false/true + +# Whether to put a newline after brace open. +# This also forces a newline before the matching brace close. +nl_after_brace_open = false # false/true + +# If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is +# placed between the open brace and a trailing single-line comment. +nl_after_brace_open_cmt = false # false/true + +# Whether to put a newline after a virtual brace open with a non-empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open = false # false/true + +# Whether to put a newline after a virtual brace open with an empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open_empty = false # false/true + +# Whether to put a newline after a brace close. +# Does not apply if followed by a necessary ';'. +nl_after_brace_close = false # false/true + +# Whether to put a newline after a virtual brace close. +# Would force a newline before return in: 'if (foo) a++; return;' +nl_after_vbrace_close = true # false/true + +# Control the newline between the close brace and 'b' in: 'struct { int a; } b;' +# Affects enums, unions, and structures. If set to ignore, uses nl_after_brace_close +nl_brace_struct_var = ignore # ignore/add/remove/force + +# Whether to alter newlines in '#define' macros +nl_define_macro = false # false/true + +# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' +nl_squeeze_ifdef = false # false/true + +# force or remove blank line before 'if' +nl_before_if = ignore # ignore/add/remove/force + +# force or remove blank line after 'if' statement +nl_after_if = ignore # ignore/add/remove/force + +# force or remove blank line before 'for' +nl_before_for = ignore # ignore/add/remove/force + +# force or remove blank line after 'for' statement +nl_after_for = ignore # ignore/add/remove/force + +# force or remove blank line before 'while' +nl_before_while = ignore # ignore/add/remove/force + +# force or remove blank line after 'while' statement +nl_after_while = ignore # ignore/add/remove/force + +# force or remove blank line before 'switch' +nl_before_switch = ignore # ignore/add/remove/force + +# force or remove blank line after 'switch' statement +nl_after_switch = ignore # ignore/add/remove/force + +# force or remove blank line before 'do' +nl_before_do = ignore # ignore/add/remove/force + +# force or remove blank line after 'do/while' statement +nl_after_do = ignore # ignore/add/remove/force + +# Whether to double-space commented-entries in struct/enum +nl_ds_struct_enum_cmt = false # false/true + +# Whether to double-space before the close brace of a struct/union/enum +# (lower priority than 'eat_blanks_before_close_brace') +nl_ds_struct_enum_close_brace = false # false/true + +# force or remove a newline around a class colon. +# Related to pos_class_colon, nl_class_init_args, and pos_comma. +nl_class_colon = ignore # ignore/add/remove/force + +# Change simple unbraced if statements into a one-liner +# 'if(b)\n i++;' => 'if(b) i++;' +nl_create_if_one_liner = false # false/true + +# Change simple unbraced for statements into a one-liner +# 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' +nl_create_for_one_liner = false # false/true + +# Change simple unbraced while statements into a one-liner +# 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' +nl_create_while_one_liner = false # false/true + +# +# Positioning options +# + +# The position of arithmetic operators in wrapped expressions +pos_arith = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of assignment in wrapped expressions. +# Do not affect '=' followed by '{' +pos_assign = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of boolean operators in wrapped expressions +pos_bool = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of comparison operators in wrapped expressions +pos_compare = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of conditional (b ? t : f) operators in wrapped expressions +pos_conditional = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in wrapped expressions +pos_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in the constructor initialization list +pos_class_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of colons between constructor and member initialization +pos_class_colon = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# +# Line Splitting options +# + +# Try to limit code width to N number of columns +code_width = 120 # number + +# Whether to fully split long 'for' statements at semi-colons +ls_for_split_full = true # false/true + +# Whether to fully split long function protos/calls at commas +ls_func_split_full = true # false/true + +# Whether to split lines as close to code_width as possible and ignore some groupings +ls_code_width = false # false/true + +# +# Blank line options +# + +# The maximum consecutive newlines +nl_max = 2 # number + +# The number of newlines after a function prototype, if followed by another function prototype +nl_after_func_proto = 0 # number + +# The number of newlines after a function prototype, if not followed by another function prototype +nl_after_func_proto_group = 0 # number + +# The number of newlines after '}' of a multi-line function body +nl_after_func_body = 0 # number + +# The number of newlines after '}' of a multi-line function body in a class declaration +nl_after_func_body_class = 0 # number + +# The number of newlines after '}' of a single line function body +nl_after_func_body_one_liner = 0 # number + +# The minimum number of newlines before a multi-line comment. +# Doesn't apply if after a brace open or another multi-line comment. +nl_before_block_comment = 0 # number + +# The minimum number of newlines before a single-line C comment. +# Doesn't apply if after a brace open or other single-line C comments. +nl_before_c_comment = 0 # number + +# The minimum number of newlines before a CPP comment. +# Doesn't apply if after a brace open or other CPP comments. +nl_before_cpp_comment = 0 # number + +# Whether to force a newline after a multi-line comment. +nl_after_multiline_comment = false # false/true + +# The number of newlines after '}' or ';' of a struct/enum/union definition +nl_after_struct = 0 # number + +# The number of newlines after '}' or ';' of a class definition +nl_after_class = 1 # number + +# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# Will not change the newline count if after a brace open. +# 0 = No change. +nl_before_access_spec = 2 # number + +# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# 0 = No change. +nl_after_access_spec = 0 # number + +# The number of newlines between a function def and the function comment. +# 0 = No change. +nl_comment_func_def = 0 # number + +# The number of newlines after a try-catch-finally block that isn't followed by a brace close. +# 0 = No change. +nl_after_try_catch_finally = 0 # number + +# The number of newlines before and after a property, indexer or event decl. +# 0 = No change. +nl_around_cs_property = 0 # number + +# The number of newlines between the get/set/add/remove handlers in C#. +# 0 = No change. +nl_between_get_set = 0 # number + +# force or remove newline between C# property and the '{' +nl_property_brace = ignore # ignore/add/remove/force + +# Whether to remove blank lines after '{' +eat_blanks_after_open_brace = true # false/true + +# Whether to remove blank lines before '}' +eat_blanks_before_close_brace = true # false/true + +# How aggressively to remove extra newlines not in preproc. +# 0: No change +# 1: Remove most newlines not handled by other config +# 2: Remove all newlines and reformat completely by config +nl_remove_extra_newlines = 0 # number + +# Whether to put a blank line before 'return' statements, unless after an open brace. +nl_before_return = false # false/true + +# Whether to put a blank line after 'return' statements, unless followed by a close brace. +nl_after_return = false # false/true + +# Whether to put a newline after a Java annotation statement. +# Only affects annotations that are after a newline. +nl_after_annotation = ignore # ignore/add/remove/force + +# Controls the newline between two annotations. +nl_between_annotation = ignore # ignore/add/remove/force + +# +# Code modifying options (non-whitespace) +# + +# force or remove braces on single-line 'do' statement +mod_full_brace_do = ignore # ignore/add/remove/force + +# force or remove braces on single-line 'for' statement +mod_full_brace_for = force # ignore/add/remove/force + +# force or remove braces on single-line function definitions. (Pawn) +mod_full_brace_function = ignore # ignore/add/remove/force + +# force or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. +mod_full_brace_if = force # ignore/add/remove/force + +# Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. +# If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. +mod_full_brace_if_chain = 0 + +# Don't remove braces around statements that span N newlines +mod_full_brace_nl = 0 # number + +# force or remove braces on single-line 'while' statement +mod_full_brace_while = force # ignore/add/remove/force + +# force or remove braces on single-line 'using ()' statement +mod_full_brace_using = ignore # ignore/add/remove/force + +# force or remove unnecessary paren on 'return' statement +mod_paren_on_return = remove # ignore/add/remove/force + +# Whether to change optional semicolons to real semicolons +mod_pawn_semicolon = false # false/true + +# force parens on 'while' and 'if' statement around bools +mod_full_paren_if_bool = true # false/true + +# Whether to remove superfluous semicolons +mod_remove_extra_semicolon = true # false/true + +# If a function body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be forceed. +mod_add_long_function_closebrace_comment = 0 # number + +# If a switch body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be forceed. +mod_add_long_switch_closebrace_comment = 0 # number + +# If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after +# the #endif, a comment will be forceed. +mod_add_long_ifdef_endif_comment = 0 # number + +# If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after +# the #else, a comment will be forceed. +mod_add_long_ifdef_else_comment = 10 # number + +# If TRUE, will sort consecutive single-line 'import' statements [Java, D] +mod_sort_import = false # false/true + +# If TRUE, will sort consecutive single-line 'using' statements [C#] +mod_sort_using = true # false/true + +# If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] +# This is generally a bad idea, as it may break your code. +mod_sort_include = true # false/true + +# If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. +mod_move_case_break = false # false/true + +# Will force or remove the braces around a fully braced case statement. +# Will only remove the braces if there are no variable declarations in the block. +mod_case_brace = ignore # ignore/add/remove/force + +# If TRUE, it will remove a void 'return;' that appears as the last statement in a function. +mod_remove_empty_return = true # false/true + +# +# Comment modifications +# + +# Try to wrap comments at cmt_width columns +cmt_width = 0 # number + +# Set the comment reflow mode (default: 0) +# 0: no reflowing (apart from the line wrapping due to cmt_width) +# 1: no touching at all +# 2: full reflow +cmt_reflow_mode = 0 # number + +# If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. +# Default is true. +cmt_indent_multi = true # false/true + +# Whether to group c-comments that look like they are in a block +cmt_c_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined c-comment +cmt_c_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined c-comment +cmt_c_nl_end = false # false/true + +# Whether to group cpp-comments that look like they are in a block +cmt_cpp_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined cpp-comment +cmt_cpp_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined cpp-comment +cmt_cpp_nl_end = false # false/true + +# Whether to change cpp-comments into c-comments +cmt_cpp_to_c = false # false/true + +# Whether to put a star on subsequent comment lines +cmt_star_cont = false # false/true + +# The number of spaces to insert at the start of subsequent comment lines +cmt_sp_before_star_cont = 0 # number + +# The number of spaces to insert after the star on subsequent comment lines +cmt_sp_after_star_cont = 0 # number + +# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of +# the comment are the same length. Default=True +cmt_multi_check_last = false # false/true + +# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. +# Will substitute $(filename) with the current file's name. +cmt_insert_file_header = "" # string + +# The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. +# Will substitute $(filename) with the current file's name. +cmt_insert_file_footer = "" # string + +# The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. +# Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. +# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } +cmt_insert_func_header = "" # string + +# The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. +# Will substitute $(class) with the class name. +cmt_insert_class_header = "" # string + +# The filename that contains text to insert before a Obj-C message specification if the method isn't preceded with a C/C++ comment. +# Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff. +cmt_insert_oc_msg_header = "" # string + +# If a preprocessor is encountered when stepping backwards from a function name, then +# this option decides whether the comment should be inserted. +# Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. +cmt_insert_before_preproc = false # false/true + +# +# Preprocessor options +# + +# Control indent of preprocessors inside #if blocks at brace level 0 +pp_indent = remove # ignore/add/remove/force + +# Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) +pp_indent_at_level = false # false/true + +# If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. +pp_indent_count = 2 # number + +# force or remove space after # based on pp_level of #if blocks +pp_space_after = add # ignore/add/remove/force + +# Sets the number of spaces forceed with pp_space +pp_space_count = 1 # number + +# The indent for #region and #endregion in C# and '#pragma region' in C/C++ +pp_indent_region = 0 # number + +# Whether to indent the code between #region and #endregion +pp_region_indent_code = false # false/true + +# If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level +pp_indent_if = 1 # number + +# Control whether to indent the code between #if, #else and #endif when not at file-level +pp_if_indent_code = false # false/true + +# Whether to indent '#define' at the brace level (true) or from column 1 (false) +pp_define_at_level = true # false/true + +# You can force a token to be a type with the 'type' option. +# Example: +# type myfoo1 myfoo2 +# +# You can create custom macro-based indentation using macro-open, +# macro-else and macro-close. +# Example: +# macro-open BEGIN_TEMPLATE_MESSAGE_MAP +# macro-open BEGIN_MESSAGE_MAP +# macro-close END_MESSAGE_MAP +# +# You can assign any keyword to any type with the set option. +# set func_call_user _ N_ +# +# The full syntax description of all custom definition config entries +# is shown below: +# +# define custom tokens as: +# - embed whitespace in token using '' escape character, or +# put token in quotes +# - these: ' " and ` are recognized as quote delimiters +# +# type token1 token2 token3 ... +# ^ optionally specify multiple tokens on a single line +# define def_token output_token +# ^ output_token is optional, then NULL is assumed +# macro-open token +# macro-close token +# macro-else token +# set id token1 token2 ... +# ^ optionally specify multiple tokens on a single line +# ^ id is one of the names in token_enum.h sans the CT_ prefix, +# e.g. PP_PRAGMA +# +# all tokens are separated by any mix of ',' commas, '=' equal signs +# and whitespace (space, tab) +# From c067aff9ace9c58daf3488d34fc83b7c20009a2a Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 12 Aug 2024 13:37:14 +0200 Subject: [PATCH 33/83] Update executable bit for INSTALL --- INSTALL | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 INSTALL diff --git a/INSTALL b/INSTALL old mode 100755 new mode 100644 From a1a4d208c1203d2ded6fb3eee91553933348bc0d Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 12 Aug 2024 13:43:34 +0200 Subject: [PATCH 34/83] Remove space after sizeof --- src/shc.c | 14 +++++++------- uncrustify.cfg | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/shc.c b/src/shc.c index 20ed4c3..6f7d1b5 100644 --- a/src/shc.c +++ b/src/shc.c @@ -771,7 +771,7 @@ static int parse_an_arg(int argc, char *argv[]) switch (getopt(argc, argv, opts)) { case 'e': - memset(tmp, 0, sizeof (tmp)); + memset(tmp, 0, sizeof(tmp)); cnt = sscanf(optarg, "%2d/%2d/%4d%c", &tmp->tm_mday, &tmp->tm_mon, &tmp->tm_year, &ctrl); if (cnt == 3) { @@ -784,7 +784,7 @@ static int parse_an_arg(int argc, char *argv[]) my_name, optarg); return -1; } - snprintf(date, sizeof (date), "%lld", (long long)expdate); // NOLINT + snprintf(date, sizeof(date), "%lld", (long long)expdate); // NOLINT if (verbose) { fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); } expdate = atoll(date); if (verbose) { fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); } @@ -980,7 +980,7 @@ int key_with_file(char *file) } /* Turn on stable fields */ - memset(control, 0, sizeof (control)); + memset(control, 0, sizeof(control)); control->st_ino = statf->st_ino; control->st_dev = statf->st_dev; control->st_rdev = statf->st_rdev; @@ -989,7 +989,7 @@ int key_with_file(char *file) control->st_size = statf->st_size; control->st_mtime = statf->st_mtime; control->st_ctime = statf->st_ctime; - key(control, sizeof (control)); + key(control, sizeof(control)); return 0; } @@ -1173,7 +1173,7 @@ unsigned rand_mod(unsigned mod) char rand_chr(void) { - return (char)rand_mod(1 << (sizeof (char) << 3)); + return (char)rand_mod(1 << (sizeof(char) << 3)); } int noise(char *ptr, unsigned min, unsigned xtra, int str) @@ -1246,7 +1246,7 @@ void cleanup_write_c(char *msg1, char *msg2, char *chk1, char *chk2, char *tst1, int write_C(char *file, char *argv[]) { char pswd[256]; - int pswd_z = sizeof (pswd); + int pswd_z = sizeof(pswd); char *msg1 = strdup("has expired!\n"); int msg1_z = strlen(msg1) + 1; int date_z = strlen(date) + 1; @@ -1261,7 +1261,7 @@ int write_C(char *file, char *argv[]) int chk1_z = tst1_z; char *msg2 = strdup("abnormal behavior!"); int msg2_z = strlen(msg2) + 1; - int rlax_z = sizeof (rlax); + int rlax_z = sizeof(rlax); int opts_z = strlen(opts) + 1; int text_z = strlen(text) + 1; char *tst2 = strdup("shell has changed!"); diff --git a/uncrustify.cfg b/uncrustify.cfg index 56a5883..db65685 100644 --- a/uncrustify.cfg +++ b/uncrustify.cfg @@ -446,7 +446,7 @@ sp_inside_paren_cast = remove # ignore/add/remove/force sp_cpp_cast_paren = force # ignore/add/remove/force # force or remove space between 'sizeof' and '(' -sp_sizeof_paren = force # ignore/add/remove/force +sp_sizeof_paren = remove # ignore/add/remove/force # force or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force From 7b6b7f5844ac33274e54f5acdf504079c168942b Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 12 Aug 2024 13:54:51 +0200 Subject: [PATCH 35/83] Format code before merging --- .pre-commit-config.yaml | 101 +++ src/shc.c | 1817 ++++++++++++++++++++------------------- uncrustify.cfg | 1579 ++++++++++++++++++++++++++++++++++ 3 files changed, 2607 insertions(+), 890 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 uncrustify.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..bd69aee --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,101 @@ +--- +exclude: + (?x)^( + configure| + configure\..*| + .cache/.*| + .*Makefile.in| + .*Makefile.am| + autogen.sh| + config/install-sh| + config/depcomp| + config/compile| + config/missing| + aclocal.m4| + __NONE__)$ +repos: + - repo: https://github.com/executablebooks/mdformat + # Do this before other tools "fixing" the line endings + rev: 0.7.17 + hooks: + - id: mdformat + name: Format Markdown + stages: [manual] + entry: mdformat # Executable to run, with fixed options + language: python + types: [markdown] + args: [--wrap, '75', --number] + additional_dependencies: + - mdformat-toc + - mdformat-gfm + - mdformat-beautysh + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + # - id: no-commit-to-branch + # args: [--branch, main] + - id: debug-statements + - id: end-of-file-fixer + exclude: ^(test/.*)$ + - id: trailing-whitespace + exclude: .*\.md$ + - id: check-json + - id: mixed-line-ending + - id: check-builtin-literals + args: [--ignore=dict] + - id: check-ast + - id: check-merge-conflict + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + exclude: ^(test/.*)$ + - id: check-docstring-first + - id: fix-byte-order-marker + - id: check-case-conflict + - id: check-toml + - repo: https://github.com/lovesegfault/beautysh.git + rev: v6.2.1 + hooks: + - id: beautysh + exclude: (?x)^(test/.*|config/missing|configure|autogen.sh)$ + additional_dependencies: + - setuptools + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + args: + - --toml + - pyproject.toml + additional_dependencies: + - tomli + - repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + # Install dependencies on windows: + # choco install llvm uncrustify cppcheck + hooks: + - id: uncrustify + args: [--replace, --no-backup, -c, uncrustify.cfg] + - id: cppcheck + args: + - --force + #- --std=c99 + - --language=c + #- -IInc + - '--template={file}({line}): {severity} ({id}): {message}' + - --inline-suppr + - id: cpplint + args: ["--filter=-build/header_guard,-build/include,-build/include_subdir,-legal/copyright,-readability/casting,-readability/fn_size,-whitespace/blank_line,-whitespace/braces,-whitespace/comma,-whitespace/comments,-whitespace/line_length,-whitespace/newline,-whitespace/operators,-whitespace/parens,-whitespace/semicolon,-whitespace/tab,-whitespace/todo"] + additional_dependencies: + - cpplint>=1.6.1 + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 + hooks: + - id: shellcheck + exclude: (?x)^(test/.*)$ + # args: [-x,-e1007,-e1009,-e1072,-e1073] + - repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + hooks: + - id: clang-format + stages: [manual] + args: [-i] diff --git a/src/shc.c b/src/shc.c index 9b1a112..005dcd7 100644 --- a/src/shc.c +++ b/src/shc.c @@ -12,100 +12,101 @@ * Date: 21 May 1996 10:49:37 -0400 * And it is licensed also under GPL. * - *That's where I got it, now I am going to do some work on it - *It will reside here: http://github.com/neurobin/shc + * That's where I got it, now I am going to do some work on it + * It will reside here: http://github.com/neurobin/shc */ static const char my_name[] = "shc"; static const char version[] = "Version 4.0.3"; static const char subject[] = "Generic Shell Script Compiler"; static const char cpright[] = "GNU GPL Version 3"; -static const struct { const char * f, * s, * e; } - provider = { "Md Jahidul", "Hamid", "" }; +static const struct {const char *f, *s, *e;} +provider = { "Md Jahidul", "Hamid", "" }; -/* -static const struct { const char * f, * s, * e; } - author = { "Francisco", "Garcia", "" }; -*/ +/* + static const struct { const char * f, * s, * e; } + author = { "Francisco", "Garcia", "" }; + */ /*This is the original author who first came up with this*/ -static const char * copying[] = { -"Copying:", -"", -" This program is free software; you can redistribute it and/or modify", -" it under the terms of the GNU General Public License as published by", -" the Free Software Foundation; either version 3 of the License, or", -" (at your option) any later version.", -"", -" This program is distributed in the hope that it will be useful,", -" but WITHOUT ANY WARRANTY; without even the implied warranty of", -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", -" GNU General Public License for more details.", -"", -" You should have received a copy of the GNU General Public License", -" along with this program; if not, write to the Free Software", -" @Neurobin, Dhaka, Bangladesh", -"", -" Report problems and questions to:http://github.com/neurobin/shc", -"", -0}; +static const char *copying[] = { + "Copying:", + "", + " This program is free software; you can redistribute it and/or modify", + " it under the terms of the GNU General Public License as published by", + " the Free Software Foundation; either version 3 of the License, or", + " (at your option) any later version.", + "", + " This program is distributed in the hope that it will be useful,", + " but WITHOUT ANY WARRANTY; without even the implied warranty of", + " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", + " GNU General Public License for more details.", + "", + " You should have received a copy of the GNU General Public License", + " along with this program; if not, write to the Free Software", + " @Neurobin, Dhaka, Bangladesh", + "", + " Report problems and questions to:http://github.com/neurobin/shc", + "", + 0 +}; -static const char * abstract[] = { -"Abstract:", -"", -" This tool generates a stripped binary executable version", -" of the script specified at command line.", -"", -" Binary version will be saved with a .x extension by default.", -" You can specify output file name too with [-o filname] option.", -"", -" You can specify expiration date [-e] too, after which binary will", -" refuse to be executed, displaying \"[-m]\" instead.", -"", -" You can compile whatever interpreted script, but valid [-i], [-x]", -" and [-l] options must be given.", -"", -0}; +static const char *abstract[] = { + "Abstract:", + "", + " This tool generates a stripped binary executable version", + " of the script specified at command line.", + "", + " Binary version will be saved with a .x extension by default.", + " You can specify output file name too with [-o filname] option.", + "", + " You can specify expiration date [-e] too, after which binary will", + " refuse to be executed, displaying \"[-m]\" instead.", + "", + " You can compile whatever interpreted script, but valid [-i], [-x]", + " and [-l] options must be given.", + "", + 0 +}; -static const char usage[] = -"Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHPCAB2h] -f script"; +static const char usage[] = + "Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHPCAB2h] -f script"; -static const char * help[] = { -"", -" -e %s Expiration date in dd/mm/yyyy format [none]", -" -m %s Message to display upon expiration [\"Please contact your provider\"]", -" -f %s File name of the script to compile", -" -i %s Inline option for the shell interpreter i.e: -e", -" -x %s eXec command, as a printf format i.e: exec('%s',@ARGV);", -" -l %s Last shell option i.e: --", -" -o %s output filename", -" -r Relax security. Make a redistributable binary", -" -v Verbose compilation", -" -S Switch ON setuid for root callable programs [OFF]", -" -D Switch ON debug exec calls [OFF]", -" -U Make binary untraceable [no]", -" -H Hardening : extra security protection [no]", -" Require bourne shell (sh) and parameters are not supported", -" -P Submit script as a pipe [no]", -" -C Display license and exit", -" -A Display abstract and exit", -" -B Compile for busybox", -" -2 Use the system call mmap2", -" -h Display help and exit", -"", -" Environment variables used:", -" Name Default Usage", -" CC cc C compiler command", -" STRIP strip Strip command", -" CFLAGS C compiler flags", -" LDFLAGS Linker flags", -"", -" Please consult the shc man page.", -"", -0}; +static const char *help[] = { + "", + " -e %s Expiration date in dd/mm/yyyy format [none]", + " -m %s Message to display upon expiration [\"Please contact your provider\"]", + " -f %s File name of the script to compile", + " -i %s Inline option for the shell interpreter i.e: -e", + " -x %s eXec command, as a printf format i.e: exec('%s',@ARGV);", + " -l %s Last shell option i.e: --", + " -o %s output filename", + " -r Relax security. Make a redistributable binary", + " -v Verbose compilation", + " -S Switch ON setuid for root callable programs [OFF]", + " -D Switch ON debug exec calls [OFF]", + " -U Make binary untraceable [no]", + " -H Hardening : extra security protection [no]", + " Require bourne shell (sh) and parameters are not supported", + " -P Submit script as a pipe [no]", + " -C Display license and exit", + " -A Display abstract and exit", + " -B Compile for busybox", + " -2 Use the system call mmap2", + " -h Display help and exit", + "", + " Environment variables used:", + " Name Default Usage", + " CC cc C compiler command", + " STRIP strip Strip command", + " CFLAGS C compiler flags", + " LDFLAGS Linker flags", + "", + " Please consult the shc man page.", + "", + 0 +}; -#include -#include #include #include #include @@ -115,691 +116,694 @@ static const char * help[] = { #include #include #include +#include +#include #include #include #define SIZE 4096 -static char * file; -static char * file2; -static char date[21]; -static char * mail = "Please contact your provider jahidulhamid@yahoo.com"; -static char rlax[1]; -static char * shll; -static char * inlo; -static char * xecc; -static char * lsto; -static char * opts; -static char * text; +static char *file; +static char *file2; +static char date[21]; +static char *mail = "Please contact your provider jahidulhamid@yahoo.com"; +static char rlax[1]; +static char *shll; +static char *inlo; +static char *xecc; +static char *lsto; +static char *opts; +static char *text; static int verbose; static const char SETUID_line[] = -"#define SETUID %d /* Define as 1 to call setuid(0) at start of script */\n"; + "#define SETUID %d /* Define as 1 to call setuid(0) at start of script */\n"; static int SETUID_flag = 0; static const char DEBUGEXEC_line[] = -"#define DEBUGEXEC %d /* Define as 1 to debug execvp calls */\n"; + "#define DEBUGEXEC %d /* Define as 1 to debug execvp calls */\n"; static int DEBUGEXEC_flag = 0; static const char TRACEABLE_line[] = -"#define TRACEABLE %d /* Define as 1 to enable ptrace the executable */\n"; + "#define TRACEABLE %d /* Define as 1 to enable ptrace the executable */\n"; static int TRACEABLE_flag = 1; static const char HARDENING_line[] = -"#define HARDENING %d /* Define as 1 to disable ptrace/dump the executable */\n"; + "#define HARDENING %d /* Define as 1 to disable ptrace/dump the executable */\n"; static int HARDENING_flag = 0; static const char MMAP2_line[] = -"#define MMAP2 %d /* Define as 1 to use syscall mmap2 */\n"; + "#define MMAP2 %d /* Define as 1 to use syscall mmap2 */\n"; static int MMAP2_flag = 0; static const char BUSYBOXON_line[] = -"#define BUSYBOXON %d /* Define as 1 to enable work with busybox */\n"; + "#define BUSYBOXON %d /* Define as 1 to enable work with busybox */\n"; static int BUSYBOXON_flag = 0; static const char PIPESCRIPT_line[] = -"#define PIPESCRIPT %d /* Define as 1 to submit script as a pipe */\n"; + "#define PIPESCRIPT %d /* Define as 1 to submit script as a pipe */\n"; static int PIPESCRIPT_flag = 0; -static const char * RTC[] = { -"", -"#if HARDENING", -"static const char * shc_x[] = {", -"\"/*\",", -"\" * Copyright 2019 - Intika \",", -"\" * Replace ******** with secret read from fd 21\",", -"\" * Also change arguments location of sub commands (sh script commands)\",", -"\" * gcc -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",", -"\" */\",", -"\"\",", -"\"#define _GNU_SOURCE /* needed to get RTLD_NEXT defined in dlfcn.h */\",", -"\"#define PLACEHOLDER \\\"********\\\"\",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"\",", -"\"static char secret[128000]; //max size\",", -"\"typedef int (*pfi)(int, char **, char **);\",", -"\"static pfi real_main;\",", -"\"\",", -"\"// copy argv to new location\",", -"\"char **copyargs(int argc, char** argv){\",", -"\" char **newargv = malloc((argc+1)*sizeof(*argv));\",", -"\" char *from,*to;\",", -"\" int i,len;\",", -"\"\",", -"\" for(i = 0; i 0) {\",", -"\" int i;\",", -"\"\",", -"\" if (secret[n - 1] == '\\\\n') secret[--n] = '\\\\0';\",", -"\" for (i = 1; i < argc; i++)\",", -"\" if (strcmp(argv[i], PLACEHOLDER) == 0)\",", -"\" argv[i] = secret;\",", -"\" }\",", -"\"\",", -"\" real_main = main;\",", -"\"\",", -"\" return real___libc_start_main(mymain, argc, argv, init, fini, rtld_fini, stack_end);\",", -"\"}\",", -"\"\",", -"0};", -"#endif /* HARDENING */", -"", -"/* rtc.c */", -"", -"#include ", -"#include ", -"#include ", -"", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"/* 'Alleged RC4' */", -"", -"static unsigned char stte[256], indx, jndx, kndx;", -"", -"/*", -" * Reset arc4 stte. ", -" */", -"void stte_0(void)", -"{", -" indx = jndx = kndx = 0;", -" do {", -" stte[indx] = indx;", -" } while (++indx);", -"}", -"", -"/*", -" * Set key. Can be used more than once. ", -" */", -"void key(void * str, int len)", -"{", -" unsigned char tmp, * ptr = (unsigned char *)str;", -" while (len > 0) {", -" do {", -" tmp = stte[indx];", -" kndx += tmp;", -" kndx += ptr[(int)indx % len];", -" stte[indx] = stte[kndx];", -" stte[kndx] = tmp;", -" } while (++indx);", -" ptr += 256;", -" len -= 256;", -" }", -"}", -"", -"/*", -" * Crypt data. ", -" */", -"void arc4(void * str, int len)", -"{", -" unsigned char tmp, * ptr = (unsigned char *)str;", -" while (len > 0) {", -" indx++;", -" tmp = stte[indx];", -" jndx += tmp;", -" stte[indx] = stte[jndx];", -" stte[jndx] = tmp;", -" tmp += stte[indx];", -" *ptr ^= stte[tmp];", -" ptr++;", -" len--;", -" }", -"}", -"", -"/* End of ARC4 */", -"", -"#if HARDENING", -"", -"#include ", -"#include ", -"#include ", -"#include ", -"#define PR_SET_PTRACER 0x59616d61", -"", -"/* Seccomp Sandboxing Init */", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"#include ", -"#include ", -"#include ", -"", -"#define ArchField offsetof(struct seccomp_data, arch)", -"", -"#define Allow(syscall) \\", -" BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, SYS_##syscall, 0, 1), \\", -" BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW)", -"", -"struct sock_filter filter[] = {", -" /* validate arch */", -" BPF_STMT(BPF_LD+BPF_W+BPF_ABS, ArchField),", -" BPF_JUMP( BPF_JMP+BPF_JEQ+BPF_K, AUDIT_ARCH_X86_64, 1, 0),", -" BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", -"", -" /* load syscall */", -" BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, nr)),", -"", -" /* list of allowed syscalls */", -" Allow(exit_group), /* exits a process */", -" Allow(brk), /* for malloc(), inside libc */", -"#if MMAP2", -" Allow(mmap2), /* also for malloc() */", -"#else", -" Allow(mmap), /* also for malloc() */", -"#endif", -" Allow(munmap), /* for free(), inside libc */", -"", -" /* and if we don't match above, die */", -" BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", -"};", -"struct sock_fprog filterprog = {", -" .len = sizeof(filter)/sizeof(filter[0]),", -" .filter = filter", -"};", -"", -"/* Seccomp Sandboxing - Set up the restricted environment */", -"void seccomp_hardening() {", -" if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {", -" perror(\"Could not start seccomp:\");", -" exit(1);", -" }", -" if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &filterprog) == -1) {", -" perror(\"Could not start seccomp:\");", -" exit(1);", -" }", -"} ", -"/* End Seccomp Sandboxing Init */", -"", -"void shc_x_file() {", -" FILE *fp;", -" int line = 0;", -"", -" if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}", -" for (line = 0; shc_x[line]; line++) fprintf(fp, \"%s\\n\", shc_x[line]);", -" fflush(fp);fclose(fp);", -"}", -"", -"int make() {", -" char * cc, * cflags, * ldflags;", -" char cmd[4096];", -"", -" cc = getenv(\"CC\");", -" if (!cc) cc = \"cc\";", -"", -" sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");", -" if (system(cmd)) {remove(\"/tmp/shc_x.c\"); return -1;}", -" remove(\"/tmp/shc_x.c\"); return 0;", -"}", -"", -"void arc4_hardrun(void * str, int len) {", -" //Decode locally", -" char tmp2[len];", -" char tmp3[len+1024];", -" memcpy(tmp2, str, len);", -"", -" unsigned char tmp, * ptr = (unsigned char *)tmp2;", -" int lentmp = len;", -" int pid, status;", -" pid = fork();", -"", -" shc_x_file();", -" if (make()) {exit(1);}", -"", -" setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);", -"", -" if(pid==0) {", -"", -" //Start tracing to protect from dump & trace", -" if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {", -" kill(getpid(), SIGKILL);", -" _exit(1);", -" }", -"", -" //Decode Bash", -" while (len > 0) {", -" indx++;", -" tmp = stte[indx];", -" jndx += tmp;", -" stte[indx] = stte[jndx];", -" stte[jndx] = tmp;", -" tmp += stte[indx];", -" *ptr ^= stte[tmp];", -" ptr++;", -" len--;", -" }", -"", -" //Do the magic", -" sprintf(tmp3, \"%s %s\", \"'********' 21<<<\", tmp2);", -"", -" //Exec bash script //fork execl with 'sh -c'", -" system(tmp2);", -"", -" //Empty script variable", -" memcpy(tmp2, str, lentmp);", -"", -" //Clean temp", -" remove(\"/tmp/shc_x.so\");", -"", -" //Sinal to detach ptrace", -" ptrace(PTRACE_DETACH, 0, 0, 0);", -" exit(0);", -" }", -" else {wait(&status);}", -"", -" /* Seccomp Sandboxing - Start */", -" seccomp_hardening();", -"", -" exit(0);", -"}", -"#endif /* HARDENING */", -"", -"/*", -" * Key with file invariants. ", -" */", -"int key_with_file(char * file)", -"{", -" struct stat statf[1];", -" struct stat control[1];", -"", -" if (stat(file, statf) < 0)", -" return -1;", -"", -" /* Turn on stable fields */", -" memset(control, 0, sizeof(control));", -" control->st_ino = statf->st_ino;", -" control->st_dev = statf->st_dev;", -" control->st_rdev = statf->st_rdev;", -" control->st_uid = statf->st_uid;", -" control->st_gid = statf->st_gid;", -" control->st_size = statf->st_size;", -" control->st_mtime = statf->st_mtime;", -" control->st_ctime = statf->st_ctime;", -" key(control, sizeof(control));", -" return 0;", -"}", -"", -"#if DEBUGEXEC", -"void debugexec(char * sh11, int argc, char ** argv)", -"{", -" int i;", -" fprintf(stderr, \"shll=%s\\n\", sh11 ? sh11 : \"\");", -" fprintf(stderr, \"argc=%d\\n\", argc);", -" if (!argv) {", -" fprintf(stderr, \"argv=\\n\");", -" } else { ", -" for (i = 0; i <= argc ; i++)", -" fprintf(stderr, \"argv[%d]=%.60s\\n\", i, argv[i] ? argv[i] : \"\");", -" }", -"}", -"#endif /* DEBUGEXEC */", -"", -"void rmarg(char ** argv, char * arg)", -"{", -" for (; argv && *argv && *argv != arg; argv++);", -" for (; argv && *argv; argv++)", -" *argv = argv[1];", -"}", -"", -"void chkenv_end(void);", -"", -"int chkenv(int argc)", -"{", -" char buff[512];", -" unsigned long mask, m;", -" int l, a, c;", -" char * string;", -" extern char ** environ;", -"", -" mask = (unsigned long)getpid();", -" stte_0();", -" key(&chkenv, (void*)&chkenv_end - (void*)&chkenv);", -" key(&data, sizeof(data));", -" key(&mask, sizeof(mask));", -" arc4(&mask, sizeof(mask));", -" sprintf(buff, \"x%lx\", mask);", -" string = getenv(buff);", -"#if DEBUGEXEC", -" fprintf(stderr, \"getenv(%s)=%s\\n\", buff, string ? string : \"\");", -"#endif", -" l = strlen(buff);", -" if (!string) {", -" /* 1st */", -" sprintf(&buff[l], \"=%lu %d\", mask, argc);", -" putenv(strdup(buff));", -" return 0;", -" }", -" c = sscanf(string, \"%lu %d%c\", &m, &a, buff);", -" if (c == 2 && m == mask) {", -" /* 3rd */", -" rmarg(environ, &string[-l - 1]);", -" return 1 + (argc - a);", -" }", -" return -1;", -"}", -"", -"void chkenv_end(void){}", -"", -"#if HARDENING", -"", -"static void gets_process_name(const pid_t pid, char * name) {", -" char procfile[BUFSIZ];", -" sprintf(procfile, \"/proc/%d/cmdline\", pid);", -" FILE* f = fopen(procfile, \"r\");", -" if (f) {", -" size_t size;", -" size = fread(name, sizeof (char), sizeof (procfile), f);", -" if (size > 0) {", -" if ('\\n' == name[size - 1])", -" name[size - 1] = '\\0';", -" }", -" fclose(f);", -" }", -"}", -"", -"void hardening() {", -" prctl(PR_SET_DUMPABLE, 0);", -" prctl(PR_SET_PTRACER, -1);", -"", -" int pid = getppid();", -" char name[256] = {0};", -" gets_process_name(pid, name);", -"", -" if ( (strcmp(name, \"bash\") != 0) ", -" && (strcmp(name, \"/bin/bash\") != 0) ", -" && (strcmp(name, \"sh\") != 0) ", -" && (strcmp(name, \"/bin/sh\") != 0) ", -" && (strcmp(name, \"sudo\") != 0) ", -" && (strcmp(name, \"/bin/sudo\") != 0) ", -" && (strcmp(name, \"/usr/bin/sudo\") != 0)", -" && (strcmp(name, \"gksudo\") != 0) ", -" && (strcmp(name, \"/bin/gksudo\") != 0) ", -" && (strcmp(name, \"/usr/bin/gksudo\") != 0) ", -" && (strcmp(name, \"kdesu\") != 0) ", -" && (strcmp(name, \"/bin/kdesu\") != 0) ", -" && (strcmp(name, \"/usr/bin/kdesu\") != 0) ", -" )", -" {", -" printf(\"Operation not permitted\\n\");", -" kill(getpid(), SIGKILL);", -" exit(1);", -" }", -"}", -"", -"#endif /* HARDENING */", -"", -"#if !TRACEABLE", -"", -"#define _LINUX_SOURCE_COMPAT", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"#if !defined(PT_ATTACHEXC) /* New replacement for PT_ATTACH */", -" #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)", -" #define PT_ATTACHEXC PT_ATTACH", -" #elif defined(PTRACE_ATTACH)", -" #define PT_ATTACHEXC PTRACE_ATTACH", -" #endif", -"#endif", -"", -"void untraceable(char * argv0)", -"{", -" char proc[80];", -" int pid, mine;", -"", -" switch(pid = fork()) {", -" case 0:", -" pid = getppid();", -" /* For problematic SunOS ptrace */", -"#if defined(__FreeBSD__)", -" sprintf(proc, \"/proc/%d/mem\", (int)pid);", -"#else", -" sprintf(proc, \"/proc/%d/as\", (int)pid);", -"#endif", -" close(0);", -" mine = !open(proc, O_RDWR|O_EXCL);", -" if (!mine && errno != EBUSY) {", -" if((mine=2*!ptrace(PT_ATTACHEXC, pid, 0, 0)))wait(0);", -" }", -" if (!mine) {", -" perror(argv0);", -" kill(pid, SIGKILL);", +static const char *RTC[] = { + "", + "#if HARDENING", + "static const char * shc_x[] = {", + "\"/*\",", + "\" * Copyright 2019 - Intika \",", + "\" * Replace ******** with secret read from fd 21\",", + "\" * Also change arguments location of sub commands (sh script commands)\",", + "\" * gcc -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",", + "\" */\",", + "\"\",", + "\"#define _GNU_SOURCE /* needed to get RTLD_NEXT defined in dlfcn.h */\",", + "\"#define PLACEHOLDER \\\"********\\\"\",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"\",", + "\"static char secret[128000]; //max size\",", + "\"typedef int (*pfi)(int, char **, char **);\",", + "\"static pfi real_main;\",", + "\"\",", + "\"// copy argv to new location\",", + "\"char **copyargs(int argc, char** argv){\",", + "\" char **newargv = malloc((argc+1)*sizeof(*argv));\",", + "\" char *from,*to;\",", + "\" int i,len;\",", + "\"\",", + "\" for(i = 0; i 0) {\",", + "\" int i;\",", + "\"\",", + "\" if (secret[n - 1] == '\\\\n') secret[--n] = '\\\\0';\",", + "\" for (i = 1; i < argc; i++)\",", + "\" if (strcmp(argv[i], PLACEHOLDER) == 0)\",", + "\" argv[i] = secret;\",", + "\" }\",", + "\"\",", + "\" real_main = main;\",", + "\"\",", + "\" return real___libc_start_main(mymain, argc, argv, init, fini, rtld_fini, stack_end);\",", + "\"}\",", + "\"\",", + "0};", + "#endif /* HARDENING */", + "", + "/* rtc.c */", + "", + "#include ", + "#include ", + "#include ", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "/* 'Alleged RC4' */", + "", + "static unsigned char stte[256], indx, jndx, kndx;", + "", + "/*", + " * Reset arc4 stte. ", + " */", + "void stte_0(void)", + "{", + " indx = jndx = kndx = 0;", + " do {", + " stte[indx] = indx;", + " } while (++indx);", + "}", + "", + "/*", + " * Set key. Can be used more than once. ", + " */", + "void key(void * str, int len)", + "{", + " unsigned char tmp, * ptr = (unsigned char *)str;", + " while (len > 0) {", + " do {", + " tmp = stte[indx];", + " kndx += tmp;", + " kndx += ptr[(int)indx % len];", + " stte[indx] = stte[kndx];", + " stte[kndx] = tmp;", + " } while (++indx);", + " ptr += 256;", + " len -= 256;", + " }", + "}", + "", + "/*", + " * Crypt data. ", + " */", + "void arc4(void * str, int len)", + "{", + " unsigned char tmp, * ptr = (unsigned char *)str;", + " while (len > 0) {", + " indx++;", + " tmp = stte[indx];", + " jndx += tmp;", + " stte[indx] = stte[jndx];", + " stte[jndx] = tmp;", + " tmp += stte[indx];", + " *ptr ^= stte[tmp];", + " ptr++;", + " len--;", + " }", + "}", + "", + "/* End of ARC4 */", + "", + "#if HARDENING", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "#define PR_SET_PTRACER 0x59616d61", + "", + "/* Seccomp Sandboxing Init */", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#include ", + "#include ", + "#include ", + "", + "#define ArchField offsetof(struct seccomp_data, arch)", + "", + "#define Allow(syscall) \\", + " BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, SYS_##syscall, 0, 1), \\", + " BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW)", + "", + "struct sock_filter filter[] = {", + " /* validate arch */", + " BPF_STMT(BPF_LD+BPF_W+BPF_ABS, ArchField),", + " BPF_JUMP( BPF_JMP+BPF_JEQ+BPF_K, AUDIT_ARCH_X86_64, 1, 0),", + " BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", + "", + " /* load syscall */", + " BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, nr)),", + "", + " /* list of allowed syscalls */", + " Allow(exit_group), /* exits a process */", + " Allow(brk), /* for malloc(), inside libc */", + "#if MMAP2", + " Allow(mmap2), /* also for malloc() */", + "#else", + " Allow(mmap), /* also for malloc() */", + "#endif", + " Allow(munmap), /* for free(), inside libc */", + "", + " /* and if we don't match above, die */", + " BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", + "};", + "struct sock_fprog filterprog = {", + " .len = sizeof(filter)/sizeof(filter[0]),", + " .filter = filter", + "};", + "", + "/* Seccomp Sandboxing - Set up the restricted environment */", + "void seccomp_hardening() {", + " if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {", + " perror(\"Could not start seccomp:\");", + " exit(1);", + " }", + " if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &filterprog) == -1) {", + " perror(\"Could not start seccomp:\");", + " exit(1);", + " }", + "} ", + "/* End Seccomp Sandboxing Init */", + "", + "void shc_x_file() {", + " FILE *fp;", + " int line = 0;", + "", + " if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}", + " for (line = 0; shc_x[line]; line++) fprintf(fp, \"%s\\n\", shc_x[line]);", + " fflush(fp);fclose(fp);", + "}", + "", + "int make() {", + " char * cc, * cflags, * ldflags;", + " char cmd[4096];", + "", + " cc = getenv(\"CC\");", + " if (!cc) cc = \"cc\";", + "", + " sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");", + " if (system(cmd)) {remove(\"/tmp/shc_x.c\"); return -1;}", + " remove(\"/tmp/shc_x.c\"); return 0;", + "}", + "", + "void arc4_hardrun(void * str, int len) {", + " //Decode locally", + " char tmp2[len];", + " char tmp3[len+1024];", + " memcpy(tmp2, str, len);", + "", + " unsigned char tmp, * ptr = (unsigned char *)tmp2;", + " int lentmp = len;", + " int pid, status;", + " pid = fork();", + "", + " shc_x_file();", + " if (make()) {exit(1);}", + "", + " setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);", + "", + " if(pid==0) {", + "", + " //Start tracing to protect from dump & trace", + " if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {", + " kill(getpid(), SIGKILL);", + " _exit(1);", + " }", + "", + " //Decode Bash", + " while (len > 0) {", + " indx++;", + " tmp = stte[indx];", + " jndx += tmp;", + " stte[indx] = stte[jndx];", + " stte[jndx] = tmp;", + " tmp += stte[indx];", + " *ptr ^= stte[tmp];", + " ptr++;", + " len--;", + " }", + "", + " //Do the magic", + " sprintf(tmp3, \"%s %s\", \"'********' 21<<<\", tmp2);", + "", + " //Exec bash script //fork execl with 'sh -c'", + " system(tmp2);", + "", + " //Empty script variable", + " memcpy(tmp2, str, lentmp);", + "", + " //Clean temp", + " remove(\"/tmp/shc_x.so\");", + "", + " //Sinal to detach ptrace", + " ptrace(PTRACE_DETACH, 0, 0, 0);", + " exit(0);", + " }", + " else {wait(&status);}", + "", + " /* Seccomp Sandboxing - Start */", + " seccomp_hardening();", + "", + " exit(0);", + "}", + "#endif /* HARDENING */", + "", + "/*", + " * Key with file invariants. ", + " */", + "int key_with_file(char * file)", + "{", + " struct stat statf[1];", + " struct stat control[1];", + "", + " if (stat(file, statf) < 0)", + " return -1;", + "", + " /* Turn on stable fields */", + " memset(control, 0, sizeof(control));", + " control->st_ino = statf->st_ino;", + " control->st_dev = statf->st_dev;", + " control->st_rdev = statf->st_rdev;", + " control->st_uid = statf->st_uid;", + " control->st_gid = statf->st_gid;", + " control->st_size = statf->st_size;", + " control->st_mtime = statf->st_mtime;", + " control->st_ctime = statf->st_ctime;", + " key(control, sizeof(control));", + " return 0;", + "}", + "", + "#if DEBUGEXEC", + "void debugexec(char * sh11, int argc, char ** argv)", + "{", + " int i;", + " fprintf(stderr, \"shll=%s\\n\", sh11 ? sh11 : \"\");", + " fprintf(stderr, \"argc=%d\\n\", argc);", + " if (!argv) {", + " fprintf(stderr, \"argv=\\n\");", + " } else { ", + " for (i = 0; i <= argc ; i++)", + " fprintf(stderr, \"argv[%d]=%.60s\\n\", i, argv[i] ? argv[i] : \"\");", + " }", + "}", + "#endif /* DEBUGEXEC */", + "", + "void rmarg(char ** argv, char * arg)", + "{", + " for (; argv && *argv && *argv != arg; argv++);", + " for (; argv && *argv; argv++)", + " *argv = argv[1];", + "}", + "", + "void chkenv_end(void);", + "", + "int chkenv(int argc)", + "{", + " char buff[512];", + " unsigned long mask, m;", + " int l, a, c;", + " char * string;", + " extern char ** environ;", + "", + " mask = (unsigned long)getpid();", + " stte_0();", + " key(&chkenv, (void*)&chkenv_end - (void*)&chkenv);", + " key(&data, sizeof(data));", + " key(&mask, sizeof(mask));", + " arc4(&mask, sizeof(mask));", + " sprintf(buff, \"x%lx\", mask);", + " string = getenv(buff);", + "#if DEBUGEXEC", + " fprintf(stderr, \"getenv(%s)=%s\\n\", buff, string ? string : \"\");", + "#endif", + " l = strlen(buff);", + " if (!string) {", + " /* 1st */", + " sprintf(&buff[l], \"=%lu %d\", mask, argc);", + " putenv(strdup(buff));", + " return 0;", + " }", + " c = sscanf(string, \"%lu %d%c\", &m, &a, buff);", + " if (c == 2 && m == mask) {", + " /* 3rd */", + " rmarg(environ, &string[-l - 1]);", + " return 1 + (argc - a);", + " }", + " return -1;", + "}", + "", + "void chkenv_end(void){}", + "", + "#if HARDENING", + "", + "static void gets_process_name(const pid_t pid, char * name) {", + " char procfile[BUFSIZ];", + " sprintf(procfile, \"/proc/%d/cmdline\", pid);", + " FILE* f = fopen(procfile, \"r\");", + " if (f) {", + " size_t size;", + " size = fread(name, sizeof (char), sizeof (procfile), f);", + " if (size > 0) {", + " if ('\\n' == name[size - 1])", + " name[size - 1] = '\\0';", + " }", + " fclose(f);", + " }", + "}", + "", + "void hardening() {", + " prctl(PR_SET_DUMPABLE, 0);", + " prctl(PR_SET_PTRACER, -1);", + "", + " int pid = getppid();", + " char name[256] = {0};", + " gets_process_name(pid, name);", + "", + " if ( (strcmp(name, \"bash\") != 0) ", + " && (strcmp(name, \"/bin/bash\") != 0) ", + " && (strcmp(name, \"sh\") != 0) ", + " && (strcmp(name, \"/bin/sh\") != 0) ", + " && (strcmp(name, \"sudo\") != 0) ", + " && (strcmp(name, \"/bin/sudo\") != 0) ", + " && (strcmp(name, \"/usr/bin/sudo\") != 0)", + " && (strcmp(name, \"gksudo\") != 0) ", + " && (strcmp(name, \"/bin/gksudo\") != 0) ", + " && (strcmp(name, \"/usr/bin/gksudo\") != 0) ", + " && (strcmp(name, \"kdesu\") != 0) ", + " && (strcmp(name, \"/bin/kdesu\") != 0) ", + " && (strcmp(name, \"/usr/bin/kdesu\") != 0) ", + " )", + " {", + " printf(\"Operation not permitted\\n\");", + " kill(getpid(), SIGKILL);", + " exit(1);", + " }", + "}", + "", + "#endif /* HARDENING */", + "", + "#if !TRACEABLE", + "", + "#define _LINUX_SOURCE_COMPAT", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#if !defined(PT_ATTACHEXC) /* New replacement for PT_ATTACH */", + " #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)", + " #define PT_ATTACHEXC PT_ATTACH", + " #elif defined(PTRACE_ATTACH)", + " #define PT_ATTACHEXC PTRACE_ATTACH", + " #endif", + "#endif", + "", + "void untraceable(char * argv0)", + "{", + " char proc[80];", + " int pid, mine;", + "", + " switch(pid = fork()) {", + " case 0:", + " pid = getppid();", + " /* For problematic SunOS ptrace */", + "#if defined(__FreeBSD__)", + " sprintf(proc, \"/proc/%d/mem\", (int)pid);", + "#else", + " sprintf(proc, \"/proc/%d/as\", (int)pid);", + "#endif", + " close(0);", + " mine = !open(proc, O_RDWR|O_EXCL);", + " if (!mine && errno != EBUSY) {", + " if((mine=2*!ptrace(PT_ATTACHEXC, pid, 0, 0)))wait(0);", + " }", + " if (!mine) {", + " perror(argv0);", + " kill(pid, SIGKILL);", /*" fprintf(stderr, \"%s is being traced!\\n\", argv0);",*/ -" } else if(mine>1) {", -" ptrace(PTRACE_DETACH, pid, 0, 0);", -" }", -" _exit(mine);", -" case -1:", -" break;", -" default:", -" if (pid == waitpid(pid, 0, 0))", -" return;", -" }", -" perror(argv0);", -" _exit(1);", -"}", -"#endif /* !TRACEABLE */", -"", -"char * xsh(int argc, char ** argv)", -"{", -" char * scrpt;", -" int ret, i, j;", -" char ** varg;", -" char * me = argv[0];", -" if (me == NULL) { me = getenv(\"_\"); }", -" if (me == 0) { fprintf(stderr, \"E: neither argv[0] nor $_ works.\"); exit(1); }", -"", -" ret = chkenv(argc);", -" stte_0();", -" key(pswd, pswd_z);", -" arc4(msg1, msg1_z);", -" arc4(date, date_z);", -" if (date[0] && (atoll(date)BUFSIZ) w=BUFSIZ;", -" if((w=write(fd, text+i, w))<0) break;", -" memset(text+i, 0, w);", -" }", -" _exit(0);", -" }", -" varg[j++] = tnm;", -" i = (ret > 1) ? ret : 1;/* Args numbering correction */", -" goto xec;", -" }", -" if (ret && *opts)", -" varg[j++] = opts; /* Options on 1st line of code */", -" if (*inlo)", -" varg[j++] = inlo; /* Option introducing inline code */", -" varg[j++] = scrpt; /* The script itself */", -" if (*lsto)", -" varg[j++] = lsto; /* Option meaning last option */", -" i = (ret > 1) ? ret : 0; /* Args numbering correction */", -"xec:", -" while (i < argc)", -" varg[j++] = argv[i++]; /* Main run-time arguments */", -" varg[j] = 0; /* NULL terminated array */", -"#if DEBUGEXEC", -" debugexec(shll, j, varg);", -"#endif", -" execvp(shll, varg);", -" return shll;", -"}", -"", -"int main(int argc, char ** argv)", -"{", -"#if SETUID", -" setuid(0);", -"#endif", -"#if DEBUGEXEC", -" debugexec(\"main\", argc, argv);", -"#endif", -"#if HARDENING", -" hardening();", -"#endif", -"#if !TRACEABLE", -" untraceable(argv[0]);", -"#endif", -" argv[1] = xsh(argc, argv);", -" fprintf(stderr, \"%s%s%s: %s\\n\", argv[0],", -" errno ? \": \" : \"\",", -" errno ? strerror(errno) : \"\",", -" argv[1] ? argv[1] : \"\"", -" );", -" return 1;", -"}", -0}; + " } else if(mine>1) {", + " ptrace(PTRACE_DETACH, pid, 0, 0);", + " }", + " _exit(mine);", + " case -1:", + " break;", + " default:", + " if (pid == waitpid(pid, 0, 0))", + " return;", + " }", + " perror(argv0);", + " _exit(1);", + "}", + "#endif /* !TRACEABLE */", + "", + "char * xsh(int argc, char ** argv)", + "{", + " char * scrpt;", + " int ret, i, j;", + " char ** varg;", + " char * me = argv[0];", + " if (me == NULL) { me = getenv(\"_\"); }", + " if (me == 0) { fprintf(stderr, \"E: neither argv[0] nor $_ works.\"); exit(1); }", + "", + " ret = chkenv(argc);", + " stte_0();", + " key(pswd, pswd_z);", + " arc4(msg1, msg1_z);", + " arc4(date, date_z);", + " if (date[0] && (atoll(date)BUFSIZ) w=BUFSIZ;", + " if((w=write(fd, text+i, w))<0) break;", + " memset(text+i, 0, w);", + " }", + " _exit(0);", + " }", + " varg[j++] = tnm;", + " i = (ret > 1) ? ret : 1;/* Args numbering correction */", + " goto xec;", + " }", + " if (ret && *opts)", + " varg[j++] = opts; /* Options on 1st line of code */", + " if (*inlo)", + " varg[j++] = inlo; /* Option introducing inline code */", + " varg[j++] = scrpt; /* The script itself */", + " if (*lsto)", + " varg[j++] = lsto; /* Option meaning last option */", + " i = (ret > 1) ? ret : 0; /* Args numbering correction */", + "xec:", + " while (i < argc)", + " varg[j++] = argv[i++]; /* Main run-time arguments */", + " varg[j] = 0; /* NULL terminated array */", + "#if DEBUGEXEC", + " debugexec(shll, j, varg);", + "#endif", + " execvp(shll, varg);", + " return shll;", + "}", + "", + "int main(int argc, char ** argv)", + "{", + "#if SETUID", + " setuid(0);", + "#endif", + "#if DEBUGEXEC", + " debugexec(\"main\", argc, argv);", + "#endif", + "#if HARDENING", + " hardening();", + "#endif", + "#if !TRACEABLE", + " untraceable(argv[0]);", + "#endif", + " argv[1] = xsh(argc, argv);", + " fprintf(stderr, \"%s%s%s: %s\\n\", argv[0],", + " errno ? \": \" : \"\",", + " errno ? strerror(errno) : \"\",", + " argv[1] ? argv[1] : \"\"", + " );", + " return 1;", + "}", + 0 +}; -static int parse_an_arg(int argc, char * argv[]) +static int parse_an_arg(int argc, char *argv[]) { - extern char * optarg; - const char * opts = "e:m:f:i:x:l:o:rvDSUHPCAB2h"; + extern char *optarg; + const char *opts = "e:m:f:i:x:l:o:rvDSUHPCAB2h"; struct tm tmp[1]; time_t expdate; int cnt, l; @@ -815,15 +819,15 @@ static int parse_an_arg(int argc, char * argv[]) tmp->tm_year -= 1900; expdate = mktime(tmp); } - if (cnt != 3 || expdate <= 0) { + if ((cnt != 3) || (expdate <= 0)) { fprintf(stderr, "%s parse(-e %s): Not a valid value\n", - my_name, optarg); + my_name, optarg); return -1; } sprintf(date, "%lld", (long long)expdate); - if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); + if (verbose) { fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); } expdate = atoll(date); - if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); + if (verbose) { fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); } break; case 'm': mail = optarg; @@ -856,7 +860,7 @@ static int parse_an_arg(int argc, char * argv[]) break; case 'S': SETUID_flag = 1; - break; + break; case 'D': DEBUGEXEC_flag = 1; break; @@ -873,8 +877,9 @@ static int parse_an_arg(int argc, char * argv[]) fprintf(stderr, "%s %s, %s\n", my_name, version, subject); fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e); fprintf(stderr, "%s ", my_name); - for (l = 0; copying[l]; l++) + for (l = 0; copying[l]; l++) { fprintf(stderr, "%s\n", copying[l]); + } fprintf(stderr, " %s %s %s\n\n", provider.f, provider.s, provider.e); exit(0); break; @@ -882,16 +887,18 @@ static int parse_an_arg(int argc, char * argv[]) fprintf(stderr, "%s %s, %s\n", my_name, version, subject); fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e); fprintf(stderr, "%s ", my_name); - for (l = 0; abstract[l]; l++) + for (l = 0; abstract[l]; l++) { fprintf(stderr, "%s\n", abstract[l]); + } exit(0); break; case 'h': fprintf(stderr, "%s %s, %s\n", my_name, version, subject); fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e); fprintf(stderr, "%s %s\n", my_name, usage); - for (l = 0; help[l]; l++) + for (l = 0; help[l]; l++) { fprintf(stderr, "%s\n", help[l]); + } exit(0); break; case -1: @@ -920,25 +927,27 @@ static int parse_an_arg(int argc, char * argv[]) return 1; } -static void parse_args(int argc, char * argv[]) +static void parse_args(int argc, char *argv[]) { int err = 0; int ret; #if 0 my_name = strrchr(argv[0], '/'); - if (my_name) + if (my_name) { my_name++; - else + } else { my_name = argv[0]; + } #endif do { ret = parse_an_arg(argc, argv); - if (ret == -1) + if (ret == -1) { err++; + } } while (ret); - + if (err) { fprintf(stderr, "\n%s %s\n\n", my_name, usage); exit(1); @@ -950,7 +959,7 @@ static void parse_args(int argc, char * argv[]) static unsigned char stte[256], indx, jndx, kndx; /* - * Reset arc4 stte. + * Reset arc4 stte. */ void stte_0(void) { @@ -961,11 +970,11 @@ void stte_0(void) } /* - * Set key. Can be used more than once. + * Set key. Can be used more than once. */ -void key(void * str, int len) +void key(void *str, int len) { - unsigned char tmp, * ptr = (unsigned char *)str; + unsigned char tmp, *ptr = (unsigned char *)str; while (len > 0) { do { tmp = stte[indx]; @@ -980,11 +989,11 @@ void key(void * str, int len) } /* - * Crypt data. + * Crypt data. */ -void arc4(void * str, int len) +void arc4(void *str, int len) { - unsigned char tmp, * ptr = (unsigned char *)str; + unsigned char tmp, *ptr = (unsigned char *)str; while (len > 0) { indx++; tmp = stte[indx]; @@ -1003,13 +1012,14 @@ void arc4(void * str, int len) /* * Key with file invariants. */ -int key_with_file(char * file) +int key_with_file(char *file) { struct stat statf[1]; struct stat control[1]; - if (stat(file, statf) < 0) + if (stat(file, statf) < 0) { return -1; + } /* Turn on stable fields */ memset(control, 0, sizeof(control)); @@ -1030,83 +1040,89 @@ int key_with_file(char * file) * environment variables with characters as "=|#:*?$ ". */ struct { - char * shll; - char * inlo; - char * lsto; - char * xecc; + char * shll; + char * inlo; + char * lsto; + char * xecc; } shellsDB[] = { { "perl", "-e", "--", "exec('%s',@ARGV);" }, - { "rc", "-c", "", "builtin exec %s $*" }, - { "sh", "-c", "", "exec '%s' \"$@\"" }, /* IRIX_nvi */ - { "dash", "-c", "", "exec '%s' \"$@\"" }, - { "bash", "-c", "", "exec '%s' \"$@\"" }, - { "zsh", "-c", "", "exec '%s' \"$@\"" }, - { "bsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ - { "Rsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ - { "ksh", "-c", "", "exec '%s' \"$@\"" }, /* OK on Solaris, AIX and Linux (THX ) */ - { "tsh", "-c", "--", "exec '%s' \"$@\"" }, /* AIX */ - { "ash", "-c", "--", "exec '%s' \"$@\"" }, /* Linux */ - { "csh", "-c", "-b", "exec '%s' $argv" }, /* AIX: No file for $0 */ + { "rc", "-c", "", "builtin exec %s $*" }, + { "sh", "-c", "", "exec '%s' \"$@\"" }, /* IRIX_nvi */ + { "dash", "-c", "", "exec '%s' \"$@\"" }, + { "bash", "-c", "", "exec '%s' \"$@\"" }, + { "zsh", "-c", "", "exec '%s' \"$@\"" }, + { "bsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ + { "Rsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ + { "ksh", "-c", "", "exec '%s' \"$@\"" }, /* OK on Solaris, AIX and Linux (THX ) */ + { "tsh", "-c", "--", "exec '%s' \"$@\"" }, /* AIX */ + { "ash", "-c", "--", "exec '%s' \"$@\"" }, /* Linux */ + { "csh", "-c", "-b", "exec '%s' $argv" }, /* AIX: No file for $0 */ { "tcsh", "-c", "-b", "exec '%s' $argv" }, { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv)" }, { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv)" }, { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv)" }, - { NULL, NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL }, }; -int eval_shell(char * text) +int eval_shell(char *text) { int i; - char * ptr; + char *ptr; ptr = strchr(text, (int)'\n'); - if (!ptr) + if (!ptr) { i = strlen(text); - else + } else { i = ptr - text; - ptr = malloc(i + 1); + } + ptr = malloc(i + 1); shll = malloc(i + 1); opts = malloc(i + 1); - if (!ptr || !shll || !opts) + if (!ptr || !shll || !opts) { return -1; + } strncpy(ptr, text, i); ptr[i] = '\0'; *opts = '\0'; i = sscanf(ptr, " #!%s%s %c", shll, opts, opts); - if (i < 1 || i > 2) { + if ((i < 1) || (i > 2)) { fprintf(stderr, "%s: invalid first line in script: %s\n", my_name, ptr); return -1; } free(ptr); shll = realloc(shll, strlen(shll) + 1); - ptr = strrchr(shll, (int)'/'); + ptr = strrchr(shll, (int)'/'); if (!ptr) { fprintf(stderr, "%s: invalid shll\n", my_name); return -1; } - if (*ptr == '/') + if (*ptr == '/') { ptr++; - if (verbose) fprintf(stderr, "%s shll=%s\n", my_name, ptr); + } + if (verbose) { fprintf(stderr, "%s shll=%s\n", my_name, ptr); } - for(i=0; shellsDB[i].shll; i++) { - if(!strcmp(ptr, shellsDB[i].shll)) { - if (!inlo) + for (i = 0; shellsDB[i].shll; i++) { + if (!strcmp(ptr, shellsDB[i].shll)) { + if (!inlo) { inlo = strdup(shellsDB[i].inlo); - if (!xecc) + } + if (!xecc) { xecc = strdup(shellsDB[i].xecc); - if (!lsto) + } + if (!lsto) { lsto = strdup(shellsDB[i].lsto); + } } } if (!inlo || !xecc || !lsto) { fprintf(stderr, "%s Unknown shell (%s): specify [-i][-x][-l]\n", my_name, ptr); return -1; } - if (verbose) fprintf(stderr, "%s [-i]=%s\n", my_name, inlo); - if (verbose) fprintf(stderr, "%s [-x]=%s\n", my_name, xecc); - if (verbose) fprintf(stderr, "%s [-l]=%s\n", my_name, lsto); + if (verbose) { fprintf(stderr, "%s [-i]=%s\n", my_name, inlo); } + if (verbose) { fprintf(stderr, "%s [-x]=%s\n", my_name, xecc); } + if (verbose) { fprintf(stderr, "%s [-l]=%s\n", my_name, lsto); } opts = realloc(opts, strlen(opts) + 1); if (*opts && !strcmp(opts, lsto)) { @@ -1116,45 +1132,50 @@ int eval_shell(char * text) fprintf(stderr, "%s opts=%s : No real one. Removing opts\n", my_name, opts); *opts = '\0'; } - if (verbose) fprintf(stderr, "%s opts=%s\n", my_name, opts); + if (verbose) { fprintf(stderr, "%s opts=%s\n", my_name, opts); } return 0; } -char * read_script(char * file) +char*read_script(char *file) { - FILE * i; - char * text; + FILE *i; + char *text; int cnt, l; text = malloc(SIZE); - if (!text) + if (!text) { return NULL; + } i = fopen(file, "r"); - if (!i) + if (!i) { return NULL; + } for (l = 0;;) { text = realloc(text, l + SIZE); - if (!text) + if (!text) { return NULL; + } cnt = fread(&text[l], 1, SIZE, i); - if (!cnt) + if (!cnt) { break; + } l += cnt; } fclose(i); text = realloc(text, l + 1); - if (!text) + if (!text) { return NULL; + } text[l] = '\0'; /* Check current System ARG_MAX limit. */ - if (!PIPESCRIPT_flag && l > 0.80 * (cnt = sysconf(_SC_ARG_MAX))) { + if (!PIPESCRIPT_flag && (l > 0.80 * (cnt = sysconf(_SC_ARG_MAX)))) { fprintf(stderr, "%s: WARNING!!\n" -" Scripts of length near to (or higher than) the current System limit on\n" -" \"maximum size of arguments to EXEC\", could comprise its binary execution.\n" -" In the current System the call sysconf(_SC_ARG_MAX) returns %d bytes\n" -" and your script \"%s\" is %d bytes length.\n", - my_name, cnt, file, l); + " Scripts of length near to (or higher than) the current System limit on\n" + " \"maximum size of arguments to EXEC\", could comprise its binary execution.\n" + " In the current System the call sysconf(_SC_ARG_MAX) returns %d bytes\n" + " and your script \"%s\" is %d bytes length.\n", + my_name, cnt, file, l); } return text; } @@ -1164,105 +1185,110 @@ unsigned rand_mod(unsigned mod) /* Without skew */ unsigned rnd, top = RAND_MAX; top -= top % mod; - while (top <= (rnd = rand())) + while (top <= (rnd = rand())) { continue; + } /* Using high-order bits. */ - rnd = 1.0*mod*rnd/(1.0+top); + rnd = 1.0 * mod * rnd / (1.0 + top); return rnd; } char rand_chr(void) { - return (char)rand_mod(1<<(sizeof(char)<<3)); + return (char)rand_mod(1 << (sizeof(char) << 3)); } -int noise(char * ptr, unsigned min, unsigned xtra, int str) +int noise(char *ptr, unsigned min, unsigned xtra, int str) { - if (xtra) xtra = rand_mod(xtra); + if (xtra) { xtra = rand_mod(xtra); } xtra += min; - for (min = 0; min < xtra; min++, ptr++) + for (min = 0; min < xtra; min++, ptr++) { do *ptr = rand_chr(); while (str && !isalnum((int)*ptr)); - if (str) *ptr = '\0'; + } + if (str) { *ptr = '\0'; } return xtra; } static int offset; -void prnt_bytes(FILE * o, char * ptr, int m, int l, int n) +void prnt_bytes(FILE *o, char *ptr, int m, int l, int n) { int i; l += m; n += l; for (i = 0; i < n; i++) { - if ((i & 0xf) == 0) + if ((i & 0xf) == 0) { fprintf(o, "\n\t\""); - fprintf(o, "\\%03o", (unsigned char)((i>=m) && (i= m) && (i < l) ? ptr[i - m] : rand_chr())); + if ((i & 0xf) == 0xf) { fprintf(o, "\""); + } } - if ((i & 0xf) != 0) + if ((i & 0xf) != 0) { fprintf(o, "\""); + } offset += n; } -void prnt_array(FILE * o, void * ptr, char * name, int l, char * cast) +void prnt_array(FILE *o, void *ptr, char *name, int l, char *cast) { - int m = rand_mod(1+l/4); /* Random amount of random pre padding (offset) */ - int n = rand_mod(1+l/4); /* Random amount of random post padding (tail) */ - int a = (offset+m)%l; - if (cast && a) m += l - a; /* Type alignement. */ + int m = rand_mod(1 + l / 4); /* Random amount of random pre padding (offset) */ + int n = rand_mod(1 + l / 4); /* Random amount of random post padding (tail) */ + int a = (offset + m) % l; + if (cast && a) { m += l - a; } /* Type alignement. */ fprintf(o, "\n"); fprintf(o, "#define %s_z %d", name, l); fprintf(o, "\n"); - fprintf(o, "#define %s (%s(&data[%d]))", name, cast?cast:"", offset+m); + fprintf(o, "#define %s (%s(&data[%d]))", name, cast?cast : "", offset + m); prnt_bytes(o, ptr, m, l, n); } -void dump_array(FILE * o, void * ptr, char * name, int l, char * cast) +void dump_array(FILE *o, void *ptr, char *name, int l, char *cast) { arc4(ptr, l); prnt_array(o, ptr, name, l, cast); } -int write_C(char * file, char * argv[]) +int write_C(char *file, char *argv[]) { char pswd[256]; int pswd_z = sizeof(pswd); - char* msg1 = strdup("has expired!\n"); + char *msg1 = strdup("has expired!\n"); int msg1_z = strlen(msg1) + 1; int date_z = strlen(date) + 1; - char* kwsh = strdup(shll); + char *kwsh = strdup(shll); int shll_z = strlen(shll) + 1; int inlo_z = strlen(inlo) + 1; int xecc_z = strlen(xecc) + 1; int lsto_z = strlen(lsto) + 1; - char* tst1 = strdup("location has changed!"); + char *tst1 = strdup("location has changed!"); int tst1_z = strlen(tst1) + 1; - char* chk1 = strdup(tst1); + char *chk1 = strdup(tst1); int chk1_z = tst1_z; - char* msg2 = strdup("abnormal behavior!"); + char *msg2 = strdup("abnormal behavior!"); int msg2_z = strlen(msg2) + 1; int rlax_z = sizeof(rlax); int opts_z = strlen(opts) + 1; int text_z = strlen(text) + 1; - char* tst2 = strdup("shell has changed!"); + char *tst2 = strdup("shell has changed!"); int tst2_z = strlen(tst2) + 1; - char* chk2 = strdup(tst2); + char *chk2 = strdup(tst2); int chk2_z = tst2_z; - char* name = strdup(file); - FILE * o; + char *name = strdup(file); + FILE *o; int indx; int numd = 0; int done = 0; /* Encrypt */ - srand((unsigned)time(NULL)^(unsigned)getpid()); + srand((unsigned)time(NULL) ^ (unsigned)getpid()); pswd_z = noise(pswd, pswd_z, 0, 0); numd++; stte_0(); - key(pswd, pswd_z); + key(pswd, pswd_z); msg1_z += strlen(mail); msg1 = strcat(realloc(msg1, msg1_z), mail); arc4(msg1, msg1_z); numd++; @@ -1272,7 +1298,7 @@ int write_C(char * file, char * argv[]) arc4(xecc, xecc_z); numd++; arc4(lsto, lsto_z); numd++; arc4(tst1, tst1_z); numd++; - key(chk1, chk1_z); + key(chk1, chk1_z); arc4(chk1, chk1_z); numd++; arc4(msg2, msg2_z); numd++; indx = !rlax[0]; @@ -1285,11 +1311,11 @@ int write_C(char * file, char * argv[]) arc4(opts, opts_z); numd++; arc4(text, text_z); numd++; arc4(tst2, tst2_z); numd++; - key(chk2, chk2_z); + key(chk2, chk2_z); arc4(chk2, chk2_z); numd++; /* Output */ - name = strcat(realloc(name, strlen(name)+5), ".x.c"); + name = strcat(realloc(name, strlen(name) + 5), ".x.c"); o = fopen(name, "w"); if (!o) { fprintf(stderr, "%s: creating output file: %s ", my_name, name); @@ -1299,8 +1325,9 @@ int write_C(char * file, char * argv[]) fprintf(o, "#if 0\n"); fprintf(o, "\t%s %s, %s\n", my_name, version, subject); fprintf(o, "\t%s %s %s %s\n\n\t", cpright, provider.f, provider.s, provider.e); - for (indx = 0; argv[indx]; indx++) + for (indx = 0; argv[indx]; indx++) { fprintf(o, "%s ", argv[indx]); + } fprintf(o, "\n#endif\n\n"); fprintf(o, "static char data [] = "); do { @@ -1308,27 +1335,27 @@ int write_C(char * file, char * argv[]) indx = rand_mod(15); do { switch (indx) { - case 0: if (pswd_z>=0) {prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z=done=-1; break;} - case 1: if (msg1_z>=0) {prnt_array(o, msg1, "msg1", msg1_z, 0); msg1_z=done=-1; break;} - case 2: if (date_z>=0) {prnt_array(o, date, "date", date_z, 0); date_z=done=-1; break;} - case 3: if (shll_z>=0) {prnt_array(o, shll, "shll", shll_z, 0); shll_z=done=-1; break;} - case 4: if (inlo_z>=0) {prnt_array(o, inlo, "inlo", inlo_z, 0); inlo_z=done=-1; break;} - case 5: if (xecc_z>=0) {prnt_array(o, xecc, "xecc", xecc_z, 0); xecc_z=done=-1; break;} - case 6: if (lsto_z>=0) {prnt_array(o, lsto, "lsto", lsto_z, 0); lsto_z=done=-1; break;} - case 7: if (tst1_z>=0) {prnt_array(o, tst1, "tst1", tst1_z, 0); tst1_z=done=-1; break;} - case 8: if (chk1_z>=0) {prnt_array(o, chk1, "chk1", chk1_z, 0); chk1_z=done=-1; break;} - case 9: if (msg2_z>=0) {prnt_array(o, msg2, "msg2", msg2_z, 0); msg2_z=done=-1; break;} - case 10: if (rlax_z>=0) {prnt_array(o, rlax, "rlax", rlax_z, 0); rlax_z=done=-1; break;} - case 11: if (opts_z>=0) {prnt_array(o, opts, "opts", opts_z, 0); opts_z=done=-1; break;} - case 12: if (text_z>=0) {prnt_array(o, text, "text", text_z, 0); text_z=done=-1; break;} - case 13: if (tst2_z>=0) {prnt_array(o, tst2, "tst2", tst2_z, 0); tst2_z=done=-1; break;} - case 14: if (chk2_z>=0) {prnt_array(o, chk2, "chk2", chk2_z, 0); chk2_z=done=-1; break;} + case 0: if (pswd_z >= 0) { prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z = done = -1; break; } + case 1: if (msg1_z >= 0) { prnt_array(o, msg1, "msg1", msg1_z, 0); msg1_z = done = -1; break; } + case 2: if (date_z >= 0) { prnt_array(o, date, "date", date_z, 0); date_z = done = -1; break; } + case 3: if (shll_z >= 0) { prnt_array(o, shll, "shll", shll_z, 0); shll_z = done = -1; break; } + case 4: if (inlo_z >= 0) { prnt_array(o, inlo, "inlo", inlo_z, 0); inlo_z = done = -1; break; } + case 5: if (xecc_z >= 0) { prnt_array(o, xecc, "xecc", xecc_z, 0); xecc_z = done = -1; break; } + case 6: if (lsto_z >= 0) { prnt_array(o, lsto, "lsto", lsto_z, 0); lsto_z = done = -1; break; } + case 7: if (tst1_z >= 0) { prnt_array(o, tst1, "tst1", tst1_z, 0); tst1_z = done = -1; break; } + case 8: if (chk1_z >= 0) { prnt_array(o, chk1, "chk1", chk1_z, 0); chk1_z = done = -1; break; } + case 9: if (msg2_z >= 0) { prnt_array(o, msg2, "msg2", msg2_z, 0); msg2_z = done = -1; break; } + case 10: if (rlax_z >= 0) { prnt_array(o, rlax, "rlax", rlax_z, 0); rlax_z = done = -1; break; } + case 11: if (opts_z >= 0) { prnt_array(o, opts, "opts", opts_z, 0); opts_z = done = -1; break; } + case 12: if (text_z >= 0) { prnt_array(o, text, "text", text_z, 0); text_z = done = -1; break; } + case 13: if (tst2_z >= 0) { prnt_array(o, tst2, "tst2", tst2_z, 0); tst2_z = done = -1; break; } + case 14: if (chk2_z >= 0) { prnt_array(o, chk2, "chk2", chk2_z, 0); chk2_z = done = -1; break; } } indx = 0; } while (!done); - } while (numd+=done); + } while (numd += done); fprintf(o, "/* End of data[] */;\n"); - fprintf(o, "#define %s_z %d\n", "hide", 1<<12); + fprintf(o, "#define %s_z %d\n", "hide", 1 << 12); fprintf(o, SETUID_line, SETUID_flag); fprintf(o, DEBUGEXEC_line, DEBUGEXEC_flag); fprintf(o, TRACEABLE_line, TRACEABLE_flag); @@ -1336,8 +1363,9 @@ int write_C(char * file, char * argv[]) fprintf(o, HARDENING_line, HARDENING_flag); fprintf(o, BUSYBOXON_line, BUSYBOXON_flag); fprintf(o, MMAP2_line, MMAP2_flag); - for (indx = 0; RTC[indx]; indx++) + for (indx = 0; RTC[indx]; indx++) { fprintf(o, "%s\n", RTC[indx]); + } fflush(o); fclose(o); @@ -1346,60 +1374,70 @@ int write_C(char * file, char * argv[]) int make(void) { - char * cc, * cflags, * ldflags; + char *cc, *cflags, *ldflags; char cmd[SIZE]; cc = getenv("CC"); - if (!cc) + if (!cc) { cc = "cc"; + } cflags = getenv("CFLAGS"); - if (!cflags) + if (!cflags) { cflags = ""; + } ldflags = getenv("LDFLAGS"); - if (!ldflags) + if (!ldflags) { ldflags = ""; + } - if(!file2){ - file2=(char*)realloc(file2,strlen(file)+3); - strcpy(file2,file); - file2=strcat(file2,".x"); - + if (!file2) { + file2 = (char *)realloc(file2, strlen(file) + 3); + strcpy(file2, file); + file2 = strcat(file2, ".x"); } sprintf(cmd, "%s %s %s %s.x.c -o %s", cc, cflags, ldflags, file, file2); - if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); - if (system(cmd)) + if (verbose) { fprintf(stderr, "%s: %s\n", my_name, cmd); } + if (system(cmd)) { return -1; - char* strip = getenv("STRIP"); - if (!strip) + } + char *strip = getenv("STRIP"); + if (!strip) { strip = "strip"; + } sprintf(cmd, "%s %s", strip, file2); - if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); - if (system(cmd)) + if (verbose) { fprintf(stderr, "%s: %s\n", my_name, cmd); } + if (system(cmd)) { fprintf(stderr, "%s: never mind\n", my_name); + } sprintf(cmd, "chmod ug=rwx,o=rx %s", file2); - if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); - if (system(cmd)) + if (verbose) { fprintf(stderr, "%s: %s\n", my_name, cmd); } + if (system(cmd)) { fprintf(stderr, "%s: remove read permission\n", my_name); + } return 0; } -void do_all(int argc, char * argv[]) +void do_all(int argc, char *argv[]) { parse_args(argc, argv); text = read_script(file); - if (!text) + if (!text) { return; - if (eval_shell(text)) + } + if (eval_shell(text)) { return; - if (write_C(file, argv)) + } + if (write_C(file, argv)) { return; - if (make()) + } + if (make()) { return; + } exit(0); } -int main(int argc, char * argv[]) +int main(int argc, char *argv[]) { putenv("LANG="); do_all(argc, argv); @@ -1408,4 +1446,3 @@ int main(int argc, char * argv[]) exit(1); return 1; } - diff --git a/uncrustify.cfg b/uncrustify.cfg new file mode 100644 index 0000000..db65685 --- /dev/null +++ b/uncrustify.cfg @@ -0,0 +1,1579 @@ +# Uncrustify 0.60 + +# +# General options +# + +# The type of line endings +newlines = auto # auto/lf/crlf/cr + +# The original size of tabs in the input +input_tab_size = 4 # number + +# The size of tabs in the output (only used if align_with_tabs=true) +output_tab_size = 4 # number + +# The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) +string_escape_char = 92 # number + +# Alternate string escape char for Pawn. Only works right before the quote char. +string_escape_char2 = 0 # number + +# Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. +# If true (default), 'assert(x<0 && y>=3)' will be broken. +# Improvements to template detection may make this option obsolete. +tok_split_gte = false # false/true + +# Control what to do with the UTF-8 BOM (recommend 'remove') +utf8_bom = ignore # ignore/add/remove/force + +# If the file contains bytes with values between 128 and 255, but is not UTF-8, then output as UTF-8 +utf8_byte = true # false/true + +# Force the output encoding to UTF-8 +utf8_force = true # false/true + +# +# Indenting +# + +# The number of columns to indent per level. +# Usually 2, 3, 4, or 8. +indent_columns = 4 # number + +# The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. +# For FreeBSD, this is set to 4. Negative value is absolute and not increased for each ( level +indent_continue = 0 # number + +# How to use tabs when indenting code +# 0=spaces only +# 1=indent with tabs to brace level, align with spaces +# 2=indent and align with tabs, using spaces when not on a tabstop +indent_with_tabs = 2 # number + +# Comments that are not a brace level are indented with tabs on a tabstop. +# Requires indent_with_tabs=2. If false, will use spaces. +indent_cmt_with_tabs = false # false/true + +# Whether to indent strings broken by '\' so that they line up +indent_align_string = false # false/true + +# The number of spaces to indent multi-line XML strings. +# Requires indent_align_string=True +indent_xml_string = 0 # number + +# Spaces to indent '{' from level +indent_brace = 0 # number + +# Whether braces are indented to the body level +indent_braces = false # false/true + +# Disabled indenting function braces if indent_braces is true +indent_braces_no_func = false # false/true + +# Disabled indenting class braces if indent_braces is true +indent_braces_no_class = false # false/true + +# Disabled indenting struct braces if indent_braces is true +indent_braces_no_struct = false # false/true + +# Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. +indent_brace_parent = false # false/true + +# Whether the 'namespace' body is indented +indent_namespace = false # false/true + +# The number of spaces to indent a namespace block +indent_namespace_level = 0 # number + +# If the body of the namespace is longer than this number, it won't be indented. +# Requires indent_namespace=true. Default=0 (no limit) +indent_namespace_limit = 0 # number + +# Whether the 'extern "C"' body is indented +indent_extern = false # false/true + +# Whether the 'class' body is indented +indent_class = true # false/true + +# Whether to indent the stuff after a leading class colon +indent_class_colon = true # false/true + +# Virtual indent from the ':' for member initializers. Default is 2 +indent_ctor_init_leading = 2 # number + +# forceitional indenting for constructor initializer list +indent_ctor_init = 0 # number + +# False=treat 'else\nif' as 'else if' for indenting purposes +# True=indent the 'if' one level +indent_else_if = false # false/true + +# Amount to indent variable declarations after a open brace. neg=relative, pos=absolute +indent_var_def_blk = 0 # number + +# Indent continued variable declarations instead of aligning. +indent_var_def_cont = false # false/true + +# True: force indentation of function definition to start in column 1 +# False: use the default behavior +indent_func_def_force_col1 = false # false/true + +# True: indent continued function call parameters one indent level +# False: align parameters under the open paren +indent_func_call_param = true # false/true + +# Same as indent_func_call_param, but for function defs +indent_func_def_param = true # false/true + +# Same as indent_func_call_param, but for function protos +indent_func_proto_param = true # false/true + +# Same as indent_func_call_param, but for class declarations +indent_func_class_param = true # false/true + +# Same as indent_func_call_param, but for class variable constructors +indent_func_ctor_var_param = true # false/true + +# Same as indent_func_call_param, but for templates +indent_template_param = true # false/true + +# Double the indent for indent_func_xxx_param options +indent_func_param_double = false # false/true + +# Indentation column for standalone 'const' function decl/proto qualifier +indent_func_const = 0 # number + +# Indentation column for standalone 'throw' function decl/proto qualifier +indent_func_throw = 0 # number + +# The number of spaces to indent a continued '->' or '.' +# Usually set to 0, 1, or indent_columns. +indent_member = 0 # number + +# Spaces to indent single line ('//') comments on lines before code +indent_single_line_comments_before = 0 # number + +# If set, will indent trailing single line ('//') comments relative +# to the code instead of trying to keep the same absolute column +indent_relative_single_line_comments = false # false/true + +# Spaces to indent 'case' from 'switch' +# Usually 0 or indent_columns. +indent_switch_case = 0 # number + +# Spaces to shift the 'case' line, without affecting any other lines +# Usually 0. +indent_case_shift = 0 # number + +# Spaces to indent '{' from 'case'. +# By default, the brace will appear under the 'c' in case. +# Usually set to 0 or indent_columns. +indent_case_brace = 0 # number + +# Whether to indent comments found in first column +indent_col1_comment = false # false/true + +# How to indent goto labels +# >0 : absolute column where 1 is the leftmost column +# <=0 : subtract from brace indent +indent_label = 1 # number + +# Same as indent_label, but for access specifiers that are followed by a colon +indent_access_spec = 1 # number + +# Indent the code after an access specifier by one level. +# If set, this option forces 'indent_access_spec=0' +indent_access_spec_body = true # false/true + +# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) +indent_paren_nl = false # false/true + +# Controls the indent of a close paren after a newline. +# 0: Indent to body level +# 1: Align under the open paren +# 2: Indent to the brace level +indent_paren_close = 0 # number + +# Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren +indent_comma_paren = 0 # false/true + +# Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren +indent_bool_paren = 0 + +# If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones +indent_first_bool_expr = false # false/true + +# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) +indent_square_nl = false # false/true + +# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies +indent_preserve_sql = false # false/true + +# Align continued statements at the '='. Default=True +# If FALSE or the '=' is followed by a newline, the next line is indent one tab. +indent_align_assign = true # false/true + +# Indent OC blocks at brace level instead of usual rules. +indent_oc_block = false # false/true + +# Indent OC blocks in a message relative to the parameter name. +# 0=use indent_oc_block rules, 1+=spaces to indent +indent_oc_block_msg = 0 # number + +# Minimum indent for subsequent parameters +indent_oc_msg_colon = 0 # number + +# +# Spacing options +# + +# force or remove space around arithmetic operator '+', '-', '/', '*', etc +sp_arith = force # ignore/add/remove/force + +# force or remove space around assignment operator '=', '+=', etc +sp_assign = force # ignore/add/remove/force + +# force or remove space around '=' in C++11 lambda capture specifications. Overrides sp_assign +sp_cpp_lambda_assign = force # ignore/add/remove/force + +# force or remove space after the capture specification in C++11 lambda. +sp_cpp_lambda_square_paren = force # ignore/add/remove/force + +# force or remove space around assignment operator '=' in a prototype +sp_assign_default = force # ignore/add/remove/force + +# force or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. +sp_before_assign = force # ignore/add/remove/force + +# force or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. +sp_after_assign = force # ignore/add/remove/force + +# force or remove space around assignment '=' in enum +sp_enum_assign = force # ignore/add/remove/force + +# force or remove space before assignment '=' in enum. Overrides sp_enum_assign. +sp_enum_before_assign = force # ignore/add/remove/force + +# force or remove space after assignment '=' in enum. Overrides sp_enum_assign. +sp_enum_after_assign = force # ignore/add/remove/force + +# force or remove space around preprocessor '##' concatenation operator. Default=Add +sp_pp_concat = force # ignore/add/remove/force + +# force or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. +sp_pp_stringify = force # ignore/add/remove/force + +# force or remove space before preprocessor '#' stringify operator as in '#define x(y) L#y'. +sp_before_pp_stringify = force # ignore/add/remove/force + +# force or remove space around boolean operators '&&' and '||' +sp_bool = force # ignore/add/remove/force + +# force or remove space around compare operator '<', '>', '==', etc +sp_compare = force # ignore/add/remove/force + +# force or remove space inside '(' and ')' +sp_inside_paren = remove # ignore/add/remove/force + +# force or remove space between nested parens +sp_paren_paren = remove # ignore/add/remove/force + +# Whether to balance spaces inside nested parens +sp_balance_nested_parens = false # false/true + +# force or remove space between ')' and '{' +sp_paren_brace = force # ignore/add/remove/force + +# force or remove space before pointer star '*' +sp_before_ptr_star = force # ignore/add/remove/force + +# force or remove space before pointer star '*' that isn't followed by a variable name +# If set to 'ignore', sp_before_ptr_star is used instead. +sp_before_unnamed_ptr_star = force # ignore/add/remove/force + +# force or remove space between pointer stars '*' +sp_between_ptr_star = remove # ignore/add/remove/force + +# force or remove space after pointer star '*', if followed by a word. +sp_after_ptr_star = remove # ignore/add/remove/force + +# force or remove space after a pointer star '*', if followed by a func proto/def. +sp_after_ptr_star_func = remove # ignore/add/remove/force + +# force or remove space after a pointer star '*', if followed by an open paren (function types). +sp_ptr_star_paren = remove # ignore/add/remove/force + +# force or remove space before a pointer star '*', if followed by a func proto/def. +sp_before_ptr_star_func = remove # ignore/add/remove/force + +# force or remove space before a reference sign '&' +sp_before_byref = force # ignore/add/remove/force + +# force or remove space before a reference sign '&' that isn't followed by a variable name +# If set to 'ignore', sp_before_byref is used instead. +sp_before_unnamed_byref = force # ignore/add/remove/force + +# force or remove space after reference sign '&', if followed by a word. +sp_after_byref = remove # ignore/add/remove/force + +# force or remove space after a reference sign '&', if followed by a func proto/def. +sp_after_byref_func = remove # ignore/add/remove/force + +# force or remove space before a reference sign '&', if followed by a func proto/def. +sp_before_byref_func = remove # ignore/add/remove/force + +# force or remove space between type and word. Default=Force +sp_after_type = force # ignore/add/remove/force + +# force or remove space before the paren in the D constructs 'template Foo(' and 'class Foo('. +sp_before_template_paren = ignore # ignore/add/remove/force + +# force or remove space in 'template <' vs 'template<'. +# If set to ignore, sp_before_angle is used. +sp_template_angle = remove # ignore/add/remove/force + +# force or remove space before '<>' +sp_before_angle = remove # ignore/add/remove/force + +# force or remove space inside '<' and '>' +sp_inside_angle = remove # ignore/add/remove/force + +# force or remove space after '<>' +sp_after_angle = force # ignore/add/remove/force + +# force or remove space between '<>' and '(' as found in 'new List();' +sp_angle_paren = remove # ignore/add/remove/force + +# force or remove space between '<>' and a word as in 'List m;' +sp_angle_word = force # ignore/add/remove/force + +# force or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add +sp_angle_shift = force # ignore/add/remove/force + +# Permit removal of the space between '>>' in 'foo >' (C++11 only). Default=False +# sp_angle_shift cannot remove the space without this option. +sp_permit_cpp11_shift = false # false/true + +# force or remove space before '(' of 'if', 'for', 'switch', and 'while' +sp_before_sparen = force # ignore/add/remove/force + +# force or remove space inside if-condition '(' and ')' +sp_inside_sparen = remove # ignore/add/remove/force + +# force or remove space before if-condition ')'. Overrides sp_inside_sparen. +sp_inside_sparen_close = remove # ignore/add/remove/force + +# force or remove space before if-condition '('. Overrides sp_inside_sparen. +sp_inside_sparen_open = remove # ignore/add/remove/force + +# force or remove space after ')' of 'if', 'for', 'switch', and 'while' +sp_after_sparen = force # ignore/add/remove/force + +# force or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' +sp_sparen_brace = force # ignore/add/remove/force + +# force or remove space between 'invariant' and '(' in the D language. +sp_invariant_paren = force # ignore/add/remove/force + +# force or remove space after the ')' in 'invariant (C) c' in the D language. +sp_after_invariant_paren = force # ignore/add/remove/force + +# force or remove space before empty statement ';' on 'if', 'for' and 'while' +sp_special_semi = remove # ignore/add/remove/force + +# force or remove space before ';'. Default=Remove +sp_before_semi = remove # ignore/add/remove/force + +# force or remove space before ';' in non-empty 'for' statements +sp_before_semi_for = remove # ignore/add/remove/force + +# force or remove space before a semicolon of an empty part of a for statement. +sp_before_semi_for_empty = remove # ignore/add/remove/force + +# force or remove space after ';', except when followed by a comment. Default=Add +sp_after_semi = force # ignore/add/remove/force + +# force or remove space after ';' in non-empty 'for' statements. Default=Force +sp_after_semi_for = force # ignore/add/remove/force + +# force or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). +sp_after_semi_for_empty = remove # ignore/add/remove/force + +# force or remove space before '[' (except '[]') +sp_before_square = remove # ignore/add/remove/force + +# force or remove space before '[]' +sp_before_squares = remove # ignore/add/remove/force + +# force or remove space inside a non-empty '[' and ']' +sp_inside_square = remove # ignore/add/remove/force + +# force or remove space after ',' +sp_after_comma = force # ignore/add/remove/force + +# force or remove space before ',' +sp_before_comma = remove # ignore/add/remove/force + +# force or remove space between an open paren and comma: '(,' vs '( ,' +sp_paren_comma = force # ignore/add/remove/force + +# force or remove space before the variadic '...' when preceded by a non-punctuator +sp_before_ellipsis = remove # ignore/add/remove/force + +# force or remove space after class ':' +sp_after_class_colon = force # ignore/add/remove/force + +# force or remove space before class ':' +sp_before_class_colon = force # ignore/add/remove/force + +# force or remove space before case ':'. Default=Remove +sp_before_case_colon = remove # ignore/add/remove/force + +# force or remove space between 'operator' and operator sign +sp_after_operator = remove # ignore/add/remove/force + +# force or remove space between the operator symbol and the open paren, as in 'operator ++(' +sp_after_operator_sym = remove # ignore/add/remove/force + +# force or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' +sp_after_cast = remove # ignore/add/remove/force + +# force or remove spaces inside cast parens +sp_inside_paren_cast = remove # ignore/add/remove/force + +# force or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' +sp_cpp_cast_paren = force # ignore/add/remove/force + +# force or remove space between 'sizeof' and '(' +sp_sizeof_paren = remove # ignore/add/remove/force + +# force or remove space after the tag keyword (Pawn) +sp_after_tag = ignore # ignore/add/remove/force + +# force or remove space inside enum '{' and '}' +sp_inside_braces_enum = remove # ignore/add/remove/force + +# force or remove space inside struct/union '{' and '}' +sp_inside_braces_struct = remove # ignore/add/remove/force + +# force or remove space inside '{' and '}' +sp_inside_braces = force # ignore/add/remove/force + +# force or remove space inside '{}' +sp_inside_braces_empty = remove # ignore/add/remove/force + +# force or remove space between return type and function name +# A minimum of 1 is forced except for pointer return types. +sp_type_func = force # ignore/add/remove/force + +# force or remove space between function name and '(' on function declaration +sp_func_proto_paren = remove # ignore/add/remove/force + +# force or remove space between function name and '(' on function definition +sp_func_def_paren = remove # ignore/add/remove/force + +# force or remove space inside empty function '()' +sp_inside_fparens = remove # ignore/add/remove/force + +# force or remove space inside function '(' and ')' +sp_inside_fparen = remove # ignore/add/remove/force + +# force or remove space inside the first parens in the function type: 'void (*x)(...)' +sp_inside_tparen = remove # ignore/add/remove/force + +# force or remove between the parens in the function type: 'void (*x)(...)' +sp_after_tparen_close = remove # ignore/add/remove/force + +# force or remove space between ']' and '(' when part of a function call. +sp_square_fparen = remove # ignore/add/remove/force + +# force or remove space between ')' and '{' of function +sp_fparen_brace = force # ignore/add/remove/force + +# force or remove space between function name and '(' on function calls +sp_func_call_paren = remove # ignore/add/remove/force + +# force or remove space between function name and '()' on function calls without parameters. +# If set to 'ignore' (the default), sp_func_call_paren is used. +sp_func_call_paren_empty = remove # ignore/add/remove/force + +# force or remove space between the user function name and '(' on function calls +# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. +sp_func_call_user_paren = ignore # ignore/add/remove/force + +# force or remove space between a constructor/destructor and the open paren +sp_func_class_paren = remove # ignore/add/remove/force + +# force or remove space between 'return' and '(' +sp_return_paren = force # ignore/add/remove/force + +# force or remove space between '__attribute__' and '(' +sp_attribute_paren = remove # ignore/add/remove/force + +# force or remove space between 'defined' and '(' in '#if defined (FOO)' +sp_defined_paren = remove # ignore/add/remove/force + +# force or remove space between 'throw' and '(' in 'throw (something)' +sp_throw_paren = remove # ignore/add/remove/force + +# force or remove space between 'throw' and anything other than '(' as in '@throw [...];' +sp_after_throw = remove # ignore/add/remove/force + +# force or remove space between 'catch' and '(' in 'catch (something) { }' +# If set to ignore, sp_before_sparen is used. +sp_catch_paren = ignore # ignore/add/remove/force + +# force or remove space between 'version' and '(' in 'version (something) { }' (D language) +# If set to ignore, sp_before_sparen is used. +sp_version_paren = ignore # ignore/add/remove/force + +# force or remove space between 'scope' and '(' in 'scope (something) { }' (D language) +# If set to ignore, sp_before_sparen is used. +sp_scope_paren = ignore # ignore/add/remove/force + +# force or remove space between macro and value +sp_macro = ignore # ignore/add/remove/force + +# force or remove space between macro function ')' and value +sp_macro_func = ignore # ignore/add/remove/force + +# force or remove space between 'else' and '{' if on the same line +sp_else_brace = force # ignore/add/remove/force + +# force or remove space between '}' and 'else' if on the same line +sp_brace_else = force # ignore/add/remove/force + +# force or remove space between '}' and the name of a typedef on the same line +sp_brace_typedef = force # ignore/add/remove/force + +# force or remove space between 'catch' and '{' if on the same line +sp_catch_brace = force # ignore/add/remove/force + +# force or remove space between '}' and 'catch' if on the same line +sp_brace_catch = force # ignore/add/remove/force + +# force or remove space between 'finally' and '{' if on the same line +sp_finally_brace = force # ignore/add/remove/force + +# force or remove space between '}' and 'finally' if on the same line +sp_brace_finally = force # ignore/add/remove/force + +# force or remove space between 'try' and '{' if on the same line +sp_try_brace = force # ignore/add/remove/force + +# force or remove space between get/set and '{' if on the same line +sp_getset_brace = ignore # ignore/add/remove/force + +# force or remove space before the '::' operator +sp_before_dc = remove # ignore/add/remove/force + +# force or remove space after the '::' operator +sp_after_dc = remove # ignore/add/remove/force + +# force or remove around the D named array initializer ':' operator +sp_d_array_colon = ignore # ignore/add/remove/force + +# force or remove space after the '!' (not) operator. Default=Remove +sp_not = remove # ignore/add/remove/force + +# force or remove space after the '~' (invert) operator. Default=Remove +sp_inv = remove # ignore/add/remove/force + +# force or remove space after the '&' (address-of) operator. Default=Remove +# This does not affect the spacing after a '&' that is part of a type. +sp_addr = remove # ignore/add/remove/force + +# force or remove space around the '.' or '->' operators. Default=Remove +sp_member = remove # ignore/add/remove/force + +# force or remove space after the '*' (dereference) operator. Default=Remove +# This does not affect the spacing after a '*' that is part of a type. +sp_deref = remove # ignore/add/remove/force + +# force or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove +sp_sign = remove # ignore/add/remove/force + +# force or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove +sp_incdec = remove # ignore/add/remove/force + +# force or remove space before a backslash-newline at the end of a line. Default=Add +sp_before_nl_cont = force # ignore/add/remove/force + +# force or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' +sp_after_oc_scope = ignore # ignore/add/remove/force + +# force or remove space after the colon in message specs +# '-(int) f:(int) x;' vs '-(int) f: (int) x;' +sp_after_oc_colon = ignore # ignore/add/remove/force + +# force or remove space before the colon in message specs +# '-(int) f: (int) x;' vs '-(int) f : (int) x;' +sp_before_oc_colon = ignore # ignore/add/remove/force + +# force or remove space after the colon in immutable dictionary expression +# 'NSDictionary *test = @{@"foo" :@"bar"};' +sp_after_oc_dict_colon = ignore # ignore/add/remove/force + +# force or remove space before the colon in immutable dictionary expression +# 'NSDictionary *test = @{@"foo" :@"bar"};' +sp_before_oc_dict_colon = ignore # ignore/add/remove/force + +# force or remove space after the colon in message specs +# '[object setValue:1];' vs '[object setValue: 1];' +sp_after_send_oc_colon = ignore # ignore/add/remove/force + +# force or remove space before the colon in message specs +# '[object setValue:1];' vs '[object setValue :1];' +sp_before_send_oc_colon = ignore # ignore/add/remove/force + +# force or remove space after the (type) in message specs +# '-(int)f: (int) x;' vs '-(int)f: (int)x;' +sp_after_oc_type = ignore # ignore/add/remove/force + +# force or remove space after the first (type) in message specs +# '-(int) f:(int)x;' vs '-(int)f:(int)x;' +sp_after_oc_return_type = ignore # ignore/add/remove/force + +# force or remove space between '@selector' and '(' +# '@selector(msgName)' vs '@selector (msgName)' +# Also applies to @protocol() constructs +sp_after_oc_at_sel = ignore # ignore/add/remove/force + +# force or remove space between '@selector(x)' and the following word +# '@selector(foo) a:' vs '@selector(foo)a:' +sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force + +# force or remove space inside '@selector' parens +# '@selector(foo)' vs '@selector( foo )' +# Also applies to @protocol() constructs +sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force + +# force or remove space before a block pointer caret +# '^int (int arg){...}' vs. ' ^int (int arg){...}' +sp_before_oc_block_caret = ignore # ignore/add/remove/force + +# force or remove space after a block pointer caret +# '^int (int arg){...}' vs. '^ int (int arg){...}' +sp_after_oc_block_caret = ignore # ignore/add/remove/force + +# force or remove space between the receiver and selector in a message. +# '[receiver selector ...]' +sp_after_oc_msg_receiver = ignore # ignore/add/remove/force + +# force or remove space after @property. +sp_after_oc_property = ignore # ignore/add/remove/force + +# force or remove space around the ':' in 'b ? t : f' +sp_cond_colon = force # ignore/add/remove/force + +# force or remove space around the '?' in 'b ? t : f' +sp_cond_question = ignore # ignore/add/remove/force + +# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. +sp_case_label = force # ignore/add/remove/force + +# Control the space around the D '..' operator. +sp_range = ignore # ignore/add/remove/force + +# Control the spacing after ':' in 'for (TYPE VAR : EXPR)' (Java) +sp_after_for_colon = ignore # ignore/add/remove/force + +# Control the spacing before ':' in 'for (TYPE VAR : EXPR)' (Java) +sp_before_for_colon = ignore # ignore/add/remove/force + +# Control the spacing in 'extern (C)' (D) +sp_extern_paren = ignore # ignore/add/remove/force + +# Control the space after the opening of a C++ comment '// A' vs '//A' +sp_cmt_cpp_start = force # ignore/add/remove/force + +# Controls the spaces between #else or #endif and a trailing comment +sp_endif_cmt = force # ignore/add/remove/force + +# Controls the spaces after 'new', 'delete', and 'delete[]' +sp_after_new = ignore # ignore/add/remove/force + +# Controls the spaces before a trailing or embedded comment +sp_before_tr_cmt = force # ignore/add/remove/force + +# Number of spaces before a trailing or embedded comment +sp_num_before_tr_cmt = 2 # number + +# Control space between a Java annotation and the open paren. +sp_annotation_paren = ignore # ignore/add/remove/force + +# +# Code alignment (not left column spaces/tabs) +# + +# Whether to keep non-indenting tabs +align_keep_tabs = false # false/true + +# Whether to use tabs for aligning +align_with_tabs = true # false/true + +# Whether to bump out to the next tab when aligning +align_on_tabstop = true # false/true + +# Whether to left-align numbers +# align_number_left = false # false/true + +# Align variable definitions in prototypes and functions +align_func_params = false # false/true + +# Align parameters in single-line functions that have the same name. +# The function names must already be aligned with each other. +align_same_func_call_params = false # false/true + +# The span for aligning variable definitions (0=don't align) +align_var_def_span = 0 # number + +# How to align the star in variable definitions. +# 0=Part of the type 'void * foo;' +# 1=Part of the variable 'void *foo;' +# 2=Dangling 'void *foo;' +align_var_def_star_style = 0 # number + +# How to align the '&' in variable definitions. +# 0=Part of the type +# 1=Part of the variable +# 2=Dangling +align_var_def_amp_style = 0 # number + +# The threshold for aligning variable definitions (0=no limit) +align_var_def_thresh = 0 # number + +# The gap for aligning variable definitions +align_var_def_gap = 0 # number + +# Whether to align the colon in struct bit fields +align_var_def_colon = false # false/true + +# Whether to align any attribute after the variable name +align_var_def_attribute = false # false/true + +# Whether to align inline struct/enum/union variable definitions +align_var_def_inline = false # false/true + +# The span for aligning on '=' in assignments (0=don't align) +align_assign_span = 0 # number + +# The threshold for aligning on '=' in assignments (0=no limit) +align_assign_thresh = 0 # number + +# The span for aligning on '=' in enums (0=don't align) +align_enum_equ_span = 1 # number + +# The threshold for aligning on '=' in enums (0=no limit) +align_enum_equ_thresh = 0 # number + +# The span for aligning struct/union (0=don't align) +align_var_struct_span = 20 # number + +# The threshold for aligning struct/union member definitions (0=no limit) +align_var_struct_thresh = 0 # number + +# The gap for aligning struct/union member definitions +align_var_struct_gap = 0 # number + +# The span for aligning struct initializer values (0=don't align) +align_struct_init_span = 0 # number + +# The minimum space between the type and the synonym of a typedef +align_typedef_gap = 0 # number + +# The span for aligning single-line typedefs (0=don't align) +align_typedef_span = 0 # number + +# How to align typedef'd functions with other typedefs +# 0: Don't mix them at all +# 1: align the open paren with the types +# 2: align the function type name with the other type names +align_typedef_func = 0 # number + +# Controls the positioning of the '*' in typedefs. Just try it. +# 0: Align on typedef type, ignore '*' +# 1: The '*' is part of type name: typedef int *pint; +# 2: The '*' is part of the type, but dangling: typedef int *pint; +align_typedef_star_style = 0 # number + +# Controls the positioning of the '&' in typedefs. Just try it. +# 0: Align on typedef type, ignore '&' +# 1: The '&' is part of type name: typedef int &pint; +# 2: The '&' is part of the type, but dangling: typedef int &pint; +align_typedef_amp_style = 0 # number + +# The span for aligning comments that end lines (0=don't align) +align_right_cmt_span = 2 # number + +# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment +align_right_cmt_mix = false # false/true + +# If a trailing comment is more than this number of columns away from the text it follows, +# it will qualify for being aligned. This has to be > 0 to do anything. +align_right_cmt_gap = 0 # number + +# Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) +align_right_cmt_at_col = 0 # number + +# The span for aligning function prototypes (0=don't align) +align_func_proto_span = 0 # number + +# Minimum gap between the return type and the function name. +align_func_proto_gap = 0 # number + +# Align function protos on the 'operator' keyword instead of what follows +align_on_operator = false # false/true + +# Whether to mix aligning prototype and variable declarations. +# If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. +align_mix_var_proto = false # false/true + +# Align single-line functions with function prototypes, uses align_func_proto_span +align_single_line_func = false # false/true + +# Aligning the open brace of single-line functions. +# Requires align_single_line_func=true, uses align_func_proto_span +align_single_line_brace = false # false/true + +# Gap for align_single_line_brace. +align_single_line_brace_gap = 0 # number + +# The span for aligning ObjC msg spec (0=don't align) +align_oc_msg_spec_span = 0 # number + +# Whether to align macros wrapped with a backslash and a newline. +# This will not work right if the macro contains a multi-line comment. +#align_nl_cont = false # false/true + +# # Align macro functions and variables together +align_pp_define_together = false # false/true + +# The minimum space between label and value of a preprocessor define +align_pp_define_gap = 1 # number + +# The span for aligning on '#define' bodies (0=don't align) +align_pp_define_span = 0 # number + +# Align lines that start with '<<' with previous '<<'. Default=true +align_left_shift = true # false/true + +# Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) +align_oc_msg_colon_span = 0 # number + +# If true, always align with the first parameter, even if it is too short. +align_oc_msg_colon_first = false # false/true + +# Aligning parameters in an Obj-C '+' or '-' declaration on the ':' +align_oc_decl_colon = false # false/true + +# +# Newline forceing and removing options +# + +# Whether to collapse empty blocks between '{' and '}' +nl_collapse_empty_body = false # false/true + +# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' +nl_assign_leave_one_liners = true # false/true + +# Don't split one-line braced statements inside a class xx { } body +nl_class_leave_one_liners = true # false/true + +# Don't split one-line enums: 'enum foo { BAR = 15 };' +nl_enum_leave_one_liners = true # false/true + +# Don't split one-line get or set functions +nl_getset_leave_one_liners = true # false/true + +# Don't split one-line function definitions - 'int foo() { return 0; }' +nl_func_leave_one_liners = true # false/true + +# Don't split one-line if/else statements - 'if(a) b++;' +nl_if_leave_one_liners = true # false/true + +# Don't split one-line OC messages +nl_oc_msg_leave_one_liner = false # false/true + +# force or remove newlines at the start of the file +nl_start_of_file = remove # ignore/add/remove/force + +# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' +nl_start_of_file_min = 0 # number + +# force or remove newline at the end of the file +nl_end_of_file = force # ignore/add/remove/force + +# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') +nl_end_of_file_min = 1 # number + +# force or remove newline between '=' and '{' +nl_assign_brace = remove # ignore/add/remove/force + +# force or remove newline between '=' and '[' (D only) +nl_assign_square = remove # ignore/add/remove/force + +# force or remove newline after '= [' (D only). Will also affect the newline before the ']' +nl_after_square_assign = ignore # ignore/add/remove/force + +# The number of blank lines after a block of variable definitions at the top of a function body +# 0 = No change (default) +# nl_func_var_def_blk = 0 # number +nl_var_def_blk_end_func_top = 0 + +# The number of newlines before a block of typedefs +# 0 = No change (default) +nl_typedef_blk_start = 0 # number + +# The number of newlines after a block of typedefs +# 0 = No change (default) +nl_typedef_blk_end = 0 # number + +# The maximum consecutive newlines within a block of typedefs +# 0 = No change (default) +nl_typedef_blk_in = 0 # number + +# The number of newlines before a block of variable definitions not at the top of a function body +# 0 = No change (default) +nl_var_def_blk_start = 0 # number + +# The number of newlines after a block of variable definitions not at the top of a function body +# 0 = No change (default) +nl_var_def_blk_end = 0 # number + +# The maximum consecutive newlines within a block of variable definitions +# 0 = No change (default) +nl_var_def_blk_in = 0 # number + +# force or remove newline between a function call's ')' and '{', as in: +# list_for_each(item, &list) { } +nl_fcall_brace = remove # ignore/add/remove/force + +# force or remove newline between 'enum' and '{' +nl_enum_brace = remove # ignore/add/remove/force + +# force or remove newline between 'struct and '{' +nl_struct_brace = remove # ignore/add/remove/force + +# force or remove newline between 'union' and '{' +nl_union_brace = remove # ignore/add/remove/force + +# force or remove newline between 'if' and '{' +nl_if_brace = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'else' +nl_brace_else = remove # ignore/add/remove/force + +# force or remove newline between 'else if' and '{' +# If set to ignore, nl_if_brace is used instead +nl_elseif_brace = remove # ignore/add/remove/force + +# force or remove newline between 'else' and '{' +nl_else_brace = remove # ignore/add/remove/force + +# force or remove newline between 'else' and 'if' +nl_else_if = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'finally' +nl_brace_finally = remove # ignore/add/remove/force + +# force or remove newline between 'finally' and '{' +nl_finally_brace = remove # ignore/add/remove/force + +# force or remove newline between 'try' and '{' +nl_try_brace = remove # ignore/add/remove/force + +# force or remove newline between get/set and '{' +nl_getset_brace = ignore # ignore/add/remove/force + +# force or remove newline between 'for' and '{' +nl_for_brace = remove # ignore/add/remove/force + +# force or remove newline between 'catch' and '{' +nl_catch_brace = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'catch' +nl_brace_catch = remove # ignore/add/remove/force + +# force or remove newline between 'while' and '{' +nl_while_brace = remove # ignore/add/remove/force + +# force or remove newline between 'scope (x)' and '{' (D) +nl_scope_brace = remove # ignore/add/remove/force + +# force or remove newline between 'unittest' and '{' (D) +nl_unittest_brace = remove # ignore/add/remove/force + +# force or remove newline between 'version (x)' and '{' (D) +nl_version_brace = remove # ignore/add/remove/force + +# force or remove newline between 'using' and '{' +nl_using_brace = remove # ignore/add/remove/force + +# force or remove newline between two open or close braces. +# Due to general newline/brace handling, REMOVE may not work. +nl_brace_brace = force # ignore/add/remove/force + +# force or remove newline between 'do' and '{' +nl_do_brace = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'while' of 'do' statement +nl_brace_while = remove # ignore/add/remove/force + +# force or remove newline between 'switch' and '{' +nl_switch_brace = remove # ignore/add/remove/force + +# force a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. +# Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. +nl_multi_line_cond = false # false/true + +# Force a newline in a define after the macro name for multi-line defines. +nl_multi_line_define = false # false/true + +# Whether to put a newline before 'case' statement +nl_before_case = false # false/true + +# force or remove newline between ')' and 'throw' +nl_before_throw = remove # ignore/add/remove/force + +# Whether to put a newline after 'case' statement +nl_after_case = false # false/true + +# force or remove a newline between a case ':' and '{'. Overrides nl_after_case. +nl_case_colon_brace = remove # ignore/add/remove/force + +# Newline between namespace and { +nl_namespace_brace = remove # ignore/add/remove/force + +# force or remove newline between 'template<>' and whatever follows. +nl_template_class = force # ignore/add/remove/force + +# force or remove newline between 'class' and '{' +nl_class_brace = force # ignore/add/remove/force + +# force or remove newline after each ',' in the constructor member initialization +nl_class_init_args = ignore # ignore/add/remove/force + +# force or remove newline between return type and function name in a function definition +nl_func_type_name = ignore # ignore/add/remove/force + +# force or remove newline between return type and function name inside a class {} +# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. +nl_func_type_name_class = ignore # ignore/add/remove/force + +# force or remove newline between function scope and name in a definition +# Controls the newline after '::' in 'void A::f() { }' +nl_func_scope_name = ignore # ignore/add/remove/force + +# force or remove newline between return type and function name in a prototype +nl_func_proto_type_name = ignore # ignore/add/remove/force + +# force or remove newline between a function name and the opening '(' +nl_func_paren = ignore # ignore/add/remove/force + +# force or remove newline between a function name and the opening '(' in the definition +nl_func_def_paren = ignore # ignore/add/remove/force + +# force or remove newline after '(' in a function declaration +nl_func_decl_start = ignore # ignore/add/remove/force + +# force or remove newline after '(' in a function definition +nl_func_def_start = ignore # ignore/add/remove/force + +# Overrides nl_func_decl_start when there is only one parameter. +nl_func_decl_start_single = ignore # ignore/add/remove/force + +# Overrides nl_func_def_start when there is only one parameter. +nl_func_def_start_single = ignore # ignore/add/remove/force + +# force or remove newline after each ',' in a function declaration +nl_func_decl_args = ignore # ignore/add/remove/force + +# force or remove newline after each ',' in a function definition +nl_func_def_args = ignore # ignore/add/remove/force + +# force or remove newline before the ')' in a function declaration +nl_func_decl_end = remove # ignore/add/remove/force + +# force or remove newline before the ')' in a function definition +nl_func_def_end = remove # ignore/add/remove/force + +# Overrides nl_func_decl_end when there is only one parameter. +nl_func_decl_end_single = ignore # ignore/add/remove/force + +# Overrides nl_func_def_end when there is only one parameter. +nl_func_def_end_single = ignore # ignore/add/remove/force + +# force or remove newline between '()' in a function declaration. +nl_func_decl_empty = remove # ignore/add/remove/force + +# force or remove newline between '()' in a function definition. +nl_func_def_empty = remove # ignore/add/remove/force + +# Whether to put each OC message parameter on a separate line +# See nl_oc_msg_leave_one_liner +nl_oc_msg_args = false # false/true + +# force or remove newline between function signature and '{' +nl_fdef_brace = add # ignore/add/remove/force + +# force or remove a newline between the return keyword and return expression. +nl_return_expr = ignore # ignore/add/remove/force + +# Whether to put a newline after semicolons, except in 'for' statements +nl_after_semicolon = false # false/true + +# Whether to put a newline after brace open. +# This also forces a newline before the matching brace close. +nl_after_brace_open = false # false/true + +# If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is +# placed between the open brace and a trailing single-line comment. +nl_after_brace_open_cmt = false # false/true + +# Whether to put a newline after a virtual brace open with a non-empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open = false # false/true + +# Whether to put a newline after a virtual brace open with an empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open_empty = false # false/true + +# Whether to put a newline after a brace close. +# Does not apply if followed by a necessary ';'. +nl_after_brace_close = false # false/true + +# Whether to put a newline after a virtual brace close. +# Would force a newline before return in: 'if (foo) a++; return;' +nl_after_vbrace_close = true # false/true + +# Control the newline between the close brace and 'b' in: 'struct { int a; } b;' +# Affects enums, unions, and structures. If set to ignore, uses nl_after_brace_close +nl_brace_struct_var = ignore # ignore/add/remove/force + +# Whether to alter newlines in '#define' macros +nl_define_macro = false # false/true + +# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' +nl_squeeze_ifdef = false # false/true + +# force or remove blank line before 'if' +nl_before_if = ignore # ignore/add/remove/force + +# force or remove blank line after 'if' statement +nl_after_if = ignore # ignore/add/remove/force + +# force or remove blank line before 'for' +nl_before_for = ignore # ignore/add/remove/force + +# force or remove blank line after 'for' statement +nl_after_for = ignore # ignore/add/remove/force + +# force or remove blank line before 'while' +nl_before_while = ignore # ignore/add/remove/force + +# force or remove blank line after 'while' statement +nl_after_while = ignore # ignore/add/remove/force + +# force or remove blank line before 'switch' +nl_before_switch = ignore # ignore/add/remove/force + +# force or remove blank line after 'switch' statement +nl_after_switch = ignore # ignore/add/remove/force + +# force or remove blank line before 'do' +nl_before_do = ignore # ignore/add/remove/force + +# force or remove blank line after 'do/while' statement +nl_after_do = ignore # ignore/add/remove/force + +# Whether to double-space commented-entries in struct/enum +nl_ds_struct_enum_cmt = false # false/true + +# Whether to double-space before the close brace of a struct/union/enum +# (lower priority than 'eat_blanks_before_close_brace') +nl_ds_struct_enum_close_brace = false # false/true + +# force or remove a newline around a class colon. +# Related to pos_class_colon, nl_class_init_args, and pos_comma. +nl_class_colon = ignore # ignore/add/remove/force + +# Change simple unbraced if statements into a one-liner +# 'if(b)\n i++;' => 'if(b) i++;' +nl_create_if_one_liner = false # false/true + +# Change simple unbraced for statements into a one-liner +# 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' +nl_create_for_one_liner = false # false/true + +# Change simple unbraced while statements into a one-liner +# 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' +nl_create_while_one_liner = false # false/true + +# +# Positioning options +# + +# The position of arithmetic operators in wrapped expressions +pos_arith = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of assignment in wrapped expressions. +# Do not affect '=' followed by '{' +pos_assign = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of boolean operators in wrapped expressions +pos_bool = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of comparison operators in wrapped expressions +pos_compare = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of conditional (b ? t : f) operators in wrapped expressions +pos_conditional = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in wrapped expressions +pos_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in the constructor initialization list +pos_class_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of colons between constructor and member initialization +pos_class_colon = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# +# Line Splitting options +# + +# Try to limit code width to N number of columns +code_width = 120 # number + +# Whether to fully split long 'for' statements at semi-colons +ls_for_split_full = true # false/true + +# Whether to fully split long function protos/calls at commas +ls_func_split_full = true # false/true + +# Whether to split lines as close to code_width as possible and ignore some groupings +ls_code_width = false # false/true + +# +# Blank line options +# + +# The maximum consecutive newlines +nl_max = 2 # number + +# The number of newlines after a function prototype, if followed by another function prototype +nl_after_func_proto = 0 # number + +# The number of newlines after a function prototype, if not followed by another function prototype +nl_after_func_proto_group = 0 # number + +# The number of newlines after '}' of a multi-line function body +nl_after_func_body = 0 # number + +# The number of newlines after '}' of a multi-line function body in a class declaration +nl_after_func_body_class = 0 # number + +# The number of newlines after '}' of a single line function body +nl_after_func_body_one_liner = 0 # number + +# The minimum number of newlines before a multi-line comment. +# Doesn't apply if after a brace open or another multi-line comment. +nl_before_block_comment = 0 # number + +# The minimum number of newlines before a single-line C comment. +# Doesn't apply if after a brace open or other single-line C comments. +nl_before_c_comment = 0 # number + +# The minimum number of newlines before a CPP comment. +# Doesn't apply if after a brace open or other CPP comments. +nl_before_cpp_comment = 0 # number + +# Whether to force a newline after a multi-line comment. +nl_after_multiline_comment = false # false/true + +# The number of newlines after '}' or ';' of a struct/enum/union definition +nl_after_struct = 0 # number + +# The number of newlines after '}' or ';' of a class definition +nl_after_class = 1 # number + +# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# Will not change the newline count if after a brace open. +# 0 = No change. +nl_before_access_spec = 2 # number + +# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# 0 = No change. +nl_after_access_spec = 0 # number + +# The number of newlines between a function def and the function comment. +# 0 = No change. +nl_comment_func_def = 0 # number + +# The number of newlines after a try-catch-finally block that isn't followed by a brace close. +# 0 = No change. +nl_after_try_catch_finally = 0 # number + +# The number of newlines before and after a property, indexer or event decl. +# 0 = No change. +nl_around_cs_property = 0 # number + +# The number of newlines between the get/set/add/remove handlers in C#. +# 0 = No change. +nl_between_get_set = 0 # number + +# force or remove newline between C# property and the '{' +nl_property_brace = ignore # ignore/add/remove/force + +# Whether to remove blank lines after '{' +eat_blanks_after_open_brace = true # false/true + +# Whether to remove blank lines before '}' +eat_blanks_before_close_brace = true # false/true + +# How aggressively to remove extra newlines not in preproc. +# 0: No change +# 1: Remove most newlines not handled by other config +# 2: Remove all newlines and reformat completely by config +nl_remove_extra_newlines = 0 # number + +# Whether to put a blank line before 'return' statements, unless after an open brace. +nl_before_return = false # false/true + +# Whether to put a blank line after 'return' statements, unless followed by a close brace. +nl_after_return = false # false/true + +# Whether to put a newline after a Java annotation statement. +# Only affects annotations that are after a newline. +nl_after_annotation = ignore # ignore/add/remove/force + +# Controls the newline between two annotations. +nl_between_annotation = ignore # ignore/add/remove/force + +# +# Code modifying options (non-whitespace) +# + +# force or remove braces on single-line 'do' statement +mod_full_brace_do = ignore # ignore/add/remove/force + +# force or remove braces on single-line 'for' statement +mod_full_brace_for = force # ignore/add/remove/force + +# force or remove braces on single-line function definitions. (Pawn) +mod_full_brace_function = ignore # ignore/add/remove/force + +# force or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. +mod_full_brace_if = force # ignore/add/remove/force + +# Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. +# If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. +mod_full_brace_if_chain = 0 + +# Don't remove braces around statements that span N newlines +mod_full_brace_nl = 0 # number + +# force or remove braces on single-line 'while' statement +mod_full_brace_while = force # ignore/add/remove/force + +# force or remove braces on single-line 'using ()' statement +mod_full_brace_using = ignore # ignore/add/remove/force + +# force or remove unnecessary paren on 'return' statement +mod_paren_on_return = remove # ignore/add/remove/force + +# Whether to change optional semicolons to real semicolons +mod_pawn_semicolon = false # false/true + +# force parens on 'while' and 'if' statement around bools +mod_full_paren_if_bool = true # false/true + +# Whether to remove superfluous semicolons +mod_remove_extra_semicolon = true # false/true + +# If a function body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be forceed. +mod_add_long_function_closebrace_comment = 0 # number + +# If a switch body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be forceed. +mod_add_long_switch_closebrace_comment = 0 # number + +# If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after +# the #endif, a comment will be forceed. +mod_add_long_ifdef_endif_comment = 0 # number + +# If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after +# the #else, a comment will be forceed. +mod_add_long_ifdef_else_comment = 10 # number + +# If TRUE, will sort consecutive single-line 'import' statements [Java, D] +mod_sort_import = false # false/true + +# If TRUE, will sort consecutive single-line 'using' statements [C#] +mod_sort_using = true # false/true + +# If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] +# This is generally a bad idea, as it may break your code. +mod_sort_include = true # false/true + +# If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. +mod_move_case_break = false # false/true + +# Will force or remove the braces around a fully braced case statement. +# Will only remove the braces if there are no variable declarations in the block. +mod_case_brace = ignore # ignore/add/remove/force + +# If TRUE, it will remove a void 'return;' that appears as the last statement in a function. +mod_remove_empty_return = true # false/true + +# +# Comment modifications +# + +# Try to wrap comments at cmt_width columns +cmt_width = 0 # number + +# Set the comment reflow mode (default: 0) +# 0: no reflowing (apart from the line wrapping due to cmt_width) +# 1: no touching at all +# 2: full reflow +cmt_reflow_mode = 0 # number + +# If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. +# Default is true. +cmt_indent_multi = true # false/true + +# Whether to group c-comments that look like they are in a block +cmt_c_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined c-comment +cmt_c_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined c-comment +cmt_c_nl_end = false # false/true + +# Whether to group cpp-comments that look like they are in a block +cmt_cpp_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined cpp-comment +cmt_cpp_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined cpp-comment +cmt_cpp_nl_end = false # false/true + +# Whether to change cpp-comments into c-comments +cmt_cpp_to_c = false # false/true + +# Whether to put a star on subsequent comment lines +cmt_star_cont = false # false/true + +# The number of spaces to insert at the start of subsequent comment lines +cmt_sp_before_star_cont = 0 # number + +# The number of spaces to insert after the star on subsequent comment lines +cmt_sp_after_star_cont = 0 # number + +# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of +# the comment are the same length. Default=True +cmt_multi_check_last = false # false/true + +# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. +# Will substitute $(filename) with the current file's name. +cmt_insert_file_header = "" # string + +# The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. +# Will substitute $(filename) with the current file's name. +cmt_insert_file_footer = "" # string + +# The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. +# Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. +# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } +cmt_insert_func_header = "" # string + +# The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. +# Will substitute $(class) with the class name. +cmt_insert_class_header = "" # string + +# The filename that contains text to insert before a Obj-C message specification if the method isn't preceded with a C/C++ comment. +# Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff. +cmt_insert_oc_msg_header = "" # string + +# If a preprocessor is encountered when stepping backwards from a function name, then +# this option decides whether the comment should be inserted. +# Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. +cmt_insert_before_preproc = false # false/true + +# +# Preprocessor options +# + +# Control indent of preprocessors inside #if blocks at brace level 0 +pp_indent = remove # ignore/add/remove/force + +# Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) +pp_indent_at_level = false # false/true + +# If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. +pp_indent_count = 2 # number + +# force or remove space after # based on pp_level of #if blocks +pp_space_after = add # ignore/add/remove/force + +# Sets the number of spaces forceed with pp_space +pp_space_count = 1 # number + +# The indent for #region and #endregion in C# and '#pragma region' in C/C++ +pp_indent_region = 0 # number + +# Whether to indent the code between #region and #endregion +pp_region_indent_code = false # false/true + +# If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level +pp_indent_if = 1 # number + +# Control whether to indent the code between #if, #else and #endif when not at file-level +pp_if_indent_code = false # false/true + +# Whether to indent '#define' at the brace level (true) or from column 1 (false) +pp_define_at_level = true # false/true + +# You can force a token to be a type with the 'type' option. +# Example: +# type myfoo1 myfoo2 +# +# You can create custom macro-based indentation using macro-open, +# macro-else and macro-close. +# Example: +# macro-open BEGIN_TEMPLATE_MESSAGE_MAP +# macro-open BEGIN_MESSAGE_MAP +# macro-close END_MESSAGE_MAP +# +# You can assign any keyword to any type with the set option. +# set func_call_user _ N_ +# +# The full syntax description of all custom definition config entries +# is shown below: +# +# define custom tokens as: +# - embed whitespace in token using '' escape character, or +# put token in quotes +# - these: ' " and ` are recognized as quote delimiters +# +# type token1 token2 token3 ... +# ^ optionally specify multiple tokens on a single line +# define def_token output_token +# ^ output_token is optional, then NULL is assumed +# macro-open token +# macro-close token +# macro-else token +# set id token1 token2 ... +# ^ optionally specify multiple tokens on a single line +# ^ id is one of the names in token_enum.h sans the CT_ prefix, +# e.g. PP_PRAGMA +# +# all tokens are separated by any mix of ',' commas, '=' equal signs +# and whitespace (space, tab) +# From 7eee637ffad01aef187719c449548d81b9d3c473 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Mon, 12 Aug 2024 15:42:10 +0200 Subject: [PATCH 36/83] add test in ttest.sh for -P flag and python --- test/ttest.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/ttest.sh b/test/ttest.sh index dbab360..9b2ca19 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -1,9 +1,9 @@ #!/bin/bash -shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc') +shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc' '/usr/bin/python' '/usr/bin/python2' '/usr/bin/python3') ## Install: sudo apt install dash bash ash ksh zsh tcsh csh rc -check_opts=('' '-r' '-v' '-D' '-S') +check_opts=('' '-r' '-v' '-D' '-S' '-P') shc=${1-shc} @@ -17,12 +17,17 @@ fc=0 echo echo "== Running tests ..." for shell in ${shells[@]}; do + [ -x "$shell" ] || continue for opt in "${check_opts[@]}"; do tmpd=$(mktemp -d) tmpf="$tmpd/test.$(basename $shell)" - echo '#!'"$shell - echo 'Hello World fp:'\$1 sp:\$2 - " > "$tmpf" + echo '#!'"$shell" >"$tmpf" + if [ ${shell#*pyth} = "$shell" ]; then + echo "echo 'Hello World fp:'\$1 sp:\$2" + else + echo 'import sys' + echo 'sys.stdout.write(("Hello World fp:%s sp:%s" % (sys.argv[1],sys.argv[2]))+"\n")' + fi >> "$tmpf" "$shc" $opt -f "$tmpf" -o "$tmpd/a.out" out=$("$tmpd/a.out" first second) #~ echo " Output: $out" From b563090316fdbd04627c99d176a8491059ecb685 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 12 Aug 2024 18:37:31 +0200 Subject: [PATCH 37/83] Ignore developer name --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 07d179c..730a992 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ dynamic = ["version"] [tool.codespell] ignore-words-list = """ -stdio,master,scrpt +stdio,master,scrpt,weerd """ skip = """./.*,*/.metadata,*.xml,configure,*Makefile*,config*,*.m4,man.html""" quiet-level=2 From d2cac421af59ff9b1576bb20db63f85876cedc9d Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Mon, 12 Aug 2024 15:42:10 +0200 Subject: [PATCH 38/83] Test pip & python --- test/ttest.sh | 74 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/test/ttest.sh b/test/ttest.sh index ed5b2c8..85b6095 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -1,9 +1,9 @@ #!/bin/bash -shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc') +shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc' '/usr/bin/python' '/usr/bin/python2' '/usr/bin/python3') ## Install: sudo apt install dash bash ksh zsh tcsh csh rc -check_opts=('' '-r' '-v' '-D' '-S') +check_opts=('' '-r' '-v' '-D' '-S' '-P') shc=${1-shc} @@ -17,30 +17,44 @@ fc=0 echo echo "== Running tests ..." for shell in "${shells[@]}"; do - for opt in "${check_opts[@]}"; do - tmpd=$(mktemp -d) - tmpf="$tmpd/test.$(basename "$shell")" - echo '#!'"$shell - echo 'Hello World fp:'\$1 sp:\$2 - " > "$tmpf" - # shellcheck disable=SC2086 - "$shc" $opt -f "$tmpf" -o "$tmpd/a.out" - out=$("$tmpd/a.out" first second) - #~ echo " Output: $out" - if [[ "$out" = 'Hello World fp:first sp:second' ]]; then - echo "====================================================" - echo -e "=== $shell [with shc $opt]: ${txtgrn}PASSED${txtrst}" - echo "====================================================" - ((pc++)) - else - echo "====================================================" - echo -e "=== $shell [with shc $opt]: ${txtred}FAILED${txtrst}" - echo "====================================================" - stat=1 - ((fc++)) - fi - rm -r "$tmpd" - done + if [ ! -x "$shell" ] ; then + echo "====================================================" + echo -e "=== $shell :${txtred}MISSING${txtrst}" + echo "====================================================" + ((fc++)) + ((pc++)) + continue + fi + for opt in "${check_opts[@]}"; do + tmpd=$(mktemp -d) + tmpf="$tmpd/test.$(basename "$shell")" + { + echo '#!'"$shell" + if [ "${shell#*pyth}" = "$shell" ] ; then + echo "echo 'Hello World fp:'\$1 sp:\$2" + else + echo 'import sys' + echo 'sys.stdout.write(("Hello World fp:%s sp:%s" % (sys.argv[1],sys.argv[2]))+"\n")' + fi + } > "$tmpf" + # shellcheck disable=SC2086 + "$shc" $opt -f "$tmpf" -o "$tmpd/a.out" + out=$("$tmpd/a.out" first second) + #~ echo " Output: $out" + if [[ "$out" = 'Hello World fp:first sp:second' ]]; then + echo "====================================================" + echo -e "=== $shell [with shc $opt]: ${txtgrn}PASSED${txtrst}" + echo "====================================================" + ((pc++)) + else + echo "====================================================" + echo -e "=== $shell [with shc $opt]: ${txtred}FAILED${txtrst}" + echo "====================================================" + stat=1 + ((fc++)) + fi + rm -r "$tmpd" + done done echo @@ -48,15 +62,15 @@ echo "Test Summary" echo "------------" if ((pc>0)); then - pt="${txtgrn}PASSED${txtrst}" + pt="${txtgrn}PASSED${txtrst}" else - pt="PASSED" + pt="PASSED" fi if ((fc>0)); then - ft="${txtred}FAILED${txtrst}" + ft="${txtred}FAILED${txtrst}" else - ft="FAILED" + ft="FAILED" fi echo -e "$pt: $pc" From 792260bb8070c0271929adb49a0386673d89909a Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 12 Aug 2024 19:05:37 +0200 Subject: [PATCH 39/83] Allow skipping of tests --- .github/workflows/ci.yml | 13 +++++ .pre-commit-config.yaml | 2 +- configure.ac | 5 +- test/ttest.sh | 109 ++++++++++++++++++++++++--------------- 4 files changed, 84 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01eba61..d23c886 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,8 @@ jobs: run: sudo apt-get update -q && sudo apt install -y dash bash ksh zsh tcsh csh rc - name: Build and Test (with sanitize) + env: + SKIP: python2 run: | SANITIZE="${SANITIZE} -fsanitize=address" #SANITIZE="${SANITIZE} -fsanitize=thread" @@ -38,9 +40,20 @@ jobs: make CC=gcc CFLAGS="${SANITIZE} -g -O2" LDFLAGS="${SANITIZE_LINK}" test - name: Build and Test (Normal) + env: + SKIP: python2 run: | ./autogen.sh ./configure make clean make make test + + - name: Provide log as artifact + uses: actions/upload-artifact@v4 + if: ${{ ! cancelled() }} + with: + name: shc.failingtests + path: | + /tmp/shc.*.tst/* + retention-days: 2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd69aee..29c422a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,7 +56,7 @@ repos: rev: v6.2.1 hooks: - id: beautysh - exclude: (?x)^(test/.*|config/missing|configure|autogen.sh)$ + exclude: (?x)^(test/test\..*|config/missing|configure|autogen.sh)$ additional_dependencies: - setuptools - repo: https://github.com/codespell-project/codespell diff --git a/configure.ac b/configure.ac index 5caa65d..720be34 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([shc], [4.0.3], [http://github.com/neurobin/shc/issues]) +AC_INIT([shc],[4.0.3],[http://github.com/neurobin/shc/issues]) AC_CONFIG_AUX_DIR(config) #prefix="/usr" AC_CONFIG_SRCDIR([src/shc.c]) @@ -25,4 +25,5 @@ AC_FUNC_REALLOC AC_CHECK_FUNCS([memset putenv strchr strdup strrchr]) -AC_OUTPUT(Makefile src/Makefile) +AC_CONFIG_FILES([Makefile src/Makefile]) +AC_OUTPUT diff --git a/test/ttest.sh b/test/ttest.sh index 85b6095..bbe8347 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -14,47 +14,69 @@ txtrst='\e[0m' # Text Reset stat=0 pc=0 fc=0 +# Comma separated list of shells that are skipped +SKIP=",${SKIP},ash," echo -echo "== Running tests ..." +echo "== Running tests ... (Skip expression: $SKIP)" for shell in "${shells[@]}"; do - if [ ! -x "$shell" ] ; then - echo "====================================================" - echo -e "=== $shell :${txtred}MISSING${txtrst}" - echo "====================================================" - ((fc++)) - ((pc++)) - continue - fi - for opt in "${check_opts[@]}"; do - tmpd=$(mktemp -d) - tmpf="$tmpd/test.$(basename "$shell")" - { - echo '#!'"$shell" - if [ "${shell#*pyth}" = "$shell" ] ; then - echo "echo 'Hello World fp:'\$1 sp:\$2" - else - echo 'import sys' - echo 'sys.stdout.write(("Hello World fp:%s sp:%s" % (sys.argv[1],sys.argv[2]))+"\n")' - fi - } > "$tmpf" - # shellcheck disable=SC2086 - "$shc" $opt -f "$tmpf" -o "$tmpd/a.out" - out=$("$tmpd/a.out" first second) - #~ echo " Output: $out" - if [[ "$out" = 'Hello World fp:first sp:second' ]]; then - echo "====================================================" - echo -e "=== $shell [with shc $opt]: ${txtgrn}PASSED${txtrst}" - echo "====================================================" - ((pc++)) - else - echo "====================================================" - echo -e "=== $shell [with shc $opt]: ${txtred}FAILED${txtrst}" - echo "====================================================" - stat=1 - ((fc++)) + if [ "${SKIP#*,${shell##*/},}" != "$SKIP" ] ; then + echo "====================================================" + echo -e "=== $shell :SKIPPED" + echo "====================================================" + continue fi - rm -r "$tmpd" - done + if [ ! -x "$shell" ] ; then + echo "====================================================" + echo -e "=== $shell :${txtred}MISSING${txtrst}" + echo "====================================================" + ((fc++)) + stat=1 + continue + fi + for opt in "${check_opts[@]}"; do + tmpd=$(mktemp -d /tmp/shc.XXX.tst) + tmpf="$tmpd/test.$(basename "$shell")" + tmpa="$tmpd/a.out" + tmpl="$tmpd/a.log" + out="" + { + echo '#!'"$shell" + if [ "${shell#*pyth}" = "$shell" ] ; then + echo "echo 'Hello World fp:'\$1 sp:\$2" + else + echo 'import sys' + echo 'sys.stdout.write(("Hello World fp:%s sp:%s" % (sys.argv[1],sys.argv[2]))+"\n")' + fi + } > "$tmpf" + # shellcheck disable=SC2086 + "$shc" $opt -f "$tmpf" -o "$tmpa" + # ls -la "$tmpa" + if [ "$opt" = "-D" ] ; then + # Hide debug output + out=$("$tmpa" first second 2>/dev/null) + outdbg=$("$tmpa" first second 2>1) + # TODO: compare dbg output + else + out=$("$tmpa" first second 2>&1) + fi + + if [[ "$out" = 'Hello World fp:first sp:second' ]]; then + echo "====================================================" + echo -e "=== $shell [with shc $opt]: ${txtgrn}PASSED${txtrst}" + echo "====================================================" + ((pc++)) + rm -rf "$tmpd" + else + echo "====================================================" + echo -e "=== $shell [with shc $opt]: ${txtred}FAILED${txtrst}" + echo "====================================================" + echo " Files kept in '$tmpd'" + printf " *** Output:\n%s\n *** End of output\n" "$out" + echo "$out" > "$tmpl" + stat=1 + ((fc++)) + fi + done done echo @@ -62,15 +84,15 @@ echo "Test Summary" echo "------------" if ((pc>0)); then - pt="${txtgrn}PASSED${txtrst}" + pt="${txtgrn}PASSED${txtrst}" else - pt="PASSED" + pt="PASSED" fi if ((fc>0)); then - ft="${txtred}FAILED${txtrst}" + ft="${txtred}FAILED${txtrst}" else - ft="FAILED" + ft="FAILED" fi echo -e "$pt: $pc" @@ -78,4 +100,7 @@ echo -e "$ft: $fc" echo "------------" echo +if ((stat>0)); then + echo "EXIT with code $stat" +fi exit $stat From d233552cf858cf3301ed9673942443161c357b64 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 12 Aug 2024 21:51:43 +0200 Subject: [PATCH 40/83] Fix memory leaks in generated program --- src/shc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/shc.c b/src/shc.c index 28f32c9..7571626 100644 --- a/src/shc.c +++ b/src/shc.c @@ -449,7 +449,7 @@ static const char *RTC[] = { " //Clean temp", " remove(\"/tmp/shc_x.so\");", "", - " //Sinal to detach ptrace", + " //Signal to detach ptrace", " ptrace(PTRACE_DETACH, 0, 0, 0);", " exit(0);", " }", @@ -686,8 +686,10 @@ static const char *RTC[] = { " return 0;", " if (ret) {", " arc4(rlax, rlax_z);", - " if (!rlax[0] && key_with_file(shll))", + " if (!rlax[0] && key_with_file(shll)) {", + " free(varg);", " return shll;", + " }", " arc4(opts, opts_z);", "#if HARDENING", " arc4_hardrun(text, text_z);", @@ -699,19 +701,25 @@ static const char *RTC[] = { " arc4(tst2, tst2_z);", " key(tst2, tst2_z);", " arc4(chk2, chk2_z);", - " if ((chk2_z != tst2_z) || memcmp(tst2, chk2, tst2_z))", + " if ((chk2_z != tst2_z) || memcmp(tst2, chk2, tst2_z)) {", + " free(varg);", " return tst2;", + " }", " /* Prepend hide_z spaces to script text to hide it. */", " scrpt = malloc(hide_z + text_z);", - " if (!scrpt)", + " if (!scrpt) {", + " free(varg);", " return 0;", + " }", " memset(scrpt, (int) ' ', hide_z);", " memcpy(&scrpt[hide_z], text, text_z);", " } else { /* Reexecute */", " if (*xecc) {", " scrpt = malloc(512);", - " if (!scrpt)", + " if (!scrpt) {", + " free(varg);", " return 0;", + " }", " sprintf(scrpt, xecc, me);", " } else {", " scrpt = me;", From 60c86e07875d3e60840bd765c70f4edecb5428ed Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 12 Aug 2024 22:40:39 +0200 Subject: [PATCH 41/83] Fix issue with flagging overflow --- src/shc.c | 1 + test/ttest.sh | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/shc.c b/src/shc.c index 7571626..9ca9bbf 100644 --- a/src/shc.c +++ b/src/shc.c @@ -735,6 +735,7 @@ static const char *RTC[] = { " if(PIPESCRIPT && ret) {", " char tnm[128];", " int l=100;", + " unsigned i=100;", " for(i=getpid(); l--; ) {", " i = (i*1436856257)%1436856259;", " sprintf(tnm, \"/tmp/%08x\", i);", diff --git a/test/ttest.sh b/test/ttest.sh index bbe8347..1c0dbd4 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -51,6 +51,8 @@ for shell in "${shells[@]}"; do # shellcheck disable=SC2086 "$shc" $opt -f "$tmpf" -o "$tmpa" # ls -la "$tmpa" + + expected='Hello World fp:first sp:second' if [ "$opt" = "-D" ] ; then # Hide debug output out=$("$tmpa" first second 2>/dev/null) @@ -59,8 +61,7 @@ for shell in "${shells[@]}"; do else out=$("$tmpa" first second 2>&1) fi - - if [[ "$out" = 'Hello World fp:first sp:second' ]]; then + if [[ "$out" = "$expected" ]]; then echo "====================================================" echo -e "=== $shell [with shc $opt]: ${txtgrn}PASSED${txtrst}" echo "====================================================" @@ -71,7 +72,8 @@ for shell in "${shells[@]}"; do echo -e "=== $shell [with shc $opt]: ${txtred}FAILED${txtrst}" echo "====================================================" echo " Files kept in '$tmpd'" - printf " *** Output:\n%s\n *** End of output\n" "$out" + printf "*** Expected Output:\n%s\n" "$expected" + printf "*** Output:\n%s\n*** End of output\n" "$out" echo "$out" > "$tmpl" stat=1 ((fc++)) From 1e635dab9faec0560b94cf3a0ca012e755f81fda Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 12 Aug 2024 23:25:35 +0200 Subject: [PATCH 42/83] Use unsigned to avoid runtime signed overflow notice & sprintf->snprintf --- src/shc.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/shc.c b/src/shc.c index 9ca9bbf..0d3130a 100644 --- a/src/shc.c +++ b/src/shc.c @@ -395,7 +395,7 @@ static const char *RTC[] = { " cc = getenv(\"CC\");", " if (!cc) cc = \"cc\";", "", - " sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");", + " snprintf(cmd, sizeof(cmd), \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");", " if (system(cmd)) {remove(\"/tmp/shc_x.c\"); return -1;}", " remove(\"/tmp/shc_x.c\"); return 0;", "}", @@ -438,7 +438,7 @@ static const char *RTC[] = { " }", "", " //Do the magic", - " sprintf(tmp3, \"%s %s\", \"'********' 21<<<\", tmp2);", + " snprintf(tmp3, sizeof(tmp3), \"%s %s\", \"'********' 21<<<\", tmp2);", "", " //Exec bash script //fork execl with 'sh -c'", " system(tmp2);", @@ -525,7 +525,7 @@ static const char *RTC[] = { " key(&data, sizeof(data));", " key(&mask, sizeof(mask));", " arc4(&mask, sizeof(mask));", - " sprintf(buff, \"x%lx\", mask);", + " snprintf(buff, sizeof(buff), \"x%lx\", mask);", " string = getenv(buff);", "#if DEBUGEXEC", " fprintf(stderr, \"getenv(%s)=%s\\n\", buff, string ? string : \"\");", @@ -533,7 +533,7 @@ static const char *RTC[] = { " l = strlen(buff);", " if (!string) {", " /* 1st */", - " sprintf(&buff[l], \"=%lu %d\", mask, argc);", + " snprintf(&buff[l], sizeof(buff)-l, \"=%lu %d\", mask, argc);", " putenv(strdup(buff));", " return 0;", " }", @@ -552,7 +552,7 @@ static const char *RTC[] = { "", "static void gets_process_name(const pid_t pid, char * name) {", " char procfile[BUFSIZ];", - " sprintf(procfile, \"/proc/%d/cmdline\", pid);", + " snprintf(procfile, sizeof(procfile), \"/proc/%d/cmdline\", pid);", " FILE* f = fopen(procfile, \"r\");", " if (f) {", " size_t size;", @@ -625,9 +625,9 @@ static const char *RTC[] = { " pid = getppid();", " /* For problematic SunOS ptrace */", "#if defined(__FreeBSD__)", - " sprintf(proc, \"/proc/%d/mem\", (int)pid);", + " snprintf(proc, sizeof(proc), \"/proc/%d/mem\", (int)pid);", "#else", - " sprintf(proc, \"/proc/%d/as\", (int)pid);", + " snprintf(proc, sizeof(proc), \"/proc/%d/as\", (int)pid);", "#endif", " close(0);", " mine = !open(proc, O_RDWR|O_EXCL);", @@ -720,7 +720,7 @@ static const char *RTC[] = { " free(varg);", " return 0;", " }", - " sprintf(scrpt, xecc, me);", + " snprintf(scrpt, 512, xecc, me);", " } else {", " scrpt = me;", " }", @@ -735,11 +735,11 @@ static const char *RTC[] = { " if(PIPESCRIPT && ret) {", " char tnm[128];", " int l=100;", - " unsigned i=100;", - " for(i=getpid(); l--; ) {", - " i = (i*1436856257)%1436856259;", - " sprintf(tnm, \"/tmp/%08x\", i);", - " if(!mkfifo(tnm, S_IWUSR|S_IRUSR)) break;", + " unsigned id;", + " for(id=getpid(); l--; ) {", + " id = (id*1436856257)%1436856259;", + " snprintf(tnm, sizeof(tnm), \"/tmp/%08x\", id);", + " if(!mkfifo(tnm, S_IWUSR|S_IRUSR)) { break; }", " }", " if(l<0) exit(1);", " if((i=fork())) {", @@ -786,8 +786,13 @@ static const char *RTC[] = { "", "int main(int argc, char ** argv)", "{", + "#if defined(__GNUC__)", + "#define _UNUSED_R(x) { int __attribute__((unused)) _tmp = (int) (x); }", + "#else", + "#define _UNUSED_R(x) (void) (x)", + "#endif", "#if SETUID", - " (void) setuid(0);", + " _UNUSED_R(setuid(0));", "#endif", "#if DEBUGEXEC", " debugexec(\"main\", argc, argv);", From 387162730979fa77d9814c1f985954a97f9c6695 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Tue, 13 Aug 2024 00:55:57 +0200 Subject: [PATCH 43/83] use unsigned in random generation to avoid sanitizer warning --- src/shc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/shc.c b/src/shc.c index 9b1a112..b882ae4 100644 --- a/src/shc.c +++ b/src/shc.c @@ -724,9 +724,10 @@ static const char * RTC[] = { " if(PIPESCRIPT && ret) {", " char tnm[128];", " int l=100;", -" for(i=getpid(); l--; ) {", -" i = (i*1436856257)%1436856259;", -" sprintf(tnm, \"/tmp/%08x\", i);", +" unsigned r;", +" for(r=getpid(); l--; ) {", +" r = (r*1436856257)%1436856259;", +" sprintf(tnm, \"/tmp/%08x\", r);", " if(!mkfifo(tnm, S_IWUSR|S_IRUSR)) break;", " }", " if(l<0) exit(1);", From ee754b8fe04542e9c914b25d0d1c19e4b8d491a0 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Tue, 13 Aug 2024 01:01:47 +0200 Subject: [PATCH 44/83] add braces around break --- src/shc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shc.c b/src/shc.c index b882ae4..e9a7427 100644 --- a/src/shc.c +++ b/src/shc.c @@ -728,7 +728,7 @@ static const char * RTC[] = { " for(r=getpid(); l--; ) {", " r = (r*1436856257)%1436856259;", " sprintf(tnm, \"/tmp/%08x\", r);", -" if(!mkfifo(tnm, S_IWUSR|S_IRUSR)) break;", +" if(!mkfifo(tnm, S_IWUSR|S_IRUSR)) { break; }", " }", " if(l<0) exit(1);", " if((i=fork())) {", From 714e92261659adef701de0d320ea2ee0e320eeeb Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Fri, 16 Aug 2024 00:23:11 +0200 Subject: [PATCH 45/83] add SHC_ARGV0 to environment --- src/shc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shc.c b/src/shc.c index e9a7427..1a60ca1 100644 --- a/src/shc.c +++ b/src/shc.c @@ -721,6 +721,7 @@ static const char * RTC[] = { "#else", " varg[j++] = argv[0]; /* My own name at execution */", "#endif", +" setenv(\"SHC_ARGV0\", argv[0], 1);", " if(PIPESCRIPT && ret) {", " char tnm[128];", " int l=100;", From b3f9c99ba0fb8b8f90bac24a01f17f02a50e4afd Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Fri, 16 Aug 2024 14:01:59 +0200 Subject: [PATCH 46/83] added SHC_PID for safer handling of SHC_ARGV0 --- src/shc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shc.c b/src/shc.c index 1a60ca1..9b82be6 100644 --- a/src/shc.c +++ b/src/shc.c @@ -722,6 +722,8 @@ static const char * RTC[] = { " varg[j++] = argv[0]; /* My own name at execution */", "#endif", " setenv(\"SHC_ARGV0\", argv[0], 1);", +" char pids[16]; snprintf(pids, sizeof(pids), \"%d\", getpid());", +" setenv(\"SHC_PID\", pids, 1);", " if(PIPESCRIPT && ret) {", " char tnm[128];", " int l=100;", From f4ff8e18c53acf21bbfee34b03d957449aefe348 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Fri, 16 Aug 2024 23:23:23 +0200 Subject: [PATCH 47/83] first partial draft of argv0 fix, only for *sh --- src/shc.c | 55 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/src/shc.c b/src/shc.c index 9b82be6..ddb4f48 100644 --- a/src/shc.c +++ b/src/shc.c @@ -127,6 +127,7 @@ static char * mail = "Please contact your provider jahidulhamid@yahoo.com"; static char rlax[1]; static char * shll; static char * inlo; +static char * pfmt; static char * xecc; static char * lsto; static char * opts; @@ -668,6 +669,7 @@ static const char * RTC[] = { " return msg1;", " arc4(shll, shll_z);", " arc4(inlo, inlo_z);", +" arc4(pfmt, pfmt_z);", " arc4(xecc, xecc_z);", " arc4(lsto, lsto_z);", " arc4(tst1, tst1_z);", @@ -724,8 +726,8 @@ static const char * RTC[] = { " setenv(\"SHC_ARGV0\", argv[0], 1);", " char pids[16]; snprintf(pids, sizeof(pids), \"%d\", getpid());", " setenv(\"SHC_PID\", pids, 1);", +" char tnm[128];", " if(PIPESCRIPT && ret) {", -" char tnm[128];", " int l=100;", " unsigned r;", " for(r=getpid(); l--; ) {", @@ -753,19 +755,22 @@ static const char * RTC[] = { " }", " _exit(0);", " }", -" varg[j++] = tnm;", " i = (ret > 1) ? ret : 1;/* Args numbering correction */", -" goto xec;", " }", " if (ret && *opts)", " varg[j++] = opts; /* Options on 1st line of code */", " if (*inlo)", " varg[j++] = inlo; /* Option introducing inline code */", -" varg[j++] = scrpt; /* The script itself */", +" char cmd[128];", +" if(PIPESCRIPT && ret) {", +" snprintf(cmd, sizeof(cmd), pfmt, tnm);" +" varg[j++] = cmd;" +" } else {", +" varg[j++] = scrpt; /* The script itself */", +" }", " if (*lsto)", " varg[j++] = lsto; /* Option meaning last option */", " i = (ret > 1) ? ret : 0; /* Args numbering correction */", -"xec:", " while (i < argc)", " varg[j++] = argv[i++]; /* Main run-time arguments */", " varg[j] = 0; /* NULL terminated array */", @@ -1038,23 +1043,24 @@ struct { char * inlo; char * lsto; char * xecc; + char * pfmt; } shellsDB[] = { - { "perl", "-e", "--", "exec('%s',@ARGV);" }, - { "rc", "-c", "", "builtin exec %s $*" }, - { "sh", "-c", "", "exec '%s' \"$@\"" }, /* IRIX_nvi */ - { "dash", "-c", "", "exec '%s' \"$@\"" }, - { "bash", "-c", "", "exec '%s' \"$@\"" }, - { "zsh", "-c", "", "exec '%s' \"$@\"" }, - { "bsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ - { "Rsh", "-c", "", "exec '%s' \"$@\"" }, /* AIX_nvi */ - { "ksh", "-c", "", "exec '%s' \"$@\"" }, /* OK on Solaris, AIX and Linux (THX ) */ - { "tsh", "-c", "--", "exec '%s' \"$@\"" }, /* AIX */ - { "ash", "-c", "--", "exec '%s' \"$@\"" }, /* Linux */ - { "csh", "-c", "-b", "exec '%s' $argv" }, /* AIX: No file for $0 */ - { "tcsh", "-c", "-b", "exec '%s' $argv" }, - { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv)" }, - { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv)" }, - { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv)" }, + { "perl", "-e", "--", "exec('%s',@ARGV);", "" }, + { "rc", "-c", "", "builtin exec %s $*", "" }, + { "sh", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, /* IRIX_nvi */ + { "dash", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, + { "bash", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, + { "zsh", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, + { "bsh", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, /* AIX_nvi */ + { "Rsh", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, /* AIX_nvi */ + { "ksh", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, /* OK on Solaris, AIX and Linux (THX ) */ + { "tsh", "-c", "--", "exec '%s' \"$@\"", ". '%s'" }, /* AIX */ + { "ash", "-c", "--", "exec '%s' \"$@\"", ". '%s'" }, /* Linux */ + { "csh", "-c", "-b", "exec '%s' $argv", "source '%s'" }, /* AIX: No file for $0 */ + { "tcsh", "-c", "-b", "exec '%s' $argv", "source '%s'" }, + { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv)", "" }, + { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv)", "" }, + { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv)", "" }, { NULL, NULL, NULL, NULL }, }; @@ -1098,6 +1104,8 @@ int eval_shell(char * text) if(!strcmp(ptr, shellsDB[i].shll)) { if (!inlo) inlo = strdup(shellsDB[i].inlo); + if (!pfmt) + pfmt = strdup(shellsDB[i].pfmt); if (!xecc) xecc = strdup(shellsDB[i].xecc); if (!lsto) @@ -1241,6 +1249,7 @@ int write_C(char * file, char * argv[]) char* kwsh = strdup(shll); int shll_z = strlen(shll) + 1; int inlo_z = strlen(inlo) + 1; + int pfmt_z = strlen(pfmt) + 1; int xecc_z = strlen(xecc) + 1; int lsto_z = strlen(lsto) + 1; char* tst1 = strdup("location has changed!"); @@ -1273,6 +1282,7 @@ int write_C(char * file, char * argv[]) arc4(date, date_z); numd++; arc4(shll, shll_z); numd++; arc4(inlo, inlo_z); numd++; + arc4(pfmt, pfmt_z); numd++; arc4(xecc, xecc_z); numd++; arc4(lsto, lsto_z); numd++; arc4(tst1, tst1_z); numd++; @@ -1309,7 +1319,7 @@ int write_C(char * file, char * argv[]) fprintf(o, "static char data [] = "); do { done = 0; - indx = rand_mod(15); + indx = rand_mod(16); do { switch (indx) { case 0: if (pswd_z>=0) {prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z=done=-1; break;} @@ -1327,6 +1337,7 @@ int write_C(char * file, char * argv[]) case 12: if (text_z>=0) {prnt_array(o, text, "text", text_z, 0); text_z=done=-1; break;} case 13: if (tst2_z>=0) {prnt_array(o, tst2, "tst2", tst2_z, 0); tst2_z=done=-1; break;} case 14: if (chk2_z>=0) {prnt_array(o, chk2, "chk2", chk2_z, 0); chk2_z=done=-1; break;} + case 15: if (pfmt_z>=0) {prnt_array(o, pfmt, "pfmt", pfmt_z, 0); pfmt_z=done=-1; break;} } indx = 0; } while (!done); From 6d4ebd00df482a452709051ac7b123010c752df4 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 12:33:09 +0200 Subject: [PATCH 48/83] Test $0 value --- test/ttest.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/test/ttest.sh b/test/ttest.sh index 1c0dbd4..3d4314c 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -1,6 +1,6 @@ #!/bin/bash -shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc' '/usr/bin/python' '/usr/bin/python2' '/usr/bin/python3') +shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc' '/usr/bin/python' '/usr/bin/python2' '/usr/bin/python3' '/usr/bin/perl') ## Install: sudo apt install dash bash ksh zsh tcsh csh rc check_opts=('' '-r' '-v' '-D' '-S' '-P') @@ -39,25 +39,35 @@ for shell in "${shells[@]}"; do tmpa="$tmpd/a.out" tmpl="$tmpd/a.log" out="" + expected=${shell}': Hello World sn:'${tmpa}' fp:first sp:second' { echo '#!'"$shell" - if [ "${shell#*pyth}" = "$shell" ] ; then - echo "echo 'Hello World fp:'\$1 sp:\$2" + if [ "${shell#*/pyth}" != "$shell" ] ; then + # Python + echo 'import sys; sys.stdout.write(("'${shell}': Hello World sn:%s fp:%s sp:%s" % (sys.argv[0],sys.argv[1],sys.argv[2]))+"\n")' + elif [ "${shell#*/rc}" != "$shell" ] ; then + # rc + echo 'echo '${shell}': Hello World sn:$0 fp:$1 sp:$2' + elif [ "${shell#*/perl}" != "$shell" ] ; then + # perl + echo 'print "'${shell}': Hello World sn:$0 fp:$ARGV[0] sp:$ARGV[1]";' + elif [ "${shell#*/csh}" != "$shell" ] ; then + # csh - can not forge $0 + echo 'echo "'${shell}:' Hello World fp:$1 sp:$2"' + expected=${shell}': Hello World fp:first sp:second' else - echo 'import sys' - echo 'sys.stdout.write(("Hello World fp:%s sp:%s" % (sys.argv[1],sys.argv[2]))+"\n")' + echo 'echo "'${shell}:' Hello World sn:$0 fp:$1 sp:$2"' fi } > "$tmpf" # shellcheck disable=SC2086 "$shc" $opt -f "$tmpf" -o "$tmpa" # ls -la "$tmpa" - expected='Hello World fp:first sp:second' if [ "$opt" = "-D" ] ; then # Hide debug output out=$("$tmpa" first second 2>/dev/null) - outdbg=$("$tmpa" first second 2>1) # TODO: compare dbg output + # outdbg=$("$tmpa" first second 2>1) else out=$("$tmpa" first second 2>&1) fi From 87f94855adf2435348eaff2637de300f29caae2c Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Sat, 17 Aug 2024 15:17:01 +0200 Subject: [PATCH 49/83] second draft of argv0 fix, includes python, and put argv fix under option -0 (to be seen) --- src/shc.c | 69 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/src/shc.c b/src/shc.c index ddb4f48..d2e276d 100644 --- a/src/shc.c +++ b/src/shc.c @@ -21,9 +21,9 @@ static const char version[] = "Version 4.0.3"; static const char subject[] = "Generic Shell Script Compiler"; static const char cpright[] = "GNU GPL Version 3"; static const struct { const char * f, * s, * e; } - provider = { "Md Jahidul", "Hamid", "" }; + provider = { "Md Jahidul", "Hamid", "" }; -/* +/* static const struct { const char * f, * s, * e; } author = { "Francisco", "Garcia", "" }; */ @@ -67,7 +67,7 @@ static const char * abstract[] = { "", 0}; -static const char usage[] = +static const char usage[] = "Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHPCAB2h] -f script"; static const char * help[] = { @@ -87,6 +87,7 @@ static const char * help[] = { " -H Hardening : extra security protection [no]", " Require bourne shell (sh) and parameters are not supported", " -P Submit script as a pipe [no]", +" -0 Fix handling of argv0 [no]", " -C Display license and exit", " -A Display abstract and exit", " -B Compile for busybox", @@ -154,6 +155,9 @@ static int BUSYBOXON_flag = 0; static const char PIPESCRIPT_line[] = "#define PIPESCRIPT %d /* Define as 1 to submit script as a pipe */\n"; static int PIPESCRIPT_flag = 0; +static const char FIXARGV0_line[] = +"#define FIXARGV0 %d /* Define as 1 fix handling of ARGV0 */\n"; +static int FIXARGV0_flag = 0; static const char * RTC[] = { "", @@ -407,10 +411,10 @@ static const char * RTC[] = { " unsigned char tmp, * ptr = (unsigned char *)tmp2;", " int lentmp = len;", " int pid, status;", -" pid = fork();", "", " shc_x_file();", " if (make()) {exit(1);}", +" pid = fork();", "", " setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);", "", @@ -495,7 +499,7 @@ static const char * RTC[] = { " fprintf(stderr, \"argv=\\n\");", " } else { ", " for (i = 0; i <= argc ; i++)", -" fprintf(stderr, \"argv[%d]=%.60s\\n\", i, argv[i] ? argv[i] : \"\");", +" fprintf(stderr, \"argv[%d]=%s\\n\", i, argv[i] ? argv[i] : \"\");", " }", "}", "#endif /* DEBUGEXEC */", @@ -727,6 +731,7 @@ static const char * RTC[] = { " char pids[16]; snprintf(pids, sizeof(pids), \"%d\", getpid());", " setenv(\"SHC_PID\", pids, 1);", " char tnm[128];", +" char i0=0;", " if(PIPESCRIPT && ret) {", " int l=100;", " unsigned r;", @@ -755,22 +760,27 @@ static const char * RTC[] = { " }", " _exit(0);", " }", -" i = (ret > 1) ? ret : 1;/* Args numbering correction */", +" if(!FIXARGV0) {", +" varg[j++] = tnm;", +" i0=1;", +" goto xec;", +" }", " }", " if (ret && *opts)", " varg[j++] = opts; /* Options on 1st line of code */", " if (*inlo)", " varg[j++] = inlo; /* Option introducing inline code */", -" char cmd[128];", +" char cmd[256];", " if(PIPESCRIPT && ret) {", -" snprintf(cmd, sizeof(cmd), pfmt, tnm);" +" snprintf(cmd, sizeof(cmd), pfmt, argv[0], tnm);" " varg[j++] = cmd;" " } else {", " varg[j++] = scrpt; /* The script itself */", " }", " if (*lsto)", " varg[j++] = lsto; /* Option meaning last option */", -" i = (ret > 1) ? ret : 0; /* Args numbering correction */", +"xec:", +" i = (ret > 1) ? ret : i0; /* Args numbering correction */", " while (i < argc)", " varg[j++] = argv[i++]; /* Main run-time arguments */", " varg[j] = 0; /* NULL terminated array */", @@ -808,7 +818,7 @@ static const char * RTC[] = { static int parse_an_arg(int argc, char * argv[]) { extern char * optarg; - const char * opts = "e:m:f:i:x:l:o:rvDSUHPCAB2h"; + const char * opts = "e:m:f:i:x:l:o:rvDSUHPCAB2h0"; struct tm tmp[1]; time_t expdate; int cnt, l; @@ -875,6 +885,9 @@ static int parse_an_arg(int argc, char * argv[]) case 'P': PIPESCRIPT_flag = 1; break; + case '0': + FIXARGV0_flag = 1; + break; case 'H': HARDENING_flag = 1; break; @@ -947,7 +960,7 @@ static void parse_args(int argc, char * argv[]) if (ret == -1) err++; } while (ret); - + if (err) { fprintf(stderr, "\n%s %s\n\n", my_name, usage); exit(1); @@ -959,7 +972,7 @@ static void parse_args(int argc, char * argv[]) static unsigned char stte[256], indx, jndx, kndx; /* - * Reset arc4 stte. + * Reset arc4 stte. */ void stte_0(void) { @@ -970,7 +983,7 @@ void stte_0(void) } /* - * Set key. Can be used more than once. + * Set key. Can be used more than once. */ void key(void * str, int len) { @@ -989,7 +1002,7 @@ void key(void * str, int len) } /* - * Crypt data. + * Crypt data. */ void arc4(void * str, int len) { @@ -1047,20 +1060,20 @@ struct { } shellsDB[] = { { "perl", "-e", "--", "exec('%s',@ARGV);", "" }, { "rc", "-c", "", "builtin exec %s $*", "" }, - { "sh", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, /* IRIX_nvi */ - { "dash", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, - { "bash", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, - { "zsh", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, - { "bsh", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, /* AIX_nvi */ - { "Rsh", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, /* AIX_nvi */ - { "ksh", "-c", "", "exec '%s' \"$@\"", ". '%s'" }, /* OK on Solaris, AIX and Linux (THX ) */ - { "tsh", "-c", "--", "exec '%s' \"$@\"", ". '%s'" }, /* AIX */ - { "ash", "-c", "--", "exec '%s' \"$@\"", ". '%s'" }, /* Linux */ + { "sh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* IRIX_nvi */ + { "dash", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, + { "bash", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, + { "zsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, + { "bsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX_nvi */ + { "Rsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX_nvi */ + { "ksh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* OK on Solaris, AIX and Linux (THX ) */ + { "tsh", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX */ + { "ash", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* Linux */ { "csh", "-c", "-b", "exec '%s' $argv", "source '%s'" }, /* AIX: No file for $0 */ { "tcsh", "-c", "-b", "exec '%s' $argv", "source '%s'" }, - { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv)", "" }, - { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv)", "" }, - { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv)", "" }, + { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];%.0s exec(open('%s').read())" }, + { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, + { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read()" }, { NULL, NULL, NULL, NULL }, }; @@ -1348,6 +1361,7 @@ int write_C(char * file, char * argv[]) fprintf(o, DEBUGEXEC_line, DEBUGEXEC_flag); fprintf(o, TRACEABLE_line, TRACEABLE_flag); fprintf(o, PIPESCRIPT_line, PIPESCRIPT_flag); + fprintf(o, FIXARGV0_line, FIXARGV0_flag); fprintf(o, HARDENING_line, HARDENING_flag); fprintf(o, BUSYBOXON_line, BUSYBOXON_flag); fprintf(o, MMAP2_line, MMAP2_flag); @@ -1407,6 +1421,9 @@ void do_all(int argc, char * argv[]) return; if (eval_shell(text)) return; + if(strstr(shll, "python")) { + PIPESCRIPT_flag=1; + } if (write_C(file, argv)) return; if (make()) From 163b5f9747800c9157a1f4eaee95d1887a8ce7b6 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 16:01:04 +0200 Subject: [PATCH 50/83] Add several test script to pre-commit checks --- .pre-commit-config.yaml | 2 +- test/match | 19 ++++++++++--------- test/ttest.sh | 14 +++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 29c422a..7554dcc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -91,7 +91,7 @@ repos: rev: v0.10.0.1 hooks: - id: shellcheck - exclude: (?x)^(test/.*)$ + exclude: (?x)^(test/test.*)$ # args: [-x,-e1007,-e1009,-e1072,-e1073] - repo: https://github.com/pocc/pre-commit-hooks rev: v1.3.5 diff --git a/test/match b/test/match index 041eec9..6a3a437 100644 --- a/test/match +++ b/test/match @@ -5,20 +5,21 @@ # IFS=":$IFS" -for substring in $@ +for substring in "$@" do - for path in $PATH - do - for command in $path/*$substring* + for path in $PATH do - if [ -f $command ] - then - echo $command - fi + for command in "$path/"*"$substring"* + do + if [ -f "$command" ] + then + echo "$command" + fi + done done - done done # Added echo "[$$] PAUSED... Hit return!" +# shellcheck disable=2162,2034 read DUMMY diff --git a/test/ttest.sh b/test/ttest.sh index 3d4314c..9b2db3d 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -1,5 +1,5 @@ #!/bin/bash - +# shellcheck disable=2016,2028 shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc' '/usr/bin/python' '/usr/bin/python2' '/usr/bin/python3' '/usr/bin/perl') ## Install: sudo apt install dash bash ksh zsh tcsh csh rc @@ -19,7 +19,7 @@ SKIP=",${SKIP},ash," echo echo "== Running tests ... (Skip expression: $SKIP)" for shell in "${shells[@]}"; do - if [ "${SKIP#*,${shell##*/},}" != "$SKIP" ] ; then + if [ "${SKIP#*,"${shell##*/}",}" != "$SKIP" ] ; then echo "====================================================" echo -e "=== $shell :SKIPPED" echo "====================================================" @@ -44,19 +44,19 @@ for shell in "${shells[@]}"; do echo '#!'"$shell" if [ "${shell#*/pyth}" != "$shell" ] ; then # Python - echo 'import sys; sys.stdout.write(("'${shell}': Hello World sn:%s fp:%s sp:%s" % (sys.argv[0],sys.argv[1],sys.argv[2]))+"\n")' + echo 'import sys; sys.stdout.write(("'"${shell}"': Hello World sn:%s fp:%s sp:%s" % (sys.argv[0],sys.argv[1],sys.argv[2]))+"\n")' elif [ "${shell#*/rc}" != "$shell" ] ; then # rc - echo 'echo '${shell}': Hello World sn:$0 fp:$1 sp:$2' + echo 'echo '"${shell}"': Hello World sn:$0 fp:$1 sp:$2' elif [ "${shell#*/perl}" != "$shell" ] ; then # perl - echo 'print "'${shell}': Hello World sn:$0 fp:$ARGV[0] sp:$ARGV[1]";' + echo 'print "'"${shell}"': Hello World sn:$0 fp:$ARGV[0] sp:$ARGV[1]";' elif [ "${shell#*/csh}" != "$shell" ] ; then # csh - can not forge $0 - echo 'echo "'${shell}:' Hello World fp:$1 sp:$2"' + echo 'echo "'"${shell}":' Hello World fp:$1 sp:$2"' expected=${shell}': Hello World fp:first sp:second' else - echo 'echo "'${shell}:' Hello World sn:$0 fp:$1 sp:$2"' + echo 'echo "'"${shell}":' Hello World sn:$0 fp:$1 sp:$2"' fi } > "$tmpf" # shellcheck disable=SC2086 From bd058ff714ee718fc0f6bed07657d66a5c2d375f Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 16:02:11 +0200 Subject: [PATCH 51/83] Duplicate strings before encryption to print unmangled args --- src/shc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/shc.c b/src/shc.c index 919d585..02789c1 100644 --- a/src/shc.c +++ b/src/shc.c @@ -855,13 +855,13 @@ static int parse_an_arg(int argc, char *argv[]) file = optarg; break; case 'i': - inlo = optarg; + inlo = strdup(optarg); // Gets encrypted break; case 'x': - xecc = optarg; + xecc = strdup(optarg); // Gets encrypted break; case 'l': - lsto = optarg; + lsto = strdup(optarg); // Gets encrypted break; case 'o': file2 = optarg; @@ -1304,7 +1304,7 @@ void cleanup_write_c(char *msg1, char *msg2, char *chk1, char *chk2, char *tst1, if (name) { free(name); } } -int write_C(char *file, char *argv[]) +int write_C(char *file, int argc, char *argv[]) { char pswd[256]; int pswd_z = sizeof(pswd); @@ -1379,7 +1379,7 @@ int write_C(char *file, char *argv[]) fprintf(o, "#if 0\n"); fprintf(o, "\t%s %s, %s\n", my_name, version, subject); fprintf(o, "\t%s %s %s %s\n\n\t", cpright, provider.f, provider.s, provider.e); - for (l_idx = 0; argv[l_idx]; l_idx++) { + for (l_idx = 0; l_idx < argc; l_idx++) { fprintf(o, "%s ", argv[l_idx]); } fprintf(o, "\n#endif\n\n"); @@ -1489,7 +1489,7 @@ void do_all(int argc, char *argv[]) if (eval_shell(text)) { return; } - if (write_C(file, argv)) { + if (write_C(file, argc, argv)) { return; } if (make()) { From 219fbc3a1edc38f326e428fc15980456005cc144 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 16:36:08 +0200 Subject: [PATCH 52/83] Add flow (actions & test runs) --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++ .github/workflows/generate.yml | 39 ++++++++++++++ .github/workflows/pre-commit.yml | 51 +++++++++++++++++++ test/ttest.sh | 87 ++++++++++++++++++++++++-------- 4 files changed, 216 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/generate.yml create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d23c886 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apt-get update -q && sudo apt install -y dash bash ksh zsh tcsh csh rc + + - name: Build and Test (with sanitize) + env: + SKIP: python2 + run: | + SANITIZE="${SANITIZE} -fsanitize=address" + #SANITIZE="${SANITIZE} -fsanitize=thread" + SANITIZE="${SANITIZE} -fsanitize=leak" + SANITIZE="${SANITIZE} -fsanitize=undefined" + SANITIZE="${SANITIZE} -fsanitize=integer-divide-by-zero" + # SANITIZE="${SANITIZE} -fsanitize=vla-bound" + SANITIZE="${SANITIZE} -fsanitize=null" + SANITIZE="${SANITIZE} -fsanitize=signed-integer-overflow" + SANITIZE="${SANITIZE} -fsanitize=bounds" + #SANITIZE="${SANITIZE} -fsanitize=bounds-strict" + SANITIZE="${SANITIZE} -fsanitize=bool" + SANITIZE="${SANITIZE} -fsanitize=enum" + #SANITIZE="${SANITIZE} -fsanitize-recover" # will try to continue running the program + #SANITIZE_LINK="-static-libasan -static -lasan -static -lubsan -ldl -lm" + SANITIZE_LINK="-l:libasan.a -l:libubsan.a -ldl -lm" + SANITIZE="${SANITIZE} -fno-sanitize=alignment" + ./autogen.sh + ./configure + make clean + make CFLAGS="${SANITIZE} -g -O2" LDFLAGS="${SANITIZE_LINK}" + make CC=gcc CFLAGS="${SANITIZE} -g -O2" LDFLAGS="${SANITIZE_LINK}" test + + - name: Build and Test (Normal) + env: + SKIP: python2 + run: | + ./autogen.sh + ./configure + make clean + make + make test + + - name: Provide log as artifact + uses: actions/upload-artifact@v4 + if: ${{ ! cancelled() }} + with: + name: shc.failingtests + path: | + /tmp/shc.*.tst/* + retention-days: 2 diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml new file mode 100644 index 0000000..bf65d7e --- /dev/null +++ b/.github/workflows/generate.yml @@ -0,0 +1,39 @@ +--- +name: Generate files (documentation, autotools) +on: + push: + paths: [man.md, aclocal.m4, configure.ac] + workflow_dispatch: +jobs: + convert_via_pandoc: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v2 + id: changes + with: + filters: | + man: + - 'man.md' + autotools: + - 'aclocal.m4' + - 'configure.ac' + - uses: docker://pandoc/core:3.3 + if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' }} + with: + args: -s man.md -t man -o shc.1 + - uses: docker://pandoc/core:3.3 + if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' }} + with: + args: -s man.md -t html -o man.html + - run: |- + ./autogen.sh + if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.autotools == 'true' }} + - name: Commit changes + if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' || steps.changes.outputs.autotools }} + run: |- + for r in $(git remote) ; do git remote get-url --all $r ; done + git config user.name github-actions + git config user.email github-actions@github.com + git commit -a -m "ci: Github Action Generate Files" + git push diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..63e17e9 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,51 @@ +--- +name: pre-commit +on: + pull_request: + push: +jobs: + pre-commit: + runs-on: ubuntu-latest + env: + RAW_LOG: pre-commit.log + CS_XML: pre-commit.xml + steps: + - run: sudo apt-get update && sudo apt-get install cppcheck + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + cache: pip + python-version: "3.12.1" + - run: python -m pip install pre-commit + - uses: actions/cache/restore@v4 + with: + path: ~/.cache/pre-commit/ + key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') + }} + - name: Run pre-commit hooks + env: + SKIP: uncrustify + run: | + set -o pipefail + pre-commit gc + pre-commit run --show-diff-on-failure --color=always --all-files | tee ${RAW_LOG} + - name: Convert Raw Log to Annotations + uses: mdeweerd/logToCheckStyle@v2024.3.5 + if: ${{ failure() }} + with: + in: ${{ env.RAW_LOG }} + - uses: actions/cache/save@v4 + if: ${{ ! cancelled() }} + with: + path: ~/.cache/pre-commit/ + key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') + }} + - name: Provide log as artifact + uses: actions/upload-artifact@v4 + if: ${{ ! cancelled() }} + with: + name: precommit-logs + path: | + ${{ env.RAW_LOG }} + ${{ env.CS_XML }} + retention-days: 2 diff --git a/test/ttest.sh b/test/ttest.sh index 9b2ca19..9b2db3d 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -1,7 +1,7 @@ #!/bin/bash - -shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc' '/usr/bin/python' '/usr/bin/python2' '/usr/bin/python3') -## Install: sudo apt install dash bash ash ksh zsh tcsh csh rc +# shellcheck disable=2016,2028 +shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc' '/usr/bin/python' '/usr/bin/python2' '/usr/bin/python3' '/usr/bin/perl') +## Install: sudo apt install dash bash ksh zsh tcsh csh rc check_opts=('' '-r' '-v' '-D' '-S' '-P') @@ -14,36 +14,80 @@ txtrst='\e[0m' # Text Reset stat=0 pc=0 fc=0 +# Comma separated list of shells that are skipped +SKIP=",${SKIP},ash," echo -echo "== Running tests ..." -for shell in ${shells[@]}; do - [ -x "$shell" ] || continue +echo "== Running tests ... (Skip expression: $SKIP)" +for shell in "${shells[@]}"; do + if [ "${SKIP#*,"${shell##*/}",}" != "$SKIP" ] ; then + echo "====================================================" + echo -e "=== $shell :SKIPPED" + echo "====================================================" + continue + fi + if [ ! -x "$shell" ] ; then + echo "====================================================" + echo -e "=== $shell :${txtred}MISSING${txtrst}" + echo "====================================================" + ((fc++)) + stat=1 + continue + fi for opt in "${check_opts[@]}"; do - tmpd=$(mktemp -d) - tmpf="$tmpd/test.$(basename $shell)" - echo '#!'"$shell" >"$tmpf" - if [ ${shell#*pyth} = "$shell" ]; then - echo "echo 'Hello World fp:'\$1 sp:\$2" - else - echo 'import sys' - echo 'sys.stdout.write(("Hello World fp:%s sp:%s" % (sys.argv[1],sys.argv[2]))+"\n")' - fi >> "$tmpf" - "$shc" $opt -f "$tmpf" -o "$tmpd/a.out" - out=$("$tmpd/a.out" first second) - #~ echo " Output: $out" - if [[ "$out" = 'Hello World fp:first sp:second' ]]; then + tmpd=$(mktemp -d /tmp/shc.XXX.tst) + tmpf="$tmpd/test.$(basename "$shell")" + tmpa="$tmpd/a.out" + tmpl="$tmpd/a.log" + out="" + expected=${shell}': Hello World sn:'${tmpa}' fp:first sp:second' + { + echo '#!'"$shell" + if [ "${shell#*/pyth}" != "$shell" ] ; then + # Python + echo 'import sys; sys.stdout.write(("'"${shell}"': Hello World sn:%s fp:%s sp:%s" % (sys.argv[0],sys.argv[1],sys.argv[2]))+"\n")' + elif [ "${shell#*/rc}" != "$shell" ] ; then + # rc + echo 'echo '"${shell}"': Hello World sn:$0 fp:$1 sp:$2' + elif [ "${shell#*/perl}" != "$shell" ] ; then + # perl + echo 'print "'"${shell}"': Hello World sn:$0 fp:$ARGV[0] sp:$ARGV[1]";' + elif [ "${shell#*/csh}" != "$shell" ] ; then + # csh - can not forge $0 + echo 'echo "'"${shell}":' Hello World fp:$1 sp:$2"' + expected=${shell}': Hello World fp:first sp:second' + else + echo 'echo "'"${shell}":' Hello World sn:$0 fp:$1 sp:$2"' + fi + } > "$tmpf" + # shellcheck disable=SC2086 + "$shc" $opt -f "$tmpf" -o "$tmpa" + # ls -la "$tmpa" + + if [ "$opt" = "-D" ] ; then + # Hide debug output + out=$("$tmpa" first second 2>/dev/null) + # TODO: compare dbg output + # outdbg=$("$tmpa" first second 2>1) + else + out=$("$tmpa" first second 2>&1) + fi + if [[ "$out" = "$expected" ]]; then echo "====================================================" echo -e "=== $shell [with shc $opt]: ${txtgrn}PASSED${txtrst}" echo "====================================================" ((pc++)) + rm -rf "$tmpd" else echo "====================================================" echo -e "=== $shell [with shc $opt]: ${txtred}FAILED${txtrst}" echo "====================================================" + echo " Files kept in '$tmpd'" + printf "*** Expected Output:\n%s\n" "$expected" + printf "*** Output:\n%s\n*** End of output\n" "$out" + echo "$out" > "$tmpl" stat=1 ((fc++)) fi - rm -r "$tmpd" done done @@ -68,4 +112,7 @@ echo -e "$ft: $fc" echo "------------" echo +if ((stat>0)); then + echo "EXIT with code $stat" +fi exit $stat From a834aa4ccdac23d58f21f5b0b3830b57442007b1 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 16:44:01 +0200 Subject: [PATCH 53/83] Disable sanitize run for fork evaluation --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d23c886..34f309d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ jobs: run: sudo apt-get update -q && sudo apt install -y dash bash ksh zsh tcsh csh rc - name: Build and Test (with sanitize) + if: false env: SKIP: python2 run: | From 3d64ca3bb932b1fb9e07421ea1df99c322a22109 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 17:03:56 +0200 Subject: [PATCH 54/83] Uncrustify before merge --- .pre-commit-config.yaml | 101 +++ uncrustify.cfg | 1579 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 1680 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 uncrustify.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..29c422a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,101 @@ +--- +exclude: + (?x)^( + configure| + configure\..*| + .cache/.*| + .*Makefile.in| + .*Makefile.am| + autogen.sh| + config/install-sh| + config/depcomp| + config/compile| + config/missing| + aclocal.m4| + __NONE__)$ +repos: + - repo: https://github.com/executablebooks/mdformat + # Do this before other tools "fixing" the line endings + rev: 0.7.17 + hooks: + - id: mdformat + name: Format Markdown + stages: [manual] + entry: mdformat # Executable to run, with fixed options + language: python + types: [markdown] + args: [--wrap, '75', --number] + additional_dependencies: + - mdformat-toc + - mdformat-gfm + - mdformat-beautysh + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + # - id: no-commit-to-branch + # args: [--branch, main] + - id: debug-statements + - id: end-of-file-fixer + exclude: ^(test/.*)$ + - id: trailing-whitespace + exclude: .*\.md$ + - id: check-json + - id: mixed-line-ending + - id: check-builtin-literals + args: [--ignore=dict] + - id: check-ast + - id: check-merge-conflict + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + exclude: ^(test/.*)$ + - id: check-docstring-first + - id: fix-byte-order-marker + - id: check-case-conflict + - id: check-toml + - repo: https://github.com/lovesegfault/beautysh.git + rev: v6.2.1 + hooks: + - id: beautysh + exclude: (?x)^(test/test\..*|config/missing|configure|autogen.sh)$ + additional_dependencies: + - setuptools + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + args: + - --toml + - pyproject.toml + additional_dependencies: + - tomli + - repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + # Install dependencies on windows: + # choco install llvm uncrustify cppcheck + hooks: + - id: uncrustify + args: [--replace, --no-backup, -c, uncrustify.cfg] + - id: cppcheck + args: + - --force + #- --std=c99 + - --language=c + #- -IInc + - '--template={file}({line}): {severity} ({id}): {message}' + - --inline-suppr + - id: cpplint + args: ["--filter=-build/header_guard,-build/include,-build/include_subdir,-legal/copyright,-readability/casting,-readability/fn_size,-whitespace/blank_line,-whitespace/braces,-whitespace/comma,-whitespace/comments,-whitespace/line_length,-whitespace/newline,-whitespace/operators,-whitespace/parens,-whitespace/semicolon,-whitespace/tab,-whitespace/todo"] + additional_dependencies: + - cpplint>=1.6.1 + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 + hooks: + - id: shellcheck + exclude: (?x)^(test/.*)$ + # args: [-x,-e1007,-e1009,-e1072,-e1073] + - repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + hooks: + - id: clang-format + stages: [manual] + args: [-i] diff --git a/uncrustify.cfg b/uncrustify.cfg new file mode 100644 index 0000000..db65685 --- /dev/null +++ b/uncrustify.cfg @@ -0,0 +1,1579 @@ +# Uncrustify 0.60 + +# +# General options +# + +# The type of line endings +newlines = auto # auto/lf/crlf/cr + +# The original size of tabs in the input +input_tab_size = 4 # number + +# The size of tabs in the output (only used if align_with_tabs=true) +output_tab_size = 4 # number + +# The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) +string_escape_char = 92 # number + +# Alternate string escape char for Pawn. Only works right before the quote char. +string_escape_char2 = 0 # number + +# Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. +# If true (default), 'assert(x<0 && y>=3)' will be broken. +# Improvements to template detection may make this option obsolete. +tok_split_gte = false # false/true + +# Control what to do with the UTF-8 BOM (recommend 'remove') +utf8_bom = ignore # ignore/add/remove/force + +# If the file contains bytes with values between 128 and 255, but is not UTF-8, then output as UTF-8 +utf8_byte = true # false/true + +# Force the output encoding to UTF-8 +utf8_force = true # false/true + +# +# Indenting +# + +# The number of columns to indent per level. +# Usually 2, 3, 4, or 8. +indent_columns = 4 # number + +# The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. +# For FreeBSD, this is set to 4. Negative value is absolute and not increased for each ( level +indent_continue = 0 # number + +# How to use tabs when indenting code +# 0=spaces only +# 1=indent with tabs to brace level, align with spaces +# 2=indent and align with tabs, using spaces when not on a tabstop +indent_with_tabs = 2 # number + +# Comments that are not a brace level are indented with tabs on a tabstop. +# Requires indent_with_tabs=2. If false, will use spaces. +indent_cmt_with_tabs = false # false/true + +# Whether to indent strings broken by '\' so that they line up +indent_align_string = false # false/true + +# The number of spaces to indent multi-line XML strings. +# Requires indent_align_string=True +indent_xml_string = 0 # number + +# Spaces to indent '{' from level +indent_brace = 0 # number + +# Whether braces are indented to the body level +indent_braces = false # false/true + +# Disabled indenting function braces if indent_braces is true +indent_braces_no_func = false # false/true + +# Disabled indenting class braces if indent_braces is true +indent_braces_no_class = false # false/true + +# Disabled indenting struct braces if indent_braces is true +indent_braces_no_struct = false # false/true + +# Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. +indent_brace_parent = false # false/true + +# Whether the 'namespace' body is indented +indent_namespace = false # false/true + +# The number of spaces to indent a namespace block +indent_namespace_level = 0 # number + +# If the body of the namespace is longer than this number, it won't be indented. +# Requires indent_namespace=true. Default=0 (no limit) +indent_namespace_limit = 0 # number + +# Whether the 'extern "C"' body is indented +indent_extern = false # false/true + +# Whether the 'class' body is indented +indent_class = true # false/true + +# Whether to indent the stuff after a leading class colon +indent_class_colon = true # false/true + +# Virtual indent from the ':' for member initializers. Default is 2 +indent_ctor_init_leading = 2 # number + +# forceitional indenting for constructor initializer list +indent_ctor_init = 0 # number + +# False=treat 'else\nif' as 'else if' for indenting purposes +# True=indent the 'if' one level +indent_else_if = false # false/true + +# Amount to indent variable declarations after a open brace. neg=relative, pos=absolute +indent_var_def_blk = 0 # number + +# Indent continued variable declarations instead of aligning. +indent_var_def_cont = false # false/true + +# True: force indentation of function definition to start in column 1 +# False: use the default behavior +indent_func_def_force_col1 = false # false/true + +# True: indent continued function call parameters one indent level +# False: align parameters under the open paren +indent_func_call_param = true # false/true + +# Same as indent_func_call_param, but for function defs +indent_func_def_param = true # false/true + +# Same as indent_func_call_param, but for function protos +indent_func_proto_param = true # false/true + +# Same as indent_func_call_param, but for class declarations +indent_func_class_param = true # false/true + +# Same as indent_func_call_param, but for class variable constructors +indent_func_ctor_var_param = true # false/true + +# Same as indent_func_call_param, but for templates +indent_template_param = true # false/true + +# Double the indent for indent_func_xxx_param options +indent_func_param_double = false # false/true + +# Indentation column for standalone 'const' function decl/proto qualifier +indent_func_const = 0 # number + +# Indentation column for standalone 'throw' function decl/proto qualifier +indent_func_throw = 0 # number + +# The number of spaces to indent a continued '->' or '.' +# Usually set to 0, 1, or indent_columns. +indent_member = 0 # number + +# Spaces to indent single line ('//') comments on lines before code +indent_single_line_comments_before = 0 # number + +# If set, will indent trailing single line ('//') comments relative +# to the code instead of trying to keep the same absolute column +indent_relative_single_line_comments = false # false/true + +# Spaces to indent 'case' from 'switch' +# Usually 0 or indent_columns. +indent_switch_case = 0 # number + +# Spaces to shift the 'case' line, without affecting any other lines +# Usually 0. +indent_case_shift = 0 # number + +# Spaces to indent '{' from 'case'. +# By default, the brace will appear under the 'c' in case. +# Usually set to 0 or indent_columns. +indent_case_brace = 0 # number + +# Whether to indent comments found in first column +indent_col1_comment = false # false/true + +# How to indent goto labels +# >0 : absolute column where 1 is the leftmost column +# <=0 : subtract from brace indent +indent_label = 1 # number + +# Same as indent_label, but for access specifiers that are followed by a colon +indent_access_spec = 1 # number + +# Indent the code after an access specifier by one level. +# If set, this option forces 'indent_access_spec=0' +indent_access_spec_body = true # false/true + +# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) +indent_paren_nl = false # false/true + +# Controls the indent of a close paren after a newline. +# 0: Indent to body level +# 1: Align under the open paren +# 2: Indent to the brace level +indent_paren_close = 0 # number + +# Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren +indent_comma_paren = 0 # false/true + +# Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren +indent_bool_paren = 0 + +# If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones +indent_first_bool_expr = false # false/true + +# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) +indent_square_nl = false # false/true + +# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies +indent_preserve_sql = false # false/true + +# Align continued statements at the '='. Default=True +# If FALSE or the '=' is followed by a newline, the next line is indent one tab. +indent_align_assign = true # false/true + +# Indent OC blocks at brace level instead of usual rules. +indent_oc_block = false # false/true + +# Indent OC blocks in a message relative to the parameter name. +# 0=use indent_oc_block rules, 1+=spaces to indent +indent_oc_block_msg = 0 # number + +# Minimum indent for subsequent parameters +indent_oc_msg_colon = 0 # number + +# +# Spacing options +# + +# force or remove space around arithmetic operator '+', '-', '/', '*', etc +sp_arith = force # ignore/add/remove/force + +# force or remove space around assignment operator '=', '+=', etc +sp_assign = force # ignore/add/remove/force + +# force or remove space around '=' in C++11 lambda capture specifications. Overrides sp_assign +sp_cpp_lambda_assign = force # ignore/add/remove/force + +# force or remove space after the capture specification in C++11 lambda. +sp_cpp_lambda_square_paren = force # ignore/add/remove/force + +# force or remove space around assignment operator '=' in a prototype +sp_assign_default = force # ignore/add/remove/force + +# force or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. +sp_before_assign = force # ignore/add/remove/force + +# force or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. +sp_after_assign = force # ignore/add/remove/force + +# force or remove space around assignment '=' in enum +sp_enum_assign = force # ignore/add/remove/force + +# force or remove space before assignment '=' in enum. Overrides sp_enum_assign. +sp_enum_before_assign = force # ignore/add/remove/force + +# force or remove space after assignment '=' in enum. Overrides sp_enum_assign. +sp_enum_after_assign = force # ignore/add/remove/force + +# force or remove space around preprocessor '##' concatenation operator. Default=Add +sp_pp_concat = force # ignore/add/remove/force + +# force or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. +sp_pp_stringify = force # ignore/add/remove/force + +# force or remove space before preprocessor '#' stringify operator as in '#define x(y) L#y'. +sp_before_pp_stringify = force # ignore/add/remove/force + +# force or remove space around boolean operators '&&' and '||' +sp_bool = force # ignore/add/remove/force + +# force or remove space around compare operator '<', '>', '==', etc +sp_compare = force # ignore/add/remove/force + +# force or remove space inside '(' and ')' +sp_inside_paren = remove # ignore/add/remove/force + +# force or remove space between nested parens +sp_paren_paren = remove # ignore/add/remove/force + +# Whether to balance spaces inside nested parens +sp_balance_nested_parens = false # false/true + +# force or remove space between ')' and '{' +sp_paren_brace = force # ignore/add/remove/force + +# force or remove space before pointer star '*' +sp_before_ptr_star = force # ignore/add/remove/force + +# force or remove space before pointer star '*' that isn't followed by a variable name +# If set to 'ignore', sp_before_ptr_star is used instead. +sp_before_unnamed_ptr_star = force # ignore/add/remove/force + +# force or remove space between pointer stars '*' +sp_between_ptr_star = remove # ignore/add/remove/force + +# force or remove space after pointer star '*', if followed by a word. +sp_after_ptr_star = remove # ignore/add/remove/force + +# force or remove space after a pointer star '*', if followed by a func proto/def. +sp_after_ptr_star_func = remove # ignore/add/remove/force + +# force or remove space after a pointer star '*', if followed by an open paren (function types). +sp_ptr_star_paren = remove # ignore/add/remove/force + +# force or remove space before a pointer star '*', if followed by a func proto/def. +sp_before_ptr_star_func = remove # ignore/add/remove/force + +# force or remove space before a reference sign '&' +sp_before_byref = force # ignore/add/remove/force + +# force or remove space before a reference sign '&' that isn't followed by a variable name +# If set to 'ignore', sp_before_byref is used instead. +sp_before_unnamed_byref = force # ignore/add/remove/force + +# force or remove space after reference sign '&', if followed by a word. +sp_after_byref = remove # ignore/add/remove/force + +# force or remove space after a reference sign '&', if followed by a func proto/def. +sp_after_byref_func = remove # ignore/add/remove/force + +# force or remove space before a reference sign '&', if followed by a func proto/def. +sp_before_byref_func = remove # ignore/add/remove/force + +# force or remove space between type and word. Default=Force +sp_after_type = force # ignore/add/remove/force + +# force or remove space before the paren in the D constructs 'template Foo(' and 'class Foo('. +sp_before_template_paren = ignore # ignore/add/remove/force + +# force or remove space in 'template <' vs 'template<'. +# If set to ignore, sp_before_angle is used. +sp_template_angle = remove # ignore/add/remove/force + +# force or remove space before '<>' +sp_before_angle = remove # ignore/add/remove/force + +# force or remove space inside '<' and '>' +sp_inside_angle = remove # ignore/add/remove/force + +# force or remove space after '<>' +sp_after_angle = force # ignore/add/remove/force + +# force or remove space between '<>' and '(' as found in 'new List();' +sp_angle_paren = remove # ignore/add/remove/force + +# force or remove space between '<>' and a word as in 'List m;' +sp_angle_word = force # ignore/add/remove/force + +# force or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add +sp_angle_shift = force # ignore/add/remove/force + +# Permit removal of the space between '>>' in 'foo >' (C++11 only). Default=False +# sp_angle_shift cannot remove the space without this option. +sp_permit_cpp11_shift = false # false/true + +# force or remove space before '(' of 'if', 'for', 'switch', and 'while' +sp_before_sparen = force # ignore/add/remove/force + +# force or remove space inside if-condition '(' and ')' +sp_inside_sparen = remove # ignore/add/remove/force + +# force or remove space before if-condition ')'. Overrides sp_inside_sparen. +sp_inside_sparen_close = remove # ignore/add/remove/force + +# force or remove space before if-condition '('. Overrides sp_inside_sparen. +sp_inside_sparen_open = remove # ignore/add/remove/force + +# force or remove space after ')' of 'if', 'for', 'switch', and 'while' +sp_after_sparen = force # ignore/add/remove/force + +# force or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' +sp_sparen_brace = force # ignore/add/remove/force + +# force or remove space between 'invariant' and '(' in the D language. +sp_invariant_paren = force # ignore/add/remove/force + +# force or remove space after the ')' in 'invariant (C) c' in the D language. +sp_after_invariant_paren = force # ignore/add/remove/force + +# force or remove space before empty statement ';' on 'if', 'for' and 'while' +sp_special_semi = remove # ignore/add/remove/force + +# force or remove space before ';'. Default=Remove +sp_before_semi = remove # ignore/add/remove/force + +# force or remove space before ';' in non-empty 'for' statements +sp_before_semi_for = remove # ignore/add/remove/force + +# force or remove space before a semicolon of an empty part of a for statement. +sp_before_semi_for_empty = remove # ignore/add/remove/force + +# force or remove space after ';', except when followed by a comment. Default=Add +sp_after_semi = force # ignore/add/remove/force + +# force or remove space after ';' in non-empty 'for' statements. Default=Force +sp_after_semi_for = force # ignore/add/remove/force + +# force or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). +sp_after_semi_for_empty = remove # ignore/add/remove/force + +# force or remove space before '[' (except '[]') +sp_before_square = remove # ignore/add/remove/force + +# force or remove space before '[]' +sp_before_squares = remove # ignore/add/remove/force + +# force or remove space inside a non-empty '[' and ']' +sp_inside_square = remove # ignore/add/remove/force + +# force or remove space after ',' +sp_after_comma = force # ignore/add/remove/force + +# force or remove space before ',' +sp_before_comma = remove # ignore/add/remove/force + +# force or remove space between an open paren and comma: '(,' vs '( ,' +sp_paren_comma = force # ignore/add/remove/force + +# force or remove space before the variadic '...' when preceded by a non-punctuator +sp_before_ellipsis = remove # ignore/add/remove/force + +# force or remove space after class ':' +sp_after_class_colon = force # ignore/add/remove/force + +# force or remove space before class ':' +sp_before_class_colon = force # ignore/add/remove/force + +# force or remove space before case ':'. Default=Remove +sp_before_case_colon = remove # ignore/add/remove/force + +# force or remove space between 'operator' and operator sign +sp_after_operator = remove # ignore/add/remove/force + +# force or remove space between the operator symbol and the open paren, as in 'operator ++(' +sp_after_operator_sym = remove # ignore/add/remove/force + +# force or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' +sp_after_cast = remove # ignore/add/remove/force + +# force or remove spaces inside cast parens +sp_inside_paren_cast = remove # ignore/add/remove/force + +# force or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' +sp_cpp_cast_paren = force # ignore/add/remove/force + +# force or remove space between 'sizeof' and '(' +sp_sizeof_paren = remove # ignore/add/remove/force + +# force or remove space after the tag keyword (Pawn) +sp_after_tag = ignore # ignore/add/remove/force + +# force or remove space inside enum '{' and '}' +sp_inside_braces_enum = remove # ignore/add/remove/force + +# force or remove space inside struct/union '{' and '}' +sp_inside_braces_struct = remove # ignore/add/remove/force + +# force or remove space inside '{' and '}' +sp_inside_braces = force # ignore/add/remove/force + +# force or remove space inside '{}' +sp_inside_braces_empty = remove # ignore/add/remove/force + +# force or remove space between return type and function name +# A minimum of 1 is forced except for pointer return types. +sp_type_func = force # ignore/add/remove/force + +# force or remove space between function name and '(' on function declaration +sp_func_proto_paren = remove # ignore/add/remove/force + +# force or remove space between function name and '(' on function definition +sp_func_def_paren = remove # ignore/add/remove/force + +# force or remove space inside empty function '()' +sp_inside_fparens = remove # ignore/add/remove/force + +# force or remove space inside function '(' and ')' +sp_inside_fparen = remove # ignore/add/remove/force + +# force or remove space inside the first parens in the function type: 'void (*x)(...)' +sp_inside_tparen = remove # ignore/add/remove/force + +# force or remove between the parens in the function type: 'void (*x)(...)' +sp_after_tparen_close = remove # ignore/add/remove/force + +# force or remove space between ']' and '(' when part of a function call. +sp_square_fparen = remove # ignore/add/remove/force + +# force or remove space between ')' and '{' of function +sp_fparen_brace = force # ignore/add/remove/force + +# force or remove space between function name and '(' on function calls +sp_func_call_paren = remove # ignore/add/remove/force + +# force or remove space between function name and '()' on function calls without parameters. +# If set to 'ignore' (the default), sp_func_call_paren is used. +sp_func_call_paren_empty = remove # ignore/add/remove/force + +# force or remove space between the user function name and '(' on function calls +# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. +sp_func_call_user_paren = ignore # ignore/add/remove/force + +# force or remove space between a constructor/destructor and the open paren +sp_func_class_paren = remove # ignore/add/remove/force + +# force or remove space between 'return' and '(' +sp_return_paren = force # ignore/add/remove/force + +# force or remove space between '__attribute__' and '(' +sp_attribute_paren = remove # ignore/add/remove/force + +# force or remove space between 'defined' and '(' in '#if defined (FOO)' +sp_defined_paren = remove # ignore/add/remove/force + +# force or remove space between 'throw' and '(' in 'throw (something)' +sp_throw_paren = remove # ignore/add/remove/force + +# force or remove space between 'throw' and anything other than '(' as in '@throw [...];' +sp_after_throw = remove # ignore/add/remove/force + +# force or remove space between 'catch' and '(' in 'catch (something) { }' +# If set to ignore, sp_before_sparen is used. +sp_catch_paren = ignore # ignore/add/remove/force + +# force or remove space between 'version' and '(' in 'version (something) { }' (D language) +# If set to ignore, sp_before_sparen is used. +sp_version_paren = ignore # ignore/add/remove/force + +# force or remove space between 'scope' and '(' in 'scope (something) { }' (D language) +# If set to ignore, sp_before_sparen is used. +sp_scope_paren = ignore # ignore/add/remove/force + +# force or remove space between macro and value +sp_macro = ignore # ignore/add/remove/force + +# force or remove space between macro function ')' and value +sp_macro_func = ignore # ignore/add/remove/force + +# force or remove space between 'else' and '{' if on the same line +sp_else_brace = force # ignore/add/remove/force + +# force or remove space between '}' and 'else' if on the same line +sp_brace_else = force # ignore/add/remove/force + +# force or remove space between '}' and the name of a typedef on the same line +sp_brace_typedef = force # ignore/add/remove/force + +# force or remove space between 'catch' and '{' if on the same line +sp_catch_brace = force # ignore/add/remove/force + +# force or remove space between '}' and 'catch' if on the same line +sp_brace_catch = force # ignore/add/remove/force + +# force or remove space between 'finally' and '{' if on the same line +sp_finally_brace = force # ignore/add/remove/force + +# force or remove space between '}' and 'finally' if on the same line +sp_brace_finally = force # ignore/add/remove/force + +# force or remove space between 'try' and '{' if on the same line +sp_try_brace = force # ignore/add/remove/force + +# force or remove space between get/set and '{' if on the same line +sp_getset_brace = ignore # ignore/add/remove/force + +# force or remove space before the '::' operator +sp_before_dc = remove # ignore/add/remove/force + +# force or remove space after the '::' operator +sp_after_dc = remove # ignore/add/remove/force + +# force or remove around the D named array initializer ':' operator +sp_d_array_colon = ignore # ignore/add/remove/force + +# force or remove space after the '!' (not) operator. Default=Remove +sp_not = remove # ignore/add/remove/force + +# force or remove space after the '~' (invert) operator. Default=Remove +sp_inv = remove # ignore/add/remove/force + +# force or remove space after the '&' (address-of) operator. Default=Remove +# This does not affect the spacing after a '&' that is part of a type. +sp_addr = remove # ignore/add/remove/force + +# force or remove space around the '.' or '->' operators. Default=Remove +sp_member = remove # ignore/add/remove/force + +# force or remove space after the '*' (dereference) operator. Default=Remove +# This does not affect the spacing after a '*' that is part of a type. +sp_deref = remove # ignore/add/remove/force + +# force or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove +sp_sign = remove # ignore/add/remove/force + +# force or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove +sp_incdec = remove # ignore/add/remove/force + +# force or remove space before a backslash-newline at the end of a line. Default=Add +sp_before_nl_cont = force # ignore/add/remove/force + +# force or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' +sp_after_oc_scope = ignore # ignore/add/remove/force + +# force or remove space after the colon in message specs +# '-(int) f:(int) x;' vs '-(int) f: (int) x;' +sp_after_oc_colon = ignore # ignore/add/remove/force + +# force or remove space before the colon in message specs +# '-(int) f: (int) x;' vs '-(int) f : (int) x;' +sp_before_oc_colon = ignore # ignore/add/remove/force + +# force or remove space after the colon in immutable dictionary expression +# 'NSDictionary *test = @{@"foo" :@"bar"};' +sp_after_oc_dict_colon = ignore # ignore/add/remove/force + +# force or remove space before the colon in immutable dictionary expression +# 'NSDictionary *test = @{@"foo" :@"bar"};' +sp_before_oc_dict_colon = ignore # ignore/add/remove/force + +# force or remove space after the colon in message specs +# '[object setValue:1];' vs '[object setValue: 1];' +sp_after_send_oc_colon = ignore # ignore/add/remove/force + +# force or remove space before the colon in message specs +# '[object setValue:1];' vs '[object setValue :1];' +sp_before_send_oc_colon = ignore # ignore/add/remove/force + +# force or remove space after the (type) in message specs +# '-(int)f: (int) x;' vs '-(int)f: (int)x;' +sp_after_oc_type = ignore # ignore/add/remove/force + +# force or remove space after the first (type) in message specs +# '-(int) f:(int)x;' vs '-(int)f:(int)x;' +sp_after_oc_return_type = ignore # ignore/add/remove/force + +# force or remove space between '@selector' and '(' +# '@selector(msgName)' vs '@selector (msgName)' +# Also applies to @protocol() constructs +sp_after_oc_at_sel = ignore # ignore/add/remove/force + +# force or remove space between '@selector(x)' and the following word +# '@selector(foo) a:' vs '@selector(foo)a:' +sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force + +# force or remove space inside '@selector' parens +# '@selector(foo)' vs '@selector( foo )' +# Also applies to @protocol() constructs +sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force + +# force or remove space before a block pointer caret +# '^int (int arg){...}' vs. ' ^int (int arg){...}' +sp_before_oc_block_caret = ignore # ignore/add/remove/force + +# force or remove space after a block pointer caret +# '^int (int arg){...}' vs. '^ int (int arg){...}' +sp_after_oc_block_caret = ignore # ignore/add/remove/force + +# force or remove space between the receiver and selector in a message. +# '[receiver selector ...]' +sp_after_oc_msg_receiver = ignore # ignore/add/remove/force + +# force or remove space after @property. +sp_after_oc_property = ignore # ignore/add/remove/force + +# force or remove space around the ':' in 'b ? t : f' +sp_cond_colon = force # ignore/add/remove/force + +# force or remove space around the '?' in 'b ? t : f' +sp_cond_question = ignore # ignore/add/remove/force + +# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. +sp_case_label = force # ignore/add/remove/force + +# Control the space around the D '..' operator. +sp_range = ignore # ignore/add/remove/force + +# Control the spacing after ':' in 'for (TYPE VAR : EXPR)' (Java) +sp_after_for_colon = ignore # ignore/add/remove/force + +# Control the spacing before ':' in 'for (TYPE VAR : EXPR)' (Java) +sp_before_for_colon = ignore # ignore/add/remove/force + +# Control the spacing in 'extern (C)' (D) +sp_extern_paren = ignore # ignore/add/remove/force + +# Control the space after the opening of a C++ comment '// A' vs '//A' +sp_cmt_cpp_start = force # ignore/add/remove/force + +# Controls the spaces between #else or #endif and a trailing comment +sp_endif_cmt = force # ignore/add/remove/force + +# Controls the spaces after 'new', 'delete', and 'delete[]' +sp_after_new = ignore # ignore/add/remove/force + +# Controls the spaces before a trailing or embedded comment +sp_before_tr_cmt = force # ignore/add/remove/force + +# Number of spaces before a trailing or embedded comment +sp_num_before_tr_cmt = 2 # number + +# Control space between a Java annotation and the open paren. +sp_annotation_paren = ignore # ignore/add/remove/force + +# +# Code alignment (not left column spaces/tabs) +# + +# Whether to keep non-indenting tabs +align_keep_tabs = false # false/true + +# Whether to use tabs for aligning +align_with_tabs = true # false/true + +# Whether to bump out to the next tab when aligning +align_on_tabstop = true # false/true + +# Whether to left-align numbers +# align_number_left = false # false/true + +# Align variable definitions in prototypes and functions +align_func_params = false # false/true + +# Align parameters in single-line functions that have the same name. +# The function names must already be aligned with each other. +align_same_func_call_params = false # false/true + +# The span for aligning variable definitions (0=don't align) +align_var_def_span = 0 # number + +# How to align the star in variable definitions. +# 0=Part of the type 'void * foo;' +# 1=Part of the variable 'void *foo;' +# 2=Dangling 'void *foo;' +align_var_def_star_style = 0 # number + +# How to align the '&' in variable definitions. +# 0=Part of the type +# 1=Part of the variable +# 2=Dangling +align_var_def_amp_style = 0 # number + +# The threshold for aligning variable definitions (0=no limit) +align_var_def_thresh = 0 # number + +# The gap for aligning variable definitions +align_var_def_gap = 0 # number + +# Whether to align the colon in struct bit fields +align_var_def_colon = false # false/true + +# Whether to align any attribute after the variable name +align_var_def_attribute = false # false/true + +# Whether to align inline struct/enum/union variable definitions +align_var_def_inline = false # false/true + +# The span for aligning on '=' in assignments (0=don't align) +align_assign_span = 0 # number + +# The threshold for aligning on '=' in assignments (0=no limit) +align_assign_thresh = 0 # number + +# The span for aligning on '=' in enums (0=don't align) +align_enum_equ_span = 1 # number + +# The threshold for aligning on '=' in enums (0=no limit) +align_enum_equ_thresh = 0 # number + +# The span for aligning struct/union (0=don't align) +align_var_struct_span = 20 # number + +# The threshold for aligning struct/union member definitions (0=no limit) +align_var_struct_thresh = 0 # number + +# The gap for aligning struct/union member definitions +align_var_struct_gap = 0 # number + +# The span for aligning struct initializer values (0=don't align) +align_struct_init_span = 0 # number + +# The minimum space between the type and the synonym of a typedef +align_typedef_gap = 0 # number + +# The span for aligning single-line typedefs (0=don't align) +align_typedef_span = 0 # number + +# How to align typedef'd functions with other typedefs +# 0: Don't mix them at all +# 1: align the open paren with the types +# 2: align the function type name with the other type names +align_typedef_func = 0 # number + +# Controls the positioning of the '*' in typedefs. Just try it. +# 0: Align on typedef type, ignore '*' +# 1: The '*' is part of type name: typedef int *pint; +# 2: The '*' is part of the type, but dangling: typedef int *pint; +align_typedef_star_style = 0 # number + +# Controls the positioning of the '&' in typedefs. Just try it. +# 0: Align on typedef type, ignore '&' +# 1: The '&' is part of type name: typedef int &pint; +# 2: The '&' is part of the type, but dangling: typedef int &pint; +align_typedef_amp_style = 0 # number + +# The span for aligning comments that end lines (0=don't align) +align_right_cmt_span = 2 # number + +# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment +align_right_cmt_mix = false # false/true + +# If a trailing comment is more than this number of columns away from the text it follows, +# it will qualify for being aligned. This has to be > 0 to do anything. +align_right_cmt_gap = 0 # number + +# Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) +align_right_cmt_at_col = 0 # number + +# The span for aligning function prototypes (0=don't align) +align_func_proto_span = 0 # number + +# Minimum gap between the return type and the function name. +align_func_proto_gap = 0 # number + +# Align function protos on the 'operator' keyword instead of what follows +align_on_operator = false # false/true + +# Whether to mix aligning prototype and variable declarations. +# If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. +align_mix_var_proto = false # false/true + +# Align single-line functions with function prototypes, uses align_func_proto_span +align_single_line_func = false # false/true + +# Aligning the open brace of single-line functions. +# Requires align_single_line_func=true, uses align_func_proto_span +align_single_line_brace = false # false/true + +# Gap for align_single_line_brace. +align_single_line_brace_gap = 0 # number + +# The span for aligning ObjC msg spec (0=don't align) +align_oc_msg_spec_span = 0 # number + +# Whether to align macros wrapped with a backslash and a newline. +# This will not work right if the macro contains a multi-line comment. +#align_nl_cont = false # false/true + +# # Align macro functions and variables together +align_pp_define_together = false # false/true + +# The minimum space between label and value of a preprocessor define +align_pp_define_gap = 1 # number + +# The span for aligning on '#define' bodies (0=don't align) +align_pp_define_span = 0 # number + +# Align lines that start with '<<' with previous '<<'. Default=true +align_left_shift = true # false/true + +# Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) +align_oc_msg_colon_span = 0 # number + +# If true, always align with the first parameter, even if it is too short. +align_oc_msg_colon_first = false # false/true + +# Aligning parameters in an Obj-C '+' or '-' declaration on the ':' +align_oc_decl_colon = false # false/true + +# +# Newline forceing and removing options +# + +# Whether to collapse empty blocks between '{' and '}' +nl_collapse_empty_body = false # false/true + +# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' +nl_assign_leave_one_liners = true # false/true + +# Don't split one-line braced statements inside a class xx { } body +nl_class_leave_one_liners = true # false/true + +# Don't split one-line enums: 'enum foo { BAR = 15 };' +nl_enum_leave_one_liners = true # false/true + +# Don't split one-line get or set functions +nl_getset_leave_one_liners = true # false/true + +# Don't split one-line function definitions - 'int foo() { return 0; }' +nl_func_leave_one_liners = true # false/true + +# Don't split one-line if/else statements - 'if(a) b++;' +nl_if_leave_one_liners = true # false/true + +# Don't split one-line OC messages +nl_oc_msg_leave_one_liner = false # false/true + +# force or remove newlines at the start of the file +nl_start_of_file = remove # ignore/add/remove/force + +# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' +nl_start_of_file_min = 0 # number + +# force or remove newline at the end of the file +nl_end_of_file = force # ignore/add/remove/force + +# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') +nl_end_of_file_min = 1 # number + +# force or remove newline between '=' and '{' +nl_assign_brace = remove # ignore/add/remove/force + +# force or remove newline between '=' and '[' (D only) +nl_assign_square = remove # ignore/add/remove/force + +# force or remove newline after '= [' (D only). Will also affect the newline before the ']' +nl_after_square_assign = ignore # ignore/add/remove/force + +# The number of blank lines after a block of variable definitions at the top of a function body +# 0 = No change (default) +# nl_func_var_def_blk = 0 # number +nl_var_def_blk_end_func_top = 0 + +# The number of newlines before a block of typedefs +# 0 = No change (default) +nl_typedef_blk_start = 0 # number + +# The number of newlines after a block of typedefs +# 0 = No change (default) +nl_typedef_blk_end = 0 # number + +# The maximum consecutive newlines within a block of typedefs +# 0 = No change (default) +nl_typedef_blk_in = 0 # number + +# The number of newlines before a block of variable definitions not at the top of a function body +# 0 = No change (default) +nl_var_def_blk_start = 0 # number + +# The number of newlines after a block of variable definitions not at the top of a function body +# 0 = No change (default) +nl_var_def_blk_end = 0 # number + +# The maximum consecutive newlines within a block of variable definitions +# 0 = No change (default) +nl_var_def_blk_in = 0 # number + +# force or remove newline between a function call's ')' and '{', as in: +# list_for_each(item, &list) { } +nl_fcall_brace = remove # ignore/add/remove/force + +# force or remove newline between 'enum' and '{' +nl_enum_brace = remove # ignore/add/remove/force + +# force or remove newline between 'struct and '{' +nl_struct_brace = remove # ignore/add/remove/force + +# force or remove newline between 'union' and '{' +nl_union_brace = remove # ignore/add/remove/force + +# force or remove newline between 'if' and '{' +nl_if_brace = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'else' +nl_brace_else = remove # ignore/add/remove/force + +# force or remove newline between 'else if' and '{' +# If set to ignore, nl_if_brace is used instead +nl_elseif_brace = remove # ignore/add/remove/force + +# force or remove newline between 'else' and '{' +nl_else_brace = remove # ignore/add/remove/force + +# force or remove newline between 'else' and 'if' +nl_else_if = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'finally' +nl_brace_finally = remove # ignore/add/remove/force + +# force or remove newline between 'finally' and '{' +nl_finally_brace = remove # ignore/add/remove/force + +# force or remove newline between 'try' and '{' +nl_try_brace = remove # ignore/add/remove/force + +# force or remove newline between get/set and '{' +nl_getset_brace = ignore # ignore/add/remove/force + +# force or remove newline between 'for' and '{' +nl_for_brace = remove # ignore/add/remove/force + +# force or remove newline between 'catch' and '{' +nl_catch_brace = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'catch' +nl_brace_catch = remove # ignore/add/remove/force + +# force or remove newline between 'while' and '{' +nl_while_brace = remove # ignore/add/remove/force + +# force or remove newline between 'scope (x)' and '{' (D) +nl_scope_brace = remove # ignore/add/remove/force + +# force or remove newline between 'unittest' and '{' (D) +nl_unittest_brace = remove # ignore/add/remove/force + +# force or remove newline between 'version (x)' and '{' (D) +nl_version_brace = remove # ignore/add/remove/force + +# force or remove newline between 'using' and '{' +nl_using_brace = remove # ignore/add/remove/force + +# force or remove newline between two open or close braces. +# Due to general newline/brace handling, REMOVE may not work. +nl_brace_brace = force # ignore/add/remove/force + +# force or remove newline between 'do' and '{' +nl_do_brace = remove # ignore/add/remove/force + +# force or remove newline between '}' and 'while' of 'do' statement +nl_brace_while = remove # ignore/add/remove/force + +# force or remove newline between 'switch' and '{' +nl_switch_brace = remove # ignore/add/remove/force + +# force a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. +# Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. +nl_multi_line_cond = false # false/true + +# Force a newline in a define after the macro name for multi-line defines. +nl_multi_line_define = false # false/true + +# Whether to put a newline before 'case' statement +nl_before_case = false # false/true + +# force or remove newline between ')' and 'throw' +nl_before_throw = remove # ignore/add/remove/force + +# Whether to put a newline after 'case' statement +nl_after_case = false # false/true + +# force or remove a newline between a case ':' and '{'. Overrides nl_after_case. +nl_case_colon_brace = remove # ignore/add/remove/force + +# Newline between namespace and { +nl_namespace_brace = remove # ignore/add/remove/force + +# force or remove newline between 'template<>' and whatever follows. +nl_template_class = force # ignore/add/remove/force + +# force or remove newline between 'class' and '{' +nl_class_brace = force # ignore/add/remove/force + +# force or remove newline after each ',' in the constructor member initialization +nl_class_init_args = ignore # ignore/add/remove/force + +# force or remove newline between return type and function name in a function definition +nl_func_type_name = ignore # ignore/add/remove/force + +# force or remove newline between return type and function name inside a class {} +# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. +nl_func_type_name_class = ignore # ignore/add/remove/force + +# force or remove newline between function scope and name in a definition +# Controls the newline after '::' in 'void A::f() { }' +nl_func_scope_name = ignore # ignore/add/remove/force + +# force or remove newline between return type and function name in a prototype +nl_func_proto_type_name = ignore # ignore/add/remove/force + +# force or remove newline between a function name and the opening '(' +nl_func_paren = ignore # ignore/add/remove/force + +# force or remove newline between a function name and the opening '(' in the definition +nl_func_def_paren = ignore # ignore/add/remove/force + +# force or remove newline after '(' in a function declaration +nl_func_decl_start = ignore # ignore/add/remove/force + +# force or remove newline after '(' in a function definition +nl_func_def_start = ignore # ignore/add/remove/force + +# Overrides nl_func_decl_start when there is only one parameter. +nl_func_decl_start_single = ignore # ignore/add/remove/force + +# Overrides nl_func_def_start when there is only one parameter. +nl_func_def_start_single = ignore # ignore/add/remove/force + +# force or remove newline after each ',' in a function declaration +nl_func_decl_args = ignore # ignore/add/remove/force + +# force or remove newline after each ',' in a function definition +nl_func_def_args = ignore # ignore/add/remove/force + +# force or remove newline before the ')' in a function declaration +nl_func_decl_end = remove # ignore/add/remove/force + +# force or remove newline before the ')' in a function definition +nl_func_def_end = remove # ignore/add/remove/force + +# Overrides nl_func_decl_end when there is only one parameter. +nl_func_decl_end_single = ignore # ignore/add/remove/force + +# Overrides nl_func_def_end when there is only one parameter. +nl_func_def_end_single = ignore # ignore/add/remove/force + +# force or remove newline between '()' in a function declaration. +nl_func_decl_empty = remove # ignore/add/remove/force + +# force or remove newline between '()' in a function definition. +nl_func_def_empty = remove # ignore/add/remove/force + +# Whether to put each OC message parameter on a separate line +# See nl_oc_msg_leave_one_liner +nl_oc_msg_args = false # false/true + +# force or remove newline between function signature and '{' +nl_fdef_brace = add # ignore/add/remove/force + +# force or remove a newline between the return keyword and return expression. +nl_return_expr = ignore # ignore/add/remove/force + +# Whether to put a newline after semicolons, except in 'for' statements +nl_after_semicolon = false # false/true + +# Whether to put a newline after brace open. +# This also forces a newline before the matching brace close. +nl_after_brace_open = false # false/true + +# If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is +# placed between the open brace and a trailing single-line comment. +nl_after_brace_open_cmt = false # false/true + +# Whether to put a newline after a virtual brace open with a non-empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open = false # false/true + +# Whether to put a newline after a virtual brace open with an empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open_empty = false # false/true + +# Whether to put a newline after a brace close. +# Does not apply if followed by a necessary ';'. +nl_after_brace_close = false # false/true + +# Whether to put a newline after a virtual brace close. +# Would force a newline before return in: 'if (foo) a++; return;' +nl_after_vbrace_close = true # false/true + +# Control the newline between the close brace and 'b' in: 'struct { int a; } b;' +# Affects enums, unions, and structures. If set to ignore, uses nl_after_brace_close +nl_brace_struct_var = ignore # ignore/add/remove/force + +# Whether to alter newlines in '#define' macros +nl_define_macro = false # false/true + +# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' +nl_squeeze_ifdef = false # false/true + +# force or remove blank line before 'if' +nl_before_if = ignore # ignore/add/remove/force + +# force or remove blank line after 'if' statement +nl_after_if = ignore # ignore/add/remove/force + +# force or remove blank line before 'for' +nl_before_for = ignore # ignore/add/remove/force + +# force or remove blank line after 'for' statement +nl_after_for = ignore # ignore/add/remove/force + +# force or remove blank line before 'while' +nl_before_while = ignore # ignore/add/remove/force + +# force or remove blank line after 'while' statement +nl_after_while = ignore # ignore/add/remove/force + +# force or remove blank line before 'switch' +nl_before_switch = ignore # ignore/add/remove/force + +# force or remove blank line after 'switch' statement +nl_after_switch = ignore # ignore/add/remove/force + +# force or remove blank line before 'do' +nl_before_do = ignore # ignore/add/remove/force + +# force or remove blank line after 'do/while' statement +nl_after_do = ignore # ignore/add/remove/force + +# Whether to double-space commented-entries in struct/enum +nl_ds_struct_enum_cmt = false # false/true + +# Whether to double-space before the close brace of a struct/union/enum +# (lower priority than 'eat_blanks_before_close_brace') +nl_ds_struct_enum_close_brace = false # false/true + +# force or remove a newline around a class colon. +# Related to pos_class_colon, nl_class_init_args, and pos_comma. +nl_class_colon = ignore # ignore/add/remove/force + +# Change simple unbraced if statements into a one-liner +# 'if(b)\n i++;' => 'if(b) i++;' +nl_create_if_one_liner = false # false/true + +# Change simple unbraced for statements into a one-liner +# 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' +nl_create_for_one_liner = false # false/true + +# Change simple unbraced while statements into a one-liner +# 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' +nl_create_while_one_liner = false # false/true + +# +# Positioning options +# + +# The position of arithmetic operators in wrapped expressions +pos_arith = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of assignment in wrapped expressions. +# Do not affect '=' followed by '{' +pos_assign = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of boolean operators in wrapped expressions +pos_bool = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of comparison operators in wrapped expressions +pos_compare = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of conditional (b ? t : f) operators in wrapped expressions +pos_conditional = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in wrapped expressions +pos_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in the constructor initialization list +pos_class_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of colons between constructor and member initialization +pos_class_colon = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# +# Line Splitting options +# + +# Try to limit code width to N number of columns +code_width = 120 # number + +# Whether to fully split long 'for' statements at semi-colons +ls_for_split_full = true # false/true + +# Whether to fully split long function protos/calls at commas +ls_func_split_full = true # false/true + +# Whether to split lines as close to code_width as possible and ignore some groupings +ls_code_width = false # false/true + +# +# Blank line options +# + +# The maximum consecutive newlines +nl_max = 2 # number + +# The number of newlines after a function prototype, if followed by another function prototype +nl_after_func_proto = 0 # number + +# The number of newlines after a function prototype, if not followed by another function prototype +nl_after_func_proto_group = 0 # number + +# The number of newlines after '}' of a multi-line function body +nl_after_func_body = 0 # number + +# The number of newlines after '}' of a multi-line function body in a class declaration +nl_after_func_body_class = 0 # number + +# The number of newlines after '}' of a single line function body +nl_after_func_body_one_liner = 0 # number + +# The minimum number of newlines before a multi-line comment. +# Doesn't apply if after a brace open or another multi-line comment. +nl_before_block_comment = 0 # number + +# The minimum number of newlines before a single-line C comment. +# Doesn't apply if after a brace open or other single-line C comments. +nl_before_c_comment = 0 # number + +# The minimum number of newlines before a CPP comment. +# Doesn't apply if after a brace open or other CPP comments. +nl_before_cpp_comment = 0 # number + +# Whether to force a newline after a multi-line comment. +nl_after_multiline_comment = false # false/true + +# The number of newlines after '}' or ';' of a struct/enum/union definition +nl_after_struct = 0 # number + +# The number of newlines after '}' or ';' of a class definition +nl_after_class = 1 # number + +# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# Will not change the newline count if after a brace open. +# 0 = No change. +nl_before_access_spec = 2 # number + +# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# 0 = No change. +nl_after_access_spec = 0 # number + +# The number of newlines between a function def and the function comment. +# 0 = No change. +nl_comment_func_def = 0 # number + +# The number of newlines after a try-catch-finally block that isn't followed by a brace close. +# 0 = No change. +nl_after_try_catch_finally = 0 # number + +# The number of newlines before and after a property, indexer or event decl. +# 0 = No change. +nl_around_cs_property = 0 # number + +# The number of newlines between the get/set/add/remove handlers in C#. +# 0 = No change. +nl_between_get_set = 0 # number + +# force or remove newline between C# property and the '{' +nl_property_brace = ignore # ignore/add/remove/force + +# Whether to remove blank lines after '{' +eat_blanks_after_open_brace = true # false/true + +# Whether to remove blank lines before '}' +eat_blanks_before_close_brace = true # false/true + +# How aggressively to remove extra newlines not in preproc. +# 0: No change +# 1: Remove most newlines not handled by other config +# 2: Remove all newlines and reformat completely by config +nl_remove_extra_newlines = 0 # number + +# Whether to put a blank line before 'return' statements, unless after an open brace. +nl_before_return = false # false/true + +# Whether to put a blank line after 'return' statements, unless followed by a close brace. +nl_after_return = false # false/true + +# Whether to put a newline after a Java annotation statement. +# Only affects annotations that are after a newline. +nl_after_annotation = ignore # ignore/add/remove/force + +# Controls the newline between two annotations. +nl_between_annotation = ignore # ignore/add/remove/force + +# +# Code modifying options (non-whitespace) +# + +# force or remove braces on single-line 'do' statement +mod_full_brace_do = ignore # ignore/add/remove/force + +# force or remove braces on single-line 'for' statement +mod_full_brace_for = force # ignore/add/remove/force + +# force or remove braces on single-line function definitions. (Pawn) +mod_full_brace_function = ignore # ignore/add/remove/force + +# force or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. +mod_full_brace_if = force # ignore/add/remove/force + +# Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. +# If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. +mod_full_brace_if_chain = 0 + +# Don't remove braces around statements that span N newlines +mod_full_brace_nl = 0 # number + +# force or remove braces on single-line 'while' statement +mod_full_brace_while = force # ignore/add/remove/force + +# force or remove braces on single-line 'using ()' statement +mod_full_brace_using = ignore # ignore/add/remove/force + +# force or remove unnecessary paren on 'return' statement +mod_paren_on_return = remove # ignore/add/remove/force + +# Whether to change optional semicolons to real semicolons +mod_pawn_semicolon = false # false/true + +# force parens on 'while' and 'if' statement around bools +mod_full_paren_if_bool = true # false/true + +# Whether to remove superfluous semicolons +mod_remove_extra_semicolon = true # false/true + +# If a function body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be forceed. +mod_add_long_function_closebrace_comment = 0 # number + +# If a switch body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be forceed. +mod_add_long_switch_closebrace_comment = 0 # number + +# If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after +# the #endif, a comment will be forceed. +mod_add_long_ifdef_endif_comment = 0 # number + +# If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after +# the #else, a comment will be forceed. +mod_add_long_ifdef_else_comment = 10 # number + +# If TRUE, will sort consecutive single-line 'import' statements [Java, D] +mod_sort_import = false # false/true + +# If TRUE, will sort consecutive single-line 'using' statements [C#] +mod_sort_using = true # false/true + +# If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] +# This is generally a bad idea, as it may break your code. +mod_sort_include = true # false/true + +# If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. +mod_move_case_break = false # false/true + +# Will force or remove the braces around a fully braced case statement. +# Will only remove the braces if there are no variable declarations in the block. +mod_case_brace = ignore # ignore/add/remove/force + +# If TRUE, it will remove a void 'return;' that appears as the last statement in a function. +mod_remove_empty_return = true # false/true + +# +# Comment modifications +# + +# Try to wrap comments at cmt_width columns +cmt_width = 0 # number + +# Set the comment reflow mode (default: 0) +# 0: no reflowing (apart from the line wrapping due to cmt_width) +# 1: no touching at all +# 2: full reflow +cmt_reflow_mode = 0 # number + +# If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. +# Default is true. +cmt_indent_multi = true # false/true + +# Whether to group c-comments that look like they are in a block +cmt_c_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined c-comment +cmt_c_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined c-comment +cmt_c_nl_end = false # false/true + +# Whether to group cpp-comments that look like they are in a block +cmt_cpp_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined cpp-comment +cmt_cpp_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined cpp-comment +cmt_cpp_nl_end = false # false/true + +# Whether to change cpp-comments into c-comments +cmt_cpp_to_c = false # false/true + +# Whether to put a star on subsequent comment lines +cmt_star_cont = false # false/true + +# The number of spaces to insert at the start of subsequent comment lines +cmt_sp_before_star_cont = 0 # number + +# The number of spaces to insert after the star on subsequent comment lines +cmt_sp_after_star_cont = 0 # number + +# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of +# the comment are the same length. Default=True +cmt_multi_check_last = false # false/true + +# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. +# Will substitute $(filename) with the current file's name. +cmt_insert_file_header = "" # string + +# The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. +# Will substitute $(filename) with the current file's name. +cmt_insert_file_footer = "" # string + +# The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. +# Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. +# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } +cmt_insert_func_header = "" # string + +# The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. +# Will substitute $(class) with the class name. +cmt_insert_class_header = "" # string + +# The filename that contains text to insert before a Obj-C message specification if the method isn't preceded with a C/C++ comment. +# Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff. +cmt_insert_oc_msg_header = "" # string + +# If a preprocessor is encountered when stepping backwards from a function name, then +# this option decides whether the comment should be inserted. +# Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. +cmt_insert_before_preproc = false # false/true + +# +# Preprocessor options +# + +# Control indent of preprocessors inside #if blocks at brace level 0 +pp_indent = remove # ignore/add/remove/force + +# Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) +pp_indent_at_level = false # false/true + +# If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. +pp_indent_count = 2 # number + +# force or remove space after # based on pp_level of #if blocks +pp_space_after = add # ignore/add/remove/force + +# Sets the number of spaces forceed with pp_space +pp_space_count = 1 # number + +# The indent for #region and #endregion in C# and '#pragma region' in C/C++ +pp_indent_region = 0 # number + +# Whether to indent the code between #region and #endregion +pp_region_indent_code = false # false/true + +# If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level +pp_indent_if = 1 # number + +# Control whether to indent the code between #if, #else and #endif when not at file-level +pp_if_indent_code = false # false/true + +# Whether to indent '#define' at the brace level (true) or from column 1 (false) +pp_define_at_level = true # false/true + +# You can force a token to be a type with the 'type' option. +# Example: +# type myfoo1 myfoo2 +# +# You can create custom macro-based indentation using macro-open, +# macro-else and macro-close. +# Example: +# macro-open BEGIN_TEMPLATE_MESSAGE_MAP +# macro-open BEGIN_MESSAGE_MAP +# macro-close END_MESSAGE_MAP +# +# You can assign any keyword to any type with the set option. +# set func_call_user _ N_ +# +# The full syntax description of all custom definition config entries +# is shown below: +# +# define custom tokens as: +# - embed whitespace in token using '' escape character, or +# put token in quotes +# - these: ' " and ` are recognized as quote delimiters +# +# type token1 token2 token3 ... +# ^ optionally specify multiple tokens on a single line +# define def_token output_token +# ^ output_token is optional, then NULL is assumed +# macro-open token +# macro-close token +# macro-else token +# set id token1 token2 ... +# ^ optionally specify multiple tokens on a single line +# ^ id is one of the names in token_enum.h sans the CT_ prefix, +# e.g. PP_PRAGMA +# +# all tokens are separated by any mix of ',' commas, '=' equal signs +# and whitespace (space, tab) +# From 1335cec04074bfcd3f2e28dad6b9894acddca604 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 17:05:54 +0200 Subject: [PATCH 55/83] Uncrustify before merge --- src/shc.c | 1859 +++++++++++++++++++++++++++-------------------------- 1 file changed, 950 insertions(+), 909 deletions(-) diff --git a/src/shc.c b/src/shc.c index d2e276d..23cd098 100644 --- a/src/shc.c +++ b/src/shc.c @@ -12,101 +12,102 @@ * Date: 21 May 1996 10:49:37 -0400 * And it is licensed also under GPL. * - *That's where I got it, now I am going to do some work on it - *It will reside here: http://github.com/neurobin/shc + * That's where I got it, now I am going to do some work on it + * It will reside here: http://github.com/neurobin/shc */ static const char my_name[] = "shc"; static const char version[] = "Version 4.0.3"; static const char subject[] = "Generic Shell Script Compiler"; static const char cpright[] = "GNU GPL Version 3"; -static const struct { const char * f, * s, * e; } - provider = { "Md Jahidul", "Hamid", "" }; +static const struct {const char *f, *s, *e;} +provider = { "Md Jahidul", "Hamid", "" }; /* -static const struct { const char * f, * s, * e; } - author = { "Francisco", "Garcia", "" }; -*/ + static const struct { const char * f, * s, * e; } + author = { "Francisco", "Garcia", "" }; + */ /*This is the original author who first came up with this*/ -static const char * copying[] = { -"Copying:", -"", -" This program is free software; you can redistribute it and/or modify", -" it under the terms of the GNU General Public License as published by", -" the Free Software Foundation; either version 3 of the License, or", -" (at your option) any later version.", -"", -" This program is distributed in the hope that it will be useful,", -" but WITHOUT ANY WARRANTY; without even the implied warranty of", -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", -" GNU General Public License for more details.", -"", -" You should have received a copy of the GNU General Public License", -" along with this program; if not, write to the Free Software", -" @Neurobin, Dhaka, Bangladesh", -"", -" Report problems and questions to:http://github.com/neurobin/shc", -"", -0}; +static const char *copying[] = { + "Copying:", + "", + " This program is free software; you can redistribute it and/or modify", + " it under the terms of the GNU General Public License as published by", + " the Free Software Foundation; either version 3 of the License, or", + " (at your option) any later version.", + "", + " This program is distributed in the hope that it will be useful,", + " but WITHOUT ANY WARRANTY; without even the implied warranty of", + " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", + " GNU General Public License for more details.", + "", + " You should have received a copy of the GNU General Public License", + " along with this program; if not, write to the Free Software", + " @Neurobin, Dhaka, Bangladesh", + "", + " Report problems and questions to:http://github.com/neurobin/shc", + "", + 0 +}; -static const char * abstract[] = { -"Abstract:", -"", -" This tool generates a stripped binary executable version", -" of the script specified at command line.", -"", -" Binary version will be saved with a .x extension by default.", -" You can specify output file name too with [-o filname] option.", -"", -" You can specify expiration date [-e] too, after which binary will", -" refuse to be executed, displaying \"[-m]\" instead.", -"", -" You can compile whatever interpreted script, but valid [-i], [-x]", -" and [-l] options must be given.", -"", -0}; +static const char *abstract[] = { + "Abstract:", + "", + " This tool generates a stripped binary executable version", + " of the script specified at command line.", + "", + " Binary version will be saved with a .x extension by default.", + " You can specify output file name too with [-o filname] option.", + "", + " You can specify expiration date [-e] too, after which binary will", + " refuse to be executed, displaying \"[-m]\" instead.", + "", + " You can compile whatever interpreted script, but valid [-i], [-x]", + " and [-l] options must be given.", + "", + 0 +}; static const char usage[] = -"Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHPCAB2h] -f script"; + "Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHPCAB2h] -f script"; -static const char * help[] = { -"", -" -e %s Expiration date in dd/mm/yyyy format [none]", -" -m %s Message to display upon expiration [\"Please contact your provider\"]", -" -f %s File name of the script to compile", -" -i %s Inline option for the shell interpreter i.e: -e", -" -x %s eXec command, as a printf format i.e: exec('%s',@ARGV);", -" -l %s Last shell option i.e: --", -" -o %s output filename", -" -r Relax security. Make a redistributable binary", -" -v Verbose compilation", -" -S Switch ON setuid for root callable programs [OFF]", -" -D Switch ON debug exec calls [OFF]", -" -U Make binary untraceable [no]", -" -H Hardening : extra security protection [no]", -" Require bourne shell (sh) and parameters are not supported", -" -P Submit script as a pipe [no]", -" -0 Fix handling of argv0 [no]", -" -C Display license and exit", -" -A Display abstract and exit", -" -B Compile for busybox", -" -2 Use the system call mmap2", -" -h Display help and exit", -"", -" Environment variables used:", -" Name Default Usage", -" CC cc C compiler command", -" STRIP strip Strip command", -" CFLAGS C compiler flags", -" LDFLAGS Linker flags", -"", -" Please consult the shc man page.", -"", -0}; +static const char *help[] = { + "", + " -e %s Expiration date in dd/mm/yyyy format [none]", + " -m %s Message to display upon expiration [\"Please contact your provider\"]", + " -f %s File name of the script to compile", + " -i %s Inline option for the shell interpreter i.e: -e", + " -x %s eXec command, as a printf format i.e: exec('%s',@ARGV);", + " -l %s Last shell option i.e: --", + " -o %s output filename", + " -r Relax security. Make a redistributable binary", + " -v Verbose compilation", + " -S Switch ON setuid for root callable programs [OFF]", + " -D Switch ON debug exec calls [OFF]", + " -U Make binary untraceable [no]", + " -H Hardening : extra security protection [no]", + " Require bourne shell (sh) and parameters are not supported", + " -P Submit script as a pipe [no]", + " -0 Fix handling of argv0 [no]", + " -C Display license and exit", + " -A Display abstract and exit", + " -B Compile for busybox", + " -2 Use the system call mmap2", + " -h Display help and exit", + "", + " Environment variables used:", + " Name Default Usage", + " CC cc C compiler command", + " STRIP strip Strip command", + " CFLAGS C compiler flags", + " LDFLAGS Linker flags", + "", + " Please consult the shc man page.", + "", + 0 +}; -#include -#include #include #include #include @@ -116,709 +117,712 @@ static const char * help[] = { #include #include #include +#include +#include #include #include #define SIZE 4096 -static char * file; -static char * file2; -static char date[21]; -static char * mail = "Please contact your provider jahidulhamid@yahoo.com"; -static char rlax[1]; -static char * shll; -static char * inlo; -static char * pfmt; -static char * xecc; -static char * lsto; -static char * opts; -static char * text; +static char *file; +static char *file2; +static char date[21]; +static char *mail = "Please contact your provider jahidulhamid@yahoo.com"; +static char rlax[1]; +static char *shll; +static char *inlo; +static char *pfmt; +static char *xecc; +static char *lsto; +static char *opts; +static char *text; static int verbose; static const char SETUID_line[] = -"#define SETUID %d /* Define as 1 to call setuid(0) at start of script */\n"; + "#define SETUID %d /* Define as 1 to call setuid(0) at start of script */\n"; static int SETUID_flag = 0; static const char DEBUGEXEC_line[] = -"#define DEBUGEXEC %d /* Define as 1 to debug execvp calls */\n"; + "#define DEBUGEXEC %d /* Define as 1 to debug execvp calls */\n"; static int DEBUGEXEC_flag = 0; static const char TRACEABLE_line[] = -"#define TRACEABLE %d /* Define as 1 to enable ptrace the executable */\n"; + "#define TRACEABLE %d /* Define as 1 to enable ptrace the executable */\n"; static int TRACEABLE_flag = 1; static const char HARDENING_line[] = -"#define HARDENING %d /* Define as 1 to disable ptrace/dump the executable */\n"; + "#define HARDENING %d /* Define as 1 to disable ptrace/dump the executable */\n"; static int HARDENING_flag = 0; static const char MMAP2_line[] = -"#define MMAP2 %d /* Define as 1 to use syscall mmap2 */\n"; + "#define MMAP2 %d /* Define as 1 to use syscall mmap2 */\n"; static int MMAP2_flag = 0; static const char BUSYBOXON_line[] = -"#define BUSYBOXON %d /* Define as 1 to enable work with busybox */\n"; + "#define BUSYBOXON %d /* Define as 1 to enable work with busybox */\n"; static int BUSYBOXON_flag = 0; static const char PIPESCRIPT_line[] = -"#define PIPESCRIPT %d /* Define as 1 to submit script as a pipe */\n"; + "#define PIPESCRIPT %d /* Define as 1 to submit script as a pipe */\n"; static int PIPESCRIPT_flag = 0; static const char FIXARGV0_line[] = -"#define FIXARGV0 %d /* Define as 1 fix handling of ARGV0 */\n"; + "#define FIXARGV0 %d /* Define as 1 fix handling of ARGV0 */\n"; static int FIXARGV0_flag = 0; -static const char * RTC[] = { -"", -"#if HARDENING", -"static const char * shc_x[] = {", -"\"/*\",", -"\" * Copyright 2019 - Intika \",", -"\" * Replace ******** with secret read from fd 21\",", -"\" * Also change arguments location of sub commands (sh script commands)\",", -"\" * gcc -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",", -"\" */\",", -"\"\",", -"\"#define _GNU_SOURCE /* needed to get RTLD_NEXT defined in dlfcn.h */\",", -"\"#define PLACEHOLDER \\\"********\\\"\",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"#include \",", -"\"\",", -"\"static char secret[128000]; //max size\",", -"\"typedef int (*pfi)(int, char **, char **);\",", -"\"static pfi real_main;\",", -"\"\",", -"\"// copy argv to new location\",", -"\"char **copyargs(int argc, char** argv){\",", -"\" char **newargv = malloc((argc+1)*sizeof(*argv));\",", -"\" char *from,*to;\",", -"\" int i,len;\",", -"\"\",", -"\" for(i = 0; i 0) {\",", -"\" int i;\",", -"\"\",", -"\" if (secret[n - 1] == '\\\\n') secret[--n] = '\\\\0';\",", -"\" for (i = 1; i < argc; i++)\",", -"\" if (strcmp(argv[i], PLACEHOLDER) == 0)\",", -"\" argv[i] = secret;\",", -"\" }\",", -"\"\",", -"\" real_main = main;\",", -"\"\",", -"\" return real___libc_start_main(mymain, argc, argv, init, fini, rtld_fini, stack_end);\",", -"\"}\",", -"\"\",", -"0};", -"#endif /* HARDENING */", -"", -"/* rtc.c */", -"", -"#include ", -"#include ", -"#include ", -"", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"/* 'Alleged RC4' */", -"", -"static unsigned char stte[256], indx, jndx, kndx;", -"", -"/*", -" * Reset arc4 stte. ", -" */", -"void stte_0(void)", -"{", -" indx = jndx = kndx = 0;", -" do {", -" stte[indx] = indx;", -" } while (++indx);", -"}", -"", -"/*", -" * Set key. Can be used more than once. ", -" */", -"void key(void * str, int len)", -"{", -" unsigned char tmp, * ptr = (unsigned char *)str;", -" while (len > 0) {", -" do {", -" tmp = stte[indx];", -" kndx += tmp;", -" kndx += ptr[(int)indx % len];", -" stte[indx] = stte[kndx];", -" stte[kndx] = tmp;", -" } while (++indx);", -" ptr += 256;", -" len -= 256;", -" }", -"}", -"", -"/*", -" * Crypt data. ", -" */", -"void arc4(void * str, int len)", -"{", -" unsigned char tmp, * ptr = (unsigned char *)str;", -" while (len > 0) {", -" indx++;", -" tmp = stte[indx];", -" jndx += tmp;", -" stte[indx] = stte[jndx];", -" stte[jndx] = tmp;", -" tmp += stte[indx];", -" *ptr ^= stte[tmp];", -" ptr++;", -" len--;", -" }", -"}", -"", -"/* End of ARC4 */", -"", -"#if HARDENING", -"", -"#include ", -"#include ", -"#include ", -"#include ", -"#define PR_SET_PTRACER 0x59616d61", -"", -"/* Seccomp Sandboxing Init */", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"#include ", -"#include ", -"#include ", -"", -"#define ArchField offsetof(struct seccomp_data, arch)", -"", -"#define Allow(syscall) \\", -" BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, SYS_##syscall, 0, 1), \\", -" BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW)", -"", -"struct sock_filter filter[] = {", -" /* validate arch */", -" BPF_STMT(BPF_LD+BPF_W+BPF_ABS, ArchField),", -" BPF_JUMP( BPF_JMP+BPF_JEQ+BPF_K, AUDIT_ARCH_X86_64, 1, 0),", -" BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", -"", -" /* load syscall */", -" BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, nr)),", -"", -" /* list of allowed syscalls */", -" Allow(exit_group), /* exits a process */", -" Allow(brk), /* for malloc(), inside libc */", -"#if MMAP2", -" Allow(mmap2), /* also for malloc() */", -"#else", -" Allow(mmap), /* also for malloc() */", -"#endif", -" Allow(munmap), /* for free(), inside libc */", -"", -" /* and if we don't match above, die */", -" BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", -"};", -"struct sock_fprog filterprog = {", -" .len = sizeof(filter)/sizeof(filter[0]),", -" .filter = filter", -"};", -"", -"/* Seccomp Sandboxing - Set up the restricted environment */", -"void seccomp_hardening() {", -" if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {", -" perror(\"Could not start seccomp:\");", -" exit(1);", -" }", -" if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &filterprog) == -1) {", -" perror(\"Could not start seccomp:\");", -" exit(1);", -" }", -"} ", -"/* End Seccomp Sandboxing Init */", -"", -"void shc_x_file() {", -" FILE *fp;", -" int line = 0;", -"", -" if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}", -" for (line = 0; shc_x[line]; line++) fprintf(fp, \"%s\\n\", shc_x[line]);", -" fflush(fp);fclose(fp);", -"}", -"", -"int make() {", -" char * cc, * cflags, * ldflags;", -" char cmd[4096];", -"", -" cc = getenv(\"CC\");", -" if (!cc) cc = \"cc\";", -"", -" sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");", -" if (system(cmd)) {remove(\"/tmp/shc_x.c\"); return -1;}", -" remove(\"/tmp/shc_x.c\"); return 0;", -"}", -"", -"void arc4_hardrun(void * str, int len) {", -" //Decode locally", -" char tmp2[len];", -" char tmp3[len+1024];", -" memcpy(tmp2, str, len);", -"", -" unsigned char tmp, * ptr = (unsigned char *)tmp2;", -" int lentmp = len;", -" int pid, status;", -"", -" shc_x_file();", -" if (make()) {exit(1);}", -" pid = fork();", -"", -" setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);", -"", -" if(pid==0) {", -"", -" //Start tracing to protect from dump & trace", -" if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {", -" kill(getpid(), SIGKILL);", -" _exit(1);", -" }", -"", -" //Decode Bash", -" while (len > 0) {", -" indx++;", -" tmp = stte[indx];", -" jndx += tmp;", -" stte[indx] = stte[jndx];", -" stte[jndx] = tmp;", -" tmp += stte[indx];", -" *ptr ^= stte[tmp];", -" ptr++;", -" len--;", -" }", -"", -" //Do the magic", -" sprintf(tmp3, \"%s %s\", \"'********' 21<<<\", tmp2);", -"", -" //Exec bash script //fork execl with 'sh -c'", -" system(tmp2);", -"", -" //Empty script variable", -" memcpy(tmp2, str, lentmp);", -"", -" //Clean temp", -" remove(\"/tmp/shc_x.so\");", -"", -" //Sinal to detach ptrace", -" ptrace(PTRACE_DETACH, 0, 0, 0);", -" exit(0);", -" }", -" else {wait(&status);}", -"", -" /* Seccomp Sandboxing - Start */", -" seccomp_hardening();", -"", -" exit(0);", -"}", -"#endif /* HARDENING */", -"", -"/*", -" * Key with file invariants. ", -" */", -"int key_with_file(char * file)", -"{", -" struct stat statf[1];", -" struct stat control[1];", -"", -" if (stat(file, statf) < 0)", -" return -1;", -"", -" /* Turn on stable fields */", -" memset(control, 0, sizeof(control));", -" control->st_ino = statf->st_ino;", -" control->st_dev = statf->st_dev;", -" control->st_rdev = statf->st_rdev;", -" control->st_uid = statf->st_uid;", -" control->st_gid = statf->st_gid;", -" control->st_size = statf->st_size;", -" control->st_mtime = statf->st_mtime;", -" control->st_ctime = statf->st_ctime;", -" key(control, sizeof(control));", -" return 0;", -"}", -"", -"#if DEBUGEXEC", -"void debugexec(char * sh11, int argc, char ** argv)", -"{", -" int i;", -" fprintf(stderr, \"shll=%s\\n\", sh11 ? sh11 : \"\");", -" fprintf(stderr, \"argc=%d\\n\", argc);", -" if (!argv) {", -" fprintf(stderr, \"argv=\\n\");", -" } else { ", -" for (i = 0; i <= argc ; i++)", -" fprintf(stderr, \"argv[%d]=%s\\n\", i, argv[i] ? argv[i] : \"\");", -" }", -"}", -"#endif /* DEBUGEXEC */", -"", -"void rmarg(char ** argv, char * arg)", -"{", -" for (; argv && *argv && *argv != arg; argv++);", -" for (; argv && *argv; argv++)", -" *argv = argv[1];", -"}", -"", -"void chkenv_end(void);", -"", -"int chkenv(int argc)", -"{", -" char buff[512];", -" unsigned long mask, m;", -" int l, a, c;", -" char * string;", -" extern char ** environ;", -"", -" mask = (unsigned long)getpid();", -" stte_0();", -" key(&chkenv, (void*)&chkenv_end - (void*)&chkenv);", -" key(&data, sizeof(data));", -" key(&mask, sizeof(mask));", -" arc4(&mask, sizeof(mask));", -" sprintf(buff, \"x%lx\", mask);", -" string = getenv(buff);", -"#if DEBUGEXEC", -" fprintf(stderr, \"getenv(%s)=%s\\n\", buff, string ? string : \"\");", -"#endif", -" l = strlen(buff);", -" if (!string) {", -" /* 1st */", -" sprintf(&buff[l], \"=%lu %d\", mask, argc);", -" putenv(strdup(buff));", -" return 0;", -" }", -" c = sscanf(string, \"%lu %d%c\", &m, &a, buff);", -" if (c == 2 && m == mask) {", -" /* 3rd */", -" rmarg(environ, &string[-l - 1]);", -" return 1 + (argc - a);", -" }", -" return -1;", -"}", -"", -"void chkenv_end(void){}", -"", -"#if HARDENING", -"", -"static void gets_process_name(const pid_t pid, char * name) {", -" char procfile[BUFSIZ];", -" sprintf(procfile, \"/proc/%d/cmdline\", pid);", -" FILE* f = fopen(procfile, \"r\");", -" if (f) {", -" size_t size;", -" size = fread(name, sizeof (char), sizeof (procfile), f);", -" if (size > 0) {", -" if ('\\n' == name[size - 1])", -" name[size - 1] = '\\0';", -" }", -" fclose(f);", -" }", -"}", -"", -"void hardening() {", -" prctl(PR_SET_DUMPABLE, 0);", -" prctl(PR_SET_PTRACER, -1);", -"", -" int pid = getppid();", -" char name[256] = {0};", -" gets_process_name(pid, name);", -"", -" if ( (strcmp(name, \"bash\") != 0) ", -" && (strcmp(name, \"/bin/bash\") != 0) ", -" && (strcmp(name, \"sh\") != 0) ", -" && (strcmp(name, \"/bin/sh\") != 0) ", -" && (strcmp(name, \"sudo\") != 0) ", -" && (strcmp(name, \"/bin/sudo\") != 0) ", -" && (strcmp(name, \"/usr/bin/sudo\") != 0)", -" && (strcmp(name, \"gksudo\") != 0) ", -" && (strcmp(name, \"/bin/gksudo\") != 0) ", -" && (strcmp(name, \"/usr/bin/gksudo\") != 0) ", -" && (strcmp(name, \"kdesu\") != 0) ", -" && (strcmp(name, \"/bin/kdesu\") != 0) ", -" && (strcmp(name, \"/usr/bin/kdesu\") != 0) ", -" )", -" {", -" printf(\"Operation not permitted\\n\");", -" kill(getpid(), SIGKILL);", -" exit(1);", -" }", -"}", -"", -"#endif /* HARDENING */", -"", -"#if !TRACEABLE", -"", -"#define _LINUX_SOURCE_COMPAT", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"#include ", -"", -"#if !defined(PT_ATTACHEXC) /* New replacement for PT_ATTACH */", -" #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)", -" #define PT_ATTACHEXC PT_ATTACH", -" #elif defined(PTRACE_ATTACH)", -" #define PT_ATTACHEXC PTRACE_ATTACH", -" #endif", -"#endif", -"", -"void untraceable(char * argv0)", -"{", -" char proc[80];", -" int pid, mine;", -"", -" switch(pid = fork()) {", -" case 0:", -" pid = getppid();", -" /* For problematic SunOS ptrace */", -"#if defined(__FreeBSD__)", -" sprintf(proc, \"/proc/%d/mem\", (int)pid);", -"#else", -" sprintf(proc, \"/proc/%d/as\", (int)pid);", -"#endif", -" close(0);", -" mine = !open(proc, O_RDWR|O_EXCL);", -" if (!mine && errno != EBUSY) {", -" if((mine=2*!ptrace(PT_ATTACHEXC, pid, 0, 0)))wait(0);", -" }", -" if (!mine) {", -" perror(argv0);", -" kill(pid, SIGKILL);", +static const char *RTC[] = { + "", + "#if HARDENING", + "static const char * shc_x[] = {", + "\"/*\",", + "\" * Copyright 2019 - Intika \",", + "\" * Replace ******** with secret read from fd 21\",", + "\" * Also change arguments location of sub commands (sh script commands)\",", + "\" * gcc -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",", + "\" */\",", + "\"\",", + "\"#define _GNU_SOURCE /* needed to get RTLD_NEXT defined in dlfcn.h */\",", + "\"#define PLACEHOLDER \\\"********\\\"\",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"#include \",", + "\"\",", + "\"static char secret[128000]; //max size\",", + "\"typedef int (*pfi)(int, char **, char **);\",", + "\"static pfi real_main;\",", + "\"\",", + "\"// copy argv to new location\",", + "\"char **copyargs(int argc, char** argv){\",", + "\" char **newargv = malloc((argc+1)*sizeof(*argv));\",", + "\" char *from,*to;\",", + "\" int i,len;\",", + "\"\",", + "\" for(i = 0; i 0) {\",", + "\" int i;\",", + "\"\",", + "\" if (secret[n - 1] == '\\\\n') secret[--n] = '\\\\0';\",", + "\" for (i = 1; i < argc; i++)\",", + "\" if (strcmp(argv[i], PLACEHOLDER) == 0)\",", + "\" argv[i] = secret;\",", + "\" }\",", + "\"\",", + "\" real_main = main;\",", + "\"\",", + "\" return real___libc_start_main(mymain, argc, argv, init, fini, rtld_fini, stack_end);\",", + "\"}\",", + "\"\",", + "0};", + "#endif /* HARDENING */", + "", + "/* rtc.c */", + "", + "#include ", + "#include ", + "#include ", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "/* 'Alleged RC4' */", + "", + "static unsigned char stte[256], indx, jndx, kndx;", + "", + "/*", + " * Reset arc4 stte. ", + " */", + "void stte_0(void)", + "{", + " indx = jndx = kndx = 0;", + " do {", + " stte[indx] = indx;", + " } while (++indx);", + "}", + "", + "/*", + " * Set key. Can be used more than once. ", + " */", + "void key(void * str, int len)", + "{", + " unsigned char tmp, * ptr = (unsigned char *)str;", + " while (len > 0) {", + " do {", + " tmp = stte[indx];", + " kndx += tmp;", + " kndx += ptr[(int)indx % len];", + " stte[indx] = stte[kndx];", + " stte[kndx] = tmp;", + " } while (++indx);", + " ptr += 256;", + " len -= 256;", + " }", + "}", + "", + "/*", + " * Crypt data. ", + " */", + "void arc4(void * str, int len)", + "{", + " unsigned char tmp, * ptr = (unsigned char *)str;", + " while (len > 0) {", + " indx++;", + " tmp = stte[indx];", + " jndx += tmp;", + " stte[indx] = stte[jndx];", + " stte[jndx] = tmp;", + " tmp += stte[indx];", + " *ptr ^= stte[tmp];", + " ptr++;", + " len--;", + " }", + "}", + "", + "/* End of ARC4 */", + "", + "#if HARDENING", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "#define PR_SET_PTRACER 0x59616d61", + "", + "/* Seccomp Sandboxing Init */", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#include ", + "#include ", + "#include ", + "", + "#define ArchField offsetof(struct seccomp_data, arch)", + "", + "#define Allow(syscall) \\", + " BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, SYS_##syscall, 0, 1), \\", + " BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW)", + "", + "struct sock_filter filter[] = {", + " /* validate arch */", + " BPF_STMT(BPF_LD+BPF_W+BPF_ABS, ArchField),", + " BPF_JUMP( BPF_JMP+BPF_JEQ+BPF_K, AUDIT_ARCH_X86_64, 1, 0),", + " BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", + "", + " /* load syscall */", + " BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, nr)),", + "", + " /* list of allowed syscalls */", + " Allow(exit_group), /* exits a process */", + " Allow(brk), /* for malloc(), inside libc */", + "#if MMAP2", + " Allow(mmap2), /* also for malloc() */", + "#else", + " Allow(mmap), /* also for malloc() */", + "#endif", + " Allow(munmap), /* for free(), inside libc */", + "", + " /* and if we don't match above, die */", + " BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", + "};", + "struct sock_fprog filterprog = {", + " .len = sizeof(filter)/sizeof(filter[0]),", + " .filter = filter", + "};", + "", + "/* Seccomp Sandboxing - Set up the restricted environment */", + "void seccomp_hardening() {", + " if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {", + " perror(\"Could not start seccomp:\");", + " exit(1);", + " }", + " if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &filterprog) == -1) {", + " perror(\"Could not start seccomp:\");", + " exit(1);", + " }", + "} ", + "/* End Seccomp Sandboxing Init */", + "", + "void shc_x_file() {", + " FILE *fp;", + " int line = 0;", + "", + " if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}", + " for (line = 0; shc_x[line]; line++) fprintf(fp, \"%s\\n\", shc_x[line]);", + " fflush(fp);fclose(fp);", + "}", + "", + "int make() {", + " char * cc, * cflags, * ldflags;", + " char cmd[4096];", + "", + " cc = getenv(\"CC\");", + " if (!cc) cc = \"cc\";", + "", + " sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");", + " if (system(cmd)) {remove(\"/tmp/shc_x.c\"); return -1;}", + " remove(\"/tmp/shc_x.c\"); return 0;", + "}", + "", + "void arc4_hardrun(void * str, int len) {", + " //Decode locally", + " char tmp2[len];", + " char tmp3[len+1024];", + " memcpy(tmp2, str, len);", + "", + " unsigned char tmp, * ptr = (unsigned char *)tmp2;", + " int lentmp = len;", + " int pid, status;", + "", + " shc_x_file();", + " if (make()) {exit(1);}", + " pid = fork();", + "", + " setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);", + "", + " if(pid==0) {", + "", + " //Start tracing to protect from dump & trace", + " if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {", + " kill(getpid(), SIGKILL);", + " _exit(1);", + " }", + "", + " //Decode Bash", + " while (len > 0) {", + " indx++;", + " tmp = stte[indx];", + " jndx += tmp;", + " stte[indx] = stte[jndx];", + " stte[jndx] = tmp;", + " tmp += stte[indx];", + " *ptr ^= stte[tmp];", + " ptr++;", + " len--;", + " }", + "", + " //Do the magic", + " sprintf(tmp3, \"%s %s\", \"'********' 21<<<\", tmp2);", + "", + " //Exec bash script //fork execl with 'sh -c'", + " system(tmp2);", + "", + " //Empty script variable", + " memcpy(tmp2, str, lentmp);", + "", + " //Clean temp", + " remove(\"/tmp/shc_x.so\");", + "", + " //Sinal to detach ptrace", + " ptrace(PTRACE_DETACH, 0, 0, 0);", + " exit(0);", + " }", + " else {wait(&status);}", + "", + " /* Seccomp Sandboxing - Start */", + " seccomp_hardening();", + "", + " exit(0);", + "}", + "#endif /* HARDENING */", + "", + "/*", + " * Key with file invariants. ", + " */", + "int key_with_file(char * file)", + "{", + " struct stat statf[1];", + " struct stat control[1];", + "", + " if (stat(file, statf) < 0)", + " return -1;", + "", + " /* Turn on stable fields */", + " memset(control, 0, sizeof(control));", + " control->st_ino = statf->st_ino;", + " control->st_dev = statf->st_dev;", + " control->st_rdev = statf->st_rdev;", + " control->st_uid = statf->st_uid;", + " control->st_gid = statf->st_gid;", + " control->st_size = statf->st_size;", + " control->st_mtime = statf->st_mtime;", + " control->st_ctime = statf->st_ctime;", + " key(control, sizeof(control));", + " return 0;", + "}", + "", + "#if DEBUGEXEC", + "void debugexec(char * sh11, int argc, char ** argv)", + "{", + " int i;", + " fprintf(stderr, \"shll=%s\\n\", sh11 ? sh11 : \"\");", + " fprintf(stderr, \"argc=%d\\n\", argc);", + " if (!argv) {", + " fprintf(stderr, \"argv=\\n\");", + " } else { ", + " for (i = 0; i <= argc ; i++)", + " fprintf(stderr, \"argv[%d]=%s\\n\", i, argv[i] ? argv[i] : \"\");", + " }", + "}", + "#endif /* DEBUGEXEC */", + "", + "void rmarg(char ** argv, char * arg)", + "{", + " for (; argv && *argv && *argv != arg; argv++);", + " for (; argv && *argv; argv++)", + " *argv = argv[1];", + "}", + "", + "void chkenv_end(void);", + "", + "int chkenv(int argc)", + "{", + " char buff[512];", + " unsigned long mask, m;", + " int l, a, c;", + " char * string;", + " extern char ** environ;", + "", + " mask = (unsigned long)getpid();", + " stte_0();", + " key(&chkenv, (void*)&chkenv_end - (void*)&chkenv);", + " key(&data, sizeof(data));", + " key(&mask, sizeof(mask));", + " arc4(&mask, sizeof(mask));", + " sprintf(buff, \"x%lx\", mask);", + " string = getenv(buff);", + "#if DEBUGEXEC", + " fprintf(stderr, \"getenv(%s)=%s\\n\", buff, string ? string : \"\");", + "#endif", + " l = strlen(buff);", + " if (!string) {", + " /* 1st */", + " sprintf(&buff[l], \"=%lu %d\", mask, argc);", + " putenv(strdup(buff));", + " return 0;", + " }", + " c = sscanf(string, \"%lu %d%c\", &m, &a, buff);", + " if (c == 2 && m == mask) {", + " /* 3rd */", + " rmarg(environ, &string[-l - 1]);", + " return 1 + (argc - a);", + " }", + " return -1;", + "}", + "", + "void chkenv_end(void){}", + "", + "#if HARDENING", + "", + "static void gets_process_name(const pid_t pid, char * name) {", + " char procfile[BUFSIZ];", + " sprintf(procfile, \"/proc/%d/cmdline\", pid);", + " FILE* f = fopen(procfile, \"r\");", + " if (f) {", + " size_t size;", + " size = fread(name, sizeof (char), sizeof (procfile), f);", + " if (size > 0) {", + " if ('\\n' == name[size - 1])", + " name[size - 1] = '\\0';", + " }", + " fclose(f);", + " }", + "}", + "", + "void hardening() {", + " prctl(PR_SET_DUMPABLE, 0);", + " prctl(PR_SET_PTRACER, -1);", + "", + " int pid = getppid();", + " char name[256] = {0};", + " gets_process_name(pid, name);", + "", + " if ( (strcmp(name, \"bash\") != 0) ", + " && (strcmp(name, \"/bin/bash\") != 0) ", + " && (strcmp(name, \"sh\") != 0) ", + " && (strcmp(name, \"/bin/sh\") != 0) ", + " && (strcmp(name, \"sudo\") != 0) ", + " && (strcmp(name, \"/bin/sudo\") != 0) ", + " && (strcmp(name, \"/usr/bin/sudo\") != 0)", + " && (strcmp(name, \"gksudo\") != 0) ", + " && (strcmp(name, \"/bin/gksudo\") != 0) ", + " && (strcmp(name, \"/usr/bin/gksudo\") != 0) ", + " && (strcmp(name, \"kdesu\") != 0) ", + " && (strcmp(name, \"/bin/kdesu\") != 0) ", + " && (strcmp(name, \"/usr/bin/kdesu\") != 0) ", + " )", + " {", + " printf(\"Operation not permitted\\n\");", + " kill(getpid(), SIGKILL);", + " exit(1);", + " }", + "}", + "", + "#endif /* HARDENING */", + "", + "#if !TRACEABLE", + "", + "#define _LINUX_SOURCE_COMPAT", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#if !defined(PT_ATTACHEXC) /* New replacement for PT_ATTACH */", + " #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)", + " #define PT_ATTACHEXC PT_ATTACH", + " #elif defined(PTRACE_ATTACH)", + " #define PT_ATTACHEXC PTRACE_ATTACH", + " #endif", + "#endif", + "", + "void untraceable(char * argv0)", + "{", + " char proc[80];", + " int pid, mine;", + "", + " switch(pid = fork()) {", + " case 0:", + " pid = getppid();", + " /* For problematic SunOS ptrace */", + "#if defined(__FreeBSD__)", + " sprintf(proc, \"/proc/%d/mem\", (int)pid);", + "#else", + " sprintf(proc, \"/proc/%d/as\", (int)pid);", + "#endif", + " close(0);", + " mine = !open(proc, O_RDWR|O_EXCL);", + " if (!mine && errno != EBUSY) {", + " if((mine=2*!ptrace(PT_ATTACHEXC, pid, 0, 0)))wait(0);", + " }", + " if (!mine) {", + " perror(argv0);", + " kill(pid, SIGKILL);", /*" fprintf(stderr, \"%s is being traced!\\n\", argv0);",*/ -" } else if(mine>1) {", -" ptrace(PTRACE_DETACH, pid, 0, 0);", -" }", -" _exit(mine);", -" case -1:", -" break;", -" default:", -" if (pid == waitpid(pid, 0, 0))", -" return;", -" }", -" perror(argv0);", -" _exit(1);", -"}", -"#endif /* !TRACEABLE */", -"", -"char * xsh(int argc, char ** argv)", -"{", -" char * scrpt;", -" int ret, i, j;", -" char ** varg;", -" char * me = argv[0];", -" if (me == NULL) { me = getenv(\"_\"); }", -" if (me == 0) { fprintf(stderr, \"E: neither argv[0] nor $_ works.\"); exit(1); }", -"", -" ret = chkenv(argc);", -" stte_0();", -" key(pswd, pswd_z);", -" arc4(msg1, msg1_z);", -" arc4(date, date_z);", -" if (date[0] && (atoll(date)BUFSIZ) w=BUFSIZ;", -" if((w=write(fd, text+i, w))<0) break;", -" memset(text+i, 0, w);", -" }", -" _exit(0);", -" }", -" if(!FIXARGV0) {", -" varg[j++] = tnm;", -" i0=1;", -" goto xec;", -" }", -" }", -" if (ret && *opts)", -" varg[j++] = opts; /* Options on 1st line of code */", -" if (*inlo)", -" varg[j++] = inlo; /* Option introducing inline code */", -" char cmd[256];", -" if(PIPESCRIPT && ret) {", -" snprintf(cmd, sizeof(cmd), pfmt, argv[0], tnm);" -" varg[j++] = cmd;" -" } else {", -" varg[j++] = scrpt; /* The script itself */", -" }", -" if (*lsto)", -" varg[j++] = lsto; /* Option meaning last option */", -"xec:", -" i = (ret > 1) ? ret : i0; /* Args numbering correction */", -" while (i < argc)", -" varg[j++] = argv[i++]; /* Main run-time arguments */", -" varg[j] = 0; /* NULL terminated array */", -"#if DEBUGEXEC", -" debugexec(shll, j, varg);", -"#endif", -" execvp(shll, varg);", -" return shll;", -"}", -"", -"int main(int argc, char ** argv)", -"{", -"#if SETUID", -" setuid(0);", -"#endif", -"#if DEBUGEXEC", -" debugexec(\"main\", argc, argv);", -"#endif", -"#if HARDENING", -" hardening();", -"#endif", -"#if !TRACEABLE", -" untraceable(argv[0]);", -"#endif", -" argv[1] = xsh(argc, argv);", -" fprintf(stderr, \"%s%s%s: %s\\n\", argv[0],", -" errno ? \": \" : \"\",", -" errno ? strerror(errno) : \"\",", -" argv[1] ? argv[1] : \"\"", -" );", -" return 1;", -"}", -0}; + " } else if(mine>1) {", + " ptrace(PTRACE_DETACH, pid, 0, 0);", + " }", + " _exit(mine);", + " case -1:", + " break;", + " default:", + " if (pid == waitpid(pid, 0, 0))", + " return;", + " }", + " perror(argv0);", + " _exit(1);", + "}", + "#endif /* !TRACEABLE */", + "", + "char * xsh(int argc, char ** argv)", + "{", + " char * scrpt;", + " int ret, i, j;", + " char ** varg;", + " char * me = argv[0];", + " if (me == NULL) { me = getenv(\"_\"); }", + " if (me == 0) { fprintf(stderr, \"E: neither argv[0] nor $_ works.\"); exit(1); }", + "", + " ret = chkenv(argc);", + " stte_0();", + " key(pswd, pswd_z);", + " arc4(msg1, msg1_z);", + " arc4(date, date_z);", + " if (date[0] && (atoll(date)BUFSIZ) w=BUFSIZ;", + " if((w=write(fd, text+i, w))<0) break;", + " memset(text+i, 0, w);", + " }", + " _exit(0);", + " }", + " if(!FIXARGV0) {", + " varg[j++] = tnm;", + " i0=1;", + " goto xec;", + " }", + " }", + " if (ret && *opts)", + " varg[j++] = opts; /* Options on 1st line of code */", + " if (*inlo)", + " varg[j++] = inlo; /* Option introducing inline code */", + " char cmd[256];", + " if(PIPESCRIPT && ret) {", + " snprintf(cmd, sizeof(cmd), pfmt, argv[0], tnm);" + " varg[j++] = cmd;" + " } else {", + " varg[j++] = scrpt; /* The script itself */", + " }", + " if (*lsto)", + " varg[j++] = lsto; /* Option meaning last option */", + "xec:", + " i = (ret > 1) ? ret : i0; /* Args numbering correction */", + " while (i < argc)", + " varg[j++] = argv[i++]; /* Main run-time arguments */", + " varg[j] = 0; /* NULL terminated array */", + "#if DEBUGEXEC", + " debugexec(shll, j, varg);", + "#endif", + " execvp(shll, varg);", + " return shll;", + "}", + "", + "int main(int argc, char ** argv)", + "{", + "#if SETUID", + " setuid(0);", + "#endif", + "#if DEBUGEXEC", + " debugexec(\"main\", argc, argv);", + "#endif", + "#if HARDENING", + " hardening();", + "#endif", + "#if !TRACEABLE", + " untraceable(argv[0]);", + "#endif", + " argv[1] = xsh(argc, argv);", + " fprintf(stderr, \"%s%s%s: %s\\n\", argv[0],", + " errno ? \": \" : \"\",", + " errno ? strerror(errno) : \"\",", + " argv[1] ? argv[1] : \"\"", + " );", + " return 1;", + "}", + 0 +}; -static int parse_an_arg(int argc, char * argv[]) +static int parse_an_arg(int argc, char *argv[]) { - extern char * optarg; - const char * opts = "e:m:f:i:x:l:o:rvDSUHPCAB2h0"; + extern char *optarg; + const char *opts = "e:m:f:i:x:l:o:rvDSUHPCAB2h0"; struct tm tmp[1]; time_t expdate; int cnt, l; @@ -834,15 +838,15 @@ static int parse_an_arg(int argc, char * argv[]) tmp->tm_year -= 1900; expdate = mktime(tmp); } - if (cnt != 3 || expdate <= 0) { + if ((cnt != 3) || (expdate <= 0)) { fprintf(stderr, "%s parse(-e %s): Not a valid value\n", - my_name, optarg); + my_name, optarg); return -1; } sprintf(date, "%lld", (long long)expdate); - if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); + if (verbose) { fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); } expdate = atoll(date); - if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); + if (verbose) { fprintf(stderr, "%s -e %s", my_name, ctime(&expdate)); } break; case 'm': mail = optarg; @@ -875,7 +879,7 @@ static int parse_an_arg(int argc, char * argv[]) break; case 'S': SETUID_flag = 1; - break; + break; case 'D': DEBUGEXEC_flag = 1; break; @@ -895,8 +899,9 @@ static int parse_an_arg(int argc, char * argv[]) fprintf(stderr, "%s %s, %s\n", my_name, version, subject); fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e); fprintf(stderr, "%s ", my_name); - for (l = 0; copying[l]; l++) + for (l = 0; copying[l]; l++) { fprintf(stderr, "%s\n", copying[l]); + } fprintf(stderr, " %s %s %s\n\n", provider.f, provider.s, provider.e); exit(0); break; @@ -904,16 +909,18 @@ static int parse_an_arg(int argc, char * argv[]) fprintf(stderr, "%s %s, %s\n", my_name, version, subject); fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e); fprintf(stderr, "%s ", my_name); - for (l = 0; abstract[l]; l++) + for (l = 0; abstract[l]; l++) { fprintf(stderr, "%s\n", abstract[l]); + } exit(0); break; case 'h': fprintf(stderr, "%s %s, %s\n", my_name, version, subject); fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e); fprintf(stderr, "%s %s\n", my_name, usage); - for (l = 0; help[l]; l++) + for (l = 0; help[l]; l++) { fprintf(stderr, "%s\n", help[l]); + } exit(0); break; case -1: @@ -942,23 +949,25 @@ static int parse_an_arg(int argc, char * argv[]) return 1; } -static void parse_args(int argc, char * argv[]) +static void parse_args(int argc, char *argv[]) { int err = 0; int ret; #if 0 my_name = strrchr(argv[0], '/'); - if (my_name) + if (my_name) { my_name++; - else + } else { my_name = argv[0]; + } #endif do { ret = parse_an_arg(argc, argv); - if (ret == -1) + if (ret == -1) { err++; + } } while (ret); if (err) { @@ -985,9 +994,9 @@ void stte_0(void) /* * Set key. Can be used more than once. */ -void key(void * str, int len) +void key(void *str, int len) { - unsigned char tmp, * ptr = (unsigned char *)str; + unsigned char tmp, *ptr = (unsigned char *)str; while (len > 0) { do { tmp = stte[indx]; @@ -1004,9 +1013,9 @@ void key(void * str, int len) /* * Crypt data. */ -void arc4(void * str, int len) +void arc4(void *str, int len) { - unsigned char tmp, * ptr = (unsigned char *)str; + unsigned char tmp, *ptr = (unsigned char *)str; while (len > 0) { indx++; tmp = stte[indx]; @@ -1025,13 +1034,14 @@ void arc4(void * str, int len) /* * Key with file invariants. */ -int key_with_file(char * file) +int key_with_file(char *file) { struct stat statf[1]; struct stat control[1]; - if (stat(file, statf) < 0) + if (stat(file, statf) < 0) { return -1; + } /* Turn on stable fields */ memset(control, 0, sizeof(control)); @@ -1052,86 +1062,96 @@ int key_with_file(char * file) * environment variables with characters as "=|#:*?$ ". */ struct { - char * shll; - char * inlo; - char * lsto; - char * xecc; - char * pfmt; + char * shll; + char * inlo; + char * lsto; + char * xecc; + char * pfmt; } shellsDB[] = { { "perl", "-e", "--", "exec('%s',@ARGV);", "" }, - { "rc", "-c", "", "builtin exec %s $*", "" }, - { "sh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* IRIX_nvi */ - { "dash", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, - { "bash", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, - { "zsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, - { "bsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX_nvi */ - { "Rsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX_nvi */ - { "ksh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* OK on Solaris, AIX and Linux (THX ) */ - { "tsh", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX */ - { "ash", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* Linux */ - { "csh", "-c", "-b", "exec '%s' $argv", "source '%s'" }, /* AIX: No file for $0 */ + { "rc", "-c", "", "builtin exec %s $*", "" }, + { "sh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* IRIX_nvi */ + { "dash", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, + { "bash", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, + { "zsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, + { "bsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX_nvi */ + { "Rsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX_nvi */ + { "ksh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* OK on Solaris, AIX and Linux (THX ) */ + { "tsh", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX */ + { "ash", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* Linux */ + { "csh", "-c", "-b", "exec '%s' $argv", "source '%s'" }, /* AIX: No file for $0 */ { "tcsh", "-c", "-b", "exec '%s' $argv", "source '%s'" }, - { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];%.0s exec(open('%s').read())" }, - { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, - { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read()" }, - { NULL, NULL, NULL, NULL }, + { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", + "import sys;sys.argv[0:1]=[];%.0s exec(open('%s').read())" }, + { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", + "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, + { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", + "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read()" }, + { NULL, NULL, NULL, NULL }, }; -int eval_shell(char * text) +int eval_shell(char *text) { int i; - char * ptr; + char *ptr; ptr = strchr(text, (int)'\n'); - if (!ptr) + if (!ptr) { i = strlen(text); - else + } else { i = ptr - text; - ptr = malloc(i + 1); + } + ptr = malloc(i + 1); shll = malloc(i + 1); opts = malloc(i + 1); - if (!ptr || !shll || !opts) + if (!ptr || !shll || !opts) { return -1; + } strncpy(ptr, text, i); ptr[i] = '\0'; *opts = '\0'; i = sscanf(ptr, " #!%s%s %c", shll, opts, opts); - if (i < 1 || i > 2) { + if ((i < 1) || (i > 2)) { fprintf(stderr, "%s: invalid first line in script: %s\n", my_name, ptr); return -1; } free(ptr); shll = realloc(shll, strlen(shll) + 1); - ptr = strrchr(shll, (int)'/'); + ptr = strrchr(shll, (int)'/'); if (!ptr) { fprintf(stderr, "%s: invalid shll\n", my_name); return -1; } - if (*ptr == '/') + if (*ptr == '/') { ptr++; - if (verbose) fprintf(stderr, "%s shll=%s\n", my_name, ptr); + } + if (verbose) { fprintf(stderr, "%s shll=%s\n", my_name, ptr); } - for(i=0; shellsDB[i].shll; i++) { - if(!strcmp(ptr, shellsDB[i].shll)) { - if (!inlo) + for (i = 0; shellsDB[i].shll; i++) { + if (!strcmp(ptr, shellsDB[i].shll)) { + if (!inlo) { inlo = strdup(shellsDB[i].inlo); - if (!pfmt) + } + if (!pfmt) { pfmt = strdup(shellsDB[i].pfmt); - if (!xecc) + } + if (!xecc) { xecc = strdup(shellsDB[i].xecc); - if (!lsto) + } + if (!lsto) { lsto = strdup(shellsDB[i].lsto); + } } } if (!inlo || !xecc || !lsto) { fprintf(stderr, "%s Unknown shell (%s): specify [-i][-x][-l]\n", my_name, ptr); return -1; } - if (verbose) fprintf(stderr, "%s [-i]=%s\n", my_name, inlo); - if (verbose) fprintf(stderr, "%s [-x]=%s\n", my_name, xecc); - if (verbose) fprintf(stderr, "%s [-l]=%s\n", my_name, lsto); + if (verbose) { fprintf(stderr, "%s [-i]=%s\n", my_name, inlo); } + if (verbose) { fprintf(stderr, "%s [-x]=%s\n", my_name, xecc); } + if (verbose) { fprintf(stderr, "%s [-l]=%s\n", my_name, lsto); } opts = realloc(opts, strlen(opts) + 1); if (*opts && !strcmp(opts, lsto)) { @@ -1141,45 +1161,50 @@ int eval_shell(char * text) fprintf(stderr, "%s opts=%s : No real one. Removing opts\n", my_name, opts); *opts = '\0'; } - if (verbose) fprintf(stderr, "%s opts=%s\n", my_name, opts); + if (verbose) { fprintf(stderr, "%s opts=%s\n", my_name, opts); } return 0; } -char * read_script(char * file) +char*read_script(char *file) { - FILE * i; - char * text; + FILE *i; + char *text; int cnt, l; text = malloc(SIZE); - if (!text) + if (!text) { return NULL; + } i = fopen(file, "r"); - if (!i) + if (!i) { return NULL; + } for (l = 0;;) { text = realloc(text, l + SIZE); - if (!text) + if (!text) { return NULL; + } cnt = fread(&text[l], 1, SIZE, i); - if (!cnt) + if (!cnt) { break; + } l += cnt; } fclose(i); text = realloc(text, l + 1); - if (!text) + if (!text) { return NULL; + } text[l] = '\0'; /* Check current System ARG_MAX limit. */ - if (!PIPESCRIPT_flag && l > 0.80 * (cnt = sysconf(_SC_ARG_MAX))) { + if (!PIPESCRIPT_flag && (l > 0.80 * (cnt = sysconf(_SC_ARG_MAX)))) { fprintf(stderr, "%s: WARNING!!\n" -" Scripts of length near to (or higher than) the current System limit on\n" -" \"maximum size of arguments to EXEC\", could comprise its binary execution.\n" -" In the current System the call sysconf(_SC_ARG_MAX) returns %d bytes\n" -" and your script \"%s\" is %d bytes length.\n", - my_name, cnt, file, l); + " Scripts of length near to (or higher than) the current System limit on\n" + " \"maximum size of arguments to EXEC\", could comprise its binary execution.\n" + " In the current System the call sysconf(_SC_ARG_MAX) returns %d bytes\n" + " and your script \"%s\" is %d bytes length.\n", + my_name, cnt, file, l); } return text; } @@ -1189,106 +1214,111 @@ unsigned rand_mod(unsigned mod) /* Without skew */ unsigned rnd, top = RAND_MAX; top -= top % mod; - while (top <= (rnd = rand())) + while (top <= (rnd = rand())) { continue; + } /* Using high-order bits. */ - rnd = 1.0*mod*rnd/(1.0+top); + rnd = 1.0 * mod * rnd / (1.0 + top); return rnd; } char rand_chr(void) { - return (char)rand_mod(1<<(sizeof(char)<<3)); + return (char)rand_mod(1 << (sizeof(char) << 3)); } -int noise(char * ptr, unsigned min, unsigned xtra, int str) +int noise(char *ptr, unsigned min, unsigned xtra, int str) { - if (xtra) xtra = rand_mod(xtra); + if (xtra) { xtra = rand_mod(xtra); } xtra += min; - for (min = 0; min < xtra; min++, ptr++) + for (min = 0; min < xtra; min++, ptr++) { do *ptr = rand_chr(); while (str && !isalnum((int)*ptr)); - if (str) *ptr = '\0'; + } + if (str) { *ptr = '\0'; } return xtra; } static int offset; -void prnt_bytes(FILE * o, char * ptr, int m, int l, int n) +void prnt_bytes(FILE *o, char *ptr, int m, int l, int n) { int i; l += m; n += l; for (i = 0; i < n; i++) { - if ((i & 0xf) == 0) + if ((i & 0xf) == 0) { fprintf(o, "\n\t\""); - fprintf(o, "\\%03o", (unsigned char)((i>=m) && (i= m) && (i < l) ? ptr[i - m] : rand_chr())); + if ((i & 0xf) == 0xf) { fprintf(o, "\""); + } } - if ((i & 0xf) != 0) + if ((i & 0xf) != 0) { fprintf(o, "\""); + } offset += n; } -void prnt_array(FILE * o, void * ptr, char * name, int l, char * cast) +void prnt_array(FILE *o, void *ptr, char *name, int l, char *cast) { - int m = rand_mod(1+l/4); /* Random amount of random pre padding (offset) */ - int n = rand_mod(1+l/4); /* Random amount of random post padding (tail) */ - int a = (offset+m)%l; - if (cast && a) m += l - a; /* Type alignement. */ + int m = rand_mod(1 + l / 4); /* Random amount of random pre padding (offset) */ + int n = rand_mod(1 + l / 4); /* Random amount of random post padding (tail) */ + int a = (offset + m) % l; + if (cast && a) { m += l - a; } /* Type alignement. */ fprintf(o, "\n"); fprintf(o, "#define %s_z %d", name, l); fprintf(o, "\n"); - fprintf(o, "#define %s (%s(&data[%d]))", name, cast?cast:"", offset+m); + fprintf(o, "#define %s (%s(&data[%d]))", name, cast?cast : "", offset + m); prnt_bytes(o, ptr, m, l, n); } -void dump_array(FILE * o, void * ptr, char * name, int l, char * cast) +void dump_array(FILE *o, void *ptr, char *name, int l, char *cast) { arc4(ptr, l); prnt_array(o, ptr, name, l, cast); } -int write_C(char * file, char * argv[]) +int write_C(char *file, char *argv[]) { char pswd[256]; int pswd_z = sizeof(pswd); - char* msg1 = strdup("has expired!\n"); + char *msg1 = strdup("has expired!\n"); int msg1_z = strlen(msg1) + 1; int date_z = strlen(date) + 1; - char* kwsh = strdup(shll); + char *kwsh = strdup(shll); int shll_z = strlen(shll) + 1; int inlo_z = strlen(inlo) + 1; int pfmt_z = strlen(pfmt) + 1; int xecc_z = strlen(xecc) + 1; int lsto_z = strlen(lsto) + 1; - char* tst1 = strdup("location has changed!"); + char *tst1 = strdup("location has changed!"); int tst1_z = strlen(tst1) + 1; - char* chk1 = strdup(tst1); + char *chk1 = strdup(tst1); int chk1_z = tst1_z; - char* msg2 = strdup("abnormal behavior!"); + char *msg2 = strdup("abnormal behavior!"); int msg2_z = strlen(msg2) + 1; int rlax_z = sizeof(rlax); int opts_z = strlen(opts) + 1; int text_z = strlen(text) + 1; - char* tst2 = strdup("shell has changed!"); + char *tst2 = strdup("shell has changed!"); int tst2_z = strlen(tst2) + 1; - char* chk2 = strdup(tst2); + char *chk2 = strdup(tst2); int chk2_z = tst2_z; - char* name = strdup(file); - FILE * o; + char *name = strdup(file); + FILE *o; int indx; int numd = 0; int done = 0; /* Encrypt */ - srand((unsigned)time(NULL)^(unsigned)getpid()); + srand((unsigned)time(NULL) ^ (unsigned)getpid()); pswd_z = noise(pswd, pswd_z, 0, 0); numd++; stte_0(); - key(pswd, pswd_z); + key(pswd, pswd_z); msg1_z += strlen(mail); msg1 = strcat(realloc(msg1, msg1_z), mail); arc4(msg1, msg1_z); numd++; @@ -1299,7 +1329,7 @@ int write_C(char * file, char * argv[]) arc4(xecc, xecc_z); numd++; arc4(lsto, lsto_z); numd++; arc4(tst1, tst1_z); numd++; - key(chk1, chk1_z); + key(chk1, chk1_z); arc4(chk1, chk1_z); numd++; arc4(msg2, msg2_z); numd++; indx = !rlax[0]; @@ -1312,11 +1342,11 @@ int write_C(char * file, char * argv[]) arc4(opts, opts_z); numd++; arc4(text, text_z); numd++; arc4(tst2, tst2_z); numd++; - key(chk2, chk2_z); + key(chk2, chk2_z); arc4(chk2, chk2_z); numd++; /* Output */ - name = strcat(realloc(name, strlen(name)+5), ".x.c"); + name = strcat(realloc(name, strlen(name) + 5), ".x.c"); o = fopen(name, "w"); if (!o) { fprintf(stderr, "%s: creating output file: %s ", my_name, name); @@ -1326,8 +1356,9 @@ int write_C(char * file, char * argv[]) fprintf(o, "#if 0\n"); fprintf(o, "\t%s %s, %s\n", my_name, version, subject); fprintf(o, "\t%s %s %s %s\n\n\t", cpright, provider.f, provider.s, provider.e); - for (indx = 0; argv[indx]; indx++) + for (indx = 0; argv[indx]; indx++) { fprintf(o, "%s ", argv[indx]); + } fprintf(o, "\n#endif\n\n"); fprintf(o, "static char data [] = "); do { @@ -1335,28 +1366,28 @@ int write_C(char * file, char * argv[]) indx = rand_mod(16); do { switch (indx) { - case 0: if (pswd_z>=0) {prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z=done=-1; break;} - case 1: if (msg1_z>=0) {prnt_array(o, msg1, "msg1", msg1_z, 0); msg1_z=done=-1; break;} - case 2: if (date_z>=0) {prnt_array(o, date, "date", date_z, 0); date_z=done=-1; break;} - case 3: if (shll_z>=0) {prnt_array(o, shll, "shll", shll_z, 0); shll_z=done=-1; break;} - case 4: if (inlo_z>=0) {prnt_array(o, inlo, "inlo", inlo_z, 0); inlo_z=done=-1; break;} - case 5: if (xecc_z>=0) {prnt_array(o, xecc, "xecc", xecc_z, 0); xecc_z=done=-1; break;} - case 6: if (lsto_z>=0) {prnt_array(o, lsto, "lsto", lsto_z, 0); lsto_z=done=-1; break;} - case 7: if (tst1_z>=0) {prnt_array(o, tst1, "tst1", tst1_z, 0); tst1_z=done=-1; break;} - case 8: if (chk1_z>=0) {prnt_array(o, chk1, "chk1", chk1_z, 0); chk1_z=done=-1; break;} - case 9: if (msg2_z>=0) {prnt_array(o, msg2, "msg2", msg2_z, 0); msg2_z=done=-1; break;} - case 10: if (rlax_z>=0) {prnt_array(o, rlax, "rlax", rlax_z, 0); rlax_z=done=-1; break;} - case 11: if (opts_z>=0) {prnt_array(o, opts, "opts", opts_z, 0); opts_z=done=-1; break;} - case 12: if (text_z>=0) {prnt_array(o, text, "text", text_z, 0); text_z=done=-1; break;} - case 13: if (tst2_z>=0) {prnt_array(o, tst2, "tst2", tst2_z, 0); tst2_z=done=-1; break;} - case 14: if (chk2_z>=0) {prnt_array(o, chk2, "chk2", chk2_z, 0); chk2_z=done=-1; break;} - case 15: if (pfmt_z>=0) {prnt_array(o, pfmt, "pfmt", pfmt_z, 0); pfmt_z=done=-1; break;} + case 0: if (pswd_z >= 0) { prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z = done = -1; break; } + case 1: if (msg1_z >= 0) { prnt_array(o, msg1, "msg1", msg1_z, 0); msg1_z = done = -1; break; } + case 2: if (date_z >= 0) { prnt_array(o, date, "date", date_z, 0); date_z = done = -1; break; } + case 3: if (shll_z >= 0) { prnt_array(o, shll, "shll", shll_z, 0); shll_z = done = -1; break; } + case 4: if (inlo_z >= 0) { prnt_array(o, inlo, "inlo", inlo_z, 0); inlo_z = done = -1; break; } + case 5: if (xecc_z >= 0) { prnt_array(o, xecc, "xecc", xecc_z, 0); xecc_z = done = -1; break; } + case 6: if (lsto_z >= 0) { prnt_array(o, lsto, "lsto", lsto_z, 0); lsto_z = done = -1; break; } + case 7: if (tst1_z >= 0) { prnt_array(o, tst1, "tst1", tst1_z, 0); tst1_z = done = -1; break; } + case 8: if (chk1_z >= 0) { prnt_array(o, chk1, "chk1", chk1_z, 0); chk1_z = done = -1; break; } + case 9: if (msg2_z >= 0) { prnt_array(o, msg2, "msg2", msg2_z, 0); msg2_z = done = -1; break; } + case 10: if (rlax_z >= 0) { prnt_array(o, rlax, "rlax", rlax_z, 0); rlax_z = done = -1; break; } + case 11: if (opts_z >= 0) { prnt_array(o, opts, "opts", opts_z, 0); opts_z = done = -1; break; } + case 12: if (text_z >= 0) { prnt_array(o, text, "text", text_z, 0); text_z = done = -1; break; } + case 13: if (tst2_z >= 0) { prnt_array(o, tst2, "tst2", tst2_z, 0); tst2_z = done = -1; break; } + case 14: if (chk2_z >= 0) { prnt_array(o, chk2, "chk2", chk2_z, 0); chk2_z = done = -1; break; } + case 15: if (pfmt_z >= 0) { prnt_array(o, pfmt, "pfmt", pfmt_z, 0); pfmt_z = done = -1; break; } } indx = 0; } while (!done); - } while (numd+=done); + } while (numd += done); fprintf(o, "/* End of data[] */;\n"); - fprintf(o, "#define %s_z %d\n", "hide", 1<<12); + fprintf(o, "#define %s_z %d\n", "hide", 1 << 12); fprintf(o, SETUID_line, SETUID_flag); fprintf(o, DEBUGEXEC_line, DEBUGEXEC_flag); fprintf(o, TRACEABLE_line, TRACEABLE_flag); @@ -1365,8 +1396,9 @@ int write_C(char * file, char * argv[]) fprintf(o, HARDENING_line, HARDENING_flag); fprintf(o, BUSYBOXON_line, BUSYBOXON_flag); fprintf(o, MMAP2_line, MMAP2_flag); - for (indx = 0; RTC[indx]; indx++) + for (indx = 0; RTC[indx]; indx++) { fprintf(o, "%s\n", RTC[indx]); + } fflush(o); fclose(o); @@ -1375,63 +1407,73 @@ int write_C(char * file, char * argv[]) int make(void) { - char * cc, * cflags, * ldflags; + char *cc, *cflags, *ldflags; char cmd[SIZE]; cc = getenv("CC"); - if (!cc) + if (!cc) { cc = "cc"; + } cflags = getenv("CFLAGS"); - if (!cflags) + if (!cflags) { cflags = ""; + } ldflags = getenv("LDFLAGS"); - if (!ldflags) + if (!ldflags) { ldflags = ""; + } - if(!file2){ - file2=(char*)realloc(file2,strlen(file)+3); - strcpy(file2,file); - file2=strcat(file2,".x"); - + if (!file2) { + file2 = (char *)realloc(file2, strlen(file) + 3); + strcpy(file2, file); + file2 = strcat(file2, ".x"); } sprintf(cmd, "%s %s %s %s.x.c -o %s", cc, cflags, ldflags, file, file2); - if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); - if (system(cmd)) + if (verbose) { fprintf(stderr, "%s: %s\n", my_name, cmd); } + if (system(cmd)) { return -1; - char* strip = getenv("STRIP"); - if (!strip) + } + char *strip = getenv("STRIP"); + if (!strip) { strip = "strip"; + } sprintf(cmd, "%s %s", strip, file2); - if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); - if (system(cmd)) + if (verbose) { fprintf(stderr, "%s: %s\n", my_name, cmd); } + if (system(cmd)) { fprintf(stderr, "%s: never mind\n", my_name); + } sprintf(cmd, "chmod ug=rwx,o=rx %s", file2); - if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd); - if (system(cmd)) + if (verbose) { fprintf(stderr, "%s: %s\n", my_name, cmd); } + if (system(cmd)) { fprintf(stderr, "%s: remove read permission\n", my_name); + } return 0; } -void do_all(int argc, char * argv[]) +void do_all(int argc, char *argv[]) { parse_args(argc, argv); text = read_script(file); - if (!text) + if (!text) { return; - if (eval_shell(text)) + } + if (eval_shell(text)) { return; - if(strstr(shll, "python")) { - PIPESCRIPT_flag=1; } - if (write_C(file, argv)) + if (strstr(shll, "python")) { + PIPESCRIPT_flag = 1; + } + if (write_C(file, argv)) { return; - if (make()) + } + if (make()) { return; + } exit(0); } -int main(int argc, char * argv[]) +int main(int argc, char *argv[]) { putenv("LANG="); do_all(argc, argv); @@ -1440,4 +1482,3 @@ int main(int argc, char * argv[]) exit(1); return 1; } - From b70a297870e104e7a0730880001e5a5bca7914ba Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 17:36:07 +0200 Subject: [PATCH 56/83] Set -0 option in tests --- test/ttest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ttest.sh b/test/ttest.sh index 9b2db3d..653cf21 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -60,7 +60,7 @@ for shell in "${shells[@]}"; do fi } > "$tmpf" # shellcheck disable=SC2086 - "$shc" $opt -f "$tmpf" -o "$tmpa" + "$shc" -0 $opt -f "$tmpf" -o "$tmpa" # ls -la "$tmpa" if [ "$opt" = "-D" ] ; then From 2dbcec68bf131e06edbf03b018b436f0450a622d Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 17:39:08 +0200 Subject: [PATCH 57/83] Enable -0 option in tests --- test/ttest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ttest.sh b/test/ttest.sh index 9b2db3d..653cf21 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -60,7 +60,7 @@ for shell in "${shells[@]}"; do fi } > "$tmpf" # shellcheck disable=SC2086 - "$shc" $opt -f "$tmpf" -o "$tmpa" + "$shc" -0 $opt -f "$tmpf" -o "$tmpa" # ls -la "$tmpa" if [ "$opt" = "-D" ] ; then From a2bc6eadc12b99fc000c979d17b03702e490a21a Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 17:39:08 +0200 Subject: [PATCH 58/83] Enable -0 option in tests --- test/ttest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ttest.sh b/test/ttest.sh index 9b2db3d..653cf21 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -60,7 +60,7 @@ for shell in "${shells[@]}"; do fi } > "$tmpf" # shellcheck disable=SC2086 - "$shc" $opt -f "$tmpf" -o "$tmpa" + "$shc" -0 $opt -f "$tmpf" -o "$tmpa" # ls -la "$tmpa" if [ "$opt" = "-D" ] ; then From 997c3d0e5b159136f8491b42af96c760729e7a9f Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Sat, 17 Aug 2024 18:21:08 +0200 Subject: [PATCH 59/83] fix typo in python3 DB --- src/shc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shc.c b/src/shc.c index d2e276d..37a1790 100644 --- a/src/shc.c +++ b/src/shc.c @@ -1073,7 +1073,7 @@ struct { { "tcsh", "-c", "-b", "exec '%s' $argv", "source '%s'" }, { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];%.0s exec(open('%s').read())" }, { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, - { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read()" }, + { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, { NULL, NULL, NULL, NULL }, }; From 3f4447664aef437766b97fac673a30852282e192 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Sat, 17 Aug 2024 19:11:38 +0200 Subject: [PATCH 60/83] add perl support (with -P forced) --- src/shc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shc.c b/src/shc.c index 37a1790..3b1f000 100644 --- a/src/shc.c +++ b/src/shc.c @@ -1058,7 +1058,7 @@ struct { char * xecc; char * pfmt; } shellsDB[] = { - { "perl", "-e", "--", "exec('%s',@ARGV);", "" }, + { "perl", "-e", "--", "exec('%s',@ARGV);", "$0='%s';open(F,'%s');@SHCS=;close(F);eval(join('',@SHCS));" }, { "rc", "-c", "", "builtin exec %s $*", "" }, { "sh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* IRIX_nvi */ { "dash", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, @@ -1421,7 +1421,8 @@ void do_all(int argc, char * argv[]) return; if (eval_shell(text)) return; - if(strstr(shll, "python")) { + if(strstr(shll, "python") + ||strstr(shll, "perl")) { PIPESCRIPT_flag=1; } if (write_C(file, argv)) From 729b1bdce0d940623b847fceec0abb89b6432f94 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 22:32:03 +0200 Subject: [PATCH 61/83] Add shell name and option to test temporary path --- test/ttest.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/ttest.sh b/test/ttest.sh index 653cf21..b5a5fc7 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -19,7 +19,8 @@ SKIP=",${SKIP},ash," echo echo "== Running tests ... (Skip expression: $SKIP)" for shell in "${shells[@]}"; do - if [ "${SKIP#*,"${shell##*/}",}" != "$SKIP" ] ; then + BASESHELL=${shell##*/} + if [ "${SKIP#*,"${BASESHELL}",}" != "$SKIP" ] ; then echo "====================================================" echo -e "=== $shell :SKIPPED" echo "====================================================" @@ -34,9 +35,9 @@ for shell in "${shells[@]}"; do continue fi for opt in "${check_opts[@]}"; do - tmpd=$(mktemp -d /tmp/shc.XXX.tst) + tmpd=$(mktemp -d "/tmp/shc.${BASESHELL}${opt}.XXX.tst") tmpf="$tmpd/test.$(basename "$shell")" - tmpa="$tmpd/a.out" + tmpa="$tmpd/a.out.${BASESHELL}$opt" tmpl="$tmpd/a.log" out="" expected=${shell}': Hello World sn:'${tmpa}' fp:first sp:second' From 52a17fca3394b918e63f412d80b851a0612718f0 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 22:32:03 +0200 Subject: [PATCH 62/83] Add shell name and option to test temporary path --- test/ttest.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/ttest.sh b/test/ttest.sh index 653cf21..b5a5fc7 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -19,7 +19,8 @@ SKIP=",${SKIP},ash," echo echo "== Running tests ... (Skip expression: $SKIP)" for shell in "${shells[@]}"; do - if [ "${SKIP#*,"${shell##*/}",}" != "$SKIP" ] ; then + BASESHELL=${shell##*/} + if [ "${SKIP#*,"${BASESHELL}",}" != "$SKIP" ] ; then echo "====================================================" echo -e "=== $shell :SKIPPED" echo "====================================================" @@ -34,9 +35,9 @@ for shell in "${shells[@]}"; do continue fi for opt in "${check_opts[@]}"; do - tmpd=$(mktemp -d /tmp/shc.XXX.tst) + tmpd=$(mktemp -d "/tmp/shc.${BASESHELL}${opt}.XXX.tst") tmpf="$tmpd/test.$(basename "$shell")" - tmpa="$tmpd/a.out" + tmpa="$tmpd/a.out.${BASESHELL}$opt" tmpl="$tmpd/a.log" out="" expected=${shell}': Hello World sn:'${tmpa}' fp:first sp:second' From accb0b81abc682e257bfbd593a5c4256f6d62a66 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 22:39:05 +0200 Subject: [PATCH 63/83] Add timeout value to ci run --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34f309d..da91260 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,8 @@ name: CI on: [push, pull_request] jobs: + # Normally runs in less than 50 seconds, but could stall because of test + timeout-minutes: 3 build: runs-on: ubuntu-24.04 From 376a71204425c136b0ad6067d126a08627eb25a0 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 22:39:05 +0200 Subject: [PATCH 64/83] Add timeout value to ci run --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d23c886..d362f71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,8 @@ name: CI on: [push, pull_request] jobs: + # Normally runs in less than 50 seconds, but could stall because of test + timeout-minutes: 3 build: runs-on: ubuntu-24.04 From e94567b005ab661f49f4587010c64785719974d8 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 22:45:38 +0200 Subject: [PATCH 65/83] Fix timeout syntax & rename job --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da91260..5eed2ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,9 +3,9 @@ name: CI on: [push, pull_request] jobs: - # Normally runs in less than 50 seconds, but could stall because of test - timeout-minutes: 3 - build: + build-and-test: + # Normally runs in less than 50 seconds, but could stall because of test + timeout-minutes: 3 runs-on: ubuntu-24.04 steps: From 2d7abab2d531505d2b5ba47f2a6e44b0646c737d Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 17 Aug 2024 23:30:45 +0200 Subject: [PATCH 66/83] Extend tests with arguments with spaces and quotes, and fix tcsh and csh for that --- src/Makefile.in | 24 ++++++++++++++++-------- src/shc.c | 4 ++-- test/ttest.sh | 10 ++++++---- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index 75462ab..3a4f1a5 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -86,6 +86,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ bin_PROGRAMS = shc$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -154,8 +156,6 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -168,17 +168,17 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -214,14 +214,22 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ +build = @build@ build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +host = @host@ host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ @@ -237,6 +245,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -405,7 +414,6 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff --git a/src/shc.c b/src/shc.c index 3b1f000..2b8d625 100644 --- a/src/shc.c +++ b/src/shc.c @@ -1069,8 +1069,8 @@ struct { { "ksh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* OK on Solaris, AIX and Linux (THX ) */ { "tsh", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX */ { "ash", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* Linux */ - { "csh", "-c", "-b", "exec '%s' $argv", "source '%s'" }, /* AIX: No file for $0 */ - { "tcsh", "-c", "-b", "exec '%s' $argv", "source '%s'" }, + { "csh", "-c", "-b", "exec '%s' $argv:q", "source '%s'" }, /* AIX: No file for $0 */ + { "tcsh", "-c", "-b", "exec '%s' $argv:q", "source '%s'" }, { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];%.0s exec(open('%s').read())" }, { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, diff --git a/test/ttest.sh b/test/ttest.sh index b5a5fc7..fd767a9 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -40,7 +40,9 @@ for shell in "${shells[@]}"; do tmpa="$tmpd/a.out.${BASESHELL}$opt" tmpl="$tmpd/a.log" out="" - expected=${shell}': Hello World sn:'${tmpa}' fp:first sp:second' + firstarg='first quote" and space' + secondarg="secondWithSingleQuote'" + expected=${shell}': Hello World sn:'"${tmpa}"' fp:'"${firstarg}"' sp:'"${secondarg}" { echo '#!'"$shell" if [ "${shell#*/pyth}" != "$shell" ] ; then @@ -55,7 +57,7 @@ for shell in "${shells[@]}"; do elif [ "${shell#*/csh}" != "$shell" ] ; then # csh - can not forge $0 echo 'echo "'"${shell}":' Hello World fp:$1 sp:$2"' - expected=${shell}': Hello World fp:first sp:second' + expected=${shell}': Hello World fp:'"${firstarg}"' sp:'"${secondarg}" else echo 'echo "'"${shell}":' Hello World sn:$0 fp:$1 sp:$2"' fi @@ -66,11 +68,11 @@ for shell in "${shells[@]}"; do if [ "$opt" = "-D" ] ; then # Hide debug output - out=$("$tmpa" first second 2>/dev/null) + out=$("$tmpa" "$firstarg" "$secondarg" 2>/dev/null) # TODO: compare dbg output # outdbg=$("$tmpa" first second 2>1) else - out=$("$tmpa" first second 2>&1) + out=$("$tmpa" "$firstarg" "$secondarg" 2>&1) fi if [[ "$out" = "$expected" ]]; then echo "====================================================" From 64c7824685f49c48002ebfeee1865f933fc861c1 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Sun, 18 Aug 2024 02:02:18 +0200 Subject: [PATCH 67/83] fix sourcing of binary for *csh --- src/shc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shc.c b/src/shc.c index 2b8d625..e637206 100644 --- a/src/shc.c +++ b/src/shc.c @@ -1069,8 +1069,8 @@ struct { { "ksh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* OK on Solaris, AIX and Linux (THX ) */ { "tsh", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX */ { "ash", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* Linux */ - { "csh", "-c", "-b", "exec '%s' $argv:q", "source '%s'" }, /* AIX: No file for $0 */ - { "tcsh", "-c", "-b", "exec '%s' $argv:q", "source '%s'" }, + { "csh", "-c", "-b", "exec '%s' $argv:q", "source %.0s'%s'" }, /* AIX: No file for $0 */ + { "tcsh", "-c", "-b", "exec '%s' $argv:q", "source %.0s'%s'" }, { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];%.0s exec(open('%s').read())" }, { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, From de0a223fba5b4539fe9c9602f17f41240be54ad3 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 18 Aug 2024 06:27:51 +0200 Subject: [PATCH 68/83] Solve $0 for zsh when using pipe --- src/shc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shc.c b/src/shc.c index e637206..5ad197a 100644 --- a/src/shc.c +++ b/src/shc.c @@ -1059,11 +1059,11 @@ struct { char * pfmt; } shellsDB[] = { { "perl", "-e", "--", "exec('%s',@ARGV);", "$0='%s';open(F,'%s');@SHCS=;close(F);eval(join('',@SHCS));" }, - { "rc", "-c", "", "builtin exec %s $*", "" }, + { "rc", "-c", "", "builtin exec %s $*", ". %.0s'%s' $*" }, { "sh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* IRIX_nvi */ { "dash", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, { "bash", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, - { "zsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, + { "zsh", "-c", "", "exec '%s' \"$@\"", "setopt posix_argzero ; . %.0s'%s'" }, { "bsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX_nvi */ { "Rsh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* AIX_nvi */ { "ksh", "-c", "", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* OK on Solaris, AIX and Linux (THX ) */ From c649a87fd22c92ccd90f29c6cb4f2d6f96f87500 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 18 Aug 2024 06:36:05 +0200 Subject: [PATCH 69/83] Adjust test to not require forged $0 for rc and the pipe option --- test/ttest.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/ttest.sh b/test/ttest.sh index fd767a9..84a5fd9 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -1,6 +1,7 @@ #!/bin/bash # shellcheck disable=2016,2028 shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc' '/usr/bin/python' '/usr/bin/python2' '/usr/bin/python3' '/usr/bin/perl') +shells=('/bin/zsh') ## Install: sudo apt install dash bash ksh zsh tcsh csh rc check_opts=('' '-r' '-v' '-D' '-S' '-P') @@ -20,6 +21,8 @@ echo echo "== Running tests ... (Skip expression: $SKIP)" for shell in "${shells[@]}"; do BASESHELL=${shell##*/} + echo "'$BASESHELL'" + [ "$BASESHELL" = "rc" ] && echo "*******************************************" if [ "${SKIP#*,"${BASESHELL}",}" != "$SKIP" ] ; then echo "====================================================" echo -e "=== $shell :SKIPPED" @@ -40,17 +43,22 @@ for shell in "${shells[@]}"; do tmpa="$tmpd/a.out.${BASESHELL}$opt" tmpl="$tmpd/a.log" out="" - firstarg='first quote" and space' - secondarg="secondWithSingleQuote'" + firstarg='first quote" and space' + secondarg="secondWithSingleQuote'" expected=${shell}': Hello World sn:'"${tmpa}"' fp:'"${firstarg}"' sp:'"${secondarg}" { echo '#!'"$shell" if [ "${shell#*/pyth}" != "$shell" ] ; then # Python echo 'import sys; sys.stdout.write(("'"${shell}"': Hello World sn:%s fp:%s sp:%s" % (sys.argv[0],sys.argv[1],sys.argv[2]))+"\n")' - elif [ "${shell#*/rc}" != "$shell" ] ; then + elif [ "$BASESHELL" = "rc" ] ; then # rc - echo 'echo '"${shell}"': Hello World sn:$0 fp:$1 sp:$2' + if [ "$opt" != "-P" ] ; then + echo 'echo '"${shell}"': Hello World sn:$0 fp:$1 sp:$2' + else + echo 'echo '"${shell}"': Hello World fp:$1 sp:$2' + expected=${shell}': Hello World fp:'"${firstarg}"' sp:'"${secondarg}" + fi elif [ "${shell#*/perl}" != "$shell" ] ; then # perl echo 'print "'"${shell}"': Hello World sn:$0 fp:$ARGV[0] sp:$ARGV[1]";' From 91ec8f9ad7fbb86349667d2286cf9503b25cb2d1 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Sun, 18 Aug 2024 12:19:58 +0200 Subject: [PATCH 70/83] fix minor oversight in shell list --- INSTALL | 6 +- Makefile.in | 47 +- aclocal.m4 | 79 +- config/compile | 6 +- config/depcomp | 2 +- config/install-sh | 161 ++- config/missing | 2 +- configure | 3476 ++++++++++++++++++++++++--------------------- configure.ac | 5 +- test/ttest.sh | 1 - 10 files changed, 2038 insertions(+), 1747 deletions(-) diff --git a/INSTALL b/INSTALL index 8865734..e82fd21 100644 --- a/INSTALL +++ b/INSTALL @@ -1,8 +1,8 @@ Installation Instructions ************************* - Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software -Foundation, Inc. + Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free +Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -225,7 +225,7 @@ order to use an ANSI C compiler: and if that doesn't work, install pre-built binaries of GCC for HP-UX. - HP-UX 'make' updates targets which have the same time stamps as their + HP-UX 'make' updates targets which have the same timestamps as their prerequisites, which makes it generally unusable when shipped generated files such as 'configure' are involved. Use GNU 'make' instead. diff --git a/Makefile.in b/Makefile.in index 5a6b6ef..b3721bb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -85,6 +85,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac @@ -180,15 +182,14 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \ - $(top_srcdir)/config/compile $(top_srcdir)/config/install-sh \ - $(top_srcdir)/config/missing AUTHORS COPYING ChangeLog INSTALL \ - NEWS README config/compile config/depcomp config/install-sh \ - config/missing + $(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \ + $(top_srcdir)/config/config.sub \ + $(top_srcdir)/config/install-sh $(top_srcdir)/config/missing \ + AUTHORS COPYING ChangeLog INSTALL NEWS README config/compile \ + config/config.guess config/config.sub config/depcomp \ + config/install-sh config/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -227,6 +228,8 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -241,17 +244,17 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -287,14 +290,22 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ +build = @build@ build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +host = @host@ host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ @@ -310,6 +321,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -508,7 +520,6 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -592,6 +603,10 @@ dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -634,6 +649,8 @@ distcheck: dist eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -649,7 +666,7 @@ distcheck: dist $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -815,7 +832,7 @@ uninstall-man: uninstall-man1 am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-generic distclean-tags \ + dist-zstd distcheck distclean distclean-generic distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ diff --git a/aclocal.m4 b/aclocal.m4 index 8c6b78f..2154e6d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,13 +14,13 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.1], [], +m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.1])dnl +[AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -371,7 +371,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi @@ -398,7 +400,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -426,6 +428,10 @@ m4_defn([AC_PROG_CC]) # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -462,7 +468,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl @@ -514,6 +520,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This @@ -595,7 +615,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -616,7 +636,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -637,7 +657,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -680,7 +700,7 @@ AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -701,12 +721,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -719,7 +734,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -748,7 +763,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -795,7 +810,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -814,7 +829,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -895,7 +910,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -955,7 +970,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -983,7 +998,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1002,7 +1017,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2018 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/config/compile b/config/compile index 99e5052..df363c8 100755 --- a/config/compile +++ b/config/compile @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) diff --git a/config/depcomp b/config/depcomp index 65cbf70..715e343 100755 --- a/config/depcomp +++ b/config/depcomp @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/config/install-sh b/config/install-sh index 8175c64..ec298b5 100755 --- a/config/install-sh +++ b/config/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2018-03-11.20; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ posix_mkdir= # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ Options: --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ while test $# -ne 0; do -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ do dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -301,22 +325,6 @@ do if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -326,52 +334,49 @@ do fi posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # Note that $RANDOM variable is not portable (e.g. dash); Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p' feature. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; esac if @@ -382,7 +387,7 @@ do then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. @@ -411,7 +416,7 @@ do prefixes= else if $posix_mkdir; then - (umask=$mkdir_umask && + (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 @@ -451,7 +456,18 @@ do trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -477,6 +493,13 @@ do then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -491,9 +514,9 @@ do # file should still install successfully. { test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || + $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 diff --git a/config/missing b/config/missing index 625aeb1..1fe1611 100755 --- a/config/missing +++ b/config/missing @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify diff --git a/configure b/configure index 6b60fa7..11dcba6 100755 --- a/configure +++ b/configure @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for shc 4.0.3. +# Generated by GNU Autoconf 2.71 for shc 4.0.3. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,42 +169,52 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -230,14 +222,21 @@ fi esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -255,18 +254,19 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: http://github.com/neurobin/shc/issues about your $0: system, including any error possibly output before this $0: message. Then install a modern shell, or manually run @@ -294,6 +294,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -311,6 +312,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -325,7 +334,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -334,7 +343,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -373,12 +382,13 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -390,18 +400,27 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -413,9 +432,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -442,7 +461,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -486,7 +505,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -500,6 +519,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -513,6 +536,13 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -588,49 +618,49 @@ PACKAGE_URL='' ac_unique_file="src/shc.c" # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" -ac_header_list= -ac_func_list= +ac_header_c_list= +ac_func_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS -EGREP -GREP -CPP +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -651,6 +681,9 @@ AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +CSCOPE +ETAGS +CTAGS am__untar am__tar AMTAR @@ -693,6 +726,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -726,8 +760,7 @@ CC CFLAGS LDFLAGS LIBS -CPPFLAGS -CPP' +CPPFLAGS' # Initialize some variables set by options. @@ -766,6 +799,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -795,8 +829,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -837,9 +869,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -863,9 +895,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1018,6 +1050,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1067,9 +1108,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1083,9 +1124,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1129,9 +1170,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1147,7 +1188,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1155,7 +1196,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1211,7 +1252,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1308,6 +1349,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1329,6 +1371,10 @@ Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi @@ -1357,7 +1403,6 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1378,9 +1423,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1408,7 +1453,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1416,7 +1462,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1426,9 +1472,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF shc configure 4.0.3 -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1445,14 +1491,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1460,14 +1506,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1477,176 +1524,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------------------------- ## -## Report this to http://github.com/neurobin/shc/issues ## -## ---------------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1654,26 +1531,28 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1685,16 +1564,17 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +printf %s "checking for $2.$3... " >&6; } +if eval test \${$4+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main () +main (void) { static $2 ac_aggr; if (ac_aggr.$3) @@ -1703,14 +1583,15 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$4=yes" -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main () +main (void) { static $2 ac_aggr; if (sizeof ac_aggr.$3) @@ -1719,36 +1600,80 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$4=yes" -else +else $as_nop eval "$4=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1756,17 +1681,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1787,11 +1713,12 @@ fi ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -1799,16 +1726,9 @@ else #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -1826,35 +1746,56 @@ choke me #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by shc $as_me 4.0.3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -1887,8 +1828,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -1923,7 +1868,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -1958,11 +1903,13 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -1973,8 +1920,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -1998,7 +1945,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2006,14 +1953,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2021,15 +1968,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2037,8 +1984,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2052,63 +1999,48 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2118,64 +2050,478 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -as_fn_append ac_header_list " sys/time.h" -as_fn_append ac_header_list " unistd.h" -as_fn_append ac_func_list " alarm" -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H" +as_fn_append ac_func_c_list " alarm HAVE_ALARM" + +# Auxiliary files required by this configure script. +ac_aux_files="config.guess config.sub compile missing install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/config" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -2185,11 +2531,12 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2202,34 +2549,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_aux_dir= -for ac_dir in config "$srcdir"/config; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - #prefix="/usr" @@ -2237,7 +2556,9 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.16' -# Find a good install program. We prefer a C program (faster), + + + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install @@ -2251,20 +2572,25 @@ am__api_version='1.16' # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -2274,13 +2600,13 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -2288,12 +2614,12 @@ case $as_dir/ in #(( echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -2309,7 +2635,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test "${ac_cv_path_install+set}" = set; then + if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -2319,8 +2645,8 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -2330,8 +2656,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -2385,8 +2711,8 @@ else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= @@ -2405,26 +2731,23 @@ test "$program_suffix" != NONE && # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then @@ -2444,11 +2767,12 @@ if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -2456,11 +2780,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2471,11 +2799,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2484,11 +2812,12 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -2496,11 +2825,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2511,11 +2844,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -2523,8 +2856,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -2536,25 +2869,31 @@ fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done @@ -2565,7 +2904,7 @@ IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then + if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a @@ -2575,18 +2914,19 @@ fi MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -2594,11 +2934,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2609,24 +2953,25 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -2642,12 +2987,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2661,7 +3006,8 @@ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -2671,12 +3017,13 @@ case $enable_silent_rules in # ((( *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -2688,8 +3035,8 @@ else am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -2724,14 +3071,10 @@ fi VERSION='4.0.3' -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. @@ -2771,6 +3114,20 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -2816,6 +3173,15 @@ fi # Checks for programs. + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2824,11 +3190,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2836,11 +3203,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2851,11 +3222,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2864,11 +3235,12 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2876,11 +3248,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2891,11 +3267,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -2903,8 +3279,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2917,11 +3293,12 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2929,11 +3306,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2944,11 +3325,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2957,11 +3338,12 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2970,15 +3352,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2994,18 +3380,18 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3016,11 +3402,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3028,11 +3415,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3043,11 +3434,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3060,11 +3451,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3072,11 +3464,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3087,11 +3483,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3103,34 +3499,138 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi +else + CC="$ac_cv_prog_CC" fi fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3140,7 +3640,7 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -3148,7 +3648,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3160,9 +3660,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -3183,11 +3683,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -3204,7 +3705,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -3220,44 +3721,46 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -3271,15 +3774,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -3288,7 +3791,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -3300,8 +3803,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -3309,10 +3812,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -3320,39 +3823,40 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3366,11 +3870,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -3379,31 +3884,32 @@ $as_echo "$ac_try_echo"; } >&5 break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -3413,29 +3919,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -3444,57 +3954,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -3509,94 +4022,144 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -3605,21 +4168,23 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_ext=c + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3647,8 +4212,8 @@ _ACEOF rm -f core conftest* unset am_i fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. @@ -3667,8 +4232,8 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out @@ -3704,11 +4269,12 @@ esac fi done rm -f confinc.* confmf.* -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -$as_echo "${_am_result}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : +if test ${enable_dependency_tracking+y} +then : enableval=$enable_dependency_tracking; fi @@ -3729,11 +4295,12 @@ fi depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -3805,525 +4372,240 @@ else # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - - -# Checks for libraries. - -# Checks for header files. - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi + cd .. + rm -rf conftest.dir else - ac_cv_path_GREP=$GREP + am_cv_CC_dependencies_compiler_type=none fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' else - ac_cv_path_EGREP=$EGREP + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -int -main () -{ +# Checks for libraries. - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Checks for header files. -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : -else - ac_cv_header_stdc=no -fi -rm -f conftest* -fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : -else - ac_cv_header_stdc=no -fi -rm -f conftest* -fi -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext fi +ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" +if test "x$ac_cv_header_fcntl_h" = xyes +then : + printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes +then : + printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes +then : + printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h fi - -done - - -for ac_header in fcntl.h stdlib.h string.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" +if test "x$ac_cv_header_unistd_h" = xyes +then : + printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h fi -done - # Checks for typedefs, structures, and compiler characteristics. ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_rdev" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_RDEV 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_RDEV 1" >>confdefs.h fi # Checks for library functions. -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi -done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if ${ac_cv_func_malloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_malloc_0_nonnull=no -else + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +printf %s "checking for GNU libc compatible malloc... " >&6; } +if test ${ac_cv_func_malloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_malloc_0_nonnull=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_malloc_0_nonnull=no ;; + esac +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif +#include int -main () +main (void) { -return ! malloc (0); +void *p = malloc (0); + int result = !p; + free (p); + return result; ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_malloc_0_nonnull=yes -else +else $as_nop ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -4331,14 +4613,15 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes +then : -$as_echo "#define HAVE_MALLOC 1" >>confdefs.h +printf "%s\n" "#define HAVE_MALLOC 1" >>confdefs.h -else - $as_echo "#define HAVE_MALLOC 0" >>confdefs.h +else $as_nop + printf "%s\n" "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; @@ -4347,106 +4630,43 @@ else esac -$as_echo "#define malloc rpl_malloc" >>confdefs.h - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - -fi - - - - - for ac_header in $ac_header_list -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +printf "%s\n" "#define malloc rpl_malloc" >>confdefs.h fi -done - - - - - - - for ac_func in $ac_func_list -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi +ac_func= +for ac_item in $ac_func_c_list +do + if test $ac_func; then + ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func + if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then + echo "#define $ac_item 1" >> confdefs.h + fi + ac_func= + else + ac_func=$ac_item + fi done - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mktime" >&5 -$as_echo_n "checking for working mktime... " >&6; } -if ${ac_cv_func_working_mktime+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working mktime" >&5 +printf %s "checking for working mktime... " >&6; } +if test ${ac_cv_func_working_mktime+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_func_working_mktime=no -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Test program from Paul Eggert and Tony Leneis. */ -#ifdef TIME_WITH_SYS_TIME +#include +#ifdef HAVE_SYS_TIME_H # include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif #endif #include @@ -4585,7 +4805,7 @@ year_2050_test () } int -main () +main (void) { time_t t, delta; int i, j; @@ -4629,9 +4849,10 @@ main () return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_working_mktime=yes -else +else $as_nop ac_cv_func_working_mktime=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -4639,8 +4860,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_working_mktime" >&5 -$as_echo "$ac_cv_func_working_mktime" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_working_mktime" >&5 +printf "%s\n" "$ac_cv_func_working_mktime" >&6; } if test $ac_cv_func_working_mktime = no; then case " $LIBOBJS " in *" mktime.$ac_objext "* ) ;; @@ -4650,45 +4871,42 @@ esac fi -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 -$as_echo_n "checking for GNU libc compatible realloc... " >&6; } -if ${ac_cv_func_realloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_realloc_0_nonnull=no -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 +printf %s "checking for GNU libc compatible realloc... " >&6; } +if test ${ac_cv_func_realloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_realloc_0_nonnull=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_realloc_0_nonnull=no ;; + esac +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *realloc (); -#endif +#include int -main () +main (void) { -return ! realloc (0, 0); +void *p = realloc (0, 0); + int result = !p; + free (p); + return result; ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_realloc_0_nonnull=yes -else +else $as_nop ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -4696,14 +4914,15 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } -if test $ac_cv_func_realloc_0_nonnull = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_realloc_0_nonnull" >&6; } +if test $ac_cv_func_realloc_0_nonnull = yes +then : -$as_echo "#define HAVE_REALLOC 1" >>confdefs.h +printf "%s\n" "#define HAVE_REALLOC 1" >>confdefs.h -else - $as_echo "#define HAVE_REALLOC 0" >>confdefs.h +else $as_nop + printf "%s\n" "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; @@ -4712,22 +4931,41 @@ else esac -$as_echo "#define realloc rpl_realloc" >>confdefs.h +printf "%s\n" "#define realloc rpl_realloc" >>confdefs.h fi -for ac_func in memset putenv strchr strdup strrchr -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" +if test "x$ac_cv_func_memset" = xyes +then : + printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "putenv" "ac_cv_func_putenv" +if test "x$ac_cv_func_putenv" = xyes +then : + printf "%s\n" "#define HAVE_PUTENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" +if test "x$ac_cv_func_strchr" = xyes +then : + printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" +if test "x$ac_cv_func_strdup" = xyes +then : + printf "%s\n" "#define HAVE_STRDUP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strrchr" "ac_cv_func_strrchr" +if test "x$ac_cv_func_strrchr" = xyes +then : + printf "%s\n" "#define HAVE_STRRCHR 1" >>confdefs.h fi -done @@ -4760,8 +4998,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -4791,15 +5029,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -4813,8 +5051,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -4867,7 +5105,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -4878,14 +5116,14 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -4907,8 +5145,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -4931,14 +5169,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -4948,46 +5188,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -4996,13 +5236,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -5011,8 +5244,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -5024,30 +5261,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -5060,13 +5277,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -5093,18 +5311,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -5116,12 +5336,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -5152,7 +5373,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -5174,6 +5395,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -5187,6 +5412,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -5228,7 +5459,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -5237,7 +5468,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5300,7 +5531,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by shc $as_me 4.0.3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5353,14 +5584,16 @@ $config_commands Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ shc config.status 4.0.3 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -5400,21 +5633,21 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -5442,7 +5675,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -5456,7 +5689,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -5488,8 +5721,8 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -5717,7 +5950,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -5725,17 +5958,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -5752,7 +5985,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5776,9 +6009,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -5840,8 +6073,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -5885,9 +6118,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -5899,8 +6132,8 @@ which seems to be undefined. Please make sure it is defined" >&2;} ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -5926,7 +6159,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -5938,7 +6171,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5960,7 +6193,7 @@ $as_echo X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -5985,10 +6218,12 @@ $as_echo X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -6034,7 +6269,8 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + diff --git a/configure.ac b/configure.ac index 5caa65d..720be34 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([shc], [4.0.3], [http://github.com/neurobin/shc/issues]) +AC_INIT([shc],[4.0.3],[http://github.com/neurobin/shc/issues]) AC_CONFIG_AUX_DIR(config) #prefix="/usr" AC_CONFIG_SRCDIR([src/shc.c]) @@ -25,4 +25,5 @@ AC_FUNC_REALLOC AC_CHECK_FUNCS([memset putenv strchr strdup strrchr]) -AC_OUTPUT(Makefile src/Makefile) +AC_CONFIG_FILES([Makefile src/Makefile]) +AC_OUTPUT diff --git a/test/ttest.sh b/test/ttest.sh index 84a5fd9..3bb4a61 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -1,7 +1,6 @@ #!/bin/bash # shellcheck disable=2016,2028 shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc' '/usr/bin/python' '/usr/bin/python2' '/usr/bin/python3' '/usr/bin/perl') -shells=('/bin/zsh') ## Install: sudo apt install dash bash ksh zsh tcsh csh rc check_opts=('' '-r' '-v' '-D' '-S' '-P') From e9ddf904a81037f343849fd7089de1f81aa46ba9 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 18 Aug 2024 14:24:20 +0200 Subject: [PATCH 71/83] Remove temporary output for debug from ttest.sh --- test/ttest.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/ttest.sh b/test/ttest.sh index 3bb4a61..0bf7fae 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -20,8 +20,6 @@ echo echo "== Running tests ... (Skip expression: $SKIP)" for shell in "${shells[@]}"; do BASESHELL=${shell##*/} - echo "'$BASESHELL'" - [ "$BASESHELL" = "rc" ] && echo "*******************************************" if [ "${SKIP#*,"${BASESHELL}",}" != "$SKIP" ] ; then echo "====================================================" echo -e "=== $shell :SKIPPED" From d7130016c33e0cc0c78f5e68241566c6972577ca Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 18 Aug 2024 12:26:24 +0000 Subject: [PATCH 72/83] ci: Github Action Generate Files --- INSTALL | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 INSTALL diff --git a/INSTALL b/INSTALL old mode 100644 new mode 100755 From 17b89beace7965cd81c08f80993efe577149cbd1 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 18 Aug 2024 14:51:55 +0200 Subject: [PATCH 73/83] Add dependabot configuration --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From 521f8d465aece6a11b868c0b868a38022b97ff40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 18 Aug 2024 12:59:34 +0000 Subject: [PATCH 74/83] Bump dorny/paths-filter from 2 to 3 Bumps [dorny/paths-filter](https://github.com/dorny/paths-filter) from 2 to 3. - [Release notes](https://github.com/dorny/paths-filter/releases) - [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md) - [Commits](https://github.com/dorny/paths-filter/compare/v2...v3) --- updated-dependencies: - dependency-name: dorny/paths-filter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/generate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index bf65d7e..390a70d 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - - uses: dorny/paths-filter@v2 + - uses: dorny/paths-filter@v3 id: changes with: filters: | From be6edbedae704cb154426082f44877271fefe194 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 18 Aug 2024 14:57:35 +0200 Subject: [PATCH 75/83] Fix executable flag on generated files --- .github/workflows/generate.yml | 2 ++ INSTALL | 0 2 files changed, 2 insertions(+) mode change 100755 => 100644 INSTALL diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index bf65d7e..3f99c4f 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -28,6 +28,8 @@ jobs: args: -s man.md -t html -o man.html - run: |- ./autogen.sh + # Correct executable flag on generated files + chmod -x INSTALL if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.autotools == 'true' }} - name: Commit changes if: ${{ github.event_name == 'workflow_dispath' || steps.changes.outputs.man == 'true' || steps.changes.outputs.autotools }} diff --git a/INSTALL b/INSTALL old mode 100755 new mode 100644 From cf91f8fb66c38d22ea94d530e847c047bce3a031 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Sun, 18 Aug 2024 17:18:28 +0200 Subject: [PATCH 76/83] make forging of argv0 opt-out with -p, force -P for *csh --- src/shc.c | 11 ++++++----- test/ttest.sh | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/shc.c b/src/shc.c index 5ad197a..8a61351 100644 --- a/src/shc.c +++ b/src/shc.c @@ -87,7 +87,7 @@ static const char * help[] = { " -H Hardening : extra security protection [no]", " Require bourne shell (sh) and parameters are not supported", " -P Submit script as a pipe [no]", -" -0 Fix handling of argv0 [no]", +" -p Don't forge argv0 with -P [no]", " -C Display license and exit", " -A Display abstract and exit", " -B Compile for busybox", @@ -157,7 +157,7 @@ static const char PIPESCRIPT_line[] = static int PIPESCRIPT_flag = 0; static const char FIXARGV0_line[] = "#define FIXARGV0 %d /* Define as 1 fix handling of ARGV0 */\n"; -static int FIXARGV0_flag = 0; +static int FIXARGV0_flag = 1; static const char * RTC[] = { "", @@ -885,8 +885,8 @@ static int parse_an_arg(int argc, char * argv[]) case 'P': PIPESCRIPT_flag = 1; break; - case '0': - FIXARGV0_flag = 1; + case 'p': + FIXARGV0_flag = 0; break; case 'H': HARDENING_flag = 1; @@ -1422,7 +1422,8 @@ void do_all(int argc, char * argv[]) if (eval_shell(text)) return; if(strstr(shll, "python") - ||strstr(shll, "perl")) { + ||strstr(shll, "perl") + ||strstr(shll, "csh")) { PIPESCRIPT_flag=1; } if (write_C(file, argv)) diff --git a/test/ttest.sh b/test/ttest.sh index 0bf7fae..0cc147e 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -68,7 +68,7 @@ for shell in "${shells[@]}"; do fi } > "$tmpf" # shellcheck disable=SC2086 - "$shc" -0 $opt -f "$tmpf" -o "$tmpa" + "$shc" $opt -f "$tmpf" -o "$tmpa" # ls -la "$tmpa" if [ "$opt" = "-D" ] ; then From db31ddd20a826c3ec2734b6fe41a4c001da9dd70 Mon Sep 17 00:00:00 2001 From: Fabio Brugnara Date: Mon, 19 Aug 2024 09:45:34 +0200 Subject: [PATCH 77/83] Change meaning of options -P -p. Added set of __file__ to python preamble --- src/shc.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/shc.c b/src/shc.c index 8a61351..cc29914 100644 --- a/src/shc.c +++ b/src/shc.c @@ -86,8 +86,8 @@ static const char * help[] = { " -U Make binary untraceable [no]", " -H Hardening : extra security protection [no]", " Require bourne shell (sh) and parameters are not supported", -" -P Submit script as a pipe [no]", -" -p Don't forge argv0 with -P [no]", +" -P Submit script as a pipe, with argv forging [no]", +" -p Submit script as a pipe, without argv forging [no]", " -C Display license and exit", " -A Display abstract and exit", " -B Compile for busybox", @@ -818,7 +818,7 @@ static const char * RTC[] = { static int parse_an_arg(int argc, char * argv[]) { extern char * optarg; - const char * opts = "e:m:f:i:x:l:o:rvDSUHPCAB2h0"; + const char * opts = "e:m:f:i:x:l:o:rvDSUHPCAB2hp"; struct tm tmp[1]; time_t expdate; int cnt, l; @@ -884,8 +884,10 @@ static int parse_an_arg(int argc, char * argv[]) break; case 'P': PIPESCRIPT_flag = 1; + FIXARGV0_flag = 1; break; case 'p': + PIPESCRIPT_flag = 1; FIXARGV0_flag = 0; break; case 'H': @@ -1071,9 +1073,9 @@ struct { { "ash", "-c", "--", "exec '%s' \"$@\"", ". %.0s'%s'" }, /* Linux */ { "csh", "-c", "-b", "exec '%s' $argv:q", "source %.0s'%s'" }, /* AIX: No file for $0 */ { "tcsh", "-c", "-b", "exec '%s' $argv:q", "source %.0s'%s'" }, - { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];%.0s exec(open('%s').read())" }, - { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, - { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];'%.0s'; exec(open('%s').read())" }, + { "python", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];__file__='%s'; exec(open('%s').read())" }, + { "python2", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];__file__='%s';exec(open('%s').read())" }, + { "python3", "-c", "", "import os,sys;os.execv('%s',sys.argv[1:])", "import sys;sys.argv[0:1]=[];__file__='%s';exec(open('%s').read())" }, { NULL, NULL, NULL, NULL }, }; @@ -1425,6 +1427,7 @@ void do_all(int argc, char * argv[]) ||strstr(shll, "perl") ||strstr(shll, "csh")) { PIPESCRIPT_flag=1; + FIXARGV0_flag = 1; } if (write_C(file, argv)) return; From 95bcb63319bbb70c5122bcd1c15deb37c1d3f838 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 19 Aug 2024 12:45:18 +0200 Subject: [PATCH 78/83] Update Changelog --- ChangeLog | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9be5f6f..fbe5c01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,26 @@ CHANGES +LATEST Aug 19 2024 + + * Feat: Piping (`-P`, `-p`), with `$0` forging (big scripts, perl. python) @fabio-brugnara. + * Qual: Enhance tests (Check stderr, forging, tempdir, complex arguments), option SKIP (tests) @mdeweerd. + * Qual: Add Github CI flox (build, run tests with(out) sanitizer, generate files) @mdeweerd. + * Fix: Fix memory leaks in generated c-code @mdeweerd. + * Fix: Fix memory leaks in generation c-code @ashamedbit #165 + * Fix: Fix static code checks/implement recommendations (prevent leaks, overflows) @mdeweerd. + * Qual: Add static code checks, linting, code formatting @mdeweerd #162 #161 + * Doc: Improvements to the documentation @mdeweerd #163 #160 + * Doc: Add code block hinting for Ubuntu PPA install procedure lb803 #164 + * Feat: Remove `ash` dependency @dviererbe #167 + * Fix: Fix for script filenames with spaces/special characters @ergoucao #157. + * Feat: Option `-2` to use mmap2 @csersoft #132 + * Doc: Fix automatic hyperlinks by removing `<>` @learnpassword #148 + * Doc: Fix typo in usage @ghost #129 + * Fix: Fix strip in case of cross-compilation @embexus #125 + * Fix: Fix NULL-ptr dereference in shhl string @RKX1209 #83 + + Note: @GITHUB_USERNAME #neurobin/Github Pull Request + 4.0.3 Tue Nov 20 08:22:20 UTC 2018 * Enhance -H flag by intika (Hide commands arguments from ps and cmdline) From aedbebe965729e43c38807b34e42d2e349a0c78d Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 19 Aug 2024 14:41:20 +0200 Subject: [PATCH 79/83] Cleanup format of generated script --- src/shc.c | 397 +++++++++++++++++++++++++++--------------------------- 1 file changed, 198 insertions(+), 199 deletions(-) diff --git a/src/shc.c b/src/shc.c index 3fa2edc..19faa4b 100644 --- a/src/shc.c +++ b/src/shc.c @@ -55,31 +55,30 @@ static const char *abstract[] = { "Abstract:", "", " This tool generates a stripped binary executable version", - " of the script specified at command line.", + " of the SCRIPT specified at command line.", "", - " Binary version will be saved with a .x extension by default.", - " You can specify output file name too with [-o OUTFILE] option.", + " The generated binary defaults to SCRIPT.x by default.", + " Use [-o OUTFILE] to specifou a different output file name.", "", - " You can specify expiration date [-e] too, after which binary will", - " refuse to be executed, displaying \"[-m]\" instead.", + " An expiration date can be set with [-e DATE], the binary will", + " refuse execute after DATE, displaying \"[-m]\" instead.", "", - " You can compile whatever interpreted script, but valid [-i], [-x]", - " and [-l] options must be given.", + " Compile any interpreted script using [-i], [-x] and [-l] options.", "", 0 }; static const char usage[] = - "Usage: shc [-e date] [-m addr] [-i iopt] [-x cmd] [-l lopt] [-o outfile] [-rvDSUHPCAB2h] -f script"; + "Usage: shc [-e DATE] [-m MESSAGE] [-i IOPT] [-x CMD] [-l LOPT] [-o OUTFILE] [-rvDSUHPCAB2h] -f SCRIPT"; static const char *help[] = { "", - " -e %s Expiration date in dd/mm/yyyy format [none]", - " -m %s Message to display upon expiration [\"Please contact your provider\"]", - " -f %s File name of the script to compile", + " -e %s Expiration DATE in dd/mm/yyyy format [none]", + " -m %s MESSAGE to display upon expiration [\"Please contact your provider\"]", + " -f %s File name of the SCRIPT to compile", " -i %s Inline option for the shell interpreter i.e: -e", - " -x %s eXec command, as a printf format i.e: exec('%s',@ARGV);", - " -l %s Last shell option i.e: --", + " -x %s eXec command, in printf format i.e: \"exec('%s',@ARGV);\"", + " -l %s Last shell option i.e: \"--\"", " -o %s output filename", " -r Relax security. Make a redistributable binary", " -v Verbose compilation", @@ -87,13 +86,13 @@ static const char *help[] = { " -D Switch ON debug exec calls [OFF]", " -U Make binary untraceable [no]", " -H Hardening : extra security protection [no]", - " Require bourne shell (sh) and parameters are not supported", + " Requires bourne shell (sh), arguments not supported", " -P Submit script as a pipe, with argv forging [no]", " -p Submit script as a pipe, without argv forging [no]", - " -C Display license and exit", - " -A Display abstract and exit", " -B Compile for busybox", " -2 Use the system call mmap2", + " -C Display license and exit", + " -A Display abstract and exit", " -h Display help and exit", "", " Environment variables used:", @@ -127,7 +126,7 @@ static const char *help[] = { static char *file; static char *file2; static char date[21]; -static char *mail = "Please contact your provider jahidulhamid@yahoo.com"; +static char *mail = "Please contact your provider"; static char rlax[1]; static char *shll; static char *inlo; @@ -188,57 +187,61 @@ static const char *RTC[] = { "\"\",", "\"// copy argv to new location\",", "\"char **copyargs(int argc, char** argv){\",", - "\" char **newargv = malloc((argc+1)*sizeof(*argv));\",", - "\" char *from,*to;\",", - "\" int i,len;\",", + "\" char **newargv = malloc((argc+1)*sizeof(*argv));\",", + "\" char *from,*to;\",", + "\" int i,len;\",", "\"\",", - "\" for(i = 0; i 0) {\",", - "\" int i;\",", + "\" n = read(21, secret, sizeof(secret));\",", + "\" if (n > 0) {\",", + "\" int i;\",", "\"\",", - "\" if (secret[n - 1] == '\\\\n') secret[--n] = '\\\\0';\",", - "\" for (i = 1; i < argc; i++)\",", - "\" if (strcmp(argv[i], PLACEHOLDER) == 0)\",", - "\" argv[i] = secret;\",", - "\" }\",", + "\" if (secret[n - 1] == '\\\\n') { secret[--n] = '\\\\0'; }\",", + "\" for (i = 1; i < argc; i++) {\",", + "\" if (strcmp(argv[i], PLACEHOLDER) == 0) {\",", + "\" argv[i] = secret;\",", + "\" }\",", + "\" }\",", + "\" }\",", "\"\",", - "\" real_main = main;\",", + "\" real_main = main;\",", "\"\",", - "\" return real___libc_start_main(mymain, argc, argv, init, fini, rtld_fini, stack_end);\",", + "\" return real___libc_start_main(mymain, argc, argv, init, fini, rtld_fini, stack_end);\",", "\"}\",", "\"\",", "0};", @@ -263,10 +266,9 @@ static const char *RTC[] = { "static unsigned char stte[256], indx, jndx, kndx;", "", "/*", - " * Reset arc4 stte. ", + " * Reset arc4 stte.", " */", - "void stte_0(void)", - "{", + "void stte_0(void) {", " indx = jndx = kndx = 0;", " do {", " stte[indx] = indx;", @@ -274,10 +276,9 @@ static const char *RTC[] = { "}", "", "/*", - " * Set key. Can be used more than once. ", + " * Set key. Can be used more than once.", " */", - "void key(void * str, int len)", - "{", + "void key(void * str, int len) {", " unsigned char tmp, * ptr = (unsigned char *)str;", " while (len > 0) {", " do {", @@ -295,8 +296,7 @@ static const char *RTC[] = { "/*", " * Encrypt data.", " */", - "void arc4(void * str, int len)", - "{", + "void arc4(void * str, int len) {", " unsigned char tmp, * ptr = (unsigned char *)str;", " while (len > 0) {", " indx++;", @@ -347,7 +347,7 @@ static const char *RTC[] = { "struct sock_filter filter[] = {", " /* validate arch */", " BPF_STMT(BPF_LD+BPF_W+BPF_ABS, ArchField),", - " BPF_JUMP( BPF_JMP+BPF_JEQ+BPF_K, AUDIT_ARCH_X86_64, 1, 0),", + " BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, AUDIT_ARCH_X86_64, 1, 0),", " BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),", "", " /* load syscall */", @@ -388,14 +388,14 @@ static const char *RTC[] = { " FILE *fp;", " int line = 0;", "", - " if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}", - " for (line = 0; shc_x[line]; line++) fprintf(fp, \"%s\\n\", shc_x[line]);", - " fflush(fp);fclose(fp);", + " if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL) { exit(1); exit(1); }", + " for (line = 0; shc_x[line]; line++) { fprintf(fp, \"%s\\n\", shc_x[line]); }", + " fflush(fp); fclose(fp);", "}", "", "int make() {", " char * cc, * cflags, * ldflags;", - " char cmd[4096];", + " char cmd[4096];", "", " cc = getenv(\"CC\");", " if (!cc) cc = \"cc\";", @@ -406,72 +406,69 @@ static const char *RTC[] = { "}", "", "void arc4_hardrun(void * str, int len) {", - " //Decode locally", - " char tmp2[len];", - " char tmp3[len+1024];", - " memcpy(tmp2, str, len);", + " /* Decode locally */", + " char tmp2[len];", + " char tmp3[len+1024];", + " memcpy(tmp2, str, len);", "", " unsigned char tmp, * ptr = (unsigned char *)tmp2;", - " int lentmp = len;", - " int pid, status;", - "", - " shc_x_file();", - " if (make()) {exit(1);}", - " pid = fork();", - "", - " setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);", - "", - " if(pid==0) {", - "", - " //Start tracing to protect from dump & trace", - " if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {", - " kill(getpid(), SIGKILL);", - " _exit(1);", - " }", - "", - " //Decode Bash", - " while (len > 0) {", - " indx++;", - " tmp = stte[indx];", - " jndx += tmp;", - " stte[indx] = stte[jndx];", - " stte[jndx] = tmp;", - " tmp += stte[indx];", - " *ptr ^= stte[tmp];", - " ptr++;", - " len--;", - " }", - "", - " //Do the magic", - " snprintf(tmp3, sizeof(tmp3), \"%s %s\", \"'********' 21<<<\", tmp2);", - "", - " //Exec bash script //fork execl with 'sh -c'", - " system(tmp2);", - "", - " //Empty script variable", - " memcpy(tmp2, str, lentmp);", - "", - " //Clean temp", - " remove(\"/tmp/shc_x.so\");", - "", - " //Signal to detach ptrace", - " ptrace(PTRACE_DETACH, 0, 0, 0);", - " exit(0);", - " }", - " else {wait(&status);}", + " int lentmp = len;", + " int pid, status;", + "", + " shc_x_file();", + " if (make()) { exit(1); }", + " pid = fork();", + "", + " setenv(\"LD_PRELOAD\", \"/tmp/shc_x.so\", 1);", + "", + " if (pid == 0) {", + " /* Start tracing to protect from dump & trace */", + " if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {", + " kill(getpid(), SIGKILL);", + " _exit(1);", + " }", + "", + " /* Decode Bash */", + " while (len > 0) {", + " indx++;", + " tmp = stte[indx];", + " jndx += tmp;", + " stte[indx] = stte[jndx];", + " stte[jndx] = tmp;", + " tmp += stte[indx];", + " *ptr ^= stte[tmp];", + " ptr++;", + " len--;", + " }", + "", + " /* Do the magic */", + " snprintf(tmp3, sizeof(tmp3), \"%s %s\", \"'********' 21<<<\", tmp2);", + "", + " /* Exec bash script - fork execl with 'sh -c' */", + " system(tmp2);", + "", + " /* Empty script variable */", + " memcpy(tmp2, str, lentmp);", "", - " /* Seccomp Sandboxing - Start */", - " seccomp_hardening();", + " /* Clean temp */", + " remove(\"/tmp/shc_x.so\");", "", - " exit(0);", + " /* Signal to detach ptrace */", + " ptrace(PTRACE_DETACH, 0, 0, 0);", + " exit(0);", + " } else { wait(&status); }", + "", + " /* Seccomp Sandboxing - Start */", + " seccomp_hardening();", + "", + " exit(0);", "}", "#endif /* HARDENING */", "", "/*", " * Key with file invariants.", " */", - "int key_with_file(char * file)", - "{", + "int key_with_file(char * file) {", " struct stat statf[1];", " struct stat control[1];", "", @@ -493,31 +490,29 @@ static const char *RTC[] = { "}", "", "#if DEBUGEXEC", - "void debugexec(char * sh11, int argc, char ** argv)", - "{", + "void debugexec(char * sh11, int argc, char ** argv) {", " int i;", " fprintf(stderr, \"shll=%s\\n\", sh11 ? sh11 : \"\");", " fprintf(stderr, \"argc=%d\\n\", argc);", " if (!argv) {", " fprintf(stderr, \"argv=\\n\");", - " } else { ", - " for (i = 0; i <= argc ; i++)", + " } else {", + " for (i = 0; i <= argc ; i++) {", " fprintf(stderr, \"argv[%d]=%s\\n\", i, argv[i] ? argv[i] : \"\");", + " }", " }", "}", "#endif /* DEBUGEXEC */", "", - "void rmarg(char ** argv, char * arg)", - "{", - " for (; argv && *argv && *argv != arg; argv++);", + "void rmarg(char ** argv, char * arg) {", + " for (; argv && *argv && *argv != arg; argv++) {}", " for (; argv && *argv; argv++)", " *argv = argv[1];", "}", "", "void chkenv_end(void);", "", - "int chkenv(int argc)", - "{", + "int chkenv(int argc) {", " char buff[512];", " unsigned long mask, m;", " int l, a, c;", @@ -551,7 +546,7 @@ static const char *RTC[] = { " return -1;", "}", "", - "void chkenv_end(void){}", + "void chkenv_end(void) {}", "", "#if HARDENING", "", @@ -571,32 +566,31 @@ static const char *RTC[] = { "}", "", "void hardening() {", - " prctl(PR_SET_DUMPABLE, 0);", - " prctl(PR_SET_PTRACER, -1);", - "", - " int pid = getppid();", - " char name[256] = {0};", - " gets_process_name(pid, name);", - "", - " if ( (strcmp(name, \"bash\") != 0)", - " && (strcmp(name, \"/bin/bash\") != 0)", - " && (strcmp(name, \"sh\") != 0)", - " && (strcmp(name, \"/bin/sh\") != 0)", - " && (strcmp(name, \"sudo\") != 0)", - " && (strcmp(name, \"/bin/sudo\") != 0)", - " && (strcmp(name, \"/usr/bin/sudo\") != 0)", - " && (strcmp(name, \"gksudo\") != 0)", - " && (strcmp(name, \"/bin/gksudo\") != 0)", - " && (strcmp(name, \"/usr/bin/gksudo\") != 0)", - " && (strcmp(name, \"kdesu\") != 0)", - " && (strcmp(name, \"/bin/kdesu\") != 0)", - " && (strcmp(name, \"/usr/bin/kdesu\") != 0)", - " )", - " {", - " printf(\"Operation not permitted\\n\");", - " kill(getpid(), SIGKILL);", - " exit(1);", - " }", + " prctl(PR_SET_DUMPABLE, 0);", + " prctl(PR_SET_PTRACER, -1);", + "", + " int pid = getppid();", + " char name[256] = {0};", + " gets_process_name(pid, name);", + "", + " if ( (strcmp(name, \"bash\") != 0)", + " && (strcmp(name, \"/bin/bash\") != 0)", + " && (strcmp(name, \"sh\") != 0)", + " && (strcmp(name, \"/bin/sh\") != 0)", + " && (strcmp(name, \"sudo\") != 0)", + " && (strcmp(name, \"/bin/sudo\") != 0)", + " && (strcmp(name, \"/usr/bin/sudo\") != 0)", + " && (strcmp(name, \"gksudo\") != 0)", + " && (strcmp(name, \"/bin/gksudo\") != 0)", + " && (strcmp(name, \"/usr/bin/gksudo\") != 0)", + " && (strcmp(name, \"kdesu\") != 0)", + " && (strcmp(name, \"/bin/kdesu\") != 0)", + " && (strcmp(name, \"/usr/bin/kdesu\") != 0)", + " ) {", + " printf(\"Operation not permitted\\n\");", + " kill(getpid(), SIGKILL);", + " exit(1);", + " }", "}", "", "#endif /* HARDENING */", @@ -613,15 +607,14 @@ static const char *RTC[] = { "#include ", "", "#if !defined(PT_ATTACHEXC) /* New replacement for PT_ATTACH */", - " #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)", - " #define PT_ATTACHEXC PT_ATTACH", - " #elif defined(PTRACE_ATTACH)", - " #define PT_ATTACHEXC PTRACE_ATTACH", - " #endif", + " #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)", + " #define PT_ATTACHEXC PT_ATTACH", + " #elif defined(PTRACE_ATTACH)", + " #define PT_ATTACHEXC PTRACE_ATTACH", + " #endif", "#endif", "", - "void untraceable(char * argv0)", - "{", + "void untraceable(char * argv0) {", " char proc[80];", " int pid, mine;", "", @@ -637,29 +630,29 @@ static const char *RTC[] = { " close(0);", " mine = !open(proc, O_RDWR|O_EXCL);", " if (!mine && errno != EBUSY) {", - " if((mine=2*!ptrace(PT_ATTACHEXC, pid, 0, 0)))wait(0);", + " if ((mine=2*!ptrace(PT_ATTACHEXC, pid, 0, 0))) { wait(0); }", " }", " if (!mine) {", " perror(argv0);", " kill(pid, SIGKILL);", -/*" fprintf(stderr, \"%s is being traced!\\n\", argv0);",*/ - " } else if(mine>1) {", + /*" fprintf(stderr, \"%s is being traced!\\n\", argv0);",*/ + " } else if (mine>1) {", " ptrace(PTRACE_DETACH, pid, 0, 0);", " }", " _exit(mine);", " case -1:", " break;", " default:", - " if (pid == waitpid(pid, 0, 0))", + " if (pid == waitpid(pid, 0, 0)) {", " return;", + " }", " }", " perror(argv0);", " _exit(1);", "}", "#endif /* !TRACEABLE */", "", - "char * xsh(int argc, char ** argv)", - "{", + "char * xsh(int argc, char ** argv) {", " char * scrpt;", " int ret, i, j;", " char ** varg;", @@ -672,8 +665,9 @@ static const char *RTC[] = { " key(pswd, pswd_z);", " arc4(msg1, msg1_z);", " arc4(date, date_z);", - " if (date[0] && (atoll(date)BUFSIZ) w=BUFSIZ;", - " if((w=write(fd, text+i, w))<0) break;", + " for (i=0, l=strlen(text); i < l; i+=w) {", + " if ((w=l-i) > BUFSIZ) { w=BUFSIZ; }", + " if ((w=write(fd, text+i, w)) < 0) { break; }", " memset(text+i, 0, w);", " }", " _exit(0);", " }", - " if(!FIXARGV0) {", + " if (!FIXARGV0) {", " varg[j++] = tnm;", - " i0=1;", + " i0 = 1;", " goto xec;", " }", " }", - " if (ret && *opts)", + " if (ret && *opts) {", " varg[j++] = opts; /* Options on 1st line of code */", - " if (*inlo)", + " }", + " if (*inlo) {", " varg[j++] = inlo; /* Option introducing inline code */", + " }", " char cmd[256];", - " if(PIPESCRIPT && ret) {", + " if (PIPESCRIPT && ret) {", " snprintf(cmd, sizeof(cmd), pfmt, argv[0], tnm);" " varg[j++] = cmd;" " } else {", @@ -793,8 +792,9 @@ static const char *RTC[] = { " }", "xec:", " i = (ret > 1) ? ret : i0; /* Args numbering correction */", - " while (i < argc)", + " while (i < argc) {", " varg[j++] = argv[i++]; /* Main run-time arguments */", + " }", " varg[j] = 0; /* NULL terminated array */", "#if DEBUGEXEC", " debugexec(shll, j, varg);", @@ -803,8 +803,7 @@ static const char *RTC[] = { " return shll;", "}", "", - "int main(int argc, char ** argv)", - "{", + "int main(int argc, char ** argv) {", "#if defined(__GNUC__)", "#define _UNUSED_R(x) { int __attribute__((unused)) _tmp = (int) (x); }", "#else", @@ -1416,7 +1415,7 @@ int write_C(char *file, int argc, char *argv[]) fprintf(o, "%s ", argv[l_idx]); } fprintf(o, "\n#endif\n\n"); - fprintf(o, "static char data [] = "); + fprintf(o, "static char data[] ="); do { done = 0; l_idx = rand_mod(16); From 9ead41af9fe663472f8b80f4ee6557ae28994215 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 19 Aug 2024 15:46:08 +0200 Subject: [PATCH 80/83] Extend tests to more options --- test/ttest.sh | 66 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 10 deletions(-) diff --git a/test/ttest.sh b/test/ttest.sh index 0cc147e..b6fa07f 100755 --- a/test/ttest.sh +++ b/test/ttest.sh @@ -3,7 +3,7 @@ shells=('/bin/sh' '/bin/dash' '/bin/bash' '/bin/ksh' '/bin/zsh' '/usr/bin/tcsh' '/bin/csh' '/usr/bin/rc' '/usr/bin/python' '/usr/bin/python2' '/usr/bin/python3' '/usr/bin/perl') ## Install: sudo apt install dash bash ksh zsh tcsh csh rc -check_opts=('' '-r' '-v' '-D' '-S' '-P') +check_opts=('' '-r' '-v' '-D' '-S' '-P' '-p' '-H' '-2') shc=${1-shc} @@ -35,6 +35,12 @@ for shell in "${shells[@]}"; do continue fi for opt in "${check_opts[@]}"; do + if [ "${opt}" = "-H" ] ; then + if [ "${shell#*sh}" = "$shell" ] ; then + # Only supported for "bourne shell" + continue + fi + fi tmpd=$(mktemp -d "/tmp/shc.${BASESHELL}${opt}.XXX.tst") tmpf="$tmpd/test.$(basename "$shell")" tmpa="$tmpd/a.out.${BASESHELL}$opt" @@ -42,29 +48,69 @@ for shell in "${shells[@]}"; do out="" firstarg='first quote" and space' secondarg="secondWithSingleQuote'" - expected=${shell}': Hello World sn:'"${tmpa}"' fp:'"${firstarg}"' sp:'"${secondarg}" + + # Default values for echo/print and expectations + args_echo=' fp:(1) sp:(2)' + args_expected=" fp:${firstarg} sp:${secondarg}" + sn_echo=' sn:(0)' + sn_expected=" sn:${tmpa}" + + # Modify defaults according to test/skip test + if [ "${opt}" = "-H" ] ; then + # -H does not support arguments + args_echo= + args_expected= + sn_echo= + sn_expected= + elif [ "${opt}" = "-p" ] ; then + # -p does not suppose $0 support + sn_echo= + sn_expected= + fi + + default_echo="${shell}: Hello World${sn_echo}${args_echo}" + expected="${shell}: Hello World${sn_expected}${args_expected}" + + arg_only_echo="${shell}: Hello World${args_echo}" + arg_only_expected="${shell}: Hello World${args_expected}" + { echo '#!'"$shell" if [ "${shell#*/pyth}" != "$shell" ] ; then # Python - echo 'import sys; sys.stdout.write(("'"${shell}"': Hello World sn:%s fp:%s sp:%s" % (sys.argv[0],sys.argv[1],sys.argv[2]))+"\n")' + default_echo="${default_echo//\(/\{}" # Use % to indicate arg + default_echo="${default_echo//)/\}}" # No end parentheses + echo 'import sys; sys.stdout.write("'"${default_echo}"'".format(*sys.argv)+"\n")' elif [ "$BASESHELL" = "rc" ] ; then + default_echo="${default_echo//\(/\$}" # Use $ to indicate arg + default_echo="${default_echo//)/}" # No end parentheses + arg_only_echo="${arg_only_echo//\(/\$}" # Use $ to indicate arg + arg_only_echo="${arg_only_echo//)/}" # No end parentheses # rc if [ "$opt" != "-P" ] ; then - echo 'echo '"${shell}"': Hello World sn:$0 fp:$1 sp:$2' + echo "echo ${default_echo}" else - echo 'echo '"${shell}"': Hello World fp:$1 sp:$2' - expected=${shell}': Hello World fp:'"${firstarg}"' sp:'"${secondarg}" + echo "echo ${arg_only_echo}" + expected="${arg_only_expected}" fi elif [ "${shell#*/perl}" != "$shell" ] ; then # perl - echo 'print "'"${shell}"': Hello World sn:$0 fp:$ARGV[0] sp:$ARGV[1]";' + default_echo="${default_echo//\(/\$ARGV\[}" # Use $ARGV[ to indicate arg + default_echo="${default_echo//)/\]}" # Place ] after arg index + default_echo="${default_echo//\$ARGV\[0\]/\$0}" # $0 for first argument + default_echo="${default_echo//1/0}" # Argument shift + default_echo="${default_echo//2/1}" # Argument shift + echo 'print "'"${default_echo}"'";' elif [ "${shell#*/csh}" != "$shell" ] ; then # csh - can not forge $0 - echo 'echo "'"${shell}":' Hello World fp:$1 sp:$2"' - expected=${shell}': Hello World fp:'"${firstarg}"' sp:'"${secondarg}" + arg_only_echo="${arg_only_echo//\(/\$}" # Use $ to indicate arg + arg_only_echo="${arg_only_echo//)/}" # No end parentheses + echo 'echo "'"${arg_only_echo}"'"' + expected="${arg_only_expected}" else - echo 'echo "'"${shell}":' Hello World sn:$0 fp:$1 sp:$2"' + default_echo=${default_echo//\(/\$} # Use $ to indicate arg + default_echo="${default_echo//)/}" # No end parentheses + echo 'echo "'"${default_echo}"'"' fi } > "$tmpf" # shellcheck disable=SC2086 From 85d658eee90f09fba8fdfa6ec922d4c8bc3e8d7a Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 19 Aug 2024 16:24:57 +0200 Subject: [PATCH 81/83] Update documentation --- README.md | 40 ++++++++++++++++++++++++++++---------- man.md | 57 +++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 66 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index f03ebd0..88fb11a 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,15 @@ shc itself is not a compiler such as cc, it rather encodes and encrypts a shell ## Install +### Building & installing locally + ```bash ./configure make sudo make install ``` -**Note** If `make` fails due to *automake* version, run `./autogen.sh` before running the above commands. +**Note** If `make` fails due to *automake*'s version, run `./autogen.sh` before running the above commands. ### Debian GNU/Linux and Ubuntu systems @@ -42,13 +44,13 @@ If the above installation method seems like too much work, then just download a ```bash shc [options] shc -f script.sh -o binary -shc -U -f script.sh -o binary # Untraceable binary (prevent strace, ptrace etc..) -shc -H -f script.sh -o binary # Untraceable binary, does not require root (only bourne shell (sh) scripts with no parameter) +shc -U -f script.sh -o binary # Untraceable binary (prevent strace, ptrace etc..) +shc -H -f script.sh -o binary # Untraceable binary, does not require root (only bourne shell (sh) scripts with no parameter) ``` -## The hardening flag -H +## The hardening flag `-H` -This flag is currently in an experimental state and may not work in all systems. This flag only works for **default** shell. For example, if you compile a **bash** script with `-H` flag then the resultant executable will only work in systems where the default shell is **bash**. You may change the default shell which generally is `/bin/sh` which further is just a link to another shell like bash or dash etc. +This flag is currently in an experimental state and may not work in all systems. This flag only works for **default** shell. For example, if you compile a **bash** script with `-H` flag then the resulting executable will only work in systems where the default shell is **bash**. You may change the default shell which generally is `/bin/sh` which further is just a link to another shell like bash or dash etc. **Also `-H` does not work with positional parameters (yet)** @@ -57,13 +59,26 @@ This flag is currently in an experimental state and may not work in all systems. ```bash ./configure make -make check +make test ``` +Temporary directories are generally created in `/tmp/shc.SHELL.OPT.XXX.tst` (caps are replaced according to test). +When a test succeeds, the directory is removed, if not, it is kept to help with debugging. + +Clean up test outputs manually with: + +```bash +rm /tmp/shc.*.tst +``` + + ## Known limitations -The one (and I hope the only) limitation using shc is the `_SC_ARG_MAX` system configuration parameter. -It limits the maximum length of the arguments to the exec function, limiting the maximum length of the runnable script of shc. +- SCRIPT length: The `_SC_ARG_MAX` system configuration parameter limits the . +length of the arguments to the exec function. + With standard options this limits the maximum length of the runnable script of shc. + However, you can now use the `-P` options which uses a pipe which circumvents this limitation. + !! - CHECK YOUR RESULTS CAREFULLY BEFORE USING - !! @@ -76,7 +91,9 @@ It limits the maximum length of the arguments to the exec function, limiting the If you want to make pull requests, please do so against the **master** branch. The default branch is **release** which should contain clean package files ready to be used. -If you want to edit the manual, please edit the **man.md** file (available in the master branch) instead and then generate the manual file from it with the command (requires `pandoc` to be installed): +If you want to edit the manual, please edit the **man.md** file. +The ci flow will generate the other manual files from it. +You can also generate these locally with the following commands (requires `pandoc`): ```bash pandoc -s man.md -t man -o shc.1 @@ -84,4 +101,7 @@ pandoc -s man.md -t man -o shc.1 pandoc -s man.md -t html -o man.html ``` -If you change anything related to autotools, please run `./autogen.sh` afterwards. +If you change anything related to `autotools`, `./autogen.sh` should be run to regenerate the derived files. +Again, the ci flow will generate these automatically. + +You may need to pull after a push because of the changes committed by ci. diff --git a/man.md b/man.md index b3a945a..ac9587f 100644 --- a/man.md +++ b/man.md @@ -1,59 +1,66 @@ % shc(1) shc user manual % -% January 14, 2019 +% August 19, 2024
# NAME shc - Generic shell script compiler # SYNOPSIS -**shc** [ -e *date* ] [ -m *addr* ] [ -i *iopt* ] [ -x *cmnd* ] [ -l *lopt* ] [ -o *outfile* ] [ -ABCDhUHvSr ] -f *script* +**shc** \[ -e *DATE* \] \[ -m *MESSAGE* \] \[ -i *IOPT* \] \[ -x *CMD* \] \[ -l *LOPT* \] \[ -o *OUTFILE* \] \[ -2ABCDHpPSUhrv \] -f *SCRIPT* # DESCRIPTION **shc** creates a stripped binary executable version of the script specified with `-f` on the command line. -The binary version will get a `.x` extension appended by default if *outfile* is not defined with [-o *outfile*] option +The binary version will get a `.x` extension appended by default if *OUTFILE* is not defined with [-o *OUTFILE*] option and will usually be a bit larger in size than the original ascii code. Generated C source code is saved in a file with the extension `.x.c` or in a file specified with appropriate option. -If you supply an expiration date with the `-e` option, the compiled binary will refuse to run after the date specified. +If you provide an expiration DATE with the `-e` option, the compiled binary will refuse to run after the date specified. The message **Please contact your provider** will be displayed instead. This message can be changed with the `-m` option. You can compile any kind of shell script, but you need to supply valid `-i`, `-x` and `-l` options. -The compiled binary will still be dependent on the shell specified in the first line of the shell code (i.e. `#!/bin/sh`), -thus **shc** does not create completely independent binaries. +The compiled binary will still require the shell specified in the first line of the shell code (i.e. `#!/bin/sh`) to be available on the system, +therefore **shc** does not create completely independent binaries, it mainly obfuscates the source script. **shc** itself is not a compiler such as cc, it rather encodes and encrypts a shell script and generates C source code with the added expiration capability. It then uses the system compiler to compile a stripped binary which behaves exactly like the original script. Upon execution, the compiled binary will decrypt and execute the code with the shell `-c` option. -Unfortunately, it will not give you any speed improvement as a real C program would. +It will not give you any speed improvement as a real C program would. **shc**'s main purpose is to protect your shell scripts from modification or inspection. You can use it if you wish to distribute your scripts but don't want them to be easily readable by other people. # OPTIONS --e *date* +-e *DATE* : Expiration date in *dd/mm/yyyy* format `[none]` --m *message* +-m *MESSAGE* : message to display upon expiration `["Please contact your provider"]` --f *script_name* +-f *SCRIPT* : File path of the script to compile --i *inline_option* +-P +: Use a pipe to feed the script, with ARGV fixes. Enabled automatically + for `python`, `perl` and `csh`. + +-p +: Use a pipe to feed the script, without ARGV fixing. + +-i *IOPT* : Inline option for the shell interpreter i.e: `-e` --x *command* +-x *CMD* : eXec command, as a printf format i.e: `exec(\\'%s\\',@ARGV);` --l *last_option* +-l *LOPT* : Last shell option i.e: `--` --o *outfile* -: output to the file specified by outfile +-o *OUTFILE* +: output to the file specified by OUTFILE -r : Relax security. Make a redistributable binary which executes on different systems running the same operating system. You can release your binary with this option for others to use @@ -62,16 +69,16 @@ You can use it if you wish to distribute your scripts but don't want them to be : Verbose compilation -S -: Switch ON setuid for root callable programs [OFF] +: Enable setuid for root callable programs -D -: Switch on debug exec calls +: Enable debug (show exec calls, etc.) -U -: Make binary to be untraceable (using *strace*, *ptrace*, *truss*, etc.) +: Make binary execution untraceable (using *strace*, *ptrace*, *truss*, etc.) -H -: Hardening. Extra security flag without root access requirement that protects against dumping, code injection, `cat /proc/pid/cmdline`, ptrace, etc.. This feature is **experimental** and may not work on all systems. it requires bourne shell (sh) scripts +: Hardening. Extra security flag without root access requirement that protects against dumping, code injection, `cat /proc/pid/cmdline`, `ptrace`, etc... This feature is **experimental** and may not work on all systems. it requires bourne shell (sh) scripts -C : Display license and exit @@ -79,6 +86,9 @@ You can use it if you wish to distribute your scripts but don't want them to be -A : Display abstract and exit +-2 +: Use `mmap2` system call. + -B : Compile for BusyBox @@ -88,6 +98,9 @@ You can use it if you wish to distribute your scripts but don't want them to be # ENVIRONMENT VARIABLES +These can be used to provide options to the GCC Compiler. +Examples: static compilation, machine architecture, sanitize options. + CC : C compiler command `[cc]` @@ -120,10 +133,12 @@ shc -Hf myscript -o mybinary # LIMITATIONS The maximum size of the script that could be executed once compiled is limited by the operating system configuration parameter `_SC_ARG_MAX` (see sysconf(2)) -# AUTHORS -Francisco Rosales +# MAIN AUTHORS +Francisco Rosales Md Jahidul Hamid +Note: Do not contact them, they are no longer actively involved + # REPORT BUGS TO https://github.com/neurobin/shc/issues From 7b0337fb668b206e9bbc8d546ba4c02d2208e678 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 19 Aug 2024 14:25:25 +0000 Subject: [PATCH 82/83] ci: Github Action Generate Files --- man.html | 86 ++++++++++++++++++++++++++++++++++---------------------- shc.1 | 68 ++++++++++++++++++++++++++------------------ 2 files changed, 93 insertions(+), 61 deletions(-) diff --git a/man.html b/man.html index ac3610d..1914c4b 100644 --- a/man.html +++ b/man.html @@ -5,7 +5,7 @@ - + shc(1) shc user manual