git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@632 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-07 21:13:56 +00:00
parent 6bea5a96b5
commit 962cd2e1c1
5 changed files with 30 additions and 16 deletions

11
m4/util/afterdot.m4 Normal file
View File

@@ -0,0 +1,11 @@
dnl $Id$
define([afterdot],[pushdef([rindex])dnl
define([rindex],index([$1],[.]))dnl
define([rindex],ifelse(rindex,[-1],len([$1]),rindex))dnl
substr([$1],[0],rindex)$2[]dnl
popdef([rindex])])dnl
dnl
define([afterdots],[pushdef([first])dnl
define([first],1)dnl
foreach([x],space_to_comma($1),[ifelse(first,[1],[define([first],0)],[ ])afterdot(x,$2)])dnl
popdef([first])])dnl

View File

@@ -1,3 +1,5 @@
dnl $Id$
define([space_to_comma],[_space_to_comma(patsubst([$*],[ ],[,]))])dnl
define([_space_to_comma],[ifelse([$#],[0],[],[$#],[1],[$1],[$1[,]_space_to_comma(shift($@))])])dnl
define([space_to_comma],[pushdef([rindex])dnl
define([rindex],index([$*],[ ]))dnl
ifelse(rindex,[-1],[$*],[substr([$*],0,rindex)[,]space_to_comma(substr([$*],eval(rindex + 1)))])[]dnl
popdef([rindex])])dnl

View File

@@ -1,2 +1,3 @@
dnl $Id$
define([my_syscmd],[syscmd([$1 > my_syscmd_out.out])include(my_syscmd_out.out)syscmd([sh -c "rm -f my_syscmd_out.out"])])dnl
define([my_syscmd],[syscmd([$* | tr '\n' ' ' | sed 's/ $//' > my_syscmd_out.out])dnl
include(my_syscmd_out.out)[]syscmd([sh -c "rm -f my_syscmd_out.out"])])dnl