strerror.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* Turning errno values into English error messages.
  2. Copyright (C) 1985, 86, 87, 88, 93, 94, 95, 2000, 2001, 2006 Free Software Foundation, Inc.
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public License
  5. as published by the Free Software Foundation; either version 3 of
  6. the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful, but
  8. WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with this library; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  14. 02110-1301 USA
  15. */
  16. char *
  17. strerror (int errnum)
  18. {
  19. extern char *sys_errlist[];
  20. extern int sys_nerr;
  21. if (errnum >= 0 && errnum < sys_nerr)
  22. return sys_errlist[errnum];
  23. return (char *) "Unknown error";
  24. }
  25. /*
  26. Local Variables:
  27. c-file-style: "gnu"
  28. End:
  29. */