summaryrefslogtreecommitdiffstats
path: root/sys-utils/flock.c
diff options
context:
space:
mode:
authorSami Kerola2011-09-21 20:55:50 +0200
committerSami Kerola2011-09-29 22:22:33 +0200
commitd89bfedff594a25d59f639c09308b2d1b4d97134 (patch)
tree409618129c5a92a58c80e23bece6c55b94c8df4b /sys-utils/flock.c
parentflock: fix coding style (diff)
downloadkernel-qcow2-util-linux-d89bfedff594a25d59f639c09308b2d1b4d97134.tar.gz
kernel-qcow2-util-linux-d89bfedff594a25d59f639c09308b2d1b4d97134.tar.xz
kernel-qcow2-util-linux-d89bfedff594a25d59f639c09308b2d1b4d97134.zip
flock: move long_options struct to function scope
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/flock.c')
-rw-r--r--sys-utils/flock.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sys-utils/flock.c b/sys-utils/flock.c
index 96d4e5a3d..356c8ec78 100644
--- a/sys-utils/flock.c
+++ b/sys-utils/flock.c
@@ -41,20 +41,6 @@
#include "nls.h"
-static const struct option long_options[] = {
- {"shared", 0, NULL, 's'},
- {"exclusive", 0, NULL, 'x'},
- {"unlock", 0, NULL, 'u'},
- {"nonblocking", 0, NULL, 'n'},
- {"nb", 0, NULL, 'n'},
- {"timeout", 1, NULL, 'w'},
- {"wait", 1, NULL, 'w'},
- {"close", 0, NULL, 'o'},
- {"help", 0, NULL, 'h'},
- {"version", 0, NULL, 'V'},
- {0, 0, 0, 0}
-};
-
const char *program;
static void usage(int ex)
@@ -129,6 +115,20 @@ int main(int argc, char *argv[])
const char *filename = NULL;
struct sigaction sa, old_sa;
+ static const struct option long_options[] = {
+ {"shared", no_argument, NULL, 's'},
+ {"exclusive", no_argument, NULL, 'x'},
+ {"unlock", no_argument, NULL, 'u'},
+ {"nonblocking", no_argument, NULL, 'n'},
+ {"nb", no_argument, NULL, 'n'},
+ {"timeout", required_argument, NULL, 'w'},
+ {"wait", required_argument, NULL, 'w'},
+ {"close", no_argument, NULL, 'o'},
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'V'},
+ {NULL, 0, NULL, 0}
+ };
+
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);