unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

VSYSLOG(3)                 Library Functions Manual                 VSYSLOG(3)



NAME
       vsyslog - log message with a varargs argument list

SYNOPSIS
       #include <&lt;syslog.h>&gt;
       #include <&lt;varargs.h>&gt;

       int vsyslog(priority, message, ap)
       char *message;
       va_list ap;

DESCRIPTION
       vsyslog()  is the same as syslog(3) except that instead of being called
       with a variable number of arguments, it is called with an argument list
       as defined by varargs(3).

EXAMPLE
       The  following  demonstrates  how  vsyslog()  could be used to write an
       error routine.
              #include <&lt;syslog.h>&gt;
              #include <&lt;varargs.h>&gt;
              ...
                   /*  error should be called like:
                   *    error(pri, function_name, format, arg1, arg2...);
                   *  Note that pri, function_name, and format cannot be declared
                   *  separately because of the definition of varargs.
                   */
              /*VARARGS0*/
              void
              error(va_alist)
                   va_dcl;
              {
                   va_list args;
                   int pri;
                   char *message;

                   va_start(args);
                   pri = va_arg(args, int);
                        /* log name of function causing error */
                   (void) syslog(pri, "ERROR in %s", va_arg(args, char *));
                   message = va_arg(args, char *);
                        /* log remainder of message */
                   (void) vsyslog(pri, fmt, args);
                   va_end(args);
                   (void) abort();
              }

SEE ALSO
       syslog(3), varargs(3)



                                10 October 1987                     VSYSLOG(3)