[DRBD-cvs] r1449 - trunk/user

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Fri, 23 Jul 2004 13:50:09 +0200 (CEST)


Author: lars
Date: 2004-07-23 13:50:08 +0200 (Fri, 23 Jul 2004)
New Revision: 1449

Modified:
   trunk/user/drbdsetup.c
Log:
I don't want -d or -h be available. that is too easy.
 If you mean it, you have to spell it out.

Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c	2004-07-22 17:42:00 UTC (rev 1448)
+++ trunk/user/drbdsetup.c	2004-07-23 11:50:08 UTC (rev 1449)
@@ -733,14 +733,26 @@
 	  int c;
 
 	  PRINT_ARGV;
-	  c = getopt_long(argc,argv,make_optstring(options),options,0);
+	  /* only --timeout-expired may be abbreviated to -t
+	   * --human and --do-what-I-say have to be spelled out */
+	  c = getopt_long_only(argc,argv,make_optstring(options),options,0);
 	  if(c == -1) break;
 	  switch(c)
 	    {
 	    case 'h':
+	      if (strcmp("--human",argv[optind-1])) {
+		      fprintf(stderr,"%s\nYou have to spell out --human, if you mean it\n",
+				      argv[optind-1]);
+		      return 20;
+	      }
 	      newstate |= Human;
 	      break;
 	    case 'd':
+	      if (strcmp("--do-what-I-say",argv[optind-1])) {
+		      fprintf(stderr,"%s\nYou have to spell out --do-what-I-say, if you mean it\n",
+				      argv[optind-1]);
+		      return 20;
+	      }
 	      newstate |= DontBlameDrbd;
 	      break;
 	    case 't':