Sync usage with man page.
[netbsd-mini2440.git] / gnu / usr.bin / fgrep / std.c
blobfb98fe614847d7c2e95b74841e2ee006fc6abcc4
1 /* std.c - compensate for a few missing library functions.
2 In the Public Domain; written by Mike Haertel. */
4 #include "std.h"
5 #include "unix.h"
7 #ifdef X_memmove
8 PTR
9 DEFUN(memmove, (d, s, n), PTR d AND PTRCONST s AND size_t n)
11 char *dd;
12 const char *ss;
14 dd = d;
15 ss = s;
16 if (dd > ss && dd < ss + n)
18 dd += n;
19 ss += n;
20 while (n--)
21 *--dd = *--ss;
23 else
24 while (n--)
25 *dd++ = *ss++;
26 return d;
28 #endif /* X_memmove */
30 #ifdef X_remove
31 #if defined(unix) || defined(__unix__)
32 int
33 DEFUN(remove, (filename), const char *filename)
35 extern int EXFUN(unlink, (const char *));
37 return unlink(filename);
39 #endif /* unix */
40 #endif /* X_strerror */
42 #ifdef X_strerror
43 #if defined(unix) || defined(__unix__)
44 char *
45 DEFUN(strerror, (errnum), int errnum)
47 extern int sys_nerr;
48 extern char *sys_errlist[];
50 if (errnum > 0 && errnum < sys_nerr)
51 return sys_errlist[errnum];
52 return "";
54 #endif /* unix */
55 #endif /* X_strerror */