~ubuntu-branches/ubuntu/trusty/slof/trusty

« back to all changes in this revision

Viewing changes to clients/takeover/main.c

  • Committer: Package Import Robot
  • Author(s): Logan Rosen
  • Date: 2013-12-11 00:00:46 UTC
  • mfrom: (2.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20131211000046-1199k14mvmd37ts6
Tags: 20131015+dfsg-1ubuntu1
* Merge from Debian unstable. Remaining changes:
  - Since Ubuntu always builds Architecture: all packages on i386, build
    using a cross-compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
# define UNUSED
37
37
#endif
38
38
 
39
 
 
40
 
/*
41
 
 * These functions are just dummy implemented to resolve symbols for linking to other objects
42
 
 */
43
 
 
44
 
int
45
 
open(const char *name UNUSED, int flags UNUSED)
46
 
{
47
 
        return 0;
48
 
}
49
 
 
50
 
int
51
 
close(int fd UNUSED)
52
 
{
53
 
        return 0;
54
 
}
55
 
 
56
 
ssize_t
57
 
read(int fd UNUSED, void *buf UNUSED, size_t count UNUSED)
58
 
{
59
 
        return 0;
60
 
}
61
 
 
62
 
int
63
 
ioctl(int fd UNUSED, int req UNUSED, void *data UNUSED)
64
 
{
65
 
        return 0;
66
 
}
67
 
 
68
 
/*
69
 
 * These functions are required for using libc.a
70
 
 */
71
 
ssize_t
72
 
write(int fd, const void *buf, size_t len)
73
 
{
74
 
        char  dst_buf[512];
75
 
        char *dst_buf_ptr;
76
 
        char *src_buf_ptr;
77
 
        int i;
78
 
 
79
 
        src_buf_ptr = (char *) buf;
80
 
        if (fd == 1 || fd == 2)
81
 
        {
82
 
                dst_buf_ptr = &dst_buf[0];
83
 
                for (i = 0; i < len && i < 256; i++)
84
 
                {
85
 
                        *dst_buf_ptr++ = *src_buf_ptr++;
86
 
                        if (src_buf_ptr[-1] == '\n')
87
 
                                *dst_buf_ptr++ = '\r';
88
 
                }
89
 
                len = dst_buf_ptr - &dst_buf[0];
90
 
                src_buf_ptr = &dst_buf[0];
91
 
        }
92
 
 
93
 
        if(fd < 0 || fd >= FILEIO_MAX
94
 
        || fd_array[fd].type == FILEIO_TYPE_EMPTY
95
 
        || fd_array[fd].write == 0)
96
 
                return -1;
97
 
 
98
 
        return fd_array[fd].write(&fd_array[fd], src_buf_ptr, len);
99
 
}
100
 
 
101
39
void *
102
40
sbrk(int incr)
103
41
{