/* Each option to be added is described in one entry of the input <args> This input must be terminated with an entry containing ARG_TABLE_ENDMARKER.  */
void nsi_add_command_line_opts(struct args_struct_t *args)
/* Each option to be added is described in one entry of the input <args> This input must be terminated with an entry containing ARG_TABLE_ENDMARKER.  */
void nsi_add_command_line_opts(struct args_struct_t *args)
{
	int count = 0;
	while (args[count].option != NULL) {
		count++;
	}
	count++;
	if (used_args + count >= args_aval) {
		int growby = count;
		if (growby < ARGS_ALLOC_CHUNK_SIZE) {
			growby = ARGS_ALLOC_CHUNK_SIZE;
		}
		struct args_struct_t *new_args_struct = realloc(args_struct,
				      (args_aval + growby)*
				      sizeof(struct args_struct_t));
		args_aval += growby;
		if (new_args_struct == NULL) {
			nsi_print_error_and_exit("Could not allocate memory");
		} else {
			args_struct = new_args_struct;
		}
	}
	memcpy(&args_struct[used_args], args,
		count*sizeof(struct args_struct_t));
	used_args += count - 1;
}