commit a2e48172adb86561f47edf6b07e88c1c1780880c
parent 5811ab9b2540ad138f92df81e456185aa6921d9c
Author: garbeam <garbeam@localhost.wmii.de>
Date: Thu, 8 Dec 2005 02:46:45 +0200
made string termination Ken Thompson-compliant
Diffstat:
17 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -162,7 +162,7 @@ void handle_client_property(Client * c, XPropertyEvent * e)
char buf[1024];
long msize;
- buf[0] = '\0';
+ buf[0] = 0;
if (e->state == PropertyDelete)
return; /* ignore */
diff --git a/cmd/wmibar.c b/cmd/wmibar.c
@@ -322,7 +322,7 @@ static void handle_buttonpress(XButtonPressedEvent * e)
for (i = 0; items && items[i]; i++) {
if (blitz_ispointinrect(e->x, e->y, &items[i]->d.rect)) {
- path[0] = '\0';
+ path[0] = 0;
wmii_get_ixppath(items[i]->root, path, sizeof(path));
snprintf(buf, MAX_BUF, "%s/b%upress", path, e->button);
if ((p = ixp_walk(ixps, buf)))
@@ -371,7 +371,7 @@ static void handle_after_write(IXPServer * s, File * f)
Item *item;
char buf[512];
- buf[0] = '\0';
+ buf[0] = 0;
if (!strncmp(f->name, "data", 5)) {
if ((item = get_item_for_file(f->parent))) {
wmii_get_ixppath(f->parent, buf, sizeof(buf));
@@ -527,7 +527,7 @@ int main(int argc, char *argv[])
XSetErrorHandler(dummy_error_handler);
screen_num = DefaultScreen(dpy);
- geom[0] = '\0';
+ geom[0] = 0;
if (argc > i)
cext_strlcpy(geom, argv[i], sizeof(geom));
diff --git a/cmd/wmifs.c b/cmd/wmifs.c
@@ -126,9 +126,9 @@ static void bind(void *obj, char *arg)
arg);
return; /* shortcut with empty argument */
}
- *sfile = '\0';
+ *sfile = 0;
sfile++;
- if (*sfile == '\0') {
+ if (*sfile == 0) {
fprintf(stderr,
"wmifs: bind: '%s' without socket argument, ignoring\n",
arg);
@@ -209,7 +209,7 @@ static File *fixp_create(IXPServer * s, char *path)
}
/* route to b */
len = strlen(b->prefix);
- b->client->create(b->client, path[len] == '\0' ? "/" : &path[len]);
+ b->client->create(b->client, path[len] == 0 ? "/" : &path[len]);
if (b->client->errstr) {
if (!strcmp(b->client->errstr, DEAD_SERVER))
_unbind(b);
@@ -229,7 +229,7 @@ static File *fixp_open(IXPServer * s, char *path)
}
/* route to b */
len = strlen(b->prefix);
- fd = b->client->open(b->client, path[len] == '\0' ? "/" : &path[len]);
+ fd = b->client->open(b->client, path[len] == 0 ? "/" : &path[len]);
if (b->client->errstr) {
set_error(s, b->client->errstr);
if (!strcmp(b->client->errstr, DEAD_SERVER))
@@ -311,7 +311,7 @@ static void fixp_remove(IXPServer * s, char *path)
}
/* route to b */
len = strlen(b->prefix);
- b->client->remove(b->client, path[len] == '\0' ? "/" : &path[len]);
+ b->client->remove(b->client, path[len] == 0 ? "/" : &path[len]);
if (b->client->errstr) {
set_error(s, b->client->errstr);
if (!strcmp(b->client->errstr, DEAD_SERVER))
diff --git a/cmd/wmikeys.c b/cmd/wmikeys.c
@@ -485,7 +485,7 @@ int main(int argc, char *argv[])
}
XSetErrorHandler(dummy_error_handler);
screen_num = DefaultScreen(dpy);
- size[0] = '\0';
+ size[0] = 0;
if (argc > i)
cext_strlcpy(size, argv[i], sizeof(size));
diff --git a/cmd/wmimenu.c b/cmd/wmimenu.c
@@ -99,7 +99,7 @@ static void _exec(char *cmd)
{
char *rc = cmd;
- if (!cmd || cmd[0] == '\0')
+ if (!cmd || cmd[0] == 0)
return;
if (items && items[0]) {
@@ -349,12 +349,12 @@ static void handle_kpress(XKeyEvent * e)
static char text[4096];
size_t len = 0;
- text[0] = '\0';
+ text[0] = 0;
if (files[M_COMMAND]->content) {
cext_strlcpy(text, files[M_COMMAND]->content, sizeof(text));
len = strlen(text);
}
- buf[0] = '\0';
+ buf[0] = 0;
num = XLookupString(e, buf, sizeof(buf), &ksym, 0);
if (IsFunctionKey(ksym) || IsKeypadKey(ksym)
@@ -448,7 +448,7 @@ static void handle_kpress(XKeyEvent * e)
for (size = 0; items && items[size]; size++);
if (i) {
do
- text[--i] = '\0';
+ text[--i] = 0;
while (size && i && size == update_items(text));
}
set_text(text);
@@ -457,7 +457,7 @@ static void handle_kpress(XKeyEvent * e)
break;
default:
if ((num == 1) && !iscntrl((int) buf[0])) {
- buf[num] = '\0';
+ buf[num] = 0;
if (len > 0)
cext_strlcat(text, buf, sizeof(text));
else
@@ -648,7 +648,7 @@ int main(int argc, char *argv[])
}
screen_num = DefaultScreen(dpy);
- size[0] = '\0';
+ size[0] = 0;
if (argc > i)
cext_strlcpy(size, argv[i], sizeof(size));
diff --git a/cmd/wmir.c b/cmd/wmir.c
@@ -91,7 +91,7 @@ static void perform(char *action, char *file, char *content)
return;
break;
}
- output[out_len] = '\0';
+ output[out_len] = 0;
fprintf(stdout, "%s", output);
}
while (out_len == 2048);
@@ -170,9 +170,9 @@ int main(int argc, char *argv[])
char *action, *file, *content;
while (fgets(line, 4096, stdin)) {
p = line;
- while (*p != '\0' && (*p == ' ' || *p == '\t'))
+ while (*p != 0 && (*p == ' ' || *p == '\t'))
p++;
- if (*p == '\0')
+ if (*p == 0)
continue; /* empty line */
if (strncmp(p, "create ", 7) &&
strncmp(p, "write ", 6) &&
@@ -180,33 +180,33 @@ int main(int argc, char *argv[])
continue;
action = p;
- while (*p != '\0' && *p != ' ' && *p != '\t' && *p != '\n')
+ while (*p != 0 && *p != ' ' && *p != '\t' && *p != '\n')
p++;
- if (*p == '\0' || *p == '\n')
+ if (*p == 0 || *p == '\n')
continue; /* ignore bogus command */
- *p = '\0';
+ *p = 0;
p++;
- while (*p != '\0' && (*p == ' ' || *p == '\t'))
+ while (*p != 0 && (*p == ' ' || *p == '\t'))
p++;
- if (*p == '\0')
+ if (*p == 0)
continue; /* ignore bogus command */
file = p;
- while (*p != '\0' && *p != ' ' && *p != '\t' && *p != '\n')
+ while (*p != 0 && *p != ' ' && *p != '\t' && *p != '\n')
p++;
- if (*p == '\0' || *p == '\n') {
+ if (*p == 0 || *p == '\n') {
content = 0;
- *p = '\0';
+ *p = 0;
} else {
- *p = '\0';
+ *p = 0;
p++;
content = p;
}
- if (file[0] == '\0')
+ if (file[0] == 0)
continue;
if (content) {
static size_t len;
if ((len = strlen(content)))
- content[len - 1] = '\0';
+ content[len - 1] = 0;
}
perform(action, file, content);
if (c->errstr)
diff --git a/libcext/strlcat.c b/libcext/strlcat.c
@@ -34,21 +34,21 @@ size_t cext_strlcat(char *dst, const char *src, size_t siz)
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
- while (n-- != 0 && *d != '\0')
+ while (n-- != 0 && *d != 0)
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return (dlen + strlen(s));
- while (*s != '\0') {
+ while (*s != 0) {
if (n != 1) {
*d++ = *s;
n--;
}
s++;
}
- *d = '\0';
+ *d = 0;
return (dlen + (s - src)); /* count does not include NUL */
}
diff --git a/libcext/strtonum.c b/libcext/strtonum.c
@@ -44,7 +44,7 @@ long long cext_strtonum(const char *numstr, long long minval, long long maxval,
error = INVALID;
else {
ll = strtoll(numstr, &ep, 10);
- if (numstr == ep || *ep != '\0')
+ if (numstr == ep || *ep != 0)
error = INVALID;
else if (errno == ERANGE || ll < minval)
error = TOOSMALL;
diff --git a/libcext/tokenize.c b/libcext/tokenize.c
@@ -16,11 +16,11 @@ size_t cext_tokenize(char **result, size_t reslen, char *str, char delim)
return 0;
for (n = str; *n == ' '; n++);
p = n;
- for (i = 0; *n != '\0';) {
+ for (i = 0; *n != 0;) {
if (i == reslen)
return i;
if (*n == delim) {
- *n = '\0';
+ *n = 0;
if (strlen(p))
result[i++] = p;
p = ++n;
diff --git a/libixp/ramfs.c b/libixp/ramfs.c
@@ -192,7 +192,7 @@ ixp_write(IXPServer * s, int fd, size_t offset, void *content,
}
memcpy((char *) f->content + offset, content, in_len);
/* internal EOF character */
- ((char *) f->content)[f->size] = '\0';
+ ((char *) f->content)[f->size] = 0;
} else if (!offset) {
/* blank file */
if (f->content)
diff --git a/libixp2/client.c b/libixp2/client.c
@@ -62,7 +62,7 @@ int ixp_client_init(IXPClient * c, char *sockfile)
c->fcall.fid = c->root_fid;
c->fcall.afid = IXP_NOFID;
cext_strlcpy(c->fcall.uname, getenv("USER"), sizeof(c->fcall.uname));
- c->fcall.aname[0] = '\0';
+ c->fcall.aname[0] = 0;
if (!do_fcall(c)) {
ixp_client_deinit(c);
return FALSE;
diff --git a/libixp2/convert.c b/libixp2/convert.c
@@ -87,7 +87,7 @@ void *ixp_dec_string(u8 * msg, char *string, u16 stringlen, u16 * len)
return msg;
if (*len > stringlen - 1)
/* might never happen if stringlen == IXP_MAX_MSG */
- string[0] = '\0';
+ string[0] = 0;
else {
memcpy(string, msg, *len);
string[*len] = 0;
diff --git a/liblitz/draw.c b/liblitz/draw.c
@@ -27,7 +27,7 @@ unsigned long blitz_loadcolor(Display * dpy, int mon, char *colstr)
char col[8];
cext_strlcpy(col, colstr, sizeof(col));
- col[7] = '\0';
+ col[7] = 0;
XAllocNamedColor(dpy, DefaultColormap(dpy, mon), col, &color, &color);
return color.pixel;
}
@@ -92,7 +92,7 @@ static void draw_text(Display * dpy, Draw * d)
/* shorten text if necessary */
while (len && (w = XTextWidth(d->font, text, len)) > d->rect.width) {
- text[len - 1] = '\0';
+ text[len - 1] = 0;
len--;
shortened = TRUE;
}
diff --git a/liblitz/kb.c b/liblitz/kb.c
@@ -11,7 +11,7 @@
char *blitz_modtostr(unsigned long mod)
{
char result[60];
- result[0] = '\0';
+ result[0] = 0;
if (mod & ShiftMask)
cext_strlcat(result, "S-", sizeof(result));
diff --git a/liblitz/mouse.c b/liblitz/mouse.c
@@ -13,7 +13,7 @@
char *blitz_buttontostr(unsigned int button)
{
char result[8];
- result[0] = '\0';
+ result[0] = 0;
snprintf(result, 8, "Button%ud", button - Button1);
return cext_estrdup(result);
}
diff --git a/libwmii/ixputil.c b/libwmii/ixputil.c
@@ -32,11 +32,11 @@ void wmii_get_ixppath(File * f, char *path, size_t size)
{
char buf[512];
- buf[0] = '\0';
+ buf[0] = 0;
if (path)
cext_strlcpy(buf, path, sizeof(buf));
snprintf(path, size, "%s/", f->name);
- if (buf[0] != '\0')
+ if (buf[0] != 0)
cext_strlcat(path, buf, size);
if (f->parent)
wmii_get_ixppath(f->parent, path, size);
diff --git a/libwmii/wm.c b/libwmii/wm.c
@@ -40,7 +40,7 @@ void win_prop(Display * dpy, Window w, Atom a, char *res, int len)
cext_strlcpy(res, (char *) prop, len);
XFree(prop);
}
- res[len - 1] = '\0';
+ res[len - 1] = 0;
XSync(dpy, False);
}