summaryrefslogtreecommitdiff
path: root/libcons/opts-std-startup.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2003-08-02 21:43:46 +0000
committerMarcus Brinkmann <marcus@gnu.org>2003-08-02 21:43:46 +0000
commitd74850a770b15db3c6d2fbae3f85b3318b1d5aa3 (patch)
tree377f09dba45ba16963d47473c153f2a993691314 /libcons/opts-std-startup.c
parentacdd8445816fb1068728057ec65a8c6dd61bc1f5 (diff)
2003-08-01 Marco Gerards <metgerards@student.han.nl>
* opts-std-startup.c: Include <string.h>. (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.
Diffstat (limited to 'libcons/opts-std-startup.c')
-rw-r--r--libcons/opts-std-startup.c39
1 files changed, 38 insertions, 1 deletions
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 <miles@gnu.org> and Marcus Brinkmann.
This file is part of the GNU Hurd.
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <argp.h>
+#include <string.h>
#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. */