---
st.c | 45 +++++++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/st.c b/st.c
index da5f78d..9789eef 100644
--- a/st.c
+++ b/st.c
_AT_@ -431,7 +431,7 @@ xmalloc(size_t len) {
void *p = malloc(len);
if(!p)
- die("Out of memory\n");
+ die("Out of memory");
return p;
}
_AT_@ -439,7 +439,7 @@ xmalloc(size_t len) {
void *
xrealloc(void *p, size_t len) {
if((p = realloc(p, len)) == NULL)
- die("Out of memory\n");
+ die("Out of memory");
return p;
}
_AT_@ -449,7 +449,7 @@ xcalloc(size_t nmemb, size_t size) {
void *p = calloc(nmemb, size);
if(!p)
- die("Out of memory\n");
+ die("Out of memory");
return p;
}
_AT_@ -890,6 +890,7 @@ die(const char *errstr, ...) {
va_start(ap, errstr);
vfprintf(stderr, errstr, ap);
+ fputc('\n', stderr);
va_end(ap);
exit(EXIT_FAILURE);
}
_AT_@ -934,7 +935,7 @@ sigchld(int a) {
int stat = 0;
if(waitpid(pid, &stat, 0) < 0)
- die("Waiting for pid %hd failed: %s\n", pid, SERRNO);
+ die("Waiting for pid %hd failed: %s", pid, SERRNO);
if(WIFEXITED(stat)) {
exit(WEXITSTATUS(stat));
_AT_@ -950,11 +951,11 @@ ttynew(void) {
/* seems to work fine on linux, openbsd and freebsd */
if(openpty(&m, &s, NULL, NULL, &w) < 0)
- die("openpty failed: %s\n", SERRNO);
+ die("openpty failed: %s", SERRNO);
switch(pid = fork()) {
case -1:
- die("fork failed\n");
+ die("fork failed");
break;
case 0:
setsid(); /* create a new process group */
_AT_@ -962,7 +963,7 @@ ttynew(void) {
dup2(s, STDOUT_FILENO);
dup2(s, STDERR_FILENO);
if(ioctl(s, TIOCSCTTY, NULL) < 0)
- die("ioctl TIOCSCTTY failed: %s\n", SERRNO);
+ die("ioctl TIOCSCTTY failed: %s", SERRNO);
close(s);
close(m);
execsh();
_AT_@ -1004,7 +1005,7 @@ ttyread(void) {
/* append read bytes to unprocessed bytes */
if((ret = read(cmdfd, buf+buflen, LEN(buf)-buflen)) < 0)
- die("Couldn't read from shell: %s\n", SERRNO);
+ die("Couldn't read from shell: %s", SERRNO);
/* process every complete utf8 char */
buflen += ret;
_AT_@ -1024,7 +1025,7 @@ ttyread(void) {
void
ttywrite(const char *s, size_t n) {
if(write(cmdfd, s, n) == -1)
- die("write error on tty: %s\n", SERRNO);
+ die("write error on tty: %s", SERRNO);
}
void
_AT_@ -2204,7 +2205,7 @@ xloadcols(void) {
if(!colorname[i])
continue;
if(!XftColorAllocName(xw.dpy, xw.vis, xw.cmap, colorname[i], &dc.col[i])) {
- die("Could not allocate color '%s'\n", colorname[i]);
+ die("Could not allocate color '%s'", colorname[i]);
}
}
_AT_@ -2216,7 +2217,7 @@ xloadcols(void) {
color.green = g == 0 ? 0 : 0x3737 + 0x2828 * g;
color.blue = b == 0 ? 0 : 0x3737 + 0x2828 * b;
if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, &dc.col[i])) {
- die("Could not allocate color %d\n", i);
+ die("Could not allocate color %d", i);
}
i++;
}
_AT_@ -2227,7 +2228,7 @@ xloadcols(void) {
color.red = color.green = color.blue = 0x0808 + 0x0a0a * r;
if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color,
&dc.col[i])) {
- die("Could not allocate color %d\n", i);
+ die("Could not allocate color %d", i);
}
}
}
_AT_@ -2314,7 +2315,7 @@ xloadfonts(char *fontstr, int fontsize) {
}
if(!pattern)
- die("st: can't open font %s\n", fontstr);
+ die("st: can't open font %s", fontstr);
if(fontsize > 0) {
FcPatternDel(pattern, FC_PIXEL_SIZE);
_AT_@ -2335,7 +2336,7 @@ xloadfonts(char *fontstr, int fontsize) {
}
if(xloadfont(&dc.font, pattern))
- die("st: can't open font %s\n", fontstr);
+ die("st: can't open font %s", fontstr);
/* Setting character width and height. */
xw.cw = dc.font.width;
_AT_@ -2344,16 +2345,16 @@ xloadfonts(char *fontstr, int fontsize) {
FcPatternDel(pattern, FC_WEIGHT);
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
if(xloadfont(&dc.bfont, pattern))
- die("st: can't open font %s\n", fontstr);
+ die("st: can't open font %s", fontstr);
FcPatternDel(pattern, FC_SLANT);
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
if(xloadfont(&dc.ibfont, pattern))
- die("st: can't open font %s\n", fontstr);
+ die("st: can't open font %s", fontstr);
FcPatternDel(pattern, FC_WEIGHT);
if(xloadfont(&dc.ifont, pattern))
- die("st: can't open font %s\n", fontstr);
+ die("st: can't open font %s", fontstr);
FcPatternDestroy(pattern);
}
_AT_@ -2374,7 +2375,7 @@ xinit(void) {
int sw, sh, major, minor;
if(!(xw.dpy = XOpenDisplay(NULL)))
- die("Can't open display\n");
+ die("Can't open display");
xw.scr = XDefaultScreen(xw.dpy);
xw.vis = XDefaultVisual(xw.dpy, xw.scr);
_AT_@ -2423,7 +2424,7 @@ xinit(void) {
/* double buffering */
if(!XdbeQueryExtension(xw.dpy, &major, &minor))
- die("Xdbe extension is not present\n");
+ die("Xdbe extension is not present");
xw.buf = XdbeAllocateBackBufferName(xw.dpy, xw.win, XdbeCopied);
/* Xft rendering context */
_AT_@ -2432,12 +2433,12 @@ xinit(void) {
/* input methods */
xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL);
if(xw.xim == NULL)
- die("XOpenIM failed. Could not open input device.\n");
+ die("XOpenIM failed. Could not open input device.");
xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing
| XIMStatusNothing, XNClientWindow, xw.win,
XNFocusWindow, xw.win, NULL);
if(xw.xic == NULL)
- die("XCreateIC failed. Could not obtain input method.\n");
+ die("XCreateIC failed. Could not obtain input method.");
/* white cursor, black outline */
cursor = XCreateFontCursor(xw.dpy, XC_xterm);
_AT_@ -2869,7 +2870,7 @@ run(void) {
if(select(MAX(xfd, cmdfd)+1, &rfd, NULL, NULL, tv) < 0) {
if(errno == EINTR)
continue;
- die("select failed: %s\n", SERRNO);
+ die("select failed: %s", SERRNO);
}
/*
--
1.7.10.4
Received on Tue Dec 11 2012 - 09:10:30 CET
This archive was generated by hypermail 2.3.0 : Tue Dec 11 2012 - 09:12:04 CET