| 17 |
#include <stdio.h> |
#include <stdio.h> |
| 18 |
#include <string.h> |
#include <string.h> |
| 19 |
#include <unistd.h> |
#include <unistd.h> |
|
#include <sys/shm.h> |
|
| 20 |
|
|
| 21 |
const char *files[] = { |
const char *files[] = { |
| 22 |
"../data/welcome.txt", |
"../data/welcome.txt", |
| 30 |
|
|
| 31 |
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
| 32 |
{ |
{ |
|
char file_path_temp[FILE_PATH_LEN]; |
|
| 33 |
int i; |
int i; |
| 34 |
void *p_shm; |
void *p_shm; |
| 35 |
size_t data_len; |
size_t data_len; |
| 37 |
const void *p_data; |
const void *p_data; |
| 38 |
const long *p_line_offsets; |
const long *p_line_offsets; |
| 39 |
|
|
|
// Change current dir |
|
|
strncpy(file_path_temp, argv[0], sizeof(file_path_temp) - 1); |
|
|
file_path_temp[sizeof(file_path_temp) - 1] = '\0'; |
|
|
|
|
|
if (chdir(dirname(file_path_temp)) < 0) |
|
|
{ |
|
|
fprintf(stderr, "chdir(%s) error: %d\n", dirname(file_path_temp), errno); |
|
|
return -1; |
|
|
} |
|
|
|
|
| 40 |
if (log_begin("../log/bbsd.log", "../log/error.log") < 0) |
if (log_begin("../log/bbsd.log", "../log/error.log") < 0) |
| 41 |
{ |
{ |
| 42 |
printf("Open log error\n"); |
printf("Open log error\n"); |