/[hyperestraier]/upstream/0.5.2/estmaster.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /upstream/0.5.2/estmaster.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

upstream/0.5.1/estmaster.c revision 2 by dpavlin, Fri Jul 29 21:56:53 2005 UTC upstream/0.5.2/estmaster.c revision 9 by dpavlin, Wed Aug 3 15:21:15 2005 UTC
# Line 139  const char *g_uigprefix = NULL; Line 139  const char *g_uigprefix = NULL;
139  const char *g_uigsuffix = NULL;          /* suffix added to the global URI of each document */  const char *g_uigsuffix = NULL;          /* suffix added to the global URI of each document */
140  const char *g_uidirindex = NULL;         /* name of the directory index file */  const char *g_uidirindex = NULL;         /* name of the directory index file */
141  CBLIST *g_uireplaces = NULL;             /* expressions to replace the URI of each document */  CBLIST *g_uireplaces = NULL;             /* expressions to replace the URI of each document */
 CBLIST *g_uicondattrs = NULL;            /* attributes for search condition */  
142  CBLIST *g_uiextattrs = NULL;             /* extra attributes to be shown */  CBLIST *g_uiextattrs = NULL;             /* extra attributes to be shown */
143    int g_uismplphrase = FALSE;              /* whether to use simplefied search phrase */
144  int g_bgmode = FALSE;                    /* whether to be foreground mode */  int g_bgmode = FALSE;                    /* whether to be foreground mode */
145  int g_stmode = FALSE;                    /* whether to be single thread mode */  int g_stmode = FALSE;                    /* whether to be single thread mode */
146  DEPOT *g_metadb = NULL;                  /* meta database */  DEPOT *g_metadb = NULL;                  /* meta database */
# Line 402  static void startup(void){ Line 402  static void startup(void){
402    struct stat sbuf;    struct stat sbuf;
403    const char *rp, *name;    const char *rp, *name;
404    char path[URIBUFSIZ], numbuf[NUMBUFSIZ];    char path[URIBUFSIZ], numbuf[NUMBUFSIZ];
405    int i, j, pid, omode;    int i, pid, omode;
406    if(stat(g_rootdir, &sbuf) == -1)    if(stat(g_rootdir, &sbuf) == -1)
407      die("the server root directory (%s) could not open", g_rootdir);      die("the server root directory (%s) could not open", g_rootdir);
408    sprintf(path, "%s%c%s", g_rootdir, ESTPATHCHR, CONFFILE);    sprintf(path, "%s%c%s", g_rootdir, ESTPATHCHR, CONFFILE);
# Line 412  static void startup(void){ Line 412  static void startup(void){
412    cbglobalgc(g_trustednodes, (void (*)(void *))cbmapclose);    cbglobalgc(g_trustednodes, (void (*)(void *))cbmapclose);
413    g_uireplaces = cblistopen();    g_uireplaces = cblistopen();
414    cbglobalgc(g_uireplaces, (void (*)(void *))cblistclose);    cbglobalgc(g_uireplaces, (void (*)(void *))cblistclose);
   g_uicondattrs = cblistopen();  
   cbglobalgc(g_uicondattrs, (void (*)(void *))cblistclose);  
