]> granicus.if.org Git - sysstat/commitdiff
sadf: Small code cleanup
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 25 Feb 2017 15:50:17 +0000 (16:50 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 25 Feb 2017 15:50:17 +0000 (16:50 +0100)
Remove unneeded tests in sadf code.
sadf uses default datafile when no filename has been entered on the
command line.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sadf.c

diff --git a/sadf.c b/sadf.c
index 1d996f94cfdba9d765332cde75e5162ad174b892..063293ae65775a3ec530eabac9a1700305ab598b 100644 (file)
--- a/sadf.c
+++ b/sadf.c
@@ -1702,22 +1702,11 @@ int main(int argc, char **argv)
                                /* File already specified */
                                usage(argv[0]);
                        }
-                       if (!strcmp(argv[opt], "-")) {
-                               /* File name set to '-' */
-                               set_default_file(dfile, 0, -1);
-                               opt++;
-                       }
-                       else if (!strncmp(argv[opt], "-", 1)) {
-                               /* Bad option */
-                               usage(argv[0]);
-                       }
-                       else {
-                               /* Write data to file */
-                               strncpy(dfile, argv[opt++], MAX_FILE_LEN);
-                               dfile[MAX_FILE_LEN - 1] = '\0';
-                               /* Check if this is an alternate directory for sa files */
-                               check_alt_sa_dir(dfile, 0, -1);
-                       }
+                       /* Write data to file */
+                       strncpy(dfile, argv[opt++], MAX_FILE_LEN);
+                       dfile[MAX_FILE_LEN - 1] = '\0';
+                       /* Check if this is an alternate directory for sa files */
+                       check_alt_sa_dir(dfile, 0, -1);
                }
 
                else if (interval < 0) {