You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/08/15 23:01:49 UTC
[incubator-nuttx] branch master updated: libc/fopen: add open for
text (translated) access support
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 82caa78 libc/fopen: add open for text (translated) access support
82caa78 is described below
commit 82caa786ccb9275fb829a3084646c94b8b82059c
Author: chao.an <an...@xiaomi.com>
AuthorDate: Tue Jul 28 10:13:00 2020 +0800
libc/fopen: add open for text (translated) access support
Change-Id: I5bb4e01a91a0f8ea82437cdcba191c484aa1b77f
Signed-off-by: chao.an <an...@xiaomi.com>
---
libs/libc/stdio/lib_fopen.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/libs/libc/stdio/lib_fopen.c b/libs/libc/stdio/lib_fopen.c
index aea1edf..e73743b 100644
--- a/libs/libc/stdio/lib_fopen.c
+++ b/libs/libc/stdio/lib_fopen.c
@@ -49,6 +49,7 @@
* and writing) */
#define MODE_B (1 << 4) /* Bit 4: "{r|w|a|x|+}b" Binary mode */
#define MODE_X (1 << 5) /* Bit 5: "{r|w|a|b|+}x" Open exclusive mode */
+#define MODE_T (1 << 6) /* Bit 6: "{r|w|a|+}t" Text mode */
#define MODE_NONE 0 /* No access mode determined */
#define MODE_MASK (MODE_R | MODE_W | MODE_A)
@@ -285,6 +286,22 @@ int lib_mode2oflags(FAR const char *mode)
}
break;
+ /* Open for text (translated) access ("{r|w|a|x|+}t") */
+
+ case 't' :
+ if ((state & MODE_MASK) != MODE_NONE)
+ {
+ /* The file is opened in text mode */
+
+ oflags |= O_TEXT;
+ state |= MODE_T;
+ }
+ else
+ {
+ goto errout;
+ }
+ break;
+
/* Unrecognized or unsupported mode */
default: