The "def" arg for fflagstostr is too specialized for ls. The caller
can easily translate from "" to whatever it wants to print if no flags are set. (ls prints "-" and mtree prints "none".) Suggested by: bde
This commit is contained in:
parent
b81eeaf0a6
commit
d502d9ac46
@ -44,7 +44,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <unistd.h>
|
||||
.Ft char *
|
||||
.Fn fflagstostr "u_long flags" "char *def"
|
||||
.Fn fflagstostr "u_long flags"
|
||||
.Ft int
|
||||
.Fn strtofflags "char **stringp" "u_long *setp" "u_long *clrp"
|
||||
.Sh DESCRIPTION
|
||||
@ -52,9 +52,7 @@ The
|
||||
.Fn fflagstostr
|
||||
function returns a comma separated string of the file flags represented by
|
||||
.Fa flags .
|
||||
If no flags are set the string
|
||||
.Fa def
|
||||
is returned instead.
|
||||
If no flags are set a zero length string is returned.
|
||||
.Pp
|
||||
The
|
||||
.Fn strtofflags
|
||||
|
@ -76,12 +76,11 @@ static struct {
|
||||
/*
|
||||
* fflagstostr --
|
||||
* Convert file flags to a comma-separated string. If no flags
|
||||
* are set, return the default string.
|
||||
* are set, return the empty string.
|
||||
*/
|
||||
char *
|
||||
fflagstostr(flags, def)
|
||||
fflagstostr(flags)
|
||||
u_long flags;
|
||||
char *def;
|
||||
{
|
||||
static char string[128];
|
||||
char *sp, *dp;
|
||||
@ -100,7 +99,7 @@ fflagstostr(flags, def)
|
||||
}
|
||||
}
|
||||
*dp = '\0';
|
||||
return (dp == string && def != NULL ? def : string);
|
||||
return (string);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user