2727#endif /* RT_USING_POSIX_STDIO */
2828#include <posix/stdlib.h>
2929
30- #define DBG_TAG "armlibc.syscalls"
31- #define DBG_LVL DBG_INFO
30+ #define DBG_TAG "armlibc.syscalls"
31+ #define DBG_LVL DBG_INFO
3232#include <rtdbg.h>
3333
3434#ifdef __clang__
35- __asm(".global __use_no_semihosting\n\t" );
35+ __asm(".global __use_no_semihosting\n\t" );
3636#else
37- #pragma import(__use_no_semihosting_swi)
37+ #pragma import(__use_no_semihosting_swi)
3838#endif
3939
4040/* Standard IO device handles. */
41- #define STDIN 0
42- #define STDOUT 1
43- #define STDERR 2
41+ #define STDIN 0
42+ #define STDOUT 1
43+ #define STDERR 2
4444
4545/* Standard IO device name defines. */
46- const char __stdin_name [] = "STDIN" ;
46+ const char __stdin_name [] = "STDIN" ;
4747const char __stdout_name [] = "STDOUT" ;
4848const char __stderr_name [] = "STDERR" ;
4949
@@ -314,7 +314,8 @@ void _ttywrch(int ch)
314314rt_weak void _sys_exit (int return_code )
315315{
316316 __rt_libc_exit (return_code );
317- while (1 );
317+ while (1 )
318+ ;
318319}
319320
320321/**
@@ -339,6 +340,12 @@ long _sys_flen(FILEHANDLE fh)
339340#endif /* DFS_USING_POSIX */
340341}
341342
343+ /**
344+ * check whether the file is a terminal device.
345+ *
346+ * @param fh - file handle
347+ * @return 1 if is a terminal device, 0 if not
348+ */
342349int _sys_istty (FILEHANDLE fh )
343350{
344351 if ((STDIN <= fh ) && (fh <= STDERR ))
@@ -347,6 +354,12 @@ int _sys_istty(FILEHANDLE fh)
347354 return 0 ;
348355}
349356
357+ /**
358+ * remove a file
359+ *
360+ * @param filename - file name with path
361+ * @return 0 on success, -1 on failed
362+ */
350363int remove (const char * filename )
351364{
352365#ifdef DFS_USING_POSIX
@@ -360,6 +373,13 @@ int remove(const char *filename)
360373#ifdef __MICROLIB
361374#include <stdio.h>
362375
376+ /**
377+ * write a character to file
378+ *
379+ * @param c - character to write
380+ * @param fh - file handle
381+ * @return 1 on success, 0 on failed
382+ */
363383int fputc (int c , FILE * f )
364384{
365385#ifdef RT_USING_CONSOLE
@@ -370,6 +390,12 @@ int fputc(int c, FILE *f)
370390#endif /* RT_USING_CONSOLE */
371391}
372392
393+ /**
394+ * get a character from file
395+ *
396+ * @param fh - file handle
397+ * @return character read, or -1 on failed
398+ */
373399int fgetc (FILE * f )
374400{
375401#ifdef RT_USING_POSIX_STDIO
0 commit comments