#!/bin/sh # # This file is part of Hercules. # http://herc.ws - http://github.com/HerculesWS/Hercules # # Copyright (C) 2012-2020 Hercules Dev Team # checking-doc script by trojal # modified by lighta # # Hercules is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . case $1 in 'script') #find which script commands are missing from doc/script_commands.txt echo "Missing script documentation for function :" 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 {}' 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 {}' ;; 'atc') #find which atcommands are missing from doc/atcommands.txt echo "Missing atcommand documentation for function :" 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 {}' 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 {}' ;; 'both') $0 script $0 atc ;; *) echo "Usage: check-doc { script | atc | both }" ;; esac