415    g_uiextattrs = cblistopen();    g_uiextattrs = cblistopen();
416    cbglobalgc(g_uiextattrs, (void (*)(void *))cblistclose);    cbglobalgc(g_uiextattrs, (void (*)(void *))cblistclose);
417    for(i = 0; i < cblistnum(lines); i++){    for(i = 0; i < cblistnum(lines); i++){
# Line 444  static void startup(void){ Line 442  static void startup(void){
442        g_docroot = skiplabel(rp);        g_docroot = skiplabel(rp);
443      } else if(cbstrfwimatch(rp, "indexfile:")){      } else if(cbstrfwimatch(rp, "indexfile:")){
444        g_indexfile = skiplabel(rp);        g_indexfile = skiplabel(rp);
445      } else if(cbstrfwimatch(rp, "trustednodes:")){      } else if(cbstrfwimatch(rp, "trustednode:")){
446        elems = cbsplit(skiplabel(rp), -1, " ,");        cbmapput(g_trustednodes, skiplabel(rp), -1, "", 0, TRUE);
       for(j = 0; j < cblistnum(elems); j++){  
         rp = cblistval(elems, j, NULL);  
         if(rp != '\0') cbmapput(g_trustednodes, rp, -1, "", 0, TRUE);  
       }  
       cblistclose(elems);  
447      } else if(cbstrfwimatch(rp, "denyuntrusted:")){      } else if(cbstrfwimatch(rp, "denyuntrusted:")){
448        g_denyuntrusted = atoi(skiplabel(rp)) > 0;        g_denyuntrusted = atoi(skiplabel(rp)) > 0;
449      } else if(cbstrfwimatch(rp, "cachesize:")){      } else if(cbstrfwimatch(rp, "cachesize:")){
# Line 473  static void startup(void){ Line 466  static void startup(void){
466        g_uidirindex = skiplabel(rp);        g_uidirindex = skiplabel(rp);
467      } else if(cbstrfwimatch(rp, "uireplace:")){      } else if(cbstrfwimatch(rp, "uireplace:")){
468        cblistpush(g_uireplaces, skiplabel(rp), -1);        cblistpush(g_uireplaces, skiplabel(rp), -1);
     } else if(cbstrfwimatch(rp, "uicondattr:")){  
       cblistpush(g_uicondattrs, skiplabel(rp), -1);  
469      } else if(cbstrfwimatch(rp, "uiextattr:")){      } else if(cbstrfwimatch(rp, "uiextattr:")){
470        cblistpush(g_uiextattrs, skiplabel(rp), -1);        cblistpush(g_uiextattrs, skiplabel(rp), -1);
471        } else if(cbstrfwimatch(rp, "uismplphrase:")){
472          g_uismplphrase = atoi(skiplabel(rp)) > 0;
473      }      }
474    }    }
475    if(!g_hostname) die("hostname is undefined");    if(!g_hostname) die("hostname is undefined");
# Line 1915  static void sendnodecmdsearch(int clsock Line 1908  static void sendnodecmdsearch(int clsock
1908    cond = est_cond_new();    cond = est_cond_new();
1909    max = DEFMAXSRCH;    max = DEFMAXSRCH;
1910    depth = 0;    depth = 0;
1911    if((tmp = cbmapget(req->params, "phrase", -1, NULL)) != NULL) est_cond_set_phrase(cond, tmp);    if((tmp = cbmapget(req->params, "phrase", -1, NULL)) != NULL && tmp[0] != '\0')
1912    if((tmp = cbmapget(req->params, "attr", -1, NULL)) != NULL) est_cond_set_phrase(cond, tmp);      est_cond_set_phrase(cond, tmp);
1913    if((tmp = cbmapget(req->params, "attr1", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);    if((tmp = cbmapget(req->params, "attr", -1, NULL)) != NULL && tmp[0] != '\0')
1914    if((tmp = cbmapget(req->params, "attr2", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);      est_cond_set_phrase(cond, tmp);
1915    if((tmp = cbmapget(req->params, "attr3", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);    if((tmp = cbmapget(req->params, "attr1", -1, NULL)) != NULL && tmp[0] != '\0')
1916    if((tmp = cbmapget(req->params, "attr4", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);      est_cond_add_attr(cond, tmp);
1917    if((tmp = cbmapget(req->params, "attr5", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);    if((tmp = cbmapget(req->params, "attr2", -1, NULL)) != NULL && tmp[0] != '\0')
1918    if((tmp = cbmapget(req->params, "attr6", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);      est_cond_add_attr(cond, tmp);
1919    if((tmp = cbmapget(req->params, "attr7", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);    if((tmp = cbmapget(req->params, "attr3", -1, NULL)) != NULL && tmp[0] != '\0')
1920    if((tmp = cbmapget(req->params, "attr8", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);      est_cond_add_attr(cond, tmp);
1921    if((tmp = cbmapget(req->params, "attr9", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);    if((tmp = cbmapget(req->params, "attr4", -1, NULL)) != NULL && tmp[0] != '\0')
1922    if((tmp = cbmapget(req->params, "order", -1, NULL)) != NULL) est_cond_set_order(cond, tmp);      est_cond_add_attr(cond, tmp);
1923      if((tmp = cbmapget(req->params, "attr5", -1, NULL)) != NULL && tmp[0] != '\0')
1924        est_cond_add_attr(cond, tmp);
1925      if((tmp = cbmapget(req->params, "attr6", -1, NULL)) != NULL && tmp[0] != '\0')
1926        est_cond_add_attr(cond, tmp);
1927      if((tmp = cbmapget(req->params, "attr7", -1, NULL)) != NULL && tmp[0] != '\0')
1928        est_cond_add_attr(cond, tmp);
1929      if((tmp = cbmapget(req->params, "attr8", -1, NULL)) != NULL && tmp[0] != '\0')
1930        est_cond_add_attr(cond, tmp);
1931      if((tmp = cbmapget(req->params, "attr9", -1, NULL)) != NULL && tmp[0] != '\0')
1932        est_cond_add_attr(cond, tmp);
1933      if((tmp = cbmapget(req->params, "order", -1, NULL)) != NULL && tmp[0] != '\0')
1934        est_cond_set_order(cond, tmp);
1935    if((tmp = cbmapget(req->params, "max", -1, NULL)) && (num = atoi(tmp)) >= 0) max = num;    if((tmp = cbmapget(req->params, "max", -1, NULL)) && (num = atoi(tmp)) >= 0) max = num;
1936    est_cond_set_max(cond, max + 1);    est_cond_set_max(cond, max + 1);
1937    if((tmp = cbmapget(req->params, "options", -1, NULL)) && (num = atoi(tmp)) > 0)    if((tmp = cbmapget(req->params, "options", -1, NULL)) && (num = atoi(tmp)) > 0)
# Line 2336  static void sendnodecmdsearchui(int clso Line 2341  static void sendnodecmdsearchui(int clso
2341    depth = 0;    depth = 0;
2342    page = 0;    page = 0;
2343    if((tmp = cbmapget(req->params, "page", -1, NULL)) && (num = atoi(tmp)) > 0) page = num;    if((tmp = cbmapget(req->params, "page", -1, NULL)) && (num = atoi(tmp)) > 0) page = num;
2344    if((tmp = cbmapget(req->params, "phrase", -1, NULL)) != NULL) est_cond_set_phrase(cond, tmp);    if((tmp = cbmapget(req->params, "phrase", -1, NULL)) != NULL && tmp[0] != '\0')
2345    if((tmp = cbmapget(req->params, "attr", -1, NULL)) != NULL) est_cond_set_phrase(cond, tmp);      est_cond_set_phrase(cond, tmp);
2346    if((tmp = cbmapget(req->params, "attr1", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);    if((tmp = cbmapget(req->params, "attr", -1, NULL)) != NULL && tmp[0] != '\0')
2347    if((tmp = cbmapget(req->params, "attr2", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);      est_cond_set_phrase(cond, tmp);
2348    if((tmp = cbmapget(req->params, "attr3", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp);    if((tmp = cbmapget(req->params, "attr1", -1, NULL)) != NULL && tmp[0] != '\0')
2349    if((tmp = cbmapget(req->params, "order", -1, NULL)) != NULL) est_cond_set_order(cond, tmp);      est_cond_add_attr(cond, tmp);
2350      if((tmp = cbmapget(req->params, "attr2", -1, NULL)) != NULL && tmp[0] != '\0')
2351        est_cond_add_attr(cond, tmp);
2352      if((tmp = cbmapget(req->params, "attr3", -1, NULL)) != NULL && tmp[0] != '\0')
2353        est_cond_add_attr(cond, tmp);
2354      if((tmp = cbmapget(req->params, "order", -1, NULL)) != NULL && tmp[0] != '\0')
2355        est_cond_set_order(cond, tmp);
2356    if((tmp = cbmapget(req->params, "max", -1, NULL)) && (num = atoi(tmp)) >= 0) max = num;    if((tmp = cbmapget(req->params, "max", -1, NULL)) && (num = atoi(tmp)) >= 0) max = num;
2357    est_cond_set_max(cond, max + page * max + 1);    est_cond_set_max(cond, max + page * max + 1);
2358    if((tmp = cbmapget(req->params, "depth", -1, NULL)) && (num = atoi(tmp)) > 0) depth = num;    if((tmp = cbmapget(req->params, "depth", -1, NULL)) && (num = atoi(tmp)) > 0) depth = num;
2359    if(depth >= g_searchdepth) depth = g_searchdepth;    if(depth >= g_searchdepth) depth = g_searchdepth;
2360      if(g_uismplphrase) est_cond_set_options(cond, ESTCONDSIMPLE);
2361    top = !est_cond_phrase(cond) && !est_cond_attrs(cond);    top = !est_cond_phrase(cond) && !est_cond_attrs(cond);
2362    phrase = est_cond_phrase(cond);    phrase = est_cond_phrase(cond);
2363    attrs = est_cond_attrs(cond);    attrs = est_cond_attrs(cond);
# Line 3021  static void sendmasteruidata(int clsock, Line 3033  static void sendmasteruidata(int clsock,
3033      for(i = 0; i < cblistnum(list); i++){      for(i = 0; i < cblistnum(list); i++){
3034        if(!(tmp = cblistval(list, i, NULL)) || !(tnode = nmgr_get(g_nmgr, tmp))) continue;        if(!(tmp = cblistval(list, i, NULL)) || !(tnode = nmgr_get(g_nmgr, tmp))) continue;
3035        est_datum_printf(datum, "<tr>\n");        est_datum_printf(datum, "<tr>\n");
3036        est_datum_printf(datum, "<td>%@</td>\n", tnode->name);        est_datum_printf(datum, "<td><a href=\"%@%@/searchui\">%@</a></td>\n",
3037                           NODEPREFIX, tnode->name, tnode->name);
3038        est_datum_printf(datum, "<td>%@</td>\n", tnode->label);        est_datum_printf(datum, "<td>%@</td>\n", tnode->label);
3039        est_datum_printf(datum, "<td>%d</td>\n", est_mtdb_doc_num(tnode->db));        est_datum_printf(datum, "<td>%d</td>\n", est_mtdb_doc_num(tnode->db));
3040        est_datum_printf(datum, "<td>%d</td>\n", est_mtdb_word_num(tnode->db));        est_datum_printf(datum, "<td>%d</td>\n", est_mtdb_word_num(tnode->db));

Legend:
Removed from v.2  
changed lines
  Added in v.9

  ViewVC Help
Powered by ViewVC 1.1.26