aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/syscalls.c
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-09-27 00:40:44 -0400
committerMarti Bolivar <mbolivar@mit.edu>2010-09-27 00:40:44 -0400
commit753f89de354eff212d84f3f2aff41146865da342 (patch)
tree095e2183ce956bac028083d056c9c4b7ee8a8d84 /libmaple/syscalls.c
parent849bc0f8f6abf42567a152cf6e01bf7349902aac (diff)
downloadlibrambutan-753f89de354eff212d84f3f2aff41146865da342.tar.gz
librambutan-753f89de354eff212d84f3f2aff41146865da342.zip
whitespace cleanups
Diffstat (limited to 'libmaple/syscalls.c')
-rw-r--r--libmaple/syscalls.c54
1 files changed, 18 insertions, 36 deletions
diff --git a/libmaple/syscalls.c b/libmaple/syscalls.c
index ec271a2..5611ce5 100644
--- a/libmaple/syscalls.c
+++ b/libmaple/syscalls.c
@@ -1,4 +1,4 @@
-/* *****************************************************************************
+/******************************************************************************
* The MIT License
*
* Copyright (c) 2010 Perry Hung.
@@ -20,7 +20,7 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
- * ****************************************************************************/
+ *****************************************************************************/
#include "libmaple.h"
#include <sys/stat.h>
@@ -35,10 +35,7 @@ void uart_send(const char*str);
* RAM. We just increment a pointer in what's
* left of memory on the board.
*/
-caddr_t
-_sbrk(nbytes)
-int nbytes;
-{
+caddr_t _sbrk(int nbytes) {
static caddr_t heap_ptr = NULL;
caddr_t base;
@@ -56,62 +53,52 @@ int nbytes;
}
}
-int _open(const char *path, int flags, ...)
-{
+int _open(const char *path, int flags, ...) {
return 1;
}
-int _close(int fd)
-{
+int _close(int fd) {
return 0;
}
-int _fstat(int fd, struct stat *st)
-{
+int _fstat(int fd, struct stat *st) {
st->st_mode = S_IFCHR;
return 0;
}
-int _isatty(int fd)
-{
+int _isatty(int fd) {
return 1;
}
-int isatty(int fd)
-{
+int isatty(int fd) {
return 1;
}
-int _lseek(int fd, off_t pos, int whence)
-{
+int _lseek(int fd, off_t pos, int whence) {
return -1;
}
-unsigned char getch(void)
-{
+unsigned char getch(void) {
// while (!(USART2->SR & USART_FLAG_RXNE));
// return USART2->DR;
return 0;
}
-int _read(int fd, char *buf, size_t cnt)
-{
+int _read(int fd, char *buf, size_t cnt) {
*buf = getch();
return 1;
}
-void putch(unsigned char c)
-{
+void putch(unsigned char c) {
// if (c == '\n') putch('\r');
// while (!(USART2->SR & USART_FLAG_TXE));
// USART2->DR = c;
}
-void cgets(char *s, int bufsize)
-{
+void cgets(char *s, int bufsize) {
char *p;
int c;
int i;
@@ -123,11 +110,9 @@ void cgets(char *s, int bufsize)
p = s;
- for (p = s; p < s + bufsize-1;)
- {
+ for (p = s; p < s + bufsize-1;) {
c = getch();
- switch (c)
- {
+ switch (c) {
case '\r' :
case '\n' :
putch('\r');
@@ -136,8 +121,7 @@ void cgets(char *s, int bufsize)
return;
case '\b' :
- if (p > s)
- {
+ if (p > s) {
*p-- = 0;
putch('\b');
putch(' ');
@@ -154,8 +138,7 @@ void cgets(char *s, int bufsize)
return;
}
-int _write(int fd, const char *buf, size_t cnt)
-{
+int _write(int fd, const char *buf, size_t cnt) {
int i;
// uart_send("_write\r\n");
@@ -166,8 +149,7 @@ int _write(int fd, const char *buf, size_t cnt)
}
/* Override fgets() in newlib with a version that does line editing */
-char *fgets(char *s, int bufsize, void *f)
-{
+char *fgets(char *s, int bufsize, void *f) {
// uart_send("fgets\r\n");
cgets(s, bufsize);
return s;