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

Diff of /lbbs/src/common.c

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

Revision 1.4 by sysadm, Sat Mar 19 08:23:05 2005 UTC Revision 1.6 by sysadm, Sat May 7 09:28:12 2005 UTC
# Line 15  Line 15 
15   *                                                                         *   *                                                                         *
16   ***************************************************************************/   ***************************************************************************/
17    
18    #include "menu.h"
19  #include <time.h>  #include <time.h>
20    
21  //Version information  //Version information
# Line 39  char DB_password[50]; Line 40  char DB_password[50];
40  char DB_database[50];  char DB_database[50];
41    
42  //Common function  //Common function
43  const char*  const char *
44  str_space (char *string, int length)  str_space (char *string, int length)
45  {  {
46    int i;    int i;
47    for (i = 0; i < length; i++)    for (i = 0; i < length; i++)
48    {      {
49      string[i] = ' ';        string[i] = ' ';
50    }      }
51    string[length] = '\0';    string[length] = '\0';
52    return string;    return string;
53  }  }
54    
55  const char*  const char *
56  get_time_str (char *string, size_t length)  get_time_str (char *string, size_t length)
57  {  {
58    char week[10],buffer[256];    char week[10], buffer[256];
59    time_t curtime;    time_t curtime;
60    struct tm *loctime;    struct tm *loctime;
61        
62    curtime = time (NULL);    curtime = time (NULL);
63    loctime = localtime (&curtime);    loctime = localtime (&curtime);
64    
65    strftime (buffer, 256, "%Y年%m月%d日%H:%M:%S ", loctime);    strftime (buffer, 256, "%Y年%m月%d日%H:%M:%S ", loctime);
66      
67    switch (loctime->tm_wday)    switch (loctime->tm_wday)
68    {      {
69      case 0:      case 0:
70        strcpy (week, "星期天");        strcpy (week, "星期天");
71        break;        break;
# Line 86  get_time_str (char *string, size_t lengt Line 87  get_time_str (char *string, size_t lengt
87      case 6:      case 6:
88        strcpy (week, "星期六");        strcpy (week, "星期六");
89        break;        break;
90    }      }
91    strcat (buffer, week);    strcat (buffer, week);
92      
93    strncpy (string, buffer, length);    strncpy (string, buffer, length);
94      
95    return string;    return string;
96  }  }
97    
98    void
99    reload_bbs_menu (int i)
100    {
101      reload_menu (&bbs_menu);
102    }


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

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