Extend pigz option parser with simple support for '--' option list terminator to make it syntax-compatible with GNU gzip. (c) 2010 Michał Górny diff -dupr pigz-2.1.6.orig//pigz.c pigz-2.1.6/pigz.c --- pigz-2.1.6.orig//pigz.c 2010-04-03 14:11:13.929950502 +0200 +++ pigz-2.1.6/pigz.c 2010-04-03 14:16:50.766949317 +0200 @@ -2914,6 +2914,7 @@ local size_t num(char *arg) local int option(char *arg) { static int get = 0; /* if not zero, look for option parameter */ + static char ddash = 0; /* if not zero, we got '--' and option parsing should stop */ char bad[3] = "-X"; /* for error messages (X is replaced) */ /* if no argument or dash option, check status of get */ @@ -2923,6 +2924,8 @@ local int option(char *arg) } if (arg == NULL) return 0; + if (ddash) + return 1; /* process long option or short options */ if (*arg == '-') { @@ -2935,6 +2938,12 @@ local int option(char *arg) int j; arg++; + /* stop parsing options after '--' */ + if (*arg == 0) { + ddash++; + return 0; + } + for (j = NLOPTS - 1; j >= 0; j--) if (strcmp(arg, longopts[j][0]) == 0) { arg = longopts[j][1];