/[LeafOK_CVS]/lbbs/src/test_file_loader.c
ViewVC logotype

Diff of /lbbs/src/test_file_loader.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.14 by sysadm, Wed Nov 19 03:12:58 2025 UTC Revision 1.16 by sysadm, Thu Nov 20 09:02:46 2025 UTC
# Line 17  Line 17 
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",
# Line 31  int files_cnt = 6; Line 30  int files_cnt = 6;
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;
# Line 39  int main(int argc, char *argv[]) Line 37  int main(int argc, char *argv[])
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");


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1