[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] df: Adding a --no-headers option, by request of Bruce Dubbs
From: |
Ed Neville |
Subject: |
[PATCH] df: Adding a --no-headers option, by request of Bruce Dubbs |
Date: |
Sun, 17 Mar 2019 12:27:02 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Taking suggestions into account, '--no-headers' seems more consistent
with ps options.
---
src/df.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/df.c b/src/df.c
index 041f2820d..09f48b8df 100644
--- a/src/df.c
+++ b/src/df.c
@@ -85,6 +85,9 @@ static bool file_systems_processed;
SunOS 4.1.3, for one. It is *not* necessary on GNU/Linux. */
static bool require_sync;
+/* If true we omit the header from output */
+static bool noheaders_option;
+
/* Desired exit status. */
static int exit_status;
@@ -250,7 +253,8 @@ enum
NO_SYNC_OPTION = CHAR_MAX + 1,
SYNC_OPTION,
TOTAL_OPTION,
- OUTPUT_OPTION
+ OUTPUT_OPTION,
+ NOHEADERS_OPTION
};
static struct option const long_options[] =
@@ -266,6 +270,7 @@ static struct option const long_options[] =
{"print-type", no_argument, NULL, 'T'},
{"sync", no_argument, NULL, SYNC_OPTION},
{"no-sync", no_argument, NULL, NO_SYNC_OPTION},
+ {"no-headers", no_argument, NULL, NOHEADERS_OPTION},
{"total", no_argument, NULL, TOTAL_OPTION},
{"type", required_argument, NULL, 't'},
{"exclude-type", required_argument, NULL, 'x'},
@@ -554,6 +559,9 @@ get_header (void)
{
size_t col;
+ if( noheaders_option )
+ return;
+
alloc_table_row ();
for (col = 0; col < ncolumns; col++)
@@ -1539,6 +1547,7 @@ or all file systems by default.\n\
--sync invoke sync before getting usage info\n\
"), stdout);
fputs (_("\
+ --no-headers do not print column headers\n\
--total elide all entries insignificant to available space,\n\
and produce a grand total\n\
"), stdout);
@@ -1581,6 +1590,7 @@ main (int argc, char **argv)
show_listed_fs = false;
human_output_opts = -1;
print_type = false;
+ noheaders_option = false;
file_systems_processed = false;
exit_status = EXIT_SUCCESS;
print_grand_total = false;
@@ -1700,6 +1710,10 @@ main (int argc, char **argv)
print_grand_total = true;
break;
+ case NOHEADERS_OPTION:
+ noheaders_option = true;
+ break;
+
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
--
2.11.0
--
Best regards,
Ed http://www.s5h.net/
- [PATCH] df: Adding a --no-headers option, by request of Bruce Dubbs,
Ed Neville <=