Cross reference for er/er_macro.c of index.

# File er/er_macro.c

      $Revision: 1.12 $

      Error reporting (er) er_macro.c - simple macro processor

      Status: NOT REVUED, PARTLY TESTED

      Design and implementation by: Marek Bukowy

## Included Files

- `#include "/home/shane/code/RIP/include/rip.h"`
  - `#include </home/shane/code/RIP/include/config.h>`
  - `#include <sys/param.h>`
  - `#include </ncc/dbwork/platforms/yucca-debug/glib-indep/include/glib-1.2/glib.h>`
  - `#include "/home/shane/code/RIP/include/AU_util.h"`
    - `#include <stdio.h>`
    - `#include <stdlib.h>`
    - `#include <string.h>`
    - `#include <sys/types.h>`
    - `#include <unistd.h>`
    - `#include <regex.h>`
    - `#include <glib.h>`
  - `#include "/home/shane/code/RIP/include/aa.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
      - `#include <sys/types.h>`
      - `#include <glib.h>`
      - `#include </home/shane/code/RIP/include/inet6def.h>`
      - `#include </home/shane/code/RIP/include/erroutines.h>`
  - `#include "/home/shane/code/RIP/include/access_control.h"`
    - `#include "/home/shane/code/RIP/include/erroutines.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
    - `#include "/home/shane/code/RIP/include/rxroutines.h"`
      - `#include <glib.h>`
      - `#include <pthread.h>`
      - `#include <stubs.h>`
      - `#include </home/shane/code/RIP/include/memwrap.h>`
      - `#include <stdio.h>`
      - `#include <iproutines.h>`
      - `#include <erroutines.h>`
      - `#include "/home/shane/code/RIP/include/sk.h"`
        - `#include "/home/shane/code/RIP/include/stubs.h"`
        - `#include <sys/time.h>`
        - `#include <unistd.h>`
        - `#include <sys/types.h>`
        - `#include <sys/socket.h>`
        - `#include <netinet/in.h>`
        - `#include <netdb.h>`
        - `#include <pthread.h>`
        - `#include <stdlib.h>`
        - `#include <errno.h>`
        - `#include <fcntl.h>`
        - `#include <signal.h>`
        - `#include <stdio.h>`
        - `#include "/home/shane/code/RIP/include/iproutines.h"`
      - `#include "/home/shane/code/RIP/include/thread.h"`
    - `#include "/home/shane/code/RIP/include/mysql_driver.h"`
      - `#include "/usr/local/mysql/include/mysql/mysql.h"`
        - `#include <sys/types.h>`
        - `#include "/usr/local/mysql/include/mysql/mysql_com.h"`
        - `#include "/usr/local/mysql/include/mysql/mysql_version.h"`
      - `#include "/usr/local/mysql/include/mysql/mysqld_error.h"`
      - `#include "/home/shane/code/RIP/include/erroutines.h"`
  - `#include "/home/shane/code/RIP/include/bitmask.h"`
  - `#include "/home/shane/code/RIP/include/ca_adminAttribs.h"`
  - `#include "/home/shane/code/RIP/include/ca_configFns.h"`
    - `#include "/home/shane/code/RIP/include/ca_defs.h"`
      - `#include <pthread.h>`
      - `#include <glib.h>`
    - `#include <memwrap.h>`
    - `#include <erroutines.h>`
  - `#include "/home/shane/code/RIP/include/ca_defs.h"`
  - `#include "/home/shane/code/RIP/include/ca_dictionary.h"`
  - `#include "/home/shane/code/RIP/include/ca_macros.h"`
    - `#include "/home/shane/code/RIP/include/ca_adminAttribs.h"`
  - `#include "/home/shane/code/RIP/include/ca_srcAttribs.h"`
  - `#include "/home/shane/code/RIP/include/comparisons.h"`
  - `#include "/home/shane/code/RIP/include/constants.h"`
    - `#include <glib.h>`
  - `#include "/home/shane/code/RIP/include/defs.h"`
    - `#include <glib.h>`
    - `#include "/home/shane/code/RIP/include/bitmask.h"`
    - `#include "/home/shane/code/RIP/include/DF_class_enum.def"`
    - `#include "/home/shane/code/RIP/include/DF_class_mask.def"`
    - `#include "/home/shane/code/RIP/include/DF_attribute_enum.def"`
    - `#include "/home/shane/code/RIP/include/DF_attribute_inv_attr_mask.def"`
    - `#include "/home/shane/code/RIP/include/which_keytypes.h"`
      - `#include "/home/shane/code/RIP/include/bitmask.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
    - `#include "/home/shane/code/RIP/include/rxroutines.h"`
  - `#include "/home/shane/code/RIP/include/er_arrays.h"`
    - `#include "/home/shane/code/RIP/include/erroutines.h"`
  - `#include "/home/shane/code/RIP/include/er_aspects.h"`
  - `#include "/home/shane/code/RIP/include/er_facilities.h"`
  - `#include "/home/shane/code/RIP/include/er_formats.h"`
  - `#include "/home/shane/code/RIP/include/er_macro.h"`
    - `#include "/home/shane/code/RIP/include/sk.h"`
  - `#include "/home/shane/code/RIP/include/er_paths.h"`
    - `#include <sys/param.h>`
    - `#include <glib.h>`
  - `#include "/home/shane/code/RIP/include/er_yacc_helper.h"`
  - `#include "/home/shane/code/RIP/include/erroutines.h"`
  - `#include "/home/shane/code/RIP/include/fdwrap.h"`
    - `#include <stdio.h>`
  - `#include "/home/shane/code/RIP/include/mg_getopt.h"`
  - `#include "/home/shane/code/RIP/include/globaldefs.h"`
  - `#include "/home/shane/code/RIP/include/gpg.h"`
    - `#include <netdb.h>`
    - `#include <unistd.h>`
    - `#include "/home/shane/code/RIP/include/mail_parser.h"`
      - `#include "/home/shane/code/RIP/include/gpg.h"`
      - `#include "/home/shane/code/RIP/include/memwrap.h"`
  - `#include "/home/shane/code/RIP/include/inet6def.h"`
  - `#include "/home/shane/code/RIP/include/iproutines.h"`
  - `#include "/home/shane/code/RIP/include/mail_parser.h"`
  - `#include "/home/shane/code/RIP/include/memwrap.h"`
  - `#include "/home/shane/code/RIP/include/mm.h"`
    - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/mail.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/linkage.h"`
    - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/osdep.h"`
      - `#include <string.h>`
      - `#include <sys/types.h>`
      - `#include <stdlib.h>`
      - `#include <dirent.h>`
      - `#include <fcntl.h>`
      - `#include <unistd.h>`
      - `#include <time.h>`
      - `#include <utime.h>`
      - `#include <syslog.h>`
      - `#include <sys/file.h>`
      - `#include <ustat.h>`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/env_unix.h"`
        - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/env.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/fs.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/ftl.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/nl.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/tcp.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/lockfix.h"`
    - `#include "/home/shane/code/RIP/include/gpg.h"`
    - `#include "/home/shane/code/RIP/include/mail_parser.h"`
    - `#include "/home/shane/code/RIP/include/memwrap.h"`
    - `#include "/ncc/dbwork/platforms/yucca-debug/glib-indep/include/glib-1.2/glib.h"`
  - `#include "/home/shane/code/RIP/include/mysql_driver.h"`
  - `#include "/home/shane/code/RIP/include/nh.h"`
    - `#include <mysql_driver.h>`
  - `#include "/home/shane/code/RIP/include/notification.h"`
    - `#include <stdarg.h>`
    - `#include <stdio.h>`
    - `#include <strings.h>`
    - `#include <unistd.h>`
    - `#include <stdlib.h>`
    - `#include <time.h>`
    - `#include <glib.h>`
    - `#include "/home/shane/code/RIP/include/UP_util.h"`
      - `#include "/home/shane/code/RIP/include/syntax_api.h"`
  - `#include "/home/shane/code/RIP/include/numconv.h"`
  - `#include "/home/shane/code/RIP/include/pc_commands.h"`
  - `#include "/home/shane/code/RIP/include/properties.h"`
  - `#include "/home/shane/code/RIP/include/protocol_config.h"`
  - `#include "/home/shane/code/RIP/include/protocol_mirror.h"`
    - `#include <glib.h>`
    - `#include "/home/shane/code/RIP/include/mysql_driver.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
    - `#include "/home/shane/code/RIP/include/aa.h"`
      - `#include "/home/shane/code/RIP/include/iproutines.h"`
  - `#include "/home/shane/code/RIP/include/protocol_whois.h"`
    - `#include "/home/shane/code/RIP/include/query_command.h"`
      - `#include <glib.h>`
      - `#include "/home/shane/code/RIP/include/bitmask.h"`
      - `#include "/home/shane/code/RIP/include/sk.h"`
  - `#include "/home/shane/code/RIP/include/query_command.h"`
  - `#include "/home/shane/code/RIP/include/query_instructions.h"`
    - `#include "/home/shane/code/RIP/include/rxroutines.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
    - `#include "/home/shane/code/RIP/include/mysql_driver.h"`
    - `#include "/home/shane/code/RIP/include/query_command.h"`
    - `#include "/home/shane/code/RIP/include/defs.h"`
    - `#include "/home/shane/code/RIP/include/which_keytypes.h"`
    - `#include "/home/shane/code/RIP/include/access_control.h"`
    - `#include "/home/shane/code/RIP/include/ca_configFns.h"`
    - `#include "/home/shane/code/RIP/include/ca_dictionary.h"`
    - `#include "/home/shane/code/RIP/include/ca_macros.h"`
    - `#include "/home/shane/code/RIP/include/ca_srcAttribs.h"`
  - `#include "/home/shane/code/RIP/include/rp.h"`
    - `#include <stddef.h>`
    - `#include <glib.h>`
    - `#include <pthread.h>`
    - `#include <defs.h>`
    - `#include <iproutines.h>`
    - `#include <erroutines.h>`
    - `#include <rxroutines.h>`
    - `#include <mysql_driver.h>`
    - `#include "/home/shane/code/RIP/include/ca_defs.h"`
    - `#include <thread.h>`
  - `#include "/home/shane/code/RIP/include/rxroutines.h"`
  - `#include "/home/shane/code/RIP/include/server.h"`
  - `#include "/home/shane/code/RIP/include/sk.h"`
  - `#include "/home/shane/code/RIP/include/stubs.h"`
  - `#include "/home/shane/code/RIP/include/syntax_api.h"`
  - `#include "/home/shane/code/RIP/include/ta.h"`
    - `#include <glib.h>`
    - `#include <pthread.h>`
    - `#include <stdio.h>`
    - `#include "/home/shane/code/RIP/include/stubs.h"`
    - `#include "/home/shane/code/RIP/include/memwrap.h"`
    - `#include "/home/shane/code/RIP/include/sk.h"`
    - `#include "/home/shane/code/RIP/include/timediff.h"`
      - `#include <sys/time.h>`
  - `#include "/home/shane/code/RIP/include/thread.h"`
  - `#include "/home/shane/code/RIP/include/timediff.h"`
  - `#include "/home/shane/code/RIP/include/ud.h"`
  - `#include "/home/shane/code/RIP/include/ud_int.h"`
    - `#include <stdio.h>`
    - `#include <strings.h>`
    - `#include <glib.h>`
    - `#include <stdlib.h>`
    - `#include <ctype.h>`
    - `#include <unistd.h>`
    - `#include "/home/shane/code/RIP/include/defs.h"`
    - `#include "/home/shane/code/RIP/include/mysql_driver.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
    - `#include "/home/shane/code/RIP/include/erroutines.h"`
    - `#include "/home/shane/code/RIP/include/rp.h"`
    - `#include "/home/shane/code/RIP/include/nh.h"`
    - `#include "/home/shane/code/RIP/include/sk.h"`
    - `#include "/home/shane/code/RIP/include/memwrap.h"`
    - `#include "/home/shane/code/RIP/include/ca_configFns.h"`
    - `#include "/home/shane/code/RIP/include/ca_dictionary.h"`
    - `#include "/home/shane/code/RIP/include/ca_macros.h"`
    - `#include "/home/shane/code/RIP/include/ca_srcAttribs.h"`
    - `#include "/home/shane/code/RIP/include/globaldefs.h"`
    - `#include "/home/shane/code/RIP/include/bitmask.h"`
    - `#include "/home/shane/code/RIP/include/which_keytypes.h"`
  - `#include "/home/shane/code/RIP/include/ud_tr.h"`
    - `#include "/home/shane/code/RIP/include/ud_int.h"`
  - `#include "/home/shane/code/RIP/include/ut_string.h"`
  - `#include "/home/shane/code/RIP/include/wh_queries.h"`
    - `#include "/home/shane/code/RIP/include/sk.h"`
  - `#include "/home/shane/code/RIP/include/which_keytypes.h"`

