]>
Commit | Line | Data |
---|---|---|
7b654bce | 1 | --- registry/Makefile~ 2004-11-07 15:08:24.889795536 +0100 |
2 | +++ registry/Makefile 2004-11-07 15:12:41.445793096 +0100 | |
3 | @@ -1,4 +1,6 @@ | |
4 | -CC=gcc -O3 -g -Wcomment -Wformat -Wimplicit-int -Wimplicit-function-declaration -Wparentheses -Wreturn-type -Wunused -Wuninitialized | |
5 | +CC = cc | |
6 | +CFLAGS = | |
7 | +AFLAGS = -Wall | |
8 | ||
9 | ||
10 | ||
11 | @@ -20,33 +22,33 @@ | |
12 | ||
13 | ||
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) | |
18 | ||
19 | ||
20 | ||
21 | #registryserver.o: registryserver.c registryserver.h registry.h comm.h | |
22 | -# gcc -g -c registryserver.c | |
23 | +# $(CC) $(CFLAGS) $(AFLAGS) -c registryserver.c | |
24 | ||
25 | ||
26 | ||
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 | |
30 | ||
31 | ||
32 | ||
33 | localregistry.o: localregistry.c registry.h | |
34 | - gcc -g -fpic -c localregistry.c | |
35 | + $(CC) $(CFLAGS) $(AFLAGS) -fpic -c localregistry.c | |
36 | ||
37 | ||
38 | ||
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 | |
42 | ||
43 | ||
44 | ||
45 | rg: rg.o registry.h | |
46 | - gcc -g -L. -lregistry -o rg rg.o | |
47 | + $(CC) $(CFLAGS) $(AFLAGS) -L. -lregistry -o rg rg.o | |
48 | ||
49 | ||
50 | ||
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 | |
54 | @@ -31,7 +31,7 @@ | |
55 | ||
56 | ||
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; | |
61 | return 0; | |
62 | } | |
63 | @@ -814,7 +814,7 @@ | |
64 | return -1; | |
65 | } | |
66 | ||
67 | - parentNameEnd=rindex(key->key,'.'); | |
68 | + parentNameEnd=strrchr(key->key,'.'); | |
69 | if (!parentNameEnd || parentNameEnd==key->key) { | |
70 | errno=RG_KEY_RET_NOKEY; | |
71 | return -1; | |
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 | |
75 | @@ -43,7 +43,9 @@ | |
76 | #include <locale.h> | |
77 | #include <langinfo.h> | |
78 | ||
79 | - | |
80 | +#include <string.h> | |
81 | +#include <ctype.h> | |
82 | +#include <unistd.h> | |
83 | ||
84 | #define UTF8_TO 1 | |
85 | #define UTF8_FROM 0 | |
86 | @@ -587,7 +589,7 @@ | |
87 | if (!strcmp(entry->d_name,".") || !strcmp(entry->d_name,"..")) continue; | |
88 | ||
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); | |
95 | @@ -688,7 +690,7 @@ | |
96 | // /* Ignore '.' and '..' directory entries */ | |
97 | // if (!strcmp(entry->d_name,".") || !strcmp(entry->d_name,"..")) continue; | |
98 | // | |
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)) | |
106 | if (errno==ENOENT) { | |
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; | |
120 | return -1; | |
121 | } | |
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 | |
133 | @@ -578,7 +578,7 @@ | |
134 | realParentName=realloc(realParentName,parentNameSize=keyGetFullNameSize(&parentKey)); | |
135 | keyGetFullName(&parentKey,realParentName,parentNameSize); | |
136 | ||
137 | - while (entry=readdir(parentDir)) { | |
138 | + while ( (entry = readdir(parentDir)) ) { | |
139 | Key *keyEntry; | |
140 | char *transformedName=0; | |
141 | char *cursor=entry->d_name; | |
142 | @@ -589,7 +589,7 @@ | |
143 | if (!strcmp(entry->d_name,".") || !strcmp(entry->d_name,"..")) continue; | |
144 | ||
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); |