dualinit

A meta-init system for linux
Log | Files | Refs | LICENSE

console.h (1375B)


      1 #pragma once
      2 
      3 #include "common.h"
      4 
      5 /**
      6  * prints debug info
      7  */
      8 #define VERBOSE(format...)                       \
      9 	{                                            \
     10 		if (color) {                             \
     11 			printf("\e[33mdebug:\e[0m " format); \
     12 		} else                                   \
     13 			printf("debug: " format);            \
     14 	}
     15 
     16 /**
     17  * prints regular info
     18  */
     19 #define INFO(format...)                      \
     20 	{                                        \
     21 		if (color) {                         \
     22 			printf("\e[36m::\e[0m " format); \
     23 		} else                               \
     24 			printf(":: " format);            \
     25 	}
     26 
     27 /**
     28  * prints a warning
     29  */
     30 #define WARN(format...)                           \
     31 	{                                             \
     32 		if (color)                                \
     33 			printf("\e[1;35mwarn\e[0m: " format); \
     34 		else                                      \
     35 			printf("warn: " format);              \
     36 	}
     37 
     38 /**
     39  * prints an error and dies
     40  */
     41 #define PANIC(format...)                           \
     42 	{                                              \
     43 		if (color)                                 \
     44 			printf("\e[1;31merror\e[0m: " format); \
     45 		else                                       \
     46 			printf("error: " format);              \
     47 		die();                                     \
     48 	}
     49 
     50 /**
     51  * initiate the console (for pid == 1)
     52  */
     53 void init_console();