- `#include <string.h>`

- `#include <glib.h>`

## Preprocessor definitions

`#define DBUPDLOG_FORMAT " FORMAT SEVCHAR|FACSYMB|TEXTLONG|DATETIME|PIDFULL|PROGNAME|MNEMONIC "`

`#define RIPLOG_FORMAT " FORMAT SEVCHAR|FACSYMB|TEXTLONG|DATETIME|PIDFULL|PROGNAME|THR_ID|MNEMONIC "`

## Global Variable Lock

`pthread_mutex_t Lock`

Included from | /home/shane/code/RIP/include/ca_defs.h
Visible in: |  | aa/aa.c
|  | ac/access_control.c
|  | ca/ca_configFns.c
|  | ca/ca_initFn.c
|  | ca/ca_sanityCheck.c
|  | ca/ca_sourceLoader.c
|  | ca/ca_values.c
|  | co/constants.c
|  | df/defs.c
|  | er/er.c
|  | er/er_arrays.c
|  | er/er_macro.c
Used in: | ca_get_adminIntElement() | ca/ca_configFns.c
| ca_get_adminStrElement() | ca/ca_configFns.c
| ca_get_boolean() | ca/ca_configFns.c
| ca_get_dirlist() | ca/ca_configFns.c
| ca_get_int() | ca/ca_configFns.c
| ca_get_string() | ca/ca_configFns.c
| ca_set_boolean() | ca/ca_configFns.c
| ca_srchandle2Intelement() | ca/ca_configFns.c
| ca_srchandle2Strelement() | ca/ca_configFns.c

