Merge pull request #999 from xexyl/ioccc-status-comment-fixes
This commit is contained in:
11 files changed
+221
-36
No files matched your search
@@ -39,7 +39,7 @@ include ../../var.mk
|
|||||||
# Common C compiler warnings to silence
|
# Common C compiler warnings to silence
|
||||||
#
|
#
|
||||||
CSILENCE= -Wno-comment -Wno-deprecated-non-prototype -Wno-main -Wno-pedantic \
|
CSILENCE= -Wno-comment -Wno-deprecated-non-prototype -Wno-main -Wno-pedantic \
|
||||||
-Wno-return-type -Wno-strict-prototypes -Wno-unused-parameter
|
-Wno-return-type -Wno-strict-prototypes -Wno-unused-parameter -Wno-implicit-int
|
||||||
|
|
||||||
# Common C compiler warning flags
|
# Common C compiler warning flags
|
||||||
#
|
#
|
||||||
|
|||||||
+11
-10
@@ -2,13 +2,13 @@
|
|||||||
#define _C_C(_)('\b'b'\b'>=C_C>'\t'b'\n')
|
#define _C_C(_)('\b'b'\b'>=C_C>'\t'b'\n')
|
||||||
#define C_C _|_
|
#define C_C _|_
|
||||||
#define b *
|
#define b *
|
||||||
#define C /b/
|
#define C /b b/
|
||||||
#define V _C_C(
|
#define V _C_C(
|
||||||
main(/*/,('\b'*'\b'>=_|_>'\t'*'\n')
|
main(/*C,V)
|
||||||
char **('\b'*'\b'>=_|_>'\t'*'\n')
|
char **V;*/
|
||||||
* C program. (If you don't
|
/* C program. (If you don't
|
||||||
* understand it look it
|
* understand it look it
|
||||||
* up.) (In the /*/ /*C*/ manual)
|
* up.) (In the C */manual)
|
||||||
{
|
{
|
||||||
char _,__;
|
char _,__;
|
||||||
while (read(0,&__,1) & write((_=(_=~' '&__,/*/)),
|
while (read(0,&__,1) & write((_=(_=~' '&__,/*/)),
|
||||||
@@ -17,12 +17,13 @@ char **('\b'*'\b'>=_|_>'\t'*'\n')
|
|||||||
|
|
||||||
'\b'*'\b'|((_-52)%('\b'*'\b'+~' '&'\t'*'\n')+1),1),&_,1));
|
'\b'*'\b'|((_-52)%('\b'*'\b'+~' '&'\t'*'\n')+1),1),&_,1));
|
||||||
}
|
}
|
||||||
subr(/*C*/)
|
|
||||||
/*char *C;*/
|
|
||||||
{
|
|
||||||
#if 0
|
#if 0
|
||||||
|
subr(C)
|
||||||
|
char *C;
|
||||||
|
{
|
||||||
C="Lint says "argument Manual isn't used." What's that
|
C="Lint says "argument Manual isn't used." What's that
|
||||||
mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+
|
mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+
|
||||||
'\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1));
|
'\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
hague
|
hague
|
||||||
|
hague.alt
|
||||||
hague.orig
|
hague.orig
|
||||||
prog.orig
|
prog.orig
|
||||||
+2
-2
@@ -114,8 +114,8 @@ OBJ= ${PROG}.o
|
|||||||
DATA=
|
DATA=
|
||||||
TARGET= ${PROG}
|
TARGET= ${PROG}
|
||||||
#
|
#
|
||||||
ALT_OBJ=
|
ALT_OBJ= ${PROG}.alt.o
|
||||||
ALT_TARGET=
|
ALT_TARGET= ${PROG}.alt
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
|
|||||||
+27
-3
@@ -9,9 +9,9 @@ UK
|
|||||||
make all
|
make all
|
||||||
```
|
```
|
||||||
|
|
||||||
|
There is an alternate version which uses `fgets()`. See the Alternate code
|
||||||
NOTE: this entry uses `gets()` so you might get a warning about this when
|
section below as well as the [bugs.md](/bugs.md) file for more details as to why
|
||||||
compiling and running this program with some systems.
|
it is worth having as an alternate version.
|
||||||
|
|
||||||
## To run:
|
## To run:
|
||||||
|
|
||||||
@@ -29,6 +29,30 @@ International Obfuscated C Code Contest
|
|||||||
Jim Hague
|
Jim Hague
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Also try:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo IOCCC | ./hague
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alternate code:
|
||||||
|
|
||||||
|
Whereas with some entries the change to `fgets()` (see the [FAQ](/faq.md) for
|
||||||
|
details on why this has been done) can be done in the original code this entry
|
||||||
|
is more complicated in that although both forms of input show the correct
|
||||||
|
output, one form segfaults after the output.
|
||||||
|
|
||||||
|
If you wish to use this alternate code, do:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make alt
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `hague.alt` as you would `hague` above. As for which form will segfault
|
||||||
|
after outputting the text it is when text is piped into the program. Again see
|
||||||
|
the [bugs.md](/bugs.md) file for more details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#define DIT (
|
||||||
|
#define DAH )
|
||||||
|
#define __DAH ++
|
||||||
|
#define DITDAH *
|
||||||
|
#define DAHDIT for
|
||||||
|
#define DIT_DAH malloc
|
||||||
|
#define DAH_DIT fgets
|
||||||
|
#define _DAHDIT char
|
||||||
|
_DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:"
|
||||||
|
;main DIT DAH{_DAHDIT
|
||||||
|
DITDAH _DIT,DITDAH DAH_,DITDAH DIT_,
|
||||||
|
DITDAH _DIT_,DITDAH DIT_DAH DIT
|
||||||
|
DAH,DITDAH DAH_DIT DIT DAH;DAHDIT
|
||||||
|
DIT _DIT=DIT_DAH DIT 81 DAH,DIT_=_DIT
|
||||||
|
__DAH;_DIT=DAH_DIT DIT _DIT,81,stdin DAH,_DIT[strlen(_DIT)-1]='\0',_DIT!=NULL;__DIT
|
||||||
|
DIT'\n'DAH DAH DAHDIT DIT DAH_=_DIT;DITDAH
|
||||||
|
DAH_;__DIT DIT DITDAH
|
||||||
|
_DIT_?_DAH DIT DITDAH DIT_ DAH:'?'DAH,__DIT
|
||||||
|
DIT' 'DAH,DAH_ __DAH DAH DAHDIT DIT
|
||||||
|
DITDAH DIT_=2,_DIT_=_DAH_; DITDAH _DIT_&&DIT
|
||||||
|
DITDAH _DIT_!=DIT DITDAH DAH_>='a'? DITDAH
|
||||||
|
DAH_&223:DITDAH DAH_ DAH DAH; DIT
|
||||||
|
DITDAH DIT_ DAH __DAH,_DIT_ __DAH DAH
|
||||||
|
DITDAH DIT_+= DIT DITDAH _DIT_>='a'? DITDAH _DIT_-'a':0
|
||||||
|
DAH;}_DAH DIT DIT_ DAH{ __DIT DIT
|
||||||
|
DIT_>3?_DAH DIT DIT_>>1 DAH:'\0'DAH;return
|
||||||
|
DIT_&1?'-':'.';}__DIT DIT DIT_ DAH _DAHDIT
|
||||||
|
DIT_;{DIT void DAH write DIT 1,&DIT_,1 DAH;}
|
||||||
+2
-2
@@ -4,7 +4,7 @@
|
|||||||
#define DITDAH *
|
#define DITDAH *
|
||||||
#define DAHDIT for
|
#define DAHDIT for
|
||||||
#define DIT_DAH malloc
|
#define DIT_DAH malloc
|
||||||
#define DAH_DIT gets
|
#define DAH_DIT fgets
|
||||||
#define _DAHDIT char
|
#define _DAHDIT char
|
||||||
_DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:"
|
_DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:"
|
||||||
;main DIT DAH{_DAHDIT
|
;main DIT DAH{_DAHDIT
|
||||||
@@ -12,7 +12,7 @@ DITDAH _DIT,DITDAH DAH_,DITDAH DIT_,
|
|||||||
DITDAH _DIT_,DITDAH DIT_DAH DIT
|
DITDAH _DIT_,DITDAH DIT_DAH DIT
|
||||||
DAH,DITDAH DAH_DIT DIT DAH;DAHDIT
|
DAH,DITDAH DAH_DIT DIT DAH;DAHDIT
|
||||||
DIT _DIT=DIT_DAH DIT 81 DAH,DIT_=_DIT
|
DIT _DIT=DIT_DAH DIT 81 DAH,DIT_=_DIT
|
||||||
__DAH;_DIT==DAH_DIT DIT _DIT DAH;__DIT
|
__DAH;_DIT=DAH_DIT DIT _DIT,81,stdin DAH,_DIT[strlen(_DIT)-1]='\0',_DIT!=NULL;__DIT
|
||||||
DIT'\n'DAH DAH DAHDIT DIT DAH_=_DIT;DITDAH
|
DIT'\n'DAH DAH DAHDIT DIT DAH_=_DIT;DITDAH
|
||||||
DAH_;__DIT DIT DITDAH
|
DAH_;__DIT DIT DITDAH
|
||||||
_DIT_?_DAH DIT DITDAH DIT_ DAH:'?'DAH,__DIT
|
_DIT_?_DAH DIT DITDAH DIT_ DAH:'?'DAH,__DIT
|
||||||
|
|||||||
@@ -469,11 +469,27 @@ the judges and shouldn't be fixed.
|
|||||||
This entry uses `gets()` which is unsafe. In particular the buffer size is a
|
This entry uses `gets()` which is unsafe. In particular the buffer size is a
|
||||||
mere 81 and it does not read a single string at command invocation but instead
|
mere 81 and it does not read a single string at command invocation but instead
|
||||||
until the program is terminated. This size can be increased to start out but it
|
until the program is terminated. This size can be increased to start out but it
|
||||||
would be better if it used `fgets()`. This will be addressed in time but is
|
would be better if it used `fgets()`.
|
||||||
noted here as a reminder.
|
|
||||||
|
|
||||||
The way this entry is formed has made it not as simple as some of the others
|
The way this entry is formed has made it not as simple as some of the others
|
||||||
that have been addressed.
|
that have been addressed at least in part. It is easy to get it to use `fgets()`
|
||||||
|
and this has been done in the [alternate code](1986/hague/hague.alt.c) but it
|
||||||
|
will segfault after outputting the (correct) text in one of the forms. In
|
||||||
|
particular whereas this:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./hague.alt
|
||||||
|
foo
|
||||||
|
|
||||||
|
works the following will print out the correct output but then segfault:
|
||||||
|
|
||||||
|
```
|
||||||
|
```sh
|
||||||
|
echo foo | ./hague.alt
|
||||||
|
```
|
||||||
|
|
||||||
|
Whether or not it is worth making the entry itself (since the output is correct)
|
||||||
|
this alt version is to be determined later but it's might very well not be.
|
||||||
|
|
||||||
|
|
||||||
## [1986/holloway](1986/holloway/holloway.c) ([README.md](1986/holloway/README.md))
|
## [1986/holloway](1986/holloway/holloway.c) ([README.md](1986/holloway/README.md))
|
||||||
|
|||||||
@@ -88,6 +88,30 @@ some entries you should look at the original code as in `winner.orig.c` or
|
|||||||
`prog.orig.c`. Sometimes the original is in an alt version like `winner.alt.c`
|
`prog.orig.c`. Sometimes the original is in an alt version like `winner.alt.c`
|
||||||
or `prog.alt.c`.
|
or `prog.alt.c`.
|
||||||
|
|
||||||
|
## Q: Why have some entries that originally used `gets()` been modified to use `fgets()`? Doesn't this tamper with the entry too much?
|
||||||
|
|
||||||
|
A fine line indeed has to be drawn here but it was decided that it is worth it
|
||||||
|
because of alarming warnings that can be displayed, in some systems at runtime
|
||||||
|
interspersed with the output of the program.
|
||||||
|
|
||||||
|
For instance in macOS the entry [1990/tbr](1990/tbr/README.md) would output the
|
||||||
|
warning in such a way that caused confusing output for the entry.
|
||||||
|
|
||||||
|
In some cases this is not so easy to fix and in one case at least there is an
|
||||||
|
alternate version that has the fix instead due to a problem it creates (correct
|
||||||
|
output but segfaults after the output in one of the forms of input).
|
||||||
|
|
||||||
|
In some cases it is not possible to fix or at least highly unlikely and so those
|
||||||
|
have mainly not been touched except one that has had the buffer size increased
|
||||||
|
(which could be done for others that are not possible to change to `fgets()` but
|
||||||
|
this has not been done).
|
||||||
|
|
||||||
|
In the future we, the judges, would prefer that entries use `fgets()` to prevent
|
||||||
|
these problems.
|
||||||
|
|
||||||
|
NOTE: due to 'compatibility reasons' `fgets()` stores the newline and `gets()`
|
||||||
|
does not. We're not sure how this is compatibility but either way it can cause a
|
||||||
|
problem and it is this that has complicated some fixes.
|
||||||
|
|
||||||
## Q: I cannot get entry XYZZY from year 19xx to compile!
|
## Q: I cannot get entry XYZZY from year 19xx to compile!
|
||||||
|
|
||||||
@@ -800,3 +824,77 @@ exaggeration](https://books.google.com/books?id=ms3tce7BgJsC&lpg=PA134&vq=%22the
|
|||||||
p.s. Here is an image of F. D. C. Willard:
|
p.s. Here is an image of F. D. C. Willard:
|
||||||
|
|
||||||
[F D C Willard](png/F.D.C.Willard.png)
|
[F D C Willard](png/F.D.C.Willard.png)
|
||||||
|
|
||||||
|
## Q: Why do Makefiles use `-Weverything` with `clang`? Don't you know that its use is not recommended by clang developers?
|
||||||
|
|
||||||
|
The use of `-Weverything` is limited to when one forces `CC=clang`. Users with
|
||||||
|
clang compilers are not required to set `CC=clang` but when they do,
|
||||||
|
`-Weverything` is enabled with all of its challenges, pedantic warnings, and
|
||||||
|
sometimes warnings about things that do not matter, some of which are frankly
|
||||||
|
frivolous and often downright dubious.
|
||||||
|
|
||||||
|
To enable this feature:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make clobber all CC=clang
|
||||||
|
```
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make clobber all 'CWARN+= -Weverything'
|
||||||
|
```
|
||||||
|
|
||||||
|
though it should be noted that if one tries `-Weverything` with compilers that
|
||||||
|
are not `clang` they might see something like:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo 'int main(void) {}' > foo.c ; cc -Weverything foo.c -o foo
|
||||||
|
cc: error: unrecognized command-line option '-Weverything'
|
||||||
|
```
|
||||||
|
|
||||||
|
which means that it can't even be compiled. Thus the proper way to do it is the
|
||||||
|
first one.
|
||||||
|
|
||||||
|
IOCCC authors who have access to a `clang` compiler might wish to try they their
|
||||||
|
hand at compiling with `-Weverything` while using a minimum of `-Wno-foo`
|
||||||
|
statements. Sometimes there is a technical or pedantic issue that
|
||||||
|
`-Weverything` warns about that would merit a change to your C code. Of course
|
||||||
|
if you're running out of bytes due to rule 2[ab] one might not have much choice.
|
||||||
|
Thus is something that obfuscators simply sometimes have to deal with!
|
||||||
|
|
||||||
|
If you to try to use minimize the number of `-Wno-foo` options needed with
|
||||||
|
`-Weverything`, please mention this in your remarks about the entry, as the
|
||||||
|
judges note you attempt to honor it (see also below). In some cases your
|
||||||
|
obfuscated code will issue warnings with `-Weverything` no matter what: the
|
||||||
|
`-Wno-poison-system-directories` is a common example of this but there are
|
||||||
|
others as well.
|
||||||
|
|
||||||
|
If you do try for a warning clean `-Weverything`, keep on mind that while _your_
|
||||||
|
compile environment might be warning free, a different clang version or a
|
||||||
|
different build environment might still have warnings. For instance the warning
|
||||||
|
set is different in macOS (which by default is `clang` even when run as `gcc`!)
|
||||||
|
than linux! Given that your entry *MUST* work as documented, you may be safer to
|
||||||
|
say that your entry keeps the number of warnings and `-Wno-foo` options while
|
||||||
|
compiling with `clang -Weverything` at a minimum. Because if you claim zero
|
||||||
|
warnings, and we find a warning situation, this may diminish the value of your
|
||||||
|
entry as it is not as documented. Thus it might be wise to point this out and
|
||||||
|
also if you can test it in multiple platforms (or versions of `clang`, see
|
||||||
|
below note) this would be advisable.
|
||||||
|
|
||||||
|
NOTE: different versions of `clang` have other differences as well. For instance
|
||||||
|
a defect of `clang` (which was fixed in a lot of entries by [Cody Boone
|
||||||
|
Ferguson](/winners.html#Cody_Boone_Ferguson) and some were fixed by us, the
|
||||||
|
[judges](https://www.ioccc.org/judges.html) as well) is that it requires that
|
||||||
|
`main()`'s arguments to be of a specific type. However some versions of `clang`
|
||||||
|
are more strict in the number of args allowed. These reasons are part of why
|
||||||
|
numerous entries had to be modified so that `main()` calls another function
|
||||||
|
instead of doing it all in `main()`. Another reason was that some entries that
|
||||||
|
recursively called `main()` caused a crash or otherwise broke the entry in
|
||||||
|
modern systems. Some entries do not work in `clang` (or at least do not work
|
||||||
|
completely) due to these defects, for instance
|
||||||
|
[1989/westley](1989/westley/README.md).
|
||||||
|
|
||||||
|
As you can see, using `clang` has some additional problems to work out but if
|
||||||
|
you can get your entry to work well in `clang` it might very well be considered
|
||||||
|
better than other entries.
|
||||||
@@ -133,6 +133,21 @@ like to refer you to the original file in
|
|||||||
[sicherman.alt.c](1985/sicherman/sicherman.alt.c) and he suggests that you then compare it
|
[sicherman.alt.c](1985/sicherman/sicherman.alt.c) and he suggests that you then compare it
|
||||||
to [sicherman.c](1985/sicherman/sicherman.c) for some good old C-fashioned fun!
|
to [sicherman.c](1985/sicherman/sicherman.c) for some good old C-fashioned fun!
|
||||||
|
|
||||||
|
Later on Cody improved the fix so that it looks much more like the original
|
||||||
|
entry which can be found in
|
||||||
|
[1985/sicherman/sicherman.orig.c](1985/sicherman/sicherman.orig.c).
|
||||||
|
|
||||||
|
|
||||||
|
## [1986/hague](1986/hague/hague.c) ([README.md](1986/hague/README.md]))
|
||||||
|
|
||||||
|
Cody added alt code that uses `fgets()` to avoid alarming and annoying warnings
|
||||||
|
about `gets()` being unsafe. The reason this is alt code, at least for now, is
|
||||||
|
that although it will print the results in both forms of invocation, after the
|
||||||
|
output in one invocation form it will segfault. This might be addressed later on
|
||||||
|
or it might be decided that it is worth it, with a caveat in the Makefile or at
|
||||||
|
least the README.md file, since it still prints out the correct output, though
|
||||||
|
that seems like it might not be so ideal unless it can be fixed (which might be
|
||||||
|
done). See the [bugs.md](/bugs.md) file for details.
|
||||||
|
|
||||||
## [1986/holloway](1986/holloway/holloway.c) ([README.md](1986/holloway/README.md]))
|
## [1986/holloway](1986/holloway/holloway.c) ([README.md](1986/holloway/README.md]))
|
||||||
|
|
||||||
|
|||||||
@@ -8,25 +8,16 @@
|
|||||||
# https://xexyl.net Cody Boone Ferguson
|
# https://xexyl.net Cody Boone Ferguson
|
||||||
# https://ioccc.xexyl.net
|
# https://ioccc.xexyl.net
|
||||||
#
|
#
|
||||||
# The script is at this just point a proof of concept but it does work, allowing
|
|
||||||
# one to update the date of the latest news, the date of the status, the status
|
|
||||||
# version and the status of the contest. It's not required to update all or for
|
|
||||||
# that matter any of them.
|
|
||||||
#
|
|
||||||
# If that is not clear: it might or might not be needed or desired and that is
|
|
||||||
# perfectly okay. If it's used but modified that's also okay. It gave me
|
|
||||||
# something to do and whether or not it's useful it has served a purpose.
|
|
||||||
#
|
|
||||||
# If -s option is used, the status field is updated, providing that the status
|
# If -s option is used, the status field is updated, providing that the status
|
||||||
# arg is either "closed" or "open".
|
# arg is either "closed" or "open".
|
||||||
#
|
#
|
||||||
# If the -d or -n flags are used then it will update the status_date or
|
# If the -d or -n flags are used then it will update the status_date or
|
||||||
# latest_news fields, respectively.
|
# latest_news fields, respectively.
|
||||||
#
|
#
|
||||||
# If the -I status_ver option is used the IOCCC_status_version field will be
|
# If the -i status_ver option is used the IOCCC_status_version field will be
|
||||||
# updated.
|
# updated.
|
||||||
#
|
#
|
||||||
export IOCCC_STATUS_VERSION="0.0.1-0 2023-10-02" # major.minor.release-patch YYYY-MM-DD
|
export IOCCC_STATUS_SCRIPT_VERSION="0.0.2-0 2023-10-04" # major.minor.release-patch YYYY-MM-DD
|
||||||
|
|
||||||
USAGE="usage: $(basename "$0") [-h] [-V] [-v level] [-s status] [-d] [-n] [-i status_ver] status.json
|
USAGE="usage: $(basename "$0") [-h] [-V] [-v level] [-s status] [-d] [-n] [-i status_ver] status.json
|
||||||
|
|
||||||
@@ -41,9 +32,11 @@ USAGE="usage: $(basename "$0") [-h] [-V] [-v level] [-s status] [-d] [-n] [-i st
|
|||||||
-n update latest_news date
|
-n update latest_news date
|
||||||
-i status_ver update IOCCC_status_version
|
-i status_ver update IOCCC_status_version
|
||||||
|
|
||||||
|
NOTE: version must match the regexp: ^[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}$
|
||||||
|
|
||||||
status.json the file to update
|
status.json the file to update
|
||||||
|
|
||||||
status version: $IOCCC_STATUS_VERSION"
|
status version: $IOCCC_STATUS_SCRIPT_VERSION"
|
||||||
|
|
||||||
export UPDATE_DATE=""
|
export UPDATE_DATE=""
|
||||||
export UPDATE_NEWS=""
|
export UPDATE_NEWS=""
|
||||||
@@ -61,7 +54,7 @@ while getopts :hVv:s:dni: flag; do
|
|||||||
h) echo "$USAGE" 1>&2
|
h) echo "$USAGE" 1>&2
|
||||||
exit 2
|
exit 2
|
||||||
;;
|
;;
|
||||||
V) echo "$IOCCC_STATUS_VERSION" 1>&2
|
V) echo "$IOCCC_STATUS_SCRIPT_VERSION" 1>&2
|
||||||
exit 2
|
exit 2
|
||||||
;;
|
;;
|
||||||
v) VERBOSITY="$OPTARG";
|
v) VERBOSITY="$OPTARG";
|
||||||
@@ -120,11 +113,20 @@ if [[ ! -r $STATUS_JSON_FILE ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check that if -s used that the status ($STATUS) is either 'open' or 'closed'
|
# check that if -s ($STATUS_FLAG) used that the status ($STATUS) is either 'open' or 'closed'
|
||||||
if [[ -n "$STATUS_FLAG" ]]; then
|
if [[ -n "$STATUS_FLAG" ]]; then
|
||||||
if [[ "$STATUS" != "open" && "$STATUS" != "closed" ]]; then
|
if [[ "$STATUS" != "open" && "$STATUS" != "closed" ]]; then
|
||||||
echo "$0: ERROR: status must be 'open' or 'closed'" 1>&2
|
echo "$0: ERROR: status must be 'open' or 'closed'" 1>&2
|
||||||
exit 1
|
exit 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check format of IOCCC_status_version if set (-i used, $UPDATE_IOCCC_STATUS_VERSION)
|
||||||
|
if [[ -n "$UPDATE_IOCCC_STATUS_VERSION" ]]; then
|
||||||
|
echo "$IOCCC_STATUS_VERSION" | grep -qE '^[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}$'
|
||||||
|
if [[ "${PIPESTATUS[1]}" -ne 0 ]]; then
|
||||||
|
echo "$0: ERROR: IOCCC_status_version must match the regexp: '^[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}$'" 1>&2
|
||||||
|
exit 3
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user