Commit | Line | Data |
7b2b351e |
1 | /* Beginning of modification history */ |
2 | /* Written 02-01-02 by Nick Ing-Simmons (nick@ing-simmons.net) */ |
a5f25d7a |
3 | /* Modified 02-03-27 by Paul Green (Paul.Green@stratus.com) to |
4 | add socketpair() dummy. */ |
0ee4199b |
5 | /* Modified 02-04-24 by Paul Green (Paul.Green@stratus.com) to |
6 | have pow(0,0) return 1, avoiding c-1471. */ |
7b2b351e |
7 | /* End of modification history */ |
8 | |
a5f25d7a |
9 | #include <errno.h> |
7b2b351e |
10 | #include <fcntl.h> |
11 | #include <sys/types.h> |
12 | #include <unistd.h> |
13 | |
a5f25d7a |
14 | /* VOS doesn't supply a truncate function, so we build one up |
15 | from the available POSIX functions. */ |
16 | |
7b2b351e |
17 | int |
18 | truncate(const char *path, off_t len) |
19 | { |
20 | int fd = open(path,O_WRONLY); |
21 | int code = -1; |
22 | if (fd >= 0) { |
23 | code = ftruncate(fd,len); |
24 | close(fd); |
25 | } |
26 | return code; |
27 | } |
a5f25d7a |
28 | |
29 | /* VOS doesn't implement AF_UNIX (AF_LOCAL) style sockets, and |
30 | the perl emulation of them hangs on VOS (due to stcp-1257), |
31 | so we supply this version that always fails. */ |
32 | |
33 | int |
34 | socketpair (int family, int type, int protocol, int fd[2]) { |
35 | fd[0] = 0; |
36 | fd[1] = 0; |
37 | errno = ENOSYS; |
38 | return -1; |
39 | } |
0ee4199b |
40 | |
41 | /* Supply a private version of the power function that returns 1 |
42 | for x**0. This avoids c-1471. Abigail's Japh tests depend |
43 | on this fix. We leave all the other cases to the VOS C |
44 | runtime. */ |
45 | |
46 | double s_crt_pow(double *x, double *y); |
47 | |
48 | double pow(x,y) |
49 | double x, y; |
50 | { |
51 | if (y == 0e0) /* c-1471 */ |
52 | { |
53 | errno = EDOM; |
54 | return (1e0); |
55 | } |
56 | |
57 | return(s_crt_pow(&x,&y)); |
58 | } |