galeb

Једноставна статичка дистрибуција заснована на musl-у
git clone https://git.sr.ht/~strahinja/galeb
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

error.h (550B)


      1 #ifndef _ERROR_H_
      2 #define _ERROR_H_
      3 
      4 #include <stdarg.h>
      5 #include <stdio.h>
      6 #include <stdlib.h>
      7 #include <string.h>
      8 #include <errno.h>
      9 
     10 static unsigned int error_message_count = 0;
     11 
     12 static inline void error(int status, int errnum, const char* format, ...)
     13 {
     14 	va_list ap;
     15 	fprintf(stderr, "%s: ", program_invocation_name);
     16 	va_start(ap, format);
     17 	vfprintf(stderr, format, ap);
     18 	va_end(ap);
     19 	if (errnum)
     20 		fprintf(stderr, ": %s", strerror(errnum));
     21 	fprintf(stderr, "\n");
     22 	error_message_count++;
     23 	if (status)
     24 		exit(status);
     25 }
     26 
     27 #endif	/* _ERROR_H_ */