diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-01-22 23:57:57 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-01-23 00:31:11 +0200 |
commit | 01151a67eb86c9068612b7f893e586f04f634aee (patch) | |
tree | f055071e3fe17393412aaf699fcf8ea07172dc4e /src/util.c | |
parent | 78911bb500c8fc104de45564543b56f317a42938 (diff) | |
download | eclat-01151a67eb86c9068612b7f893e586f04f634aee.tar.gz eclat-01151a67eb86c9068612b7f893e586f04f634aee.tar.bz2 |
Implement snapshot attribute commands.
* TODO: Update.
* etc/describe-snapshot-attribute.fln: New file.
* etc/modify-snapshot-attribute.fln: New file.
* etc/reset-snapshot-attribute.fln: New file.
* etc/Makefile.am: Add new files.
* src/dscrsnapattr.c: New file.
* src/Makefile.am: Add new files.
* src/dscrinstattr.c (list_attrs): Remove.
(eclat_describe_instance_attribute): Assign available_attrs.
* src/eclat.c (cmdtab): New commands: describe-snapshot-attribute,
modify-snapshot-attribute, and reset-snapshot-attribute.
* src/eclat.h (eclat_describe_snapshot_attribute)
(eclat_modify_snapshot_attribute)
(eclat_reset_snapshot_attribute): New protos.
(available_attrs): New extern.
(list_attrs): New function.
* src/modinstattr.c (list_attrs): Rename to list_mod_attrs.
* src/util.c (available_attrs): New global.
(list_attrs): New function.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -273,3 +273,28 @@ eclat_actcmp(const char *a, const char *b) } return rc; } + +char **available_attrs; + +void +list_attrs(FILE *fp) +{ + size_t ncols = get_scr_cols(); + int i, col, len; + char *delim = ""; + + fprintf(fp, "Available attributes are:\n"); + col = 0; + for (i = 0; available_attrs[i]; i++) { + len = strlen(delim) + strlen(available_attrs[i]); + if (col + len > ncols) { + fprintf(fp, ",\n%s", available_attrs[i]); + col = strlen(available_attrs[i]); + } else + col += fprintf(fp, "%s%s", delim, available_attrs[i]); + delim = ", "; + } + fputc('\n', fp); + fputc('\n', fp); +} + |