cvs commit: ALFS/nALFS/src/lib file_handling.c

kpfleming at linuxfromscratch.org kpfleming at linuxfromscratch.org
Mon Nov 3 13:45:07 PST 2003


kpfleming    03/11/03 14:45:07

  Modified:    nALFS    bootstrap bootstrap.configure
               nALFS/src backend.c comm.c editor.c find.c handlers.c init.c
                        libXML-tree.c logging.c nalfs-core.h nalfs.c
                        options.c options.h parser.c utility.c win.c
               nALFS/src/handlers stage.c
               nALFS/src/lib file_handling.c
  Added:       nALFS    bootstrap.option-list
  Log:
  rework option handling to eliminate pointer-casting and inconsistent option definitions
  remove -fno-aliasing-check from configure script as it is no longer needed
  
  Revision  Changes    Path
  1.14      +2 -0      ALFS/nALFS/bootstrap
  
  Index: bootstrap
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/bootstrap,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- bootstrap	29 Oct 2003 02:53:27 -0000	1.13
  +++ bootstrap	3 Nov 2003 21:45:03 -0000	1.14
  @@ -34,6 +34,8 @@
   done
   all_syntaxes=`echo ${all_syntaxes} | ${SP2NL} | sort -u`
   
  +. ./bootstrap.option-list > src/option-list.h
  +
   . ./bootstrap.Makefile > Makefile.am
   
   . ./bootstrap.configure > configure.ac
  
  
  
  1.5       +0 -1      ALFS/nALFS/bootstrap.configure
  
  Index: bootstrap.configure
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/bootstrap.configure,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- bootstrap.configure	29 Oct 2003 02:53:28 -0000	1.4
  +++ bootstrap.configure	3 Nov 2003 21:45:03 -0000	1.5
  @@ -21,7 +21,6 @@
   AC_STDC_HEADERS
   AC_CONFIG_HEADER([config.h])
   AX_CFLAGS_GCC_OPTION([-Wno-unused-function])
  -AX_CFLAGS_GCC_OPTION([-fno-strict-aliasing])
   AC_CHECK_LIB([form], [form_driver], [MAIN_LIBS="${MAIN_LIBS} -lform"])
   AC_CHECK_LIB([ncurses], [initscr], [MAIN_LIBS="${MAIN_LIBS} -lncurses"])
   AC_SUBST([MAIN_LIBS])
  
  
  
  1.1                  ALFS/nALFS/bootstrap.option-list
  
  Index: bootstrap.option-list
  ===================================================================
  #!/bin/bash
  
  cat <<"EOF"
  /*
   *  option-list.h - Program's options.
   *
   *  Copyright (C) 2003
   *
   *  Neven Has <haski at sezampro.yu>
   *  Kevin P. Fleming <kpfleming at linuxfromscratch.org>
   *
   *  This program is free software; you can redistribute it and/or modify
   *  it under the terms of the GNU General Public License as published by
   *  the Free Software Foundation; either version 2 of the License, or
   *  (at your option) any later version.
   *
   *  This program is distributed in the hope that it will be useful,
   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *  GNU General Public License for more details.
   *
   *  You should have received a copy of the GNU General Public License
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
  static struct option_s *options[] = {
  EOF
  
  grep -e "^STRING_OPTION" src/options.h | sed "s/STRING_OPTION(/\&real_opt_/" | sed "s/,.*$/,/"
  grep -e "^BOOL_OPTION" src/options.h | sed "s/BOOL_OPTION(/\&real_opt_/" | sed "s/,.*$/,/"
  grep -e "^NUMBER_OPTION" src/options.h | sed "s/NUMBER_OPTION(/\&real_opt_/" | sed "s/,.*$/,/"
  grep -e "^COMMAND_OPTION" src/options.h | sed "s/COMMAND_OPTION(/\&real_opt_/" | sed "s/,.*$/,/"
  
  cat <<"EOF"
  NULL
  };
  EOF
  
  
  
  1.6       +8 -7      ALFS/nALFS/src/backend.c
  
  Index: backend.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/backend.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- backend.c	23 Oct 2003 00:46:55 -0000	1.5
  +++ backend.c	3 Nov 2003 21:45:04 -0000	1.6
  @@ -45,6 +45,7 @@
   #include "logging.h"
   #include "nalfs-core.h"
   #include "comm.h"
  +#include "options.h"
   
   #include "backend.h"
   
  @@ -105,21 +106,21 @@
   	while ((message = comm_read_ctrl_message(BACKEND_CTRL_SOCK))) {
   		switch (comm_msg_type(message)) {
   			case CTRL_LOG_CHANGED_FILES:
  -				if (++opt_logging_method > LAST_LOGGING_METHOD) {
  -					opt_logging_method = 0;
  +				if (++*opt_logging_method > LAST_LOGGING_METHOD) {
  +					*opt_logging_method = 0;
   				}
   				break;
   
   			case CTRL_LOG_HANDLER_ACTIONS:
  -				Toggle(opt_log_handlers);
  +				Toggle(*opt_log_handlers);
   				break;
   
   			case CTRL_SYSTEM_OUTPUT:
  -				Toggle(opt_show_system_output);
  +				Toggle(*opt_show_system_output);
   				break;
   
   			case CTRL_LOG_BACKEND:
  -				Toggle(opt_log_backend);
  +				Toggle(*opt_log_backend);
   				break;
   
   			case CTRL_PAUSE:
  @@ -155,7 +156,7 @@
   	vsnprintf(raw_msg, sizeof raw_msg, format, ap);
   	va_end(ap);
   
  -	if (mid == T_SYS && !opt_show_system_output) {
  +	if (mid == T_SYS && !*opt_show_system_output) {
   		return;
   	}
   
  @@ -345,7 +346,7 @@
   	} else {
   		/* Find element's handler and then execute it's function. */
   		if (el->handler) {
  -			if (opt_use_relative_dirs) {
  +			if (*opt_use_relative_dirs) {
   				change_to_profiles_dir(el);
   			}
   
  
  
  
  1.8       +1 -0      ALFS/nALFS/src/comm.c
  
  Index: comm.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/comm.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- comm.c	30 Oct 2003 04:56:52 -0000	1.7
  +++ comm.c	3 Nov 2003 21:45:04 -0000	1.8
  @@ -40,6 +40,7 @@
   #include "win.h"
   #include "utility.h"
   #include "nalfs-core.h"
  +#include "options.h"
   
   #include "comm.h"
   
  
  
  
  1.4       +1 -0      ALFS/nALFS/src/editor.c
  
  Index: editor.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/editor.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- editor.c	26 Oct 2003 19:26:10 -0000	1.3
  +++ editor.c	3 Nov 2003 21:45:04 -0000	1.4
  @@ -34,6 +34,7 @@
   #include "utility.h"
   #include "win.h"
   #include "nalfs-core.h"
  +#include "options.h"
   
   #include "editor.h"
   
  
  
  
  1.5       +1 -0      ALFS/nALFS/src/find.c
  
  Index: find.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/find.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- find.c	30 Oct 2003 05:48:45 -0000	1.4
  +++ find.c	3 Nov 2003 21:45:04 -0000	1.5
  @@ -43,6 +43,7 @@
   #include "nalfs-core.h"
   #include "win.h"
   #include "logging.h"
  +#include "options.h"
   
   #include "find.h"
   
  
  
  
  1.12      +1 -0      ALFS/nALFS/src/handlers.c
  
  Index: handlers.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- handlers.c	28 Oct 2003 01:18:57 -0000	1.11
  +++ handlers.c	3 Nov 2003 21:45:04 -0000	1.12
  @@ -37,6 +37,7 @@
   #include "utility.h"
   #include "win.h"
   #include "nalfs-core.h"
  +#include "options.h"
   
   #include "handlers.h"
   #include "ltdl/ltdl.h"
  
  
  
  1.4       +31 -31    ALFS/nALFS/src/init.c
  
  Index: init.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/init.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- init.c	30 Oct 2003 04:37:40 -0000	1.3
  +++ init.c	3 Nov 2003 21:45:04 -0000	1.4
  @@ -91,7 +91,7 @@
   {
   	char *dir = alloc_alfs_directory_name();
   
  -	Set_string_option(opt_alfs_directory, dir);
  +	set_string_option(opt_alfs_directory, dir);
   
   	xfree(dir);
   }
  @@ -363,16 +363,16 @@
   "    --help                        Display this help.\n"
   "\n",
   	prog,
  -	opt_display_alfs ? "on" : "off",
  -	opt_display_doctype ? "on" : "off",
  -	opt_display_comments ? "on" : "off",
  -	opt_show_system_output ? "on" : "off",
  -	opt_log_status_window ? "on" : "off",
  +	*opt_display_alfs ? "on" : "off",
  +	*opt_display_doctype ? "on" : "off",
  +	*opt_display_comments ? "on" : "off",
  +	*opt_show_system_output ? "on" : "off",
  +	*opt_log_status_window ? "on" : "off",
   	file,
  -	opt_log_backend ? "on" : "off",
  -	opt_log_handlers ? "on" : "off",
  -	opt_run_interactive ? "on" : "off",
  -	opt_be_verbose ? "on" : "off");
  +	*opt_log_backend ? "on" : "off",
  +	*opt_log_handlers ? "on" : "off",
  +	*opt_run_interactive ? "on" : "off",
  +        *opt_be_verbose ? "on" : "off");
   
   	xfree(file);
   
  @@ -425,58 +425,58 @@
   	while ((i = getopt_long(*argc, *argv, "lPfhisBSL:b:p:v", long_opts, NULL)) != -1) {
   		switch (i) {
   			case LONG_OPTION_DISPLAY_ALFS:
  -				Toggle(opt_display_alfs);
  +				Toggle(*opt_display_alfs);
   				break;
   			case LONG_OPTION_DISPLAY_DOCTYPE:
  -				Toggle(opt_display_doctype);
  +				Toggle(*opt_display_doctype);
   				break;
   			case LONG_OPTION_DISPLAY_COMMENTS:
  -				Toggle(opt_display_comments);
  +				Toggle(*opt_display_comments);
   				break;
   			case LONG_OPTION_SYSTEM_OUTPUT:
  -				Toggle(opt_show_system_output);
  +				Toggle(*opt_show_system_output);
   				break;
   
   			case LONG_OPTION_TIMER_SHOWS_CURRENT:
  -				opt_display_timer = TIMER_CURRENT;
  +				*opt_display_timer = TIMER_CURRENT;
   				break;
   			case LONG_OPTION_TIMER_SHOWS_TOTAL:
  -				opt_display_timer = TIMER_TOTAL;
  +				*opt_display_timer = TIMER_TOTAL;
   				break;
   
   			case 'l':
  -				Toggle(opt_log_status_window);
  +				Toggle(*opt_log_status_window);
   				break;
   			case 'B':
  -				Toggle(opt_log_backend);
  +				Toggle(*opt_log_backend);
   				break;
   			case 'f':
  -				opt_logging_method = LOG_USING_ONE_FIND;
  +				*opt_logging_method = LOG_USING_ONE_FIND;
   				break;
   			case 'h':
  -				Toggle(opt_log_handlers);
  +				Toggle(*opt_log_handlers);
   				break;
   
   			case 'i':
  -				Toggle(opt_run_interactive);
  +				Toggle(*opt_run_interactive);
   				break;
   			case 's':
  -				opt_start_immediately = 1;
  +				*opt_start_immediately = 1;
   				break;
   
   			case 'L':
  -				Set_string_option(opt_status_logfile, optarg);
  +				set_string_option(opt_status_logfile, optarg);
   				break;
   
   			case 'b':
  -				Set_string_option(opt_find_base, optarg);
  +				set_string_option(opt_find_base, optarg);
   				break;
   			case 'p':
  -				Set_string_option(opt_find_prunes, optarg);
  +				set_string_option(opt_find_prunes, optarg);
   				break;
   
   			case 'v':
  -				Toggle(opt_be_verbose);
  +				Toggle(*opt_be_verbose);
   				break;
   
   			case LONG_OPTION_VERSION:
  @@ -485,7 +485,7 @@
   
   			case 'S':
   			case LONG_OPTION_GENERATE_STAMP:
  -				Toggle(opt_stamp_packages);
  +				Toggle(*opt_stamp_packages);
   				break;
   
   			case LONG_OPTION_HELP:
  @@ -543,7 +543,7 @@
   
   	do {
   		printf("Do you want to create \"%s\" now (N/y) ? ",
  -			opt_alfs_directory);
  +			*opt_alfs_directory);
   		fflush(stdout);
   
   	} while (fgets(input, sizeof input, stdin) == NULL);
  @@ -554,9 +554,9 @@
   	}
   
   	if (input[0] == 'y' || input[0] == 'Y') {
  -		do_create_directory(opt_alfs_directory);
  +		do_create_directory(*opt_alfs_directory);
   
  -		printf("Directory \"%s\" created.\n\n", opt_alfs_directory);
  +		printf("Directory \"%s\" created.\n\n", *opt_alfs_directory);
   		printf("Press enter to continue. ");
   
   		getchar();
  @@ -610,7 +610,7 @@
   	char *pdir;
   
   
  -	switch (check_directory(opt_alfs_directory)) {
  +	switch (check_directory(*opt_alfs_directory)) {
   		case 0: /* Looking good. */
   			break;
   
  
  
  
  1.5       +1 -1      ALFS/nALFS/src/libXML-tree.c
  
  Index: libXML-tree.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/libXML-tree.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- libXML-tree.c	25 Oct 2003 22:29:48 -0000	1.4
  +++ libXML-tree.c	3 Nov 2003 21:45:04 -0000	1.5
  @@ -259,7 +259,7 @@
   	/* Set the default syntax version. It will be changed while
   	 * parsing, if there is version="" inside <alfs>.
   	 */
  -	syntax_version = xstrdup(opt_default_syntax);
  +	syntax_version = xstrdup(*opt_default_syntax);
   
   	xmlSubstituteEntitiesDefault(1);
   	xmlSetGenericErrorFunc(NULL, handle_error);
  
  
  
  1.14      +14 -13    ALFS/nALFS/src/logging.c
  
  Index: logging.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/logging.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- logging.c	1 Nov 2003 18:25:39 -0000	1.13
  +++ logging.c	3 Nov 2003 21:45:04 -0000	1.14
  @@ -45,6 +45,7 @@
   #include "comm.h"
   #include "handlers.h"
   #include "logfiles.h"
  +#include "options.h"
   
   #include "logging.h"
   
  @@ -434,7 +435,7 @@
   	va_list ap;
   
   
  -	if (! opt_log_handlers) {
  +	if (! *opt_log_handlers) {
   		return;
   	}
   
  @@ -494,9 +495,9 @@
   
   
   	Nprint("Collecting files from %s...",
  -		opt_find_base ? opt_find_base : "/");
  +		*opt_find_base ? *opt_find_base : "/");
   
  -	i = do_collect_files(fp, opt_find_base, opt_find_prunes, time_stamp);
  +	i = do_collect_files(fp, *opt_find_base, *opt_find_prunes, time_stamp);
   
   	fclose(fp);
   
  @@ -569,7 +570,7 @@
   
   	package_string = alloc_package_string(current_package);
   
  -	if (opt_be_verbose) {
  +	if (*opt_be_verbose) {
   		Nprint("Sending the package log to the frontend... ");
   	}
   
  @@ -656,7 +657,7 @@
   		return NULL;
   	}
   
  -	if (opt_logging_method == LOG_USING_ONE_FIND) {
  +	if (*opt_logging_method == LOG_USING_ONE_FIND) {
   		Debug_logging("Logging using one find.");
   
   		if (time_stamp == -1) {
  @@ -669,7 +670,7 @@
   	collect_files(LIST_OF_FILES, &list_of_files);
   
   	if (list_of_files) {
  -		logs_add_installed_files(logs, opt_find_base, opt_find_prunes);
  +		logs_add_installed_files(logs, *opt_find_base, *opt_find_prunes);
   		return list_of_files->name;
   	}
   
  @@ -681,13 +682,13 @@
   	char *installed_files = NULL;
   
   
  -	if (opt_logging_method != LOG_OFF) {
  +	if (*opt_logging_method != LOG_OFF) {
   		installed_files = stage_two_of_logging_changed_files();
   	} else {
   		Debug_logging("Logging files is off, not entering stage two.");
   	}
   
  -	if (opt_stamp_packages) {
  +	if (*opt_stamp_packages) {
   		char *name = alloc_package_name(current_package);
   		char *version = alloc_package_version(current_package);
   
  @@ -710,7 +711,7 @@
   
   static void stage_one_of_logging_changed_files(void)
   {
  -	if (opt_logging_method == LOG_USING_ONE_FIND) {
  +	if (*opt_logging_method == LOG_USING_ONE_FIND) {
   		Debug_logging("Logging using one find.");
   
   		/* Check if the frontend sent us a time stamp. */
  @@ -718,8 +719,8 @@
   			Nprint("Creating new time stamp.");
   			time_stamp = time(NULL);
   
  -			if (opt_sleep_after_stamp > 0) {
  -				sleep(opt_sleep_after_stamp);
  +			if (*opt_sleep_after_stamp > 0) {
  +				sleep(*opt_sleep_after_stamp);
   			}
   
   		} else {
  @@ -792,7 +793,7 @@
   	// Check if frontend has a state file to send us.
   	request_state();
   
  -	if (opt_logging_method != LOG_OFF) {
  +	if (*opt_logging_method != LOG_OFF) {
   		stage_one_of_logging_changed_files();
   	} else {
   		Debug_logging("Logging files is off, not entering stage one.");
  @@ -841,7 +842,7 @@
   
   void start_logging_element(element_s *el)
   {
  -	if (!opt_log_backend) { // Logging off.
  +	if (!*opt_log_backend) { // Logging off.
   		Debug_logging("start_logging_element: log_backend is off");
   		return;
   	}
  
  
  
  1.3       +0 -2      ALFS/nALFS/src/nalfs-core.h
  
  Index: nalfs-core.h
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/nalfs-core.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- nalfs-core.h	21 Oct 2003 15:55:09 -0000	1.2
  +++ nalfs-core.h	3 Nov 2003 21:45:04 -0000	1.3
  @@ -30,8 +30,6 @@
   
   #include "parser.h"
   
  -#include "options.h"
  -
   #define Fatal_error(a, b...) do { \
   	if (opt_run_interactive) { \
   		clear(); refresh(); endwin(); \
  
  
  
  1.31      +142 -142  ALFS/nALFS/src/nalfs.c
  
  Index: nalfs.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/nalfs.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- nalfs.c	1 Nov 2003 18:25:39 -0000	1.30
  +++ nalfs.c	3 Nov 2003 21:45:04 -0000	1.31
  @@ -171,9 +171,9 @@
   
   static void print_cursor(void)
   {
  -	Xmvwaddstr(windows.main->name, displayed.current, 0, opt_cursor_string);
  +	Xmvwaddstr(windows.main->name, displayed.current, 0, *opt_cursor);
   
  -	Xwmove(windows.main->name, displayed.current, strlen(opt_cursor_string) + 6);
  +	Xwmove(windows.main->name, displayed.current, strlen(*opt_cursor) + 6);
   	wchgat(windows.main->name, -1, A_BOLD, COLP_WHITE, NULL);
   
   }
  @@ -185,13 +185,13 @@
   
   	Xwmove(windows.main->name, displayed.current, 0);
   
  -	len = strlen(opt_cursor_string);
  +	len = strlen(*opt_cursor);
   	for (i = 0; i < len; ++i) {
   		Xwaddch(windows.main->name, ' ');
   	}
   
   	Xwmove(windows.main->name,
  -		displayed.current, strlen(opt_cursor_string) + 6);
  +		displayed.current, strlen(*opt_cursor) + 6);
   	wchgat(windows.main->name, -1, A_NORMAL, COLP_WHITE, NULL);
   }
   
  @@ -338,10 +338,10 @@
   			return;
   	}
   
  -	Xmvwaddch(windows.main->name, csr, strlen(opt_cursor_string) + 3,
  +	Xmvwaddch(windows.main->name, csr, strlen(*opt_cursor) + 3,
   		status_to_mark(status));
   
  -	Xwmove(windows.main->name, csr, strlen(opt_cursor_string) + 3);
  +	Xwmove(windows.main->name, csr, strlen(*opt_cursor) + 3);
   	wchgat(windows.main->name, 1, A_NORMAL, pair, NULL);
   }
   
  @@ -359,7 +359,7 @@
   
   static void set_run_status(element_s *el, run_status_e status)
   {
  -	if (!Can_run(el) || !opt_run_interactive) {
  +	if (!Can_run(el) || !*opt_run_interactive) {
   		return;
   	}
   
  @@ -791,7 +791,7 @@
   
   			print_cursor();
   
  -			if (opt_display_profile) {
  +			if (*opt_display_profile) {
   				draw_profile_name(
   				get_profile_by_element(Current_element));
   			}
  @@ -812,7 +812,7 @@
   	set_run_status(current_running, RUN_STATUS_RUNNING);
   
   	/* Jump to this element. */
  -	if (opt_follow_running && opt_run_interactive) {
  +	if (*opt_follow_running && *opt_run_interactive) {
   		jump_to_current_running();
   	}
   }
  @@ -950,7 +950,7 @@
   
   	endwin();
   
  -	editor = opt_editor;
  +	editor = *opt_editor;
   
   	if (Empty_string(editor)) {
   		editor = getenv("EDITOR");
  @@ -1212,7 +1212,7 @@
   
   
   	/* Space for cursor. */
  -	for (i = 0; i < strlen(opt_cursor_string) + 1; ++i) {
  +	for (i = 0; i < strlen(*opt_cursor) + 1; ++i) {
   		append_str(&line, " ");
   	}
   
  @@ -1244,7 +1244,7 @@
   	Xwmove(windows.main->name, 0, 0);
   
   	/* Space for cursor. */
  -	for (j = 0; j < strlen(opt_cursor_string) + 1; ++j) {
  +	for (j = 0; j < strlen(*opt_cursor) + 1; ++j) {
   		Xwaddstr(windows.main->name, " ");
   	}
   
  @@ -1383,11 +1383,11 @@
   
   static int should_skip_element(element_s *el, int *depth)
   {
  -	if (el->type == TYPE_COMMENT && !opt_display_comments) {
  +	if (el->type == TYPE_COMMENT && !*opt_display_comments) {
   		return 1;
   	}
   
  -	if (!opt_display_alfs && Is_element_name(el, "alfs")) {
  +	if (!*opt_display_alfs && Is_element_name(el, "alfs")) {
   		if (depth) {
   			--(*depth);
   			el->hide_children = 0;
  @@ -1395,13 +1395,13 @@
   		return 1;
   	}
   
  -	if (!opt_display_doctype && el->type == TYPE_DOCTYPE) {
  +	if (!*opt_display_doctype && el->type == TYPE_DOCTYPE) {
   		if (depth) {
   			el->hide_children = 1;
   		}
   		return 1;
   	}
  -	if (!opt_display_doctype
  +	if (!*opt_display_doctype
   	&& el->parent && el->parent->type == TYPE_DOCTYPE) {
   		return 1;
   	}
  @@ -1431,7 +1431,7 @@
   
   
   	/* Space for cursor. */
  -	for (i = 0; i < (int)strlen(opt_cursor_string); ++i) {
  +	for (i = 0; i < (int)strlen(*opt_cursor); ++i) {
   		append_str(&line, " ");
   	}
   
  @@ -1450,7 +1450,7 @@
   	append_str(&line, status_mark);
   
   	/* Indentation space. */
  -	j = (*depth) * opt_indentation_size;
  +	j = (*depth) * *opt_indentation_size;
   	for (i = 0; i < j; ++i) {
   		append_str(&line, " ");
   	}
  @@ -1467,7 +1467,7 @@
   	}
   
   	if (el->handler) { /* Description and some element-specific info. */
  -		if (! Is_element_name(el, "stage") || opt_display_stage_header) {
  +		if (! Is_element_name(el, "stage") || *opt_display_stage_header) {
   			append_str(&line, el->handler->info->description);
   		}
   
  @@ -1566,7 +1566,7 @@
   
   static INLINE int jump_match(element_s *el)
   {
  -	switch (opt_jumpto_element) {
  +	switch (*opt_jumpto_element) {
   		case JUMP_TO_FAILED:
   			return el->run_status == RUN_STATUS_FAILED;
   
  @@ -1602,7 +1602,7 @@
   			int i;
   
   			// Open all elements to the package.
  -			if (opt_jumpto_element == JUMP_TO_PACKAGE) {
  +			if (*opt_jumpto_element == JUMP_TO_PACKAGE) {
   				i = found_searched(curr);
   			} else {
   				i = find_cursor(curr);
  @@ -1648,7 +1648,7 @@
   			int i;
   
   			// Open all elements to the package.
  -			if (opt_jumpto_element == JUMP_TO_PACKAGE) {
  +			if (*opt_jumpto_element == JUMP_TO_PACKAGE) {
   				i = found_searched(curr);
   			} else {
   				i = find_cursor(curr);
  @@ -1675,7 +1675,7 @@
   
   static void print_did_not_jump_message(void)
   {
  -	switch (opt_jumpto_element) {
  +	switch (*opt_jumpto_element) {
   		case JUMP_TO_FAILED:
   			Nprint("No more failed elements.");
   			break;
  @@ -1752,22 +1752,22 @@
   
   	switch (get_key(windows.main->name)) {
   		case 'r':
  -			opt_jumpto_element = JUMP_TO_RUNNING;
  +			*opt_jumpto_element = JUMP_TO_RUNNING;
   			Nprint("Jumping to running elements from now on.");
   			break;
   
   		case 'f':
  -			opt_jumpto_element = JUMP_TO_FAILED;
  +			*opt_jumpto_element = JUMP_TO_FAILED;
   			Nprint("Jumping to failed elements from now on.");
   			break;
   
   		case 'd':
  -			opt_jumpto_element = JUMP_TO_DONE;
  +			*opt_jumpto_element = JUMP_TO_DONE;
   			Nprint("Jumping to done elements from now on.");
   			break;
   
   		case 'p':
  -			opt_jumpto_element = JUMP_TO_PACKAGE;
  +			*opt_jumpto_element = JUMP_TO_PACKAGE;
   			Nprint("Jumping to packages from now on.");
   			break;
   
  @@ -1783,9 +1783,9 @@
   
   static INLINE void toggle_verbosity(void)
   {
  -	Toggle(opt_be_verbose);
  +	Toggle(*opt_be_verbose);
   
  -	if (opt_be_verbose) {
  +	if (*opt_be_verbose) {
   		Nprint("Verbosity now on.");
   	} else {
   		Nprint("Verbosity now off.");
  @@ -1798,9 +1798,9 @@
   		comm_send_ctrl_msg(FRONTEND_CTRL_SOCK, CTRL_LOG_BACKEND, "");
   	}
   
  -	Toggle(opt_log_backend);
  +	Toggle(*opt_log_backend);
   
  -	if (opt_log_backend) {
  +	if (*opt_log_backend) {
   		Nprint("Backend logging now on.");
   	} else {
   		Nprint("Backend logging now off.");
  @@ -1813,13 +1813,13 @@
   	FILE *fp;
   
   
  -	if (opt_log_status_window) {
  +	if (*opt_log_status_window) {
   		Nprint("Logging to \"%s\" now off.", file);
  -		opt_log_status_window = 0;
  +		*opt_log_status_window = 0;
   
   	} else {
   		if ((fp = fopen(file, "a")) != NULL) {
  -			opt_log_status_window = 1;
  +			*opt_log_status_window = 1;
   			Nprint("Logging to \"%s\" now on.", file);
   			fclose(fp);
   
  @@ -1838,11 +1838,11 @@
   		comm_send_ctrl_msg(FRONTEND_CTRL_SOCK, CTRL_LOG_CHANGED_FILES, "");
   	}
   
  -	if (++opt_logging_method > LAST_LOGGING_METHOD) {
  -		opt_logging_method = 0;
  +	if (++*opt_logging_method > LAST_LOGGING_METHOD) {
  +		*opt_logging_method = 0;
   	}
   
  -	switch (opt_logging_method) {
  +	switch (*opt_logging_method) {
   		case LOG_USING_ONE_FIND:
   			Nprint("Logging changed files using time stamps.");
   			break;
  @@ -1858,12 +1858,12 @@
   		comm_send_ctrl_msg(FRONTEND_CTRL_SOCK, CTRL_LOG_HANDLER_ACTIONS, "");
   	}
   
  -	if (opt_log_handlers) {
  +	if (*opt_log_handlers) {
   		Nprint("Logging handler actions now off.");
  -		opt_log_handlers = 0;
  +		*opt_log_handlers = 0;
   	} else {
   		Nprint("Logging handler actions now on.");
  -		opt_log_handlers = 1;
  +		*opt_log_handlers = 1;
   	}
   }
   
  @@ -1874,12 +1874,12 @@
   		comm_send_ctrl_msg(FRONTEND_CTRL_SOCK, CTRL_GENERATE_STAMP, "");
   	}
   
  -	if (opt_stamp_packages) {
  +	if (*opt_stamp_packages) {
   		Nprint("Generating stamp now off.");
  -		opt_stamp_packages = 0;
  +		*opt_stamp_packages = 0;
   	} else {
   		Nprint("Generating stamp now on.");
  -		opt_stamp_packages = 1;
  +		*opt_stamp_packages = 1;
   	}
   }
   #endif
  @@ -1890,23 +1890,23 @@
   		comm_send_ctrl_msg(FRONTEND_CTRL_SOCK, CTRL_SYSTEM_OUTPUT, "");
   	}
   
  -	if (opt_show_system_output) {
  +	if (*opt_show_system_output) {
   		Nprint("Displaying system output turned off.");
  -		opt_show_system_output = 0;
  +		*opt_show_system_output = 0;
   	} else {
   		Nprint("Displaying system output turned on.");
  -		opt_show_system_output = 1;
  +		*opt_show_system_output = 1;
   	}
   }
   
   static INLINE void toggle_following(void)
   {
  -	if (opt_follow_running) {
  +	if (*opt_follow_running) {
   		Nprint("Following running elements now off.");
  -		opt_follow_running = 0;
  +		*opt_follow_running = 0;
   	} else {
   		Nprint("Following running elements now on.");
  -		opt_follow_running = 1;
  +		*opt_follow_running = 1;
   	}
   }
   
  @@ -1945,16 +1945,16 @@
   	element_s *old_el = Current_element;
   
   
  -	Toggle(opt_display_comments);
  +	Toggle(*opt_display_comments);
   
  -	if (! opt_display_comments) {
  +	if (! *opt_display_comments) {
   		Nprint("Comments hidden.");
   	} else {
   		Nprint("Comments will be displayed again.");
   	}
   
   	/* We're on the element that's going to be hidden, find another. */
  -	if (Current_element->type == TYPE_COMMENT && !opt_display_comments) {
  +	if (Current_element->type == TYPE_COMMENT && !*opt_display_comments) {
   		old_el = find_nearest_non_comment_element();
   	}
   
  @@ -2001,16 +2001,16 @@
   	element_s *old_el = Current_element;
   
   
  -	Toggle(opt_display_alfs);
  +	Toggle(*opt_display_alfs);
   
  -	if (! opt_display_alfs) {
  +	if (! *opt_display_alfs) {
   		Nprint("Alfs element hidden.");
   	} else {
   		Nprint("Alfs element will be displayed again.");
   	}
   
   	/* We're on the element that's going to be hidden, find another. */
  -	if (Is_element_name(Current_element, "alfs") && !opt_display_alfs) {
  +	if (Is_element_name(Current_element, "alfs") && !*opt_display_alfs) {
   		old_el = find_nearest_non_alfs_element();
   	}
   
  @@ -2030,12 +2030,12 @@
   		return;
   	}
   
  -	get_string_from_bottom("Root directory:", &opt_find_base);
  -	Nprint("Root directory: %s", opt_find_base ? opt_find_base : "/");
  +	get_string_from_bottom("Root directory:", opt_find_base);
  +	Nprint("Root directory: %s", *opt_find_base ? *opt_find_base : "/");
   
  -	get_string_from_bottom("Prune directories:", &opt_find_prunes);
  -	if (opt_find_prunes) {
  -		Nprint("Prune directories: %s", opt_find_prunes);
  +	get_string_from_bottom("Prune directories:", opt_find_prunes);
  +	if (*opt_find_prunes) {
  +		Nprint("Prune directories: %s", *opt_find_prunes);
   	} else {
   		Nprint("Not ignoring any directory.");
   	}
  @@ -2054,7 +2054,7 @@
   
   	/* Jump to option. */
   
  -	switch (opt_jumpto_element) {
  +	switch (*opt_jumpto_element) {
   		case JUMP_TO_FAILED:
   			c = 'f';
   			pair = COLP_STATUS_FAILED;
  @@ -2081,21 +2081,21 @@
   	wchgat(stdscr, 1, A_NORMAL, pair, NULL);
   
   	++col;
  -	Xmvaddch(row, col++, opt_display_alfs		? 'a' : ' ');
  -	Xmvaddch(row, col++, opt_display_doctype	? 'd' : ' ');
  -	Xmvaddch(row, col++, opt_display_comments	? 'c' : ' ');
  +	Xmvaddch(row, col++, *opt_display_alfs		? 'a' : ' ');
  +	Xmvaddch(row, col++, *opt_display_doctype	? 'd' : ' ');
  +	Xmvaddch(row, col++, *opt_display_comments	? 'c' : ' ');
   	++col;
  -	Xmvaddch(row, col++, opt_be_verbose		? 'v' : ' ');
  +	Xmvaddch(row, col++, *opt_be_verbose		? 'v' : ' ');
   	++col;
  -	Xmvaddch(row, col++, opt_show_system_output 	? 's' : ' ');
  +	Xmvaddch(row, col++, *opt_show_system_output 	? 's' : ' ');
   	++col;
  -	Xmvaddch(row, col++, opt_follow_running		? 'o' : ' ');
  +	Xmvaddch(row, col++, *opt_follow_running		? 'o' : ' ');
   	++col;
  -	Xmvaddch(row, col++, opt_log_status_window	? 'w' : ' ');
  +	Xmvaddch(row, col++, *opt_log_status_window	? 'w' : ' ');
   	++col;
  -	Xmvaddch(row, col++, opt_log_handlers		? 'h' : ' ');
  +	Xmvaddch(row, col++, *opt_log_handlers		? 'h' : ' ');
   	++col;
  -	switch (opt_logging_method) {
  +	switch (*opt_logging_method) {
   		case LOG_USING_ONE_FIND:
   			Xmvaddch(row, col++, 'f');
   			break;
  @@ -2104,7 +2104,7 @@
   			break;
   	}
   	++col;
  -	Xmvaddch(row, col++, opt_log_backend ? 'B' : ' ');
  +	Xmvaddch(row, col++, *opt_log_backend ? 'B' : ' ');
   
   	refresh();
   }
  @@ -2125,7 +2125,7 @@
   	 * Set them.
   	 */
   
  -	switch (opt_jumpto_element) {
  +	switch (*opt_jumpto_element) {
   		case JUMP_TO_FAILED:
   			strcpy(jump, "Failed");
   			break;
  @@ -2149,7 +2149,7 @@
   	}
   
   
  -	switch (opt_logging_method) {
  +	switch (*opt_logging_method) {
   		case LOG_USING_ONE_FIND:
   			strcpy(find, "Using one find()-like search");
   			break;
  @@ -2163,7 +2163,7 @@
   			strcpy(find, "Unknown");
   	}
   
  -	switch (opt_display_timer) {
  +	switch (*opt_display_timer) {
   		case TIMER_NONE:
   			strcpy(tdisplay, "Nothing");
   			break;
  @@ -2187,13 +2187,13 @@
   
   	Po("To exit the option menu, type 'q'.\n");
   	Po("\n");
  -	Po("(B)ackend logging: %s\n", Onoff(opt_log_backend));
  -	Po("    (h) Log handler actions: %s\n", Yesno(opt_log_handlers));
  +	Po("(B)ackend logging: %s\n", Onoff(*opt_log_backend));
  +	Po("    (h) Log handler actions: %s\n", Yesno(*opt_log_handlers));
   	Po("    (f) Log changed files: %s\n", find);
   	Po("    (F) Find search options\n");
  -	Po("        Base directory: %s\n", opt_find_base ? opt_find_base : "");
  +	Po("        Base directory: %s\n", *opt_find_base ? *opt_find_base : "");
   	Po("        Prune directories:\n");
  -	Po("        %s", opt_find_prunes ? opt_find_prunes : "");
  +	Po("        %s", *opt_find_prunes ? *opt_find_prunes : "");
   	Po("\n\n");
   	Po("Jump-to element: %s\n", jump);
   	Po("    (jr) Jump to next running element\n");
  @@ -2201,16 +2201,16 @@
   	Po("    (jd) Jump to next successfully done element\n");
   	Po("    (jp) Jump to next package\n");
   	Po("\n");
  -	Po("(w) Log status window: %s\n", Yesno(opt_log_status_window));
  +	Po("(w) Log status window: %s\n", Yesno(*opt_log_status_window));
   	Po("\n");
  -	Po("(o) Follow running element: %s\n", Yesno(opt_follow_running));
  +	Po("(o) Follow running element: %s\n", Yesno(*opt_follow_running));
   	Po("\n");
  -	Po("(a) Show <alfs> element: %s\n", Yesno(opt_display_alfs));
  -//	Po("(d) Show doctype: %s\n", Yesno(opt_display_doctype));
  -	Po("(c) Show comments: %s\n", Yesno(opt_display_comments));
  +	Po("(a) Show <alfs> element: %s\n", Yesno(*opt_display_alfs));
  +//	Po("(d) Show doctype: %s\n", Yesno(*opt_display_doctype));
  +	Po("(c) Show comments: %s\n", Yesno(*opt_display_comments));
   	Po("\n");
  -	Po("(v) Verbose program output: %s\n", Yesno(opt_be_verbose));
  -	Po("(s) Display system output: %s\n", Yesno(opt_show_system_output));
  +	Po("(v) Verbose program output: %s\n", Yesno(*opt_be_verbose));
  +	Po("(s) Display system output: %s\n", Yesno(*opt_show_system_output));
   	Po("\n");
   	Po("(t) Timer displaying : %s", tdisplay);
   
  @@ -2245,7 +2245,7 @@
   		Xmvaddch(0, i + 1 + 1 + strlen(PACKAGE_STRING) + 1, ACS_LTEE);
   	}
   
  -	if (opt_display_options_line) { /* Border of option indicators. */
  +	if (*opt_display_options_line) { /* Border of option indicators. */
   		int begin = strlen(OPTIONS_SPACE) + 4;
   		if ((i = windows.max_cols - begin) > 1) {
   			Xmvaddch(middle_line_y, i, ACS_RTEE);
  @@ -2254,7 +2254,7 @@
   		}
   	}
   
  -	if (opt_display_timer) { /* Timer's and backend status border. */
  +	if (*opt_display_timer) { /* Timer's and backend status border. */
   		int ts = strlen(TIMERS_SPACE);
   		if ((i = windows.max_cols - ( ts + 3 )) > 1) {
   			Xmvaddch(windows.max_lines - 1, i, ACS_RTEE);
  @@ -2275,7 +2275,7 @@
   	int col = windows.max_cols - 6;
   
   
  -	if (opt_display_timer == TIMER_NONE) {
  +	if (*opt_display_timer == TIMER_NONE) {
   		return;
   	}
   
  @@ -2368,7 +2368,7 @@
   	int col = windows.max_cols - 15;
   
   
  -	if (opt_display_timer != TIMER_NONE && col >= 6) {
  +	if (*opt_display_timer != TIMER_NONE && col >= 6) {
   		char *str;
   		double curr, total;
   
  @@ -2381,7 +2381,7 @@
   			total = timer.total_executing;
   		}
   
  -		switch (opt_display_timer) {
  +		switch (*opt_display_timer) {
   			case TIMER_CURRENT:
   				mvaddch(row, col - 2, 'C');
   				str = timer_convert(curr);
  @@ -2420,10 +2420,10 @@
   	draw_backend_status();
   	draw_timer();
   
  -	if (opt_display_profile) {
  +	if (*opt_display_profile) {
   		draw_profile_name(get_profile_by_element(Current_element));
   	}
  -	if (opt_display_options_line) {
  +	if (*opt_display_options_line) {
   		draw_options_indicators();
   	}
   
  @@ -2433,19 +2433,19 @@
   
   static INLINE void toggle_timer(void)
   {
  -	switch (opt_display_timer) {
  +	switch (*opt_display_timer) {
   		case TIMER_NONE:
  -			opt_display_timer = TIMER_TOTAL;
  +			*opt_display_timer = TIMER_TOTAL;
   			Nprint("Displaying total time of execution.");
   			break;
   
   		case TIMER_TOTAL:
  -			opt_display_timer = TIMER_CURRENT;
  +			*opt_display_timer = TIMER_CURRENT;
   			Nprint("Displaying current time of execution.");
   			break;
   
   		case TIMER_CURRENT:
  -			opt_display_timer = TIMER_NONE;
  +			*opt_display_timer = TIMER_NONE;
   			Nprint("Not displaying timer.");
   			break;
   
  @@ -2463,13 +2463,13 @@
   	switch (input) {
   		case 'c':
   			toggle_comments();
  -			if (opt_display_options_line) {
  +			if (*opt_display_options_line) {
   				draw_options_indicators();
   			}
   			break;
   		case 'a':
   			toggle_alfs();
  -			if (opt_display_options_line) {
  +			if (*opt_display_options_line) {
   				draw_options_indicators();
   			}
   			break;
  @@ -2480,28 +2480,28 @@
   
   		case 'v':
   			toggle_verbosity();
  -			if (opt_display_options_line) {
  +			if (*opt_display_options_line) {
   				draw_options_indicators();
   			}
   			break;
   
   		case 'w':
   			toggle_logging();
  -			if (opt_display_options_line) {
  +			if (*opt_display_options_line) {
   				draw_options_indicators();
   			}
   			break;
   
   		case 'o':
   			toggle_following();
  -			if (opt_display_options_line) {
  +			if (*opt_display_options_line) {
   				draw_options_indicators();
   			}
   			break;
   
   		case 'f':
   			toggle_logging_files();
  -			if (opt_display_options_line) {
  +			if (*opt_display_options_line) {
   				draw_options_indicators();
   			}
   			break;
  @@ -2512,28 +2512,28 @@
   
   		case 'h':
   			toggle_logging_actions();
  -			if (opt_display_options_line) {
  +			if (*opt_display_options_line) {
   				draw_options_indicators();
   			}
   			break;
   
   		case 's':
   			toggle_system_output();
  -			if (opt_display_options_line) {
  +			if (*opt_display_options_line) {
   				draw_options_indicators();
   			}
   			break;
   
   		case 'j':
   			toggle_jump_to_element();
  -			if (opt_display_options_line) {
  +			if (*opt_display_options_line) {
   				draw_options_indicators();
   			}
   			break;
   
   		case 'B':
   			toggle_backend_logging();
  -			if (opt_display_options_line) {
  +			if (*opt_display_options_line) {
   				draw_options_indicators();
   			}
   			break;
  @@ -2660,8 +2660,8 @@
   		change_run_status_to_failed(current_running);
   	}
   
  -	if (opt_beep_when_done) {
  -		if (opt_run_interactive) {
  +	if (*opt_beep_when_done) {
  +		if (*opt_run_interactive) {
   			beep();
   
   		} else {
  @@ -3040,7 +3040,7 @@
   
   	backend_status = BACKEND_RUNNING;
   
  -	if (opt_run_interactive) {
  +	if (*opt_run_interactive) {
   		draw_backend_status();
   	}
   }
  @@ -3307,7 +3307,7 @@
   
   	if (! Empty_string(filename)) {
   		char *fullname = NULL;
  -		char *base = xstrdup(opt_profiles_directory);
  +		char *base = xstrdup(*opt_profiles_directory);
   	
   		/* Lying and cheating RFC 2396, telling xmlBuildURI() that
   		 * the _whole_ string should be used as a base directory.
  @@ -3640,11 +3640,11 @@
   	draw_backend_status();
   	draw_timer();
   
  -	if (opt_display_options_line) {
  +	if (*opt_display_options_line) {
   		draw_options_indicators();
   	}
   
  -	if (opt_expand_profiles) {
  +	if (*opt_expand_profiles) {
   		element_s *profile;
   
   		for (profile = root_element->children;
  @@ -3656,11 +3656,11 @@
   
   	rewrite_main();
   
  -	if (opt_print_startup_help) {
  +	if (*opt_print_startup_help) {
   		Nprint("For help, type '?'.");
   	}
   
  -	if (opt_start_immediately) {
  +	if (*opt_start_immediately) {
   		start_executing_children(root_element);
   	}
   
  @@ -3669,7 +3669,7 @@
   
   		print_cursor();
   
  -		if (opt_display_profile) {
  +		if (*opt_display_profile) {
   			draw_profile_name(get_profile_by_element(Current_element));
   		}
   
  @@ -4358,11 +4358,11 @@
   	char *var, *variables;
   
   
  -	if (!opt_warn_if_set_variables || !strlen(opt_warn_if_set_variables)) {
  +	if (!*opt_warn_if_set_variables || !strlen(*opt_warn_if_set_variables)) {
   		return;
   	}
   
  -	variables = xstrdup(opt_warn_if_set_variables);
  +	variables = xstrdup(*opt_warn_if_set_variables);
   
   	for (var = strtok(variables, WHITE_SPACE);
   	     var;
  @@ -4421,7 +4421,7 @@
   	/* First, stop the backend. */
   	comm_send_ctrl_msg(FRONTEND_CTRL_SOCK, CTRL_STOP, "");
   
  -	if (opt_run_interactive) {
  +	if (*opt_run_interactive) {
   		end_display();
   	}
   
  @@ -4434,7 +4434,7 @@
   {
   	(void)sig;
   
  -	if (opt_run_interactive) {
  +	if (*opt_run_interactive) {
   		end_display();
   	}
   
  @@ -4458,7 +4458,7 @@
   		Fatal_error("signal() failed");
   	}
   
  -	if (opt_run_interactive) {
  +	if (*opt_run_interactive) {
   		if (signal(SIGWINCH, signal_winch) == SIG_ERR) {
   			Fatal_error("signal() failed");
   		}
  @@ -4475,12 +4475,12 @@
   
   
   	/* Get real file name. */
  -	if (opt_find_prunes_file[0] == '/') {
  -		file = xstrdup(opt_find_prunes_file);
  +	if (*opt_find_prunes_file[0] == '/') {
  +		file = xstrdup(*opt_find_prunes_file);
   	} else {
  -		file = xstrdup(opt_alfs_directory);
  +		file = xstrdup(*opt_alfs_directory);
   		append_str(&file, "/");
  -		append_str(&file, opt_find_prunes_file);
  +		append_str(&file, *opt_find_prunes_file);
   	}
   
   	/* Read directories from a file. */
  @@ -4500,7 +4500,7 @@
   		
   		fclose(fp);
   
  -		Set_string_option(opt_find_prunes, new_dirs);
  +		set_string_option(opt_find_prunes, new_dirs);
   
   		xfree(new_dirs);
   	}
  @@ -4514,7 +4514,7 @@
    */
   static INLINE void init_state_file(void)
   {
  -	state.filename = xstrdup(opt_alfs_directory);
  +	state.filename = xstrdup(*opt_alfs_directory);
   	append_str(&state.filename, "/");
          	append_str(&state.filename, state_file_name);
   
  @@ -4532,8 +4532,8 @@
   	va_list ap;
           va_list ap2;
   
  -	if (opt_log_status_window && (fp = fopen(file, "a")) == NULL) {
  -		opt_log_status_window = 0;
  +	if (*opt_log_status_window && (fp = fopen(file, "a")) == NULL) {
  +		*opt_log_status_window = 0;
   		nprint_curses(T_WAR,
   			"Unable to open \"%s\" for logging (%s).",
   			file, strerror(errno));
  @@ -4548,7 +4548,7 @@
   	if (mid != T_RAW) {
   		Xwprintw(windows.status->name, "\n%c: ", msg_character(mid));
   
  -		if (opt_log_status_window && fp) {
  +		if (*opt_log_status_window && fp) {
   			fprintf(fp, "\n%c: ", msg_character(mid));
   		}
   	}
  @@ -4557,7 +4557,7 @@
   
   	vwprintw(windows.status->name, (char *) format, ap);
   
  -	if (opt_log_status_window && fp) {
  +	if (*opt_log_status_window && fp) {
   		vfprintf(fp, format, ap2);
   	}
   
  @@ -4566,7 +4566,7 @@
   	va_end(ap);
           va_end(ap2);
   
  -	if (opt_log_status_window && fp) {
  +	if (*opt_log_status_window && fp) {
   		fclose(fp);
   	}
   
  @@ -4581,8 +4581,8 @@
   	va_list ap;
           va_list ap2;
   
  -	if (opt_log_status_window && (fp = fopen(file, "a")) == NULL) {
  -		opt_log_status_window = 0;
  +	if (*opt_log_status_window && (fp = fopen(file, "a")) == NULL) {
  +		*opt_log_status_window = 0;
   		nprint_text(T_WAR,
   			"Unable to open \"%s\" for logging.", file);
   		nprint_text(T_WAR, "Logging will be disabled.");
  @@ -4594,7 +4594,7 @@
   	if (mid != T_RAW) {
   		printf("\n%c: ", msg_character(mid));
   
  -		if (opt_log_status_window && fp) {
  +		if (*opt_log_status_window && fp) {
   			fprintf(fp, "\n%c: ", msg_character(mid));
   		}
   	}
  @@ -4602,14 +4602,14 @@
   	vprintf(format, ap);
   	fflush(stdout);
   
  -	if (opt_log_status_window && fp) {
  +	if (*opt_log_status_window && fp) {
   		vfprintf(fp, format, ap2);
   	}
   
   	va_end(ap);
           va_end(ap2);
           
  -	if (opt_log_status_window && fp) {
  +	if (*opt_log_status_window && fp) {
   		fclose(fp);
   	}
   
  @@ -4648,21 +4648,21 @@
   
   	init_state_file();
   
  -	if (! Empty_string(opt_find_prunes_file)) {
  +	if (! Empty_string(*opt_find_prunes_file)) {
   		append_prune_dirs_from_file();
   	}
   
   	set_main_signals();
   
   
  -	if (opt_run_interactive) { /* Start ncurses. */
  +	if (*opt_run_interactive) { /* Start ncurses. */
   		start_display();
   		draw_static_border();
   		nprint = nprint_curses;
   	}
   
   	/* Print some useful information. */
  -	Nprint("Using \"%s\" directory.", opt_alfs_directory);
  +	Nprint("Using \"%s\" directory.", *opt_alfs_directory);
   	Nprint("Using libxml2, version %s.", LIBXML_DOTTED_VERSION);
   
   	/* Load all handlers. */
  @@ -4673,17 +4673,17 @@
   		add_profile(argv[i]);
   	}
   
  -	if (opt_log_status_window) {
  +	if (*opt_log_status_window) {
   		char *file = alloc_real_status_logfile_name();
   		Nprint("Using \"%s\" for status logging.", file);
   		xfree(file);
   	}
   
  -	if (opt_warn_if_set) {
  +	if (*opt_warn_if_set) {
   		warn_if_variables_set();
   	}
   
  -	if (!opt_run_interactive) {
  +	if (!*opt_run_interactive) {
   		i = run_non_interactively();
   
   		printf("\n\n");
  
  
  
  1.5       +90 -300   ALFS/nALFS/src/options.c
  
  Index: options.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/options.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- options.c	3 Nov 2003 01:25:34 -0000	1.4
  +++ options.c	3 Nov 2003 21:45:04 -0000	1.5
  @@ -4,6 +4,7 @@
    *  Copyright (C) 2002-2003
    *
    *  Neven Has <haski at sezampro.yu>
  + *  Kevin P. Fleming <kpfleming at linuxfromscratch.org>
    *
    *  This program is free software; you can redistribute it and/or modify
    *  it under the terms of the GNU General Public License as published by
  @@ -27,294 +28,101 @@
   #include <config.h>
   #endif
   
  -#define C_FILE
  -#include "options.h"
   
   #include "nalfs-core.h"
   #include "logging.h"
   #include "utility.h"
   
  +/* These macro definitions will cause the options in options.h to actually
  +   be allocated storage in this module.
  +*/
  +
  +#define STRING_OPTION(opt_name, opt_def_value) \
  +		static struct option_s real_opt_##opt_name = { \
  +			.name = #opt_name, \
  +			.type = O_STRING, \
  +			.def_value.str_value = opt_def_value \
  +		}; \
  +		STRING *opt_##opt_name = &real_opt_##opt_name .value.str_value;
  +#define BOOL_OPTION(opt_name, opt_def_value) \
  +		static struct option_s real_opt_##opt_name = { \
  +			.name = #opt_name, \
  +			.type = O_BOOL, \
  +			.def_value.bool_value = opt_def_value \
  +		}; \
  +		BOOL *opt_##opt_name = &real_opt_##opt_name .value.bool_value;
  +#define NUMBER_OPTION(opt_name, opt_def_value) \
  +		static struct option_s real_opt_##opt_name = { \
  +			.name = #opt_name, \
  +			.type = O_NUMBER, \
  +			.def_value.num_value = opt_def_value \
  +		}; \
  +		NUMBER *opt_##opt_name = &real_opt_##opt_name .value.num_value;
  +#define COMMAND_OPTION(opt_name, opt_def_value) \
  +		static struct option_s real_opt_##opt_name = { \
  +			.name = #opt_name, \
  +			.type = O_COMMAND, \
  +			.def_value.str_value = opt_def_value \
  +		}; \
  +		STRING *opt_##opt_name = &real_opt_##opt_name .value.str_value;
   
  -static option_s options[] = {
  -	{
  -		"alfs_directory", O_STRING,
  -		(option_pointer *)& opt_alfs_directory,
  -		(option_pointer *)& ""
  -	},{
  -		"start_immediately", O_BOOL,
  -		(option_pointer *)& opt_start_immediately,
  -		(option_pointer *)  0
  -	},{
  -		"packages_directory", O_STRING,
  -		(option_pointer *)& opt_packages_directory,
  -		(option_pointer *)& "packages"
  -	},{
  -		"default_syntax", O_STRING,
  -		(option_pointer *)& opt_default_syntax,
  -		(option_pointer *)& "3.0"
  -	},{
  -		"cursor", O_STRING,
  -		(option_pointer *)& opt_cursor_string,
  -		(option_pointer *)& "->"
  -	},{
  -		"indentation_size", O_NUMBER,
  -		(option_pointer *)& opt_indentation_size,
  -		(option_pointer *)  4
  -	},{
  -		"sleep_after_stamp", O_NUMBER,
  -		(option_pointer *)& opt_sleep_after_stamp,
  -		(option_pointer *)  1
  -	},{
  -		"beep_when_done", O_BOOL,
  -		(option_pointer *)& opt_beep_when_done,
  -		(option_pointer *)  0
  -	},{
  -		"display_profile", O_BOOL,
  -		(option_pointer *)& opt_display_profile,
  -		(option_pointer *)  1
  -	},{
  -		"display_options_line", O_BOOL,
  -		(option_pointer *)& opt_display_options_line,
  -		(option_pointer *)  1
  -	},{
  -		"display_timer", O_NUMBER,
  -		(option_pointer *)& opt_display_timer,
  -		(option_pointer *)  TIMER_TOTAL
  -	},{
  -		"expand_profiles", O_BOOL,
  -		(option_pointer *)& opt_expand_profiles,
  -		(option_pointer *)  0
  -	},{
  -		"use_relative_dirs", O_BOOL,
  -		(option_pointer *)& opt_use_relative_dirs,
  -		(option_pointer *)  0
  -	},{
  -		"log_status_window", O_BOOL,
  -		(option_pointer *)& opt_log_status_window,
  -		(option_pointer *)  0
  -	},{
  -		"status_logfile", O_STRING,
  -		(option_pointer *)& opt_status_logfile,
  -		(option_pointer *)& "log_file"
  -	},{
  -		"show_system_output", O_BOOL,
  -		(option_pointer *)& opt_show_system_output,
  -		(option_pointer *)  1
  -	},{
  -		"be_verbose", O_BOOL,
  -		(option_pointer *)& opt_be_verbose,
  -		(option_pointer *)  0
  -	},{
  -		"display_alfs", O_BOOL,
  -		(option_pointer *)& opt_display_alfs,
  -		(option_pointer *)  0
  -	},{
  -		"display_doctype", O_BOOL,
  -		(option_pointer *)& opt_display_doctype,
  -		(option_pointer *)  0
  -	},{
  -		"display_comments", O_BOOL,
  -		(option_pointer *)& opt_display_comments,
  -		(option_pointer *)  0
  -	},{
  -		"run_interactive", O_BOOL,
  -		(option_pointer *)& opt_run_interactive,
  -		(option_pointer *)  1
  -	},{
  -		"jumpto_element", O_NUMBER,
  -		(option_pointer *)& opt_jumpto_element,
  -		(option_pointer *)  JUMP_TO_RUNNING
  -	},{
  -		"logging_method", O_NUMBER,
  -		(option_pointer *)& opt_logging_method,
  -		(option_pointer *)  LOG_OFF
  -	},{
  -		"log_handlers", O_BOOL,
  -		(option_pointer *)& opt_log_handlers,
  -		(option_pointer *)  1
  -	},{
  -		"log_backend", O_BOOL,
  -		(option_pointer *)& opt_log_backend,
  -		(option_pointer *)  1
  -	},{
  -		"stamp_packages", O_BOOL,
  -		(option_pointer *)& opt_stamp_packages,
  -		(option_pointer *)  0
  -	},{
  -		"stamp_directory", O_STRING,
  -		(option_pointer *)& opt_stamp_directory,
  -		(option_pointer *)& "stamps"
  -	},{
  -		"display_stage_header", O_BOOL,
  -		(option_pointer *)& opt_display_stage_header,
  -		(option_pointer *)  0
  -	},{
  -		"find_base", O_STRING,
  -		(option_pointer *)& opt_find_base,
  -		(option_pointer *)& "/"
  -	},{
  -		"find_prunes", O_STRING,
  -		(option_pointer *)& opt_find_prunes,
  -		(option_pointer *)& ""
  -	},{
  -		"find_prunes_file", O_STRING,
  -		(option_pointer *)& opt_find_prunes_file,
  -		(option_pointer *)& ""
  -	},{
  -		"profiles_directory", O_STRING,
  -		(option_pointer *)& opt_profiles_directory,
  -		(option_pointer *)& "/" 
  -	},{
  -		"warn_if_set", O_BOOL,
  -		(option_pointer *)& opt_warn_if_set,
  -		(option_pointer *)  0
  -	},{
  -		"follow_running", O_BOOL,
  -		(option_pointer *)& opt_follow_running,
  -		(option_pointer *)  0
  -	},{
  -		"warn_if_set_variables", O_STRING,
  -		(option_pointer *)& opt_warn_if_set_variables,
  -		(option_pointer *)& "CPPFLAGS CXXFLAGS CFLAGS LDFLAGS"
  -	},{
  -		"print_startup_help", O_BOOL,
  -		(option_pointer *)& opt_print_startup_help,
  -		(option_pointer *)  1
  -	},{
  -		"windows_relation", O_NUMBER,
  -		(option_pointer *)& opt_windows_relation,
  -		(option_pointer *)  50
  -	},{
  -		"status_history", O_NUMBER,
  -		(option_pointer *)& opt_status_history,
  -		(option_pointer *)  500
  -	},{
  -		"editor", O_STRING,
  -		(option_pointer *)& opt_editor,
  -		(option_pointer *)& ""
  -	},{
  -		"gunzip_command", O_COMMAND,
  -		(option_pointer *)& opt_gunzip_command,
  -		(option_pointer *)& "zcat %s"
  -	},{
  -		"uncompress_command", O_COMMAND,
  -		(option_pointer *)& opt_uncompress_command,
  -		(option_pointer *)& "zcat %s"
  -	},{
  -		"bunzip2_command", O_COMMAND,
  -		(option_pointer *)& opt_bunzip2_command,
  -		(option_pointer *)& "bunzip2 -dc %s"
  -	},{
  -		"untar_command", O_COMMAND,
  -		(option_pointer *)& opt_untar_command,
  -		(option_pointer *)& "tar xv"
  -	},{
  -		"unpax_command", O_COMMAND,
  -		(option_pointer *)& opt_unpax_command,
  -		(option_pointer *)& "pax -rv"
  -	},{
  -		"uncpio_command", O_COMMAND,
  -		(option_pointer *)& opt_uncpio_command,
  -		(option_pointer *)& "cpio -idv"
  -	},{
  -		"unzip_command", O_COMMAND,
  -		(option_pointer *)& opt_unzip_command,
  -		(option_pointer *)& "unzip %s"
  -	},{
  -		NULL, 0, NULL, NULL
  -	}
  -};
  -
  -
  -
  -static void set_number_option(int idx, NUMBER value)
  -{
  -	option_pointer **var_pointer;
  -
  -
  -	var_pointer = (option_pointer **)(options[idx].var);
  +#include "options.h"
  +#include "option-list.h"
   
  -	*var_pointer = (option_pointer *)value;
  -}
   
  -static void set_string_option(int idx, const char *value)
  +void set_string_option(STRING *var, const char *value)
   {
  -	option_pointer **var_pointer;
  -
   
  +	ASSERT(var != NULL);
   	ASSERT(value != NULL);
   
  -	var_pointer = (option_pointer **)(options[idx].var);
  -
   	/*
   	 * Some options need special treatment when they are set.
   	 */
   
  -	if (var_pointer == (option_pointer **) &opt_find_prunes) {
  +	if (var == opt_find_prunes) {
   		/* Append the value, instead of overwriting the existing. */
   
   		char *new_value = NULL;
   
  -		if (opt_find_prunes && strlen(opt_find_prunes) > 0) {
  -			append_str(&new_value, opt_find_prunes);
  +		if (*var && strlen(*var) > 0) {
  +			append_str(&new_value, *var);
   			append_str(&new_value, " ");
   		}
   
   		append_str(&new_value, value);
   
  -		xfree(*var_pointer);
  +		xfree(*var);
   
  -		*var_pointer = (option_pointer *)new_value;
  +		*var = new_value;
   
   	} else {
  -		xfree(*var_pointer);
  +		xfree(*var);
   
  -		*var_pointer = (option_pointer *)xstrdup(value);
  +		*var = xstrdup(value);
   	}
   }
   
   /*
  - * Sets the option to the specified value.
  - */
  -void set_option(option_pointer **var_pointer, NUMBER number, char *string)
  -{
  -	int i;
  -
  -
  -	for (i = 0; options[i].name; i++) {
  -		if (var_pointer != (option_pointer **)options[i].var) {
  -			continue;
  -		}
  -
  -		switch (options[i].type) {
  -			case O_BOOL:
  -			case O_NUMBER:
  -				set_number_option(i, number);
  -				break;
  -
  -			case O_STRING:
  -			case O_COMMAND:
  -				set_string_option(i, string);
  -				break;
  -		}
  -	}
  -}
  -
  -/*
  - * Sets an option to the specified value.
  + * Sets an option to its default value.
    */
  -static void set_option_from_index(int idx, option_pointer *value)
  +static void set_option_to_default(struct option_s *option)
   {
  -	switch (options[idx].type) {
  -		case O_BOOL:
  -		case O_NUMBER:
  -			set_number_option(idx, (NUMBER)value);
  -			break;
  -
  -		case O_STRING:
  -		case O_COMMAND:
  -			set_string_option(idx, (char *)value);
  -			break;
  +	switch (option->type) {
  +	case O_BOOL:
  +		option->value.bool_value = option->def_value.bool_value;
  +		break;
  +		
  +	case O_NUMBER:
  +		option->value.num_value = option->def_value.num_value;
  +		break;
  +		
  +	case O_STRING:
  +	case O_COMMAND:
  +		if (option->value.str_value)
  +			xfree(option->value.str_value);
  +		option->value.str_value = xstrdup(option->def_value.str_value);
  +		break;
   	}
   }
   
  @@ -325,22 +133,8 @@
   {
   	int i;
   
  -	for (i = 0; options[i].name; i++) {
  -		set_option_from_index(i, options[i].def_value);
  -	}
  -}
  -
  -/*
  - * Sets an option to its default value.
  - */
  -void set_option_to_default(option_pointer **var_pointer)
  -{
  -	int i;
  -
  -	for (i = 0; options[i].name; i++) {
  -		if (var_pointer == (option_pointer **)options[i].var) {
  -			set_option_from_index(i, options[i].def_value);
  -		}
  +	for (i = 0; options[i]; i++) {
  +		set_option_to_default(options[i]);
   	}
   }
   
  @@ -352,13 +146,13 @@
   {
   	char *s;
   
  -	if (opt_status_logfile[0] == '/') {
  -		return xstrdup(opt_status_logfile);
  +	if (*opt_status_logfile[0] == '/') {
  +		return xstrdup(*opt_status_logfile);
   	}
   
  -	s = xstrdup(opt_alfs_directory);
  +	s = xstrdup(*opt_alfs_directory);
   	append_str(&s, "/");
  -	append_str(&s, opt_status_logfile);
  +	append_str(&s, *opt_status_logfile);
   
   	return s;
   }
  @@ -367,13 +161,13 @@
   {
   	char *s;
   
  -	if (opt_packages_directory[0] == '/') {
  -		return xstrdup(opt_packages_directory);
  +	if (*opt_packages_directory[0] == '/') {
  +		return xstrdup(*opt_packages_directory);
   	}
   
  -	s = xstrdup(opt_alfs_directory);
  +	s = xstrdup(*opt_alfs_directory);
   	append_str(&s, "/");
  -	append_str(&s, opt_packages_directory);
  +	append_str(&s, *opt_packages_directory);
   
   	return s;
   }
  @@ -382,30 +176,30 @@
   {
   	char *s;
   
  -	if (opt_stamp_directory[0] == '/') {
  -		return xstrdup(opt_stamp_directory);
  +	if (*opt_stamp_directory[0] == '/') {
  +		return xstrdup(*opt_stamp_directory);
   	}
   
  -	s = xstrdup(opt_alfs_directory);
  +	s = xstrdup(*opt_alfs_directory);
   	append_str(&s, "/");
  -	append_str(&s, opt_stamp_directory);
  +	append_str(&s, *opt_stamp_directory);
   
   	return s;
   }
   
  -static INLINE int not_correct_number(int idx, NUMBER num)
  +static INLINE int not_correct_number(const struct option_s *option, NUMBER num)
   {
  -	if (options[idx].var == (option_pointer *)&opt_display_timer) {
  +	if (option == &real_opt_display_timer) {
   		if (num < TIMER_NONE || num > TIMER_CURRENT) {
   			return 1;
   		}
   
  -	} else if (options[idx].var == (option_pointer *)&opt_jumpto_element) {
  +	} else if (option == &real_opt_jumpto_element) {
   		if (num < JUMP_TO_FAILED || num > JUMP_TO_PACKAGE) {
   			return 1;
   		}
   
  -	} else if (options[idx].var == (option_pointer *)&opt_logging_method) {
  +	} else if (option == &real_opt_logging_method) {
   		if (num < 0 || num > LAST_LOGGING_METHOD) {
   			return 1;
   		}
  @@ -444,19 +238,19 @@
   	char *s = NULL;
   
   
  -	for (i = 0; options[i].name; i++) {
  -		if (strcmp(options[i].name, opt) != 0) {
  +	for (i = 0; options[i]; i++) {
  +		if (strcmp(options[i]->name, opt) != 0) {
   			continue;
   		}
   
  -		switch (options[i].type) {
  +		switch (options[i]->type) {
   			case O_BOOL:
   				if (strcmp(val, BOOL_TRUE_VALUE) == 0) {
  -					set_number_option(i, 1);
  +					options[i]->value.bool_value = 1;
   					return OPTION_SET;
   
   				} else if (strcmp(val, BOOL_FALSE_VALUE) == 0) {
  -					set_number_option(i, 0);
  +					options[i]->value.bool_value = 0;
   					return OPTION_SET;
   				}
   
  @@ -465,30 +259,26 @@
   			case O_NUMBER:
   				num = strtol(val, &s, 10);
   
  -				if (s != NULL && *s) {
  +				if (s != NULL && *s)
   					return OPTION_INVALID_VALUE;
  -				}
   
  -				if (not_correct_number(i, num)) {
  +				if (not_correct_number(options[i], num))
   					return OPTION_INVALID_VALUE;
  -				}
   
  -				set_number_option(i, num);
  +				options[i]->value.num_value = num;
   
   				return OPTION_SET;
   
   			case O_STRING:
  -				set_string_option(i, val);
  +				set_string_option(&options[i]->value.str_value, val);
   
   				return OPTION_SET;
   
   			case O_COMMAND:
  -
  -				if (not_valid_command(val)) {
  +				if (not_valid_command(val))
   					return OPTION_INVALID_VALUE;
  -				}
   
  -				set_string_option(i, val);
  +				set_string_option(&options[i]->value.str_value, val);
   
   				return OPTION_SET;
   		}
  
  
  
  1.6       +82 -82    ALFS/nALFS/src/options.h
  
  Index: options.h
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/options.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- options.h	3 Nov 2003 01:25:34 -0000	1.5
  +++ options.h	3 Nov 2003 21:45:04 -0000	1.6
  @@ -4,6 +4,7 @@
    *  Copyright (C) 2002
    *
    *  Neven Has <haski at sezampro.yu>
  + *  Kevin P. Fleming <kpfleming at linuxfromscratch.org>
    *
    *  This program is free software; you can redistribute it and/or modify
    *  it under the terms of the GNU General Public License as published by
  @@ -55,7 +56,15 @@
    * Options themselves.
    */
   
  -typedef unsigned char option_pointer;
  +#define BOOL 	int
  +#define NUMBER 	int
  +#define STRING 	char *
  +
  +union option_value {
  +	STRING str_value;
  +	BOOL bool_value;
  +	NUMBER num_value;
  +};
   
   enum option_type {
   	O_BOOL,
  @@ -64,95 +73,86 @@
   	O_COMMAND
   };
   
  -typedef struct option_s {
  +struct option_s {
   	char *name;
   
   	enum option_type type;
   
  -	option_pointer *var;
  -
  -	option_pointer *def_value;
  -} option_s;
  -
  -
  -
  -
  -#ifdef C_FILE_
  -#define EXTERN
  -#else
  -#define EXTERN extern
  -#endif
  -
  -
  -#undef INIT
  -#undef EXTERN
  -
  -#ifdef C_FILE
  -# define INIT(x) x
  -# define EXTERN
  -#else
  -# define INIT(x)
  -# define EXTERN extern
  -#endif
  -
  -
  -#define BOOL 	int
  -#define NUMBER 	int
  -#define STRING 	char *
  -
  -EXTERN BOOL opt_start_immediately INIT(= 0);
  -EXTERN STRING opt_alfs_directory INIT(= NULL);
  -EXTERN STRING opt_packages_directory INIT(= NULL);
  -EXTERN STRING opt_default_syntax INIT(= NULL);
  -EXTERN STRING opt_cursor_string INIT(= NULL);
  -EXTERN NUMBER opt_indentation_size INIT(= 0);
  -EXTERN NUMBER opt_sleep_after_stamp INIT(= 0);
  -EXTERN BOOL opt_beep_when_done INIT(= 0);
  -EXTERN BOOL opt_display_profile INIT(= 0);
  -EXTERN BOOL opt_display_options_line INIT(= 0);
  -EXTERN BOOL opt_display_timer INIT(= 0);
  -EXTERN BOOL opt_expand_profiles INIT(= 0);
  -EXTERN BOOL opt_use_relative_dirs INIT(= 0);
  -EXTERN BOOL opt_log_status_window INIT(= 0);
  -EXTERN STRING opt_status_logfile INIT(= NULL);
  -EXTERN BOOL opt_show_system_output INIT(= 0);
  -EXTERN BOOL opt_be_verbose INIT(= 0);
  -EXTERN BOOL opt_display_alfs INIT(= 0);
  -EXTERN BOOL opt_display_doctype INIT(= 0);
  -EXTERN BOOL opt_display_comments INIT(= 0);
  -EXTERN BOOL opt_run_interactive INIT(= 0);
  -EXTERN NUMBER opt_jumpto_element INIT(= 0);
  -EXTERN NUMBER opt_logging_method INIT(= 0);
  -EXTERN BOOL opt_log_handlers INIT(= 0);
  -EXTERN BOOL opt_log_backend INIT(= 0);
  -EXTERN BOOL opt_stamp_packages INIT(= 0);
  -EXTERN STRING opt_stamp_directory INIT(= NULL);
  -EXTERN BOOL opt_display_stage_header INIT(= 0);
  -EXTERN STRING opt_find_base INIT(= NULL);
  -EXTERN STRING opt_find_prunes INIT(= NULL);
  -EXTERN STRING opt_find_prunes_file INIT(= NULL);
  -EXTERN STRING opt_profiles_directory INIT(= NULL);
  -EXTERN BOOL opt_warn_if_set INIT(= 0);
  -EXTERN NUMBER opt_follow_running INIT(= 0);
  -EXTERN STRING opt_warn_if_set_variables INIT(= NULL);
  -EXTERN BOOL opt_print_startup_help INIT(= 0);
  -EXTERN NUMBER opt_windows_relation INIT(= 0);
  -EXTERN NUMBER opt_status_history INIT(= 0);
  -EXTERN STRING opt_editor INIT(= NULL);
  -EXTERN STRING opt_bunzip2_command INIT(= NULL);
  -EXTERN STRING opt_gunzip_command INIT(= NULL);
  -EXTERN STRING opt_uncompress_command INIT(= NULL);
  -EXTERN STRING opt_untar_command INIT(= NULL);
  -EXTERN STRING opt_unpax_command INIT(= NULL);
  -EXTERN STRING opt_uncpio_command INIT(= NULL);
  -EXTERN STRING opt_unzip_command INIT(= NULL);
  +	union option_value value;
  +	union option_value def_value;
  +};
   
  +#ifndef STRING_OPTION
  +#define STRING_OPTION(opt_name, opt_def_value) \
  +		extern STRING *opt_##opt_name;
  +#endif /* STRING_OPTION */
  +
  +#ifndef BOOL_OPTION
  +#define BOOL_OPTION(opt_name, opt_def_value) \
  +		extern BOOL *opt_##opt_name;
  +#endif /* BOOL_OPTION */
  +
  +#ifndef NUMBER_OPTION
  +#define NUMBER_OPTION(opt_name, opt_def_value) \
  +		extern NUMBER *opt_##opt_name;
  +#endif /* NUMBER_OPTION */
  +
  +#ifndef COMMAND_OPTION
  +#define COMMAND_OPTION(opt_name, opt_def_value) \
  +		extern const STRING *opt_##opt_name;
  +#endif /* COMMAND_OPTION */
  +
  +
  +STRING_OPTION(alfs_directory,"")
  +BOOL_OPTION(start_immediately,0)
  +STRING_OPTION(packages_directory,"packages")
  +STRING_OPTION(default_syntax,"3.0")
  +STRING_OPTION(cursor,"->")
  +NUMBER_OPTION(indentation_size,4)
  +NUMBER_OPTION(sleep_after_stamp,1)
  +BOOL_OPTION(beep_when_done,0)
  +BOOL_OPTION(display_profile,1)
  +BOOL_OPTION(display_options_line,1)
  +NUMBER_OPTION(display_timer,TIMER_TOTAL)
  +BOOL_OPTION(expand_profiles,0)
  +BOOL_OPTION(use_relative_dirs,0)
  +BOOL_OPTION(log_status_window,0)
  +STRING_OPTION(status_logfile,"log_file")
  +BOOL_OPTION(show_system_output,1)
  +BOOL_OPTION(be_verbose,0)
  +BOOL_OPTION(display_alfs,0)
  +BOOL_OPTION(display_doctype,0)
  +BOOL_OPTION(display_comments,0)
  +BOOL_OPTION(run_interactive,1)
  +NUMBER_OPTION(jumpto_element,JUMP_TO_RUNNING)
  +NUMBER_OPTION(logging_method,LOG_OFF)
  +BOOL_OPTION(log_handlers,1)
  +BOOL_OPTION(log_backend,1)
  +BOOL_OPTION(stamp_packages,0)
  +STRING_OPTION(stamp_directory,"stamps")
  +BOOL_OPTION(display_stage_header,0)
  +STRING_OPTION(find_base,"/")
  +STRING_OPTION(find_prunes,"")
  +STRING_OPTION(find_prunes_file,"")
  +STRING_OPTION(profiles_directory,"/")
  +BOOL_OPTION(warn_if_set,0)
  +BOOL_OPTION(follow_running,0)
  +STRING_OPTION(warn_if_set_variables,"CPPFLAGS CXXFLAGS CFLAGS LDFLAGS")
  +BOOL_OPTION(print_startup_help,1)
  +NUMBER_OPTION(windows_relation,50)
  +NUMBER_OPTION(status_history,500)
  +STRING_OPTION(editor,"")
  +COMMAND_OPTION(bunzip2_command,"bunzip2 -dc %s")
  +COMMAND_OPTION(gunzip_command,"zcat %s")
  +COMMAND_OPTION(uncompress_command,"zcat %s")
  +COMMAND_OPTION(untar_command,"tar xv")
  +COMMAND_OPTION(unpax_command,"pax -rv")
  +COMMAND_OPTION(uncpio_command,"cpio -idv")
  +COMMAND_OPTION(unzip_command,"unzip %s")
   
  -void set_option(option_pointer **var_pointer, NUMBER number, char *string);
  -#define Set_string_option(a,b) set_option((option_pointer **)&a, 0, b);
   
  +void set_string_option(STRING *var, const STRING value);
   void set_options_to_defaults(void);
  -void set_option_to_default(option_pointer **var_pointer);
   
   char *alloc_real_status_logfile_name(void);
   char *alloc_real_packages_directory_name(void);
  
  
  
  1.5       +2 -0      ALFS/nALFS/src/parser.c
  
  Index: parser.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/parser.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- parser.c	23 Oct 2003 22:02:56 -0000	1.4
  +++ parser.c	3 Nov 2003 21:45:04 -0000	1.5
  @@ -36,6 +36,8 @@
   #include "win.h"
   #include "handlers.h"
   #include "nalfs-core.h"
  +#include "options.h"
  +
   #ifdef PARSE_WITH_LIBXML_SAX
   #include "libXML-SAX.h"
   #else
  
  
  
  1.7       +1 -0      ALFS/nALFS/src/utility.c
  
  Index: utility.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/utility.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- utility.c	29 Oct 2003 00:09:12 -0000	1.6
  +++ utility.c	3 Nov 2003 21:45:04 -0000	1.7
  @@ -43,6 +43,7 @@
   
   #include "win.h" /* For Nprint_err.*/
   #include "nalfs-core.h" /* For Fatal_error. */
  +#include "options.h" /* for opt_run_interactive */
   
   #define PRINT_ERROR Nprint_err
   #define FATAL_ERROR Fatal_error
  
  
  
  1.8       +6 -6      ALFS/nALFS/src/win.c
  
  Index: win.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/win.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- win.c	26 Oct 2003 19:26:10 -0000	1.7
  +++ win.c	3 Nov 2003 21:45:04 -0000	1.8
  @@ -111,7 +111,7 @@
   	int lines_with_offset;
   
   
  -	lines = (opt_windows_relation * (windows.max_lines - 3)) / 100;
  +	lines = (*opt_windows_relation * (windows.max_lines - 3)) / 100;
   
   	lines_with_offset = lines + windows.middle_line_offset;
   
  @@ -192,7 +192,7 @@
   
   	w->ref = refresh_status;
   	w->lines = windows.max_lines - 3 - main_lines;
  -	w->name = newpad(opt_status_history + w->lines, windows.max_cols - 2);
  +	w->name = newpad(*opt_status_history + w->lines, windows.max_cols - 2);
   
   	if (w->name == NULL) {
   		Fatal_error("newpad() failed");
  @@ -200,7 +200,7 @@
   
   	set_default_window_options(w);
   
  -	Xwmove(w->name, opt_status_history - 1, 0);
  +	Xwmove(w->name, *opt_status_history - 1, 0);
   
   	return w;
   }
  @@ -344,7 +344,7 @@
   
   	if (cursor) {
   		move_cursor(top, cursor, lines, ' ');
  -		Xmvwaddstr(windows.main->name, *cursor, 0, opt_cursor_string);
  +		Xmvwaddstr(windows.main->name, *cursor, 0, *opt_cursor);
   	}
   
   	windows.main->ref(*top);
  @@ -396,12 +396,12 @@
   
   		if (cursor) {
   			size_t i;
  -			for (i = 0; i < strlen(opt_cursor_string) + 1; ++i)
  +			for (i = 0; i < strlen(*opt_cursor) + 1; ++i)
   				Xmvwaddch(
   				windows.main->name, old_cursor, i, ' ');
   
   			Xmvwaddstr(
  -			windows.main->name, *cursor, 0, opt_cursor_string);
  +			windows.main->name, *cursor, 0, *opt_cursor);
   		}
   
   		windows.main->ref(*top);
  
  
  
  1.9       +3 -2      ALFS/nALFS/src/handlers/stage.c
  
  Index: stage.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers/stage.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- stage.c	3 Nov 2003 14:28:14 -0000	1.8
  +++ stage.c	3 Nov 2003 21:45:06 -0000	1.9
  @@ -45,6 +45,7 @@
   #include "parser.h"
   #include "nalfs-core.h"
   #include "backend.h"
  +#include "options.h"
   
   extern char **environ;
   
  @@ -375,7 +376,7 @@
   	element_s *stageinfo;
          
   
  -	if (opt_be_verbose) {
  +	if (*opt_be_verbose) {
   		if (stage_name) {
   			Nprint_h("Entering new stage: %s", stage_name);
   		} else {
  @@ -393,7 +394,7 @@
   
   	log_end_time(el, status);
   
  -	if (opt_be_verbose) {
  +	if (*opt_be_verbose) {
   		if (stage_name) {
   			Nprint_h("Exiting stage: %s", stage_name);
   		} else {
  
  
  
  1.3       +7 -7      ALFS/nALFS/src/lib/file_handling.c
  
  Index: file_handling.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/lib/file_handling.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- file_handling.c	31 Oct 2003 01:48:00 -0000	1.2
  +++ file_handling.c	3 Nov 2003 21:45:06 -0000	1.3
  @@ -85,11 +85,11 @@
   {
   	switch (type) {
   	case COMPRESS_GZ:
  -		return xstrdup(opt_gunzip_command);
  +		return xstrdup(*opt_gunzip_command);
   	case COMPRESS_BZ2:
  -		return xstrdup(opt_bunzip2_command);
  +		return xstrdup(*opt_bunzip2_command);
   	case COMPRESS_Z:
  -		return xstrdup(opt_uncompress_command);
  +		return xstrdup(*opt_uncompress_command);
   	default:
   		return NULL;
   	}
  @@ -108,13 +108,13 @@
   {
   	switch (format) {
   	case ARCHIVE_TAR:
  -		return xstrdup(opt_untar_command);
  +		return xstrdup(*opt_untar_command);
   	case ARCHIVE_ZIP:
  -		return xstrdup(opt_unzip_command);
  +		return xstrdup(*opt_unzip_command);
   	case ARCHIVE_PAX:
  -		return xstrdup(opt_unpax_command);
  +		return xstrdup(*opt_unpax_command);
   	case ARCHIVE_CPIO:
  -		return xstrdup(opt_uncpio_command);
  +		return xstrdup(*opt_uncpio_command);
   	default:
   		return NULL;
   	}
  
  
  



More information about the alfs-log mailing list