-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfilter.c
105 lines (91 loc) · 2.25 KB
/
filter.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/***************************************************************************
*
* Copyright (c) 1997-2022 Jeff V. Merkey
* 7260 SE Tenino St.
* Portland, Oregon 97206
* jeffmerkey@gmail.com
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the Lesser GNU Public License as published by the
* Free Software Foundation, version 2.1, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* Original Authorship :
* source code written by Jeff V. Merkey
*
* Original Contributors :
* Jeff V. Merkey
*
*
*
****************************************************************************
*
*
* AUTHOR : Jeff V. Merkey (jeffmerkey@gmail.com)
* FILE : FILTER.C
* DESCRIP : printf() suppression object file
* DATE : December 27, 2022
*
*
***************************************************************************/
#include "globals.h"
BYTE LogFileName[20] = "NWFS.LOG";
FILE *logfp = 0;
ULONG EnableLogging = 0;
int log_sprintf(char *buffer, char *format, ...)
{
int ccode;
va_list args;
if (!EnableLogging)
{
if (logfp)
fclose(logfp);
logfp = 0;
logfp = fopen(LogFileName, "a+");
if (logfp)
{
va_start(args, format);
vfprintf(logfp, format, args);
fprintf(logfp, "\r\n");
va_end(args);
fclose(logfp);
logfp = 0;
}
}
va_start(args, format);
ccode = vsprintf(buffer, format, args);
va_end(args);
return ccode;
}
int log_printf(char *format, ...)
{
va_list args;
if (!EnableLogging)
{
if (logfp)
fclose(logfp);
logfp = 0;
logfp = fopen(LogFileName, "a+");
if (logfp)
{
va_start(args, format);
vfprintf(logfp, format, args);
va_end(args);
fclose(logfp);
logfp = 0;
}
}
return 0;
}
int printk(char *format, ...)
{
return 0;
}
int DbgPrint(char *format, ...)
{
return 0;
}