xref: /reactos/sdk/tools/log2lines/util.h (revision c2c66aff)
1 /*
2  * ReactOS log2lines
3  * Written by Jan Roeloffzen
4  *
5  * - Misc utils
6  */
7 
8 #pragma once
9 
10 #include <stdio.h>
11 
12 #include "cmd.h"
13 #include "options.h"
14 
15 #define log(outFile, fmt, ...)                          \
16     {                                                   \
17         fprintf(outFile, fmt, ##__VA_ARGS__);           \
18         if (logFile)                                    \
19             fprintf(logFile, fmt, ##__VA_ARGS__);       \
20     }
21 
22 #define esclog(outFile, fmt, ...)                           \
23     {                                                       \
24         log(outFile, KDBG_ESC_RESP fmt, ##__VA_ARGS__);     \
25     }
26 
27 #define clilog(outFile, fmt, ...)                       \
28     {                                                   \
29         if (opt_cli)                                    \
30             esclog(outFile, fmt, ##__VA_ARGS__)         \
31         else                                            \
32             log(outFile, fmt, ##__VA_ARGS__);           \
33     }
34 
35 #define l2l_dbg(level, ...)                     \
36     {                                           \
37         if (opt_verbose >= level)               \
38             fprintf(stderr, ##__VA_ARGS__);     \
39     }
40 
41 int file_exists(char *name);
42 int mkPath(char *path, int isDir);
43 char *basename(char *path);
44 const char *getFmt(const char *a);
45 long my_atoi(const char *a);
46 int isOffset(const char *a);
47 int copy_file(char *src, char *dst);
48 int set_LogFile(FILE **plogFile);
49 
50 /* EOF */
51