Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

string.h 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 __attribute__ (( pure )) strcmp(const char * cs,const char * ct);
  41. int __attribute__ (( pure )) strncmp(const char * cs,const char * ct,
  42. size_t count);
  43. char * strchr(const char * s, int c);
  44. char * strrchr(const char * s, int c);
  45. size_t strlen(const char * s);
  46. size_t strnlen(const char * s, size_t count);
  47. size_t strspn(const char *s, const char *accept);
  48. char * strpbrk(const char * cs,const char * ct);
  49. char * strtok(char * s,const char * ct);
  50. char * strsep(char **s, const char *ct);
  51. void * memset(void * s,int c,size_t count);
  52. char * bcopy(const char * src, char * dest, int count);
  53. void * memmove(void * dest,const void *src,size_t count);
  54. int __attribute__ (( pure )) memcmp(const void * cs,const void * ct,
  55. size_t count);
  56. void * memscan(void * addr, int c, size_t size);
  57. char * strstr(const char * s1,const char * s2);
  58. void * memchr(const void *s, int c, size_t n);
  59. char * strdup(const char *s);
  60. extern const char * strerror ( int errno );
  61. #endif /* ETHERBOOT_STRING */