/* Copyright (c) 2025 Rodrigo Arias Mallo * SPDX-License-Identifier: GPL-3.0-or-later */ #include #include "overheat.h" /* Read a CSV from the stdin in the format * * skipping the first row (header). * * Outputs overheat state. */ #define MAX_LINE 1024 int main(void) { char buf[MAX_LINE]; fgets(buf, MAX_LINE, stdin); float t, temp; int st; struct overheat ovh; overheat_init(&ovh); while (scanf("%f %d %f", &t, &st, &temp) == 3) { overheat_input(&ovh, t * 1000.0, temp); float delta = overheat_delta(&ovh); int panic = overheat_panic(&ovh); printf("%.3f %d %.2f %.1f %s\n", t, st, temp, delta, panic ? "PANIC" : "OK"); } return 0; }