X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=300cab631d76ead7242c23e3a0b06162427bd19c;hb=07ce96a3a0f4a650933f5f586082cbf2064ea2c1;hp=f527858c2bdf29c827970004365dd75e154ed703;hpb=0622ad9badefa985231ddede467d2bd8d94e93e4;p=st.git diff --git a/st.c b/st.c index f527858..300cab6 100644 --- a/st.c +++ b/st.c @@ -183,8 +183,8 @@ typedef XftColor Color; typedef struct { long u; /* character code */ ushort mode; /* attribute flags */ - uint32_t fg; /* foreground */ - uint32_t bg; /* background */ + ushort fg; /* foreground */ + ushort bg; /* background */ } Glyph; typedef Glyph *Line; @@ -855,12 +855,11 @@ mousereport(XEvent *e) { } if(!IS_SET(MODE_MOUSEX10)) { - button += (state & ShiftMask ? 4 : 0) - + (state & Mod4Mask ? 8 : 0) - + (state & ControlMask ? 16 : 0); + button += ((state & ShiftMask ) ? 4 : 0) + + ((state & Mod4Mask ) ? 8 : 0) + + ((state & ControlMask) ? 16 : 0); } - len = 0; if(IS_SET(MODE_MOUSESGR)) { len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c", button, x+1, y+1, @@ -1239,10 +1238,14 @@ execsh(void) { void sigchld(int a) { int stat, ret; + pid_t p; - if(waitpid(pid, &stat, 0) < 0) + if((p = waitpid(pid, &stat, WNOHANG)) < 0) die("Waiting for pid %hd failed: %s\n", pid, strerror(errno)); + if(pid != p) + return; + ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE; if (ret != EXIT_SUCCESS) die("child finished with error '%d'\n", stat); @@ -1744,7 +1747,7 @@ tdefcolor(int *attr, int *npar, int l) { b = attr[*npar + 4]; *npar += 4; if(!BETWEEN(r, 0, 255) || !BETWEEN(g, 0, 255) || !BETWEEN(b, 0, 255)) - fprintf(stderr, "erresc: bad rgb color (%d,%d,%d)\n", + fprintf(stderr, "erresc: bad rgb color (%u,%u,%u)\n", r, g, b); else idx = TRUECOLOR(r, g, b);