struct gt_func_create_data *dt = NULL;
int ind;
int tmp;
- int avaible_opts = GT_FORCE;
+ int avaible_opts = GT_FORCE | GT_HELP;
dt = zalloc(sizeof(*dt));
if (dt == NULL)
goto out;
ind = gt_get_options(&dt->opts, avaible_opts, argc, argv);
- if (ind < 0)
+ if (ind < 0 || dt->opts & GT_HELP)
goto out;
if (argc - ind < 3)
{
struct gt_func_rm_data *dt = NULL;
int ind;
- int avaible_opts = GT_FORCE | GT_RECURSIVE;
+ int avaible_opts = GT_FORCE | GT_RECURSIVE | GT_HELP;
dt = zalloc(sizeof(*dt));
if (dt == NULL)
goto out;
ind = gt_get_options(&dt->opts, avaible_opts, argc, argv);
- if (ind < 0)
+ if (ind < 0 || dt->opts & GT_HELP)
goto out;
if (argc - ind < 3)
struct gt_func_get_data *dt = NULL;
int ind = 0;
int i;
+ int avaible_opts = GT_HELP;
if (argc < 3)
goto out;
if (dt == NULL)
goto out;
+ ind = gt_get_options(&dt->opts, avaible_opts, argc, argv);
+ if (ind < 0 || dt->opts & GT_HELP)
+ goto out;
+
dt->gadget = argv[ind++];
dt->type = argv[ind++];
dt->name = argv[ind++];
struct gt_func_set_data *dt = NULL;
int ind = 0;
int tmp;
+ int avaible_opts = GT_HELP;
if (argc < 3)
goto out;
if (dt == NULL)
goto out;
+ ind = gt_get_options(&dt->opts, avaible_opts, argc, argv);
+ if (ind < 0 || dt->opts & GT_HELP)
+ goto out;
+
dt->gadget = argv[ind++];
dt->type = argv[ind++];
dt->name = argv[ind++];
{
struct gt_func_func_data *dt = NULL;
int ind;
- int avaible_opts = GT_VERBOSE;
+ int avaible_opts = GT_VERBOSE | GT_HELP;
if (argc < 1)
goto out;
goto out;
ind = gt_get_options(&dt->opts, avaible_opts, argc, argv);
- if (ind < 0)
+ if (ind < 0 || dt->opts & GT_HELP)
goto out;
dt->gadget = argv[ind++];
{"file", required_argument, 0, 1},
{"stdin", no_argument, 0, 2},
{"path", required_argument, 0, 3},
+ {"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
argc++;
while (1) {
int opt_index = 0;
- c = getopt_long(argc, argv, "f", opts, &opt_index);
+ c = getopt_long(argc, argv, "frh", opts, &opt_index);
if (c == -1)
break;
goto out;
dt->path = optarg;
break;
+ case 'h':
+ goto out;
+ break;
default:
goto out;
}
{"file", required_argument, 0, 1},
{"stdout", no_argument, 0, 2},
{"path", required_argument, 0, 3},
+ {"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
argc++;
while (1) {
int opt_index = 0;
- c = getopt_long(argc, argv, "f", opts, &opt_index);
+ c = getopt_long(argc, argv, "fh", opts, &opt_index);
if (c == -1)
break;
goto out;
dt->path = optarg;
break;
+ case 'h':
+ goto out;
+ break;
default:
goto out;
}
char **argv, ExecutableCommand *exec, void * data)
{
struct gt_func_template_data *dt;
- int avaible_opts = GT_VERBOSE;
+ int avaible_opts = GT_VERBOSE | GT_HELP;
int ind;
dt = zalloc(sizeof(*dt));
goto out;
ind = gt_get_options(&dt->opts, avaible_opts, argc, argv);
- if (ind < 0)
+ if (ind < 0 || dt->opts & GT_HELP)
goto out;
if (argc - ind > 1)
{
struct gt_func_template_get_data *dt = NULL;
int i;
+ int ind = 0;
+ int avaible_opts = GT_HELP;
if (argc < 1)
goto out;
if (dt == NULL)
goto out;
- dt->name = argv[0];
+ ind = gt_get_options(&dt->opts, avaible_opts, argc, argv);
+ if (ind < 0 || dt->opts & GT_HELP)
+ goto out;
+
+ dt->name = argv[ind++];
dt->attrs = calloc(argc, sizeof(char *));
if (dt->attrs == NULL)
{
struct gt_func_template_set_data *dt = NULL;
int tmp;
+ int ind = 0;
+ int avaible_opts = GT_HELP;
if (argc < 2)
goto out;
if (dt == NULL)
goto out;
- dt->name = argv[0];
- tmp = gt_parse_setting_list(&dt->attrs, argc - 1, argv + 1);
+ ind = gt_get_options(&dt->opts, avaible_opts, argc, argv);
+ if (ind < 0 || dt->opts & GT_HELP)
+ goto out;
+
+ dt->name = argv[ind++];
+ tmp = gt_parse_setting_list(&dt->attrs, argc - ind, argv + ind);
if (tmp < 0)
goto out;
char **argv, ExecutableCommand *exec, void * data)
{
const char *name;
+ int ind = 0;
+ int avaible_opts = GT_HELP;
+ int opts = 0;
if (argc != 1)
goto out;
- name = argv[0];
+ ind = gt_get_options(&opts, avaible_opts, argc, argv);
+ if (ind < 0 || opts & GT_HELP)
+ goto out;
+
+ name = argv[ind];
executable_command_set(exec, GET_EXECUTABLE(template_rm), (void *)name, NULL);