strerror.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but 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 02110-1301 USA
  14. */
  15. char *
  16. strerror (int errnum)
  17. {
  18. extern char *sys_errlist[];
  19. extern int sys_nerr;
  20. if (errnum >= 0 && errnum < sys_nerr)
  21. return sys_errlist[errnum];
  22. return (char *) "Unknown error";
  23. }
  24. /*
  25. Local Variables:
  26. c-file-style: "gnu"
  27. End:
  28. */