base
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#define DEFAULT_LOGFILE_PATH "."
|
||||
|
||||
int main()
|
||||
{
|
||||
char *makeLogString();
|
||||
FILE *shLogFile=NULL;
|
||||
|
||||
shLogFile = fopen(makeLogString(), "a");
|
||||
fprintf(shLogFile, "-------- shit ----------\n");
|
||||
fclose(shLogFile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *makeLogString()
|
||||
{
|
||||
struct tm *t;
|
||||
time_t timer;
|
||||
static char log_path_file[128];
|
||||
|
||||
timer = time(NULL);
|
||||
t = localtime(&timer);
|
||||
|
||||
snprintf(log_path_file, 128, "%ssh_statusd_%04d%02d%02d.log", DEFAULT_LOGFILE_PATH,
|
||||
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday);
|
||||
return log_path_file;
|
||||
}
|
||||
Reference in New Issue
Block a user