|
Last change
on this file was
2,
checked in by oldcode, 25 years ago
|
|
Initial revision
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | #include <stdio.h> |
|---|
| 2 | #include <stdlib.h> |
|---|
| 3 | |
|---|
| 4 | #include "arbdb.h" |
|---|
| 5 | #include "adlocal.h" |
|---|
| 6 | #include "string.h" |
|---|
| 7 | |
|---|
| 8 | typedef struct S_Reffile |
|---|
| 9 | { |
|---|
| 10 | char *quickpath; |
|---|
| 11 | char *user; |
|---|
| 12 | struct S_Reffile *next; |
|---|
| 13 | |
|---|
| 14 | } *Reffile; |
|---|
| 15 | |
|---|
| 16 | static char *referencePath(GB_CSTR arbpath) |
|---|
| 17 | { |
|---|
| 18 | char *copy = GB_STRDUP(arbpath); |
|---|
| 19 | char *ext = |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | static Reffile addReference(Reffile ref, GB_CSTR quickpath, GB_CSTR user) |
|---|
| 23 | { |
|---|
| 24 | |
|---|
| 25 | } |
|---|
| 26 | static Reffile removeReference(Reffile ref, GB_CSTR quickpath) |
|---|
| 27 | { |
|---|
| 28 | |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | static Reffile readReferences(GB_CSTR refpath) |
|---|
| 32 | { |
|---|
| 33 | |
|---|
| 34 | } |
|---|
| 35 | static void writeReferences(Reffile ref, GB_CSTR refpath) |
|---|
| 36 | { |
|---|
| 37 | |
|---|
| 38 | } |
|---|
| 39 | static void freeReferences(Reffile ref) |
|---|
| 40 | { |
|---|
| 41 | while (ref) |
|---|
| 42 | { |
|---|
| 43 | Reffile next = ref->next; |
|---|
| 44 | |
|---|
| 45 | free(ref->quickpath); |
|---|
| 46 | free(ref->user); |
|---|
| 47 | free(ref); |
|---|
| 48 | |
|---|
| 49 | ref = next; |
|---|
| 50 | } |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | int gb_announceReference(GB_CSTR arbpath, GB_CSTR quickpath, GB_CSTR user) |
|---|
| 54 | { |
|---|
| 55 | char *refpath = referencePath(arbpath); |
|---|
| 56 | Reffile ref = readReferences(refpath); |
|---|
| 57 | |
|---|
| 58 | if (!ref || removeReference(ref,quickpath)==NULL) |
|---|
| 59 | { |
|---|
| 60 | ref = addReference(ref,quickpath,user); |
|---|
| 61 | writeReferences(ref,refpath); |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | freeReferences(ref); |
|---|
| 65 | free(refpath); |
|---|
| 66 | return 0; |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | int gb_deleteReference(GB_CSTR arbpath, GB_CSTR quickpath) |
|---|
| 70 | { |
|---|
| 71 | char *refpath = referencePath(arbpath); |
|---|
| 72 | Reffile ref = readReferences(refpath); |
|---|
| 73 | |
|---|
| 74 | ... |
|---|
| 75 | |
|---|
| 76 | freeReferences(ref); |
|---|
| 77 | free(refpath); |
|---|
| 78 | return 0; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.