2007-09-22 Dmitry V. Levin <ldv@altlinux.org>
* desc.c (sprintflags): Remove static qualifier, add "prefix"
argument, move function to ...
* util.c (sprintflags): ... here.
* defs.h (sprintflags): Declare it.
diff --git a/desc.c b/desc.c
index 4d82fa8..47aa92c 100644
--- a/desc.c
+++ b/desc.c
@@ -242,28 +242,6 @@
}
#endif
-static const char *
-sprintflags(const struct xlat *xlat, int flags)
-{
- static char outstr[1024];
- const char *sep;
-
- strcpy(outstr, "flags ");
- sep = "";
- for (; xlat->str; xlat++) {
- if ((flags & xlat->val) == xlat->val) {
- sprintf(outstr + strlen(outstr),
- "%s%s", sep, xlat->str);
- sep = "|";
- flags &= ~xlat->val;
- }
- }
- if (flags)
- sprintf(outstr + strlen(outstr),
- "%s%#x", sep, flags);
- return outstr;
-}
-
/*
* low bits of the open(2) flags define access mode,
* other bits are real flags.
@@ -356,7 +334,8 @@
case F_GETFD:
if (tcp->u_rval == 0)
return 0;
- tcp->auxstr = sprintflags(fdflags, tcp->u_rval);
+ tcp->auxstr =
+ sprintflags("flags ", fdflags, tcp->u_rval);
return RVAL_HEX|RVAL_STR;
case F_GETFL:
tcp->auxstr = sprint_open_modes(tcp->u_rval);