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

Diff of /lbbs/src/section_list_loader.c

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

Revision 1.24 by sysadm, Tue Jun 17 07:00:32 2025 UTC Revision 1.30 by sysadm, Sat Jun 21 02:15:18 2025 UTC
# Line 14  Line 14 
14   *                                                                         *   *                                                                         *
15   ***************************************************************************/   ***************************************************************************/
16    
 #define _POSIX_C_SOURCE 200809L  
   
 #include "section_list_loader.h"  
17  #include "article_cache.h"  #include "article_cache.h"
18  #include "bbs.h"  #include "bbs.h"
 #include "log.h"  
19  #include "database.h"  #include "database.h"
20    #include "log.h"
21  #include "menu.h"  #include "menu.h"
22  #include <stdio.h>  #include "section_list_loader.h"
 #include <string.h>  
23  #include <errno.h>  #include <errno.h>
24  #include <signal.h>  #include <signal.h>
25    #include <stdio.h>
26  #include <stdlib.h>  #include <stdlib.h>
27  #include <string.h>  #include <string.h>
 #include <strings.h>  
28  #include <unistd.h>  #include <unistd.h>
29    
30  int section_list_loader_pid;  int section_list_loader_pid;
# Line 135  int load_section_config_from_db(void) Line 131  int load_section_config_from_db(void)
131                                  break;                                  break;
132                          }                          }
133    
134                          strncpy(p_section->sname, row[1], sizeof(p_section->sname) - 1);                          strncpy(p_section->sname, row[0], sizeof(p_section->sname) - 1);
135                          p_section->sname[sizeof(p_section->sname) - 1] = '\0';                          p_section->sname[sizeof(p_section->sname) - 1] = '\0';
136                          strncpy(p_section->stitle, row[1], sizeof(p_section->stitle) - 1);                          strncpy(p_section->stitle, row[1], sizeof(p_section->stitle) - 1);
137                          p_section->stitle[sizeof(p_section->stitle) - 1] = '\0';                          p_section->stitle[sizeof(p_section->stitle) - 1] = '\0';
# Line 684  int section_list_loader_launch(void) Line 680  int section_list_loader_launch(void)
680                          }                          }
681                          else                          else
682                          {                          {
683                                  log_error("Reload section config successfully\n");                                  log_common("Reload section config successfully\n");
684                          }                          }
685                  }                  }
686    
# Line 885  int locate_article_in_section(SECTION_LI Line 881  int locate_article_in_section(SECTION_LI
881                          }                          }
882                  }                  }
883    
884                  aid = (p_article->aid > p_article_cur->aid ? p_article->aid : 0);                  aid = (p_article->aid > p_article_cur->aid && p_article->visible ? p_article->aid : 0);
885          }          }
886          else if (direction == -1)          else if (direction == -1)
887          {          {
# Line 897  int locate_article_in_section(SECTION_LI Line 893  int locate_article_in_section(SECTION_LI
893                          }                          }
894                  }                  }
895    
896                  aid = (p_article->aid < p_article_cur->aid ? p_article->aid : 0);                  aid = (p_article->aid < p_article_cur->aid && p_article->visible ? p_article->aid : 0);
897          }          }
898    
899          p_article = NULL;          p_article = NULL;
# Line 910  int locate_article_in_section(SECTION_LI Line 906  int locate_article_in_section(SECTION_LI
906                          *p_article_count = (page_id == p_section->page_count - 1 ? p_section->last_page_visible_article_count : BBS_article_limit_per_page);                          *p_article_count = (page_id == p_section->page_count - 1 ? p_section->last_page_visible_article_count : BBS_article_limit_per_page);
907    
908                          p_article = p_section->p_page_first_article[page_id];                          p_article = p_section->p_page_first_article[page_id];
909                          for (i = 0; i < *p_article_count;)                          for (i = 0; i < *p_article_count && p_article != NULL;)
910                          {                          {
911                                  if (p_article->visible)                                  if (p_article->visible)
912                                  {                                  {
# Line 925  int locate_article_in_section(SECTION_LI Line 921  int locate_article_in_section(SECTION_LI
921                                          {                                          {
922                                                  log_error("Visible article (aid=%d) not found in page %d\n", aid, page_id);                                                  log_error("Visible article (aid=%d) not found in page %d\n", aid, page_id);
923                                                  p_article = NULL;                                                  p_article = NULL;
924                                                    break;
925                                          }                                          }
926                                  }                                  }
927                                  p_article = p_article->p_next;                                  p_article = p_article->p_next;


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

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