summaryrefslogtreecommitdiffhomepage
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)
*: 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)
OPT_c = (1 << 1),
OPT_f = (1 << 2),
OPT_q = (1 << 3),
-#if ENABLE_SCRIPTREPLAY
OPT_t = (1 << 4),
-#endif
};
-#if ENABLE_GETOPT_LONG
static const char getopt_longopts[] ALIGN1 =
"append\0" No_argument "a"
"command\0" Required_argument "c"
"flush\0" No_argument "f"
"quiet\0" No_argument "q"
-# if ENABLE_SCRIPTREPLAY
- "timing\0" No_argument "t"
-# endif
+ IF_SCRIPTREPLAY("timing\0" No_argument "t")
;
- applet_long_options = getopt_longopts;
-#endif
+ if (ENABLE_GETOPT_LONG)
+ applet_long_options = getopt_longopts;
+
opt_complementary = "?1"; /* max one arg */
opt = getopt32(argv, "ac:fq" IF_SCRIPTREPLAY("t") , &shell_arg);
//argc -= optind;
@@ -101,9 +97,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
#define buf bb_common_bufsiz1
struct pollfd pfd[2];
int outfd, count, loop;
-#if ENABLE_SCRIPTREPLAY
- double oldtime = time(NULL);
-#endif
+ double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0;
smallint fd_count = 2;
outfd = xopen(fname, mode);
@@ -132,8 +126,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
goto restore;
}
if (count > 0) {
-#if ENABLE_SCRIPTREPLAY
- if (opt & OPT_t) {
+ if (ENABLE_SCRIPTREPLAY && (opt & OPT_t)) {
struct timeval tv;
double newtime;
@@ -142,7 +135,6 @@ int script_main(int argc UNUSED_PARAM, char **argv)
fprintf(stderr, "%f %u\n", newtime - oldtime, count);
oldtime = newtime;
}
-#endif
full_write(STDOUT_FILENO, buf, count);
full_write(outfd, buf, count);
if (opt & OPT_f) {