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

Diff of /lbbs/src/str_process.c

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

Revision 1.1 by sysadm, Sat May 3 06:25:17 2025 UTC Revision 1.3 by sysadm, Tue May 6 05:31:26 2025 UTC
# Line 9  Line 9 
9   *                                                                         *   *                                                                         *
10   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
11   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
12   *   the Free Software Foundation; either version 2 of the License, or     *   *   the Free Software Foundation; either version 3 of the License, or     *
13   *   (at your option) any later version.                                   *   *   (at your option) any later version.                                   *
14   *                                                                         *   *                                                                         *
15   ***************************************************************************/   ***************************************************************************/
# Line 20  Line 20 
20  #include <stdio.h>  #include <stdio.h>
21  #include <string.h>  #include <string.h>
22    
23  int split_line(const char *buffer, int max_len, int *p_eol)  unsigned int split_line(const char *buffer, int max_len, int *p_eol)
24  {  {
25          int len = strnlen(buffer, LINE_BUFFER_LEN);          size_t len = strnlen(buffer, LINE_BUFFER_LEN);
26          int display_len = 0;          int display_len = 0;
27          int i = 0;          unsigned int i = 0;
28          *p_eol = 0;          *p_eol = 0;
29    
30          if (len == 0)          if (len == 0)
# Line 47  int split_line(const char *buffer, int m Line 47  int split_line(const char *buffer, int m
47                          *p_eol = 1;                          *p_eol = 1;
48                          break;                          break;
49                  }                  }
50                    
51                  if (c == '\033' && buffer[i + 1] == '[') // Skip control sequence                  if (c == '\033' && buffer[i + 1] == '[') // Skip control sequence
52                  {                  {
53                          i += 2;                          i += 2;
54                          while(i < len && buffer[i] != 'm')                          while (i < len && buffer[i] != 'm')
55                          {                          {
56                                  i++;                                  i++;
57                          }                          }
# Line 82  int split_line(const char *buffer, int m Line 82  int split_line(const char *buffer, int m
82          return i;          return i;
83  }  }
84    
85  int split_file_lines(FILE *fin, int max_len, long *p_line_offsets, int max_line_cnt)  unsigned int split_file_lines(FILE *fin, int max_len, long *p_line_offsets, int max_line_cnt)
86  {  {
87          char buffer[LINE_BUFFER_LEN];          char buffer[LINE_BUFFER_LEN];
88          char *p_buf = buffer;          char *p_buf = buffer;
89          int line_cnt = 0;          unsigned int line_cnt = 0;
90          int len = 0;          unsigned int len = 0;
91          int end_of_line = 0;          int end_of_line = 0;
92          p_line_offsets[line_cnt] = 0L;          p_line_offsets[line_cnt] = 0L;
93    
94          while (fgets(p_buf, sizeof(buffer) - len, fin))          while (fgets(p_buf, (int)(sizeof(buffer) - len), fin))
95          {          {
96                  p_buf = buffer;                  p_buf = buffer;
97                  while (1)                  while (1)


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

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