summaryrefslogtreecommitdiff
path: root/console-client/driver.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2004-03-21 19:57:00 +0000
committerMarcus Brinkmann <marcus@gnu.org>2004-03-21 19:57:00 +0000
commit132c62de3caad3a9c7de679854f8eb214ad0ce8e (patch)
tree476ea75710fcba20a624e2ce3b5bb1aace60f29b /console-client/driver.c
parentf34ee975ad64f836b3e6af7303f79c6e8ff76a3d (diff)
2004-03-21 Marco Gerards <metgerards@student.han.nl>
* console.c (main): Make sure the arguments are parsed in order. * driver.c (driver_add): Set up argc and argv so they can be used by argp. * generic-speaker.c: Include <string.h> and <argp.h>. (struct melody): New member `name'. Every melody was given a name. (BELL_CLASSIC, BELL_LINUX, BELL_ALARM, BELL_CMAJOR): New macros. (doc, options, argp): New variables. (parse_opt): New function. (generic_speaker_init): Parse the arguments using argp. * vga.c (doc, options, argp): New variables. (parse_opt): New function. (parse_startup_args): Function removed. (vga_display_init): Use argp_parse instead of parse_startup_args.
Diffstat (limited to 'console-client/driver.c')
-rw-r--r--console-client/driver.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/console-client/driver.c b/console-client/driver.c
index 5c4630a0..15b6f185 100644
--- a/console-client/driver.c
+++ b/console-client/driver.c
@@ -1,5 +1,5 @@
/* driver.c - The console client driver code.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann.
This file is part of the GNU Hurd.
@@ -99,6 +99,7 @@ error_t driver_add (const char *const name, const char *const driver,
unsigned int i;
char *dir = driver_path;
int defpath = 0;
+ char *opt_backup;
mutex_lock (&driver_list_lock);
for (i = 0; i < driver_list_len; i++)
@@ -213,8 +214,13 @@ error_t driver_add (const char *const name, const char *const driver,
return ENOMEM;
}
+ opt_backup = argv[*next - 1];
+ argv[*next - 1] = (char *) name;
/* If we will start the driver, the init function must not exit. */
- err = (*drv->ops->init) (&drv->handle, start, argc, argv, next);
+ err = (*drv->ops->init) (&drv->handle, start, argc - (*next - 1),
+ argv + *next - 1, next);
+ argv[*next - 1] = opt_backup;
+
if (!err && start && drv->ops->start)
err = (*drv->ops->start) (drv->handle);
if (err)