setup src tree, clean out bin directory
The src tree now contains source for tools that will be published as part of the IOCCC winner web site. However, the compiled and/or installed tools that install under bin, will NOT be published. The bin directory is now excluded under .gitignore so that those who use this repo will have to do: ```sh cd src; make clobber all install ``` The src/Makefile in turn drives rules in sub-directory Makefiles. Currently there are only two sub-directories: winner_name - a completely re-written extract_winner_handles.sh sgit - run sed on all files under git control The check_awards.sh tool was moved under tmp as this tool depends on CSV file, will not be needed soon, and will go away when the tmp directory is cleaned out towards the end of finishing issue #4.
This commit is contained in:
1 parent
7df6b18ec4
commit
828ddef5eb
11 files changed
+451
-6
No files matched your search
@@ -36,6 +36,7 @@
|
||||
/archive/2019/
|
||||
/archive/2020/
|
||||
/bugs.html
|
||||
/bin
|
||||
/faq.html
|
||||
iocccsize
|
||||
mkentry
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
grep -o '<A NAME="[^"][A-Za-z_][A-Za-z_]*">' winners.html |sed -e 's,<A NAME=,,g' -e 's/"//g' -e 's/>//g'
|
||||
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# src - all source for bin tools
|
||||
#
|
||||
# Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software and
|
||||
# its documentation for any purpose and without fee is hereby granted,
|
||||
# provided that the above copyright, this permission notice and text
|
||||
# this comment, and the disclaimer below appear in all of the following:
|
||||
#
|
||||
# supporting documentation
|
||||
# source copies
|
||||
# source works derived from this source
|
||||
# binaries derived from this source or from derived source
|
||||
#
|
||||
# LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
# EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# chongo (Landon Curt Noll, http://www.isthe.com/chongo/index.html) /\oo/\
|
||||
#
|
||||
# Share and enjoy! :-)
|
||||
|
||||
#############
|
||||
# utilities #
|
||||
#############
|
||||
|
||||
CC= cc
|
||||
CHMOD= chmod
|
||||
CP= cp
|
||||
INSTALL= install
|
||||
RM= rm
|
||||
SHELL= bash
|
||||
|
||||
#CFLAGS= -O3 -g3 --pedantic -Wall -Werror
|
||||
CFLAGS= -O3 -g3 --pedantic -Wall
|
||||
|
||||
######################
|
||||
# target information #
|
||||
######################
|
||||
|
||||
TARGETS= sgit winner_name
|
||||
|
||||
######################################
|
||||
# all - default rule - must be first #
|
||||
######################################
|
||||
|
||||
all: ${TARGETS}
|
||||
@for dir in ${TARGETS}; do \
|
||||
if [[ ! -d $$dir ]]; then \
|
||||
echo "$0: FATAL: not a sub-directory: $$dir" 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [[ ! -f $$dir/Makefile ]]; then \
|
||||
echo "$0: FATAL: not a file: $$dir/Makefile" 1>&2; \
|
||||
exit 2; \
|
||||
fi; \
|
||||
echo "make -C \"$$dir\" $@"; \
|
||||
make -C "$$dir" $@; \
|
||||
done
|
||||
|
||||
#################################################
|
||||
# .PHONY list of rules that do not create files #
|
||||
#################################################
|
||||
|
||||
.PHONY: all configure clean clobber install
|
||||
|
||||
###################################
|
||||
# standard Makefile utility rules #
|
||||
###################################
|
||||
|
||||
configure:
|
||||
@for dir in ${TARGETS}; do \
|
||||
if [[ ! -d $$dir ]]; then \
|
||||
echo "$0: FATAL: not a sub-directory: $$dir" 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [[ ! -f $$dir/Makefile ]]; then \
|
||||
echo "$0: FATAL: not a file: $$dir/Makefile" 1>&2; \
|
||||
exit 2; \
|
||||
fi; \
|
||||
echo "make -C \"$$dir\" $@"; \
|
||||
make -C "$$dir" $@; \
|
||||
done
|
||||
|
||||
clean:
|
||||
@for dir in ${TARGETS}; do \
|
||||
if [[ ! -d $$dir ]]; then \
|
||||
echo "$0: FATAL: not a sub-directory: $$dir" 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [[ ! -f $$dir/Makefile ]]; then \
|
||||
echo "$0: FATAL: not a file: $$dir/Makefile" 1>&2; \
|
||||
exit 2; \
|
||||
fi; \
|
||||
echo "make -C \"$$dir\" $@"; \
|
||||
make -C "$$dir" $@; \
|
||||
done
|
||||
|
||||
clobber: clean
|
||||
@for dir in ${TARGETS}; do \
|
||||
if [[ ! -d $$dir ]]; then \
|
||||
echo "$0: FATAL: not a sub-directory: $$dir" 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [[ ! -f $$dir/Makefile ]]; then \
|
||||
echo "$0: FATAL: not a file: $$dir/Makefile" 1>&2; \
|
||||
exit 2; \
|
||||
fi; \
|
||||
echo "make -C \"$$dir\" $@"; \
|
||||
make -C "$$dir" $@; \
|
||||
done
|
||||
|
||||
install: all
|
||||
@for dir in ${TARGETS}; do \
|
||||
if [[ ! -d $$dir ]]; then \
|
||||
echo "$0: FATAL: not a sub-directory: $$dir" 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [[ ! -f $$dir/Makefile ]]; then \
|
||||
echo "$0: FATAL: not a file: $$dir/Makefile" 1>&2; \
|
||||
exit 2; \
|
||||
fi; \
|
||||
echo "make -C \"$$dir\" $@"; \
|
||||
make -C "$$dir" $@; \
|
||||
done
|
||||
@@ -0,0 +1 @@
|
||||
sgit
|
||||
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# sgit - run sed on all files under git control
|
||||
#
|
||||
# Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software and
|
||||
# its documentation for any purpose and without fee is hereby granted,
|
||||
# provided that the above copyright, this permission notice and text
|
||||
# this comment, and the disclaimer below appear in all of the following:
|
||||
#
|
||||
# supporting documentation
|
||||
# source copies
|
||||
# source works derived from this source
|
||||
# binaries derived from this source or from derived source
|
||||
#
|
||||
# LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
# EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# chongo (Landon Curt Noll, http://www.isthe.com/chongo/index.html) /\oo/\
|
||||
#
|
||||
# Share and enjoy! :-)
|
||||
|
||||
#############
|
||||
# utilities #
|
||||
#############
|
||||
|
||||
CC= cc
|
||||
CHMOD= chmod
|
||||
CP= cp
|
||||
INSTALL= install
|
||||
RM= rm
|
||||
SHELL= bash
|
||||
|
||||
#CFLAGS= -O3 -g3 --pedantic -Wall -Werror
|
||||
CFLAGS= -O3 -g3 --pedantic -Wall
|
||||
|
||||
######################
|
||||
# target information #
|
||||
######################
|
||||
|
||||
DESTDIR= ../../bin
|
||||
|
||||
TARGETS= sgit
|
||||
|
||||
######################################
|
||||
# all - default rule - must be first #
|
||||
######################################
|
||||
|
||||
all: ${TARGETS}
|
||||
|
||||
winner_name: winner_name.sh
|
||||
${RM} -f -v $@
|
||||
${CP} -f -v $? $@
|
||||
${CHMOD} +x $@
|
||||
|
||||
#################################################
|
||||
# .PHONY list of rules that do not create files #
|
||||
#################################################
|
||||
|
||||
.PHONY: all configure clean clobber install
|
||||
|
||||
###################################
|
||||
# standard Makefile utility rules #
|
||||
###################################
|
||||
|
||||
configure:
|
||||
@:
|
||||
|
||||
clean:
|
||||
@:
|
||||
|
||||
clobber: clean
|
||||
rm -f ${TARGETS}
|
||||
|
||||
install: all
|
||||
${INSTALL} -m 0555 ${TARGETS} ${DESTDIR}
|
||||
File renamed without changes.
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# sgit - run sed (by default with -i) on all files (or one or more globs) under
|
||||
# git control
|
||||
# sgit - run sed on all files under git control
|
||||
#
|
||||
# This script allows one to run sed under git control without having to come up
|
||||
# with a list of files first and then passing those to the command.
|
||||
@@ -0,0 +1 @@
|
||||
winner_name
|
||||
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# winner_name - extract NAME handles from winners.html
|
||||
#
|
||||
# Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software and
|
||||
# its documentation for any purpose and without fee is hereby granted,
|
||||
# provided that the above copyright, this permission notice and text
|
||||
# this comment, and the disclaimer below appear in all of the following:
|
||||
#
|
||||
# supporting documentation
|
||||
# source copies
|
||||
# source works derived from this source
|
||||
# binaries derived from this source or from derived source
|
||||
#
|
||||
# LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
# EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# chongo (Landon Curt Noll, http://www.isthe.com/chongo/index.html) /\oo/\
|
||||
#
|
||||
# Share and enjoy! :-)
|
||||
|
||||
#############
|
||||
# utilities #
|
||||
#############
|
||||
|
||||
CC= cc
|
||||
CHMOD= chmod
|
||||
CP= cp
|
||||
INSTALL= install
|
||||
RM= rm
|
||||
SHELL= bash
|
||||
|
||||
#CFLAGS= -O3 -g3 --pedantic -Wall -Werror
|
||||
CFLAGS= -O3 -g3 --pedantic -Wall
|
||||
|
||||
######################
|
||||
# target information #
|
||||
######################
|
||||
|
||||
DESTDIR= ../../bin
|
||||
|
||||
TARGETS= winner_name
|
||||
|
||||
######################################
|
||||
# all - default rule - must be first #
|
||||
######################################
|
||||
|
||||
all: ${TARGETS}
|
||||
|
||||
winner_name: winner_name.sh
|
||||
${RM} -f -v $@
|
||||
${CP} -f -v $? $@
|
||||
${CHMOD} +x $@
|
||||
|
||||
#################################################
|
||||
# .PHONY list of rules that do not create files #
|
||||
#################################################
|
||||
|
||||
.PHONY: all configure clean clobber install
|
||||
|
||||
###################################
|
||||
# standard Makefile utility rules #
|
||||
###################################
|
||||
|
||||
configure:
|
||||
@:
|
||||
|
||||
clean:
|
||||
@:
|
||||
|
||||
clobber: clean
|
||||
rm -f ${TARGETS}
|
||||
|
||||
install: all
|
||||
${INSTALL} -m 0555 ${TARGETS} ${DESTDIR}
|
||||
Executable
+147
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# winner_name - extract NAME tags from winners.html
|
||||
#
|
||||
# Print NAME tags from a winners.html. By default print just the winner_id renamed NAME tags.
|
||||
#
|
||||
# Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software and
|
||||
# its documentation for any purpose and without fee is hereby granted,
|
||||
# provided that the above copyright, this permission notice and text
|
||||
# this comment, and the disclaimer below appear in all of the following:
|
||||
#
|
||||
# supporting documentation
|
||||
# source copies
|
||||
# source works derived from this source
|
||||
# binaries derived from this source or from derived source
|
||||
#
|
||||
# LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
# EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# chongo (Landon Curt Noll, http://www.isthe.com/chongo/index.html) /\oo/\
|
||||
#
|
||||
# Share and enjoy! :-)
|
||||
|
||||
# setup
|
||||
#
|
||||
export VERSION="1.0 2023-05-15"
|
||||
NAME=$(basename "$0")
|
||||
export NAME
|
||||
#
|
||||
export A_FLAG=
|
||||
export V_FLAG=0
|
||||
export WINNERS_HTML="./winners.html"
|
||||
|
||||
# usage
|
||||
#
|
||||
export USAGE="usage: $0 [-h] [-v level] [-V] [-a] [winners.html]
|
||||
|
||||
-h print help message and exit
|
||||
-v level set verbosity level (def level: $V_FLAG)
|
||||
-V print version string and exit
|
||||
-a print all NAME tags (def: print just winner_id NAMEs)
|
||||
|
||||
winners.html path of winners.html (def: ./winners.html)
|
||||
|
||||
Exit codes:
|
||||
0 all OK
|
||||
1 winners.html does not exist, not a file, not readable
|
||||
2 -h and help string printed or -V and version string printed
|
||||
3 command line error
|
||||
>= 10 internal error
|
||||
|
||||
$NAME version: $VERSION"
|
||||
|
||||
# parse command line
|
||||
#
|
||||
while getopts :hv:Va flag; do
|
||||
case "$flag" in
|
||||
h) echo "$USAGE"
|
||||
exit 2
|
||||
;;
|
||||
v) V_FLAG="$OPTARG"
|
||||
;;
|
||||
V) echo "$VERSION"
|
||||
exit 2
|
||||
;;
|
||||
a) A_FLAG="true"
|
||||
;;
|
||||
\?) echo "$0: ERROR: invalid option: -$OPTARG" 1>&2
|
||||
echo 1>&2
|
||||
echo "$USAGE" 1>&2
|
||||
exit 3
|
||||
;;
|
||||
:) echo "$0: ERROR: option -$OPTARG requires an argument" 1>&2
|
||||
echo 1>&2
|
||||
echo "$USAGE" 1>&2
|
||||
exit 3
|
||||
;;
|
||||
*) echo "$0: ERROR: unexpected value from getopts: $flag" 1>&2
|
||||
echo 1>&2
|
||||
echo "$USAGE" 1>&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [[ $V_FLAG -ge 1 ]]; then
|
||||
echo "$0: debug[1]: debug level: $V_FLAG" 1>&2
|
||||
fi
|
||||
#
|
||||
# remove the options
|
||||
#
|
||||
shift $(( OPTIND - 1 ));
|
||||
#
|
||||
# verify arg count
|
||||
#
|
||||
if [[ $# -gt 1 ]]; then
|
||||
echo "$0: ERROR: expected 0 or 1 args, found: $#" 1>&2
|
||||
echo "$USAGE" 1>&2
|
||||
exit 3
|
||||
fi
|
||||
#
|
||||
# parse args
|
||||
#
|
||||
if [[ $# -gt 0 ]]; then
|
||||
export WINNERS_HTML="$1"
|
||||
fi
|
||||
|
||||
# firewall WINNERS_HTML just be a readable file
|
||||
#
|
||||
if [[ ! -e $WINNERS_HTML ]]; then
|
||||
echo "$0: ERROR: winners.html does not exist: $WINNERS_HTML" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f $WINNERS_HTML ]]; then
|
||||
echo "$0: ERROR: winners.html not a file: $WINNERS_HTML" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -r $WINNERS_HTML ]]; then
|
||||
echo "$0: ERROR: winners.html not a readable file: $WINNERS_HTML" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# case: print only winner_id NAME tags
|
||||
#
|
||||
if [[ -z $A_FLAG ]]; then
|
||||
|
||||
grep -o -i '<a[[:space:]][[:space:]]*name[[:space:]]*=[[:space:]]*"[^"][^"]*"' "$WINNERS_HTML" |
|
||||
sed -e 's/^.*<[Aa][[:space:]][[:space:]]*[Nn][Aa][Mm][Ee][[:space:]]*=[[:space:]]*"//' -e 's/".*//' |
|
||||
grep '^[0-9A-Za-z][0-9A-Za-z]*_[0-9A-Za-z][0-9A-Za-z]*$'
|
||||
|
||||
# case: print all NAME tags
|
||||
#
|
||||
else
|
||||
|
||||
grep -o -i '<a[[:space:]][[:space:]]*name[[:space:]]*=[[:space:]]*"[^"][^"]*"' "$WINNERS_HTML" |
|
||||
sed -e 's/^.*<[Aa][[:space:]][[:space:]]*[Nn][Aa][Mm][Ee][[:space:]]*=[[:space:]]*"//' -e 's/".*//'
|
||||
fi
|
||||
|
||||
# All Done!!! -- Jessica Noll, Age 2
|
||||
#
|
||||
exit 0
|
||||
@@ -1,4 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# check_awards - check the award lines in README.md files
|
||||
#
|
||||
# XXX - This is a temporary utility that will be replaced when
|
||||
# the .winner.json files are built
|
||||
#
|
||||
# This script was mostly auto-generated with the contents of the
|
||||
# tmp/year-auth-prize.csv file but modified in vim to make it simpler to
|
||||
Reference in new issue
Block a user