Skip to content

Commit

Permalink
add long command line arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
bwalex committed May 14, 2011
1 parent a87b5cc commit cc104dd
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tc-play.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <sys/mman.h>
#include <sys/uio.h>
#include <sys/endian.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand All @@ -61,6 +62,7 @@
* - LRW-benbi support? needs further work in dm-crypt and even opencrypto
* - secure buffer review (i.e: is everything that needs it using secure mem?)
* - mlockall? (at least MCL_FUTURE, which is the only one we support)
* - replace err(...) with r = 1; fprintf(); goto out;
*/

#if 0
Expand Down Expand Up @@ -779,6 +781,17 @@ usage(void)
exit(1);
}

static struct option longopts[] = {
{ "info", no_argument, NULL, 'i' },
{ "map", required_argument, NULL, 'm' },
{ "keyfile", required_argument, NULL, 'k' },
{ "keyfile-hidden", required_argument, NULL, 'f' },
{ "protect-hidden", no_argument, NULL, 'e' },
{ "device", required_argument, NULL, 'd' },
{ "system-encryption", required_argument, NULL, 's' },
{ NULL, 0, NULL, 0 },
};

int
main(int argc, char *argv[])
{
Expand All @@ -801,7 +814,7 @@ main(int argc, char *argv[])
nkeyfiles = 0;
n_hkeyfiles = 0;

while ((ch = getopt(argc, argv, "d:ef:ik:m:s:v")) != -1) {
while ((ch = getopt_long(argc, argv, "d:ef:ik:m:s:v", longopts, NULL)) != -1) {
switch(ch) {
case 'd':
dev = optarg;
Expand Down

0 comments on commit cc104dd

Please sign in to comment.