commit 31c6d443506c0f266b40a906e3a454ccb73cad35
parent 427c7452b4fd1f0a8d960e63f13dad0368240a6d
Author: Anselm R. Garbe <arg@10kloc.org>
Date: Thu, 12 Oct 2006 16:00:23 +0200
necessary change for wmii
Diffstat:
4 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/client.c b/client.c
@@ -9,31 +9,6 @@
#include <sys/types.h>
#include <unistd.h>
-static unsigned int
-tokenize(char **result, unsigned int reslen, char *str, char delim) {
- char *p, *n;
- unsigned int i = 0;
-
- if(!str)
- return 0;
- for(n = str; *n == delim; n++);
- p = n;
- for(i = 0; *n != 0;) {
- if(i == reslen)
- return i;
- if(*n == delim) {
- *n = 0;
- if(strlen(p))
- result[i++] = p;
- p = ++n;
- } else
- n++;
- }
- if((i < reslen) && (p < n) && strlen(p))
- result[i++] = p;
- return i; /* number of tokens */
-}
-
int
ixp_client_do_fcall(IXPClient *c) {
static unsigned char msg[IXP_MAX_MSG];
@@ -126,7 +101,7 @@ ixp_client_walk(IXPClient *c, unsigned int newfid, char *filepath) {
c->ifcall.newfid = newfid;
if(filepath) {
c->ifcall.name = filepath;
- c->ifcall.nwname = tokenize(wname, IXP_MAX_WELEM, c->ifcall.name, '/');
+ c->ifcall.nwname = ixp_tokenize(wname, IXP_MAX_WELEM, c->ifcall.name, '/');
for(i = 0; i < c->ifcall.nwname; i++)
c->ifcall.wname[i] = wname[i];
}
diff --git a/config.mk b/config.mk
@@ -5,6 +5,7 @@ VERSION = 0.1
# paths
PREFIX = /usr/local
+MANPREFIX = ${PREFIX}/share/man
# includes and libs
INCS = -I. -I/usr/include
diff --git a/ixp.h b/ixp.h
@@ -373,3 +373,4 @@ extern void * ixp_emallocz(unsigned int size);
extern void ixp_eprint(const char *errstr, ...);
extern void * ixp_erealloc(void *ptr, unsigned int size);
extern char * ixp_estrdup(const char *str);
+extern unsigned int ixp_tokenize(char **result, unsigned int reslen, char *str, char delim);
diff --git a/util.c b/util.c
@@ -54,3 +54,28 @@ ixp_estrdup(const char *str) {
ixp_eprint("fatal: could not malloc() %u bytes\n", strlen(str));
return res;
}
+
+unsigned int
+ixp_tokenize(char **result, unsigned int reslen, char *str, char delim) {
+ char *p, *n;
+ unsigned int i = 0;
+
+ if(!str)
+ return 0;
+ for(n = str; *n == delim; n++);
+ p = n;
+ for(i = 0; *n != 0;) {
+ if(i == reslen)
+ return i;
+ if(*n == delim) {
+ *n = 0;
+ if(strlen(p))
+ result[i++] = p;
+ p = ++n;
+ } else
+ n++;
+ }
+ if((i < reslen) && (p < n) && strlen(p))
+ result[i++] = p;
+ return i; /* number of tokens */
+}