charset.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. Unix SMB/Netbios implementation.
  3. Version 1.9.
  4. Character set handling
  5. Copyright (C) Andrew Tridgell 1992-1998
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. */
  18. #ifndef CHARSET_C
  19. extern char *dos_char_map;
  20. extern char *upper_char_map;
  21. extern char *lower_char_map;
  22. #ifdef toupper
  23. #undef toupper
  24. #endif
  25. #ifdef tolower
  26. #undef tolower
  27. #endif
  28. #ifdef isupper
  29. #undef isupper
  30. #endif
  31. #ifdef islower
  32. #undef islower
  33. #endif
  34. #ifdef isdoschar
  35. #undef isdoschar
  36. #endif
  37. #ifdef isspace
  38. #undef isspace
  39. #endif
  40. #define toupper(c) (upper_char_map[(c&0xff)] & 0xff)
  41. #define tolower(c) (lower_char_map[(c&0xff)] & 0xff)
  42. #define isupper(c) ((c&0xff) != tolower(c&0xff))
  43. #define islower(c) ((c&0xff) != toupper(c&0xff))
  44. #define isdoschar(c) (dos_char_map[(c&0xff)] != 0)
  45. #define isspace(c) ((c)==' ' || (c) == '\t')
  46. /* this is used to determine if a character is safe to use in
  47. something that may be put on a command line */
  48. #define issafe(c) (isalnum((c&0xff)) || strchr("-._",c))
  49. #endif /* !CHARSET_C */
  50. /* Dynamic codepage files defines. */
  51. /* Version id for dynamically loadable codepage files. */
  52. #define CODEPAGE_FILE_VERSION_ID 0x1
  53. /* Version 1 codepage file header size. */
  54. #define CODEPAGE_HEADER_SIZE 8
  55. /* Offsets for codepage file header entries. */
  56. #define CODEPAGE_VERSION_OFFSET 0
  57. #define CODEPAGE_CLIENT_CODEPAGE_OFFSET 2
  58. #define CODEPAGE_LENGTH_OFFSET 4