Skip to content

Commit f5f6a29

Browse files
committed
COMMON: fix printing chr(0) into a file or network interface #105
1 parent 7b2d0a8 commit f5f6a29

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2023-01-09 (12.26)
2+
COMMON: fix printing chr(0) into a file or network interface
3+
14
2022-11-13 (12.25)
25
ANDROID: Updated file manager web UI:
36
- Implemented delete command

configure.ac

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dnl This program is distributed under the terms of the GPL v2.0
77
dnl Download the GNU Public License (GPL) from www.gnu.org
88
dnl
99

10-
AC_INIT([smallbasic], [12.25])
10+
AC_INIT([smallbasic], [12.26])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET
@@ -17,7 +17,6 @@ AM_MAINTAINER_MODE
1717

1818
AC_PROG_CXX
1919
AM_PROG_CC_C_O
20-
AC_HEADER_STDC
2120
AC_PROG_RANLIB
2221
PKG_PROG_PKG_CONFIG
2322

src/common/proc.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,25 @@ void pv_write_str(char *str, var_t *vp) {
165165
}
166166
}
167167

168+
void pv_write_str_var(var_t *var, int method, intptr_t handle) {
169+
switch (method) {
170+
case PV_FILE:
171+
dev_fwrite((int)handle, (byte *)var->v.p.ptr, var->v.p.length - 1);
172+
break;
173+
case PV_LOG:
174+
lwrite(var->v.p.ptr);
175+
break;
176+
case PV_STRING:
177+
pv_write_str(var->v.p.ptr, (var_t *)handle);
178+
break;
179+
case PV_NET:
180+
net_send((socket_t)handle, (const char *)var->v.p.ptr, var->v.p.length - 1);
181+
break;
182+
default:
183+
dev_print(var->v.p.ptr);
184+
}
185+
}
186+
168187
/*
169188
* Write string to output device
170189
*/
@@ -206,7 +225,7 @@ void pv_writevar(var_t *var, int method, intptr_t handle) {
206225
pv_write(tmpsb, method, handle);
207226
break;
208227
case V_STR:
209-
pv_write(var->v.p.ptr, method, handle);
228+
pv_write_str_var(var, method, handle);
210229
break;
211230
case V_ARRAY:
212231
case V_MAP:

0 commit comments

Comments
 (0)