summaryrefslogtreecommitdiffstats
path: root/src/ctx.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ctx.h')
-rw-r--r--src/ctx.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/ctx.h b/src/ctx.h
index b28a63c..be6e2af 100644
--- a/src/ctx.h
+++ b/src/ctx.h
@@ -8,14 +8,15 @@
#ifndef BFS_CTX_H
#define BFS_CTX_H
-#include "prelude.h"
#include "alloc.h"
#include "bftw.h"
#include "diag.h"
#include "expr.h"
#include "trie.h"
+
#include <stddef.h>
#include <sys/resource.h>
+#include <sys/types.h>
#include <time.h>
struct CFILE;
@@ -67,11 +68,18 @@ struct bfs_ctx {
bool status;
/** Whether to only return unique files (-unique). */
bool unique;
- /** Whether to print warnings (-warn/-nowarn). */
- bool warn;
/** Whether to only handle paths with xargs-safe characters (-X). */
bool xargs_safe;
+ /** Whether bfs was run interactively. */
+ bool interactive;
+ /** Whether to print warnings (-warn/-nowarn). */
+ bool warn;
+ /** Whether to report errors (-noerror). */
+ bool ignore_errors;
+ /** Whether any dangerous actions (-delete/-exec) are present. */
+ bool dangerous;
+
/** Color data. */
struct colors *colors;
/** The error that occurred parsing the color table, if any. */
@@ -98,6 +106,9 @@ struct bfs_ctx {
/** The number of files owned by the context. */
int nfiles;
+ /** The current file creation mask. */
+ mode_t umask;
+
/** The initial RLIMIT_NOFILE limits. */
struct rlimit orig_nofile;
/** The current RLIMIT_NOFILE limits. */
@@ -118,7 +129,7 @@ struct bfs_ctx *bfs_ctx_new(void);
/**
* Get the mount table.
*
- * @param ctx
+ * @ctx
* The bfs context.
* @return
* The cached mount table, or NULL on failure.
@@ -128,11 +139,11 @@ const struct bfs_mtab *bfs_ctx_mtab(const struct bfs_ctx *ctx);
/**
* Deduplicate an opened file.
*
- * @param ctx
+ * @ctx
* The bfs context.
- * @param cfile
+ * @cfile
* The opened file.
- * @param path
+ * @path
* The path to the opened file (or NULL for standard streams).
* @return
* If the same file was opened previously, that file is returned. If cfile is a new file,
@@ -143,7 +154,7 @@ struct CFILE *bfs_ctx_dedup(struct bfs_ctx *ctx, struct CFILE *cfile, const char
/**
* Flush any caches for consistency with external processes.
*
- * @param ctx
+ * @ctx
* The bfs context.
*/
void bfs_ctx_flush(const struct bfs_ctx *ctx);
@@ -151,9 +162,9 @@ void bfs_ctx_flush(const struct bfs_ctx *ctx);
/**
* Dump the parsed command line.
*
- * @param ctx
+ * @ctx
* The bfs context.
- * @param flag
+ * @flag
* The -D flag that triggered the dump.
*/
void bfs_ctx_dump(const struct bfs_ctx *ctx, enum debug_flags flag);
@@ -161,7 +172,7 @@ void bfs_ctx_dump(const struct bfs_ctx *ctx, enum debug_flags flag);
/**
* Free a bfs context.
*
- * @param ctx
+ * @ctx
* The context to free.
* @return
* 0 on success, -1 if any errors occurred.