/[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.85 by sysadm, Fri Oct 17 07:07:55 2025 UTC Revision 1.90 by sysadm, Sat Oct 18 06:13:16 2025 UTC
# 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            while (!SYS_server_exit)
290            {
291                    ch = press_any_key_ex(msg, 5);
292                    switch (ch)
293                    {
294                    case KEY_NULL:
295                            return -1;
296                    case KEY_TIMEOUT:
297                    case CR:
298                    case 'u':
299                    case 'U':
300                            return 0;
301                    case 'g':
302                    case 'G':
303                            if (io_conv_init("GBK////TRANSLIT") < 0)
304                            {
305                                    log_error("io_conv_init(%s) error\n", "GBK////TRANSLIT");
306                                    return -1;
307                            }
308                            return 0;
309                    default:
310                            continue;
311                    }
312            }
313    
314            return 0;
315    }
316    
317  int bbs_main()  int bbs_main()
318  {  {
319          struct sigaction act = {0};          struct sigaction act = {0};
320            char msg[LINE_BUFFER_LEN];
321    
322          // Set signal handler          // Set signal handler
323          act.sa_handler = SIG_IGN;          act.sa_handler = SIG_IGN;
# Line 316  int bbs_main() Line 353  int bbs_main()
353                  goto cleanup;                  goto cleanup;
354          }          }
355    
356            // Set default charset
357            if (io_conv_init(BBS_DEFAULT_CHARSET) < 0)
358            {
359                    log_error("io_conv_init(%s) error\n", BBS_DEFAULT_CHARSET);
360                    goto cleanup;
361            }
362    
363          set_input_echo(0);          set_input_echo(0);
364    
365            // Set user charset
366            bbs_charset_select();
367    
368          // System info          // System info
369          if (bbs_info() < 0)          if (bbs_info() < 0)
370          {          {
# Line 333  int bbs_main() Line 380  int bbs_main()
380          // User login          // User login
381          if (SSH_v2)          if (SSH_v2)
382          {          {
383                  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);
384                  iflush();                  press_any_key_ex(msg, 60);
                 igetch_reset();  
                 while (!SYS_server_exit && igetch_t(MAX_DELAY_TIME) == 0)  
                         ;  
385          }          }
386          else if (bbs_login() < 0)          else if (bbs_login() < 0)
387          {          {
# Line 390  int bbs_main() Line 434  int bbs_main()
434          }          }
435    
436  cleanup:  cleanup:
437            // Cleanup iconv
438            io_conv_cleanup();
439    
440          // Cleanup editor memory pool          // Cleanup editor memory pool
441          editor_memory_pool_cleanup();          editor_memory_pool_cleanup();
442    


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

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