From 3accd8fcee87299b51de0abde3c8d9c83368d871 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 7 Jun 2015 01:34:12 +0100 Subject: tidyup --- app/stdio.c | 93 ++++++++++++++++++++++++++++--------------------------------- 1 file changed, 43 insertions(+), 50 deletions(-) (limited to 'app/stdio.c') 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 (); } -- cgit v1.2.3