Tor  0.4.7.0-alpha-dev
Functions
parse_int.h File Reference

Header for parse_int.c. More...

#include "lib/cc/torint.h"

Go to the source code of this file.

Functions

long tor_parse_long (const char *s, int base, long min, long max, int *ok, char **next)
 
unsigned long tor_parse_ulong (const char *s, int base, unsigned long min, unsigned long max, int *ok, char **next)
 
double tor_parse_double (const char *s, double min, double max, int *ok, char **next)
 
uint64_t tor_parse_uint64 (const char *s, int base, uint64_t min, uint64_t max, int *ok, char **next)
 

Detailed Description

Header for parse_int.c.

Definition in file parse_int.h.

Function Documentation

◆ tor_parse_double()

double tor_parse_double ( const char *  s,
double  min,
double  max,
int *  ok,
char **  next 
)

As tor_parse_long(), but return a double.

Definition at line 97 of file parse_int.c.

◆ tor_parse_long()

long tor_parse_long ( const char *  s,
int  base,
long  min,
long  max,
int *  ok,
char **  next 
)

Extract a long from the start of s, in the given numeric base. If base is 0, s is parsed as a decimal, octal, or hex number in the syntax of a C integer literal. If there is unconverted data and next is provided, set *next to the first unconverted character. An error has occurred if no characters are converted; or if there are unconverted characters and next is NULL; or if the parsed value is not between min and max. When no error occurs, return the parsed value and set *ok (if provided) to

  1. When an error occurs, return 0 and set *ok (if provided) to 0.

Definition at line 59 of file parse_int.c.

Referenced by cmp_int_strings_(), dirvote_get_intermediate_param_value(), extract_param_buggy(), handle_control_protocolinfo(), parse_port_range(), and parse_process_specifier().

◆ tor_parse_uint64()

uint64_t tor_parse_uint64 ( const char *  s,
int  base,
uint64_t  min,
uint64_t  max,
int *  ok,
char **  next 
)

As tor_parse_long, but return a uint64_t. Only base 10 is guaranteed to work for now.

Definition at line 110 of file parse_int.c.

Referenced by get_stream().

◆ tor_parse_ulong()

unsigned long tor_parse_ulong ( const char *  s,
int  base,
unsigned long  min,
unsigned long  max,
int *  ok,
char **  next 
)

As tor_parse_long(), but return an unsigned long.

Definition at line 78 of file parse_int.c.

Referenced by get_circ().