From: twittner Date: Sun, 7 Nov 2004 15:14:20 +0000 (+0000) Subject: - added registry-misc_fixes.patch: X-Git-Tag: auto/th/elektra-0.7.2-1~21 X-Git-Url: http://git.pld-linux.org/?p=packages%2Felektra.git;a=commitdiff_plain;h=7b654bce9ea2ed128f7f1dca403308c85fd3cfa9;hp=c544b4cad3d52879cb4705b6e0484cabb3570e3d;ds=sidebyside - added registry-misc_fixes.patch: Makefile: allow pass CC, CFLAGS, added -Wall, added CC, CFLAGS to spec (to sb.: don't even try your stupid cosmetics) - C sources: added missing includes, replaced (r)index with str(r)chr, added missing parentheses around assignment used as truth value. - rel. 1.1 - builds but not tested. Changed files: elektra.spec -> 1.6 registry-misc_fixes.patch -> 1.1 --- diff --git a/elektra.spec b/elektra.spec index dc5ad11..bbeaa82 100644 --- a/elektra.spec +++ b/elektra.spec @@ -2,12 +2,13 @@ Summary: A registry to store general key-value pairs instead of text configurati Summary(pl): Rejestr do przechowywania par klucz-warto¶æ u¿ywany zamiast plików konfiguracyjnych Name: registry Version: 0.1.6 -Release: 1 +Release: 1.1 License: LGPL Vendor: Avi Alkalay Group: Base Source0: http://dl.sourceforge.net/%{name}/%{name}-%{version}.tar.gz # Source0-md5: 04f05693c7be8da6db64f59129b92cf3 +Patch0: %{name}-misc_fixes.patch URL: http://registry.sf.net BuildRequires: docbook-style-xsl BuildRequires: libxslt-progs @@ -161,9 +162,10 @@ aplikacji wraz z Rejestrem. %prep %setup -q -n registry +%patch0 -p1 %build -%{__make} all +%{__make} all CC="%{__cc}" CFLAGS="%{rpmcflags}" %install rm -rf $RPM_BUILD_ROOT diff --git a/registry-misc_fixes.patch b/registry-misc_fixes.patch new file mode 100644 index 0000000..8f4f44f --- /dev/null +++ b/registry-misc_fixes.patch @@ -0,0 +1,150 @@ +--- 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);