| 15 |
* * |
* * |
| 16 |
***************************************************************************/ |
***************************************************************************/ |
| 17 |
|
|
| 18 |
|
#include "menu.h" |
| 19 |
#include <time.h> |
#include <time.h> |
| 20 |
|
|
| 21 |
//Version information |
//Version information |
| 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; |
| 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 |
|
} |