[BACK]Return to options-table.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Annotation of src/usr.bin/tmux/options-table.c, Revision 1.14

1.14    ! nicm        1: /* $OpenBSD: options-table.c,v 1.13 2011/08/24 10:29:57 nicm Exp $ */
1.1       nicm        2:
                      3: /*
                      4:  * Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
                      5:  *
                      6:  * Permission to use, copy, modify, and distribute this software for any
                      7:  * purpose with or without fee is hereby granted, provided that the above
                      8:  * copyright notice and this permission notice appear in all copies.
                      9:  *
                     10:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     11:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     12:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     13:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     14:  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
                     15:  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
                     16:  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     17:  */
                     18:
                     19: #include <sys/types.h>
                     20:
                     21: #include <string.h>
                     22: #include <paths.h>
                     23:
                     24: #include "tmux.h"
                     25:
                     26: /*
                     27:  * This file has a tables with all the server, session and window
                     28:  * options. These tables are the master copy of the options with their real
                     29:  * (user-visible) types, range limits and default values. At start these are
                     30:  * copied into the runtime global options trees (which only has number and
                     31:  * string types). These tables are then used to loop up the real type when
                     32:  * the user sets an option or its value needs to be shown.
                     33:  */
                     34:
                     35: /* Choice option type lists. */
                     36: const char *options_table_mode_keys_list[] = {
                     37:        "emacs", "vi", NULL
                     38: };
1.12      nicm       39: const char *options_table_mode_mouse_list[] = {
                     40:        "off", "on", "copy-mode", NULL
                     41: };
