1 Msgno <mba/msgno.h>

1.1 Introduction

The msgno module provides a mechanism for managing error codes (or more generically message numbers) and associated messages across separate C libraries. Each participating library registers a table of messages at runtime with the msgno_add_codes function. Several macros are provided to dispatch messages (e.g. print to stderr). When the library is distributed these macros may be disabled however, when a library is compiled with other packages that use also use msgno, the following stack trace like output may be generated where messages may come from different libraries.

  [miallen@nano c]$ ./zsvr_test
  domnode.c:433:domnode_load: No such file or directory: conf/zsvr.xml
    cfg.c:288:cfg_get_property: Configuration error
    zsvr.c:555:main: Server initialization failed

1.2

1.2 The MSG, MNO, MNF, PMSG, PMNO, PMNF, AMSG, AMNO, AMNF macros
Synopsis


#include <mba/msgno.h> MSG(fmt, args...) MNO(msgno) MNF(msgno, fmt, args...) PMSG(fmt, args...) PMNO(msgno) PMNF(msgno, fmt, args...) AMSG(fmt, args...) AMNO(msgno) AMNF(msgno, fmt, args...)
Description
The MSG, MNO, MNF, PMSG, PMNO, PMNF, AMSG, AMNO, AMNF macros dispatch or buffer messages.

1.3 Message management functions

1.3 The msgno_entry structure
Synopsis


#include <mba/msgno.h> struct msgno_entry { unsigned int msgno; const char *msg; };
Description

1.3.1 The msgno_add_codes function
Synopsis


#include <mba/msgno.h>
int msgno_add_codes(struct msgno_entry *list);
Description
The msgno_add_codes function
Returns
The msgno_add_codes function returns non-zero if the operation was successfull. Otherwise, zero is returned and errno is set to indicate that the operation failed.

1.3.2 The msgno_msg function
Synopsis


#include <mba/msgno.h>
const char *msgno_msg(unsigned int msgno);
Description
The msgno_msg function
Returns
The msgno_msg function returns the message associated with the msgno parameter. If no such message has been registered, then either the message "No such msgno list" or "No such message in msgno list" is returned.

1.3.3 The msgno_hdlr_stderr function
Synopsis


#include <mba/msgno.h>
int msgno_hdlr_stderr(const char *fmt, ...);
Description
The msgno_hdlr_stderr function
Returns
The msgno_hdlr_stderr function


Michael B. Allen <mballen@erols.com>
Thu Mar 21 00:52:48 EST 2002