]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Migrate from echo to printf. /bin/printf also works
authordrjaska <drjaska83@gmail.com>
Thu, 22 Aug 2024 04:41:51 +0000 (07:41 +0300)
committerdrjaska <drjaska83@gmail.com>
Thu, 22 Aug 2024 04:41:51 +0000 (07:41 +0300)
qcsrc/tools/genmod.sh

index 2d18f68a9173a2b9524d9b6ec0790e309c6a3e4a..726ae9a031ae40ed6a6d58d77813b1abb846df7a 100755 (executable)
@@ -40,16 +40,18 @@ function genmod() {
        # Dr. Jaska: find without some configuration would prefix everything with ./ which is likely unwanted
        for f in $(ls | sed -e "s/^cl_//" -e "s/^sv_//" -e "s/^ui_//" | sort -u)
        do
+               # skip .qc files
                if [[ "$f" != *.qc ]];        then continue; fi
 
-               if [[ -f "$f" ]];             then echo -e "#include <${CTX}$f>"                                        >> ${MOD}.inc; fi
-               if [[ -f "${f%.qc}.qh" ]];    then echo -e "#include <${CTX}${f%.qc}.qh>"                               >> ${MOD}.qh; fi
-               if [[ -f "cl_$f" ]];          then echo -e "#ifdef CSQC\n    #include <${CTX}cl_$f>\n#endif"            >> ${MOD}.inc; fi
-               if [[ -f "cl_${f%.qc}.qh" ]]; then echo -e "#ifdef CSQC\n    #include <${CTX}cl_${f%.qc}.qh>\n#endif"   >> ${MOD}.qh; fi
-               if [[ -f "sv_$f" ]];          then echo -e "#ifdef SVQC\n    #include <${CTX}sv_$f>\n#endif"            >> ${MOD}.inc; fi
-               if [[ -f "sv_${f%.qc}.qh" ]]; then echo -e "#ifdef SVQC\n    #include <${CTX}sv_${f%.qc}.qh>\n#endif"   >> ${MOD}.qh; fi
-               if [[ -f "ui_$f" ]];          then echo -e "#ifdef MENUQC\n    #include <${CTX}ui_$f>\n#endif"          >> ${MOD}.inc; fi
-               if [[ -f "ui_${f%.qc}.qh" ]]; then echo -e "#ifdef MENUQC\n    #include <${CTX}ui_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi
+               if [[ -f "$f" ]];             then printf "#include <%s>\n"                            "${CTX}$f"             >> ${MOD}.inc; fi
+               if [[ -f "${f%.qc}.qh" ]];    then printf "#include <%s>\n"                            "${CTX}${f%.qc}.qh"    >> ${MOD}.qh;  fi
+
+               if [[ -f "cl_$f" ]];          then printf "#ifdef CSQC\n    #include <%s>\n#endif\n"   "${CTX}cl_$f"          >> ${MOD}.inc; fi
+               if [[ -f "cl_${f%.qc}.qh" ]]; then printf "#ifdef CSQC\n    #include <%s>\n#endif\n"   "${CTX}cl_${f%.qc}.qh" >> ${MOD}.qh;  fi
+               if [[ -f "sv_$f" ]];          then printf "#ifdef SVQC\n    #include <%s>\n#endif\n"   "${CTX}sv_$f"          >> ${MOD}.inc; fi
+               if [[ -f "sv_${f%.qc}.qh" ]]; then printf "#ifdef SVQC\n    #include <%s>\n#endif\n"   "${CTX}sv_${f%.qc}.qh" >> ${MOD}.qh;  fi
+               if [[ -f "ui_$f" ]];          then printf "#ifdef MENUQC\n    #include <%s>\n#endif\n" "${CTX}ui_$f"          >> ${MOD}.inc; fi
+               if [[ -f "ui_${f%.qc}.qh" ]]; then printf "#ifdef MENUQC\n    #include <%s>\n#endif\n" "${CTX}ui_${f%.qc}.qh" >> ${MOD}.qh;  fi
        done
 
        declare -l rec=1