errormsg man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

ERRORMSG(3)							   ERRORMSG(3)

NAME
       errormsg, set_progname, get_progname - printing error messages

SYNOPSIS
       #include <errormsg.h>

       void errormsg(int exitp, int eno, const char *fmt, ...);
       void set_progname(const char *argv0, const char *def);
       const char *get_progname(void);

DESCRIPTION
       The  errormsg  function	is  used for printing error messages.  It is a
       like a combination of fprintf(3) and perror(3), in  that	 it  makes  it
       easy  to	 add  arbitrary, printf-like formatted text to the output, and
       makes it easy to include the system's error message (the	 error	string
       corresponding to the eno parameter).  Unlike perror, this function does
       not get the error code directly from errno, thus making it easier to do
       something else that might set it before printing out the error message.
       errormsg also adds the name of the program to the output, if known.

       The first argument to errormsg should be	 0  (don't  exit  program),  1
       (exit program with exit(EXIT_FAILURE)) or 2 (with abort()).  The second
       one should be 0 (don't print system  error  message),  positive	(print
       error  message corresponding to the error code), or -1 (print the error
       message corresponding to errno).

       The set_progname function sets the program name.	 You need to call this
       function	 with at least one non-NULL parameter to get the program names
       included in the output.	If either  argument  is	 non-NULL,  it	should
       point  at  strings that have static duration, i.e. they exist until the
       program terminates (or at least until the last error message  has  been
       printed);  this	is so that it is not necessary to create a copy of the
       name.  (Either or both arguments can also be NULL.)

       If the first argument is non-NULL, that is used as the name,  otherwise
       the  seconds  argument  is  used.  If both are NULL, no program name is
       included in the output.	The reason for having two arguments is so that
       the caller doesn't have to do the test, and can just call

		 set_progname(argv[0], "default_name");

       (it is valid for argv[0] to be NULL, under ISO C).

       The  get_progname function returns a pointer to the current name of the
       program, as set by set_progname.	 If get_progname returns NULL, then no
       name has been set and none is included in the output.  This function is
       included for completeness, it is not really expected to be useful.

SEE ALSO
       publib(3)

AUTHOR
       Lars Wirzenius (lars.wirzenius@helsinki.fi)

								   ERRORMSG(3)
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net