summaryrefslogtreecommitdiffstats
path: root/sbin/mount
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2007-04-13 21:30:47 +0000
committerphk <phk@FreeBSD.org>2007-04-13 21:30:47 +0000
commite6d8ff48cac534bd7efd0048f2e700bd605df778 (patch)
treec60f368fe03b8efabb69b0ab59cf84decfeef102 /sbin/mount
parent07cc016152a495aba24cd4bca7fc449750d28749 (diff)
downloadFreeBSD-src-e6d8ff48cac534bd7efd0048f2e700bd605df778.zip
FreeBSD-src-e6d8ff48cac534bd7efd0048f2e700bd605df778.tar.gz
Align -p output in TAB built columns suitable for /etc/fstab.
Diffstat (limited to 'sbin/mount')
-rw-r--r--sbin/mount/mount.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index 70a7b42..4148163 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -810,6 +810,7 @@ putfsent(const struct statfs *ent)
{
struct fstab *fst;
char *opts;
+ int l;
opts = flags2opts(ent->f_flags);
@@ -817,8 +818,24 @@ putfsent(const struct statfs *ent)
* "rw" is not a real mount option; this is why we print NULL as "rw"
* if opts is still NULL here.
*/
- printf("%s\t%s\t%s %s", ent->f_mntfromname, ent->f_mntonname,
- ent->f_fstypename, opts ? opts : "rw");
+ l = strlen(ent->f_mntfromname);
+ printf("%s%s%s%s", ent->f_mntfromname,
+ l < 8 ? "\t" : "",
+ l < 16 ? "\t" : "",
+ l < 24 ? "\t" : " ");
+ l = strlen(ent->f_mntonname);
+ printf("%s%s%s%s", ent->f_mntonname,
+ l < 8 ? "\t" : "",
+ l < 16 ? "\t" : "",
+ l < 24 ? "\t" : " ");
+ printf("%s\t", ent->f_fstypename);
+ if (opts == NULL) {
+ printf("%s\t", "rw");
+ } else {
+ l = strlen(opts);
+ printf("%s%s", opts,
+ l < 8 ? "\t" : " ");
+ }
free(opts);
if ((fst = getfsspec(ent->f_mntfromname)))
OpenPOWER on IntegriCloud