static void get_real_name(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char **long_name, char **short_name) { const char *mask; struct masktest_state state; if (cli->transport->negotiate.protocol <= PROTOCOL_LANMAN1) { mask = "\\masktest\\*.*"; } else { mask = "\\masktest\\*"; } f_info_hit = false; state.mem_ctx = mem_ctx; smbcli_list_new(cli->tree, mask, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY, RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO, listfn, &state); if (f_info_hit) { *short_name = talloc_strdup(mem_ctx, last_hit.short_name); strlower(*short_name); *long_name = talloc_strdup(mem_ctx, last_hit.long_name); strlower(*long_name); } if (*short_name == '\0') { *short_name = talloc_strdup(mem_ctx, *long_name); } }
int psr_number_from_name(char *psrname) /* Returns the pulsar number of psrname from the database */ /* This number can be from zero to the total number */ /* of pulsars minus 1. This way you can use this number */ /* as an index from the result of collect_psrparams(). */ /* Return -1 if no pulsar is found. */ { int ii, psrnumber = -1; char *matchname, jname[13], bname[9]; matchname = strlower(psrname); if (matchname[0] == 'j' || matchname[0] == 'b') matchname++; /* Read the database if needed */ if (!have_database) np = read_database(); /* Search for the J-name, the B-name, or the alias */ for (ii = 0; ii < np; ii++) { strncpy(jname, pulsardata[ii].jname, 13); strncpy(bname, pulsardata[ii].bname, 9); if (!strcmp(strlower(jname), matchname) || !strcmp(strlower(bname), matchname) || !strcmp(pulsardata[ii].alias, matchname)) { psrnumber = ii; break; } } /* Return the pulsar number */ return psrnumber; }
void dbBtree::remove(dbDatabase* db, oid_t treeId, oid_t recordId, int offs) { dbGetTie treeTie; dbBtree* tree = (dbBtree*)db->getRow(treeTie, treeId); dbBtreePage::item rem; oid_t rootId = tree->root; int height = tree->height; dbGetTie tie; byte* p = (byte*)db->getRow(tie, recordId); if (tree->type == dbField::tpString) { rem.keyLen = ((dbVarying*)(p + offs))->size; assert(rem.keyLen <= dbMaxKeyLen); #ifdef USE_LOCALE_SETTINGS char cnvBuf[dbMaxKeyLen]; if (tree->caseInsensitive) { rem.keyLen = strxfrm(cnvBuf, (char*)(p + ((dbVarying*)(p + offs))->offs), dbMaxKeyLen) + 1; strlower(rem.keyChar, cnvBuf); } else { rem.keyLen = strxfrm(rem.keyChar, (char*)(p + ((dbVarying*)(p + offs))->offs), dbMaxKeyLen) + 1; } #else if (tree->caseInsensitive) { strlower(rem.keyChar, (char*)(p + ((dbVarying*)(p + offs))->offs)); } else { strcpy(rem.keyChar, (char*)(p + ((dbVarying*)(p + offs))->offs)); } #endif } else { memcpy(rem.keyChar, p + offs, keySize[tree->type]); } rem.oid = recordId; int result = dbBtreePage::remove(db, rootId, tree->type, rem, height); assert(result != not_found); if (result == underflow && height != 1) { dbBtreePage* page = (dbBtreePage*)db->get(rootId); if (page->nItems == 0) { dbPutTie tie; dbBtree* t = (dbBtree*)db->putRow(tie, treeId); if (tree->type == dbField::tpString) { t->root = page->keyStr[0].oid; } else { t->root = page->record[dbBtreePage::maxItems-1]; } t->height -= 1; db->freePage(rootId); } db->pool.unfix(page); } else if (result == dbBtree::overflow) { dbPutTie tie; dbBtree* t = (dbBtree*)db->putRow(tie, treeId); t->root = dbBtreePage::allocate(db, rootId, tree->type, rem); t->height += 1; } }
/* ==================================================================== Read all SHP files in source directory and save to directory '.view' in dest directory. ==================================================================== */ int shp_all_to_bmp( void ) { char path[MAXPATHLEN]; int length; DIR *dir = 0; PG_Shp *shp; struct dirent *dirent = 0; /* open directory */ if ( ( dir = opendir( source_path ) ) == 0 ) { fprintf( stderr, "%s: can't open directory\n", source_path ); return 0; } while ( ( dirent = readdir( dir ) ) != 0 ) { if ( dirent->d_name[0] == '.' ) continue; if ( !strncmp( "tacally.shp", strlower( dirent->d_name ), 11 ) ) continue; if ( !strncmp( "tacgerm.shp", strlower( dirent->d_name ), 11 ) ) continue; if ( !strncmp( "a_", strlower( dirent->d_name ), 2 ) ) continue; length = strlen( dirent->d_name ); if ( (dirent->d_name[length - 1] != 'P' || dirent->d_name[length - 2] != 'H' || dirent->d_name[length - 3] != 'S') && (dirent->d_name[length - 1] != 'p' || dirent->d_name[length - 2] != 'h' || dirent->d_name[length - 3] != 's') ) continue; printf( "%s...\n", dirent->d_name ); if ( ( shp = shp_load( dirent->d_name ) ) == 0 ) continue; snprintf( path, MAXPATHLEN, "%s/.view/%s.bmp", dest_path, dirent->d_name ); SDL_SaveBMP( shp->surf, path ); shp_free( &shp ); } closedir( dir ); return 1; }
/*! \brief * Extract Address of Record */ int extract_aor(str* _uri, str* _a) { static char aor_buf[MAX_AOR_LEN]; memset(aor_buf, 0, MAX_AOR_LEN); str tmp; struct sip_uri puri; int user_len; if (parse_uri(_uri->s, _uri->len, &puri) < 0) { rerrno = R_AOR_PARSE; LM_ERR("failed to parse Address of Record\n"); return -1; } if ( (puri.user.len + puri.host.len + 1) > MAX_AOR_LEN || puri.user.len > USERNAME_MAX_SIZE || puri.host.len > DOMAIN_MAX_SIZE ) { rerrno = R_AOR_LEN; LM_ERR("Address Of Record too long\n"); return -2; } _a->s = aor_buf; _a->len = puri.user.len; if (un_escape(&puri.user, _a) < 0) { rerrno = R_UNESCAPE; LM_ERR("failed to unescape username\n"); return -3; } user_len = _a->len; if (reg_use_domain) { if (user_len) aor_buf[_a->len++] = '@'; /* strip prefix (if defined) */ if (realm_prefix.len && realm_prefix.len<puri.host.len && (memcmp(realm_prefix.s, puri.host.s, realm_prefix.len)==0) ) { memcpy(aor_buf + _a->len, puri.host.s + realm_prefix.len, puri.host.len - realm_prefix.len); _a->len += puri.host.len - realm_prefix.len; } else { memcpy(aor_buf + _a->len, puri.host.s, puri.host.len); _a->len += puri.host.len; } } if (case_sensitive && user_len) { tmp.s = _a->s + user_len + 1; tmp.len = _a->s + _a->len - tmp.s; strlower(&tmp); } else { strlower(_a); } return 0; }
struct passwd *Get_Pwnam(char *user,BOOL allow_change) { fstring user2; int last_char; int usernamelevel = lp_usernamelevel(); struct passwd *ret; if (!user || !(*user)) return(NULL); StrnCpy(user2,user,sizeof(user2)-1); if (!allow_change) { user = &user2[0]; } ret = _Get_Pwnam(user); if (ret) return(ret); strlower(user); ret = _Get_Pwnam(user); if (ret) return(ret); strupper(user); ret = _Get_Pwnam(user); if (ret) return(ret); /* Try with first letter capitalised. */ if (strlen(user) > 1) strlower(user+1); ret = _Get_Pwnam(user); if (ret) return(ret); /* try with last letter capitalised */ strlower(user); last_char = strlen(user)-1; user[last_char] = toupper(user[last_char]); ret = _Get_Pwnam(user); if (ret) return(ret); /* Try all combinations up to usernamelevel. */ strlower(user); ret = uname_string_combinations(user, _Get_Pwnam, usernamelevel); if (ret) return(ret); if (allow_change) fstrcpy(user,user2); return(NULL); }
/* * Extract Address of Record */ int extract_aor(str* _uri, str* _a) { static char aor_buf[MAX_AOR_LEN]; str tmp; struct sip_uri puri; int user_len; if (parse_uri(_uri->s, _uri->len, &puri) < 0) { rerrno = R_AOR_PARSE; LOG(L_ERR, "extract_aor(): Error while parsing Address of Record\n"); return -1; } if ((puri.user.len + puri.host.len + 1) > MAX_AOR_LEN) { rerrno = R_AOR_LEN; LOG(L_ERR, "extract_aor(): Address Of Record too long\n"); return -2; } _a->s = aor_buf; _a->len = puri.user.len; if (un_escape(&puri.user, _a) < 0) { rerrno = R_UNESCAPE; LOG(L_ERR, "extract_aor(): Error while unescaping username\n"); return -3; } user_len = _a->len; if (use_domain) { if (user_len) aor_buf[_a->len++] = '@'; /* strip prefix (if defined) */ if (realm_prefix.len && realm_prefix.len<puri.host.len && (memcmp(realm_prefix.s, puri.host.s, realm_prefix.len)==0) ) { memcpy(aor_buf + _a->len, puri.host.s + realm_prefix.len, puri.host.len - realm_prefix.len); _a->len += puri.host.len - realm_prefix.len; } else { memcpy(aor_buf + _a->len, puri.host.s, puri.host.len); _a->len += puri.host.len; } } if (case_sensitive && user_len) { tmp.s = _a->s + user_len + 1; tmp.len = _a->s + _a->len - tmp.s; strlower(&tmp); } else { strlower(_a); } return 0; }
void dbBtree::insert(dbDatabase* db, oid_t treeId, oid_t recordId, int offs) { dbGetTie treeTie; dbBtree* tree = (dbBtree*)db->getRow(treeTie, treeId); oid_t rootId = tree->root; int height = tree->height; dbBtreePage::item ins; dbGetTie tie; byte* p = (byte*)db->getRow(tie, recordId); if (tree->type == dbField::tpString) { ins.keyLen = ((dbVarying*)(p + offs))->size; assert(ins.keyLen <= dbMaxKeyLen); #ifdef USE_LOCALE_SETTINGS char cnvBuf[dbMaxKeyLen]; if (tree->caseInsensitive) { ins.keyLen = strxfrm(cnvBuf, (char*)(p + ((dbVarying*)(p + offs))->offs), dbMaxKeyLen) + 1; strlower(ins.keyChar, cnvBuf); } else { ins.keyLen = strxfrm(ins.keyChar, (char*)(p + ((dbVarying*)(p + offs))->offs), dbMaxKeyLen) + 1; } #else if (tree->caseInsensitive) { strlower(ins.keyChar, (char*)(p + ((dbVarying*)(p + offs))->offs)); } else { strcpy(ins.keyChar, (char*)(p + ((dbVarying*)(p + offs))->offs)); } #endif } else { memcpy(ins.keyChar, p + offs, keySize[tree->type]); } ins.oid = recordId; if (rootId == 0) { dbPutTie tie; dbBtree* t = (dbBtree*)db->putRow(tie, treeId); t->root = dbBtreePage::allocate(db, 0, tree->type, ins); t->height = 1; } else { int result; result = dbBtreePage::insert(db, rootId, tree->type, ins, height); assert(result != not_found); if (result == overflow) { dbPutTie tie; dbBtree* t = (dbBtree*)db->putRow(tie, treeId); t->root = dbBtreePage::allocate(db, rootId, tree->type, ins); t->height += 1; } } }
bool StringMatch::basic_match (const std::wstring &haystack) const { #ifdef TIARY_USE_PCRE if (PcRe *rex = regex.get ()) { return rex->basic_match (haystack); } else #endif { return (strlower (haystack).find (strlower (pattern)) != std::wstring::npos); } }
std::vector <std::pair <size_t, size_t> > StringMatch::match (const std::wstring &haystack) const { #ifdef TIARY_USE_PCRE if (PcRe *rex = regex.get ()) { return rex->match (haystack); } else #endif { return find_all (strlower (haystack), strlower (pattern)); } }
/**************************************************************************** a wrapper for getpwnam() that tries with all lower and all upper case if the initial name fails. Also tried with first letter capitalised ****************************************************************************/ struct passwd * Get_Pwnam (const char *a_user) { fstring user; int last_char; int usernamelevel = lp_usernamelevel (); struct passwd *ret; if (!a_user || !(*a_user)) return (NULL); StrnCpy (user, a_user, sizeof (user) - 1); ret = _Get_Pwnam (user); if (ret) return (ret); strlower (user); ret = _Get_Pwnam (user); if (ret) return (ret); strupper (user); ret = _Get_Pwnam (user); if (ret) return (ret); /* try with first letter capitalised */ if (strlen (user) > 1) strlower (user + 1); ret = _Get_Pwnam (user); if (ret) return (ret); /* try with last letter capitalised */ strlower (user); last_char = strlen (user) - 1; user[last_char] = toupper (user[last_char]); ret = _Get_Pwnam (user); if (ret) return (ret); /* try all combinations up to usernamelevel */ strlower (user); ret = uname_string_combinations (user, _Get_Pwnam, usernamelevel); if (ret) return (ret); return (NULL); }
extern char *ini_get(ini_t * self, char *section, char *var) { dict_t *vars; assert(self && section && var); strlower(section); strlower(var); if (!(vars = dict_get(self->sections, section))) return NULL; return dict_get(vars, var); }
extern ini_t *ini_unset(ini_t * self, char *section, char *var) { dict_t *vars; assert(self && section && var); strlower(section); strlower(var); if (!(vars = dict_get(self->sections, section))) return self; dict_remove(vars, var, free); return self; }
void run_interactive_loop(geonames_by_token_func geonames_func, int max_results, process_geoname_id_func process_func) { char q[MAX_QUERY_LENGTH]; debug("Ready to serve\n"); for (;;) { int i; vector_t tokens; geoname_indices_t geonames; if (!fgets(q, sizeof q, stdin)) break; strlower(strtrim(q)); if (!*q) { puts(""); continue; } tokens = strsplit(q, " \t"); geonames = process_query(tokens, max_results, geonames_func); for (i = 0; i != vector_size(geonames); ++i) process_func(geoname_idx(geonames, i)); puts(""); vector_free(tokens); vector_free(geonames); } }
/* Get the extension of the file to be processed */ int get_target_extension(t_session *session) { char *last_slash; #ifdef CIFS check_free(session->extension); session->extension = NULL; #endif if ((last_slash = strrchr(session->file_on_disk, '/')) == NULL) { return -1; } if ((session->extension = strrchr(last_slash, '.')) != NULL) { session->extension++; } else { session->extension = session->host->no_extension_as; } #ifdef CIFS if (session->extension != NULL) { if ((session->extension = strdup(session->extension)) == NULL) { return -1; } strlower(session->extension); } #endif return 0; }
/* Check if the domain name given in the parameter is one * of the locally configured domain names. * Returns 1 if yes and -1 otherwise */ int is_domain_local(str* domain) { str tmp; /* Make a temporary copy, domain name comparisons are always * case insensitive */ tmp.s = pkg_malloc(domain->len); if (!tmp.s) { ERR("No memory left\n"); return -1; } memcpy(tmp.s, domain->s, domain->len); tmp.len = domain->len; strlower(&tmp); if (!db_mode) { switch(db_get_did(0, &tmp)) { case 1: goto found; default: goto not_found; } } else { if (hash_lookup(0, *active_hash, &tmp) == 1) goto found; else goto not_found; } found: pkg_free(tmp.s); return 1; not_found: pkg_free(tmp.s); return -1; }
void v_macro(char *str, MNEMONIC *dummy) { STRLIST *base; int defined = 0; STRLIST **slp, *sl; MACRO *mac; /* slp, mac: might be used uninitialised */ MNEMONIC *mne; unsigned int i; char buf[MAXLINE]; int skipit = !(Ifstack->xtrue && Ifstack->acctrue); strlower(str); if (skipit) { defined = 1; } else { defined = (findmne(str) != NULL); if (F_listfile && ListMode) outlistfile(""); } if (!defined) { base = NULL; slp = &base; mac = (MACRO *)permalloc(sizeof(MACRO)); i = hash1(str); mac->next = (MACRO *)MHash[i]; mac->vect = v_execmac; mac->name = strcpy(permalloc(strlen(str)+1), str); mac->flags = MF_MACRO; MHash[i] = (MNEMONIC *)mac; } while (fgets(buf, MAXLINE, pIncfile->fi)) { const char *comment; if (Xdebug) printf("%08lx %s\n", (unsigned long) pIncfile, buf); ++pIncfile->lineno; comment = cleanup(buf, true); mne = parse(buf); if (Av[1][0]) { if (mne && mne->flags & MF_ENDM) { if (!defined) mac->strlist = base; return; } } if (!skipit && F_listfile && ListMode) outlistfile(comment); if (!defined) { sl = (STRLIST *)permalloc(STRLISTSIZE+1+strlen(buf)); strcpy(sl->buf, buf); *slp = sl; slp = &sl->next; } } asmerr( ERROR_PREMATURE_EOF, true, NULL ); }
char_t *websUrlType(char_t *url, char_t *buf, int charCnt) { sym_t *sp; char_t *ext, *parsebuf; a_assert(url && *url); a_assert(buf && charCnt > 0); if (url == NULL || *url == '\0') { gstrcpy(buf, T("text/plain")); return buf; } if (websUrlParse(url, &parsebuf, NULL, NULL, NULL, NULL, NULL, NULL, &ext) < 0) { gstrcpy(buf, T("text/plain")); return buf; } strlower(ext); /* * Lookup the mime type symbol table to find the relevant content type */ if ((sp = symLookup(websMime, ext)) != NULL) { gstrncpy(buf, sp->content.value.string, charCnt); } else { gstrcpy(buf, T("text/plain")); } bfree(B_L, parsebuf); return buf; }
/* * Add a new domain name to did */ static int domain_add(domain_t* d, str* domain, unsigned int flags) { str* p1; unsigned int* p2; str dom; if (!d || !domain) { ERR("Invalid parameter value\n"); return -1; } dom.s = shm_malloc(domain->len); if (!dom.s) goto error; memcpy(dom.s, domain->s, domain->len); dom.len = domain->len; strlower(&dom); p1 = (str*)shm_realloc(d->domain, sizeof(str) * (d->n + 1)); if (!p1) goto error; p2 = (unsigned int*)shm_realloc(d->flags, sizeof(unsigned int) * (d->n + 1)); if (!p2) goto error; d->domain = p1; d->domain[d->n] = dom; d->flags = p2; d->flags[d->n] = flags; d->n++; return 0; error: ERR("Unable to add new domain name (out of memory)\n"); if (dom.s) shm_free(dom.s); return -1; }
int main(int argc, char **argv) { URL_FILE *handle; char buffer[BUFSIZE]; if(argc > 1) strcpy(BASE,argv[1]); else { fprintf(stderr, "Usage: %s BaseURL\n",argv[0]); exit(1); } handle = url_fopen(BASE, "r"); if (!handle) { fprintf(stderr,"couldn't url_fopen() %s\n", BASE); return 2; } while(!url_feof(handle)) { url_fgets(buffer,sizeof(buffer),handle); strlower(buffer); fputs(buffer,stdout); char *cur, link[BUFSIZE], full_link[BUFSIZE]; cur = buffer; while ((cur = nextURL(cur)) != NULL) { getURL(cur, link, BUFSIZE-1); normalise(link, full_link, BUFSIZE-1); printf("%s\n",full_link); cur += strlen(link); } } url_fclose(handle); return 0; }
/** * @brief Parse a @a decoration definition. * * Syntax: decoration=enable|disable * * @param in definition to be analyzed * * @return 0 (ok) or 1 (error) */ static int item_decoration(char *in) { if (!window_item("decoration")) return 1; if (in_window("video")) return 1; if (in_window("playbar")) return 1; if (in_window("menu")) return 1; strlower(in); if (strcmp(in, "enable") != 0 && strcmp(in, "disable") != 0) { skin_error(MSGTR_SKIN_UnknownParameter, in); return 1; } skin->mainDecoration = (strcmp(in, "enable") == 0); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] decoration: %s\n", in); return 0; }
int nametonum(char *s) { char *p; int i, lo, hi, m, rv; s = estrdup(s); strlower(s); for(p=s; *p; p++) if(*p=='_') *p = ' '; currentmap(0); rlock(&maplock); lo = 0; hi = map->nel; while(hi-lo > 1){ m = (lo+hi)/2; i = strcmp(s, map->el[m].s); if(i < 0) hi = m; else lo = m; } if(hi-lo == 1 && strcmp(s, map->el[lo].s)==0) rv = map->el[lo].n; else rv = -1; runlock(&maplock); free(s); return rv; }
/********************************************************* Join a domain. **********************************************************/ static int join_domain(char *domain, char *remote) { pstring remote_machine; fstring trust_passwd; unsigned char orig_trust_passwd_hash[16]; BOOL ret; pstrcpy(remote_machine, remote ? remote : ""); fstrcpy(trust_passwd, global_myname); strlower(trust_passwd); E_md4hash( (uchar *)trust_passwd, orig_trust_passwd_hash); /* Ensure that we are not trying to join a domain if we are locally set up as a domain controller. */ if(strequal(remote, global_myname)) { fprintf(stderr, "Cannot join domain %s as the domain controller name is our own. We cannot be a domain controller for a domain and also be a domain member.\n", domain); return 1; } /* * Create the machine account password file. */ if(!trust_password_lock( domain, global_myname, True)) { fprintf(stderr, "Unable to open the machine account password file for \ machine %s in domain %s.\n", global_myname, domain); return 1; }
/* * Check if domain is local */ static int is_local(struct sip_msg* msg, char* fp, char* s2) { str domain, tmp; if (get_str_fparam(&domain, msg, (fparam_t*)fp) != 0) { ERR("Unable to get domain to check\n"); return -1; } tmp.s = pkg_malloc(domain.len); if (!tmp.s) { ERR("No memory left\n"); return -1; } memcpy(tmp.s, domain.s, domain.len); tmp.len = domain.len; strlower(&tmp); if (!db_mode) { switch(db_get_did(0, &tmp)) { case 1: goto found; default: goto not_found; } } else { if (hash_lookup(0, *active_hash, &tmp) == 1) goto found; else goto not_found; } found: pkg_free(tmp.s); return 1; not_found: pkg_free(tmp.s); return -1; }
/* * column_names = statement:columns() */ static int statement_columns(lua_State *L) { statement_t *statement = (statement_t *)luaL_checkudata(L, 1, DBD_ORACLE_STATEMENT); int rc; bindparams_t *bind; char errbuf[100]; int errcode; int i; int d = 1; if (!statement->stmt) { luaL_error(L, DBI_ERR_INVALID_STATEMENT); return 0; } statement_fetch_metadata(L, statement); lua_newtable(L); for (i = 0; i < statement->num_columns; i++) { const char *name = strlower(statement->bind[i].name); LUA_PUSH_ARRAY_STRING(d, name); } return 1; }
extern ini_t *ini_set_default(ini_t * self, char *section, char *var, char *value) { dict_t *vars; assert(self && section && var && value); section = strlower(section); var = strlower(var); if (!(vars = dict_get(self->sections, section))) return self; if (!dict_get(vars, var)) dict_add(vars, var, value); return self; }
int ADZ_libIsValidDiskFile(HXCFLOPPYEMULATOR* floppycontext,char * imgfile) { int pathlen; char * filepath; floppycontext->hxc_printf(MSG_DEBUG,"ADZ_libIsValidDiskFile %s",imgfile); if(imgfile) { pathlen=strlen(imgfile); if(pathlen!=0) { filepath=malloc(pathlen+1); if(filepath!=0) { sprintf(filepath,"%s",imgfile); strlower(filepath); if((strstr( filepath,".adz" )!=NULL) || (strstr( filepath,".adf.gz" )!=NULL)) { floppycontext->hxc_printf(MSG_DEBUG,"ADZ file !"); free(filepath); return LOADER_ISVALID; } else { floppycontext->hxc_printf(MSG_DEBUG,"non ADZ file !"); free(filepath); return LOADER_BADFILE; } } } } return LOADER_BADPARAMETER; }
int my_parser(t_scene *scene, t_parser *parser, int i) { char *otab[6]; ptr which_object[6]; init_functab(otab, which_object); i = 0; while (i < 5) { if (strcmp(otab[i], strlower(parser->tab[parser->n])) == 0) { if ((i == 1 || i == 2) && parser->k != 3) parser->k = parser->k + i; (*which_object[i++])(scene, parser); i = 6; } i++; } if (i == 6) { printf("%s: unknown object line %d.\n", parser->tab[0], parser->line); exit(EXIT_FAILURE); } return (parser->k); }
static int get_did(str* did, str* domain) { str tmp; domain_t* d; unsigned int track; track = 0; if (!db_mode) { ERR("lookup_domain only works in cache mode\n"); return -1; } tmp.s = pkg_malloc(domain->len); if (!tmp.s) { ERR("No memory left\n"); return -1; } memcpy(tmp.s, domain->s, domain->len); tmp.len = domain->len; strlower(&tmp); if (hash_lookup(&d, *active_hash, &tmp) == 1) { *did = d->did; pkg_free(tmp.s); return 1; } else { pkg_free(tmp.s); return -1; } }
static char getFunction(std::string const& name) { std::string id = strlower(name); if (id == "table") return funcTable; if (id == "min") return funcMin; if (id == "max") return funcMax; return '('; }