diff options
Diffstat (limited to 'src/mkinst-cl.opt')
-rw-r--r-- | src/mkinst-cl.opt | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/src/mkinst-cl.opt b/src/mkinst-cl.opt index 16521d3..8fd9c27 100644 --- a/src/mkinst-cl.opt +++ b/src/mkinst-cl.opt @@ -1,5 +1,5 @@ /* This file is part of Eclat. - Copyright (C) 2013-2014 Sergey Poznyakoff. + Copyright (C) 2013-2015 Sergey Poznyakoff. Eclat is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,6 @@ You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ -#include <sys/stat.h> #include <stdio.h> static char *ami; @@ -38,29 +37,6 @@ static int monitor; static int disable_term; static int ebs_opt; -static void -read_user_data(const char *file) -{ - struct stat st; - FILE *fp; - - if (stat(file, &st)) - die(EX_USAGE, "cannot stat file %s: %s", file, - strerror(errno)); - - /* FIXME: Use limits.h to check st.st_size */ - user_data = grecs_malloc(st.st_size+1); - fp = fopen(file, "r"); - if (!fp) - die(EX_UNAVAILABLE, "cannot open file %s: %s", file, - strerror(errno)); - if (fread(user_data, st.st_size, 1, fp) != 1) - die(EX_UNAVAILABLE, "error reading from %s: %s", file, - strerror(errno)); - fclose(fp); - user_data[st.st_size] = 0; -} - ECLAT_CL_BEGIN([<launch new instances>], [<AMI-ID>]) @@ -94,7 +70,7 @@ END OPTION(data-file,f,[<FILE>], [<read user data from FILE>]) BEGIN - read_user_data(optarg); + user_data = read_file(optarg); END OPTION(type,t,[<TYPE>], |