<commit_before>#include <stdlib.h>
#include <syslog.h>
#include <signal.h>
#include <sys/wait.h>
#include "gpio.h"
#include "gpio_port.h"

static volatile int sigterm = 0;
static volatile int sigint = 0;
static volatile int sighup = 0;

static void handle_sigint(int sig)
{
    dlog(LOG_INFO, "SIGINT received.\n");
    sigint = 1;
}
static void handle_sigterm(int sig)
{
    dlog(LOG_INFO, "SIGTERM received.\n");
    sigterm = 1;
}
static void handle_sighup(int sig)
{
    dlog(LOG_INFO, "SIGHUP received.\n");
    sighup = 1;
}

int daemon_main(int argc, char* argv[], char* envp[])
{
    int shutdown = 0;
    dlog(LOG_INFO, "shutdownd started.\n");
    if (signal(SIGINT, handle_sigint) == SIG_ERR) {
        dlog(LOG_ERR, "fail to setup SIGINT.\n");
        return 2;
    } else
    if (signal(SIGTERM, handle_sigterm) == SIG_ERR) {
        dlog(LOG_ERR, "fail to setup SIGTERM.\n");
        return 2;
    } else if (signal(SIGHUP, handle_sighup) == SIG_ERR) {
        dlog(LOG_ERR, "fail to ignore SIGHUP.\n");
        return 2;
    }
	gpio_init();
	GPIO_PORT* GPIO_PED_BUTTON = gpio_port_input_pullup(25);
	while(!sigterm && !sigint) {
        if(shutdown) {
            usleep(1000000);
        } else {
            int button_state = gpio_port_read(GPIO_PED_BUTTON);
            int button_pushed = (button_state == 0 ? 1 : 0);
            if(button_pushed) {
                shutdown = 1;
                syslog(LOG_INFO, "shutdownd is going to shutdown the system.");
                system("shutdown -h now");
            } else {
                usleep(10000);
            }
        }
	}
    dlog(LOG_INFO, "shutdownd stopped.\n");
	return 0;
}
<commit_msg>adjust indent<commit_after>#include <stdlib.h>
#include <syslog.h>
#include <signal.h>
#include <sys/wait.h>
#include "gpio.h"
#include "gpio_port.h"

static volatile int sigterm = 0;
static volatile int sigint = 0;
static volatile int sighup = 0;

static void handle_sigint(int sig)
{
    dlog(LOG_INFO, "SIGINT received.\n");
    sigint = 1;
}
static void handle_sigterm(int sig)
{
    dlog(LOG_INFO, "SIGTERM received.\n");
    sigterm = 1;
}
static void handle_sighup(int sig)
{
    dlog(LOG_INFO, "SIGHUP received.\n");
    sighup = 1;
}

int daemon_main(int argc, char* argv[], char* envp[])
{
    int shutdown = 0;
    dlog(LOG_INFO, "shutdownd started.\n");
    if (signal(SIGINT, handle_sigint) == SIG_ERR) {
        dlog(LOG_ERR, "fail to setup SIGINT.\n");
        return 2;
    } else
    if (signal(SIGTERM, handle_sigterm) == SIG_ERR) {
        dlog(LOG_ERR, "fail to setup SIGTERM.\n");
        return 2;
    } else if (signal(SIGHUP, handle_sighup) == SIG_ERR) {
        dlog(LOG_ERR, "fail to ignore SIGHUP.\n");
        return 2;
    }
    gpio_init();
    GPIO_PORT* GPIO_PED_BUTTON = gpio_port_input_pullup(25);
    while(!sigterm && !sigint) {
        if(shutdown) {
            usleep(1000000);
        } else {
            int button_state = gpio_port_read(GPIO_PED_BUTTON);
            int button_pushed = (button_state == 0 ? 1 : 0);
            if(button_pushed) {
                shutdown = 1;
                syslog(LOG_INFO, "shutdownd is going to shutdown the system.");
                system("shutdown -h now");
            } else {
                usleep(10000);
            }
        }
    }
    dlog(LOG_INFO, "shutdownd stopped.\n");
    return 0;
}
{'fraction_non_alphanumeric': 0.13230035756853398, 'fraction_numerical': 0.01728247914183552, 'mean_word_length': 2.439549180327869, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6831820', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1188, 'n_words': 283}