summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorRalf Friedl <Ralf.Friedl@online.de>2011-08-09 04:49:27 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-08-09 04:49:27 +0200
commit00103d32879e98c9bba9b6c14fb36d573badc9e0 (patch)
tree951b98b70cc05fed53a71ad6b942f4e39242ca8c /coreutils
parent98aeabe792ac039b941968efbb4d2d6ef826813d (diff)
downloadbusybox-w32-00103d32879e98c9bba9b6c14fb36d573badc9e0.tar.gz
busybox-w32-00103d32879e98c9bba9b6c14fb36d573badc9e0.tar.bz2
busybox-w32-00103d32879e98c9bba9b6c14fb36d573badc9e0.zip
df: more compatible -P behavior
In coreutils df, one of the effects of the option -P is to output everything in one line. This makes it much easier for a script to parse the output of df. This patch adds the same behavior to busybox df. function old new delta df_main 853 863 +10 Signed-off-by: Ralf Friedl <Ralf.Friedl@online.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/df.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/coreutils/df.c b/coreutils/df.c
index 846cb38ad..63dbd61bd 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -212,7 +212,7 @@ int df_main(int argc UNUSED_PARAM, char **argv)
212 { 212 {
213 uni_stat_t uni_stat; 213 uni_stat_t uni_stat;
214 char *uni_dev = unicode_conv_to_printable(&uni_stat, device); 214 char *uni_dev = unicode_conv_to_printable(&uni_stat, device);
215 if (uni_stat.unicode_width > 20) { 215 if (uni_stat.unicode_width > 20 && !(opt & OPT_POSIX)) {
216 printf("%s\n%20s", uni_dev, ""); 216 printf("%s\n%20s", uni_dev, "");
217 } else { 217 } else {
218 printf("%s%*s", uni_dev, 20 - (int)uni_stat.unicode_width, ""); 218 printf("%s%*s", uni_dev, 20 - (int)uni_stat.unicode_width, "");
@@ -220,7 +220,7 @@ int df_main(int argc UNUSED_PARAM, char **argv)
220 free(uni_dev); 220 free(uni_dev);
221 } 221 }
222#else 222#else
223 if (printf("\n%-20s" + 1, device) > 20) 223 if (printf("\n%-20s" + 1, device) > 20 && !(opt & OPT_POSIX))
224 printf("\n%-20s", ""); 224 printf("\n%-20s", "");
225#endif 225#endif
226 226