Align -p output in TAB built columns suitable for /etc/fstab.
This commit is contained in:
parent
bd59d85850
commit
306d73d61e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168698
@ -810,6 +810,7 @@ putfsent(const struct statfs *ent)
|
|||||||
{
|
{
|
||||||
struct fstab *fst;
|
struct fstab *fst;
|
||||||
char *opts;
|
char *opts;
|
||||||
|
int l;
|
||||||
|
|
||||||
opts = flags2opts(ent->f_flags);
|
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"
|
* "rw" is not a real mount option; this is why we print NULL as "rw"
|
||||||
* if opts is still NULL here.
|
* if opts is still NULL here.
|
||||||
*/
|
*/
|
||||||
printf("%s\t%s\t%s %s", ent->f_mntfromname, ent->f_mntonname,
|
l = strlen(ent->f_mntfromname);
|
||||||
ent->f_fstypename, opts ? opts : "rw");
|
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);
|
free(opts);
|
||||||
|
|
||||||
if ((fst = getfsspec(ent->f_mntfromname)))
|
if ((fst = getfsspec(ent->f_mntfromname)))
|
||||||
|
Loading…
Reference in New Issue
Block a user