| #!/bin/sh | |
| if [ "$#" -ne 2 ] | |
| then | |
| echo Usage: $0 in_file out_file >&2 | |
| echo e.g. $0 zip.h zip_err_str.c >&2 | |
| exit 1 | |
| fi | |
| if [ "$1" = "$2" ] | |
| then | |
| echo $0: error: output file = input file >&2 | |
| exit 1 | |
| fi | |
| echo "/* This file was autogenerated by $0 from $1" > "$2.$$" | |
| echo " -- don't change here */" >> "$2.$$" | |
| echo '#include "zip.h"' >> "$2.$$" | |
| echo 'char *zip_err_str[] = {' >> "$2.$$" | |
| sed -n '/^#define ZERR_/ s/.*\/\* \([^*]*\) \*\// "\1",/p' "$1" >> "$2.$$" | |
| echo '};' >> "$2.$$" | |
| mv "$2.$$" "$2" |