From d74850a770b15db3c6d2fbae3f85b3318b1d5aa3 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sat, 2 Aug 2003 21:43:46 +0000 Subject: 2003-08-01 Marco Gerards * opts-std-startup.c: Include . (OPT_VISUAL_BELL): New macro. (OPT_AUDIBLE_BELL): Likewise. (_cons_visual_bell): New variable. (_cons_audible_bell): Likewise. (startup_options): Added options "--visual-bell" and "--audible-bell" ... (parse_startup_opt): ...and parse those new options here. * priv.h (bell_type_t): New enumeration. (_cons_visual_bell): New external variable. (_cons_audible_bell): Likewise. * file-changed.c (cons_S_file_changed): Use the right bell. --- libcons/opts-std-startup.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'libcons/opts-std-startup.c') diff --git a/libcons/opts-std-startup.c b/libcons/opts-std-startup.c index 085f960b..29278cc2 100644 --- a/libcons/opts-std-startup.c +++ b/libcons/opts-std-startup.c @@ -1,5 +1,5 @@ /* opts-std-startup.c - Standard startup-time command line parser. - Copyright (C) 1995,96,97,98,99,2001,02 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,98,99,2001,02,2003 Free Software Foundation, Inc. Written by Miles Bader and Marcus Brinkmann. This file is part of the GNU Hurd. @@ -20,6 +20,7 @@ #include #include +#include #include "priv.h" @@ -30,6 +31,8 @@ #define OPT_NO_JUMP_DOWN_ON_INPUT 602 /* --no-jump-down-on-input */ #define OPT_JUMP_DOWN_ON_OUTPUT 603 /* --jump-down-on-output */ #define OPT_NO_JUMP_DOWN_ON_OUTPUT 604 /* --no-jump-down-on-output */ +#define OPT_VISUAL_BELL 605 /* --visual-bell */ +#define OPT_AUDIBLE_BELL 606 /* --audible-bell */ /* Common value for diskfs_common_options and diskfs_default_sync_interval. */ #define DEFAULT_SLACK 100 @@ -50,6 +53,12 @@ int _cons_jump_down_on_output; /* The filename of the console server. */ char *_cons_file; +/* The type of bell used for the visual bell. */ +bell_type_t _cons_visual_bell = BELL_VISUAL; + +/* The type of bell used for the audible bell. */ +bell_type_t _cons_audible_bell = BELL_AUDIBLE; + static const struct argp_option startup_options[] = { @@ -63,6 +72,10 @@ startup_options[] = "End scrollback when something is printed" }, { "no-jump-down-on-output", OPT_NO_JUMP_DOWN_ON_OUTPUT, NULL, 0, "End scrollback when something is printed (default)" }, + { "visual-bell", OPT_VISUAL_BELL, "BELL", 0, "Visual bell: on (default), " + "off, visual, audible" }, + { "audible-bell", OPT_AUDIBLE_BELL, "BELL", 0, "Audible bell: on (default), " + "off, visual, audible" }, { 0, 0 } }; @@ -95,6 +108,30 @@ parse_startup_opt (int opt, char *arg, struct argp_state *state) _cons_jump_down_on_output = 0; break; + case OPT_AUDIBLE_BELL: + if (!strcasecmp ("on", arg) || !strcasecmp ("audible", arg)) + _cons_audible_bell = BELL_AUDIBLE; + else if (!strcasecmp ("off", arg)) + _cons_audible_bell = BELL_OFF; + else if (!strcasecmp ("visual", arg)) + _cons_audible_bell = BELL_VISUAL; + else + argp_error (state, "The audible bell can be one of: on, off, visual, " + "audible"); + break; + + case OPT_VISUAL_BELL: + if (!strcasecmp ("on", arg) || !strcasecmp ("visual", arg)) + _cons_visual_bell = BELL_VISUAL; + else if (!strcasecmp ("off", arg)) + _cons_visual_bell = BELL_OFF; + else if (!strcasecmp ("audible", arg)) + _cons_visual_bell = BELL_AUDIBLE; + else + argp_error (state, "The visual bell can be one of: on, off, visual, " + "audible"); + break; + case ARGP_KEY_ARG: if (state->arg_num > 0) /* Too many arguments. */ -- cgit v1.2.3