Ejemplo n.º 1
0
int main() {
    signal(SIGTERM, handler);
    establishLock();
    
    printf("\t\tman 7/%d\n", BOSS_VERSION);
    
    //it is somewhat important that we write to the old file descriptors before reopening.
    //this copies some stdout buffer behavior to the new file description.
    printf("Man re-opening stdout...\n");
    fprintf(stderr, "Man re-opening stderr...\n");

    //Make stdout's fd point to a file description for the manlog file (MAN_LOG_PATH)
    freopen(MAN_LOG_PATH, "w", stdout);
    //Send stderr to whatever stdout's fd describes
    dup2(STDOUT_FILENO, STDERR_FILENO);
    
    //fprintf(stderr, "THIS IS A TEST OF STDERR\n");
    //fprintf(stdout, "THIS IS A TEST OF STDOUT\n");
    
    // Constructs an instance of man. If we get here we have a lock
    instance = new man::Man();

    while (1) {
        // Hack so that I don't have to modify DiagramThread
        // (Diagram threads are daemon threads, and man will exit if they're the
        // only ones left)
        sleep(10);
    }
    return 1;
}
Ejemplo n.º 2
0
int main() {
    signal(SIGTERM, handler);
    establishLock();
    
    printf("\t\tman 7/%d\n", BOSS_VERSION);
    printf("Man re-opening stdout...\n");
    freopen(MAN_LOG_PATH, "w", stdout);

    // Constructs an instance of man. If we get here we have a lock
    instance = new man::Man();

    while (1) {
        // Hack so that I don't have to modify DiagramThread
        // (Diagram threads are daemon threads, and man will exit if they're the
        // only ones left)
        sleep(10);
    }
    return 1;
}