Last change
on this file was
6100,
checked in by westram, 16 years ago
|
- fix warning "format not a string literal and no format arguments"
- GB_export_error → GB_export_error/GB_export_errorf
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.2 KB
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | #include <stdlib.h> |
---|
3 | #include <string.h> |
---|
4 | #include "adlocal.h" |
---|
5 | /* #include <arbdb.h> */ |
---|
6 | |
---|
7 | |
---|
8 | GBDATA *GB_follow_link(GBDATA *gb_link){ |
---|
9 | char *s; |
---|
10 | const char *link; |
---|
11 | char c; |
---|
12 | GB_MAIN_TYPE *Main = GB_MAIN(gb_link); |
---|
13 | GBDATA *result; |
---|
14 | GB_Link_Follower lf; |
---|
15 | link = (char *)GB_read_link_pntr(gb_link); |
---|
16 | if (!link) return 0; |
---|
17 | s = strchr(link,':'); |
---|
18 | if (!s){ |
---|
19 | GB_export_errorf("Your link '%s' does not contain a ':' character",link); |
---|
20 | return 0; |
---|
21 | } |
---|
22 | c = *s; |
---|
23 | *s = 0; |
---|
24 | lf = (GB_Link_Follower)GBS_read_hash(Main->resolve_link_hash,link); |
---|
25 | *s = c; |
---|
26 | if (!lf){ |
---|
27 | GB_export_errorf("Your link tag '%s' is unknown to the system",link); |
---|
28 | return 0; |
---|
29 | } |
---|
30 | result = lf(GB_get_root(gb_link),gb_link,s+1); |
---|
31 | return result; |
---|
32 | } |
---|
33 | |
---|
34 | |
---|
35 | GB_ERROR GB_install_link_follower(GBDATA *gb_main, const char *link_type, GB_Link_Follower link_follower){ |
---|
36 | GB_ERROR error =0; |
---|
37 | GB_MAIN_TYPE *Main = GB_MAIN(gb_main); |
---|
38 | if (!Main->resolve_link_hash){ |
---|
39 | Main->resolve_link_hash = GBS_create_hash(256, GB_MIND_CASE); |
---|
40 | } |
---|
41 | error = GB_check_link_name(link_type); |
---|
42 | if (error) return error; |
---|
43 | GBS_write_hash(Main->resolve_link_hash, link_type,(long)link_follower); |
---|
44 | return 0; |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
Note: See
TracBrowser
for help on using the repository browser.