File: ui_bel_mode.c

package info (click to toggle)
mlterm 3.9.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,340 kB
  • sloc: ansic: 154,713; sh: 5,302; cpp: 2,953; objc: 2,776; java: 2,472; makefile: 2,445; perl: 1,674; xml: 44
file content (35 lines) | stat: -rw-r--r-- 812 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */

#include "ui_bel_mode.h"

#include <string.h>        /* strcmp */
#include <pobl/bl_types.h> /* u_int */

/* --- static variables --- */

/* Order of this table must be same as ui_bel_mode_t. */
static char *bel_mode_name_table[] = {"none", "sound", "visual", "sound|visual"};

/* --- global functions --- */

ui_bel_mode_t ui_get_bel_mode_by_name(const char *name) {
  ui_bel_mode_t mode;

  for (mode = 0; mode < BEL_MODE_MAX; mode++) {
    if (strcmp(bel_mode_name_table[mode], name) == 0) {
      return mode;
    }
  }

  /* default value */
  return BEL_SOUND;
}

char *ui_get_bel_mode_name(ui_bel_mode_t mode) {
  if ((u_int)mode >= BEL_MODE_MAX) {
    /* default value */
    mode = BEL_SOUND;
  }

  return bel_mode_name_table[mode];
}