diff --git a/Makefile b/Makefile index 976e885..583def4 100644 --- a/Makefile +++ b/Makefile @@ -9,15 +9,16 @@ TARGET=pastebincl OBJS=CurlPost.o func.o main.o ParameterRead.o ConfigRead.o all: inputdevcode checkdevcode $(TARGET) - cp $(TARGET) ../ +# cp $(TARGET) ../ inputdevcode: - @if [[ ! -f data_devcode.h ]]; then cp data_devcode_default.h data_devcode.h; fi - @if (( `cat data_devcode.h | grep -c '#define DEVELOPPER_CODE ""'` != 0 )); then echo -e "\n" ; bash input_devcode.sh; fi + + @if ! test -f data_devcode.h; then cp data_devcode_default.h data_devcode.h; fi + @if test `cat data_devcode.h | grep -c '#define DEVELOPPER_CODE ""'` -gt 0 ; then echo -e "\n" ; /bin/bash input_devcode.sh; fi checkdevcode: - @if [[ ! -f data_devcode.h ]]; then echo -e "\nERROR: No 'data_devcode.h' file (common error). Please read \"COMPILE.txt\" for more help.\n" ; false ; fi - @if (( `cat data_devcode.h | grep -c '#define DEVELOPPER_CODE ""'` != 0 )); then echo -e "\nERROR: 'DEVELOPPER_CODE' undefined (common error). Please read \"COMPILE.txt\" for more help.\n" ; false ; fi + @if ! test -f data_devcode.h ; then echo -e "\nERROR: No 'data_devcode.h' file (common error). Please read \"COMPILE.txt\" for more help.\n" ; false ; fi + @if test `cat data_devcode.h | grep -c '#define DEVELOPPER_CODE ""'` -gt 0 ; then echo -e "\nERROR: 'DEVELOPPER_CODE' undefined (common error). Please read \"COMPILE.txt\" for more help.\n" ; false ; fi #### Useful while developping. To enable it, uncomment and add it as a dependence of 'all' #### #makeuser: diff --git a/input_devcode.sh b/input_devcode.sh index af595e5..dd8d749 100755 --- a/input_devcode.sh +++ b/input_devcode.sh @@ -23,6 +23,7 @@ while true; do fi done -sed -ire "49s/\"\".*$/\"${input}\"/" data_devcode.h +sed -i "s/\(#define DEVELOPPER_CODE \)\"\"/\1\"${input}\"/" data_devcode.h +#sed -ire "49s/\"\".*$/\"${input}\"/" data_devcode.h echo "Success!"