/[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.5 by sysadm, Sun May 25 06:48:31 2025 UTC Revision 1.13 by sysadm, Tue Nov 11 00:28:05 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /* SPDX-License-Identifier: GPL-3.0-or-later */
2                                                  file_loader.c  -  description  /*
3                                                           -------------------   * test_file_loader
4          Copyright            : (C) 2004-2025 by Leaflet   *   - tester for shared memory based file loader
5          Email                : leaflet@leafok.com   *
6   ***************************************************************************/   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7     */
8  /***************************************************************************  
9   *                                                                         *  #ifdef HAVE_CONFIG_H
10   *   This program is free software; you can redistribute it and/or modify  *  #include "config.h"
11   *   it under the terms of the GNU General Public License as published by  *  #endif
  *   the Free Software Foundation; either version 3 of the License, or     *  
  *   (at your option) any later version.                                   *  
  *                                                                         *  
  ***************************************************************************/  
12    
13  #include "file_loader.h"  #include "file_loader.h"
 #include "trie_dict.h"  
14  #include "log.h"  #include "log.h"
15    #include "trie_dict.h"
16    #include <errno.h>
17  #include <stdio.h>  #include <stdio.h>
18  #include <unistd.h>  #include <unistd.h>
 #include <errno.h>  
19  #include <sys/shm.h>  #include <sys/shm.h>
20    
21  #define TRIE_DICT_SHM_FILE "~trie_dict_shm.dat"  static const char TRIE_DICT_SHM_FILE[] = "~trie_dict_shm.dat";
22    
23  const char *files[] = {  const char *files[] = {
24          "../data/welcome.txt",          "../data/welcome.txt",
# Line 51  int main(int argc, char *argv[]) Line 47  int main(int argc, char *argv[])
47                  return -1;                  return -1;
48          }          }
49    
50          log_std_redirect(STDOUT_FILENO);          log_common_redir(STDOUT_FILENO);
51          log_err_redirect(STDERR_FILENO);          log_error_redir(STDERR_FILENO);
52    
53          if ((fp = fopen(TRIE_DICT_SHM_FILE, "w")) == NULL)          if ((fp = fopen(TRIE_DICT_SHM_FILE, "w")) == NULL)
54          {          {
# Line 61  int main(int argc, char *argv[]) Line 57  int main(int argc, char *argv[])
57          }          }
58          fclose(fp);          fclose(fp);
59    
60          if (trie_dict_init(TRIE_DICT_SHM_FILE) < 0)          if (trie_dict_init(TRIE_DICT_SHM_FILE, TRIE_NODE_PER_POOL) < 0)
61          {          {
62                  printf("trie_dict_init failed\n");                  printf("trie_dict_init failed\n");
63                  return -1;                  return -1;


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

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