Changeset aa2f33b3 for variable.c
- Timestamp:
- Jul 16, 2002, 9:55:47 PM (23 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- f2e36b5
- Parents:
- e50cd56
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
variable.c
rae9e6be raa2f33b3 10 10 static int in_regtest = 0; 11 11 12 #define OWLVAR_BOOL(name,default, docstring) \13 { name, OWL_VARIABLE_BOOL, NULL, default, "on,off", docstring, NULL, \12 #define OWLVAR_BOOL(name,default,summary,description) \ 13 { name, OWL_VARIABLE_BOOL, NULL, default, "on,off", summary,description, NULL, \ 14 14 NULL, NULL, NULL, NULL, NULL } 15 15 16 #define OWLVAR_BOOL_FULL(name,default, docstring,validate,set,get) \17 { name, OWL_VARIABLE_BOOL, NULL, default, "on,off", docstring, NULL, \16 #define OWLVAR_BOOL_FULL(name,default,summary,description,validate,set,get) \ 17 { name, OWL_VARIABLE_BOOL, NULL, default, "on,off", summary,description, NULL, \ 18 18 validate, set, NULL, get, NULL } 19 19 20 #define OWLVAR_INT(name,default, docstring) \21 { name, OWL_VARIABLE_INT, NULL, default, "<int>", docstring, NULL, \20 #define OWLVAR_INT(name,default,summary,description) \ 21 { name, OWL_VARIABLE_INT, NULL, default, "<int>", summary,description, NULL, \ 22 22 NULL, NULL, NULL, NULL, NULL, NULL } 23 23 24 #define OWLVAR_INT_FULL(name,default, docstring,validset,validate,set,get) \25 { name, OWL_VARIABLE_INT, NULL, default, validset, docstring, NULL, \24 #define OWLVAR_INT_FULL(name,default,summary,description,validset,validate,set,get) \ 25 { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \ 26 26 validate, set, NULL, get, NULL, NULL } 27 27 28 #define OWLVAR_PATH(name,default, docstring) \29 { name, OWL_VARIABLE_STRING, default, 0, "<path>", docstring, NULL, \28 #define OWLVAR_PATH(name,default,summary,description) \ 29 { name, OWL_VARIABLE_STRING, default, 0, "<path>", summary,description, NULL, \ 30 30 NULL, NULL, NULL, NULL, NULL, NULL } 31 31 32 #define OWLVAR_STRING(name,default, docstring) \33 { name, OWL_VARIABLE_STRING, default, 0, "<string>", docstring, NULL, \32 #define OWLVAR_STRING(name,default,summary,description) \ 33 { name, OWL_VARIABLE_STRING, default, 0, "<string>", summary,description, NULL, \ 34 34 NULL, NULL, NULL, NULL, NULL, NULL } 35 35 … … 37 37 * list of strings which can be specified. The tokens, starting at 0, 38 38 * correspond to the values that may be specified. */ 39 #define OWLVAR_ENUM(name,default, docstring,validset) \40 { name, OWL_VARIABLE_INT, NULL, default, validset, docstring, NULL, \39 #define OWLVAR_ENUM(name,default,summary,description,validset) \ 40 { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \ 41 41 owl_variable_enum_validate, \ 42 42 NULL, owl_variable_enum_set_fromstring, \ … … 44 44 NULL } 45 45 46 #define OWLVAR_ENUM_FULL(name,default, docstring,validset,validate, set, get) \47 { name, OWL_VARIABLE_INT, NULL, default, validset, docstring, NULL, \46 #define OWLVAR_ENUM_FULL(name,default,summary,description,validset,validate, set, get) \ 47 { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \ 48 48 validate, \ 49 49 set, owl_variable_enum_set_fromstring, \ … … 54 54 55 55 OWLVAR_BOOL( "personalbell" /* %OwlVarStub */, 0, 56 "ring the terminal bell when personal messages are received" ), 56 "ring the terminal bell when personal messages are received", 57 "" ), 57 58 58 59 OWLVAR_BOOL( "bell" /* %OwlVarStub */, 1, 59 "enable / disable the terminal bell" ),60 "enable / disable the terminal bell", "" ), 60 61 61 62 OWLVAR_BOOL_FULL( "debug" /* %OwlVarStub */, OWL_DEBUG, 62 63 "whether debugging is enabled", 64 "If set to 'on', debugging messages are logged to the\n" 65 "file specified by the debugfile variable.\n", 63 66 NULL, owl_variable_debug_set, NULL), 64 67 65 68 OWLVAR_BOOL( "startuplogin" /* %OwlVarStub */, 1, 66 "send a login message when owl starts" ),69 "send a login message when owl starts", "" ), 67 70 68 71 OWLVAR_BOOL( "shutdownlogout" /* %OwlVarStub */, 1, 69 "send a logout message when owl exits" ),72 "send a logout message when owl exits", "" ), 70 73 71 74 OWLVAR_BOOL( "rxping" /* %OwlVarStub */, 0, 72 "display received pings" ),75 "display received pings", "" ), 73 76 74 77 OWLVAR_BOOL( "txping" /* %OwlVarStub */, 1, 75 "send pings" ),78 "send pings", "" ), 76 79 77 80 OWLVAR_BOOL( "displayoutgoing" /* %OwlVarStub */, 1, 78 "display outgoing messages" ),81 "display outgoing messages", "" ), 79 82 80 83 OWLVAR_BOOL( "loginsubs" /* %OwlVarStub */, 1, 81 "load logins from .anyone on startup" ),84 "load logins from .anyone on startup", "" ), 82 85 83 86 OWLVAR_BOOL( "logging" /* %OwlVarStub */, 0, 84 "turn personal logging on or off" ), 87 "turn personal logging on or off", 88 "If this is set to on, personal messages are\n" 89 "logged in the directory specified\n" 90 "by the 'logpath' variable. The filename in that\n" 91 "directory is derived from the sender of the message.\n" ), 85 92 86 93 OWLVAR_BOOL( "classlogging" /* %OwlVarStub */, 0, 87 "turn class logging on or off" ), 94 "turn class logging on or off", 95 "If this is set to on, class messages are\n" 96 "logged in the directory specified\n" 97 "by the 'classlogpath' variable.\n" 98 "The filename in that directory is derived from\n" 99 "the name of the class to which the message was sent.\n" ), 88 100 89 101 OWLVAR_BOOL( "colorztext" /* %OwlVarStub */, 1, 90 "allow @color() in zephyrs to change color" ), 102 "allow @color() in zephyrs to change color", 103 "Note that only messages received after this variable\n" 104 "is set will be affected." ), 91 105 92 106 OWLVAR_ENUM_FULL( "disable-ctrl-d" /* %OwlVarStub:lockout_ctrld */, 1, 93 "don't send zephyrs on C-d (or disable if in the middle of the message if set to 'middle')", "off,middle,on", 107 "don't send zephyrs on C-d", 108 "If set to 'off', C-d won't send a zephyr from the edit\n" 109 "window. If set to 'on', C-d will always send a zephyr\n" 110 "being composed in the edit window. If set to 'middle',\n" 111 "C-d will only ever send a zephyr if the cursor is at\n" 112 "the end of the message being composed.\n\n" 113 "Note that this works by changing the C-d keybinding\n" 114 "in the editmulti keymap.\n", 115 "off,middle,on", 94 116 NULL, owl_variable_disable_ctrl_d_set, NULL), 95 117 96 118 OWLVAR_BOOL( "_burningears" /* %OwlVarStub:burningears */, 0, 97 "[NOT YET IMPLEMENTED] beep on messages matching patterns" ),119 "[NOT YET IMPLEMENTED] beep on messages matching patterns", "" ), 98 120 99 121 OWLVAR_BOOL( "_summarymode" /* %OwlVarStub:summarymode */, 0, 100 "[NOT YET IMPLEMENTED]" ),122 "[NOT YET IMPLEMENTED]", "" ), 101 123 102 124 OWLVAR_PATH( "logpath" /* %OwlVarStub */, "~/zlog/people", 103 "path for logging personal zephyrs" ), 125 "path for logging personal zephyrs", 126 "Specifies a directory which must exist.\n" 127 "Files will be created in the directory for each sender.\n"), 104 128 105 129 OWLVAR_PATH( "classlogpath" /* %OwlVarStub:classlogpath */, "~/zlog/class", 106 "path for logging class zephyrs" ), 130 "path for logging class zephyrs", 131 "Specifies a directory which must exist.\n" 132 "Files will be created in the directory for each class.\n"), 107 133 108 134 OWLVAR_PATH( "debug_file" /* %OwlVarStub */, OWL_DEBUG_FILE, 109 "path for logging debug messages when debugging is enabled" ), 135 "path for logging debug messages when debugging is enabled", 136 "This file will be logged to if 'debug' is set to 'on'.\n"), 110 137 111 138 OWLVAR_PATH( "zsigproc" /* %OwlVarStub:zsig_exec */, NULL, 112 "name of a program to run that will generate zsigs" ), 139 "name of a program to run that will generate zsigs", 140 "This program should produce a zsig on stdout when run.\n" 141 "Note that it is important that this program not block.\n" ), 113 142 114 143 OWLVAR_STRING( "zsig" /* %OwlVarStub */, "", 115 "zephyr signature" ), 144 "zephyr signature", 145 "If 'zsigproc' is not set, this string will be used\n" 146 "as a zsig. If this is also unset, the 'zwrite-signature'\n" 147 "zephyr variable will be used instead.\n"), 116 148 117 149 OWLVAR_STRING( "appendtosepbar" /* %OwlVarStub */, "", 118 "string to append to the end of the sepbar" ), 150 "string to append to the end of the sepbar", 151 "The sepbar is the bar separating the top and bottom\n" 152 "of the owl screen. Any string specified here will\n" 153 "be displayed on the right of the sepbar\n"), 119 154 120 155 OWLVAR_BOOL( "zaway" /* %OwlVarStub */, 0, 121 "turn zaway on or off" ),156 "turn zaway on or off", "" ), 122 157 123 158 OWLVAR_STRING( "zaway_msg" /* %OwlVarStub */, 124 159 OWL_DEFAULT_ZAWAYMSG, 125 "zaway msg for responding to zephyrs when away" ),160 "zaway msg for responding to zephyrs when away", "" ), 126 161 127 162 OWLVAR_STRING( "zaway_msg_default" /* %OwlVarStub */, 128 163 OWL_DEFAULT_ZAWAYMSG, 129 "default zaway message" ),164 "default zaway message", "" ), 130 165 131 166 OWLVAR_STRING( "view_home" /* %OwlVarStub */, "all", 132 "home view to switch to after 'X'" ), 167 "home view to switch to after 'X' and 'V'", 168 "SEE ALSO: view, filter\n" ), 133 169 134 170 OWLVAR_INT( "edit:maxfillcols" /* %OwlVarStub:edit_maxfillcols */, 70, 135 "maximum number of columns for M-q to fill text to (or unlimited if 0)" ), 171 "maximum number of columns for M-q to fill text to", 172 "This specifies the maximum number of columns for M-q\n" 173 "to fill text to. If set to 0, ther will be no maximum\n" 174 "limit. In all cases, the current width of the screen\n" 175 "will also be taken into account. It will be used instead\n" 176 "if it is narrower than the maximum, or if this\n" 177 "is set to 0.\n" ), 136 178 137 179 OWLVAR_INT( "edit:maxwrapcols" /* %OwlVarStub:edit_maxwrapcols */, 0, 138 "maximum number of columns for line-wrapping (or unlimited if 0)" ), 180 "maximum number of columns for line-wrapping", 181 "This specifies the maximum number of columns for\n" 182 "auto-line-wrapping. If set to 0, ther will be no maximum\n" 183 "limit. In all cases, the current width of the screen\n" 184 "will also be taken into account. It will be used instead\n" 185 "if it is narrower than the maximum, or if this\n" 186 "is set to 0.\n\n" 187 "It is recommended that outgoing messages be no wider\n" 188 "than 60 columns, as a courtesy to recipients.\n"), 139 189 140 190 OWLVAR_INT_FULL( "typewinsize" /* %OwlVarStub:typwin_lines */, 141 191 OWL_TYPWIN_SIZE, 142 "number of lines in the typing window", "int > 0", 192 "number of lines in the typing window", 193 "This specifies the height of the window at the\n" 194 "bottom of the screen where commands are entered\n" 195 "and where messages are composed.\n", 196 "int > 0", 143 197 owl_variable_int_validate_gt0, 144 198 owl_variable_typewinsize_set, … … 146 200 ), 147 201 202 OWLVAR_ENUM( "scrollmode" /* %OwlVarStub */, OWL_SCROLLMODE_NORMAL, 203 "how to scroll up and down", 204 "This controls how the screen is scrolled as the\n" 205 "cursor moves between messages being displayed.\n" 206 "The following modes are supported:\n\n" 207 " normal - This is the owl default. Scrolling happens\n" 208 " when it needs to, and an attempt is made to\n" 209 " keep the current message roughly near\n" 210 " the middle of the screen.\n" 211 " top - The current message will always be the\n" 212 " the top message displayed.\n" 213 " neartop - The current message will be one down\n" 214 " from the top message displayed,\n" 215 " where possible.\n" 216 " center - An attempt is made to keep the current\n" 217 " message near the center of the screen.\n" 218 " paged - The top message displayed only changes\n" 219 " when user moves the cursor to the top\n" 220 " or bottom of the screen. When it moves,\n" 221 " the screen will be paged up or down and\n" 222 " the cursor will be near the top or\n" 223 " the bottom.\n" 224 " pagedcenter - The top message displayed only changes\n" 225 " when user moves the cursor to the top\n" 226 " or bottom of the screen. When it moves,\n" 227 " the screen will be paged up or down and\n" 228 " the cursor will be near the center.\n", 229 "normal,top,neartop,center,paged,pagedcenter" ), 230 148 231 OWLVAR_ENUM( "webbrowser" /* %OwlVarStub */, OWL_WEBBROWSER_NETSCAPE, 149 232 "web browser to use to launch URLs", 233 "When the 'w' key is pressed, this browser is used\n" 234 "to display the requested URL.\n", 150 235 "none,netscape,galeon,opera" ), 151 236 152 237 OWLVAR_BOOL( "_followlast" /* %OwlVarStub */, 0, 153 "enable automatic following of the last zephyr" ), 238 "enable automatic following of the last zephyr", 239 "If the cursor is at the last message, it will\n" 240 "continue to follow the last message if this is set.\n" 241 "Note that this is currently risky as you might accidentally\n" 242 "delete a message right as it came in.\n" ), 154 243 155 244 /* This MUST be last... */ 156 { NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } 245 { NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 246 NULL, NULL, NULL, NULL, NULL, NULL } 157 247 158 248 }; … … 300 390 301 391 302 char *owl_variable_get_docstring(owl_variable *v) { 303 return v->docstring; 392 char *owl_variable_get_description(owl_variable *v) { 393 return v->description; 394 } 395 396 char *owl_variable_get_summary(owl_variable *v) { 397 return v->summary; 304 398 } 305 399 … … 420 514 } 421 515 422 #define OWL_VARIABLE_HELP_FMT " %-15s %-9s %-9s %s\n" 423 424 /* appends to the end of the fmtext */ 425 void owl_variable_get_summaryheader(owl_fmtext *fm) { 426 char tmpbuff[512]; 427 snprintf(tmpbuff, 512, 428 OWL_VARIABLE_HELP_FMT OWL_VARIABLE_HELP_FMT, 429 "name", "settings", "default", "meaning", 430 "---------------", "--------", "-------", "-------"); 431 owl_fmtext_append_bold(fm, tmpbuff); 432 } 433 434 void owl_variable_get_summary(owl_vardict *d, char *name, owl_fmtext *fm) { 435 char defaultbuf[10]; 516 void owl_variable_describe(owl_vardict *d, char *name, owl_fmtext *fm) { 517 char defaultbuf[50]; 436 518 char buf[1024]; 437 519 int buflen = 1023; … … 446 528 } 447 529 if (v->type == OWL_VARIABLE_INT || v->type == OWL_VARIABLE_BOOL) { 448 v->get_tostring_fn(v, defaultbuf, 10, &(v->ival_default));530 v->get_tostring_fn(v, defaultbuf, 50, &(v->ival_default)); 449 531 } else { 450 v->get_tostring_fn(v, defaultbuf, 10, v->pval_default);451 } 452 snprintf(buf, buflen, OWL_ VARIABLE_HELP_FMT,532 v->get_tostring_fn(v, defaultbuf, 50, v->pval_default); 533 } 534 snprintf(buf, buflen, OWL_TABSTR "%-20s - %s (default: '%s')\n", 453 535 v->name, 454 owl_variable_get_validsettings(v), 455 defaultbuf, 456 owl_variable_get_docstring(v)); 536 owl_variable_get_summary(v), defaultbuf); 457 537 owl_fmtext_append_normal(fm, buf); 458 538 } … … 474 554 owl_fmtext_append_normal(fm, name); 475 555 owl_fmtext_append_normal(fm, " - "); 476 owl_fmtext_append_normal(fm, v-> docstring);556 owl_fmtext_append_normal(fm, v->summary); 477 557 owl_fmtext_append_normal(fm, "\n\n"); 478 558 … … 495 575 owl_fmtext_append_normal(fm, owl_variable_get_validsettings(v)); 496 576 owl_fmtext_append_normal(fm, "\n\n"); 577 578 if (v->description && *v->description) { 579 owl_fmtext_append_normal(fm, "Description:\n"); 580 owl_fmtext_append_normal(fm, owl_variable_get_description(v)); 581 owl_fmtext_append_normal(fm, "\n\n"); 582 } 497 583 } 498 584
Note: See TracChangeset
for help on using the changeset viewer.