src/server/util/util.c

changeset 96
0185b13bf41f
parent 91
fac51f87def0
child 99
b9a6af0ae41a
equal deleted inserted replaced
95:74a81d9e19d0 96:0185b13bf41f
54 #include "../daemon/netsite.h" 54 #include "../daemon/netsite.h"
55 #include "../public/nsapi.h" 55 #include "../public/nsapi.h"
56 #include <ucx/string.h> 56 #include <ucx/string.h>
57 #include <ucx/mempool.h> 57 #include <ucx/mempool.h>
58 58
59 #include "pblock.h"
59 #include "util.h" 60 #include "util.h"
60 61
61 62
62 63
63 /* ------------------------------ _uudecode ------------------------------- */ 64 /* ------------------------------ _uudecode ------------------------------- */
508 if(i < 0) { 509 if(i < 0) {
509 path.ptr = NULL; 510 path.ptr = NULL;
510 path.length = 0; 511 path.length = 0;
511 } 512 }
512 return path; 513 return path;
514 }
515
516 void util_add_ppath(sstr_t root, sstr_t path, pblock *vars) {
517 // concat path
518 sstr_t translated_path;
519 translated_path.length = root.length + path.length;
520 translated_path.ptr = alloca(translated_path.length);
521
522 translated_path = sstrncat(translated_path, 2, root, path);
523
524 // add path to specified pblock
525 pblock_kvinsert(
526 pb_key_ppath,
527 translated_path.ptr,
528 translated_path.length,
529 vars);
513 } 530 }
514 531
515 532
516 // new - code in parts from params.cpp 533 // new - code in parts from params.cpp
517 NSAPI_PUBLIC pblock* util_parse_param(pool_handle_t *pool, char *query) { 534 NSAPI_PUBLIC pblock* util_parse_param(pool_handle_t *pool, char *query) {

mercurial