error95/error95.h
2026-01-10 22:08:35 +04:00

83 lines
2.1 KiB
C

/*
* error95.h
*
* Copyright 2026
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
#if (!defined(__LIB_error95_H_))
#define __LIB_error95_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ncurses.h>
static void error95_error(char* _err) {
printf("\033[1merror95: \033[91m%s\033[0m\n", _err);
}
int _lib_error95_main(int argc, char** argv) {
if (!initscr()) {
error95_error("Error!");
return EXIT_FAILURE;
}
start_color();
init_pair(1, COLOR_RED, COLOR_BLACK);
attron(COLOR_PAIR(0));
printw("System failure!\n[Kernel Panic: 0xA3CFFB57 - Error exit: execute format cmd]\nUpdate disk...\n");
curs_set(0);
unsigned char i = 0;
while (i < 101) {
move(3, 0);
printw("Status: %d%% [", (int)i);
unsigned char cnt = i / 5;
while (cnt != 0) {
addch('#');
cnt --;
}
cnt = 20 - (i / 5);
while (cnt != 0) {
addch(' ');
cnt --;
}
addch(']');
printw(" ");
refresh();
sleep(1);
i ++;
}
refresh();
printw("\nReset system settings? [Y/N] ");
getch();
printw("\nAre you sure? [Y/N] ");
getch();
printw("\nRemove setting and files...");
sleep(2);
if (system("poweroff") != EXIT_SUCCESS) printw("\nReset system settings error!");
sleep(5);
endwin();
return EXIT_SUCCESS;
}
#endif /* __LIB_error95_H_ */