10 #define MAXBUFSIZE 1024
11 char logfilename
[64] = { 0 };
12 void writelog(const char *buf
, bool append_cr
);
15 void SetLogFilename(const char *fname
)
17 maxcpy(logfilename
, fname
, sizeof(logfilename
));
20 stat("Log set %d", time(NULL
));
23 void writelog(const char *buf
, bool append_cr
)
27 fp
= fopen(logfilename
, "a+");
31 if (append_cr
) fputc('\n', fp
);
38 void c------------------------------() {}
41 void stat(const char *fmt
, ...)
44 char buffer
[MAXBUFSIZE
];
47 vsnprintf(buffer
, sizeof(buffer
), fmt
, ar
);
54 writelog(buffer
, true);
57 void staterr(const char *fmt
, ...)
60 char buffer
[MAXBUFSIZE
];
63 vsnprintf(buffer
, sizeof(buffer
), fmt
, ar
);
66 printf(" error << %s >> \n", buffer
);
71 writelog(" error << ", false);
72 writelog(buffer
, false);
73 writelog(" >>\n", false);
78 char *stprintf(const char *fmt
, ...)
81 char *str
= GetStaticStr();
84 vsnprintf(str
, 255, fmt
, ar
);