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