commit dd0b7f512331d26795e34763a603f8b8fc0a8722
parent 7fee0ec5e27a3a9d9637bb2ac0593a03cfa6a289
Author: Kris Maglione <jg@suckless.org>
Date: Thu, 22 Mar 2007 17:00:27 -0400
X/\.c$/ ,s/wmiiwm/wmii/g. Don't use printf (may malloc) on malloc failure.
Diffstat:
15 files changed, 56 insertions(+), 31 deletions(-)
diff --git a/area.c b/area.c
@@ -1,5 +1,5 @@
-/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
- * © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
+/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
+ * ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
#include <assert.h>
@@ -82,7 +82,8 @@ destroy_area(Area *a) {
v = a->view;
- assert(!a->frame && "wmiiwm: fatal, destroying non-empty area");
+ if(a->frame)
+ fatal("destroying non-empty area");
if(v->revert == a)
v->revert = nil;
for(c=client; c; c=c->next)
diff --git a/bar.c b/bar.c
@@ -1,5 +1,5 @@
-/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
- * © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
+/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
+ * ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
#include <math.h>
diff --git a/client.c b/client.c
@@ -1,5 +1,5 @@
-/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
- * © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
+/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
+ * ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
#include <assert.h>
diff --git a/column.c b/column.c
@@ -1,5 +1,5 @@
-/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
- * © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
+/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
+ * ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
#include <assert.h>
diff --git a/draw.c b/draw.c
@@ -1,4 +1,4 @@
-/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
+/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include <stdio.h>
@@ -32,7 +32,7 @@ loadfont(Blitz *blitz, BlitzFont *font) {
font->set = XCreateFontSet(blitz->dpy, fontname, &missing, &n, &def);
if(missing) {
while(n--)
- fprintf(stderr, "wmiiwm: missing fontset for '%s': %s\n",
+ fprintf(stderr, "wmii: missing fontset for '%s': %s\n",
fontname, missing[n]);
XFreeStringList(missing);
}
diff --git a/event.c b/event.c
@@ -1,5 +1,5 @@
-/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
- * © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
+/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
+ * ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
#include <fcntl.h>
diff --git a/frame.c b/frame.c
@@ -1,4 +1,4 @@
-/* © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
+/* ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
#include <stdlib.h>
diff --git a/fs.c b/fs.c
@@ -1,4 +1,4 @@
-/* © 2006 Kris Maglione <fbsdaemon at gmail dot com>
+/* ©2006 Kris Maglione <fbsdaemon at gmail dot com>
* See LICENSE file for license details.
*/
#include <assert.h>
@@ -244,7 +244,7 @@ message_root(char *message)
else if(!strncmp(message, "view ", 5))
select_view(&message[5]);
else if(!strncmp(message, "selcolors ", 10)) {
- fprintf(stderr, "wmiiwm: warning: selcolors have been removed\n");
+ fprintf(stderr, "wmii: warning: selcolors have been removed\n");
return Ebadcmd;
}
else if(!strncmp(message, "focuscolors ", 12)) {
diff --git a/geom.c b/geom.c
@@ -1,4 +1,4 @@
-/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
+/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include "wmii.h"
diff --git a/key.c b/key.c
@@ -1,4 +1,4 @@
-/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
+/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include <string.h>
diff --git a/main.c b/main.c
@@ -1,5 +1,5 @@
-/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
- * © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
+/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
+ * ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
#include <X11/Xatom.h>
@@ -22,7 +22,7 @@
#define nelem(ary) (sizeof(ary) / sizeof(*ary))
static const char
- version[] = "wmiiwm - " VERSION ", ©2007 Kris Maglione\n";
+ version[] = "wmii - " VERSION ", ©2007 Kris Maglione\n";
static int (*x_error_handler) (Display *, XErrorEvent *);
static char *address, *ns_path;
@@ -33,7 +33,7 @@ static int sleeperfd, sock;
static void
usage() {
- fatal("usage: wmiiwm -a <address> [-r <wmiirc>] [-v]\n");
+ fatal("usage: wmii [-a <address>] [-r <wmiirc>] [-v]\n");
}
static void
@@ -281,7 +281,7 @@ wmii_error_handler(Display *dpy, XErrorEvent *error) {
&& error->error_code == BadAccess))
return 0;
- fprintf(stderr, "wmiiwm: fatal error: Xrequest code=%d, Xerror code=%d\n",
+ fprintf(stderr, "wmii: fatal error: Xrequest code=%d, Xerror code=%d\n",
error->request_code, error->error_code);
return x_error_handler(blz.dpy, error); /* calls exit() */
}
diff --git a/mouse.c b/mouse.c
@@ -1,4 +1,4 @@
-/* © 2006 Kris Maglione <fbsdaemon@gmail.com>
+/* ©2006 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
#include <stdlib.h>
diff --git a/rule.c b/rule.c
@@ -1,5 +1,5 @@
/*
- * © 2006 Anselm R. Garbe <garbeam at gmail dot com>
+ * ©2006 Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
diff --git a/util.c b/util.c
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "wmii.h"
void
@@ -13,7 +14,7 @@ fatal(const char *fmt, ...) {
int err;
err = errno;
- fprintf(stderr, "wmiiwm: fatal: ");
+ fprintf(stderr, "wmii: fatal: ");
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
@@ -27,11 +28,34 @@ fatal(const char *fmt, ...) {
exit(1);
}
+/* Can't malloc */
+void
+mfatal(char *name, int size) {
+ const char
+ couldnot[] = "Could not ",
+ paren[] = "() ",
+ bytes[] = " bytes\n";
+ char sizestr[8];
+ int i;
+
+ i = sizeof(sizestr);
+ do {
+ sizestr[--i] = size&8;
+ size >>= 8;
+ } while(size > 0);
+
+ write(1, couldnot, sizeof(couldnot)-1);
+ write(1, name, strlen(name));
+ write(1, paren, sizeof(paren)-1);
+ write(1, sizestr+i, sizeof(sizestr)-i);
+ write(1, bytes, sizeof(bytes)-1);
+}
+
void *
emalloc(uint size) {
void *ret = malloc(size);
if(!ret)
- fatal("could not malloc() %d bytes", size);
+ mfatal("malloc", size);
return ret;
}
@@ -46,7 +70,7 @@ void *
erealloc(void *ptr, uint size) {
void *ret = realloc(ptr, size);
if(!ret)
- fatal("fatal: could not realloc() %d bytes", size);
+ mfatal("realloc", size);
return ret;
}
@@ -54,7 +78,7 @@ char *
estrdup(const char *str) {
void *ret = strdup(str);
if(!ret)
- fatal("fatal: could not strdup() %u bytes", strlen(str));
+ mfatal("strdup", strlen(str));
return ret;
}
diff --git a/view.c b/view.c
@@ -1,5 +1,5 @@
-/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
- * © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
+/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
+ * ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/