Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

countm.c File Reference

countm database interface application. More...


Defines

#define BUF_SIZE   4096
#define PHASE_LINK   0
#define PHASE_COUNTER   1
#define PHASE_ACCESS   2
#define PHASE_HOSTS   4

Functions

static void countm_print_dbcounter_data (p_dbcounter_data_t p_dbcd)
 prints the contents of the record.
static void countm_print_enum_imagetype (enum imagetype it, char **r_str)
 converts imagetype to string for printing.
static int countm_enum_imagetype (const char *buf, enum imagetype *p_it)
 converts imagetype string to enum imagetype value.
static void countm_print_enum_randomtype (enum randomtype rt, char **r_str)
 converts the randomtype string to a enum randomtype.
static int countm_enum_randomtype (const char *buf, enum randomtype *p_rt)
 converts the randomtype to a string for printing.
static void countm_print_enum_resettype (enum resettype rt, char **r_str)
 Converts resettype to string for printing.
static int countm_enum_resettype (const char *buf, enum resettype *p_rt)
 Converts string resettype to enum resettype.
static void countm_print_enum_counttype (enum counttype ct, char **r_str)
 Converts counttype to string for printing.
static int countm_enum_counttype (const char *buf, enum counttype *p_ct)
 Converts counttype string to enum counttype.
static void countm_print_struct_rgb (p_rgb_t p_rgb, char *buf)
 Converts struct rgb to string for printing.
static int countm_read_info (char *fn)
static int countm_read_info_readline (FILE *fp, char *p_line, int i_len)
static char * countm_read_info_islink (char *buf)
 Tests buf to determine if it is a LINK: statement.
static int countm_read_info_isaccess (char *buf)
 Tests buf to determine if it is a DB_ACCESS: label.
int countm_read_info_iscounter (char *buf)
 Tests buf to determine if it is a DB_COUNTER: label.
static int countm_read_info_counteritem (char *buf, p_dbcounter_data_t p)
 Converts info in buf into data for structure May allocate and define sza_font, sza_bgfile. A value of notdef returns SUCCESS, implies ignore it.
static int countm_match_extension (const char *fname, const char *pattern)
 Determines if fname matches pattern.
static int countm_verify_bgfile (char *fn, enum imagetype *img)
 Attempts to determine file type via extension.
static void countm_print_help (char *pc)
 prints the help message.
static void countm_rgb_color (const char *hexnum, p_rgb_t rgb)
 Manipulates rgb color values.
static int countm_set_atime (p_dbcounter_data_t p_dbcd)
 creates the atime field from the request time. The "time" is really an ISO 8601 (C99) date: YYYY-MM-DD. ALL Digits! return 0
static int countm_match_param (const char *p_param, p_cm_param_e p_type)
static int countm_parse_option (p_options_record_t p_or, char *p_param)
 Parses the option, sets info in structure. Checks the option in p_param. If it is a valid option, fills in info in p_or. If it is not a valid option, returns error. If it is a duplicate, returns error. If it is a duplicate command, returns error.
int main (int argc, char *argv[], char *envp[])


Detailed Description

countm database interface application.

Author:
Byron Young
Remarks:
A simple application for manipulating the countm database.
Version:
5.4
Bug:
report to spamiccling@yahoo.com

report to bkyoung@users.sourceforge.net


Function Documentation

countm_enum_counttype const char *  buf,
enum counttype p_ct
[static]
 

Converts counttype string to enum counttype.

Parameters:
p_ct counttype of string.
buf buffer of counttype string.
Returns:
int

countm_enum_imagetype const char *  buf,
enum imagetype p_it
[static]
 

converts imagetype string to enum imagetype value.

Parameters:
buf the string.
p_it OUT:the enum imagetype of string.
Returns:
0=success, 1=failure.

countm_enum_randomtype const char *  buf,
enum randomtype p_rt
[static]
 

converts the randomtype to a string for printing.

Parameters:
p_rt randomtype to convert
buf buffer of adequate size.
Returns:
0=success, 1=failure.

countm_enum_resettype const char *  buf,
enum resettype p_rt
[static]
 

Converts string resettype to enum resettype.

Parameters:
p_rt resettype of buf
buf buffer with string of resettype.
Returns:
int 0=success, 1=failure

countm_match_extension const char *  fname,
const char *  pattern
[static]
 

Determines if fname matches pattern.

Parameters:
fname The file name to check.
pattern The RE to use.
Returns:
0 No, does not match.

1 Yes, they match.

countm_match_param const char *  p_param,
p_cm_param_e  p_type
[static]
 

Parameters:
p_param The parameter to match.
p_type OUT:The matched parameter.
Returns:
0 Did not match parameter.

