Nimbin2git.christianimmanuel.de / Linux & System / seatd-u_vimb / seatd-n76310.c

seatd-u_vimb files

last change 2026-09-04 (2 hours ago)

wget https://git.christianimmanuel.de/linux-system/seatd-u_vimb/archive/seatd-u_vimb.tar.gz
seatd-n76310.c 743 B · 31 lines raw
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int start_Seatd() {
    execl("/usr/bin/seatd", "seatd", "-u", "u_vimb", (char *)NULL);
    fprintf(stderr, "Failed to start seatd\n");
    return 1;
}

int stop_Seatd() {
    int result = system("pkill seatd");
    if (result != 0)
        fprintf(stderr, "Failed to stop seatd\n");
    return 0;
}

int main(int argc, char* argv[]) {
    if (argc != 2)
        fprintf(stderr, "Usage: %s [start|stop]\n", argv[0]);

    if (strncmp(argv[1], "start", 5) == 0)
        return start_Seatd();
    else if (strncmp(argv[1], "stop", 4) == 0)
        return stop_Seatd();
    else
        fprintf(stderr, "Invalid argument. Use 'start' or 'stop'\n");

    return 1;
}