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

Diff of /lbbs/src/bbs_main.c

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

Revision 1.84 by sysadm, Fri Oct 17 01:25:08 2025 UTC Revision 1.87 by sysadm, Sat Oct 18 05:02:15 2025 UTC
# Line 219  int bbs_center() Line 219  int bbs_center()
219          {          {
220                  ch = igetch(100);                  ch = igetch(100);
221    
222          if (ch != KEY_NULL && ch != KEY_TIMEOUT)                  if (ch != KEY_NULL && ch != KEY_TIMEOUT)
223          {                  {
224              BBS_last_access_tm = time(NULL);                          BBS_last_access_tm = time(NULL);
225          }                  }
226    
227                  if (bbs_menu.choose_step == 0 && time(NULL) - t_last_action >= 10)                  if (bbs_menu.choose_step == 0 && time(NULL) - t_last_action >= 10)
228                  {                  {
# Line 278  int bbs_center() Line 278  int bbs_center()
278          return 0;          return 0;
279  }  }
280    
281    int bbs_charset_select()
282    {
283            char msg[LINE_BUFFER_LEN];
284            int ch;
285    
286            snprintf(msg, sizeof(msg),
287                             "\rChoose character set in 5 seconds [UTF-8, GBK]: [U/g]");
288    
289            ch = press_any_key_ex(msg, 5);
290            switch (ch)
291            {
292            case 'g':
293            case 'G':
294                    if (io_conv_init("GBK") < 0)
295                    {
296                            log_error("io_conv_init(%s) error\n", "GBK");
297                            return -1;
298                    }
299                    break;
300            default:
301                    log_error("Debug: %d\n", ch);
302            }
303    
304            prints("\r\n");
305            iflush();
306    
307            return 0;
308    }
309    
310  int bbs_main()  int bbs_main()
311  {  {
312          struct sigaction act = {0};          struct sigaction act = {0};
313            char msg[LINE_BUFFER_LEN];
314    
315          // Set signal handler          // Set signal handler
316          act.sa_handler = SIG_IGN;          act.sa_handler = SIG_IGN;
# Line 316  int bbs_main() Line 346  int bbs_main()
346                  goto cleanup;                  goto cleanup;
347          }          }
348    
349            // Set default charset
350            if (io_conv_init(BBS_DEFAULT_CHARSET) < 0)
351            {
352                    log_error("io_conv_init(%s) error\n", BBS_DEFAULT_CHARSET);
353                    goto cleanup;
354            }
355    
356          set_input_echo(0);          set_input_echo(0);
357    
358            // Set user charset
359            bbs_charset_select();
360    
361          // System info          // System info
362          if (bbs_info() < 0)          if (bbs_info() < 0)
363          {          {
# Line 333  int bbs_main() Line 373  int bbs_main()
373          // User login          // User login
374          if (SSH_v2)          if (SSH_v2)
375          {          {
376                  prints("\033[1m%s 欢迎使用ssh方式访问 \033[1;33m按任意键继续...\033[m", BBS_username);                  snprintf(msg, sizeof(msg), "\033[1m%s 欢迎使用ssh方式访问 \033[1;33m按任意键继续...\033[m", BBS_username);
377                  iflush();                  press_any_key_ex(msg, 60);
                 igetch_reset();  
                 igetch_t(MAX_DELAY_TIME);  
378          }          }
379          else if (bbs_login() < 0)          else if (bbs_login() < 0)
380          {          {
# Line 389  int bbs_main() Line 427  int bbs_main()
427          }          }
428    
429  cleanup:  cleanup:
430            // Cleanup iconv
431            io_conv_cleanup();
432    
433          // Cleanup editor memory pool          // Cleanup editor memory pool
434          editor_memory_pool_cleanup();          editor_memory_pool_cleanup();
435    


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

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