Introduce pet-projects dir
[lcapit-junk-code.git] / pet-projects / games / hangman / misc.c
bloba6040d3d527d0e9cb038145eb5ba8a0909cf54bd
1 /*
2 * This file is licensed under the GPLv2 license
3 *
4 * Luiz Fernando N. Capitulino
5 * <lcapitulino@gmail.com>
6 */
7 #include <stdio.h>
8 #include <string.h>
9 #include <stdlib.h>
10 #include <stdarg.h>
11 #include <errno.h>
13 #include "misc.h"
15 void eprint(const char *fmt, ...)
17 va_list ap;
19 fprintf(stderr, "\n-> ERRO: ");
21 va_start(ap, fmt);
22 vfprintf(stderr, fmt, ap);
23 va_end(ap);
25 fprintf(stderr, " (%s)\n", strerror(errno));
27 fprintf(stderr, "[pressione ENTER para continuar] ");
28 getchar();
31 void mprint(const char *fmt, ...)
33 va_list ap;
35 printf("\n-> ");
37 va_start(ap, fmt);
38 vfprintf(stdout, fmt, ap);
39 va_end(ap);
41 printf("[pressione ENTER para continuar] ");
42 getchar();
45 void flush_all(void)
47 getchar();
48 fflush(stdout);
51 #ifdef LINUX_CLEAR_SCREEN
52 void clear_screen(void)
54 system("clear");
56 #else /* !LINUX_CLEAR_SCREEN */
57 void clear_screen(void)
59 system("cls");
61 #endif /* LINUX_CLEAR_SCREE */