You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

string.h 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (C) 1991, 1992 Linus Torvalds
  3. * Copyright (C) 2004 Tobias Lorenz
  4. *
  5. * string handling functions
  6. * based on linux/include/linux/ctype.h
  7. * and linux/include/linux/string.h
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #ifndef ETHERBOOT_STRING_H
  14. #define ETHERBOOT_STRING_H
  15. #include "bits/string.h"
  16. /* *** FROM ctype.h *** */
  17. #define isdigit(c) ((c & 0x04) != 0)
  18. #define islower(c) ((c & 0x02) != 0)
  19. //#define isspace(c) ((c & 0x20) != 0)
  20. #define isupper(c) ((c & 0x01) != 0)
  21. static inline unsigned char tolower(unsigned char c)
  22. {
  23. if (isupper(c))
  24. c -= 'A'-'a';
  25. return c;
  26. }
  27. static inline unsigned char toupper(unsigned char c)
  28. {
  29. if (islower(c))
  30. c -= 'a'-'A';
  31. return c;
  32. }
  33. /* *** FROM string.h *** */
  34. int strnicmp(const char *s1, const char *s2, size_t len);
  35. char * strcpy(char * dest,const char *src);
  36. char * strncpy(char * dest,const char *src,size_t count);
  37. char * strcat(char * dest, const char * src);
  38. char * strncat(char *dest, const char *src, size_t count);
  39. int strcmp(const char * cs,const char * ct);
  40. int strncmp(const char * cs,const char * ct,size_t count);
  41. char * strchr(const char * s, int c);
  42. char * strrchr(const char * s, int c);
  43. size_t strlen(const char * s);
  44. size_t strnlen(const char * s, size_t count);
  45. size_t strspn(const char *s, const char *accept);
  46. char * strpbrk(const char * cs,const char * ct);
  47. char * strtok(char * s,const char * ct);
  48. char * strsep(char **s, const char *ct);
  49. void * memset(void * s,int c,size_t count);
  50. char * bcopy(const char * src, char * dest, int count);
  51. void * memcpy(void * dest,const void *src,size_t count);
  52. void * memmove(void * dest,const void *src,size_t count);
  53. int memcmp(const void * cs,const void * ct,size_t count);
  54. void * memscan(void * addr, int c, size_t size);
  55. char * strstr(const char * s1,const char * s2);
  56. void * memchr(const void *s, int c, size_t n);
  57. #endif /* ETHERBOOT_STRING */