1.1       nicm       42: const char *options_table_clock_mode_style_list[] = {
                     43:        "12", "24", NULL
                     44: };
                     45: const char *options_table_status_keys_list[] = {
                     46:        "emacs", "vi", NULL
                     47: };
                     48: const char *options_table_status_justify_list[] = {
                     49:        "left", "centre", "right", NULL
                     50: };
                     51: const char *options_table_bell_action_list[] = {
                     52:        "none", "any", "current", NULL
                     53: };
                     54:
                     55: /* Server options. */
                     56: const struct options_table_entry server_options_table[] = {
                     57:        { .name = "buffer-limit",
                     58:          .type = OPTIONS_TABLE_NUMBER,
                     59:          .minimum = 1,
                     60:          .maximum = INT_MAX,
1.4       nicm       61:          .default_num = 20
1.1       nicm       62:        },
                     63:
                     64:        { .name = "escape-time",
                     65:          .type = OPTIONS_TABLE_NUMBER,
                     66:          .minimum = 0,
                     67:          .maximum = INT_MAX,
                     68:          .default_num = 500
                     69:        },
                     70:
                     71:        { .name = "exit-unattached",
                     72:          .type = OPTIONS_TABLE_FLAG,
                     73:          .default_num = 0
                     74:        },
                     75:
                     76:        { .name = "quiet",
                     77:          .type = OPTIONS_TABLE_FLAG,
                     78:          .default_num = 0 /* overridden in main() */
                     79:        },
                     80:
1.8       nicm       81:        { .name = "set-clipboard",
                     82:          .type = OPTIONS_TABLE_FLAG,
                     83:          .default_num = 1
                     84:        },
                     85:
1.1       nicm       86:        { .name = NULL }
                     87: };
                     88:
                     89: /* Session options. */
                     90: const struct options_table_entry session_options_table[] = {
                     91:        { .name = "base-index",
                     92:          .type = OPTIONS_TABLE_NUMBER,
                     93:          .minimum = 0,
                     94:          .maximum = INT_MAX,
                     95:          .default_num = 0
                     96:        },
                     97:
                     98:        { .name = "bell-action",
                     99:          .type = OPTIONS_TABLE_CHOICE,
                    100:          .choices = options_table_bell_action_list,
                    101:          .default_num = BELL_ANY
1.11      nicm      102:        },
                    103:
                    104:        { .name = "bell-on-alert",
                    105:          .type = OPTIONS_TABLE_FLAG,
                    106:          .default_num = 0
1.1       nicm      107:        },
                    108:
                    109:        { .name = "default-command",
                    110:          .type = OPTIONS_TABLE_STRING,
                    111:          .default_str = ""
                    112:        },
                    113:
                    114:        { .name = "default-path",
                    115:          .type = OPTIONS_TABLE_STRING,
                    116:          .default_str = ""
                    117:        },
                    118:
                    119:        { .name = "default-shell",
                    120:          .type = OPTIONS_TABLE_STRING,
                    121:          .default_str = _PATH_BSHELL
                    122:        },
                    123:
                    124:        { .name = "default-terminal",
                    125:          .type = OPTIONS_TABLE_STRING,
                    126:          .default_str = "screen"
                    127:        },
                    128:
                    129:        { .name = "destroy-unattached",
                    130:          .type = OPTIONS_TABLE_FLAG,
                    131:          .default_num = 0
                    132:        },
                    133:
                    134:        { .name = "detach-on-destroy",
                    135:          .type = OPTIONS_TABLE_FLAG,
                    136:          .default_num = 1
                    137:        },
                    138:
                    139:        { .name = "display-panes-active-colour",
                    140:          .type = OPTIONS_TABLE_COLOUR,
                    141:          .default_num = 1
                    142:        },
                    143:
                    144:        { .name = "display-panes-colour",
                    145:          .type = OPTIONS_TABLE_COLOUR,
                    146:          .default_num = 4
                    147:        },
                    148:
                    149:        { .name = "display-panes-time",
                    150:          .type = OPTIONS_TABLE_NUMBER,
                    151:          .minimum = 1,
                    152:          .maximum = INT_MAX,
                    153:          .default_num = 1000
                    154:        },
                    155:
                    156:        { .name = "display-time",
                    157:          .type = OPTIONS_TABLE_NUMBER,
                    158:          .minimum = 1,
                    159:          .maximum = INT_MAX,
                    160:          .default_num = 750
                    161:        },
                    162:
                    163:        { .name = "history-limit",
                    164:          .type = OPTIONS_TABLE_NUMBER,
                    165:          .minimum = 0,
1.3       nicm      166:          .maximum = INT_MAX,
1.1       nicm      167:          .default_num = 2000
                    168:        },
                    169:
                    170:        { .name = "lock-after-time",
                    171:          .type = OPTIONS_TABLE_NUMBER,
                    172:          .minimum = 0,
                    173:          .maximum = INT_MAX,
                    174:          .default_num = 0
                    175:        },
                    176:
                    177:        { .name = "lock-command",
                    178:          .type = OPTIONS_TABLE_STRING,
                    179:          .default_str = "lock -np"
                    180:        },
                    181:
                    182:        { .name = "lock-server",
                    183:          .type = OPTIONS_TABLE_FLAG,
                    184:          .default_num = 1
                    185:        },
                    186:
                    187:        { .name = "message-attr",
                    188:          .type = OPTIONS_TABLE_ATTRIBUTES,
                    189:          .default_num = 0
                    190:        },
                    191:
                    192:        { .name = "message-bg",
                    193:          .type = OPTIONS_TABLE_COLOUR,
                    194:          .default_num = 3
                    195:        },
                    196:
                    197:        { .name = "message-fg",
                    198:          .type = OPTIONS_TABLE_COLOUR,
                    199:          .default_num = 0
                    200:        },
                    201:
                    202:        { .name = "message-limit",
                    203:          .type = OPTIONS_TABLE_NUMBER,
                    204:          .minimum = 0,
                    205:          .maximum = INT_MAX,
                    206:          .default_num = 20
1.7       nicm      207:        },
                    208:
                    209:        { .name = "mouse-resize-pane",
                    210:          .type = OPTIONS_TABLE_FLAG,
                    211:          .default_num = 0
1.1       nicm      212:        },
                    213:
                    214:        { .name = "mouse-select-pane",
1.5       nicm      215:          .type = OPTIONS_TABLE_FLAG,
                    216:          .default_num = 0
                    217:        },
                    218:
                    219:        { .name = "mouse-select-window",
1.2       nicm      220:          .type = OPTIONS_TABLE_FLAG,
                    221:          .default_num = 0
                    222:        },
                    223:
                    224:        { .name = "mouse-utf8",
1.1       nicm      225:          .type = OPTIONS_TABLE_FLAG,
                    226:          .default_num = 0
                    227:        },
                    228:
                    229:        { .name = "pane-active-border-bg",
                    230:          .type = OPTIONS_TABLE_COLOUR,
                    231:          .default_num = 8
                    232:        },
                    233:
                    234:        { .name = "pane-active-border-fg",
                    235:          .type = OPTIONS_TABLE_COLOUR,
                    236:          .default_num = 2
                    237:        },
                    238:
                    239:        { .name = "pane-border-bg",
                    240:          .type = OPTIONS_TABLE_COLOUR,
                    241:          .default_num = 8
                    242:        },
                    243:
                    244:        { .name = "pane-border-fg",
                    245:          .type = OPTIONS_TABLE_COLOUR,
                    246:          .default_num = 8
                    247:        },
                    248:
                    249:        { .name = "prefix",
                    250:          .type = OPTIONS_TABLE_KEYS,
                    251:          /* set in main() */
                    252:        },
                    253:
                    254:        { .name = "repeat-time",
                    255:          .type = OPTIONS_TABLE_NUMBER,
                    256:          .minimum = 0,
                    257:          .maximum = SHRT_MAX,
                    258:          .default_num = 500
                    259:        },
                    260:
                    261:        { .name = "set-remain-on-exit",
                    262:          .type = OPTIONS_TABLE_FLAG,
                    263:          .default_num = 0
                    264:        },
                    265:
                    266:        { .name = "set-titles",
                    267:          .type = OPTIONS_TABLE_FLAG,
                    268:          .default_num = 0
                    269:        },
                    270:
                    271:        { .name = "set-titles-string",
                    272:          .type = OPTIONS_TABLE_STRING,
                    273:          .default_str = "#S:#I:#W - \"#T\""
                    274:        },
                    275:
                    276:        { .name = "status",
                    277:          .type = OPTIONS_TABLE_FLAG,
                    278:          .default_num = 1
                    279:        },
                    280:
                    281:        { .name = "status-attr",
                    282:          .type = OPTIONS_TABLE_ATTRIBUTES,
                    283:          .default_num = 0
                    284:        },
                    285:
                    286:        { .name = "status-bg",
                    287:          .type = OPTIONS_TABLE_COLOUR,
                    288:          .default_num = 2
                    289:        },
                    290:
                    291:        { .name = "status-fg",
                    292:          .type = OPTIONS_TABLE_COLOUR,
                    293:          .default_num = 0
                    294:        },
                    295:
                    296:        { .name = "status-interval",
                    297:          .type = OPTIONS_TABLE_NUMBER,
                    298:          .minimum = 0,
                    299:          .maximum = INT_MAX,
                    300:          .default_num = 15
                    301:        },
                    302:
                    303:        { .name = "status-justify",
                    304:          .type = OPTIONS_TABLE_CHOICE,
                    305:          .choices = options_table_status_justify_list,
                    306:          .default_num = 0
                    307:        },
                    308:
                    309:        { .name = "status-keys",
                    310:          .type = OPTIONS_TABLE_CHOICE,
                    311:          .choices = options_table_status_keys_list,
                    312:          .default_num = MODEKEY_EMACS
                    313:        },
                    314:
                    315:        { .name = "status-left",
                    316:          .type = OPTIONS_TABLE_STRING,
                    317:          .default_str = "[#S]"
                    318:        },
                    319:
                    320:        { .name = "status-left-attr",
                    321:          .type = OPTIONS_TABLE_ATTRIBUTES,
                    322:          .default_num = 0
                    323:        },
                    324:
                    325:        { .name = "status-left-bg",
                    326:          .type = OPTIONS_TABLE_COLOUR,
                    327:          .default_num = 8
                    328:        },
                    329:
                    330:        { .name = "status-left-fg",
                    331:          .type = OPTIONS_TABLE_COLOUR,
                    332:          .default_num = 8
                    333:        },
                    334:
                    335:        { .name = "status-left-length",
                    336:          .type = OPTIONS_TABLE_NUMBER,
                    337:          .minimum = 0,
                    338:          .maximum = SHRT_MAX,
                    339:          .default_num = 10
                    340:        },
                    341:
                    342:        { .name = "status-right",
                    343:          .type = OPTIONS_TABLE_STRING,
                    344:          .default_str = "\"#22T\" %H:%M %d-%b-%y"
                    345:        },
                    346:
                    347:        { .name = "status-right-attr",
                    348:          .type = OPTIONS_TABLE_ATTRIBUTES,
                    349:          .default_num = 0
                    350:        },
                    351:
                    352:        { .name = "status-right-bg",
                    353:          .type = OPTIONS_TABLE_COLOUR,
                    354:          .default_num = 8
                    355:        },
                    356:
                    357:        { .name = "status-right-fg",
                    358:          .type = OPTIONS_TABLE_COLOUR,
                    359:          .default_num = 8
                    360:        },
                    361:
                    362:        { .name = "status-right-length",
                    363:          .type = OPTIONS_TABLE_NUMBER,
                    364:          .minimum = 0,
                    365:          .maximum = SHRT_MAX,
                    366:          .default_num = 40
                    367:        },
                    368:
                    369:        { .name = "status-utf8",
                    370:          .type = OPTIONS_TABLE_FLAG,
                    371:          .default_num = 0 /* overridden in main() */
                    372:        },
                    373:
                    374:        { .name = "terminal-overrides",
                    375:          .type = OPTIONS_TABLE_STRING,
1.8       nicm      376:          .default_str = "*88col*:colors=88,*256col*:colors=256"
1.9       nicm      377:                         ",xterm*:XT:Ms=\\E]52;%p1%s;%p2%s\\007"
                    378:                         ":Cc=\\E]12;%p1%s\\007:Cr=\\E]112\\007"
1.14    ! nicm      379:                         ":Cs=\\E[%p1%d q:Csr=\\E[2 q,screen*:XT"
1.1       nicm      380:        },
                    381:
                    382:        { .name = "update-environment",
                    383:          .type = OPTIONS_TABLE_STRING,
                    384:          .default_str = "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID "
1.9       nicm      385:                         "SSH_CONNECTION WINDOWID XAUTHORITY"
1.1       nicm      386:
                    387:        },
                    388:
                    389:        { .name = "visual-activity",
                    390:          .type = OPTIONS_TABLE_FLAG,
                    391:          .default_num = 0
                    392:        },
                    393:
                    394:        { .name = "visual-bell",
                    395:          .type = OPTIONS_TABLE_FLAG,
                    396:          .default_num = 0
                    397:        },
                    398:
                    399:        { .name = "visual-content",
                    400:          .type = OPTIONS_TABLE_FLAG,
                    401:          .default_num = 0
                    402:        },
                    403:
                    404:        { .name = "visual-silence",
                    405:          .type = OPTIONS_TABLE_FLAG,
                    406:          .default_num = 0
                    407:        },
                    408:
                    409:        { .name = NULL }
                    410: };
                    411:
                    412: /* Window options. */
                    413: const struct options_table_entry window_options_table[] = {
                    414:        { .name = "aggressive-resize",
                    415:          .type = OPTIONS_TABLE_FLAG,
                    416:          .default_num = 0
                    417:        },
                    418:
                    419:        { .name = "alternate-screen",
                    420:          .type = OPTIONS_TABLE_FLAG,
                    421:          .default_num = 1
                    422:        },
                    423:
                    424:        { .name = "automatic-rename",
                    425:          .type = OPTIONS_TABLE_FLAG,
                    426:          .default_num = 1
                    427:        },
                    428:
                    429:        { .name = "clock-mode-colour",
                    430:          .type = OPTIONS_TABLE_COLOUR,
                    431:          .default_num = 4
                    432:        },
                    433:
                    434:        { .name = "clock-mode-style",
                    435:          .type = OPTIONS_TABLE_CHOICE,
                    436:          .choices = options_table_clock_mode_style_list,
                    437:          .default_num = 1
                    438:        },
                    439:
                    440:        { .name = "force-height",
                    441:          .type = OPTIONS_TABLE_NUMBER,
                    442:          .minimum = 0,
                    443:          .maximum = INT_MAX,
                    444:          .default_num = 0
                    445:        },
                    446:
                    447:        { .name = "force-width",
                    448:          .type = OPTIONS_TABLE_NUMBER,
                    449:          .minimum = 0,
                    450:          .maximum = INT_MAX,
                    451:          .default_num = 0
                    452:        },
                    453:
                    454:        { .name = "main-pane-height",
                    455:          .type = OPTIONS_TABLE_NUMBER,
                    456:          .minimum = 1,
                    457:          .maximum = INT_MAX,
                    458:          .default_num = 24
                    459:        },
                    460:
                    461:        { .name = "main-pane-width",
                    462:          .type = OPTIONS_TABLE_NUMBER,
                    463:          .minimum = 1,
                    464:          .maximum = INT_MAX,
                    465:          .default_num = 80
                    466:        },
                    467:
                    468:        { .name = "mode-attr",
                    469:          .type = OPTIONS_TABLE_ATTRIBUTES,
                    470:          .default_num = 0
                    471:        },
                    472:
                    473:        { .name = "mode-bg",
                    474:          .type = OPTIONS_TABLE_COLOUR,
                    475:          .default_num = 3
                    476:        },
                    477:
                    478:        { .name = "mode-fg",
                    479:          .type = OPTIONS_TABLE_COLOUR,
                    480:          .default_num = 0
                    481:        },
                    482:
                    483:        { .name = "mode-keys",
                    484:          .type = OPTIONS_TABLE_CHOICE,
                    485:          .choices = options_table_mode_keys_list,
                    486:          .default_num = MODEKEY_EMACS
                    487:        },
                    488:
                    489:        { .name = "mode-mouse",
1.12      nicm      490:          .type = OPTIONS_TABLE_CHOICE,
                    491:          .choices = options_table_mode_mouse_list,
1.1       nicm      492:          .default_num = 0
                    493:        },
                    494:
                    495:        { .name = "monitor-activity",
                    496:          .type = OPTIONS_TABLE_FLAG,
                    497:          .default_num = 0
                    498:        },
                    499:
                    500:        { .name = "monitor-content",
                    501:          .type = OPTIONS_TABLE_STRING,
                    502:          .default_str = ""
                    503:        },
                    504:
                    505:        { .name = "monitor-silence",
                    506:          .type = OPTIONS_TABLE_NUMBER,
                    507:          .minimum = 0,
                    508:          .maximum = INT_MAX,
                    509:          .default_num = 0
                    510:        },
                    511:
                    512:        { .name = "other-pane-height",
                    513:          .type = OPTIONS_TABLE_NUMBER,
                    514:          .minimum = 0,
                    515:          .maximum = INT_MAX,
                    516:          .default_num = 0
                    517:        },
                    518:
                    519:        { .name = "other-pane-width",
                    520:          .type = OPTIONS_TABLE_NUMBER,
                    521:          .minimum = 0,
                    522:          .maximum = INT_MAX,
1.13      nicm      523:          .default_num = 0
                    524:        },
                    525:
                    526:        { .name = "pane-base-index",
                    527:          .type = OPTIONS_TABLE_NUMBER,
                    528:          .minimum = 0,
                    529:          .maximum = USHRT_MAX,
1.1       nicm      530:          .default_num = 0
                    531:        },
                    532:
                    533:        { .name = "remain-on-exit",
                    534:          .type = OPTIONS_TABLE_FLAG,
                    535:          .default_num = 0
                    536:        },
                    537:
                    538:        { .name = "synchronize-panes",
                    539:          .type = OPTIONS_TABLE_FLAG,
                    540:          .default_num = 0
                    541:        },
                    542:
                    543:        { .name = "utf8",
                    544:          .type = OPTIONS_TABLE_FLAG,
                    545:          .default_num = 0 /* overridden in main() */
                    546:        },
                    547:
                    548:        { .name = "window-status-alert-attr",
                    549:          .type = OPTIONS_TABLE_ATTRIBUTES,
                    550:          .default_num = GRID_ATTR_REVERSE
                    551:        },
                    552:
                    553:        { .name = "window-status-alert-bg",
                    554:          .type = OPTIONS_TABLE_COLOUR,
                    555:          .default_num = 8
                    556:        },
                    557:
                    558:        { .name = "window-status-alert-fg",
                    559:          .type = OPTIONS_TABLE_COLOUR,
                    560:          .default_num = 8
                    561:        },
                    562:
                    563:        { .name = "window-status-attr",
                    564:          .type = OPTIONS_TABLE_ATTRIBUTES,
                    565:          .default_num = 0
                    566:        },
                    567:
                    568:        { .name = "window-status-bg",
                    569:          .type = OPTIONS_TABLE_COLOUR,
                    570:          .default_num = 8
                    571:        },
                    572:
                    573:        { .name = "window-status-current-attr",
                    574:          .type = OPTIONS_TABLE_ATTRIBUTES,
                    575:          .default_num = 0
                    576:        },
                    577:
                    578:        { .name = "window-status-current-bg",
                    579:          .type = OPTIONS_TABLE_COLOUR,
                    580:          .default_num = 8
                    581:        },
                    582:
                    583:        { .name = "window-status-current-fg",
                    584:          .type = OPTIONS_TABLE_COLOUR,
                    585:          .default_num = 8
                    586:        },
                    587:
                    588:        { .name = "window-status-current-format",
                    589:          .type = OPTIONS_TABLE_STRING,
                    590:          .default_str = "#I:#W#F"
                    591:        },
                    592:
                    593:        { .name = "window-status-fg",
                    594:          .type = OPTIONS_TABLE_COLOUR,
                    595:          .default_num = 8
                    596:        },
                    597:
                    598:        { .name = "window-status-format",
                    599:          .type = OPTIONS_TABLE_STRING,
                    600:          .default_str = "#I:#W#F"
                    601:        },
                    602:
                    603:        { .name = "word-separators",
                    604:          .type = OPTIONS_TABLE_STRING,
                    605:          .default_str = " -_@"
                    606:        },
                    607:
                    608:        { .name = "xterm-keys",
                    609:          .type = OPTIONS_TABLE_FLAG,
                    610:          .default_num = 0
                    611:        },
                    612:
                    613:        { .name = NULL }
                    614: };
                    615:
                    616: /* Populate an options tree from a table. */
                    617: void
                    618: options_table_populate_tree(
                    619:     const struct options_table_entry *table, struct options *oo)
                    620: {
                    621:        const struct options_table_entry        *oe;
                    622:
                    623:        for (oe = table; oe->name != NULL; oe++) {
                    624:                if (oe->default_str != NULL)
                    625:                        options_set_string(oo, oe->name, "%s", oe->default_str);
                    626:                else
                    627:                        options_set_number(oo, oe->name, oe->default_num);
                    628:        }
                    629: }
                    630:
                    631: /* Print an option using its type from the table. */
                    632: const char *
                    633: options_table_print_entry(
                    634:     const struct options_table_entry *oe, struct options_entry *o)
                    635: {
                    636:        static char                              out[BUFSIZ];
                    637:        const char                              *s;
                    638:        struct keylist                          *keylist;
                    639:        u_int                                    i;
                    640:
                    641:        *out = '\0';
                    642:        switch (oe->type) {
                    643:        case OPTIONS_TABLE_STRING:
                    644:                xsnprintf(out, sizeof out, "\"%s\"", o->str);
                    645:                break;
                    646:        case OPTIONS_TABLE_NUMBER:
                    647:                xsnprintf(out, sizeof out, "%lld", o->num);
                    648:                break;
                    649:        case OPTIONS_TABLE_KEYS:
                    650:                keylist = o->data;
                    651:                for (i = 0; i < ARRAY_LENGTH(keylist); i++) {
                    652:                        s = key_string_lookup_key(ARRAY_ITEM(keylist, i));
                    653:                        strlcat(out, s, sizeof out);
                    654:                        if (i != ARRAY_LENGTH(keylist) - 1)
                    655:                                strlcat(out, ",", sizeof out);
                    656:                }
                    657:                break;
                    658:        case OPTIONS_TABLE_COLOUR:
                    659:                s = colour_tostring(o->num);
                    660:                xsnprintf(out, sizeof out, "%s", s);
                    661:                break;
                    662:        case OPTIONS_TABLE_ATTRIBUTES:
                    663:                s = attributes_tostring(o->num);
                    664:                xsnprintf(out, sizeof out, "%s", s);
                    665:                break;
                    666:        case OPTIONS_TABLE_FLAG:
                    667:                if (o->num)
                    668:                        strlcpy(out, "on", sizeof out);
                    669:                else
                    670:                        strlcpy(out, "off", sizeof out);
                    671:                break;
                    672:        case OPTIONS_TABLE_CHOICE:
                    673:                s = oe->choices[o->num];
                    674:                xsnprintf(out, sizeof out, "%s", s);
                    675:                break;
                    676:        }
                    677:        return (out);
                    678: }