Functions | |
long | ipow10 (int x) |
get [x]'s power of 10, an integer version. | |
long | roundd (double x) |
returns the closest long to [x]. | |
bool | is_empty (const char *s) |
returns true if [s] contains no elements. | |
bool | is_numeric (const char *p) |
returns true if and only if [s] contains digits. | |
char * | substr (const char *s, unsigned int n, unsigned int m) |
substring [s] from [n] to [m] | |
char * | ora_substr (const char *s, int n, unsigned int m) |
Returns a portion of [s], beginning at index [n], [m] characters long. | |
void | replace (const char *in, char **out, const char *os, const char *ns) |
replace all occurrences of [os] with [ns] and put new string in [out]. | |
bool | str_equal (const char *s1, const char *s2) |
returns true if and only if the arguments is not null and represents the same sequence of characters. | |
bool | str_equal_ic (const char *s1, const char *s2) |
returns true if the arguments is not null and represents the same sequence of characters (case ignored). | |
time_t | make_time (const char *sdate, const char *fmt) |
makes a time_t object with specified date and format. | |
int | date_diff (const char *d1, const char *d2) |
diff two date-value and returns in seconds. | |
int | sdate_diff (const char *d1, const char *d2) |
diff two short-date-value and returns in seconds. | |
int | sys_load () |
returns current load of OS. | |
FILE * | open_file (const char *file, const char *mode) |
void | close_file (FILE *fp) |
void | close_del_file (FILE *fp, const char *file) |
void | rand_init () |
void | rand_chars (char *rc, int len) |
double | rand_double () |
int | rand_int (int digit) |
void | read_key (const char *file, const char *key, char *value) |
read a key's value from a property file (key=value pair line by line) . | |
void | ora_sysdate (char *od) |
set YYYYMMDD string to [od]. | |
void | err_exit (int ec) |
when error occurred, log current time and exit. |
void close_del_file | ( | FILE * | fp, | |
const char * | file | |||
) |
void close_file | ( | FILE * | fp | ) |
int date_diff | ( | const char * | d1, | |
const char * | d2 | |||
) |
diff two date-value and returns in seconds.
(Unix-ware required.)
d1 | a YYYYMMDD string. | |
d2 | a YYYYMMDD string. |
void err_exit | ( | int | ec | ) |
when error occurred, log current time and exit.
long ipow10 | ( | int | x | ) |
get [x]'s power of 10, an integer version.
bool is_empty | ( | const char * | s | ) |
returns true if [s] contains no elements.
bool is_numeric | ( | const char * | p | ) |
returns true if and only if [s] contains digits.
time_t make_time | ( | const char * | sdate, | |
const char * | fmt | |||
) |
makes a time_t object with specified date and format.
(Unix-ware required.)
actually this is a wrapper of [strptime()].
sdate | date-value in string format. | |
fmt | date_format in string format. |
FILE* open_file | ( | const char * | file, | |
const char * | mode | |||
) |
char* ora_substr | ( | const char * | s, | |
int | n, | |||
unsigned int | m | |||
) |
Returns a portion of [s], beginning at index [n], [m] characters long.
If [m] is positive, counts from the beginning of char to find the first character. if [m] is negative, counts backwards from the end of char. If [m] is omitted, returns all characters to the end of char.
void ora_sysdate | ( | char * | od | ) |
void rand_chars | ( | char * | rc, | |
int | len | |||
) |
double rand_double | ( | ) |
void rand_init | ( | ) |
int rand_int | ( | int | digit | ) |
void read_key | ( | const char * | file, | |
const char * | key, | |||
char * | value | |||
) |
read a key's value from a property file (key=value pair line by line) .
file | path of property file | |
key | the key you want to find | |
value | the value returned. |
void replace | ( | const char * | in, | |
char ** | out, | |||
const char * | os, | |||
const char * | ns | |||
) |
replace all occurrences of [os] with [ns] and put new string in [out].
in | the original string | |
out | the result string | |
os | the search string | |
ns | the replacement string |
long roundd | ( | double | x | ) |
returns the closest long to [x].
if x = 10.5, return 11.
if x = 10.4, return 10.
int sdate_diff | ( | const char * | d1, | |
const char * | d2 | |||
) |
diff two short-date-value and returns in seconds.
(Unix-ware required.)
d1 | a YYMMDD string. | |
d2 | a YYMMDD string. |
bool str_equal | ( | const char * | s1, | |
const char * | s2 | |||
) |
returns true if and only if the arguments is not null and represents the same sequence of characters.
bool str_equal_ic | ( | const char * | s1, | |
const char * | s2 | |||
) |
returns true if the arguments is not null and represents the same sequence of characters (case ignored).
char* substr | ( | const char * | s, | |
unsigned int | n, | |||
unsigned int | m | |||
) |
substring [s] from [n] to [m]
int sys_load | ( | ) |
returns current load of OS.
(Unix-ware required.)