1 Parameter matched.

countm_parse_option p_options_record_t  p_or,
char *  p_param
[static]
 

Parses the option, sets info in structure. Checks the option in p_param. If it is a valid option, fills in info in p_or. If it is not a valid option, returns error. If it is a duplicate, returns error. If it is a duplicate command, returns error.

Parameters:
p_or The options record to store valid data.
p_param The command line option.
Returns:
0 = The parameter found and processed, # => error type.

countm_print_dbcounter_data p_dbcounter_data_t  p_dbcd  )  [static]
 

prints the contents of the record.

Parameters:
p_dbcd dbcounter_data
Returns:
void

countm_print_enum_counttype enum counttype  ct,
char **  r_str
[static]
 

Converts counttype to string for printing.

Parameters:
ct counttype.
r_str Return string.
Returns:
void

countm_print_enum_imagetype enum imagetype  it,
char **  r_str
[static]
 

converts imagetype to string for printing.

Parameters:
it the image type.
r_str Return string.
Returns:
void

countm_print_enum_randomtype enum randomtype  rt,
char **  r_str
[static]
 

converts the randomtype string to a enum randomtype.

Parameters:
rt the enum randomtype.
r_str Return string.
Returns:
void.

countm_print_enum_resettype enum resettype  rt,
char **  r_str
[static]
 

Converts resettype to string for printing.

Parameters:
rt resettype to convert
r_str Return string.
Returns:
void

countm_print_help char *  pc  )  [static]
 

prints the help message.

Parameters:
pc the program name.

countm_print_struct_rgb p_rgb_t  p_rgb,
char *  buf
[static]
 

Converts struct rgb to string for printing.

Parameters:
p_rgb pointer to rgb structure.
buf The return buffer of adequate size.
Returns:
void

countm_read_info char *  fn  )  [static]
 

Parameters:
fn Complete path/filename of textfile. Opens fn in text mode. File: No spaces. Last line must end with newline. Must begin with LINK: Next line must be DB_COUNTER:/n Until DB_ACCESS: all lines are considered item=data pairs. After DB_ACCESS: until EOF or next LINK:, all lines are considered hostnames to be inserted into DB_ACCESS.
Returns:
4=cannot open file, 5=out of memory, 6=file syntax error

countm_read_info_counteritem char *  buf,
p_dbcounter_data_t  p
[static]
 

Converts info in buf into data for structure May allocate and define sza_font, sza_bgfile. A value of notdef returns SUCCESS, implies ignore it.

Parameters:
buf The counteritem
p the structure to store item within.
Returns:
CM_SUCCESS

CM_PARAM_INVALID

countm_read_info_isaccess char *  buf  )  [static]
 

Tests buf to determine if it is a DB_ACCESS: label.

Parameters:
buf The line of the file to check.
Returns:
0=NO, 1=YES

int countm_read_info_iscounter char *  buf  ) 
 

Tests buf to determine if it is a DB_COUNTER: label.

Parameters:
countm_read_info_iscounter(char * buf)
buf The line of the file to check.
Returns:
0=NO, 1=YES

countm_read_info_islink char *  buf  )  [static]
 

Tests buf to determine if it is a LINK: statement.

Parameters:
buf The line of the file to check.
Returns:
pointer to link, if a link statement. NULL otherwise.

countm_read_info_readline FILE *  fp,
char *  p_line,
int  i_len
[static]
 

Parameters:
fp The text file.
p_line The buffer.
i_len The size, in bytes of buffer p_line. Read a line from a text file, and place into p_line. Removes all leading and trailing white space.
Returns:
EOF=endoffile:no data in p_line;ERRNO=file error;ENOBUFS=textfile line too large for buffer; 0=success: line data in p_line.

countm_rgb_color const char *  hexnum,
p_rgb_t  rgb
[static]
 

Manipulates rgb color values.

Parameters:
hexnum String representing 6 consecutive hex digits.
rgb Pointer to allocated return structure.
Returns:
The colors within the rgb structure.

countm_set_atime p_dbcounter_data_t  p_dbcd  )  [static]
 

creates the atime field from the request time. The "time" is really an ISO 8601 (C99) date: YYYY-MM-DD. ALL Digits! return 0

Parameters:
p_dbcd structure containing atime to fill in.

countm_verify_bgfile char *  fn,
enum imagetype img
[static]
 

Attempts to determine file type via extension.

Parameters:
fn The file name to verify.
img OUT:The image type.
Returns:
1 Success. Extensions match.

0 Failure. fn incorrect.


Generated on Sat Jan 7 15:48:39 2006 for countm by  doxygen 1.4.2