aboutsummaryrefslogtreecommitdiff
path: root/jim-aio.c
diff options
context:
space:
mode:
Diffstat (limited to 'jim-aio.c')
-rw-r--r--jim-aio.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/jim-aio.c b/jim-aio.c
index a2b81f5..f43eaac 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -1666,6 +1666,28 @@ static int aio_cmd_buffering(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK;
}
+static int aio_cmd_translation(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+{
+ enum {OPT_BINARY, OPT_TEXT};
+ static const char * const options[] = {
+ "binary",
+ "text",
+ NULL
+ };
+ int opt;
+
+ if (Jim_GetEnum(interp, argv[0], options, &opt, NULL, JIM_ERRMSG) != JIM_OK) {
+ return JIM_ERR;
+ }
+#if defined(Jim_SetMode)
+ else {
+ AioFile *af = Jim_CmdPrivData(interp);
+ Jim_SetMode(af->fd, opt == OPT_BINARY ? O_BINARY : O_TEXT);
+ }
+#endif
+ return JIM_OK;
+}
+
static int aio_cmd_readsize(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
AioFile *af = Jim_CmdPrivData(interp);
@@ -2182,6 +2204,13 @@ static const jim_subcmd_type aio_command_table[] = {
2,
/* Description: Sets or returns write buffering */
},
+ { "translation",
+ "binary|text",
+ aio_cmd_translation,
+ 1,
+ 1,
+ /* Description: Sets output translation mode */
+ },
{ "readsize",
"?size?",
aio_cmd_readsize,