From abe994ae16b892106e0b36d7be5bfd7e1100075c Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Mon, 21 Mar 2005 18:49:34 +0000 Subject: Internally renamed some option flags to match their #opt counterparts: echo_int => opt_info echo_key => opt_keyecho echo_ext => opt_echo As per the 1.2.6-dain patch diff --git a/cmd.c b/cmd.c index f25a845..b9f924d 100644 --- a/cmd.c +++ b/cmd.c @@ -464,7 +464,7 @@ static void cmd_clear __P1 (char *,arg) static void cmd_shell __P1 (char *,arg) { if (!*arg) { - if (echo_int) { + if (opt_info) { PRINTF("#that's easy.\n"); } } else { @@ -606,7 +606,7 @@ static void cmd_hilite __P1 (char *,arg) attr = parse_attributes(arg); if (attr == -1) { PRINTF("#attribute syntax error.\n"); - if (echo_int) + if (opt_info) show_attr_syntax(); } else { attr_string(attr, edattrbeg, edattrend); @@ -614,7 +614,7 @@ static void cmd_hilite __P1 (char *,arg) edattrbg = ATTR(attr) & ATTR_INVERSE ? 1 : BACKGROUND(attr) != NO_COLOR || ATTR(attr) & ATTR_BLINK; - if (echo_int) { + if (opt_info) { PRINTF("#input highlighting is now %so%s%s.\n", edattrbeg, (attr == NOATTRCODE) ? "ff" : "n", edattrend); @@ -665,7 +665,7 @@ static void cmd_host __P1 (char *,arg) if (*arg) { my_strncpy(hostname, newhost, BUFSIZE-1); portnumber = atoi(arg); - if (echo_int) { + if (opt_info) { PRINTF("#host set to: %s %d\n", hostname, portnumber); } } else { @@ -698,14 +698,14 @@ static void cmd_request __P1 (char *,arg) if ((all || !strncmp(buf, "editor", len))) { tcp_raw_write(tcp_fd, ideditor, strlen(ideditor)); CONN_LIST(tcp_fd).flags |= IDEDITOR; - if (echo_int) { + if (opt_info) { PRINTF("#request editor: %s done!\n", ideditor); } } if ((all || !strncmp(buf, "prompt", len))) { tcp_raw_write(tcp_fd, idprompt, strlen(idprompt)); CONN_LIST(tcp_fd).flags |= IDPROMPT; - if (echo_int) { + if (opt_info) { PRINTF("#request prompt: %s done!\n", idprompt); } } @@ -789,7 +789,7 @@ static void cmd_in __P1 (char *,arg) PRINTF("#cannot create delay label without a command.\n"); } } else if (*p && !millisec) { - if (echo_int) { + if (opt_info) { PRINTF("#deleting delay label: %s %s\n", name, (*p)->command); } delete_delaynode(p); @@ -918,12 +918,12 @@ static void cmd_init __P1 (char *,arg) if (*arg == '=') { if (*++arg) { my_strncpy(initstr, arg, BUFSIZE-1); - if (echo_int) { + if (opt_info) { PRINTF("#init: %s\n", initstr); } } else { *initstr = '\0'; - if (echo_int) { + if (opt_info) { PRINTF("#init cleared.\n"); } } @@ -1063,7 +1063,7 @@ static void cmd_nice __P1 (char *,arg) static void cmd_prefix __P1 (char *,arg) { strcpy(prefixstr, arg); - if (echo_int) { + if (opt_info) { PRINTF("#prefix %s.\n", *arg ? "set" : "cleared"); } } @@ -1077,7 +1077,7 @@ static void cmd_quote __P1 (char *,arg) verbatim = 1; else if (!strcmp(arg, "off")) verbatim = 0; - if (echo_int) { + if (opt_info) { PRINTF("#%s mode.\n", verbatim ? "verbatim" : "normal"); } } @@ -1222,7 +1222,7 @@ static void cmd_stop __P1 (char *,arg) dying->next = dead_delays; dead_delays = dying; } - if (echo_int) { + if (opt_info) { PRINTF("#all delayed labels are now disabled.\n"); } } @@ -1394,7 +1394,7 @@ static void cmd_send __P1 (char *,arg) *newline = '\0'; if (!start || i++>=start) { - if (echo_ext) { + if (opt_echo) { PRINTF("[%s]\n", buf); } tcp_write(tcp_fd, buf); @@ -1402,7 +1402,7 @@ static void cmd_send __P1 (char *,arg) } if (kind == '!') pclose(fp); else fclose(fp); } else { - if (echo_ext) { + if (opt_echo) { PRINTF("[%s]\n", arg); } tcp_write(tcp_fd, arg); @@ -1564,7 +1564,7 @@ static void cmd_var __P1 (char *,arg) named_var = add_varnode(arg, kind); if (REAL_ERROR) return; - if (echo_int) { + if (opt_info) { PRINTF("#new variable: \"%s\"\n", arg - 1); } } else { @@ -1613,7 +1613,7 @@ static void cmd_var __P1 (char *,arg) ptrdel(pbuf); return; } - if (echo_int) { + if (opt_info) { PRINTF("#new variable: %c%s\n", kind ? '$' : '@', buf); } @@ -1664,7 +1664,7 @@ static void cmd_var __P1 (char *,arg) PRINTF("#cannot delete variable: \"%s\"\n", arg - 1); } else { delete_varnode(p_named_var, kind); - if (echo_int) { + if (opt_info) { PRINTF("#deleted variable: \"%s\"\n", arg - 1); } } @@ -1823,7 +1823,7 @@ static void cmd_setvar __P1 (char *,arg) else { if (buf > 0) lines = (int)buf; - if (echo_int) { + if (opt_info) { PRINTF("#setvar: lines=%d\n", lines); } } @@ -1834,7 +1834,7 @@ static void cmd_setvar __P1 (char *,arg) else { if (buf == 0 || buf >= PARAMLEN) limit_mem = buf <= INT_MAX ? (int)buf : INT_MAX; - if (echo_int) { + if (opt_info) { PRINTF("#setvar: mem=%d%s\n", limit_mem, limit_mem ? "" : " (unlimited)"); } @@ -2005,7 +2005,7 @@ static void cmd_capture __P1 (char *,arg) log_flush(); fclose(capturefile); capturefile = NULL; - if (echo_int) { + if (opt_info) { PRINTF("#end of capture to file.\n"); } } else { @@ -2023,7 +2023,7 @@ static void cmd_capture __P1 (char *,arg) } if ((capturefile = fopen(arg, (append) ? "a" : "w")) == NULL) { PRINTF("#error writing file \"%s\"\n", arg); - } else if (echo_int) { + } else if (opt_info) { PRINTF("#capture to \"%s\" active, \"#capture\" ends.\n", arg); } } @@ -2039,7 +2039,7 @@ static void cmd_movie __P1 (char *,arg) log_flush(); fclose(moviefile); moviefile = NULL; - if (echo_int) { + if (opt_info) { PRINTF("#end of movie to file.\n"); } } else { @@ -2052,7 +2052,7 @@ static void cmd_movie __P1 (char *,arg) if ((moviefile = fopen(arg, "w")) == NULL) { PRINTF("#error writing file \"%s\"\n", arg); } else { - if (echo_int) { + if (opt_info) { PRINTF("#movie to \"%s\" active, \"#movie\" ends.\n", arg); } update_now(); @@ -2071,7 +2071,7 @@ static void cmd_record __P1 (char *,arg) if (recordfile) { fclose(recordfile); recordfile = NULL; - if (echo_int) { + if (opt_info) { PRINTF("#end of record to file.\n"); } } else { @@ -2083,7 +2083,7 @@ static void cmd_record __P1 (char *,arg) } else { if ((recordfile = fopen(arg, "w")) == NULL) { PRINTF("#error writing file \"%s\"\n", arg); - } else if (echo_int) { + } else if (opt_info) { PRINTF("#record to \"%s\" active, \"#record\" ends.\n", arg); } } @@ -2165,7 +2165,7 @@ static void cmd_color __P1 (char *,arg) if (!*arg) { strcpy(tty_modenorm, tty_modenormbackup); tty_puts(tty_modenorm); - if (echo_int) { + if (opt_info) { PRINTF("#standard color cleared.\n"); } return; @@ -2174,7 +2174,7 @@ static void cmd_color __P1 (char *,arg) attrcode = parse_attributes(arg); if (attrcode == -1) { PRINTF("#invalid attribute syntax.\n"); - if (echo_int) + if (opt_info) show_attr_syntax(); } else { int bg = BACKGROUND(attrcode), fg = FOREGROUND(attrcode); @@ -2185,7 +2185,7 @@ static void cmd_color __P1 (char *,arg) fg%c%s %s\n", (*nodep)->active ? '+' : '-', (*nodep)->label, (*nodep)->pattern); } @@ -243,7 +243,7 @@ static void delete_action __P1 (actionnode **,nodep) */ static void delete_prompt __P1 (actionnode **,nodep) { - if (echo_int) { + if (opt_info) { PRINTF("#deleting prompt: >%c%s %s\n", (*nodep)->active ? '+' : '-', (*nodep)->label, (*nodep)->pattern); } @@ -256,7 +256,7 @@ static void delete_prompt __P1 (actionnode **,nodep) static void add_new_action __P6 (char *,label, char *,pattern, char *,command, int,active, int,type, void *,q) { add_actionnode(pattern, command, label, active, type, q); - if (echo_int) { + if (opt_info) { PRINTF("#new action: %c%c%s %s=%s\n", action_chars[type], active ? '+' : '-', label, @@ -270,7 +270,7 @@ static void add_new_action __P6 (char *,label, char *,pattern, char *,command, i static void add_new_prompt __P6 (char *,label, char *,pattern, char *,command, int,active, int,type, void *,q) { add_promptnode(pattern, command, label, active, type, q); - if (echo_int) { + if (opt_info) { PRINTF("#new prompt: %c%c%s %s=%s\n", action_chars[type], active ? '+' : '-', label, @@ -316,7 +316,7 @@ static void change_actionorprompt __P6 (actionnode *,node, char *,pattern, char node->command = my_strdup(command); } - if (echo_int) { + if (opt_info) { PRINTF("#changed %s %c%c%s %s=%s\n", ONPROMPT, action_chars[node->type], node->active ? '+' : '-', @@ -593,7 +593,7 @@ void parse_action __P2 (char *,str, int,onprompt) } else { if (np && *np) { (*np)->active = (sign == '+'); - if (echo_int) { + if (opt_info) { PRINTF("#%s %c%s %s is now o%s.\n", ONPROMPT, action_chars[(*np)->type], label, @@ -939,10 +939,10 @@ void parse_mark __P1 (char *,str) if (attrcode == -1) { PRINTF("#invalid attribute syntax.\n"); error=SYNTAX_ERROR; - if (echo_int) show_attr_syntax(); + if (opt_info) show_attr_syntax(); } else if (!*p) if ((n = *np)) { - if (echo_int) { + if (opt_info) { PRINTF("#deleting mark: %s%s=%s\n", n->mbeg ? "^" : "", n->pattern, attr_name(n->attrcode)); } @@ -954,16 +954,16 @@ void parse_mark __P1 (char *,str) else { if (*np) { (*np)->attrcode = attrcode; - if (echo_int) { + if (opt_info) { PRINTF("#changed"); } } else { add_marknode(pattern, attrcode, mbeg, wild); - if (echo_int) { + if (opt_info) { PRINTF("#new"); } } - if (echo_int) + if (opt_info) tty_printf(" mark: %s%s=%s\n", mbeg ? "^" : "", pattern, attr_name(attrcode)); } @@ -1238,7 +1238,7 @@ static void define_new_key __P2 (char *,name, char *,command) else add_keynode(name, seq, seqlen, key_run_command, command); - if (echo_int) { + if (opt_info) { PRINTF("#new key binding: %s %s=%s\n", name, seq_name(seq, seqlen), command); } @@ -1278,7 +1278,7 @@ static void parse_bind_noninteractive __P1 (char *,arg) else add_keynode(arg, rawseq, seqlen, key_run_command, p); - if (echo_int) { + if (opt_info) { PRINTF("#%s: %s %s=%s\n", (kp && *kp) ? "redefined key" : "new key binding", arg, seq, p); } @@ -1318,7 +1318,7 @@ void parse_bind __P1 (char *,arg) np->call_data = my_strdup(command); np->funct = key_run_command; } - if (echo_int) { + if (opt_info) { PRINTF("#redefined key: %s %s=%s\n", name, seq_name(np->sequence, np->seqlen), command); @@ -1327,7 +1327,7 @@ void parse_bind __P1 (char *,arg) define_new_key(name, command); } else { if (np) { - if (echo_int) + if (opt_info) show_single_bind("deleting key binding:", np); delete_keynode(npp); } else { @@ -1409,7 +1409,7 @@ void parse_rebind __P1 (char *,arg) *old = (char *)malloc((*kp)->seqlen = seqlen); memmove(*old, seq, seqlen); - if (echo_int) + if (opt_info) show_single_bind("redefined key:", *kp); } @@ -1607,7 +1607,7 @@ void change_delaynode __P3 (delaynode **,p, char *,command, long,millisec) add_node((defnode*)m, (defnode**)&dead_delays, rev_time_sort); else add_node((defnode*)m, (defnode**)&delays, time_sort); - if (echo_int) { + if (opt_info) { PRINTF("#changed "); show_delaynode(m, 0); } @@ -1623,7 +1623,7 @@ void new_delaynode __P3 (char *,name, char *,command, long,millisec) update_now(); add_vtime(&t, &now); node = add_delaynode(name, command, &t, millisec < 0); - if (echo_int && node) { + if (opt_info && node) { PRINTF("#new "); show_delaynode(node, 0); } diff --git a/edit.c b/edit.c index 463f318..c86f3f0 100644 --- a/edit.c +++ b/edit.c @@ -863,8 +863,8 @@ static void insert_string __P1 (char *,arg) */ void key_run_command __P1 (char *,cmd) { - clear_input_line(opt_compact && !echo_key); - if (echo_key) { + clear_input_line(opt_compact && !opt_keyecho); + if (opt_keyecho) { tty_printf("%s%s%s\n", edattrbeg, cmd, edattrend); } else if (!opt_compact) tty_putc('\n'); diff --git a/eval.c b/eval.c index 03f6b16..f790896 100644 --- a/eval.c +++ b/eval.c @@ -407,7 +407,7 @@ static int check_object __P1 (object *,obj) named_var = add_varnode(line, i); if (REAL_ERROR) return 0; - if (echo_int) { + if (opt_info) { PRINTF("#new variable: %s\n", line - 1); } } @@ -1212,7 +1212,7 @@ static int exe_op __P1 (operator *,op) named_var = add_varnode(ptrdata(o1.txt), delta); if (REAL_ERROR) break; - if (echo_int) { + if (opt_info) { PRINTF("#new variable: %c%s\n", delta ? '$' : '@', ptrdata(o1.txt)); } diff --git a/log.c b/log.c index 3f17342..24deddc 100644 --- a/log.c +++ b/log.c @@ -151,7 +151,7 @@ void log_resize __P1 (int,newsize) datasize = newsize; logsize = newsize / 16; } - if (echo_int) { + if (opt_info) { PRINTF("#buffer resized to %d bytes%s\n", newsize, newsize ? "" : " (disabled)"); } } diff --git a/main.c b/main.c index e0877af..5afb94f 100644 --- a/main.c +++ b/main.c @@ -119,9 +119,9 @@ int line_status = 0; /* input line status: 0 = ready -> nothing to do; int limit_mem = 0; /* if !=0, max len of a string or text */ -char echo_ext = 1; /* 1 if text sent to MUD must be echoed */ -char echo_key = 1; /* 1 if binds must be echoed */ -char echo_int = 1; /* 0 if internal messages are suppressed */ +char opt_echo = 1; /* 1 if text sent to MUD must be echoed */ +char opt_keyecho = 1; /* 1 if binds must be echoed */ +char opt_info = 1; /* 0 if internal messages are suppressed */ char opt_exit = 0; /* 1 to autoquit when closing last conn. */ char opt_history; /* 1 if to save also history */ char opt_words = 0; /* 1 if to save also word completion list */ @@ -583,8 +583,8 @@ static void exec_delays __P0 (void) /* remember delayed command may modify the prompt and/or input line! */ if (prompt_status == 0) { - clear_input_line(opt_compact || !echo_int); - if (!opt_compact && echo_int && prompt_status == 0 && promptlen) { + clear_input_line(opt_compact || !opt_info); + if (!opt_compact && opt_info && prompt_status == 0 && promptlen) { tty_putc('\n'); col0 = 0; status(1); @@ -604,7 +604,7 @@ static void exec_delays __P0 (void) * (can't you imagine why? The command may edit itself...) */ - if (echo_int) + if (opt_info) tty_printf("#now [%s]\n", dying->command); if (*dying->command) { @@ -994,7 +994,7 @@ static void get_remote_input __P0 (void) common_clear(!opt_compact); } do { - if (echo_int) { + if (opt_info) { if (line_status == 0) { common_clear(!opt_compact); } @@ -1024,7 +1024,7 @@ static void get_remote_input __P0 (void) */ CONN_LIST(otcp_fd).fragment = my_strdup(buf); - if (echo_int) { + if (opt_info) { if (line_status == 0) { common_clear(!opt_compact); } @@ -1515,7 +1515,7 @@ char *get_next_instr __P1 (char *,p) static void send_line __P2 (char *,line, char,silent) { - if (!silent && echo_ext) { PRINTF("[%s]\n", line); } + if (!silent && opt_echo) { PRINTF("[%s]\n", line); } tcp_write(tcp_fd, line); } diff --git a/main.h b/main.h index 3258988..bbd9790 100644 --- a/main.h +++ b/main.h @@ -96,9 +96,9 @@ extern char opt_words; extern char opt_compact; extern char opt_debug; extern char opt_wrap; -extern char echo_ext; -extern char echo_int; -extern char echo_key; +extern char opt_echo; +extern char opt_info; +extern char opt_keyecho; extern char opt_speedwalk; extern char opt_autoprint; extern char opt_reprint; diff --git a/map.c b/map.c index 8b88269..5b2198c 100644 --- a/map.c +++ b/map.c @@ -59,7 +59,7 @@ void map_retrace __P2 (int,steps, int,walk_back) else { if (!steps) steps = -1; - if (walk_back && echo_ext) { + if (walk_back && opt_echo) { status(1); tty_putc('['); } @@ -68,12 +68,12 @@ void map_retrace __P2 (int,steps, int,walk_back) mapend = MAPINDEX(mapend - 1); if (walk_back) { cmd[0] = reverse_dir(mappath[mapend]); - if (echo_ext) + if (opt_echo) tty_putc(cmd[0]); tcp_write(tcp_fd, cmd); } } - if (walk_back && echo_ext) + if (walk_back && opt_echo) tty_puts("]\n"); } } diff --git a/tcp.c b/tcp.c index 31c90c0..a6ae2f0 100644 --- a/tcp.c +++ b/tcp.c @@ -150,12 +150,12 @@ int tcp_connect __P2 (char *,addr, int,port) address.sin_family = AF_INET; else { - if (echo_int) + if (opt_info) tty_printf("#looking up %s... ", addr); tty_flush(); host_info = gethostbyname(addr); if (host_info == 0) { - if (!echo_int) { + if (!opt_info) { tty_printf("#looking up %s... ", addr); } tty_printf("unknown host!\n"); @@ -164,7 +164,7 @@ int tcp_connect __P2 (char *,addr, int,port) memmove((char *)&address.sin_addr, host_info->h_addr, host_info->h_length); address.sin_family = host_info->h_addrtype; - if (echo_int) + if (opt_info) tty_puts("found.\n"); } address.sin_port = htons(port); @@ -815,7 +815,7 @@ void tcp_open __P4 (char *,id, char *,initstring, char *,host, int,port) FD_SET(newtcp_fd, &fdset); /* add socket to select() set */ tcp_count++; - if (echo_int && tcp_count) { + if (opt_info && tcp_count) { PRINTF("#default connection is now \"%s\"\n", id); } tcp_set_main(tcp_fd = newtcp_fd); @@ -926,7 +926,7 @@ void tcp_togglesnoop __P1 (char *,id) sfd = tcp_find(id); if (sfd>=0) { CONN_LIST(sfd).flags ^= ACTIVE; - if (echo_int) { + if (opt_info) { PRINTF("#connection %s is now %sactive.\n", CONN_LIST(sfd).id, CONN_LIST(sfd).flags & ACTIVE ? "" : "non"); } @@ -1010,7 +1010,7 @@ void tcp_spawn __P2 (char *,id, char *,cmd) if (conn_max_index <= i) conn_max_index = i+1; - if (echo_int) { + if (opt_info) { PRINTF("#successfully spawned \"%s\" with pid %d\n", id, childpid); } diff --git a/utils.c b/utils.c index 52d7c10..302d1d9 100644 --- a/utils.c +++ b/utils.c @@ -893,7 +893,7 @@ int read_settings __P0 (void) left = ptrmax(ptrbuf); len = 0; - echo_int = a_nice = 0; + opt_info = a_nice = 0; for (n = 0; n < MAX_HASH; n++) { while (aliases[n]) @@ -1220,9 +1220,9 @@ int save_settings __P0 (void) opt_words ? '+' : '-', opt_compact ? '+' : '-', opt_debug ? '+' : '-', - echo_ext ? '+' : '-', - echo_int ? '+' : '-', - echo_key ? '+' : '-', + opt_echo ? '+' : '-', + opt_info ? '+' : '-', + opt_keyecho ? '+' : '-', opt_speedwalk ? '+' : '-', opt_wrap ? '+' : '-', opt_autoprint ? '+' : '-', -- cgit v0.10.2