From 288f80cb06b442ef0f55ea62bbceb3260338bf7a Mon Sep 17 00:00:00 2001 From: "Roberto E. Vargas Caballero" Date: Fri, 20 Mar 2015 06:46:59 +0000 Subject: Remove strsep() call strsep() is not a POSIX function, and it means that every system needs different defines to expose it. If the prototype of strsep is not exposed then an ugly int/pointer is done and it might mean a crash. The best solution?, to remove the strsep and make a custom loop. If C programmers cannot do this kind of loops without calling a library function, then maybe we should move all the suckless software to Java. --- st.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'st.c') diff --git a/st.c b/st.c index 68dc2be..39d3fee 100644 --- a/st.c +++ b/st.c @@ -2272,12 +2272,23 @@ strhandle(void) { void strparse(void) { + int c; char *p = strescseq.buf; strescseq.narg = 0; strescseq.buf[strescseq.len] = '\0'; - while(p && strescseq.narg < STR_ARG_SIZ) - strescseq.args[strescseq.narg++] = strsep(&p, ";"); + + if(*p == '\0') + return; + + while(strescseq.narg < STR_ARG_SIZ) { + strescseq.args[strescseq.narg++] = p; + while((c = *p) != ';' && c != '\0') + ++p; + if(c == '\0') + return; + *p++ = '\0'; + } } void -- cgit v1.2.1