## Global Function ER_macro_list()

      Lists all currently defined macros to the given connection.

`void ER_macro_list ( sk_conn_st* condat )`

`sk_conn_st* condat`
  connection data structure

Prototyped in: | /home/shane/code/RIP/include/er_macro.h
Calls: | TH_acquire_read_lock(), TH_release_read_lock(), g_hash_table_foreach()
References Functions: | er_macro_list_hook() | er/er_macro.c

## Global Function ER_macro_predef()

      predefine some macros useful for the whois_rip server.
      XXX - this should not be here, it should be done via the CA module!

`void ER_macro_predef ( void )`

Prototyped in: | /home/shane/code/RIP/include/er_macro.h
Calls: | ER_make_macro() | er/er_macro.c
Called by: | ER_init() | er/er.c

## Global Function ER_macro_spec()

      Take a text line and parse it as an error specification
      line. Optionally, if the first word is a macro, run the macro using
      other words as its arguments.  This is basically a wrapper around
      ER_process_split() that splits the string into argv and calls the
      ER_parse.

      sets the errbuf to the result of ER_parse_spec.

`int ER_macro_spec ( char* input, char** errbuf )`

`int ER_macro_spec`
  returns 0 on success, non-0 on failure.
`char* input`
  input line
`char** errbuf`
  storage for the result pointer (to allocated text)

