aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGavin Howard <gavin@yzena.com>2021-07-23 13:02:33 -0600
committerGavin Howard <gavin@yzena.com>2021-07-23 13:02:33 -0600
commitde7f0b83b620958cd325f95a472efda2a1912092 (patch)
tree78ca66fab6c53beae33a219fb6d794b9d0162ae1 /include
parent7efba6d83b9605e4f932d8a3e41ac878be8714eb (diff)
downloadplatform_external_bc-de7f0b83b620958cd325f95a472efda2a1912092.tar.gz
platform_external_bc-de7f0b83b620958cd325f95a472efda2a1912092.tar.bz2
platform_external_bc-de7f0b83b620958cd325f95a472efda2a1912092.zip
Add the check for binary files back in
This does not add it in as it was; it only checks for nul bytes. This is to prevent problems treating the data as a string. Signed-off-by: Gavin Howard <gavin@yzena.com>
Diffstat (limited to 'include')
-rw-r--r--include/read.h2
-rw-r--r--include/status.h3
2 files changed, 4 insertions, 1 deletions
diff --git a/include/read.h b/include/read.h
index 0a685657..2ebb456e 100644
--- a/include/read.h
+++ b/include/read.h
@@ -46,7 +46,7 @@
* @param c The character to test.
* @return True if @a c is an invalid char.
*/
-#define BC_READ_BIN_CHAR(c) (((c) < ' ' && !isspace((c))) || ((uchar) c) > '~')
+#define BC_READ_BIN_CHAR(c) (!(c))
/**
* Reads a line from stdin after printing prompt, if desired.
diff --git a/include/status.h b/include/status.h
index 0750ad18..27039394 100644
--- a/include/status.h
+++ b/include/status.h
@@ -306,6 +306,9 @@ typedef enum BcErr {
/// File error, such as permissions or file does not exist.
BC_ERR_FATAL_FILE_ERR,
+ /// File is binary, not text, error.
+ BC_ERR_FATAL_BIN_FILE,
+
/// Attempted to read a directory as a file error.
BC_ERR_FATAL_PATH_DIR,