OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [misc/] [aliases.c] - Blame information for rev 1778

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
2
 * This file is part of the Linux-8086 C library and is distributed
3
 * under the GNU Library General Public License.
4
 */
5
#include <string.h>
6
#include <sys/types.h>
7
 
8
#ifdef L_abs
9
int
10
abs(arg1)
11
int arg1;
12
{
13
   return arg1>0?arg1:-arg1;
14
}
15
#endif
16
 
17
#ifdef L_raise
18
int
19
raise(signo)
20
int signo;
21
{
22
   return kill(getpid(), signo);
23
}
24
#endif
25
 
26
#ifdef L_bcopy
27
#undef bcopy
28
void
29
bcopy(src, dest, len)
30
__const void * src;
31
void *dest;
32
int len;
33
{
34
/*   (void) memcpy(dest, src, len); */
35
  while (len--) *(char *)(dest++) = *(char *)(src++);
36
}
37
#endif
38
 
39
#ifdef L_bzero
40
#undef bzero
41
void
42
bzero(dest, len)
43
void *dest;
44
int len;
45
{
46
  /* (void) memset(dest, '\0', len); */
47
  while (len--) *(char *)(dest++) = '\0';
48
}
49
#endif
50
 
51
#ifdef L_bcmp
52
#undef bcmp
53
int
54
bcmp(dest, src, len)
55
__const void * src, *dest;
56
int len;
57
{
58
   return memcmp(dest, src, len);
59
}
60
#endif
61
 
62
#ifdef L_index
63
#undef index
64
char *
65
index(src, chr)
66
__const char *src;
67
int chr;
68
{
69
   return strchr(src, chr);
70
}
71
#endif
72
 
73
#ifdef L_rindex
74
#undef rindex
75
char *
76
rindex(src, chr)
77
__const char *src;
78
int chr;
79
{
80
   return strrchr(src, chr);
81
}
82
#endif
83
 
84
#ifdef L_remove
85
#include <errno.h>
86
 
87
int
88
remove(src)
89
__const char *src;
90
{
91
   extern int errno;
92
   int er = errno;
93
   int rv = unlink(src);
94
   if( rv < 0 && errno == EISDIR )
95
      rv = rmdir(src);
96
   if( rv >= 0 ) errno = er;
97
   return rv;
98
}
99
#endif
100
 
101
#ifdef L_creat
102
#include <fcntl.h>
103
 
104
int
105
creat(file, mode)
106
__const char * file;
107
mode_t mode;
108
{
109
   return open(file, O_TRUNC|O_CREAT|O_WRONLY, mode);
110
}
111
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.