Subversion Repositories IRCServ

Rev

Rev 2 | Rev 6 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

/* $Id: check.c 3 2024-08-25 10:23:36Z nishi $ */

#include "config.h"

#include <stdio.h>

int check_log(void) {
        int count = 0;
        const char* name = "";
#ifdef USE_SYSLOG
        name = "Syslog";
        count++;
#endif
#ifdef USE_STDERR
        name = "stderr";
        count++;
#endif
        if(count == 0) {
                fprintf(stderr, "Select a logger\n");
                return 1;
        } else if(count > 1) {
                fprintf(stderr, "Too many loggers\n");
                return 1;
        } else {
                printf("Using %s for logging\n", name);
                return 0;
        }
}

int check_irc(void){
        int st = 0;
#ifndef IRC_SERVER
        fprintf(stderr, "Set a server IP\n");
        st = 1;
#endif
#ifndef IRC_PORT
        fprintf(stderr, "Set a server port\n");
        st = 1;
#endif
#ifndef IRC_SECRET
        fprintf(stderr, "Set a service password\n");
        st = 1;
#endif
#ifndef IRC_SERVICE
        fprintf(stderr, "Set a service name\n");
        st = 1;
#endif
        return st;
}

int main() {
        int st = 0;
        st = check_log();
        if(st != 0) goto cleanup;
        st = check_irc();
        if(st != 0) goto cleanup;
cleanup:
        return st;
}