Changeset 37 in openpam


Ignore:
Timestamp:
Feb 6, 2002, 4:03:18 PM (16 years ago)
Author:
Dag-Erling Smørgrav
Message:

Provide a fallback for platforms that don't support varadic macros.

Sponsored by: DARPA, NAI Labs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_log.c

    r16 r37  
    4444#include "openpam_impl.h"
    4545
     46#if defined(openpam_log)
     47
    4648/*
    4749 * Log a message through syslog(3)
     
    8082}
    8183
     84#else
     85
     86/*
     87 * If openpam_log isn't defined as a macro, we're on a platform that
     88 * doesn't support varadic macros (or it does but we aren't aware of
     89 * it).  Do the next best thing.
     90 */
     91
     92void
     93openpam_log(int level, const char *fmt, ...)
     94{
     95        va_list ap;
     96        int priority;
     97
     98        switch (level) {
     99        case PAM_LOG_DEBUG:
     100                priority = LOG_DEBUG;
     101                break;
     102        case PAM_LOG_VERBOSE:
     103                priority = LOG_INFO;
     104                break;
     105        case PAM_LOG_NOTICE:
     106                priority = LOG_NOTICE;
     107                break;
     108        case PAM_LOG_ERROR:
     109                priority = LOG_ERR;
     110                break;
     111        }
     112        va_start(ap, fmt);
     113        vsyslog(priority, fmt, ap);
     114        va_end(ap);
     115}
     116
     117#endif
Note: See TracChangeset for help on using the changeset viewer.