SPEC_RET spec_janitor( CHAR_DATA *ch ) { OBJ_DATA *trash; OBJ_DATA *trash_next; if ( !is_awake(ch) ) return FALSE; for ( trash = ch->in_room->first_content; trash; trash = trash_next ) { trash_next = trash->next_content; if ( !HAS_BIT(trash->wear_flags, OBJWEAR_TAKE) ) continue; if ( HAS_BIT(trash->extra_flags, OBJFLAG_BURIED) ) continue; if ( trash->type == OBJTYPE_DRINK_CON || trash->type == OBJTYPE_TRASH || trash->cost < 10 || (trash->pObjProto->vnum == VNUM_OBJ_SHOPPING_BAG && !trash->first_content) ) { act( AT_ACTION, "$n raccoglie della spazzatura.", ch, NULL, NULL, TO_ROOM ); obj_from_room( trash ); obj_to_char( trash, ch ); return TRUE; } } return FALSE; }
void abort_handler(int signal) { static char crashed = FALSE; if (crashed) { exit(-1); } crashed = TRUE; restore_terminal(); clean_screen(gtd->ses); dump_stack(); fflush(NULL); exit(-1); if (gtd->ses->connect_retry > utime()) { gtd->ses->connect_retry = 0; } else if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_SGA) && !HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO)) { socket_printf(gtd->ses, 1, "%c", 3); } else { do_zap(gtd->ses, ""); } }
void write_mud(struct session *ses, char *command, int flags) { char output[BUFFER_SIZE]; int size; size = substitute(ses, command, output, flags); if (HAS_BIT(ses->flags, SES_FLAG_MAPPING)) { if (ses->map == NULL || ses->map->nofollow == 0) { check_insert_path(command, ses); } } if (ses->map && ses->map->in_room && ses->map->nofollow == 0) { if (!HAS_BIT(ses->map->flags, MAP_FLAG_NOFOLLOW)) { if (follow_map(ses, command)) { return; } } } write_line_mud(ses, output, size); }
void process_input(void) { if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_SGA) && !HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO)) { read_key(); } else { read_line(); } if (!HAS_BIT(gtd->flags, TINTIN_FLAG_PROCESSINPUT)) { return; } DEL_BIT(gtd->flags, TINTIN_FLAG_PROCESSINPUT); if (gtd->chat && gtd->chat->paste_time) { chat_paste(gtd->input_buf, NULL); return; } if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO)) { add_line_history(gtd->ses, gtd->input_buf); } if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO)) { echo_command(gtd->ses, gtd->input_buf); } else { echo_command(gtd->ses, ""); } if (gtd->ses->scroll_line != -1) { buffer_end(gtd->ses, ""); } check_all_events(gtd->ses, SUB_ARG|SUB_SEC, 0, 1, "RECEIVED INPUT", gtd->input_buf); gtd->ses = script_driver(gtd->ses, LIST_COMMAND, gtd->input_buf); if (IS_SPLIT(gtd->ses)) { erase_toeol(); } gtd->input_buf[0] = 0; }
void echo_command(struct session *ses, char *line) { char buffer[STRING_SIZE], result[STRING_SIZE]; if (HAS_BIT(ses->flags, SES_FLAG_SPLIT)) { sprintf(buffer, "%s%s\033[0m", ses->cmd_color, line); } else { sprintf(buffer, "%s", line); } /* Deal with pending output */ if (ses->more_output[0]) { if (ses->check_output) { strcpy(result, ses->more_output); ses->more_output[0] = 0; process_mud_output(ses, result, FALSE); } } DEL_BIT(ses->telopts, TELOPT_FLAG_PROMPT); if (HAS_BIT(ses->flags, SES_FLAG_SPLIT)) { if (!HAS_BIT(ses->flags, SES_FLAG_ECHOCOMMAND)) { sprintf(result, "\033[0;37m"); } else { sprintf(result, "%s%s", ses->more_output, buffer); } add_line_buffer(ses, buffer, -1); SET_BIT(ses->flags, SES_FLAG_SCROLLSTOP); tintin_printf2(ses, "%s", result); DEL_BIT(ses->flags, SES_FLAG_SCROLLSTOP); } else { add_line_buffer(ses, buffer, -1); } }
void modified_input(void) { kill_list(gtd->ses->list[LIST_TABCYCLE]); if (HAS_BIT(gtd->flags, TINTIN_FLAG_HISTORYSEARCH)) { cursor_history_find(""); } if (HAS_BIT(gtd->flags, TINTIN_FLAG_HISTORYBROWSE)) { DEL_BIT(gtd->flags, TINTIN_FLAG_HISTORYBROWSE); } }
char *get_arg_stop_spaces(struct session *ses, char *string, char *result, int flag) { char *pto, *pti; int nest = 0; pti = space_out(string); pto = result; while (*pti) { if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *pti & 128 && pti[1] != 0) { *pto++ = *pti++; *pto++ = *pti++; continue; } if (*pti == '\\' && pti[1] == COMMAND_SEPARATOR) { *pto++ = *pti++; } else if (*pti == COMMAND_SEPARATOR && nest == 0) { break; } else if (isspace((int) *pti) && nest == 0) { pti++; break; } else if (*pti == DEFAULT_OPEN) { nest++; } else if (*pti == '[' && HAS_BIT(flag, GET_NST)) { nest++; } else if (*pti == DEFAULT_CLOSE) { nest--; } else if (*pti == ']' && HAS_BIT(flag, GET_NST)) { nest--; } *pto++ = *pti++; } *pto = '\0'; return pti; }
void printline(struct session *ses, char **str, int prompt) { char *out; push_call("printline(%p,%p,%d)",ses,*str,prompt); if (ses->scroll_line != -1 && HAS_BIT(ses->flags, SES_FLAG_SCROLLLOCK)) { pop_call(); return; } if (HAS_BIT(ses->flags, SES_FLAG_SCAN) && !HAS_BIT(ses->flags, SES_FLAG_VERBOSE)) { pop_call(); return; } out = str_alloc(strlen(*str) * 2); if (HAS_BIT(ses->flags, SES_FLAG_CONVERTMETA)) { convert_meta(*str, out); str_cpy(str, out); } if (HAS_BIT(ses->flags, SES_FLAG_WORDWRAP)) { word_wrap(ses, *str, out, TRUE); } else { strcpy(out, *str); } if (prompt) { printf("%s", out); } else { printf("%s\n", out); } str_free(out); pop_call(); return; }
void process_mud_output(struct session *ses, char *linebuf, int prompt) { char line[STRING_SIZE]; ses->check_output = 0; strip_vt102_codes(linebuf, line); check_all_events(ses, SUB_ARG | SUB_SEC, 0, 2, "RECEIVED LINE", linebuf, line); if (prompt) { check_all_events(ses, SUB_ARG | SUB_SEC, 0, 2, "RECEIVED PROMPT", linebuf, line); } if (HAS_BIT(ses->flags, SES_FLAG_COLORPATCH)) { sprintf(line, "%s%s", ses->color, linebuf); get_color_codes(ses->color, linebuf, ses->color); linebuf = line; } do_one_line(linebuf, ses); /* changes linebuf */ /* Take care of gags, vt102 support still goes */ if (HAS_BIT(ses->flags, SES_FLAG_GAG)) { strip_non_vt102_codes(linebuf, ses->more_output); printf("%s", ses->more_output); ses->more_output[0] = 0; DEL_BIT(ses->flags, SES_FLAG_GAG); return; } add_line_buffer(ses, linebuf, prompt); if (ses == gtd->ses) { printline(ses, linebuf, prompt); } else if (HAS_BIT(ses->flags, SES_FLAG_SNOOP)) { strip_vt102_codes_non_graph(linebuf, linebuf); tintin_printf2(gtd->ses, "[%s] %s", ses->name, linebuf); } }
void interrupt_handler(int signal) { if (gtd->ses->connect_retry > utime()) { gtd->ses->connect_retry = 0; } else if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_SGA) && !HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO)) { socket_printf(gtd->ses, 1, "%c", 4); } else { cursor_delete_or_exit(gtd->ses, ""); } }
int inputline_raw_str_len(int start, int end) { int raw_cnt, ret_cnt; raw_cnt = start; ret_cnt = 0; while (raw_cnt < gtd->input_len) { if (raw_cnt >= end) { break; } if (HAS_BIT(gtd->ses->flags, SES_FLAG_UTF8) && (gtd->input_buf[raw_cnt] & 192) == 192) { raw_cnt++; while (raw_cnt < gtd->input_len && (gtd->input_buf[raw_cnt] & 192) == 128) { raw_cnt++; } } else { raw_cnt++; } ret_cnt++; } return ret_cnt; }
char *get_arg_to_brackets(struct session *ses, char *string, char *result) { char *pti, *pto, *ptii, *ptoo; int nest1 = 0, nest2 = 0, nest3 = 0; pti = space_out(string); pto = result; ptii = ptoo = NULL; while (*pti) { if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *pti & 128 && pti[1] != 0) { *pto++ = *pti++; *pto++ = *pti++; continue; } if (*pti == '[') { nest2++; if (nest1 == 0 && ptii == NULL) { ptii = pti; ptoo = pto; } } else if (*pti == ']') { if (nest2) { nest2--; } else { nest3 = 1; } if (*(pti+1) == 0 && ptii && nest1 == 0 && nest2 == 0 && nest3 == 0) { *ptoo = 0; return ptii; } } else if (*pti == DEFAULT_OPEN) { nest1++; } else if (*pti == DEFAULT_CLOSE) { nest1--; } *pto++ = *pti++; } *pto = 0; return pti; }
void add_line_history(struct session *ses, char *line) { struct listroot *root; root = ses->list[LIST_HISTORY]; if (*line == 0) { if (root->used && HAS_BIT(ses->flags, SES_FLAG_REPEATENTER)) { strcpy(line, root->list[root->used - 1]->left); } return; } if (*line == gtd->repeat_char) { search_line_history(ses, line); } update_node_list(ses->list[LIST_HISTORY], line, "", ""); while (root->used > gtd->history_size) { delete_index_list(ses->list[LIST_HISTORY], 0); } return; }
int strip_vt102_strlen(struct session *ses, char *str) { char *pti; int i = 0; pti = str; while (*pti) { if (skip_vt102_codes(pti)) { pti += skip_vt102_codes(pti); continue; } if (HAS_BIT(ses->flags, SES_FLAG_UTF8) && (*pti & 192) == 192) { pti++; while ((*pti & 192) == 128) { pti++; } } else { pti++; } i++; } return i; }
void winch_handler(int signal) { struct session *ses; init_screen_size(gts); for (ses = gts->next ; ses ; ses = ses->next) { init_screen_size(ses); if (HAS_BIT(ses->telopts, TELOPT_FLAG_NAWS)) { send_sb_naws(ses, 0, NULL); } } /* we have to reinitialize the signals for sysv machines if (signal(SIGWINCH, winch_handler) == BADSIG) { syserr("signal SIGWINCH"); } */ }
int check_one_regexp(struct session *ses, struct listnode *node, char *line, char *original, int option) { char *exp, *str; if (node->regex == NULL) { char result[BUFFER_SIZE]; substitute(ses, node->left, result, SUB_VAR|SUB_FUN); exp = result; } else { exp = node->left; } if (HAS_BIT(node->flags, NODE_FLAG_META)) { exp++; str = original; } else { str = line; } return tintin_regexp(ses, node->regex, str, exp, option, SUB_ARG); }
void DoExtDiskSpace(tBuffer *bIn, tBuffer *bOut, u_int32_t id) { struct STATFS stfs; tFSPath *realPath; char *path; path = convertFromUtf8(BufferGetString(bIn), 1); realPath = FSCheckPath(path); DEBUG((MYLOG_DEBUG, "[DoExtDiskSpaceOpenSSH]Path: %s", path)); if (realPath != NULL && !HAS_BIT(gl_var->flagsDisable, SFTP_DISABLE_STATSFS)) { DEBUG((MYLOG_DEBUG, "[DoExtDiskSpaceOpenSSH]Realpath: %s", realPath->realPath)); if (STATFS(realPath->realPath, &stfs) == 0) { tBuffer *b; b = BufferNew(); BufferPutInt8(b, SSH2_FXP_EXTENDED_REPLY); BufferPutInt32(b, id); BufferPutInt64(b, (u_int64_t) stfs.f_blocks * (u_int64_t) stfs.f_bsize); BufferPutInt64(b, (u_int64_t) stfs.f_bfree * (u_int64_t) stfs.f_bsize); BufferPutInt64(b, 0); BufferPutInt64(b, (u_int64_t) stfs.f_bavail * (u_int64_t) stfs.f_bsize); BufferPutInt32(b, stfs.f_bsize); BufferPutPacket(bOut, b); } else SendStatus(bOut, id, errnoToPortable(errno)); } else SendStatus(bOut, id, SSH2_FX_PERMISSION_DENIED); FSDestroyPath(realPath); free(path); }
void show_session(struct session *ses, struct session *ptr) { char temp[BUFFER_SIZE]; sprintf(temp, "%3d %-12s %20s:%-5s", ptr->socket, ptr->name, ptr->host, ptr->port); if (ptr == gtd->ses) { strcat(temp, " (active)"); } else { strcat(temp, " "); } if (ptr->mccp) { strcat(temp, " (mccp) "); } if (HAS_BIT(ptr->flags, SES_FLAG_SNOOP)) { strcat(temp, " (snooped)"); } if (ptr->logfile) { strcat(temp, " (logging)"); } tintin_puts2(ses, temp); }
char *get_arg_to_brackets(struct session *ses, char *string, char *result) { char *pti, *pto; pti = space_out(string); pto = result; while (*pti) { if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *pti & 128 && pti[1] != 0) { *pto++ = *pti++; *pto++ = *pti++; continue; } if (*pti == '[') { break; } *pto++ = *pti++; } *pto = 0; return pti; }
void check_all_prompts(struct session *ses, char *original, char *line) { struct listroot *root = ses->list[LIST_PROMPT]; struct listnode *node; if (!HAS_BIT(ses->flags, SES_FLAG_SPLIT)) { return; } for (root->update = 0 ; root->update < root->used ; root->update++) { if (check_one_regexp(ses, root->list[root->update], line, original, 0)) { node = root->list[root->update]; if (*node->right) { substitute(ses, node->right, original, SUB_ARG); substitute(ses, original, original, SUB_VAR|SUB_FUN|SUB_COL|SUB_ESC); } show_debug(ses, LIST_PROMPT, "#DEBUG PROMPT {%s}", node->left); do_one_prompt(ses, original, atoi(node->pr)); SET_BIT(ses->flags, SES_FLAG_GAG); } } }
/* * Se un mob conosce la magia e odia qualcuno allora prova a evocarlo. */ void summon_if_hating( CHAR_DATA *ch ) { CHAR_DATA *victim; char buf[MSL]; char name[MIL]; bool found = FALSE; if ( ch->position <= POSITION_SLEEP ) return; if ( ch->fighting ) return; if ( ch->fearing ) return; if ( !ch->hating ) return; if ( HAS_BIT(ch->in_room->flags, ROOM_SAFE) ) return; if ( ch->hunting ) return; /* Non evoca se un pg è vicino abbastanza da poterlo cacciare */ one_argument( ch->hating->name, name ); /* Si assicura che il giocatore esista, funziona anche se il pg esce dal gioco */ for ( victim = first_char; victim; victim = victim->next ) { if ( !str_cmp(victim->name, ch->hating->name) ) { found = TRUE; break; } } if ( !found ) return; if ( victim->in_room == ch->in_room ) return; sprintf( buf, "cast summon %s", name ); send_command( ch, buf, CO ); }
/* For exit flags */ void redit_disp_exit_flag_menu( DESCRIPTOR_DATA *d ) { EXIT_DATA *pexit = d->character->spare_ptr; char buf[MSL]; int x; write_to_buffer( d, "50\x1B[;H\x1B[2J", 0 ); for ( x = 0; x < MAX_EXIT; x++ ) { if ( (x == EXIT_RES1) || (x == EXIT_RES2) || (x == EXIT_PORTAL) ) continue; ch_printf( d->character, "&g%2d&w) %-20.20s\r\n", x+1, code_name(NULL, x, CODE_EXIT) ); } buf[0] = '\0'; for ( x = 0; x < MAX_EXIT; x++ ) { if ( HAS_BIT(pexit->flags, x) ) { strcat( buf, code_name(NULL, x, CODE_EXIT) ); strcat( buf, " " ); } } ch_printf( d->character, "\r\nExit flags: &c%s&w\r\n" "Enter room flags, 0 to quit: ", buf ); OLC_MODE(d) = REDIT_EXIT_FLAGS; }
void redit_disp_exit_edit( DESCRIPTOR_DATA *d ) { char flags[MSL]; EXIT_DATA *pexit = d->character->spare_ptr; int x; flags[0] = '\0'; for ( x = 0; x < MAX_EXIT; x++ ) { if ( pexit->flags && HAS_BIT(pexit->flags, x) ) { strcat( flags, code_name(NULL, x, CODE_EXIT) ); strcat( flags, " " ); } } OLC_MODE(d) = REDIT_EXIT_EDIT; write_to_buffer( d, "50\x1B[;H\x1B[2J", 0 ); ch_printf( d->character, "&g1&w) Direction : &c%s\r\n", code_name(NULL, pexit->vdir, CODE_DIR) ); ch_printf( d->character, "&g2&w) To Vnum : &c%d\r\n", (pexit->to_room) ? pexit->to_room->vnum : -1 ); ch_printf( d->character, "&g3&w) Key : &c%d\r\n", pexit->key ); ch_printf( d->character, "&g4&w) Keyword : &c%s\r\n", (VALID_STR(pexit->keyword)) ? pexit->keyword : "(none)" ); ch_printf( d->character, "&g5&w) Flags : &c%s\r\n", (VALID_STR(flags)) ? flags : "(none)" ); ch_printf( d->character, "&g6&w) Description: &c%s\r\n", (VALID_STR(pexit->description)) ? pexit->description : "(none)" ); send_to_char( d->character, "&gQ&w) Quit\r\n" ); send_to_char( d->character, "\r\nEnter choice: " ); }
SPEC_RET spec_executioner( CHAR_DATA *ch ) { MOB_PROTO_DATA *cityguard; CHAR_DATA *victim; CHAR_DATA *v_next; char *crime; char buf[MSL]; if ( !is_awake(ch) ) return FALSE; if ( ch->fighting ) return FALSE; crime = ""; for ( victim = ch->in_room->first_person; victim; victim = v_next ) { v_next = victim->next_in_room; if ( IS_PG(victim) && HAS_BIT_PLR(victim, PLAYER_KILLER) ) { crime = "assassino"; break; } if ( IS_PG(victim) && HAS_BIT_PLR(victim, PLAYER_THIEF) ) { crime = "ladro"; break; } } if ( !victim ) return FALSE; if ( HAS_BIT(ch->in_room->flags, ROOM_SAFE) ) { sprintf( buf, "yell codardo di un %s!", crime ); /* (GR) articolo */ send_command( ch, buf, CO ); return TRUE; } sprintf( buf, "yell Proteggiamo l'innocente dal %s!!", crime ); /* (GR) articolo dal dall' */ send_command( ch, buf, CO ); multi_hit( ch, victim, TYPE_UNDEFINED ); if ( char_died(ch) ) return TRUE; /* Aggiunto il log nel caso che venga a mancare la guardia cittadina */ cityguard = get_mob_index( NULL, VNUM_MOB_CITYGUARD ); if ( !cityguard ) { send_log( NULL, LOG_BUG, "spec_executioner: Guardia cittadina mancante - Vnum:[%d]", VNUM_MOB_CITYGUARD ); return TRUE; } char_to_room( make_mobile(cityguard), ch->in_room ); char_to_room( make_mobile(cityguard), ch->in_room ); return TRUE; }
void input_printf(char *format, ...) { char buf[STRING_SIZE]; va_list args; if (!HAS_BIT(gtd->flags, TINTIN_FLAG_HISTORYSEARCH)) { if (!HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO) && gtd->input_buf[0] != gtd->tintin_char) { return; } } va_start(args, format); vsprintf(buf, format, args); va_end(args); printf("%s", buf); }
int tintin_regexp_check(struct session *ses, char *exp) { if (*exp == '^') { return TRUE; } while (*exp) { if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *exp & 128 && exp[1] != 0) { exp += 2; continue; } switch (exp[0]) { case '\\': case '{': return TRUE; case '$': if (exp[1] == 0) { return TRUE; } break; case '%': switch (exp[1]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'd': case 'D': case 'i': case 'I': case 's': case 'S': case 'w': case 'W': case '?': case '*': case '+': case '.': case '%': return TRUE; } break; } exp++; } return FALSE; }
int inputline_str_chk(int offset, int totlen) { while (offset < totlen) { if (HAS_BIT(gtd->ses->flags, SES_FLAG_BIG5)) { if (gtd->input_buf[offset] & 128) { if (offset + 1 < totlen || gtd->input_buf[offset + 1] == 0) { return FALSE; } offset += 2; } else { offset += 1; } } else if (HAS_BIT(gtd->ses->flags, SES_FLAG_UTF8)) { switch (gtd->input_buf[offset] & (128 + 64 + 32 + 16)) { case 128 + 64: case 128 + 64 + 16: if (offset + 1 < totlen || (gtd->input_buf[offset + 1] & 192) != 128) { return FALSE; } offset += 2; break; case 128 + 64 + 32: if (offset + 2 < totlen || (gtd->input_buf[offset + 1] & 192) != 128 || (gtd->input_buf[offset + 2] & 192) != 128) { return FALSE; } offset += 3; break; case 128 + 64 + 32 + 16: if (offset + 3 < totlen || (gtd->input_buf[offset + 1] & 192) != 128 || (gtd->input_buf[offset + 2] & 192) != 128 || (gtd->input_buf[offset + 3] & 192) != 128) { return FALSE; } offset += 4; break; default: offset += 1; break; } } } return TRUE; }
int FlagsFromAccess(int access) { int flags = 0; if (HAS_BIT(access, SSH5_ACE4_READ_DATA)) { if (HAS_BIT(access, SSH5_ACE4_WRITE_DATA)) flags = O_RDWR; else flags = O_RDONLY; } else if (HAS_BIT(access, SSH5_ACE4_WRITE_DATA)) flags = O_WRONLY; if (HAS_BIT(access, SSH5_ACE4_APPEND_DATA)) flags |= O_APPEND; if (HAS_BIT(access, SSH5_ACE4_SYNCHRONIZE)) flags |= O_SYNC; return (flags); }
int check_all_aliases(struct session *ses, char *input) { struct listnode *node; struct listroot *root; char line[BUFFER_SIZE], tmp[BUFFER_SIZE], *arg; int i; root = ses->list[LIST_ALIAS]; if (HAS_BIT(root->flags, LIST_FLAG_IGNORE)) { return FALSE; } for (i = 1; i < 100; i++) { if (*gtd->vars[i]) { RESTRING(gtd->vars[i], ""); } } substitute(ses, input, line, SUB_VAR | SUB_FUN); for (root->update = 0; root->update < root->used; root->update++) { if (check_one_regexp(ses, root->list[root->update], line, line, PCRE_ANCHORED)) { node = root->list[root->update]; i = strlen(node->left); if (!strncmp(node->left, line, i)) { if (line[i] && line[i] != ' ') { continue; } arg = get_arg_in_braces(ses, line, tmp, FALSE); RESTRING(gtd->vars[0], arg) for (i = 1; i < 100 && *arg; i++) { arg = get_arg_in_braces(ses, arg, tmp, FALSE); RESTRING(gtd->vars[i], tmp); } } substitute(ses, node->right, tmp, SUB_ARG); if (!strncmp(node->left, line, strlen(node->left)) && !strcmp(node->right, tmp) && *gtd->vars[0]) { sprintf(input, "%s %s", tmp, gtd->vars[0]); } else { sprintf(input, "%s", tmp); } show_debug(ses, LIST_ALIAS, "#DEBUG ALIAS {%s} {%s}", node->left, gtd->vars[0]); return TRUE; } }
char *get_arg_in_brackets(struct session *ses, char *string, char *result) { char *pti, *pto; int nest = 1; pti = string; pto = result; if (*pti != '[') { *pto = 0; return pti; } pti++; while (*pti) { if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *pti & 128 && pti[1] != 0) { *pto++ = *pti++; *pto++ = *pti++; continue; } if (*pti == '[') { nest++; } else if (*pti == ']') { nest--; if (nest == 0) { break; } } *pto++ = *pti++; } if (*pti == 0) { tintin_printf2(NULL, "#UNMATCHED IN BRACKETS ERROR."); } else { pti++; } *pto = 0; return pti; }