home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / GNU / FGRE11AS.ZIP / STD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-22  |  1.5 KB  |  70 lines

  1. /* std.c - compensate for a few missing library functions.
  2.    In the Public Domain; written by Mike Haertel. */
  3.  
  4. /* MS-DOS port (c) 1990 by Thorsten Ohl, ohl@gnu.ai.mit.edu
  5.    This port is also distributed under the terms of the
  6.    GNU General Public License as published by the
  7.    Free Software Foundation.
  8.  
  9.    Please note that this file is not identical to the
  10.    original GNU release, you should have received this
  11.    code as patch to the official release.
  12.  
  13.    $Header: e:/gnu/fgrep/RCS/std.c 1.1.0.2 90/09/24 00:37:55 tho Exp $
  14.  */
  15.  
  16. #include "std.h"
  17. #ifndef MSDOS
  18. #include "unix.h"
  19. #endif /* MSDOS */
  20.  
  21. #ifdef X_memmove
  22. PTR
  23. DEFUN(memmove, (d, s, n), PTR d AND PTRCONST s AND size_t n)
  24. {
  25.   char *dd;
  26.   const char *ss;
  27.  
  28.   dd = d;
  29.   ss = s;
  30.   if (dd > ss && dd < ss + n)
  31.     {
  32.       dd += n;
  33.       ss += n;
  34.       while (n--)
  35.     *--dd = *--ss;
  36.     }
  37.   else
  38.     while (n--)
  39.       *dd++ = *ss++;
  40.   return d;
  41. }
  42. #endif /* X_memmove */
  43.  
  44. #ifdef X_remove
  45. #if defined(unix) || defined(__unix__)
  46. int
  47. DEFUN(remove, (filename), const char *filename)
  48. {
  49.   extern int EXFUN(unlink, (const char *));
  50.  
  51.   return unlink(filename);
  52. }
  53. #endif /* unix */
  54. #endif /* X_strerror */
  55.  
  56. #ifdef X_strerror
  57. #if defined(unix) || defined(__unix__)
  58. char *
  59. DEFUN(strerror, (errnum), int errnum)
  60. {
  61.   extern int sys_nerr;
  62.   extern char *sys_errlist[];
  63.  
  64.   if (errnum > 0 && errnum < sys_nerr)
  65.     return sys_errlist[errnum];
  66.   return "";
  67. }
  68. #endif /* unix */
  69. #endif /* X_strerror */
  70.