Prototyped in: | /home/shane/code/RIP/include/er_macro.h
Calls: | ER_parse_spec() | er/er.yacc.tab.c
| ER_process_split() | er/er_macro.c
| UT_free_real(), UT_strdup_real(), g_strfreev(), g_strsplit(), ut_string_compress()
Called by: | ER_proc_ca_err() | er/er_macro.c

## Global Function ER_make_macro()

      (Re)Define a macro.

`void ER_make_macro ( char* name, char* def )`

`char* name`
  macro name
`char* def`
  macro contents

Prototyped in: | /home/shane/code/RIP/include/er_macro.h
Calls: | TH_acquire_write_lock(), TH_release_write_lock(), UT_free_real(), UT_strdup_real(), g_hash_table_insert(), g_hash_table_lookup_extended(), g_hash_table_remove()
Called by: | ER_macro_predef() | er/er_macro.c
| ER_proc_ca_macro() | er/er_macro.c

## Global Function ER_proc_ca_err()

      Processes the error definitions from the config file. The
      definitions can be specified with the use of a macro or without.

`void ER_proc_ca_err ( void )`

Prototyped in: | /home/shane/code/RIP/include/er_macro.h
Calls: | ER_macro_spec() | er/er_macro.c
| ca_get_string() | ca/ca_configFns.c
| UT_free_real(), fprintf(), fputs(), strchr()
Called by: | ER_init() | er/er.c

