37 |
const char *g_authname = NULL; /* name of authority */ |
const char *g_authname = NULL; /* name of authority */ |
38 |
const char *g_authpass = NULL; /* password of authority */ |
const char *g_authpass = NULL; /* password of authority */ |
39 |
int g_viewmode = VM_PROT; /* viewing mode */ |
int g_viewmode = VM_PROT; /* viewing mode */ |
|
int g_condopts = 0; /* options of the search condtion */ |
|
40 |
int g_nonparse = FALSE; /* whether to output response headers */ |
int g_nonparse = FALSE; /* whether to output response headers */ |
41 |
CBLIST *g_exheaders = NULL; /* extension headers */ |
CBLIST *g_exheaders = NULL; /* extension headers */ |
42 |
|
|
61 |
static int procuriid(const char *nurl, const char *uri); |
static int procuriid(const char *nurl, const char *uri); |
62 |
static int procinform(const char *nurl); |
static int procinform(const char *nurl); |
63 |
static int procsearch(const char *nurl, const char *phrase, |
static int procsearch(const char *nurl, const char *phrase, |
64 |
const CBLIST *attrs, const char *ord, int max, int depth); |
const CBLIST *attrs, const char *ord, int max, int opts, int depth); |
65 |
static int procsetuser(const char *nurl, const char *name, int mode); |
static int procsetuser(const char *nurl, const char *name, int mode); |
66 |
static int procsetlink(const char *nurl, const char *url, const char *label, int credit); |
static int procsetlink(const char *nurl, const char *url, const char *label, int credit); |
67 |
static int procraw(const char *url, const char *file); |
static int procraw(const char *url, const char *file); |
343 |
CBDATUM *pbuf; |
CBDATUM *pbuf; |
344 |
CBLIST *attrs; |
CBLIST *attrs; |
345 |
char *nurl, *ord; |
char *nurl, *ord; |
346 |
int i, max, depth, rv; |
int i, max, opts, depth, rv; |
347 |
nurl = NULL; |
nurl = NULL; |
348 |
ord = NULL; |
ord = NULL; |
349 |
max = SEARCHMAX; |
max = SEARCHMAX; |
350 |
|
opts = 0; |
351 |
depth = 0; |
depth = 0; |
352 |
pbuf = cbdatumopen("", 0); |
pbuf = cbdatumopen("", 0); |
353 |
cbglobalgc(pbuf, (void (*)(void *))cbdatumclose); |
cbglobalgc(pbuf, (void (*)(void *))cbdatumclose); |
371 |
} else if(!strcmp(argv[i], "-vx")){ |
} else if(!strcmp(argv[i], "-vx")){ |
372 |
g_viewmode = VM_XML; |
g_viewmode = VM_XML; |
373 |
} else if(!strcmp(argv[i], "-sf")){ |
} else if(!strcmp(argv[i], "-sf")){ |
374 |
g_condopts |= ESTCONDSIMPLE; |
opts |= ESTCONDSIMPLE; |
375 |
} else if(!strcmp(argv[i], "-attr")){ |
} else if(!strcmp(argv[i], "-attr")){ |
376 |
if(++i >= argc) usage(); |
if(++i >= argc) usage(); |
377 |
cblistpush(attrs, argv[i], -1); |
cblistpush(attrs, argv[i], -1); |
395 |
} |
} |
396 |
} |
} |
397 |
if(!nurl || depth < 0) usage(); |
if(!nurl || depth < 0) usage(); |
398 |
rv = procsearch(nurl, cbdatumptr(pbuf), attrs, ord, max, depth); |
rv = procsearch(nurl, cbdatumptr(pbuf), attrs, ord, max, opts, depth); |
399 |
return rv; |
return rv; |
400 |
} |
} |
401 |
|
|
741 |
|
|
742 |
/* perform the inform command */ |
/* perform the inform command */ |
743 |
static int procsearch(const char *nurl, const char *phrase, |
static int procsearch(const char *nurl, const char *phrase, |
744 |
const CBLIST *attrs, const char *ord, int max, int depth){ |
const CBLIST *attrs, const char *ord, int max, int opts, int depth){ |
745 |
ESTNODE *node; |
ESTNODE *node; |
746 |
ESTNODERES *nres; |
ESTNODERES *nres; |
747 |
ESTRESDOC *rdoc; |
ESTRESDOC *rdoc; |
767 |
} |
} |
768 |
if(ord) est_cond_set_order(cond, ord); |
if(ord) est_cond_set_order(cond, ord); |
769 |
if(max >= 0) est_cond_set_max(cond, max); |
if(max >= 0) est_cond_set_max(cond, max); |
770 |
est_cond_set_options(cond, g_condopts); |
est_cond_set_options(cond, opts); |
771 |
if((nres = est_node_search(node, cond, depth)) != NULL){ |
if((nres = est_node_search(node, cond, depth)) != NULL){ |
772 |
hints = est_noderes_hints(nres); |
hints = est_noderes_hints(nres); |
773 |
switch(g_viewmode){ |
switch(g_viewmode){ |