shell.h (bed-3.0.3.src.tar.xz) | : | shell.h (bed-3.1.0.src.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
#include <sys/signal.h> | #include <sys/signal.h> | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#include "varmacro.h" | #include "varmacro.h" | |||
template<typename T,typename ... Ts> | template<typename T,typename ... Ts> | |||
int process(T com,Ts... args) { | int process(T com,Ts... args) { | |||
int statusdieprocessreturns; | int statusdieprocessreturns; | |||
return (fork()?(wait(&statusdieprocessreturns),statusdieprocessreturns): ( (execlp(com,com,args...,NULL), perror(com)), exit(4),1)); | return (fork()?(wait(&statusdieprocessreturns),statusdieprocessreturns): ( (execlp(com,com,args...,NULL), perror(com)), exit(4),1)); | |||
} | } | |||
#else | ||||
#include "strconcat.h" | ||||
/* | ||||
template<typename T,typename ... Ts> | ||||
void procbuf(char *buf,T one,Ts... args) { | ||||
int len=strlen(one); | ||||
memcpy(buf,one,len); | ||||
if constexpr (sizeof...(args)) { | ||||
buf[len++]=' '; | ||||
procbuf(buf+len,args...); | ||||
} | ||||
else | ||||
buf[len]='\0'; | ||||
} | ||||
template<typename ... Ts> int process(Ts ... args) { | ||||
char buf[1024]; | ||||
procbuf(buf,args...); | ||||
return system(buf); | ||||
} | ||||
*/ | ||||
template<typename ... Ts> int process(Ts ... args) { | ||||
strconcat command(string_view(" "),args ...); | ||||
return system(command.data()); | ||||
} | ||||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 26 lines changed or added |