static int wepinit(Proto*, Fsstate *fss) { int ret; Key *k; Keyinfo ki; State *s; /* find a key with at least one password */ mkkeyinfo(&ki, fss, nil); ret = findkey(&k, &ki, "!key1?"); if(ret != RpcOk) ret = findkey(&k, &ki, "!key2?"); if(ret != RpcOk) ret = findkey(&k, &ki, "!key3?"); if(ret != RpcOk) return ret; setattrs(fss->attr, k->attr); s = emalloc(sizeof(*s)); s->key = k; fss->ps = s; fss->phase = HavePass; return RpcOk; }
int get_knic(int card) //returns "0" for zero cards or error and "1" card is found. { struct keyvalue *kv = initkeyvalues(); char temp[STRING_SIZE], searchstr[STRING_SIZE]; int ret_value; if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings"))) { freekeyvalues(kv); errorbox(_("Unable to open settings file")); return 0; } sprintf(searchstr, "%s_MACADDR", ucolourcard[card]); strcpy(temp, ""); findkey(kv, searchstr, temp); if (strlen(temp)) { strcpy(knics[ card ].macaddr, temp); strcpy(knics[ card ].colour, ucolourcard[card]); sprintf(searchstr, "%s_DESCRIPTION", ucolourcard[card]); findkey(kv, searchstr, temp); strcpy(knics[ card ].description, temp); sprintf(searchstr, "%s_DRIVER", ucolourcard[card]); findkey(kv, searchstr, temp); strcpy(knics[ card ].driver, temp); ret_value = 1; } else { strcpy(knics[ card ].description, _("Unset")); ret_value = 0; } freekeyvalues(kv); return ret_value; }
int findkey(struct node *root, int input) { if(root -> data == input) return root -> data; if(root -> data > input) findkey(root -> left); else findkey(root -> right); }
/* This will rewrite /etc/hosts, /etc/hosts.*, and the apache ServerName file. */ int writehostsfiles(void) { char address[STRING_SIZE] = ""; char netaddress[STRING_SIZE] = ""; char netmask[STRING_SIZE] = ""; FILE *file; struct keyvalue *kv; char hostname[STRING_SIZE]; char commandstring[STRING_SIZE]; kv = initkeyvalues(); if (!(readkeyvalues(kv, CONFIG_ROOT "ethernet/settings"))) { freekeyvalues(kv); errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]); return 0; } findkey(kv, "GREEN_ADDRESS", address); findkey(kv, "GREEN_NETADDRESS", netaddress); findkey(kv, "GREEN_NETMASK", netmask); freekeyvalues(kv); kv = initkeyvalues(); if (!(readkeyvalues(kv, CONFIG_ROOT "main/settings"))) { freekeyvalues(kv); errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]); return 0; } strcpy(hostname, "smoothwall"); findkey(kv, "HOSTNAME", hostname); freekeyvalues(kv); if (!(file = fopen(CONFIG_ROOT "main/hostname.conf", "w"))) { errorbox(ctr[TR_UNABLE_TO_WRITE_VAR_SMOOTHWALL_MAIN_HOSTNAMECONF]); return 0; } fprintf(file, "ServerName %s\n", hostname); fclose(file); if (mysystem("/usr/bin/smoothwall/writehosts.pl")) { errorbox(ctr[TR_UNABLE_TO_WRITE_ETC_HOSTS]); return 0; } sprintf(commandstring, "/bin/hostname %s", hostname); if (mysystem(commandstring)) { errorbox(ctr[TR_UNABLE_TO_SET_HOSTNAME]); return 0; } return 1; }
int ticketrequest(Ticketreq *tr) { char akey[DESKEYLEN]; char hkey[DESKEYLEN]; Ticket t; char tbuf[2*TICKETLEN+1]; if(findkey(KEYDB, tr->authid, akey) == 0){ /* make one up so caller doesn't know it was wrong */ mkkey(akey); if(debug) syslog(0, AUTHLOG, "tr-fail authid %s", raddr); } if(findkey(KEYDB, tr->hostid, hkey) == 0){ /* make one up so caller doesn't know it was wrong */ mkkey(hkey); if(debug) syslog(0, AUTHLOG, "tr-fail hostid %s(%s)", tr->hostid, raddr); } memset(&t, 0, sizeof(t)); memmove(t.chal, tr->chal, CHALLEN); strcpy(t.cuid, tr->uid); if(speaksfor(tr->hostid, tr->uid)) strcpy(t.suid, tr->uid); else { mkkey(akey); mkkey(hkey); if(debug) syslog(0, AUTHLOG, "tr-fail %s@%s(%s) -> %s@%s no speaks for", tr->uid, tr->hostid, raddr, tr->uid, tr->authid); } mkkey(t.key); tbuf[0] = AuthOK; t.num = AuthTc; convT2M(&t, tbuf+1, hkey); t.num = AuthTs; convT2M(&t, tbuf+1+TICKETLEN, akey); if(write(1, tbuf, 2*TICKETLEN+1) < 0){ if(debug) syslog(0, AUTHLOG, "tr-fail %s@%s(%s): hangup", tr->uid, tr->hostid, raddr); exits(0); } if(debug) syslog(0, AUTHLOG, "tr-ok %s@%s(%s) -> %s@%s", tr->uid, tr->hostid, raddr, tr->uid, tr->authid); return 0; }
/* Returns 0 if main ISDN setup loop should exit. */ int isdnenabledpressed(void) { struct keyvalue *kv = initkeyvalues(); char protocol[STRING_SIZE] = ""; char type[STRING_SIZE] = ""; char msn[STRING_SIZE] = ""; char moduleparams[STRING_SIZE] = ""; char commandstring[STRING_SIZE]; int result = 0; if (!(readkeyvalues(kv, CONFIG_ROOT "isdn/settings"))) { freekeyvalues(kv); errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]); return 0; } findkey(kv, "PROTOCOL", protocol); findkey(kv, "TYPE", type); findkey(kv, "MSN", msn); findkey(kv, "MODULE_PARAMS", moduleparams); if (strlen(protocol) && strlen(type) && strlen(msn)) { if (!strcmp(type, "100")) { sprintf(commandstring, "/sbin/modprobe hisax_st5481 protocol=%s %s", protocol, moduleparams); } else { sprintf(commandstring, "/sbin/modprobe hisax protocol=%s type=%s %s", protocol, type, moduleparams); } if (runcommandwithstatus(commandstring, ctr[TR_INITIALISING_ISDN]) != 0) { errorbox(ctr[TR_UNABLE_TO_INITIALISE_ISDN]); replacekeyvalue(kv, "ENABLED", "off"); result = 1; } else replacekeyvalue(kv, "ENABLED", "on"); } else { errorbox(ctr[TR_ISDN_NOT_SETUP]); replacekeyvalue(kv, "ENABLED", "off"); result = 1; } writekeyvalues(kv, CONFIG_ROOT "isdn/settings"); freekeyvalues(kv); return result; }
void handleisdnprotocol(char **protocolnames) { int rc; int choice; struct keyvalue *kv = initkeyvalues(); char temp[STRING_SIZE] = "1"; if (!(readkeyvalues(kv, CONFIG_ROOT "isdn/settings"))) { freekeyvalues(kv); errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]); return; } findkey(kv, "PROTOCOL", temp); choice = atol(temp) - 1; rc = newtWinMenu(ctr[TR_ISDN_PROTOCOL_SELECTION], ctr[TR_CHOOSE_THE_ISDN_PROTOCOL], 50, 5, 5, 6, protocolnames, &choice, ctr[TR_OK], ctr[TR_CANCEL], NULL); if (rc == 2) return; sprintf(temp, "%d", choice + 1); replacekeyvalue(kv, "PROTOCOL", temp); writekeyvalues(kv, CONFIG_ROOT "isdn/settings"); freekeyvalues(kv); }
/*获取文件的长度*/ int getflen(){ long i; file *p; if (ismulti() == 1){ if (file_head == NULL){ getflap(); } p = file_head; while (p != NULL){ file_size += p->len; p = p -> next; } }else { if (findkey("6:length",&i) == i) { i = i + strlen("6:length"); i++; //跳过i while(torrent_content[i] != 'e'){ file_size = file_size * 10 + torrent_content[i] - '0'; i++; } } } #ifdef DEBUG printf("file length:%lld\n",file_size); #endif return 0; }
/*获取文件的名字*/ int getfname(){ long i; int count = 0; if (findkey("4:name", &i) == 1){ i = i + strlen("4:name"); while(torrent_content[i] != ':'){ count = count * 10 + (torrent_content[i] - '0'); i++; } i++; files = (char *)malloc(count+1); memcpy(files,&torrent_content[i],count); files[count] = '\0'; }else{ return -1; } #ifdef DEBUG printf("files name:%s\n",files); #endif return 0; }
asmlinkage int sys_semget (key_t key, int nsems, int semflg) { int id, err = -EINVAL; struct semid_ds *sma; lock_kernel(); if (nsems < 0 || nsems > SEMMSL) goto out; if (key == IPC_PRIVATE) { err = newary(key, nsems, semflg); } else if ((id = findkey (key)) == -1) { /* key not used */ if (!(semflg & IPC_CREAT)) err = -ENOENT; else err = newary(key, nsems, semflg); } else if (semflg & IPC_CREAT && semflg & IPC_EXCL) { err = -EEXIST; } else { sma = semary[id]; if (nsems > sma->sem_nsems) err = -EINVAL; else if (ipcperms(&sma->sem_perm, semflg)) err = -EACCES; else err = (int) sma->sem_perm.seq * SEMMNI + id; } out: unlock_kernel(); return err; }
const char* windowsxp_gaim (void) { FILE* fp; char* accounts_file; char* accounts_file_new; char* appdata = NULL; char* path = NULL; appdata = findkey(user_key_file, "\\Software\\Microsoft\\Windows\\" "CurrentVersion\\Explorer\\Shell Folders\\Local AppData"); if(!appdata) { return NULL; } path = reformat_path(appdata); if(!path) return NULL; free(appdata); asprintf(&accounts_file, "%s/%s/%s", from_location, path, "/.gaim/accounts.xml"); asprintf(&accounts_file_new, "%s/%s/%s", from_location, path, "/.purple/accounts.xml"); free(path); fp = fopen(accounts_file, "r"); free(accounts_file); if(fp != NULL) { fclose(fp); return "Gaim"; } fp = fopen(accounts_file_new, "r"); free(accounts_file_new); if(fp != NULL) { fclose(fp); return "Gaim"; } return NULL; }
/* 从系统中获取一个信号量 */ int sys_semget (key_t key, int nsems, int semflg) { int id; struct semid_ds *sma; if (nsems < 0 || nsems > SEMMSL) return -EINVAL; if (key == IPC_PRIVATE) return newary(key, nsems, semflg); if ((id = findkey (key)) == -1) { /* key not used */ /* 对应key的信号量没有找到,又不是创建标记则出错,否则创建一个新的 */ if (!(semflg & IPC_CREAT)) return -ENOENT; return newary(key, nsems, semflg); } if (semflg & IPC_CREAT && semflg & IPC_EXCL) return -EEXIST; sma = semary[id]; if (nsems > sma->sem_nsems) return -EINVAL; if (ipcperms(&sma->sem_perm, semflg)) return -EACCES; /* 和newary返回联系 */ return sma->sem_perm.seq*SEMMNI + id; }
asmlinkage int sys_msgget (key_t key, int msgflg) { int id, ret = -EPERM; struct msqid_ds *msq; lock_kernel(); if (key == IPC_PRIVATE) ret = newque(key, msgflg); else if ((id = findkey (key)) == -1) { /* key not used */ if (!(msgflg & IPC_CREAT)) ret = -ENOENT; else ret = newque(key, msgflg); } else if (msgflg & IPC_CREAT && msgflg & IPC_EXCL) { ret = -EEXIST; } else { msq = msgque[id]; if (msq == IPC_UNUSED || msq == IPC_NOID) ret = -EIDRM; else if (ipcperms(&msq->msg_perm, msgflg)) ret = -EACCES; else ret = (unsigned int) msq->msg_perm.seq * MSGMNI + id; } unlock_kernel(); return ret; }
const char* windowsxp_opera (void) { char* filename; char* appdata = NULL; char* path = NULL; appdata = findkey(user_key_file, "\\Software\\Microsoft\\Windows\\" "CurrentVersion\\Explorer\\Shell Folders\\Local AppData"); if(!appdata) { return NULL; } path = reformat_path(appdata); if(!path) return NULL; free(appdata); asprintf(&filename, "%s/%s/%s", from_location, path, "Opera/Opera/profile/opera6.adr"); free(path); FILE* fp; if((fp = fopen(filename, "r")) != NULL) { fclose(fp); free(filename); return "Opera"; } else { free(filename); return NULL; } }
void main(int argc, char *argv[]) { char *key; char *u; char keybuf[DESKEYLEN]; argv0 = "printnetkey"; fmtinstall('K', keyfmt); ARGBEGIN{ default: usage(); }ARGEND if(argc != 1) usage(); u = argv[0]; fmtinstall('K', keyfmt); if(memchr(u, '\0', ANAMELEN) == 0) error("bad user name"); key = findkey(NETKEYDB, u, keybuf); if(!key) error("%s has no netkey\n", u); print("user %s: net key %K\n", u, key); exits(0); }
const char* windowsxp_iexplorer (void) { DIR* dir; struct dirent *entry; char* path, *iedir; char* favorites = NULL; favorites = findkey(user_key_file, "\\Software\\Microsoft\\Windows\\" "CurrentVersion\\Explorer\\Shell Folders\\Favorites"); if(!favorites) return NULL; path = reformat_path(favorites); if(!path) return NULL; free(favorites); asprintf(&iedir, "%s/%s", from_location, path); free(path); dir = opendir(iedir); if(!dir) return NULL; free(iedir); while((entry = readdir(dir)) != NULL) { if(strcmp(entry->d_name,".") == 0 || strcmp(entry->d_name,"..") == 0) continue; if(strcmp(entry->d_name, "Desktop.ini") == 0) continue; return "Internet Explorer"; } return NULL; }
asmlinkage int sys_shmget (key_t key, int size, int shmflg) { struct shmid_kernel *shp; int err, id = 0; down(¤t->mm->mmap_sem); lock_kernel(); if (size < 0 || size > shmmax) { err = -EINVAL; } else if (key == IPC_PRIVATE) { err = newseg(key, shmflg, size); } else if ((id = findkey (key)) == -1) { if (!(shmflg & IPC_CREAT)) err = -ENOENT; else err = newseg(key, shmflg, size); } else if ((shmflg & IPC_CREAT) && (shmflg & IPC_EXCL)) { err = -EEXIST; } else { shp = shm_segs[id]; if (shp->u.shm_perm.mode & SHM_DEST) err = -EIDRM; else if (size > shp->u.shm_segsz) err = -EINVAL; else if (ipcperms (&shp->u.shm_perm, shmflg)) err = -EACCES; else err = (int) shp->u.shm_perm.seq * SHMMNI + id; } unlock_kernel(); up(¤t->mm->mmap_sem); return err; }
int main(int argc, char *argv[]) { struct keyvalue* kv = NULL; int fd = -1; int r = 0; if (!(initsetuid())) exit(1); if (argc < 2) { fprintf(stderr, "\nNo argument given.\n\nqosctrl (start|stop|restart|status|generate)\n\n"); exit(1); } if (strcmp(argv[1], "generate") == 0) { kv = initkeyvalues(); if (!readkeyvalues(kv, CONFIG_ROOT "/qos/settings")) { fprintf(stderr, "Cannot read QoS settings\n"); r = 1; goto END; } char enabled[STRING_SIZE]; if (!findkey(kv, "ENABLED", enabled)) strcpy(enabled, "off"); if (strcmp(enabled, "on") == 0) safe_system("/usr/bin/perl /var/ipfire/qos/bin/makeqosscripts.pl > " QOS_SH); else unlink(QOS_SH); } if ((fd = open(QOS_SH, O_RDONLY)) != -1) { close(fd); } else { // If there is no qos.sh do nothing. goto END; } safe_system("chmod 755 " QOS_SH " &>/dev/null"); if (strcmp(argv[1], "start") == 0) { safe_system(QOS_SH " start"); } else if (strcmp(argv[1], "stop") == 0) { safe_system(QOS_SH " clear"); } else if (strcmp(argv[1], "status") == 0) { safe_system(QOS_SH " status"); } else if (strcmp(argv[1], "restart") == 0) { safe_system(QOS_SH " restart"); } else { if (strcmp(argv[1], "generate") == 0) {exit(0);} fprintf(stderr, "\nBad argument given.\n\nqosctrl (start|stop|restart|status|generate)\n\n"); exit(1); } END: if (kv) freekeyvalues(kv); return r; }
void rpmluaDelVar(rpmlua _lua, const char *key, ...) { INITSTATE(_lua, lua); va_list va; va_start(va, key); (void) findkey(lua->L, FINDKEY_REMOVE, key, va); va_end(va); }
void chap(Ticketreq *tr) { char *secret, *hkey; DigestState *s; char sbuf[SECRETLEN], hbuf[DESKEYLEN]; uchar digest[MD5dlen]; char chal[CHALLEN]; OChapreply reply; /* * Create a challenge and send it. */ randombytes((uchar*)chal, sizeof(chal)); write(1, chal, sizeof(chal)); /* * get chap reply */ if(readn(0, &reply, sizeof(reply)) < 0) exits(0); safecpy(tr->uid, reply.uid, sizeof(tr->uid)); /* * lookup */ secret = findsecret(KEYDB, tr->uid, sbuf); hkey = findkey(KEYDB, tr->hostid, hbuf); if(hkey == 0 || secret == 0){ replyerror("chap-fail bad response %s", raddr); logfail(tr->uid); exits(0); } /* * check for match */ s = md5(&reply.id, 1, 0, 0); md5((uchar*)secret, strlen(secret), 0, s); md5((uchar*)chal, sizeof(chal), digest, s); if(memcmp(digest, reply.resp, MD5dlen) != 0){ replyerror("chap-fail bad response %s", raddr); logfail(tr->uid); exits(0); } succeed(tr->uid); /* * reply with ticket & authenticator */ if(tickauthreply(tr, hkey) < 0) exits(0); if(debug) syslog(0, AUTHLOG, "chap-ok %s %s", tr->uid, raddr); }
/* 0.9.9: calculates broadcast too. */ int setnetaddress(struct keyvalue *kv, char *colour) { char addressfield[STRING_SIZE]; char netaddressfield[STRING_SIZE]; char netmaskfield[STRING_SIZE]; char broadcastfield[STRING_SIZE]; char address[STRING_SIZE]; char netmask[STRING_SIZE]; unsigned long int intaddress; unsigned long int intnetaddress; unsigned long int intnetmask; unsigned long int intbroadcast; struct in_addr temp; char *netaddress; char *broadcast; /* Build some key strings. */ sprintf(addressfield, "%s_ADDRESS", colour); sprintf(netaddressfield, "%s_NETADDRESS", colour); sprintf(netmaskfield, "%s_NETMASK", colour); sprintf(broadcastfield, "%s_BROADCAST", colour); strcpy(address, ""); findkey(kv, addressfield, address); strcpy(netmask, ""); findkey(kv, netmaskfield, netmask); /* Calculate netaddress. Messy.. */ intaddress = inet_addr(address); intnetmask = inet_addr(netmask); intnetaddress = intaddress & intnetmask; temp.s_addr = intnetaddress; netaddress = inet_ntoa(temp); replacekeyvalue(kv, netaddressfield, netaddress); intbroadcast = intnetaddress | ~intnetmask; temp.s_addr = intbroadcast; broadcast = inet_ntoa(temp); replacekeyvalue(kv, broadcastfield, broadcast); return 1; }
void rpmluaPushTable(rpmlua _lua, const char *key, ...) { INITSTATE(_lua, lua); va_list va; va_start(va, key); (void) findkey(lua->L, FINDKEY_CREATE, key, va); lua->pushsize++; va_end(va); }
int probeisdncard(void) { int c; char message[STRING_SIZE]; char commandstring[STRING_SIZE]; char moduleparams[STRING_SIZE] = ""; struct keyvalue *kv = initkeyvalues(); int result = -1; if (!(readkeyvalues(kv, CONFIG_ROOT "isdn/settings"))) { freekeyvalues(kv); errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]); return -1; } findkey(kv, "MODULE_PARAMS", moduleparams); c = 1; while (cards[c].name) { sprintf(message, ctr[TR_CHECKING_FOR], cards[c].name); /* * For USB ISDN.... * just check /proc/bus/usb/devices for our supported device */ if (cards[c].type == 100) { if (probeusbisdncard("Vendor=0483 ProdID=481")) sprintf(commandstring, "/sbin/modprobe hisax_st5481 protocol=1 %s", moduleparams); else goto CONTINUE; } else { sprintf(commandstring, "/sbin/modprobe hisax type=%d protocol=1 %s", cards[c].type, moduleparams); } if (runcommandwithstatus(commandstring, message) == 0) { mysystem("/etc/ppp/isdn-cleanup"); sprintf(message, ctr[TR_DETECTED], cards[c].name); newtWinMessage(TITLE, ctr[TR_OK], message); result = cards[c].type; goto EXIT; } CONTINUE: c++; } errorbox(ctr[TR_UNABLE_TO_FIND_AN_ISDN_CARD]); EXIT: freekeyvalues(kv); return result; }
int findkey(struct node *root,int key) { int flag=0; if(root) { if(root->data==key) { root=NULL; flag=1; } else { flag=findkey(root->left,key); if(flag!=1) flag=findkey(root->right,key); } } return flag; }
int handlehostname(void) { char hostname[STRING_SIZE] = ""; struct keyvalue *kv = initkeyvalues(); char *values[] = { hostname, NULL }; /* pointers for the values. */ struct newtWinEntry entries[] = { { "", &values[0], 0,}, { NULL, NULL, 0 } }; int rc; int result; if (!(readkeyvalues(kv, CONFIG_ROOT "/main/settings"))) { freekeyvalues(kv); errorbox(_("Unable to open settings file")); return 0; } strcpy(hostname, SNAME); findkey(kv, "HOSTNAME", hostname); for (;;) { rc = newtWinEntries(_("Hostname"), _("Enter the machine's hostname."), 50, 5, 5, 40, entries, _("OK"), _("Cancel"), NULL); if (rc == 1) { strcpy(hostname, values[0]); if (!(strlen(hostname))) errorbox(_("Hostname cannot be empty.")); else if (strchr(hostname, ' ')) errorbox(_("Hostname cannot contain spaces.")); else if (strlen(hostname) != strspn(hostname, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-")) errorbox(_("Hostname may only contain letters, numbers and hyphens.")); else { replacekeyvalue(kv, "HOSTNAME", hostname); writekeyvalues(kv, CONFIG_ROOT "/main/settings"); writehostsfiles(); result = 1; break; } } else { result = 0; break; } } free(values[0]); freekeyvalues(kv); return result; }
char *env_get(const char *s) { char *r; long long i; if (!s) return (char *)0; for (i = 0; environ[i]; ++i) { r = findkey(environ[i], s); if (r) return r; } return (char *)0; }
/* Here they choose general network config, number of nics etc. */ int configtypemenu(void) { struct keyvalue *kv = initkeyvalues(); char temp[STRING_SIZE] = "1"; char message[1000]; int choise, found; int rc, configtype; if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings"))) { freekeyvalues(kv); errorbox(_("Unable to open settings file")); return 0; } found = scan_network_cards(); findkey(kv, "CONFIG_TYPE", temp); choise = atol(temp); choise--; sprintf(message, _("Select the network configuration for %s. " "The following configuration types list those interfaces which have ethernet attached. " "If you change this setting, a network restart will be required, and you will have to " "reconfigure the network driver assignments."), NAME); rc = newtWinMenu(_("Network configuration type"), message, 50, 5, 5, 6, configtypenames, &choise, _("OK"), _("Cancel"), NULL); if ( configtypecards[choise] > found ) { sprintf(message, _("Not enough netcards for your choice.\n\nNeeded: %d - Available: %d\n"), configtypecards[choise], found); errorbox(message); } if (rc == 0 || rc == 1) { choise++; sprintf(temp, "%d", choise); replacekeyvalue(kv, "CONFIG_TYPE", temp); configtype = atol(temp); if (!HAS_RED) clear_card_entry(_RED_CARD_); if (!HAS_ORANGE) clear_card_entry(_ORANGE_CARD_); if (!HAS_BLUE) clear_card_entry(_BLUE_CARD_); writekeyvalues(kv, CONFIG_ROOT "/ethernet/settings"); netaddresschange = 1; } freekeyvalues(kv); return 0; }
int main() { int n1,n2,k; printf("\nEnter the table values and index(starts from 1) need to find : "); scanf("%d%d%d",&n1,&n2,&k); if( (n1==0) || (n2==0) || (k==0) ) { printf("values cannot be zero"); return 0; } printf("\nThe element at index %d in merged table of %d,%d is %d",k,n1,n2,findkey(n1,n2,k)); return 0; }
const char* windowsxp_outlookexpress (void) { char* registry_location; char* registry_key = NULL; registry_location = windows_get_user_registry(); registry_key = findkey(registry_location, "\\Software\\Microsoft\\Internet Account Manager\\Accounts\\00000001" "\\Account Name"); if(registry_key) return "Outlook Express"; else return NULL; }
Datum exists(PG_FUNCTION_ARGS) { HStore *hs = PG_GETARG_HS(0); text *key = PG_GETARG_TEXT_P(1); HEntry *entry; entry = findkey(hs, VARDATA(key), VARSIZE(key) - VARHDRSZ); PG_FREE_IF_COPY(hs, 0); PG_FREE_IF_COPY(key, 1); PG_RETURN_BOOL(entry); }