1 --- registry/Makefile~ 2004-11-07 15:08:24.889795536 +0100
2 +++ registry/Makefile 2004-11-07 15:12:41.445793096 +0100
4 -CC=gcc -O3 -g -Wcomment -Wformat -Wimplicit-int -Wimplicit-function-declaration -Wparentheses -Wreturn-type -Wunused -Wuninitialized
14 #registryserver: registryserver.o key.o backend-BDB.o
15 -# gcc -o registryserver -lm -lpthread -ldb registryserver.o key.o backend-BDB.o
16 +# $(CC) $(CFLAGS) $(AFLAGS) -o registryserver -lm -lpthread -ldb registryserver.o key.o backend-BDB.o
17 # - [ `id -u` -eq 0 ] && (chown root. registryserver; chmod u+s registryserver)
21 #registryserver.o: registryserver.c registryserver.h registry.h comm.h
22 -# gcc -g -c registryserver.c
23 +# $(CC) $(CFLAGS) $(AFLAGS) -c registryserver.c
27 libregistry.so: localregistry.o key.o
28 - gcc -shared -fpic -o libregistry.so localregistry.o key.o
29 + $(CC) $(CFLAGS) $(AFLAGS) -shared -fpic -o libregistry.so localregistry.o key.o
33 localregistry.o: localregistry.c registry.h
34 - gcc -g -fpic -c localregistry.c
35 + $(CC) $(CFLAGS) $(AFLAGS) -fpic -c localregistry.c
39 #test: test.o registry.h
40 -# gcc -fpic -L. -lregistry -o test test.o
41 +# $(CC) $(CFLAGS) $(AFLAGS) -fpic -L. -lregistry -o test test.o
46 - gcc -g -L. -lregistry -o rg rg.o
47 + $(CC) $(CFLAGS) $(AFLAGS) -L. -lregistry -o rg rg.o
51 diff -Nura registry/key.c n/key.c
52 --- registry/key.c 1970-03-22 13:12:01.000000000 +0100
53 +++ n/key.c 2004-11-07 15:34:52.385459512 +0100
57 size_t strblen(char *s) {
58 - char *found=index(s,0);
59 + char *found=strchr(s,0);
60 if (found) return found-s+1;
67 - parentNameEnd=rindex(key->key,'.');
68 + parentNameEnd=strrchr(key->key,'.');
69 if (!parentNameEnd || parentNameEnd==key->key) {
70 errno=RG_KEY_RET_NOKEY;
72 diff -Nura registry/localregistry.c n/localregistry.c
73 --- registry/localregistry.c 1970-03-23 02:03:44.000000000 +0100
74 +++ n/localregistry.c 2004-11-07 15:34:52.388459056 +0100
87 if (!strcmp(entry->d_name,".") || !strcmp(entry->d_name,"..")) continue;
89 /* Dots ('.') in key name must be escaped */
90 - while (cursor=index(cursor,'.')) {
91 + while (cursor=strchr(cursor,'.')) {
92 if (!transformedName) transformedName=realloc(transformedName,200);
93 strncat(transformedName,lastCursor,cursor-lastCursor);
94 strncat(transformedName,"\\",1);
96 // /* Ignore '.' and '..' directory entries */
97 // if (!strcmp(entry->d_name,".") || !strcmp(entry->d_name,"..")) continue;
99 -// while (cursor=index(cursor,'.')) {
100 +// while (cursor=strchr(cursor,'.')) {
101 // /* Dots ('.') in key name must be escaped */
102 // strncat(transformedName,lastCursor,cursor-lastCursor);
103 // strncat(transformedName,"\\",1);
104 @@ -847,20 +849,20 @@
105 if (stat(keyFileName,&stated))
107 /* check if parent dir already exists */
108 - last=rindex(keyFileName,'/');
109 + last=strrchr(keyFileName,'/');
110 strncpy(folderMaker,keyFileName,last-keyFileName);
111 folderMaker[last-keyFileName]=0;
112 if (stat(folderMaker,&stated)) {
113 /* create all path recursively until before our basename */
114 - last =rindex(keyFileName,'/');
115 - cursor = index(keyFileName,'/'); cursor++; /* skip first occurence */
116 + last =strrchr(keyFileName,'/');
117 + cursor = strchr(keyFileName,'/'); cursor++; /* skip first occurence */
118 if (!last || !cursor) {
119 errno=RG_KEY_RET_INVALIDKEY;
122 - for (cursor=index(cursor,'/');
123 + for (cursor=strchr(cursor,'/');
124 cursor && (cursor <= last);
125 - cursor=index(cursor,'/')) {
126 + cursor=strchr(cursor,'/')) {
127 strncpy(folderMaker,keyFileName,cursor-keyFileName);
128 folderMaker[cursor-keyFileName]=0;
129 /* TODO: use correct user's umask() for dir permissions */
130 diff -Nura registry/localregistry.c n/localregistry.c
131 --- registry/localregistry.c 2004-11-07 15:42:25.202620840 +0100
132 +++ n/localregistry.c 2004-11-07 15:45:12.132243680 +0100
134 realParentName=realloc(realParentName,parentNameSize=keyGetFullNameSize(&parentKey));
135 keyGetFullName(&parentKey,realParentName,parentNameSize);
137 - while (entry=readdir(parentDir)) {
138 + while ( (entry = readdir(parentDir)) ) {
140 char *transformedName=0;
141 char *cursor=entry->d_name;
143 if (!strcmp(entry->d_name,".") || !strcmp(entry->d_name,"..")) continue;
145 /* Dots ('.') in key name must be escaped */
146 - while (cursor=strchr(cursor,'.')) {
147 + while ( (cursor = strchr(cursor,'.')) ) {
148 if (!transformedName) transformedName=realloc(transformedName,200);
149 strncat(transformedName,lastCursor,cursor-lastCursor);
150 strncat(transformedName,"\\",1);