From 7234d1b90c3a62740cf89931341cfb2d04ded1c0 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 20 Dec 2004 13:13:35 +0000 Subject: create unset_automatic() --- mdk-stage1/automatic.c | 4 ++-- mdk-stage1/cdrom.c | 4 ++-- mdk-stage1/modules.c | 4 ++-- mdk-stage1/network.c | 10 +++++----- mdk-stage1/stage1.c | 6 ++---- mdk-stage1/tools.c | 6 ++++++ mdk-stage1/tools.h | 1 + 7 files changed, 20 insertions(+), 15 deletions(-) (limited to 'mdk-stage1') diff --git a/mdk-stage1/automatic.c b/mdk-stage1/automatic.c index 406e5f003..a2e32924e 100644 --- a/mdk-stage1/automatic.c +++ b/mdk-stage1/automatic.c @@ -114,7 +114,7 @@ enum return_type ask_from_list_auto(char *msg, char ** elems, char ** choice, ch elems++; elems_auto++; } - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ + unset_automatic(); /* we are in a fallback mode */ return ask_from_list(msg, sav_elems, choice); } } @@ -135,7 +135,7 @@ enum return_type ask_from_list_comments_auto(char *msg, char ** elems, char ** e elems++; elems_auto++; } - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ + unset_automatic(); /* we are in a fallback mode */ return ask_from_list_comments(msg, sav_elems, elems_comments, choice); } } diff --git a/mdk-stage1/cdrom.c b/mdk-stage1/cdrom.c index f226020c4..1d93ed112 100644 --- a/mdk-stage1/cdrom.c +++ b/mdk-stage1/cdrom.c @@ -83,7 +83,7 @@ static enum return_type try_with_device(char * dev_name, char * dev_model) if (mount_that_cd_device(dev_name) == -1) { enum return_type results; char msg[500]; - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ + unset_automatic(); /* we are in a fallback mode */ remove_wait_message(); snprintf(msg, sizeof(msg), "I can't access a " DISTRIB_NAME " Installation disc in your CDROM drive (%s).\nRetry?", dev_model); @@ -153,7 +153,7 @@ enum return_type cdrom_prepare(void) if ((i = try_automatic(medias, medias_models)) != -1) return do_with_device(medias[i], medias_models[i]); - unset_param(MODE_AUTOMATIC); + unset_automatic(); } else my_insmod("sr_mod", ANY_DRIVER_TYPE, NULL, 0); diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c index 654873146..8fb92b6d5 100644 --- a/mdk-stage1/modules.c +++ b/mdk-stage1/modules.c @@ -103,7 +103,7 @@ static enum return_type ensure_additional_modules_available(void) } if (IS_AUTOMATIC) { - unset_param(MODE_AUTOMATIC); + unset_automatic(); automatic = 1; } @@ -502,7 +502,7 @@ enum return_type ask_insmod(enum driver_type type) enum return_type results; char * choice; - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ + unset_automatic(); /* we are in a fallback mode */ if (type == SCSI_ADAPTERS) mytype = "SCSI"; diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c index 5f341640c..be4cbefc4 100644 --- a/mdk-stage1/network.c +++ b/mdk-stage1/network.c @@ -867,7 +867,7 @@ enum return_type nfs_prepare(void) "and the directory containing the " DISTRIB_NAME " Distribution.", questions, &answers, 40, questions_auto, NULL); if (results != RETURN_OK || streq(answers[0], "")) { - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ + unset_automatic(); /* we are in a fallback mode */ return nfs_prepare(); } @@ -940,7 +940,7 @@ enum return_type ftp_prepare(void) "and the login/pass if necessary (leave login blank for anonymous). ", questions, &answers, 40, questions_auto, NULL); if (results != RETURN_OK || streq(answers[0], "")) { - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ + unset_automatic(); /* we are in a fallback mode */ return ftp_prepare(); } @@ -1026,7 +1026,7 @@ enum return_type ftp_prepare(void) if (!use_http_proxy) ftp_end_data_command(ftp_serv_response); } else { - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ + unset_automatic(); /* we are in a fallback mode */ return results; } @@ -1081,7 +1081,7 @@ enum return_type http_prepare(void) "and the directory containing the " DISTRIB_NAME " Distribution.", questions, &answers, 40, questions_auto, NULL); if (results != RETURN_OK || streq(answers[0], "")) { - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ + unset_automatic(); /* we are in a fallback mode */ return http_prepare(); } @@ -1107,7 +1107,7 @@ enum return_type http_prepare(void) log_message("HTTP: size of download %d bytes", size); if (load_clp_fd(fd, size) != RETURN_OK) { - unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ + unset_automatic(); /* we are in a fallback mode */ return RETURN_ERROR; } diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index 9768bce56..eb832db38 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -84,8 +84,7 @@ void stg1_error_message(char *msg, ...) { va_list args; va_start(args, msg); - log_message("unsetting automatic"); - unset_param(MODE_AUTOMATIC); + unset_automatic(); verror_message(msg, args); va_end(args); } @@ -94,8 +93,7 @@ void stg1_fatal_message(char *msg, ...) { va_list args; va_start(args, msg); - log_message("unsetting automatic"); - unset_param(MODE_AUTOMATIC); + unset_automatic(); verror_message(msg, args); va_end(args); exit(1); diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c index 45cafcfad..6c47b193d 100644 --- a/mdk-stage1/tools.c +++ b/mdk-stage1/tools.c @@ -187,6 +187,12 @@ void unset_param(int i) stage1_mode &= ~i; } +void unset_automatic(void) +{ + log_message("unsetting automatic"); + unset_param(MODE_AUTOMATIC); +} + // warning, many things rely on the fact that: // - when failing it returns 0 // - it stops on first non-digit char diff --git a/mdk-stage1/tools.h b/mdk-stage1/tools.h index bd4dc7683..3e0213a17 100644 --- a/mdk-stage1/tools.h +++ b/mdk-stage1/tools.h @@ -28,6 +28,7 @@ void process_cmdline(void); int get_param(int i); void set_param(int i); void unset_param(int i); +void unset_automatic(void); int charstar_to_int(const char * s); off_t file_size(const char * path); int total_memory(void); -- cgit v1.2.1