utils.h 526 B

1234567891011121314151617181920212223
  1. #ifndef UTILS_H
  2. #define UTILS_H
  3. // http://c-faq.com/lib/randrange.html
  4. int randint(int N);
  5. // http://c-faq.com/lib/randrange.html
  6. // numbers in the range [M, N] could be generated with something like
  7. int randrange(int M, int N);
  8. /**
  9. * Display a repr of the given string.
  10. *
  11. * This converts most \n\r\v\f\t codes,
  12. * defaults to \xHH (hex value).
  13. */
  14. char *repr(const char *data);
  15. const char *strnstr(const char *source, int len, const char *needle);
  16. int rstrnstr(const char *buffer, int len, const char *find);
  17. #endif