summaryrefslogtreecommitdiff
path: root/ports/posix/src/stream_stdio.c
blob: e9b6f0970a7f74d0c6a2091a42e49f920c9ba0f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <stdlib.h>
#include "stream_stdio.h"
#include "stream.h"
#include "main.h"

int stdio_init(void **vptr, void *sptr)
{
    /* TODO */
    /* p_stream_t *stream = (p_stream_t*)sptr; */
    /* int num_files = BUS_DEVICE_LIMIT; */
    /* int x; */
    /* char fname_base[] = "devio_", fname[10]; */
    
    return 0;
}

int stdio_read(uint8_t* buf, size_t count, void **vptr, void *sptr)
{
    int x;
    for (x = 0; x < count; x++) {
	scanf("%c", &buf[x]);
    }
    return 0;
}

int stdio_write(uint8_t* buf, size_t count, void **vptr, void *sptr)
{
    int x;
    for (x = 0; x < count; x++) {
	printf("%x", buf[x]);
    }
    printf("\n");
    return 0;
}