summaryrefslogtreecommitdiffstats
path: root/printf.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-01-27 15:27:56 -0500
committerTavian Barnes <tavianator@tavianator.com>2021-01-28 17:13:26 -0500
commit9bf75cee19b8d60d2b4f6260a8c2322cc8ca11db (patch)
tree0bc819909cb616b05ff013fbf1144dae7a13ec23 /printf.c
parent3fcd7b010fd4f477582997d688cc415f76e70411 (diff)
downloadbfs-9bf75cee19b8d60d2b4f6260a8c2322cc8ca11db.tar.xz
dir: New DIR* facade
Diffstat (limited to 'printf.c')
-rw-r--r--printf.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/printf.c b/printf.c
index 5f04ad3..4b18f04 100644
--- a/printf.c
+++ b/printf.c
@@ -18,6 +18,7 @@
#include "bftw.h"
#include "ctx.h"
#include "diag.h"
+#include "dir.h"
#include "dstring.h"
#include "mtab.h"
#include "pwcache.h"
@@ -309,7 +310,7 @@ static int bfs_printf_l(FILE *file, const struct bfs_printf *directive, const st
char *buf = NULL;
const char *target = "";
- if (ftwbuf->type == BFTW_LNK) {
+ if (ftwbuf->type == BFS_LNK) {
const struct bfs_stat *statbuf = bftw_cached_stat(ftwbuf, BFS_STAT_NOFOLLOW);
size_t len = statbuf ? statbuf->size : 0;
@@ -425,23 +426,23 @@ static int bfs_printf_u(FILE *file, const struct bfs_printf *directive, const st
return fprintf(file, directive->str, pwd->pw_name);
}
-static const char *bfs_printf_type(enum bftw_type type) {
+static const char *bfs_printf_type(enum bfs_type type) {
switch (type) {
- case BFTW_BLK:
+ case BFS_BLK:
return "b";
- case BFTW_CHR:
+ case BFS_CHR:
return "c";
- case BFTW_DIR:
+ case BFS_DIR:
return "d";
- case BFTW_DOOR:
+ case BFS_DOOR:
return "D";
- case BFTW_FIFO:
+ case BFS_FIFO:
return "p";
- case BFTW_LNK:
+ case BFS_LNK:
return "l";
- case BFTW_REG:
+ case BFS_REG:
return "f";
- case BFTW_SOCK:
+ case BFS_SOCK:
return "s";
default:
return "U";
@@ -458,7 +459,7 @@ static int bfs_printf_y(FILE *file, const struct bfs_printf *directive, const st
static int bfs_printf_Y(FILE *file, const struct bfs_printf *directive, const struct BFTW *ftwbuf) {
int error = 0;
- if (ftwbuf->type != BFTW_LNK) {
+ if (ftwbuf->type != BFS_LNK) {
return bfs_printf_y(file, directive, ftwbuf);
}
@@ -466,7 +467,7 @@ static int bfs_printf_Y(FILE *file, const struct bfs_printf *directive, const st
const struct bfs_stat *statbuf = bftw_stat(ftwbuf, BFS_STAT_FOLLOW);
if (statbuf) {
- type = bfs_printf_type(bftw_mode_to_type(statbuf->mode));
+ type = bfs_printf_type(bfs_mode_to_type(statbuf->mode));
} else {
switch (errno) {
case ELOOP: