-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0001-rename-option-w-to-t-for-timeout.patch
87 lines (79 loc) · 2.24 KB
/
0001-rename-option-w-to-t-for-timeout.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
From 1b77a4c27b8a3297a645fcb0b92ca76d405beacb Mon Sep 17 00:00:00 2001
From: Thomas Monjalon <thomas@monjalon.net>
Date: Sun, 14 Feb 2010 20:41:35 +0100
Subject: [PATCH] rename option -w to -t (for timeout)
Now timeout is disabled by default.
It must specified if really needed (e.g. in scripts).
---
README | 4 ++--
clunc | 15 +++++++--------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/README b/README
index 0081381..8d2aa15 100644
--- a/README
+++ b/README
@@ -56,8 +56,8 @@ It can be used
as an interactive shell
or to send a batch of commands via the standard input
-In case of batch commands, CLUNC will close itself after a inactivity time.
-This timeout can be defined with option "-w". The default is 1 second.
+In case of batch commands, CLUNC can close itself after a inactivity time.
+This timeout can be defined with option "-t".
Examples:
clunc -i 192.168.42.3
diff --git a/clunc b/clunc
index e28d86a..9dba8ea 100755
--- a/clunc
+++ b/clunc
@@ -25,8 +25,7 @@ print_usage () {
-v verbose
-m address MAC to target
-i address IP to set (mandatory)
- -w seconds inactivity time to wait
- before closing a batch session (default: 1)
+ -t seconds close batch session after an inactivity time
END_OF_USAGE
}
@@ -42,7 +41,7 @@ set_defaults () {
unset IP
SERVER_PORT=6666
CLIENT_PORT=6666
- DELAY=1
+ unset TIMEOUT_OPT
VERBOSE=0
}
@@ -50,7 +49,7 @@ handle_args () {
SELF=$(basename $0)
SELF_DIR=$(readlink -em $(dirname $0))
- while getopts 'hvm:i:w:' ARG ; do
+ while getopts 'hvm:i:t:' ARG ; do
case $ARG in
h )
print_help
@@ -67,12 +66,12 @@ handle_args () {
IP=$OPTARG
OPEN_OPTS="$OPEN_OPTS -i $IP"
;;
- w )
+ t )
if ! has_batch_input ; then
- echo 'option -w is for batch mode'
+ echo 'option -t is for batch mode'
syntax_error
fi
- DELAY=$OPTARG
+ TIMEOUT_OPT="-w $OPTARG"
;;
* )
syntax_error
@@ -160,7 +159,7 @@ fi
print_header
if has_batch_input ; then # input is a pipe or a file
printf 'Marvell>> '
- $NC_CMD -w $DELAY
+ $NC_CMD $TIMEOUT_OPT
echo ; echo
else # input from a terminal
(echo ; cat) | $NC_CMD
--
2.14.3 (Apple Git-98)