/branches/0.7/src/lib/libc/isalpha.c

http://ailes.googlecode.com/ · C · 39 lines · 6 code · 5 blank · 28 comment · 2 complexity · 9999bcc4f85b1885f22ac88747a542af MD5 · raw file

  1. //
  2. // Copyright (C) 1998-2007 J. Andrew McLaughlin
  3. //
  4. // This library is free software; you can redistribute it and/or modify it
  5. // under the terms of the GNU Lesser General Public License as published by
  6. // the Free Software Foundation; either version 2.1 of the License, or (at
  7. // your option) any later version.
  8. //
  9. // This library is distributed in the hope that it will be useful, but
  10. // WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
  12. // General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public License
  15. // along with this library; if not, write to the Free Software Foundation,
  16. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. //
  18. // isalpha.c
  19. //
  20. // This is the standard "isalpha" function, as found in standard C libraries
  21. // These functions check whether c, which must have the value of an
  22. // unsigned char or EOF, falls into a certain character class according
  23. // to the current locale. Ok, right now they don't look at the current
  24. // locale.
  25. #include <ctype.h>
  26. int isalpha(int c)
  27. {
  28. // checks for an alphabetic character; in the standard "C" locale, it is
  29. // equivalent to (isupper(c) || islower(c)). In some locales, there may
  30. // be additional characters for which isalpha() is true -- letters which
  31. // are neither upper case nor lower case.
  32. return (((c >= 'a') && (c <= 'z')) ||
  33. ((c >= 'A') && (c <= 'Z')));
  34. }