Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
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.
 
 
 
 

77 lines
3.1 KiB

  1. #ifndef SCAN_H
  2. #define SCAN_H
  3. #include <sys/types.h>
  4. #ifdef __dietlibc__
  5. #include <sys/cdefs.h>
  6. #endif
  7. #ifndef __pure__
  8. #define __pure__
  9. #endif
  10. /* interpret src as ASCII decimal number, write number to dest and
  11. * return the number of bytes that were parsed */
  12. extern unsigned int scan_ulong(const char *src,unsigned long *dest);
  13. /* interpret src as ASCII hexadecimal number, write number to dest and
  14. * return the number of bytes that were parsed */
  15. extern unsigned int scan_xlong(const char *src,unsigned long *dest);
  16. /* interpret src as ASCII octal number, write number to dest and
  17. * return the number of bytes that were parsed */
  18. extern unsigned int scan_8long(const char *src,unsigned long *dest);
  19. /* interpret src as signed ASCII decimal number, write number to dest
  20. * and return the number of bytes that were parsed */
  21. extern unsigned int scan_long(const char *src,signed long *dest);
  22. extern unsigned int scan_longlong(const char *src,signed long long *dest);
  23. extern unsigned int scan_ulonglong(const char *src,unsigned long long *dest);
  24. extern unsigned int scan_xlonglong(const char *src,unsigned long long *dest);
  25. extern unsigned int scan_8longlong(const char *src,unsigned long long *dest);
  26. extern unsigned int scan_uint(const char *src,unsigned int *dest);
  27. extern unsigned int scan_xint(const char *src,unsigned int *dest);
  28. extern unsigned int scan_8int(const char *src,unsigned int *dest);
  29. extern unsigned int scan_int(const char *src,signed int *dest);
  30. extern unsigned int scan_ushort(const char *src,unsigned short *dest);
  31. extern unsigned int scan_xshort(const char *src,unsigned short *dest);
  32. extern unsigned int scan_8short(const char *src,unsigned short *dest);
  33. extern unsigned int scan_short(const char *src,signed short *dest);
  34. /* interpret src as double precision floating point number,
  35. * write number to dest and return the number of bytes that were parsed */
  36. extern unsigned int scan_double(const char *in, double *dest);
  37. /* if *src=='-', set *dest to -1 and return 1.
  38. * if *src=='+', set *dest to 1 and return 1.
  39. * otherwise set *dest to 1 return 0. */
  40. extern unsigned int scan_plusminus(const char *src,signed int *dest);
  41. /* return the highest integer n<=limit so that isspace(in[i]) for all 0<=i<=n */
  42. extern unsigned long scan_whitenskip(const char *in,unsigned long limit) __pure__;
  43. /* return the highest integer n<=limit so that !isspace(in[i]) for all 0<=i<=n */
  44. extern unsigned long scan_nonwhitenskip(const char *in,unsigned long limit) __pure__;
  45. /* return the highest integer n<=limit so that in[i] is element of
  46. * charset (ASCIIZ string) for all 0<=i<=n */
  47. extern unsigned long scan_charsetnskip(const char *in,const char *charset,unsigned long limit) __pure__;
  48. /* return the highest integer n<=limit so that in[i] is not element of
  49. * charset (ASCIIZ string) for all 0<=i<=n */
  50. extern unsigned long scan_noncharsetnskip(const char *in,const char *charset,unsigned long limit) __pure__;
  51. /* try to parse ASCII GMT date; does not understand time zones. */
  52. /* example dates:
  53. * "Sun, 06 Nov 1994 08:49:37 GMT"
  54. * "Sunday, 06-Nov-94 08:49:37 GMT"
  55. * "Sun Nov 6 08:49:37 1994"
  56. */
  57. extern unsigned int scan_httpdate(const char *in,time_t *t) __pure__;
  58. #endif