Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 712 → Rev 713

/uspace/trunk/libc/include/libc.h
32,6 → 32,11
#include <types.h>
 
 
#define __SYSCALL0(id) __syscall(id, 0, 0, 0)
#define __SYSCALL1(id, p1) __syscall(id, p1, 0, 0)
#define __SYSCALL2(id, p1, p2) __syscall(id, p1, p2, 0)
 
 
typedef enum {
SYS_CTL = 0,
SYS_IO = 1
/uspace/trunk/libc/include/unistd.h
34,5 → 34,6
#define NULL 0
 
extern ssize_t write(int fd, const void * buf, size_t count);
extern void _exit(int status);
 
#endif
/uspace/trunk/libc/generic/io.c
30,15 → 30,19
#include <unistd.h>
#include <stdio.h>
 
static char nl = '\n';
 
int puts(const char * str)
{
size_t count;
for (count = 0; str[count] != 0; count++);
if (write(1, (void * ) str, count) == count)
return 0;
else
return EOF;
if (write(1, (void * ) str, count) == count) {
if (write(1, &nl, 1) == 1)
return 0;
}
return EOF;
}
 
ssize_t write(int fd, const void * buf, size_t count)
/uspace/trunk/libc/generic/libc.c
29,8 → 29,13
#include <libc.h>
#include <unistd.h>
 
void _exit(int status) {
__SYSCALL0(SYS_CTL);
}
 
void __main(void) {
}
 
void __exit(void) {
_exit(0);
}