aboutsummaryrefslogtreecommitdiff
path: root/util-linux/script.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-06-05 14:55:26 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-06-05 14:55:26 +0200
commit53f17912120e2f8732443fbb91fcf2c87123eaa5 (patch)
treec7a40ebfe3b487e4b47dff48af69e084e5fa77e6 /util-linux/script.c
parentd5f1b1bbe0a881f66b6bb6951fa54e553002c24d (diff)
downloadbusybox-w32-53f17912120e2f8732443fbb91fcf2c87123eaa5.tar.gz
busybox-w32-53f17912120e2f8732443fbb91fcf2c87123eaa5.tar.bz2
busybox-w32-53f17912120e2f8732443fbb91fcf2c87123eaa5.zip
*: reduce #ifdef forest
Remove unnecessary #if statements from the "more", "script", and "scriptreplay" commands. Bloatcheck says 0 bytes changed. Signed-off-by: Rob Landley <rob@landley.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/script.c')
-rw-r--r--util-linux/script.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/util-linux/script.c b/util-linux/script.c
index d16a2914a..4e0deb4ef 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -33,24 +33,20 @@ int script_main(int argc UNUSED_PARAM, char **argv)
33 OPT_c = (1 << 1), 33 OPT_c = (1 << 1),
34 OPT_f = (1 << 2), 34 OPT_f = (1 << 2),
35 OPT_q = (1 << 3), 35 OPT_q = (1 << 3),
36#if ENABLE_SCRIPTREPLAY
37 OPT_t = (1 << 4), 36 OPT_t = (1 << 4),
38#endif
39 }; 37 };
40 38
41#if ENABLE_GETOPT_LONG
42 static const char getopt_longopts[] ALIGN1 = 39 static const char getopt_longopts[] ALIGN1 =
43 "append\0" No_argument "a" 40 "append\0" No_argument "a"
44 "command\0" Required_argument "c" 41 "command\0" Required_argument "c"
45 "flush\0" No_argument "f" 42 "flush\0" No_argument "f"
46 "quiet\0" No_argument "q" 43 "quiet\0" No_argument "q"
47# if ENABLE_SCRIPTREPLAY 44 IF_SCRIPTREPLAY("timing\0" No_argument "t")
48 "timing\0" No_argument "t"
49# endif
50 ; 45 ;
51 46
52 applet_long_options = getopt_longopts; 47 if (ENABLE_GETOPT_LONG)
53#endif 48 applet_long_options = getopt_longopts;
49
54 opt_complementary = "?1"; /* max one arg */ 50 opt_complementary = "?1"; /* max one arg */
55 opt = getopt32(argv, "ac:fq" IF_SCRIPTREPLAY("t") , &shell_arg); 51 opt = getopt32(argv, "ac:fq" IF_SCRIPTREPLAY("t") , &shell_arg);
56 //argc -= optind; 52 //argc -= optind;
@@ -101,9 +97,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
101#define buf bb_common_bufsiz1 97#define buf bb_common_bufsiz1
102 struct pollfd pfd[2]; 98 struct pollfd pfd[2];
103 int outfd, count, loop; 99 int outfd, count, loop;
104#if ENABLE_SCRIPTREPLAY 100 double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0;
105 double oldtime = time(NULL);
106#endif
107 smallint fd_count = 2; 101 smallint fd_count = 2;
108 102
109 outfd = xopen(fname, mode); 103 outfd = xopen(fname, mode);
@@ -132,8 +126,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
132 goto restore; 126 goto restore;
133 } 127 }
134 if (count > 0) { 128 if (count > 0) {
135#if ENABLE_SCRIPTREPLAY 129 if (ENABLE_SCRIPTREPLAY && (opt & OPT_t)) {
136 if (opt & OPT_t) {
137 struct timeval tv; 130 struct timeval tv;
138 double newtime; 131 double newtime;
139 132
@@ -142,7 +135,6 @@ int script_main(int argc UNUSED_PARAM, char **argv)
142 fprintf(stderr, "%f %u\n", newtime - oldtime, count); 135 fprintf(stderr, "%f %u\n", newtime - oldtime, count);
143 oldtime = newtime; 136 oldtime = newtime;
144 } 137 }
145#endif
146 full_write(STDOUT_FILENO, buf, count); 138 full_write(STDOUT_FILENO, buf, count);
147 full_write(outfd, buf, count); 139 full_write(outfd, buf, count);
148 if (opt & OPT_f) { 140 if (opt & OPT_f) {