Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 533c4cb46d5ec5ffd0d20b5b2499e456d17fe9ec
  • master par défaut protégée
  • rust-playlist-sync
  • rust
  • fix-qt-deprecated-qvariant-type
  • fix-mpris-qtwindow-race-condition
  • rust-appimage-wayland
  • windows-build-rebased
  • v2.5 protégée
  • v2.4 protégée
  • v2.3-1 protégée
  • v2.3 protégée
  • v2.2 protégée
  • v2.1 protégée
  • v2.0 protégée
  • v1.8-3 protégée
  • v1.8-2 protégée
  • v1.8-1 protégée
  • v1.8 protégée
  • v1.7 protégée
  • v1.6 protégée
  • v1.5 protégée
  • v1.4 protégée
  • v1.3 protégée
  • v1.2 protégée
  • v1.1 protégée
  • v1.0 protégée
27 résultats

server.c

Blame
  • server.c 14,44 Kio
    #define _POSIX_C_SOURCE 200808L
    
    #include <lektor/lktconfig.h>
    #include <lektor/common.h>
    #include <lektor/config.h>
    #include <lektor/net.h>
    #include <lektor/cmd.h>
    #include <lektor/reg.h>
    #include <lektor/database.h>
    #include <lektor/commands.h>
    #include <lektor/segv.h>
    
    #include <fcntl.h>
    #include <sys/types.h>
    #include <wait.h>
    #include <spawn.h>
    #include <libgen.h>
    #include <limits.h>
    #include <locale.h>
    #include <signal.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <string.h>
    #include <strings.h>
    #include <pthread.h>
    #include <sys/stat.h>
    #include <termios.h>
    
    #if defined (LKT_STATIC_MODULE)
        REG_DECLARE(sdl2_reg)
        REG_DECLARE(repo_reg)
    #endif
    
    /* The environment */
    extern char **environ;
    
    /* Disable echo in the console, only for the program */
    struct termios ___tty_cur, ___tty_save;
    static int ___tty_must_be_restored = 0;
    
    __attribute__((constructor))
    static void ___tty_disable_echo(void)
    {
        GOTO_IF((tcgetattr(STDIN_FILENO, &___tty_cur) == -1),
                "Failed to get termios flags", error);
    
        ___tty_save = ___tty_cur;
        ___tty_cur.c_lflag &= ~ ECHO;
    
        GOTO_IF((tcsetattr(STDIN_FILENO, TCSAFLUSH, &___tty_cur) == -1),
                "Failed to turned of echo in termios flags", error);
        ___tty_must_be_restored = 1;
    
        return;
    error:
        /* Fails silently for the moment */
        return;
    }
    
    __attribute__((destructor))
    static void ___tty_enable_echo(void)
    {
        if (!___tty_must_be_restored) {
            LOG_DEBUG("INIT", "No need to restore the tty");
            return;
        }
        if (tcsetattr(STDIN_FILENO, TCSANOW, &___tty_save) == -1)
            LOG_ERROR("INIT", "Failed to reset termios flags");
        errno = 0;