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

Diff of /lbbs/src/screen.c

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

Revision 1.105 by sysadm, Wed Jul 2 06:25:02 2025 UTC Revision 1.107 by sysadm, Wed Jul 23 01:16:56 2025 UTC
# Line 40  Line 40 
40  #define STR_TOP_MIDDLE_MAX_LEN 40  #define STR_TOP_MIDDLE_MAX_LEN 40
41  #define STR_TOP_RIGHT_MAX_LEN 40  #define STR_TOP_RIGHT_MAX_LEN 40
42    
43    static const char *get_time_str(char *s, size_t len)
44    {
45            static const char *weekday[] = {
46                    "天", "一", "二", "三", "四", "五", "六"};
47            time_t curtime;
48            struct tm local_tm;
49    
50            time(&curtime);
51            localtime_r(&curtime, &local_tm);
52            size_t j = strftime(s, len, "%b %d %H:%M 星期", &local_tm);
53    
54            if (j == 0 || j + strlen(weekday[local_tm.tm_wday]) + 1 > len)
55            {
56                    return NULL;
57            }
58    
59            strncat(s, weekday[local_tm.tm_wday], len - 1 - j);
60    
61            return s;
62    }
63    
64  void moveto(int row, int col)  void moveto(int row, int col)
65  {  {
66          if (row >= 0)          if (row >= 0)
# Line 185  static int _str_input(char *buffer, int Line 206  static int _str_input(char *buffer, int
206                                  ch = igetch(100);                                                // 0.1 second                                  ch = igetch(100);                                                // 0.1 second
207                                  if (ch == KEY_NULL || ch == KEY_TIMEOUT) // Ignore received bytes if no futher input                                  if (ch == KEY_NULL || ch == KEY_TIMEOUT) // Ignore received bytes if no futher input
208                                  {                                  {
209    #ifdef _DEBUG
210                                          log_error("Ignore %d bytes of incomplete UTF8 character\n", str_len);                                          log_error("Ignore %d bytes of incomplete UTF8 character\n", str_len);
211    #endif
212                                          str_len = 0;                                          str_len = 0;
213                                          break;                                          break;
214                                  }                                  }


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

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