Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 057ba5b0124d0058d89b3cd80f8172815295e59f
  • main par défaut protégée
2 résultats

potato.lua

Blame
  • server.c 976 o
    #define _POSIX_C_SOURCE 200809L
    
    #include <common/common.h>
    #include <lektor/config.h>
    #include <lektor/net.h>
    #include <lektor/cmd.h>
    #include <lektor/database.h>
    #include <mthread/mthread.h>
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <string.h>
    #include <strings.h>
    #include <pwd.h>
    #include <pthread.h>
    
    int
    main(int argc, char *argv[])
    {
        struct passwd *pw = getpwuid(getuid());
        char exe[PATH_MAX];
        pthread_t th;
        executable_name = "lektord";
        UNUSED(argv);
    
        if (argc <= 1)
            goto normal_launch;
        help__();
        return EXIT_FAILURE;
    
    normal_launch:
        LOG_INFO("Lektor launched by user %s (shell: %s, home: %s)", pw->pw_name, pw->pw_shell, pw->pw_dir);
        mthread_init();
        pthread_create(&th, NULL, mthread_main, NULL);
        if (read_self_exe(exe, PATH_MAX))
            LOG_WARN_SCT("GENERAL", "%s", "Failed to read self executable path, restart may not work");
        executable_name = exe;
        return lkt_listen();
    }