check-doc 1.3 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. # checking-doc script by trojal
  3. # modified by lighta
  4. case $1 in
  5. 'script')
  6. #find which script commands are missing from doc/script_commands.txt
  7. echo "Missing script documentation for function :"
  8. awk '/BUILDIN_DEF\(.*\),/ {b=match($0,"BUILDIN_DEF(.*),");c=match($0,",");print substr($0,b+12,c-b-12);}' ../src/map/script.c | xargs -I{} sh -c '! grep -Lq {} ../doc/script_commands.txt && echo {}'
  9. awk '/BUILDIN_DEF2\(.*\),/ {b=match($0,"BUILDIN_DEF2(.*),");c=match($0,",");d=match($0 ,"\",\"");print substr($0,c+2,d-c-2);}' ../src/map/script.c | xargs -I{} sh -c '! grep -Lq {} ../doc/script_commands.txt && echo {}'
  10. ;;
  11. 'atc')
  12. #find which atcommands are missing from doc/atcommands.txt
  13. echo "Missing atcommand documentation for function :"
  14. awk '/ACMD_DEF\(.*\),/ {b=match($0,"ACMD_DEF(.*),");c=match($0,",");print substr($0,b+9,c-b-10);}' ../src/map/atcommand.c | xargs -I{} sh -c '! grep -Lq {} ../doc/atcommands.txt && echo {}'
  15. awk '/ACMD_DEF2\(.*\),/ {b=match($0,"ACMD_DEF2(.*),");c=match($0,",");print substr($0,b+10,c-b-10);}' ../src/map/atcommand.c | xargs -I{} sh -c '! grep -Lq {} ../doc/atcommands.txt && echo {}'
  16. ;;
  17. 'both')
  18. $0 script
  19. $0 atc
  20. ;;
  21. *)
  22. echo "Usage: check-doc { script | atc | both }"
  23. read -p "Enter a valid option: " readEnterKey
  24. $0 $readEnterKey
  25. ;;
  26. esac