std::vector<IMenu*> LayoutManager::findAllMenus(IWindow& window, const char* path) { // create a collection of all menus associated with this window. auto& windowMenus = window.menus(); std::vector<IMenu*> menus(windowMenus.size() + dynamicMenus_.size()); // copy all the menus owned by the window auto it = std::transform(windowMenus.begin(), windowMenus.end(), menus.begin(), [](const std::unique_ptr<IMenu>& menu) { return menu.get(); }); // copy all the menus dynamically registered for this window auto windowId = safe_str(window.id()); it = std::copy_if(dynamicMenus_.begin(), dynamicMenus_.end(), it, [&](IMenu* menu) { auto menuWindowId = safe_str(menu->windowId()); return strcmp(windowId, menuWindowId) == 0; }); // resize the collection to the actual number of menus that were collected menus.erase(it, menus.end()); for (auto it = menus.begin(); it != menus.end();) { if (matchMenu(**it, path)) { ++it; continue; } it = menus.erase(it); } return menus; }
void addNewNebula(dbref executor, int index, const char* name, double radius, double x, double y, double z, char *buff, char **bp) { aspace_borders* newNebula; newNebula = im_find(nebula_map, index); if (newNebula != NULL) { safe_str("#-1 NEBULA # ALREADY IN USE", buff, bp); return; } newNebula = mush_malloc(sizeof(aspace_borders), "nebula_info"); newNebula->name = mush_strdup(name, "spacenebula_name"); newNebula->empire_id = 0; newNebula->radius = radius; newNebula->x = x; newNebula->y = y; newNebula->z = z; if( im_insert(nebula_map, index, newNebula )) { safe_str("New nebula Created.", buff, bp); write_spacelog(executor, executor, tprintf("Nebula Created: %s", newNebula->name)); } else safe_str("#-1 NEBULA NOT CREATED.", buff, bp); }
/** Return a list of standard attributes. * This functions returns the list of standard attributes, separated by * spaces, in a statically allocated buffer. */ char * list_attribs(void) { ATTR *ap; const char *ptrs[BUFFER_LEN / 2]; static char buff[BUFFER_LEN]; char *bp; const char *name; int nptrs = -1, i; for (ap = ptab_firstentry_new(&ptab_attrib, &name); ap; ap = ptab_nextentry_new(&ptab_attrib, &name)) { if (strcmp(name, AL_NAME(ap))) continue; ptrs[++nptrs] = AL_NAME(ap); } bp = buff; if (nptrs >= 0) safe_str(ptrs[0], buff, &bp); for (i = 1; i < nptrs; i++) { safe_chr(' ', buff, &bp); safe_str(ptrs[i], buff, &bp); } *bp = '\0'; return buff; }
void display_flagtab(dbref player) { UTF8 *buf, *bp; FLAGNAMEENT *fp; bp = buf = alloc_lbuf("display_flagtab"); safe_str(T("Flags:"), buf, &bp); for (fp = gen_flag_names; fp->flagname; fp++) { FLAGBITENT *fbe = fp->fbe; if ( ( (fbe->listperm & CA_WIZARD) && !Wizard(player)) || ( (fbe->listperm & CA_GOD) && !God(player))) { continue; } safe_chr(' ', buf, &bp); safe_str(fp->flagname, buf, &bp); if (fbe->flaglett != ' ') { safe_chr('(', buf, &bp); if (!fp->bPositive) { safe_chr('!', buf, &bp); } safe_chr(fbe->flaglett, buf, &bp); safe_chr(')', buf, &bp); } } *bp = '\0'; notify(player, buf); free_lbuf(buf); }
void help_helper(dbref executor, int iHelpfile, UTF8 *topic_arg, UTF8 *buff, UTF8 **bufc) { if (!ValidateHelpFileIndex(iHelpfile)) { return; } size_t nTopic; const UTF8 *topic = MakeCanonicalTopicName(topic_arg, nTopic); CHashTable *htab = mudstate.aHelpDesc[iHelpfile].ht; struct help_entry *htab_entry = (struct help_entry *)hashfindLEN(topic, nTopic, htab); if (htab_entry) { UTF8 *result = alloc_lbuf("help_helper"); if (ReportTopic(executor, htab_entry, iHelpfile, result)) { safe_str(result, buff, bufc); } else { safe_str(T("#-1 ERROR"), buff, bufc); } free_lbuf(result); } else { safe_str(T("#-1 TOPIC DOES NOT EXIST"), buff, bufc); } }
static cachemgr_request * read_request(void) { char *buf; cachemgr_request *req; char *s; char *t; char *q; if ((buf = read_post_request()) != NULL) (void) 0; else if ((buf = read_get_request()) != NULL) (void) 0; else return NULL; #ifdef _SQUID_MSWIN_ if (strlen(buf) == 0 || strlen(buf) == 4000) #else if (strlen(buf) == 0) #endif return NULL; req = xcalloc(1, sizeof(cachemgr_request)); for (s = strtok(buf, "&"); s != NULL; s = strtok(NULL, "&")) { t = xstrdup(s); if ((q = strchr(t, '=')) == NULL) continue; *q++ = '\0'; rfc1738_unescape(t); rfc1738_unescape(q); if (0 == strcasecmp(t, "server") && strlen(q)) req->server = xstrdup(q); else if (0 == strcasecmp(t, "host") && strlen(q)) req->hostname = xstrdup(q); else if (0 == strcasecmp(t, "port") && strlen(q)) req->port = atoi(q); else if (0 == strcasecmp(t, "user_name") && strlen(q)) req->user_name = xstrdup(q); else if (0 == strcasecmp(t, "passwd") && strlen(q)) req->passwd = xstrdup(q); else if (0 == strcasecmp(t, "auth") && strlen(q)) req->pub_auth = xstrdup(q), decode_pub_auth(req); else if (0 == strcasecmp(t, "operation")) req->action = xstrdup(q); } if (req->server && !req->hostname) { char *p; req->hostname = strtok(req->server, ":"); if ((p = strtok(NULL, ":"))) req->port = atoi(p); } make_pub_auth(req); debug(1) fprintf(stderr, "cmgr: got req: host: '%s' port: %d uname: '%s' passwd: '%s' auth: '%s' oper: '%s'\n", safe_str(req->hostname), req->port, safe_str(req->user_name), safe_str(req->passwd), safe_str(req->pub_auth), safe_str(req->action)); return req; }
static char * menu_url(cachemgr_request * req, const char *action) { static char url[1024]; snprintf(url, sizeof(url), "%s?host=%s&port=%d&user_name=%s&operation=%s&auth=%s", script_name, req->hostname, req->port, safe_str(req->user_name), action, safe_str(req->pub_auth)); return url; }
void list_borders(char *buff, char **bp) { int first = 0; int index = 0; for (index = 1; index <= im_count(border_map); index++) { if (first) { safe_str("~", buff, bp); } safe_str(border_line_bot(index, im_find(border_map, index)), buff, bp); ++first; } }
static Block_Obj sass_parse_block(Sass_Compiler* compiler) throw() { // assert valid pointer if (compiler == 0) return 0; // The cpp context must be set by now Context* cpp_ctx = compiler->cpp_ctx; Sass_Context* c_ctx = compiler->c_ctx; // We will take care to wire up the rest compiler->cpp_ctx->c_compiler = compiler; compiler->state = SASS_COMPILER_PARSED; try { // get input/output path from options std::string input_path = safe_str(c_ctx->input_path); std::string output_path = safe_str(c_ctx->output_path); // maybe skip some entries of included files // we do not include stdin for data contexts bool skip = c_ctx->type == SASS_CONTEXT_DATA; // dispatch parse call Block_Obj root(cpp_ctx->parse()); // abort on errors if (!root) return 0; // skip all prefixed files? (ToDo: check srcmap) // IMO source-maps should point to headers already // therefore don't skip it for now. re-enable or // remove completely once this is tested size_t headers = cpp_ctx->head_imports; // copy the included files on to the context (dont forget to free later) if (copy_strings(cpp_ctx->get_included_files(skip, headers), &c_ctx->included_files) == NULL) throw(std::bad_alloc()); // return parsed block return root; } // pass errors to generic error handler catch (...) { handle_errors(c_ctx); } // error return 0; }
static void do_whichof(char *args[], int nargs, enum whichof_t flag, char *buff, char **bp, dbref executor, dbref caller, dbref enactor, NEW_PE_INFO *pe_info, int eflags, int isbool) { int j; char tbuf[BUFFER_LEN], *tp; char sep[BUFFER_LEN]; char const *ap; int first = 1; tbuf[0] = '\0'; if (eflags <= 0) eflags = PE_DEFAULT; if (flag == DO_ALLOF) { /* The last arg is a delimiter. Parse it in place. */ char *sp = sep; const char *arglast = args[nargs - 1]; if (process_expression(sep, &sp, &arglast, executor, caller, enactor, eflags, PT_DEFAULT, pe_info)) return; *sp = '\0'; nargs--; } else sep[0] = '\0'; for (j = 0; j < nargs; j++) { tp = tbuf; ap = args[j]; if (process_expression(tbuf, &tp, &ap, executor, caller, enactor, eflags, PT_DEFAULT, pe_info)) return; *tp = '\0'; if ((isbool && parse_boolean(tbuf)) || (!isbool && strlen(tbuf))) { if (!first && *sep) { safe_str(sep, buff, bp); } else first = 0; safe_str(tbuf, buff, bp); if (flag == DO_FIRSTOF) return; } } if (flag == DO_FIRSTOF) safe_str(tbuf, buff, bp); }
/** Return a list of all available locks * \param buff the buffer * \param bp a pointer to the current position in the buffer. * \param name if not NULL, only show locks with this prefix */ void list_locks(char *buff, char **bp, const char *name) { lock_list **locks, *lk; bool first = 1; int nlocks = 0, n; locks = mush_calloc(htab_locks.entries, sizeof(lock_list), "lock.list"); for (lk = hash_firstentry(&htab_locks); lk; lk = hash_nextentry(&htab_locks)) { /* Skip those that don't match */ if (name && !string_prefix(lk->type, name)) continue; locks[nlocks++] = lk; } qsort(locks, nlocks, sizeof lk, lock_compare); for (n = 0; n < nlocks; n += 1) { if (first) { first = 0; } else { safe_chr(' ', buff, bp); } safe_str(strupper(locks[n]->type), buff, bp); } mush_free(locks, "lock.list"); }
/** Given a warning bitmask, return a string of warnings on it. * \param warns the warnings. * \return pointer to statically allocated string listing warnings. */ const char * unparse_warnings(warn_type warns) { static char tbuf1[BUFFER_LEN]; char *tp; int listsize, indexx; tp = tbuf1; /* Get the # of elements in checklist */ listsize = sizeof(checklist) / sizeof(tcheck); /* Point c at last non-null in checklist, and go backwards */ for (indexx = listsize - 2; warns && (indexx >= 0); indexx--) { warn_type the_flag = checklist[indexx].flag; if (!(the_flag & ~warns)) { /* Which is to say: * if the bits set on the_flag is a subset of the bits set on warns */ safe_str(checklist[indexx].name, tbuf1, &tp); safe_chr(' ', tbuf1, &tp); /* If we've got a flag which subsumes smaller ones, don't * list the smaller ones */ warns &= ~the_flag; } } *tp = '\0'; return tbuf1; }
static void listq_walk(const char *cur, int count __attribute__ ((__unused__)), void *userdata) { struct st_qreg_data *st_data = (struct st_qreg_data *) userdata; char *name; name = (char *) cur + 1; if (!st_data->wild || quick_wild(st_data->wild, name)) { if (st_data->count++) { safe_str(st_data->osep, st_data->buff, st_data->bp); } safe_str(name, st_data->buff, st_data->bp); } }
static int cu5_pennpy_unparse(PyObject *value, char *buff, char **bp) { char *value_str; if (value == Py_None) { /* No value. */ return 1; } /* Coerce value to string. */ if (!(value = PyObject_Str(value))) { /* Swallow exception. */ PyErr_Clear(); return 0; } /* Get string. */ if (!(value_str = PyString_AsString(value))) { /* Swallow exception. */ PyErr_Clear(); Py_DECREF(value); return 0; } safe_str(value_str, buff, bp); Py_DECREF(value); return 1; }
/** Process a 'relay' or 'relay_early' <b>cell</b> that just arrived from * <b>conn</b>. Make sure it came in with a recognized circ_id. Pass it on to * circuit_receive_relay_cell() for actual processing. */ static void command_process_relay_cell(cell_t *cell, or_connection_t *conn) { circuit_t *circ; int reason, direction; circ = circuit_get_by_circid_orconn(cell->circ_id, conn); if (!circ) { log_debug(LD_OR, "unknown circuit %d on connection from %s:%d. Dropping.", cell->circ_id, conn->_base.address, conn->_base.port); return; } if (circ->state == CIRCUIT_STATE_ONIONSKIN_PENDING) { log_fn(LOG_PROTOCOL_WARN,LD_PROTOCOL,"circuit in create_wait. Closing."); circuit_mark_for_close(circ, END_CIRC_REASON_TORPROTOCOL); return; } if (CIRCUIT_IS_ORIGIN(circ)) { /* if we're a relay and treating connections with recent local * traffic better, then this is one of them. */ conn->client_used = time(NULL); } if (!CIRCUIT_IS_ORIGIN(circ) && cell->circ_id == TO_OR_CIRCUIT(circ)->p_circ_id) direction = CELL_DIRECTION_OUT; else direction = CELL_DIRECTION_IN; /* If we have a relay_early cell, make sure that it's outbound, and we've * gotten no more than MAX_RELAY_EARLY_CELLS_PER_CIRCUIT of them. */ if (cell->command == CELL_RELAY_EARLY) { if (direction == CELL_DIRECTION_IN) { /* XXX Allow an unlimited number of inbound relay_early cells for * now, for hidden service compatibility. See bug 1038. -RD */ } else { or_circuit_t *or_circ = TO_OR_CIRCUIT(circ); if (or_circ->remaining_relay_early_cells == 0) { log_fn(LOG_PROTOCOL_WARN, LD_OR, "Received too many RELAY_EARLY cells on circ %d from %s:%d." " Closing circuit.", cell->circ_id, safe_str(conn->_base.address), conn->_base.port); circuit_mark_for_close(circ, END_CIRC_REASON_TORPROTOCOL); return; } --or_circ->remaining_relay_early_cells; } } if ((reason = circuit_receive_relay_cell(cell, circ, direction)) < 0) { log_fn(LOG_PROTOCOL_WARN,LD_PROTOCOL,"circuit_receive_relay_cell " "(%s) failed. Closing.", direction==CELL_DIRECTION_OUT?"forward":"backward"); circuit_mark_for_close(circ, -reason); } }
IWindow* LayoutManager::getWindow(const char* windowId) { auto windowIt = windows_.find(safe_str(windowId)); if (windowIt == windows_.end()) { return nullptr; } return windowIt->second; }
static void do_whichof(char *args[], int nargs, enum whichof_t flag, char *buff, char **bp, dbref executor, dbref caller, dbref enactor, PE_Info *pe_info, int isbool) { int j; char tbuf[BUFFER_LEN], *tp; char const *sp; char sep = ' '; int first = 1; tbuf[0] = '\0'; if (flag == DO_ALLOF) { /* The last arg is a delimiter. Parse it in place. */ char insep[BUFFER_LEN]; char *isep = insep; const char *arglast = args[nargs - 1]; process_expression(insep, &isep, &arglast, executor, caller, enactor, PE_DEFAULT, PT_DEFAULT, pe_info); *isep = '\0'; strcpy(args[nargs - 1], insep); if (!delim_check(buff, bp, nargs, args, nargs, &sep)) return; nargs--; } for (j = 0; j < nargs; j++) { tp = tbuf; sp = args[j]; process_expression(tbuf, &tp, &sp, executor, caller, enactor, PE_DEFAULT, PT_DEFAULT, pe_info); *tp = '\0'; if ((isbool && parse_boolean(tbuf)) || (!isbool && strlen(tbuf))) { if (!first) { safe_chr(sep, buff, bp); } else first = 0; safe_str(tbuf, buff, bp); if (flag == DO_FIRSTOF) return; } } if (flag == DO_FIRSTOF) safe_str(tbuf, buff, bp); }
void deleteBorder(dbref executor, int border, char *buff, char **bp) { aspace_borders *theBorder; if (!border) { safe_str("#-1 BORDER NOT SUPPLIED", buff, bp); return; } theBorder = im_find(border_map, border); if (theBorder !=NULL) { write_spacelog(executor, executor, tprintf("Border deleted: %s", theBorder->name)); free_borderinfo(theBorder); im_delete(border_map, border); } else { safe_str("#-1 BORDER NOT FOUND", buff, bp); return; } }
/** Display the access list. * \param player enactor. * Sends the complete access list to the player. */ void do_list_access(dbref player) { struct access *ap; acsflag *c; char flaglist[BUFFER_LEN]; int rulenum = 0; char *bp; for (ap = access_top; ap; ap = ap->next) { rulenum++; if (ap->can != ACS_SITELOCK) { bp = flaglist; for (c = acslist; c->name; c++) { if (c->flag == ACS_DEFAULT) continue; if (ap->can & c->flag) { safe_chr(' ', flaglist, &bp); safe_str(c->name, flaglist, &bp); } if (c->toggle && (ap->cant & c->flag)) { safe_chr(' ', flaglist, &bp); safe_chr('!', flaglist, &bp); safe_str(c->name, flaglist, &bp); } } *bp = '\0'; notify_format(player, T("%3d SITE: %-20s DBREF: %-6s FLAGS:%s"), rulenum, ap->host, unparse_dbref(ap->who), flaglist); notify_format(player, T(" COMMENT: %s"), ap->comment ? ap->comment : ""); } else { notify(player, T ("---- @sitelock will add sites immediately below this line ----")); } } if (rulenum == 0) { notify(player, T("There are no access rules.")); } }
static void ShowPsLine(BQUE *tmp) { char *bufp = unparse_object(Show_Player, tmp->executor, false); if (tmp->IsTimed && (Good_obj(tmp->sem))) { CLinearTimeDelta ltd = tmp->waittime - Show_lsaNow; notify(Show_Player, tprintf("[#%d/%d]%s:%s", tmp->sem, ltd.ReturnSeconds(), bufp, tmp->comm)); } else if (tmp->IsTimed) { CLinearTimeDelta ltd = tmp->waittime - Show_lsaNow; notify(Show_Player, tprintf("[%d]%s:%s", ltd.ReturnSeconds(), bufp, tmp->comm)); } else if (Good_obj(tmp->sem)) { notify(Show_Player, tprintf("[#%d]%s:%s", tmp->sem, bufp, tmp->comm)); } else { notify(Show_Player, tprintf("%s:%s", bufp, tmp->comm)); } char *bp = bufp; if (Show_Key == PS_LONG) { for (int i = 0; i < tmp->nargs; i++) { if (tmp->env[i] != NULL) { safe_str("; Arg", bufp, &bp); safe_chr((char)(i + '0'), bufp, &bp); safe_str("='", bufp, &bp); safe_str(tmp->env[i], bufp, &bp); safe_chr('\'', bufp, &bp); } } *bp = '\0'; bp = unparse_object(Show_Player, tmp->enactor, false); notify(Show_Player, tprintf(" Enactor: %s%s", bp, bufp)); free_lbuf(bp); } free_lbuf(bufp); }
/* Issue a log message describing <b>commit</b>. */ static void commit_log(const sr_commit_t *commit) { tor_assert(commit); log_debug(LD_DIR, "SR: Commit from %s", sr_commit_get_rsa_fpr(commit)); log_debug(LD_DIR, "SR: Commit: [TS: %" PRIu64 "] [Encoded: %s]", commit->commit_ts, commit->encoded_commit); log_debug(LD_DIR, "SR: Reveal: [TS: %" PRIu64 "] [Encoded: %s]", commit->reveal_ts, safe_str(commit->encoded_reveal)); }
void list_lock_flags_long(char *buff, char **bp) { int i; int first = 1; for (i = 0; lock_privs[i].name; i++) { if (!first) safe_chr(' ', buff, bp); first = 0; safe_str(lock_privs[i].name, buff, bp); } }
static void decode_pub_auth(cachemgr_request * req) { char *buf; const char *host_name; const char *time_str; const char *user_name; const char *passwd; debug(2) fprintf(stderr, "cmgr: decoding pub: '%s'\n", safe_str(req->pub_auth)); safe_free(req->passwd); if (!req->pub_auth || strlen(req->pub_auth) < 4 + strlen(safe_str(req->hostname))) return; buf = xstrdup(base64_decode(req->pub_auth)); debug(3) fprintf(stderr, "cmgr: length ok\n"); /* parse ( a lot of memory leaks, but that is cachemgr style :) */ if ((host_name = strtok(buf, "|")) == NULL) return; debug(3) fprintf(stderr, "cmgr: decoded host: '%s'\n", host_name); if ((time_str = strtok(NULL, "|")) == NULL) return; debug(3) fprintf(stderr, "cmgr: decoded time: '%s' (now: %d)\n", time_str, (int) now); if ((user_name = strtok(NULL, "|")) == NULL) return; debug(3) fprintf(stderr, "cmgr: decoded uname: '%s'\n", user_name); if ((passwd = strtok(NULL, "|")) == NULL) return; debug(2) fprintf(stderr, "cmgr: decoded passwd: '%s'\n", passwd); /* verify freshness and validity */ if (atoi(time_str) + passwd_ttl < now) return; if (strcasecmp(host_name, req->hostname)) return; debug(1) fprintf(stderr, "cmgr: verified auth. info.\n"); /* ok, accept */ xfree(req->user_name); req->user_name = xstrdup(user_name); req->passwd = xstrdup(passwd); xfree(buf); }
static bool encode_base64(const char *input, int len, char *buff, char **bp) { BIO *bio, *b64, *bmem; char *membuf; b64 = BIO_new(BIO_f_base64()); if (!b64) { safe_str(T("#-1 ALLOCATION ERROR"), buff, bp); return false; } BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); bmem = BIO_new(BIO_s_mem()); if (!bmem) { safe_str(T("#-1 ALLOCATION ERROR"), buff, bp); BIO_free(b64); return false; } bio = BIO_push(b64, bmem); if (BIO_write(bio, input, len) < 0) { safe_str(T("#-1 CONVERSION ERROR"), buff, bp); BIO_free_all(bio); return false; } (void) BIO_flush(bio); len = BIO_get_mem_data(bmem, &membuf); safe_strl(membuf, len, buff, bp); BIO_free_all(bio); return true; }
void deleteNebula(dbref executor, int index, char *buff, char **bp) { aspace_borders *nebula; if (!index) { safe_str("#-1 NEBULA NOT SUPPLIED", buff, bp); return; } if (aspace_config.nebula < 1) { safe_str("#-1 DISABLED IN CONFIG", buff, bp); return; } nebula = im_find(nebula_map, index); if (nebula !=NULL) { write_spacelog(executor, executor, tprintf("Nebula deleted: %s", nebula->name)); free_borderinfo(nebula); im_delete(nebula_map, index); } else { safe_str("#-1 NEBULA NOT FOUND", buff, bp); return; } }
/** Return a string with all help entries that match a pattern */ static char * list_matching_entries(char *pattern, help_file *help_dat, const char *sep) { static char buff[BUFFER_LEN]; int offset; char *bp; size_t n; int len; bp = buff; if (help_dat->admin) offset = 1; /* To skip the leading & */ else offset = 0; if (!wildcard(pattern)) { /* Quick way out, use the other kind of matching */ char the_topic[LINE_SIZE + 2]; help_indx *entry = NULL; strcpy(the_topic, normalize_entry(help_dat, pattern)); if (!help_dat->indx || help_dat->entries == 0) return T("#-1 NO INDEX FOR FILE"); entry = help_find_entry(help_dat, the_topic); if (!entry) return (char *) ""; return (char *) (entry->topic + offset); } bp = buff; if (sep) len = strlen(sep); for (n = 0; n < help_dat->entries; n++) if (quick_wild(pattern, help_dat->indx[n].topic + offset)) { safe_str(help_dat->indx[n].topic + offset, buff, &bp); if (sep) safe_strl(sep, len, buff, &bp); } if (bp > buff) *(bp - len) = '\0'; else { *bp = '\0'; } return buff; }
/** Return a list of standard attributes. * This functions returns the list of standard attributes, separated by * spaces, in a statically allocated buffer. */ char * list_attribs(void) { ATTR *ap; const char *ptrs[BUFFER_LEN / 2]; static char buff[BUFFER_LEN]; char *bp; int nptrs = 0, i; ap = (ATTR *) ptab_firstentry(&ptab_attrib); ptrs[0] = ""; while (ap) { ptrs[nptrs++] = AL_NAME(ap); ap = (ATTR *) ptab_nextentry(&ptab_attrib); } bp = buff; safe_str(ptrs[0], buff, &bp); for (i = 1; i < nptrs; i++) { safe_chr(' ', buff, &bp); safe_str(ptrs[i], buff, &bp); } *bp = '\0'; return buff; }
void display_flagtab( dbref player ) { char *buf, *bp; FLAGENT *fp; bp = buf = alloc_lbuf( "display_flagtab" ); safe_str( ( char * ) "Flags:", buf, &bp ); for( fp = gen_flags; fp->flagname; fp++ ) { if( ( fp->listperm & CA_WIZARD ) && !Wizard( player ) ) { continue; } if( ( fp->listperm & CA_GOD ) && !God( player ) ) { continue; } safe_chr( ' ', buf, &bp ); safe_str( ( char * ) fp->flagname, buf, &bp ); safe_chr( '(', buf, &bp ); safe_chr( fp->flaglett, buf, &bp ); safe_chr( ')', buf, &bp ); } *bp = '\0'; notify( player, buf ); free_lbuf( buf ); }
void display_powertab(dbref player) { char *buf, *bp; POWERENT *fp; bp = buf = alloc_lbuf("display_powertab"); safe_str((char *) "Powers:", buf, &bp); for (fp = gen_powers; fp->powername; fp++) { if ((fp->listperm & CA_WIZARD) && !Wizard(player)) { continue; } if ((fp->listperm & CA_GOD) && !God(player)) { continue; } safe_chr(' ', buf, &bp); safe_str((char *) fp->powername, buf, &bp); } *bp = '\0'; notify(player, buf); free_lbuf(buf); }
/** Return a list of all available locks * \param buff the buffer * \param bp a pointer to the current position in the buffer */ void list_locks(char *buff, char **bp, const char *name) { char rbuff[BUFFER_LEN]; char *rp; int first = 1; const lock_list *ptr; rp = rbuff; for (ptr = lock_types; ptr->type != NULL; ptr++) { /* Skip those that don't match */ if (name && !string_prefix(ptr->type, name)) continue; if (first) { first = 0; } else { safe_chr(' ', rbuff, &rp); } safe_str(ptr->type, rbuff, &rp); } *rp = '\0'; /* We strupper it for consistency with the other * @list/foo and list(foo)s. */ safe_str(strupper(rbuff), buff, bp); }