diff options
author | harti <harti@FreeBSD.org> | 2005-03-11 13:24:08 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-03-11 13:24:08 +0000 |
commit | 559d1826e4ca2d77a3ca26ec198b47e71b73dc5d (patch) | |
tree | d7a72118acaac8f01559518c6d55a24514af1049 /usr.bin/make/util.c | |
parent | 1fbc0d2e5290e51ca5821422869cb7282527a815 (diff) | |
download | FreeBSD-src-559d1826e4ca2d77a3ca26ec198b47e71b73dc5d.zip FreeBSD-src-559d1826e4ca2d77a3ca26ec198b47e71b73dc5d.tar.gz |
Simplify the print routines by using LST_FOREACH instead of Lst_ForEach
and inlining the small printing utility functions.
Create a function that can be used to produce printable representations
of flag words.
Diffstat (limited to 'usr.bin/make/util.c')
-rw-r--r-- | usr.bin/make/util.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/usr.bin/make/util.c b/usr.bin/make/util.c index e0dbfdc..70e814a 100644 --- a/usr.bin/make/util.c +++ b/usr.bin/make/util.c @@ -292,3 +292,23 @@ eunlink(const char *file) return (unlink(file)); } +/* + * Convert a flag word to a printable thing and print it + */ +void +print_flags(FILE *fp, const struct flag2str *tab, u_int flags) +{ + int first = 1; + + fprintf(fp, "("); + while (tab->str != NULL) { + if (flags & tab->flag) { + if (!first) + fprintf(fp, "|"); + first = 0; + fprintf(fp, "%s", tab->str); + } + tab++; + } + fprintf(fp, ")"); +} |