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 "stddef.h"
  16. #include "bits/string.h"
  17. /* *** FROM ctype.h *** */
  18. #define isdigit(c) ((c & 0x04) != 0)
  19. #define islower(c) ((c & 0x02) != 0)
  20. //#define isspace(c) ((c & 0x20) != 0)
  21. #define isupper(c) ((c & 0x01) != 0)
  22. static inline unsigned char tolower(unsigned char c)
  23. {
  24. if (isupper(c))
  25. c -= 'A'-'a';
  26. return c;
  27. }
  28. static inline unsigned char toupper(unsigned char c)
  29. {
  30. if (islower(c))
  31. c -= 'a'-'A';
  32. return c;
  33. }
  34. /* *** FROM string.h *** */
  35. int strnicmp(const char *s1, const char *s2, size_t len);
  36. char * strcpy(char * dest,const char *src);
  37. char * strncpy(char * dest,const char *src,size_t count);
  38. char * strcat(char * dest, const char * src);
  39. char * strncat(char *dest, const char *src, size_t count);
  40. int strcmp(const char * cs,const char * ct);
  41. int strncmp(const char * cs,const char * ct,size_t count);
  42. char * strchr(const char * s, int c);
  43. char * strrchr(const char * s, int c);
  44. size_t strlen(const char * s);
  45. size_t strnlen(const char * s, size_t count);
  46. size_t strspn(const char *s, const char *accept);
  47. char * strpbrk(const char * cs,const char * ct);
  48. char * strtok(char * s,const char * ct);
  49. char * strsep(char **s, const char *ct);
  50. void * memset(void * s,int c,size_t count);
  51. char * bcopy(const char * src, char * dest, int 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 */