fix path to last 10 and automessage
This commit is contained in:
parent
321bf47ee8
commit
ee194c102f
29
src/bbs.c
29
src/bbs.c
@ -684,7 +684,12 @@ void record_last10_callers(struct user_record *user) {
|
|||||||
struct last10_callers callers[10];
|
struct last10_callers callers[10];
|
||||||
|
|
||||||
int i, j;
|
int i, j;
|
||||||
FILE *fptr = fopen("last10v2.dat", "rb");
|
|
||||||
|
char last10_path[PATH_MAX];
|
||||||
|
|
||||||
|
snprintf(last10_path, PATH_MAX, "%s/last10v2.dat", conf.bbs_path);
|
||||||
|
|
||||||
|
FILE *fptr = fopen(last10_path, "rb");
|
||||||
|
|
||||||
if (fptr != NULL) {
|
if (fptr != NULL) {
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
@ -708,7 +713,7 @@ void record_last10_callers(struct user_record *user) {
|
|||||||
} else {
|
} else {
|
||||||
j = 0;
|
j = 0;
|
||||||
}
|
}
|
||||||
fptr = fopen("last10v2.dat", "wb");
|
fptr = fopen(last10_path, "wb");
|
||||||
for (; j < i; j++) {
|
for (; j < i; j++) {
|
||||||
fwrite(&callers[j], sizeof(struct last10_callers), 1, fptr);
|
fwrite(&callers[j], sizeof(struct last10_callers), 1, fptr);
|
||||||
}
|
}
|
||||||
@ -720,9 +725,14 @@ void record_last10_callers(struct user_record *user) {
|
|||||||
void display_last10_callers(struct user_record *user) {
|
void display_last10_callers(struct user_record *user) {
|
||||||
struct last10_callers callers[10];
|
struct last10_callers callers[10];
|
||||||
|
|
||||||
|
char last10_path[PATH_MAX];
|
||||||
|
|
||||||
int i, z;
|
int i, z;
|
||||||
struct tm l10_time;
|
struct tm l10_time;
|
||||||
FILE *fptr = fopen("last10v2.dat", "rb");
|
|
||||||
|
snprintf(last10_path, PATH_MAX, "%s/last10v2.dat", conf.bbs_path);
|
||||||
|
|
||||||
|
FILE *fptr = fopen(last10_path, "rb");
|
||||||
time_t l10_timet;
|
time_t l10_timet;
|
||||||
|
|
||||||
s_printf("\e[2J\e[1;1H");
|
s_printf("\e[2J\e[1;1H");
|
||||||
@ -779,6 +789,7 @@ void automessage_write() {
|
|||||||
FILE *fptr;
|
FILE *fptr;
|
||||||
char automsg[450];
|
char automsg[450];
|
||||||
char buffer[76];
|
char buffer[76];
|
||||||
|
char automsg_path[PATH_MAX];
|
||||||
int i;
|
int i;
|
||||||
struct tm timenow;
|
struct tm timenow;
|
||||||
time_t timen;
|
time_t timen;
|
||||||
@ -802,7 +813,9 @@ void automessage_write() {
|
|||||||
strlcat(automsg, "\r\n", sizeof automsg);
|
strlcat(automsg, "\r\n", sizeof automsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
fptr = fopen("automessage.txt", "w");
|
snprintf(automsg_path, PATH_MAX, "%s/automessage.txt", conf.bbs_path);
|
||||||
|
|
||||||
|
fptr = fopen(automsg_path, "w");
|
||||||
if (fptr) {
|
if (fptr) {
|
||||||
fwrite(automsg, strlen(automsg), 1, fptr);
|
fwrite(automsg, strlen(automsg), 1, fptr);
|
||||||
fclose(fptr);
|
fclose(fptr);
|
||||||
@ -816,10 +829,14 @@ void automessage_display() {
|
|||||||
struct stat s;
|
struct stat s;
|
||||||
FILE *fptr;
|
FILE *fptr;
|
||||||
char buffer[90];
|
char buffer[90];
|
||||||
|
char automsg_path[PATH_MAX];
|
||||||
int i;
|
int i;
|
||||||
s_printf("\r\n\r\n");
|
s_printf("\r\n\r\n");
|
||||||
if (stat("automessage.txt", &s) == 0) {
|
|
||||||
fptr = fopen("automessage.txt", "r");
|
snprintf(automsg_path, PATH_MAX, "%s/automessage.txt", conf.bbs_path);
|
||||||
|
|
||||||
|
if (stat(automsg_path, &s) == 0) {
|
||||||
|
fptr = fopen(automsg_path, "r");
|
||||||
if (fptr) {
|
if (fptr) {
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
memset(buffer, 0, 90);
|
memset(buffer, 0, 90);
|
||||||
|
@ -12,8 +12,11 @@ char *www_last10() {
|
|||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
stralloc page = EMPTY_STRALLOC;
|
stralloc page = EMPTY_STRALLOC;
|
||||||
struct last10_callers callers[10];
|
struct last10_callers callers[10];
|
||||||
|
char last10_path[PATH_MAX];
|
||||||
|
|
||||||
FILE *fptr = fopen("last10v2.dat", "rb");
|
snprintf(last10_path, PATH_MAX, "%s/last10v2.dat", conf.bbs_path);
|
||||||
|
|
||||||
|
FILE *fptr = fopen(last10_path, "rb");
|
||||||
if (fptr != NULL) {
|
if (fptr != NULL) {
|
||||||
for (; n < 10; ++n)
|
for (; n < 10; ++n)
|
||||||
if (fread(&callers[n], sizeof(callers[n]), 1, fptr) != 1)
|
if (fread(&callers[n], sizeof(callers[n]), 1, fptr) != 1)
|
||||||
|
Reference in New Issue
Block a user