From c6c22c4fadb3000453389f3ecf471392674adfd1 Mon Sep 17 00:00:00 2001 From: crunchy Date: Fri, 27 Jun 2003 12:21:21 +0000 Subject: add backup and restore commands; little bug fix and clean up. Need to be tested! Just give me 5 minutes, please! --- mpiosh/config.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'mpiosh/config.c') diff --git a/mpiosh/config.c b/mpiosh/config.c index bc2c7dd..e962266 100644 --- a/mpiosh/config.c +++ b/mpiosh/config.c @@ -2,7 +2,7 @@ * * Author: Andreas Buesching * - * $Id: config.c,v 1.5 2003/04/19 11:41:26 germeier Exp $ + * $Id: config.c,v 1.6 2003/06/27 12:21:21 crunchy Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -167,7 +167,27 @@ mpiosh_config_read(struct mpiosh_config_t *config) } int -mpiosh_config_write(struct mpiosh_config_t *config) +mpiosh_config_check_backup_dir( struct mpiosh_config_t *config, int create ) +{ + DIR *dir; + char *path = cfg_resolve_path( CONFIG_BACKUP ); + int ret = 1; + + if ( ( dir = opendir( path ) ) == NULL ) + if ( create ) + ret = ( ! mkdir(path, 0777 ) ); + else + ret = 0; + else + closedir(dir); + + free(path); + + return ret; +} + +int +mpiosh_config_write( struct mpiosh_config_t *config ) { DIR *dir; char *path = cfg_resolve_path(CONFIG_USER); -- cgit v1.2.3