## Global Function ER_proc_ca_macro()

     Defines the macros with the definitions from the config file,
     overriding any currently defined ones if the same name is used.

`void ER_proc_ca_macro ( void )`

Prototyped in: | /home/shane/code/RIP/include/er_macro.h
Calls: | ER_make_macro() | er/er_macro.c
| ca_get_string() | ca/ca_configFns.c
| UT_free_real(), fprintf(), strchr(), strtok_r()
Called by: | ER_init() | er/er.c

## Global Function ER_process_split()

      processes a macro call, i.e. executes one of the predefined macros
      selected by the 0th word of the array, using other words as
      arguments to that macro. Uses the er_macro_array[] to find the
      macro definition.  Allocates the result string and stores the
      pointer to it in **output.

`int ER_process_split ( int argc, char** argv, char** output )`

`int ER_process_split`
  returns 0 on success, non-0 on failure.
`int argc`
  number of words in the word array
`char** argv`
  word array (pointers to strings)
`char** output`
  storage for the result pointer (to allocated text)

Prototyped in: | /home/shane/code/RIP/include/er_macro.h
Calls: | TH_acquire_write_lock(), TH_release_write_lock(), g_hash_table_lookup(), g_string_append(), g_string_append_c(), g_string_free(), g_string_new(), strlen(), strstr()
Called by: | ER_macro_spec() | er/er_macro.c

## Local Function asctime_r()

`static char* asctime_r ( const struct tm* __tm, char* __buf )`

Included from: | /usr/include/time.h
Calls: | __posix_asctime_r()

## Local Function ctime_r()

`static char* ctime_r ( const time_t* __time, char* __buf )`

Included from: | /usr/include/time.h
Calls: | __posix_ctime_r()

## Local Function er_macro_list_hook()

      Prints the arguments (key and value of a hash) to the given
      connection (used for listing the defined macros)

`static void er_macro_list_hook ( void* key, void* value, void* condat )`

`void* key`
  hash key
`void* value`
  hash value
`void* condat`
  connection data structure

Calls: | SK_cd_printf()
Used in: | ER_macro_list() | er/er_macro.c

## Local Function getlogin_r()

`static int getlogin_r ( char* __name, int __len )`

Included from: | /usr/include/unistd.h
Calls: | __posix_getlogin_r()

## Local Function readdir_r()

`static int readdir_r ( DIR* __dp, struct dirent* __ent, struct dirent** __res )`

Included from: | /usr/include/dirent.h
Calls: | __posix_readdir_r()

## Local Function sigwait()

`static int sigwait ( const sigset_t* __setp, int* __signo )`

Included from: | /usr/include/signal.h
Calls: | __posix_sigwait()

## Local Function ttyname_r()

`static int ttyname_r ( int __fildes, char* __buf, size_t __size )`

Included from: | /usr/include/unistd.h
Calls: | __posix_ttyname_r()