main.c

来自「unix环境高级编程的源代码」· C语言 代码 · 共 44 行

C
44
字号
#include    "calld.h"
#include    <syslog.h>

            /* define global variables */
int            clifd;
int            debug;    /* daemon's command line flag */
int            Debug;    /* Debug controlled by client, not cmd line */
char        errmsg[MAXLINE];
char        *speed;
char        *sysname;
uid_t        uid;
Client        *client = NULL;
int            client_size;
Systems        systems;
Devices        devices;
Dialers        dialers;
volatile sig_atomic_t chld_flag;
enum parity parity = NONE;

int
main(int argc, char *argv[])
{
    int        c;

    log_open("calld", LOG_PID, LOG_USER);

    opterr = 0;        /* don't want getopt() writing to stderr */
    while ( (c = getopt(argc, argv, "d")) != EOF) {
        switch (c) {
        case 'd':        /* debug */
            debug = 1;
            break;

        case '?':
            log_quit("unrecognized option: -%c", optopt);
        }
    }

    if (debug == 0)
        daemon_init();

    loop();        /* never returns */
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?