--- registry/Makefile~ 2004-11-07 15:08:24.889795536 +0100 +++ registry/Makefile 2004-11-07 15:12:41.445793096 +0100 @@ -1,4 +1,6 @@ -CC=gcc -O3 -g -Wcomment -Wformat -Wimplicit-int -Wimplicit-function-declaration -Wparentheses -Wreturn-type -Wunused -Wuninitialized +CC = cc +CFLAGS = +AFLAGS = -Wall @@ -20,33 +22,33 @@ #registryserver: registryserver.o key.o backend-BDB.o -# gcc -o registryserver -lm -lpthread -ldb registryserver.o key.o backend-BDB.o +# $(CC) $(CFLAGS) $(AFLAGS) -o registryserver -lm -lpthread -ldb registryserver.o key.o backend-BDB.o # - [ `id -u` -eq 0 ] && (chown root. registryserver; chmod u+s registryserver) #registryserver.o: registryserver.c registryserver.h registry.h comm.h -# gcc -g -c registryserver.c +# $(CC) $(CFLAGS) $(AFLAGS) -c registryserver.c libregistry.so: localregistry.o key.o - gcc -shared -fpic -o libregistry.so localregistry.o key.o + $(CC) $(CFLAGS) $(AFLAGS) -shared -fpic -o libregistry.so localregistry.o key.o localregistry.o: localregistry.c registry.h - gcc -g -fpic -c localregistry.c + $(CC) $(CFLAGS) $(AFLAGS) -fpic -c localregistry.c #test: test.o registry.h -# gcc -fpic -L. -lregistry -o test test.o +# $(CC) $(CFLAGS) $(AFLAGS) -fpic -L. -lregistry -o test test.o rg: rg.o registry.h - gcc -g -L. -lregistry -o rg rg.o + $(CC) $(CFLAGS) $(AFLAGS) -L. -lregistry -o rg rg.o diff -Nura registry/key.c n/key.c --- registry/key.c 1970-03-22 13:12:01.000000000 +0100 +++ n/key.c 2004-11-07 15:34:52.385459512 +0100 @@ -31,7 +31,7 @@ size_t strblen(char *s) { - char *found=index(s,0); + char *found=strchr(s,0); if (found) return found-s+1; return 0; } @@ -814,7 +814,7 @@ return -1; } - parentNameEnd=rindex(key->key,'.'); + parentNameEnd=strrchr(key->key,'.'); if (!parentNameEnd || parentNameEnd==key->key) { errno=RG_KEY_RET_NOKEY; return -1; diff -Nura registry/localregistry.c n/localregistry.c --- registry/localregistry.c 1970-03-23 02:03:44.000000000 +0100 +++ n/localregistry.c 2004-11-07 15:34:52.388459056 +0100 @@ -43,7 +43,9 @@ #include #include - +#include +#include +#include #define UTF8_TO 1 #define UTF8_FROM 0 @@ -587,7 +589,7 @@ if (!strcmp(entry->d_name,".") || !strcmp(entry->d_name,"..")) continue; /* Dots ('.') in key name must be escaped */ - while (cursor=index(cursor,'.')) { + while (cursor=strchr(cursor,'.')) { if (!transformedName) transformedName=realloc(transformedName,200); strncat(transformedName,lastCursor,cursor-lastCursor); strncat(transformedName,"\\",1); @@ -688,7 +690,7 @@ // /* Ignore '.' and '..' directory entries */ // if (!strcmp(entry->d_name,".") || !strcmp(entry->d_name,"..")) continue; // -// while (cursor=index(cursor,'.')) { +// while (cursor=strchr(cursor,'.')) { // /* Dots ('.') in key name must be escaped */ // strncat(transformedName,lastCursor,cursor-lastCursor); // strncat(transformedName,"\\",1); @@ -847,20 +849,20 @@ if (stat(keyFileName,&stated)) if (errno==ENOENT) { /* check if parent dir already exists */ - last=rindex(keyFileName,'/'); + last=strrchr(keyFileName,'/'); strncpy(folderMaker,keyFileName,last-keyFileName); folderMaker[last-keyFileName]=0; if (stat(folderMaker,&stated)) { /* create all path recursively until before our basename */ - last =rindex(keyFileName,'/'); - cursor = index(keyFileName,'/'); cursor++; /* skip first occurence */ + last =strrchr(keyFileName,'/'); + cursor = strchr(keyFileName,'/'); cursor++; /* skip first occurence */ if (!last || !cursor) { errno=RG_KEY_RET_INVALIDKEY; return -1; } - for (cursor=index(cursor,'/'); + for (cursor=strchr(cursor,'/'); cursor && (cursor <= last); - cursor=index(cursor,'/')) { + cursor=strchr(cursor,'/')) { strncpy(folderMaker,keyFileName,cursor-keyFileName); folderMaker[cursor-keyFileName]=0; /* TODO: use correct user's umask() for dir permissions */ diff -Nura registry/localregistry.c n/localregistry.c --- registry/localregistry.c 2004-11-07 15:42:25.202620840 +0100 +++ n/localregistry.c 2004-11-07 15:45:12.132243680 +0100 @@ -578,7 +578,7 @@ realParentName=realloc(realParentName,parentNameSize=keyGetFullNameSize(&parentKey)); keyGetFullName(&parentKey,realParentName,parentNameSize); - while (entry=readdir(parentDir)) { + while ( (entry = readdir(parentDir)) ) { Key *keyEntry; char *transformedName=0; char *cursor=entry->d_name; @@ -589,7 +589,7 @@ if (!strcmp(entry->d_name,".") || !strcmp(entry->d_name,"..")) continue; /* Dots ('.') in key name must be escaped */ - while (cursor=strchr(cursor,'.')) { + while ( (cursor = strchr(cursor,'.')) ) { if (!transformedName) transformedName=realloc(transformedName,200); strncat(transformedName,lastCursor,cursor-lastCursor); strncat(transformedName,"\\",1);