[DRBD-cvs] user by phil; * removed the infrastructure for built-i...
drbd-user@lists.linbit.com
drbd-user@lists.linbit.com
Thu, 12 Feb 2004 21:24:53 +0100 (CET)
DRBD CVS committal
Author : phil
Project : drbd
Module : user
Dir : drbd/user
Modified Files:
Tag: rel-0_7-branch
drbdadm_main.c
Log Message:
* removed the infrastructure for built-in-help from drbdadm.
* Fixed the sample configuration file.
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/user/Attic/drbdadm_main.c,v
retrieving revision 1.1.2.35
retrieving revision 1.1.2.36
diff -u -3 -r1.1.2.35 -r1.1.2.36
--- drbdadm_main.c 12 Feb 2004 10:36:08 -0000 1.1.2.35
+++ drbdadm_main.c 12 Feb 2004 20:24:48 -0000 1.1.2.36
@@ -65,7 +65,6 @@
char* arg;
int show_in_usage;
int res_name_required;
- const char* help;
};
extern int yyparse();
@@ -101,29 +100,28 @@
{ "dry-run", no_argument, 0, 'd' },
{ "config-file", required_argument,0, 'c' },
{ "drbdsetup", required_argument,0, 's' },
- { "help", no_argument, 0, 'h' },
{ 0, 0, 0, 0 }
};
struct adm_cmd cmds[] = {
- { "attach", adm_attach, 0 ,1,1, "FIXME attach help" },
- { "detach", adm_generic, "detach" ,1,1, "FIXME detach help" },
- { "connect", adm_connect, 0 ,1,1, "FIXME connect help" },
- { "disconnect", adm_generic, "disconnect" ,1,1, "FIXME disconnect help" },
- { "up", adm_up, 0 ,1,1, "FIXME up help" },
- { "down", adm_generic, "down" ,1,1, "FIXME down help" },
- { "primary", adm_generic, "primary" ,1,1, "FIXME primary help" },
- { "secondary", adm_generic, "secondary" ,1,1, "FIXME secondary help" },
- { "invalidate", adm_generic, "invalidate" ,1,1, "FIXME invalidate help" },
- { "invalidate_remote", adm_generic, "invalidate_remote",1,1, "FIXME invalidate_remote help" },
- { "resize", adm_resize, 0 ,1,1, "FIXME resize help" },
- { "syncer", adm_syncer, 0 ,1,1, "FIXME syncer help" },
- { "adjust", adm_adjust, 0 ,1,1, "FIXME adjust help" },
- { "wait_connect", adm_wait_c, 0 ,1,1, "FIXME wait_connect help" },
- { "dump", adm_dump, 0 ,1,1, "FIXME dump help" },
- { "sh-devices", sh_devices, 0 ,0,0, "FIXME sh-devices help" },
- { "sh-mod-parms", sh_mod_parms,0 ,0,0, "FIXME sh-mod-parms help" },
- { "sh-ll-dev", sh_ll_dev, 0 ,0,1, "FIXME sh-ll-dev help" },
+ { "attach", adm_attach, 0 ,1,1 },
+ { "detach", adm_generic, "detach" ,1,1 },
+ { "connect", adm_connect, 0 ,1,1 },
+ { "disconnect", adm_generic, "disconnect" ,1,1 },
+ { "up", adm_up, 0 ,1,1 },
+ { "down", adm_generic, "down" ,1,1 },
+ { "primary", adm_generic, "primary" ,1,1 },
+ { "secondary", adm_generic, "secondary" ,1,1 },
+ { "invalidate", adm_generic, "invalidate" ,1,1 },
+ { "invalidate_remote", adm_generic, "invalidate_remote",1,1 },
+ { "resize", adm_resize, 0 ,1,1 },
+ { "syncer", adm_syncer, 0 ,1,1 },
+ { "adjust", adm_adjust, 0 ,1,1 },
+ { "wait_connect", adm_wait_c, 0 ,1,1 },
+ { "dump", adm_dump, 0 ,1,1 },
+ { "sh-devices", sh_devices, 0 ,0,0 },
+ { "sh-mod-parms", sh_mod_parms,0 ,0,0 },
+ { "sh-ll-dev", sh_ll_dev, 0 ,0,1 }
};
#define ARRY_SIZE(A) (sizeof(A)/sizeof(A[0]))
@@ -528,26 +526,6 @@
return buffer;
}
-void print_cmd_help(struct adm_cmd *cmd)
-{
- struct option *opt;
-
- printf("\nUSAGE: %s [OPTION...] [-- DRBDSETUP-OPTION...] COMMAND "
- "{all|RESOURCE...}\n\n"
- "OPTIONS:\n",basename);
-
- opt=admopt;
- while(opt->name) {
- if(opt->has_arg == required_argument)
- printf(" {--%s|-%c} val\n",opt->name,opt->val);
- else
- printf(" {--%s|-%c}\n",opt->name,opt->val);
- opt++;
- }
- printf("\n%s:\n%s\n",cmd->name,cmd->help);
- exit(20);
-}
-
void print_usage()
{
int i;
@@ -591,7 +569,6 @@
int main(int argc, char** argv)
{
int i,rv;
- int help = 0;
struct adm_cmd *cmd;
struct d_resource *res,*tmp;
@@ -631,8 +608,6 @@
ssprintf(config_file,"%s",optarg);
}
break;
- case 'h':
- print_usage();
case 's':
{
char* pathes[2];
@@ -655,14 +630,12 @@
setup_opts[soi++]=argv[optind++];
if (optind == argc) print_usage();
}
- if (!strcmp(argv[optind],"help")) { help = 1; ++optind; }
if (optind == argc) print_usage();
cmd=NULL;
for(i=0;i<ARRY_SIZE(cmds);i++) {
if(!strcmp(cmds[i].name,argv[optind])) {
cmd=cmds+i;
- if (help) print_cmd_help(cmd); // noreturn
break;
}
}