From e72da228343024d66a2d2be92429e6bfec4f6fa1 Mon Sep 17 00:00:00 2001 From: jkh Date: Tue, 22 Dec 1998 12:31:26 +0000 Subject: Collapse the "get" code substantially by combining common functions. Also make mountpoint for each media type easier to change. Also reshuffled some menus for easier usage. --- usr.sbin/sysinstall/media.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'usr.sbin/sysinstall/media.c') diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index 05080d6..87f63f4 100644 --- a/usr.sbin/sysinstall/media.c +++ b/usr.sbin/sysinstall/media.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: media.c,v 1.92 1998/11/02 10:42:18 obrien Exp $ + * $Id: media.c,v 1.93 1998/12/02 03:27:37 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -204,8 +204,6 @@ mediaSetFloppy(dialogMenuItem *self) } else mediaDevice = devs[0]; - if (mediaDevice) - mediaDevice->private = "/dist"; return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE) | DITEM_RESTORE; } @@ -764,3 +762,23 @@ mediaSetCPIOVerbosity(dialogMenuItem *self) } return DITEM_SUCCESS; } + +/* A generic open which follows a well-known "path" of places to look */ +FILE * +mediaGenericGet(char *base, const char *file) +{ + char buf[PATH_MAX]; + + snprintf(buf, PATH_MAX, "%s/%s", base, file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "%s/releases/%s", base, file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "%s/%s/%s", base, variable_get(VAR_RELNAME), file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "%s/releases/%s/%s", base, variable_get(VAR_RELNAME), file); + return fopen(buf, "r"); +} + -- cgit v1.1