ARPDAS_QNX6 1.0
Defines | Functions | Variables
msg.c File Reference
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <time.h>
#include "oui.h"
#include "nortlib.h"
#include "msg.h"
#include "tm.h"
Include dependency graph for msg.c:

Go to the source code of this file.

Defines

#define MSG_MAX_HDR_LEN   10
#define MSG_MAX_INTERNAL   250

Functions

const char * msghdr_init (const char *hdr_default, int argc, char **argv)
void msg_set_hdr (const char *hdr)
void msg_init_options (const char *hdr, int argc, char **argv)
static void write_msg (char *buf, int nb, FILE *fp, char *dest)
int msg (int level, const char *fmt,...)
int msgv (int level, const char *fmt, va_list args)

Variables

static char msg_app_hdr [MSG_MAX_HDR_LEN+1]
static int write_to_memo = 1
static int write_to_stderr = 0
static int write_to_file = 0
FILE * memo_fp
FILE * file_fp

Define Documentation

#define MSG_MAX_HDR_LEN   10

Definition at line 30 of file msg.c.

Referenced by msg_set_hdr().

#define MSG_MAX_INTERNAL   250

msgv() is a version of the msg() function that takes a va_list for format arguments, allowing more complex reporting functions to built on top of the msg() functionality. Internally msg() calls msgv().

Returns:
the level argument.

Definition at line 125 of file msg.c.

Referenced by msgv().


Function Documentation

int msg ( int  level,
const char *  fmt,
  ... 
)

msg() supports the nl_error() interface, but provides a considerable amount of additional functionality to support logging of messages within an application with multiple executables. Through command-line options, msg() can be configured to log to stderr and/or to a log file and/or to the memo application, and adds a timestamp to each message. See nl_error() for definition of the level options.

Returns:
the level argument.

Definition at line 107 of file msg.c.

References msgv().

Referenced by Ser_Sel::not_float(), Ser_Sel::report_err(), and Ser_Sel::report_ok().

Here is the call graph for this function:

Here is the caller graph for this function:

void msg_init_options ( const char *  hdr,
int  argc,
char **  argv 
)

Definition at line 50 of file msg.c.

References file_fp, memo_fp, msg_set_hdr(), nl_debug_level, opt_string, OPTIND_RESET, tm_dev_name(), write_to_file, write_to_memo, and write_to_stderr.

Here is the call graph for this function:

void msg_set_hdr ( const char *  hdr)

Definition at line 35 of file msg.c.

References msg_app_hdr, and MSG_MAX_HDR_LEN.

Referenced by msg_init_options().

Here is the caller graph for this function:

const char* msghdr_init ( const char *  hdr_default,
int  argc,
char **  argv 
)

Handle -h option

Definition at line 15 of file msg.c.

References opt_string, and OPTIND_RESET.

int msgv ( int  level,
const char *  fmt,
va_list  args 
)

Definition at line 126 of file msg.c.

References file_fp, memo_fp, msg_app_hdr, MSG_MAX_INTERNAL, nl_debug_level, write_msg(), write_to_file, write_to_memo, and write_to_stderr.

Referenced by msg(), and Ser_Sel::report_err().

Here is the call graph for this function:

Here is the caller graph for this function:

static void write_msg ( char *  buf,
int  nb,
FILE *  fp,
char *  dest 
) [static]

Definition at line 87 of file msg.c.

Referenced by msgv().

Here is the caller graph for this function:


Variable Documentation

FILE * file_fp

Definition at line 33 of file msg.c.

Referenced by msg_init_options(), and msgv().

FILE* memo_fp

Definition at line 33 of file msg.c.

Referenced by msg_init_options(), and msgv().

char msg_app_hdr[MSG_MAX_HDR_LEN+1] [static]

Definition at line 31 of file msg.c.

Referenced by msg_set_hdr(), and msgv().

int write_to_file = 0

Definition at line 32 of file msg.c.

Referenced by msg_init_options(), and msgv().

int write_to_memo = 1 [static]

Definition at line 32 of file msg.c.

Referenced by msg_init_options(), and msgv().

int write_to_stderr = 0

Definition at line 32 of file msg.c.

Referenced by msg_init_options(), and msgv().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines