summaryrefslogtreecommitdiffstats
path: root/app/stdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/stdio.c')
-rw-r--r--app/stdio.c93
1 files changed, 43 insertions, 50 deletions
diff --git a/app/stdio.c b/app/stdio.c
index b3fee4f..29c00a1 100644
--- a/app/stdio.c
+++ b/app/stdio.c
@@ -1,83 +1,76 @@
#include "project.h"
int
-_open (const char *name,
- int flags,
- int mode)
+_open (const char *name, int flags, int mode)
{
errno = ENOSYS;
return -1; /* Always fails */
-
-} /* _open () */
-
+
+} /* _open () */
+
int
-_close (int file)
+_close (int file)
{
errno = EBADF;
return -1; /* Always fails */
-
-} /* _close () */
-
+
+} /* _close () */
+
int
-_write (int file,
- char *buf,
- int nbytes)
+_write (int file, char *buf, int nbytes)
{
int ret;
- ret=usart1_write(buf,nbytes, 1);
-
- if (ret<0) {
- errno=-ret;
- return -1;
- }
+ ret = usart1_write (buf, nbytes, 1);
+
+ if (ret < 0)
+ {
+ errno = -ret;
+ return -1;
+ }
return ret;
-} /* _write () */
-
-
+} /* _write () */
+
+
int
-_read (int file,
- char *buf,
- int nbytes)
+_read (int file, char *buf, int nbytes)
{
-
- errno=-EAGAIN;
- return -1; /* EOF */
-
-} /* _read () */
-
+
+ errno = -EAGAIN;
+ return -1; /* EOF */
+
+} /* _read () */
+
#if 0
int
-_fstat (int file,
- struct stat *st)
+_fstat (int file, struct stat *st)
{
st->st_mode = S_IFCHR;
- return 0;
-
-} /* _fstat () */
+ return 0;
+
+} /* _fstat () */
#endif
-
+
int
-_lseek (int file,
- int offset,
- int whence)
+_lseek (int file, int offset, int whence)
{
- return 0;
-
-} /* _lseek () */
-
+ return 0;
+
+} /* _lseek () */
+
int
-isatty (int file)
+isatty (int file)
{
- return 1;
-
-} /* _isatty () */
+ return 1;
+
+} /* _isatty () */
-void stdio_drain(void)
+void
+stdio_drain (void)
{
-usart1_drain();
+ usart1_drain ();
}