X-Git-Url: https://jasonwoof.com/gitweb/?p=st.git;a=blobdiff_plain;f=st.c;h=39d3fee36017a0fd73301e64f3942d6612315ce5;hp=00fca99788da317c7853138ab8d4b3d7795c59c9;hb=288f80cb06b442ef0f55ea62bbceb3260338bf7a;hpb=580302f3179ef3f24cf0329755686dfa7100996b diff --git a/st.c b/st.c index 00fca99..39d3fee 100644 --- a/st.c +++ b/st.c @@ -996,6 +996,8 @@ selnotify(XEvent *e) { ofs = 0; xsev = (XSelectionEvent *)e; + if (xsev->property == None) + return; do { if(XGetWindowProperty(xw.dpy, xw.win, xsev->property, ofs, BUFSIZ/4, False, AnyPropertyType, @@ -2270,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