diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-22 17:32:33 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-22 17:49:08 +0200 |
commit | f158212743c51bf1ebd44d27ee07a6c2b4867426 (patch) | |
tree | d50ec63da5173113bae52b9dfa39bf2ab370cfc6 /src/mkinst-cl.opt | |
parent | 90262e24c2a3ec8b1e3fa189f80b41166a347555 (diff) | |
download | eclat-f158212743c51bf1ebd44d27ee07a6c2b4867426.tar.gz eclat-f158212743c51bf1ebd44d27ee07a6c2b4867426.tar.bz2 |
Improve setting UserData attribute. Change lsistat defaults.
* NEWS: Update.
* doc/eclat-setiattr.1: Document new options.
* doc/eclat-lsistat.1: Update.
* etc/describe-instance-attribute.fln: Decode userData.
* grecs: Upgrade.
* src/setiattr-cl.opt: New file.
* src/Makefile.am (OPTFILES): Add setiattr-cl.opt
* src/setiattr.c: Encode UserData.
* src/eclat.h (read_file): New proto.
* src/lsistat-cl.opt: New option -r (--running).
* src/lsistat.c: Change default to show all instances, no matter
their state.
* src/mkinst-cl.opt (read_user_data): Remove. Use read_file instead.
* src/sg.c: Add missing include.
* src/util.c (read_file): New function.
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>], |