File modules/pr/properties.c

  $Revision: 1.9 $

Properties module (pr) - this _should_ eventually get merged in with the
Status: NOT REVUED, NOT TESTED
Online References:
  Instructions for use:

To get a property: use the PR_get_property("Property.name") function from your other code.

Included Files


Preprocessor definitions

#define COMMENT_CHARACTER

#define MAX_PROPERTIES 1024


Typedef Property

Each property has a

typedef struct _Property* Property
struct _Property 
   { 
     char* token; Token to be found in properties file.
     char* value; Value to be found in properties file.
   } 


Global Variable Properties

Array of Properties

Property Properties[1024]
Visible in:  modules/pr/properties.c
Used in: PR_get_property()modules/pr/properties.c
  PR_to_string()modules/pr/properties.c
  add_property()modules/pr/properties.c
  purge_properties()modules/pr/properties.c


Global Variable Prop_count

The number of properties.

int Prop_count
Visible in:  modules/pr/properties.c
Used in: PR_get_property()modules/pr/properties.c
  PR_set()modules/pr/properties.c
  PR_to_string()modules/pr/properties.c
  add_property()modules/pr/properties.c
  purge_properties()modules/pr/properties.c


Global Variable Prop_file_name

The name of properties file.

char* Prop_file_name
Visible in:  modules/pr/properties.c
Used in: PR_load()modules/pr/properties.c
  PR_set()modules/pr/properties.c


Global Function PR_get_property()

  Sets the properties file name.  Then sets the properties with a call to set_properties().

More:
  Authors:
        ottrey
Online References:
char* PR_get_property ( const char* token, const char* default_value )
Calls: fprintf(), strcmp(), strcpy(), strlen(), wr_real_malloc()
Called by: CO_set()modules/co/constants.c
  authenticate_user()modules/pc/protocol_config.c
References Variables: Prop_countmodules/pr/properties.c
  Propertiesmodules/pr/properties.c

Global Function PR_load()

  Sets the properties file name.  Then sets the properties with a call to set_properties().

More:
  Authors:
        ottrey
Online References:
void PR_load ( const char* prop_file_name )
Calls: PR_set()modules/pr/properties.c
  fprintf(), free(), strcpy(), strlen(), wr_real_malloc()
References Variables: Prop_file_namemodules/pr/properties.c

Global Function PR_set()

  Sets the properties from the properties file.

More:
  Authors:
        ottrey
Online References:
char* PR_set ( void )
Calls: add_property()modules/pr/properties.c
  purge_properties()modules/pr/properties.c
  fclose(), fgets(), fopen(), fprintf(), sprintf(), strcat(), strchr(), strcpy(), strlen(), strncpy(), strrchr(), wr_real_malloc()
Called by: PR_load()modules/pr/properties.c
References Variables: Prop_countmodules/pr/properties.c
  Prop_file_namemodules/pr/properties.c

Global Function PR_to_string()

  Returns the properties as a string.

More:
  Authors:
        ottrey

Pre-Conditions: The properties must be loaded first with load_properties().
Online References:
char* PR_to_string ( void )
Calls: fprintf(), sprintf(), strcat(), strcpy(), strlen(), wr_real_malloc()
Called by: show_props()modules/pc/pc_commands.c
References Variables: Prop_countmodules/pr/properties.c
  Propertiesmodules/pr/properties.c

Local Function add_property()

  Adds a new property to the Properties array.

More:
  Authors:
        ottrey
Online References:
static void add_property ( const char* token, const char* value )
Calls: fprintf(), strcpy(), strlen(), wr_real_calloc(), wr_real_malloc()
Called by: PR_set()modules/pr/properties.c
References Variables: Prop_countmodules/pr/properties.c
  Propertiesmodules/pr/properties.c

Local Function purge_properties()

  Purges the old properties.

More:
  Authors:
        ottrey
Online References:
static void purge_properties ( void )
Calls: wr_real_free()
Called by: PR_set()modules/pr/properties.c
References Variables: Prop_countmodules/pr/properties.c
  Propertiesmodules/pr/properties.c