CPlay/ansicodes/main.c
2025-11-14 16:31:23 +01:00

58 lines
2.2 KiB
C

#include "ansi.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
if (!isatty(STDOUT_FILENO) || !(getenv("TERM") && strcmp(getenv("TERM"), "dumb") != 0)) {
printf("This terminal does not seem to support ANSI\n");
exit(EXIT_FAILURE);
}
printf(ANSI_BOLD "ABCDE" ANSI_RESET "\n");
printf(ANSI_DIM "ABCDE" ANSI_RESET "\n");
printf(ANSI_UNDER "ABCDE" ANSI_RESET "\n");
printf(ANSI_BLINK "ABCDE" ANSI_RESET "\n");
printf(ANSI_REV "ABCDE" ANSI_RESET "\n");
printf(ANSI_HIDDEN "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BLACK "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_RED "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_GREEN "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_YELLOW "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BLUE "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_MAGENTA "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_CYAN "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_WHITE "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BBLACK "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BRED "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BGREEN "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BYELLOW "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BBLUE "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BMAGENTA "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BCYAN "ABCDE" ANSI_RESET "\n");
printf(ANSI_FG_BWHITE "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BLACK "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_RED "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_GREEN "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_YELLOW "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BLUE "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_MAGENTA "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_CYAN "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_WHITE "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BBLACK "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BRED "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BGREEN "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BYELLOW "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BBLUE "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BMAGENTA "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BCYAN "ABCDE" ANSI_RESET "\n");
printf(ANSI_BG_BWHITE "ABCDE" ANSI_RESET "\n");
exit(EXIT_SUCCESS);
}