Merge pull request #26 from wyld-sw/master

Migrated away from using asctime() and ctime() - in favor of strftime().
This commit is contained in:
Jason "Opie" Babo
2015-09-18 14:30:14 +01:00
10 changed files with 178 additions and 176 deletions

View File

@@ -286,21 +286,21 @@ AC-CONFIDENCE ARMOR-CLASS ARMOUR-CLASS AC-APPLY
is at protecting you. When you don armor, any AC apply that armor has is is at protecting you. When you don armor, any AC apply that armor has is
subtracted from your standard (naked) AC value, modified depending on where on subtracted from your standard (naked) AC value, modified depending on where on
the body you are wearing the armor. Some items have a special bonus, and the body you are wearing the armor. Some items have a special bonus, and
subtract from the AC directly. Negative AC is better. Modifiers: Body X3, subtract from the AC directly. Negative AC is better.
head and legs X2.
See also: MEDIT-AC See Also: ARMOR-SPELL
#31 #0
AC-CONFIDENCE ARMOR-CLASS ARMOUR-CLASS AC-APPLY AC-CONFIDENCE ARMOR-CLASS ARMOUR-CLASS AC-APPLY
Your Armor Class (often called AC) is an expression for how good your armor Your Armor Class (often called AC) is an expression for how good your armor
is at protecting you. When you don armor, any AC apply that armor has is is at protecting you. When you don armor, any AC apply that armor has is
subtracted from your standard (naked) AC value, modified depending on where on subtracted from your standard (naked) AC value, modified depending on where on
the body you are wearing the armor. Some items have a special bonus, and the body you are wearing the armor. Some items have a special bonus, and
subtract from the AC directly. Negative AC is better. subtract from the AC directly. Negative AC is better. Modifiers: Body X3,
head and legs X2.
See Also: ARMOR-SPELL See also: MEDIT-AC
#0 #31
ACRONYMS TERMINOLOGY VOCABULARY ACRONYMS TERMINOLOGY VOCABULARY
Here are some common terms used in building, and TBA zone: Here are some common terms used in building, and TBA zone:
@@ -1184,36 +1184,6 @@ NOTE: Buildwalk does not autosave on exit. You must type SAVEALL. This way if
See also: TOGGLE, SAVEALL, REDIT, OLC, RLIST, DIG See also: TOGGLE, SAVEALL, REDIT, OLC, RLIST, DIG
#31 #31
BULLETINS BOARDS BULLETIN-BOARDS MESSAGE-BOARDS POSTING
Bulletin boards are the forum of inter-player communication on the MUD.
There are different bulletin boards for different purposes -- for example,
a standard mortal board, a board for immortals, a board for fun "social"
messages, etc. Naturally, not all players may be allowed to read all
types of boards.
Type "LOOK BOARD" to see the messages already posted on a board. Type
"WRITE <subject>" to post a message to a board; terminate a message with
a '/s' as the first characters on a line. Type "READ <number>" to read a
post. Type "REMOVE <number>" to remove your own messages.
Examples:
> look at board
> write Crash Bug I found!
[writes the message; terminates with '/s']
> look at board
> read 6
> remove 6
Boards are just a normal object with a special procedure attached in the
MUD's code. Ask your friendly implementor if you need to make one.
@uRoom - Board@n
1204 - Immortal Board
1290 - Social Board
See also: MAIL, READ, WRITE, SPECIALS
#31
BULLETINS BOARDS BULLETIN-BOARDS MESSAGE-BOARDS BULLETINS BOARDS BULLETIN-BOARDS MESSAGE-BOARDS
Bulletin boards are the forum of inter-player communication on the MUD. Bulletin boards are the forum of inter-player communication on the MUD.
@@ -1244,6 +1214,36 @@ MUD's code. Ask your friendly implementor if you need to make one.
See also: MAIL, READ, WRITE See also: MAIL, READ, WRITE
#0 #0
BULLETINS BOARDS BULLETIN-BOARDS MESSAGE-BOARDS POSTING
Bulletin boards are the forum of inter-player communication on the MUD.
There are different bulletin boards for different purposes -- for example,
a standard mortal board, a board for immortals, a board for fun "social"
messages, etc. Naturally, not all players may be allowed to read all
types of boards.
Type "LOOK BOARD" to see the messages already posted on a board. Type
"WRITE <subject>" to post a message to a board; terminate a message with
a '/s' as the first characters on a line. Type "READ <number>" to read a
post. Type "REMOVE <number>" to remove your own messages.
Examples:
> look at board
> write Crash Bug I found!
[writes the message; terminates with '/s']
> look at board
> read 6
> remove 6
Boards are just a normal object with a special procedure attached in the
MUD's code. Ask your friendly implementor if you need to make one.
@uRoom - Board@n
1204 - Immortal Board
1290 - Social Board
See also: MAIL, READ, WRITE, SPECIALS
#31
BURNING-HANDS BURNING-HANDS
Usage : cast 'burning hands' <victim> Usage : cast 'burning hands' <victim>
@@ -1989,29 +1989,6 @@ See also: REMOTE
#31 #31
CONTROL-WEATHER CONTROL-WEATHER
Usage : cast 'control weather' <'better' | 'worse'>
Accumulative: Yes
This spell will change the "course" of the current weather.
Example:
> cast 'control wea' worse
See also: %WEATHER%, WEATHER
#31
CONTROL-WEATHER
Usage : cast 'control weather' <'better' | 'worse'>
Accumulative: Yes
This spell will change the "course" of the current weather.
Example:
> cast 'control wea' worse
#0
CONTROL-WEATHER
Usage : cast 'control weather' <'better' | 'worse'> Usage : cast 'control weather' <'better' | 'worse'>
Accumulative: Yes Accumulative: Yes
Duration : - Duration : -
@@ -2023,6 +2000,29 @@ Example:
> cast 'control wea' worse > cast 'control wea' worse
#0 #0
CONTROL-WEATHER
Usage : cast 'control weather' <'better' | 'worse'>
Accumulative: Yes
This spell will change the "course" of the current weather.
Example:
> cast 'control wea' worse
#0
CONTROL-WEATHER
Usage : cast 'control weather' <'better' | 'worse'>
Accumulative: Yes
This spell will change the "course" of the current weather.
Example:
> cast 'control wea' worse
See also: %WEATHER%, WEATHER
#31
COPYOVERS COPYOVERS
Usage: copyover Usage: copyover
@@ -4252,7 +4252,7 @@ all the / commands do).
#31 #31
LAST LASTLISTS LAST LASTLISTS
Usage: last [player_name | all] [#] Usage: last [[#] [player_name] | all | *]
For checking the last time(s) a person logged on, their sitename, and their For checking the last time(s) a person logged on, their sitename, and their
ID number. This now works similar to the unix version of 'last'. This will ID number. This now works similar to the unix version of 'last'. This will
@@ -10259,6 +10259,27 @@ can attain the next level.
#0 #0
TOGGLES CONFIGURE SETTINGS TOGGLES CONFIGURE SETTINGS
Usage: toggle
toggle <option> <argument>
TOGGLE shows you the current values of various toggles available on the MUD.
This command can also be used to change these values, if used with the correct
argument. When a toggle is set, it will be saved in that state until the next
time you change it.
Hit Pnt Display: OFF Brief: OFF Summonable: OFF
Move Display: OFF Compact: ON Quest: OFF
Mana Display: OFF NoTell: OFF NoRepeat: OFF
AutoExits: OFF NoShout: OFF Wimpy: OFF
NoGossip: OFF NoAuction: OFF NoGrats: OFF
AutoLoot: ON AutoGold: ON AutoSplit: ON
AutoSac: ON AutoAssist: ON AFK: OFF
Pagelength: 23 Color: off
See also: DISPLAY, NOSHOUT, NOSUMM, NOTELL, QUEST, REPEAT, WIMP
#0
TOGGLES CONFIGURE SETTINGS
Usage: toggle Usage: toggle
toggle <option> <argument> toggle <option> <argument>
@@ -10281,27 +10302,6 @@ Hit Pnt Display: OFF Brief: OFF Summonable: OFF
Pagelength: 32 Screenwidth: 80 AFK: OFF Pagelength: 32 Screenwidth: 80 AFK: OFF
Autokey: OFF Autodoor: OFF Color: on Autokey: OFF Autodoor: OFF Color: on
See also: DISPLAY, NOSHOUT, NOSUMM, NOTELL, QUEST, REPEAT, WIMP
#0
TOGGLES CONFIGURE SETTINGS
Usage: toggle
toggle <option> <argument>
TOGGLE shows you the current values of various toggles available on the MUD.
This command can also be used to change these values, if used with the correct
argument. When a toggle is set, it will be saved in that state until the next
time you change it.
Hit Pnt Display: OFF Brief: OFF Summonable: OFF
Move Display: OFF Compact: ON Quest: OFF
Mana Display: OFF NoTell: OFF NoRepeat: OFF
AutoExits: OFF NoShout: OFF Wimpy: OFF
NoGossip: OFF NoAuction: OFF NoGrats: OFF
AutoLoot: ON AutoGold: ON AutoSplit: ON
AutoSac: ON AutoAssist: ON AFK: OFF
Pagelength: 23 Color: off
See also: DISPLAY, NOSHOUT, NOSUMM, NOTELL, QUEST, REPEAT, WIMP See also: DISPLAY, NOSHOUT, NOSUMM, NOTELL, QUEST, REPEAT, WIMP
#0 #0
TRACK TRAIL TRACK TRAIL

View File

@@ -996,7 +996,6 @@ ACMD(do_time)
break; break;
} }
} }
send_to_char(ch, "The %d%s Day of the %s, Year %d.\r\n", send_to_char(ch, "The %d%s Day of the %s, Year %d.\r\n",
day, suf, month_name[time_info.month], time_info.year); day, suf, month_name[time_info.month], time_info.year);
} }
@@ -1363,7 +1362,7 @@ ACMD(do_who)
ACMD(do_users) ACMD(do_users)
{ {
char line[200], line2[220], idletime[10], classname[20]; char line[200], line2[220], idletime[10], classname[20];
char state[30], *timeptr, mode; char state[30], timestr[9], mode;
char name_search[MAX_INPUT_LENGTH], host_search[MAX_INPUT_LENGTH]; char name_search[MAX_INPUT_LENGTH], host_search[MAX_INPUT_LENGTH];
struct char_data *tch; struct char_data *tch;
struct descriptor_data *d; struct descriptor_data *d;
@@ -1463,9 +1462,7 @@ ACMD(do_users)
} else } else
strcpy(classname, " - "); strcpy(classname, " - ");
timeptr = asctime(localtime(&d->login_time)); strftime(timestr, sizeof(timestr), "%H:%M:%S", localtime(&(d->login_time)));
timeptr += 11;
*(timeptr + 8) = '\0';
if (STATE(d) == CON_PLAYING && d->original) if (STATE(d) == CON_PLAYING && d->original)
strcpy(state, "Switched"); strcpy(state, "Switched");
@@ -1482,7 +1479,7 @@ ACMD(do_users)
d->original && d->original->player.name ? d->original->player.name : d->original && d->original->player.name ? d->original->player.name :
d->character && d->character->player.name ? d->character->player.name : d->character && d->character->player.name ? d->character->player.name :
"UNDEFINED", "UNDEFINED",
state, idletime, timeptr); state, idletime, timestr);
if (d->host && *d->host) if (d->host && *d->host)
sprintf(line + strlen(line), "[%s]\r\n", d->host); sprintf(line + strlen(line), "[%s]\r\n", d->host);
@@ -2405,8 +2402,7 @@ ACMD(do_whois)
send_to_char(ch, "Level: %d\r\n", GET_LEVEL(victim)); send_to_char(ch, "Level: %d\r\n", GET_LEVEL(victim));
if (!(GET_LEVEL(victim) < LVL_IMMORT) || (GET_LEVEL(ch) >= GET_LEVEL(victim))) { if (!(GET_LEVEL(victim) < LVL_IMMORT) || (GET_LEVEL(ch) >= GET_LEVEL(victim))) {
strcpy (buf, (char *) asctime(localtime(&(victim->player.time.logon)))); strftime(buf, sizeof(buf), "%a %b %d %Y", localtime(&(victim->player.time.logon)));
buf[10] = '\0';
hours = (time(0) - victim->player.time.logon) / 3600; hours = (time(0) - victim->player.time.logon) / 3600;

View File

@@ -100,7 +100,7 @@ ACMD(do_kill)
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
struct char_data *vict; struct char_data *vict;
if (GET_LEVEL(ch) < LVL_IMMORT || IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_NOHASSLE)) { if (GET_LEVEL(ch) < LVL_GRGOD || IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_NOHASSLE)) {
do_hit(ch, argument, cmd, subcmd); do_hit(ch, argument, cmd, subcmd);
return; return;
} }

View File

@@ -764,16 +764,14 @@ static void do_stat_character(struct char_data *ch, struct char_data *k)
if (!IS_NPC(k)) { if (!IS_NPC(k)) {
char buf1[64], buf2[64]; char buf1[64], buf2[64];
strlcpy(buf1, asctime(localtime(&(k->player.time.birth))), sizeof(buf1)); strftime(buf1, sizeof(buf1), "%a %b %d %Y", localtime(&(k->player.time.birth)));
strlcpy(buf2, asctime(localtime(&(k->player.time.logon))), sizeof(buf2)); strftime(buf2, sizeof(buf2), "%a %b %d %Y", localtime(&(k->player.time.logon)));
buf1[10] = buf2[10] = '\0';
send_to_char(ch, "Created: [%s], Last Logon: [%s], Played [%dh %dm], Age [%d]\r\n", send_to_char(ch, "Created: [%s], Last Logon: [%s]\r\n", buf1, buf2);
buf1, buf2, k->player.time.played / 3600,
((k->player.time.played % 3600) / 60), age(k)->year);
send_to_char(ch, "STL[%d]/per[%d]/NSTL[%d]", send_to_char(ch, "Played: [%dh %dm], Age: [%d], STL[%d]/per[%d]/NSTL[%d]",
GET_PRACTICES(k), int_app[GET_INT(k)].learn, k->player.time.played / 3600, (k->player.time.played % 3600) / 60,
age(k)->year, GET_PRACTICES(k), int_app[GET_INT(k)].learn,
wis_app[GET_WIS(k)].bonus); wis_app[GET_WIS(k)].bonus);
/* Display OLC zone for immorts. */ /* Display OLC zone for immorts. */
if (GET_LEVEL(k) >= LVL_BUILDER) { if (GET_LEVEL(k) >= LVL_BUILDER) {
@@ -1766,7 +1764,7 @@ ACMD(do_wizlock)
ACMD(do_date) ACMD(do_date)
{ {
char *tmstr; char timestr[25];
time_t mytime; time_t mytime;
int d, h, m; int d, h, m;
@@ -1775,18 +1773,17 @@ ACMD(do_date)
else else
mytime = boot_time; mytime = boot_time;
tmstr = (char *) asctime(localtime(&mytime)); strftime(timestr, sizeof(timestr), "%c", localtime(&mytime));
*(tmstr + strlen(tmstr) - 1) = '\0';
if (subcmd == SCMD_DATE) if (subcmd == SCMD_DATE)
send_to_char(ch, "Current machine time: %s\r\n", tmstr); send_to_char(ch, "Current machine time: %s\r\n", timestr);
else { else {
mytime = time(0) - boot_time; mytime = time(0) - boot_time;
d = mytime / 86400; d = mytime / 86400;
h = (mytime / 3600) % 24; h = (mytime / 3600) % 24;
m = (mytime / 60) % 60; m = (mytime / 60) % 60;
send_to_char(ch, "Up since %s: %d day%s, %d:%02d\r\n", tmstr, d, d == 1 ? "" : "s", h, m); send_to_char(ch, "Up since %s: %d day%s, %d:%02d\r\n", timestr, d, d == 1 ? "" : "s", h, m);
} }
} }
@@ -1977,6 +1974,7 @@ void list_llog_entries(struct char_data *ch)
FILE *fp; FILE *fp;
struct last_entry llast; struct last_entry llast;
int i; int i;
char timestr[25];
if(!(fp=fopen(LAST_FILE,"r"))) { if(!(fp=fopen(LAST_FILE,"r"))) {
log("bad things."); log("bad things.");
@@ -1985,9 +1983,11 @@ void list_llog_entries(struct char_data *ch)
send_to_char(ch, "Last log\r\n"); send_to_char(ch, "Last log\r\n");
i = fread(&llast, sizeof(struct last_entry), 1, fp); i = fread(&llast, sizeof(struct last_entry), 1, fp);
strftime(timestr, sizeof(timestr), "%a %b %d %Y %H:%M:%S", localtime(&llast.time));
while(!feof(fp)) { while(!feof(fp)) {
send_to_char(ch, "%10s\t%d\t%s\t%s", llast.username, llast.punique, send_to_char(ch, "%10s\t%d\t%s\t%s\r\n", llast.username, llast.punique,
last_array[llast.close_type], ctime(&llast.time)); last_array[llast.close_type], timestr);
i = fread(&llast, sizeof(struct last_entry), 1, fp); i = fread(&llast, sizeof(struct last_entry), 1, fp);
} }
} }
@@ -2005,12 +2005,13 @@ static struct char_data *is_in_game(long idnum) {
ACMD(do_last) ACMD(do_last)
{ {
char arg[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH], timestr[25], to[6];
char deltastr[6];
time_t delta;
struct char_data *vict = NULL; struct char_data *vict = NULL;
struct char_data *temp; struct char_data *temp;
int recs, i, num = 0; int recs, i, num = 0;
FILE *fp; FILE *fp;
time_t delta;
struct last_entry mlast; struct last_entry mlast;
*name = '\0'; *name = '\0';
@@ -2018,7 +2019,7 @@ ACMD(do_last)
if (*argument) { /* parse it */ if (*argument) { /* parse it */
half_chop(argument, arg, argument); half_chop(argument, arg, argument);
while (*arg) { while (*arg) {
if ((*arg == '*') && (GET_LEVEL(ch) == LVL_IMPL)) { if ((*arg == '*' || !strcmp(arg, "all")) && (GET_LEVEL(ch) == LVL_IMPL)) {
list_llog_entries(ch); list_llog_entries(ch);
return; return;
} }
@@ -2043,11 +2044,12 @@ ACMD(do_last)
return; return;
} }
send_to_char(ch, "[%5ld] [%2d %s] %-12s : %-18s : %-20s\r\n", strftime(timestr, sizeof(timestr), "%a %b %d %H:%M:%S %Y", localtime(&(vict->player.time.logon)));
send_to_char(ch, "[%5ld] [%2d %s] %-12s : %-18s : %-24s\r\n",
GET_IDNUM(vict), (int) GET_LEVEL(vict), GET_IDNUM(vict), (int) GET_LEVEL(vict),
class_abbrevs[(int) GET_CLASS(vict)], GET_NAME(vict), class_abbrevs[(int) GET_CLASS(vict)], GET_NAME(vict),
GET_HOST(vict) && *GET_HOST(vict) ? GET_HOST(vict) : "(NOHOST)", GET_HOST(vict) && *GET_HOST(vict) ? GET_HOST(vict) : "(NOHOST)", timestr);
ctime(&vict->player.time.logon));
free_char(vict); free_char(vict);
return; return;
} }
@@ -2069,15 +2071,18 @@ ACMD(do_last)
i = fread(&mlast,sizeof(struct last_entry),1,fp); i = fread(&mlast,sizeof(struct last_entry),1,fp);
fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR); fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR);
if(!*name ||(*name && !str_cmp(name, mlast.username))) { if(!*name ||(*name && !str_cmp(name, mlast.username))) {
send_to_char(ch,"%10.10s %20.20s %16.16s - ", strftime(timestr, sizeof(timestr), "%a %b %d %Y %H:%M", localtime(&mlast.time));
mlast.username, mlast.hostname, ctime(&mlast.time)); send_to_char(ch,"%10.10s %20.20s %20.21s - ",
mlast.username, mlast.hostname, timestr);
if((temp=is_in_game(mlast.idnum)) && mlast.punique == GET_PREF(temp)) { if((temp=is_in_game(mlast.idnum)) && mlast.punique == GET_PREF(temp)) {
send_to_char(ch, "Still Playing "); send_to_char(ch, "Still Playing ");
} else { } else {
send_to_char(ch, "%5.5s ",ctime(&mlast.close_time)+11); delta = mlast.close_time - mlast.time;
delta=mlast.close_time - mlast.time; strftime(to, sizeof(to), "%H:%M", localtime(&mlast.close_time));
send_to_char(ch, "(%5.5s) ",asctime(gmtime(&delta))+11); strftime(deltastr, sizeof(deltastr), "%H:%M", gmtime(&delta));
send_to_char(ch, "%s", last_array[mlast.close_type]);
send_to_char(ch, "%5.5s (%5.5s) %s", to, deltastr,
last_array[mlast.close_type]);
} }
send_to_char(ch, "\r\n"); send_to_char(ch, "\r\n");
@@ -2543,7 +2548,9 @@ ACMD(do_show)
break; break;
/* show player */ /* show player */
case 2: case 2: {
char buf1[64], buf2[64];
if (!*value) { if (!*value) {
send_to_char(ch, "A name would help.\r\n"); send_to_char(ch, "A name would help.\r\n");
return; return;
@@ -2558,22 +2565,24 @@ ACMD(do_show)
free_char(vict); free_char(vict);
return; return;
} }
strftime(buf1, sizeof(buf1), "%a %b %d %H:%M:%S %Y", localtime(&(vict->player.time.birth)));
strftime(buf2, sizeof(buf2), "%a %b %d %H:%H:%S %Y", localtime(&(vict->player.time.logon)));
send_to_char(ch, "Player: %-12s (%s) [%2d %s]\r\n", GET_NAME(vict), send_to_char(ch, "Player: %-12s (%s) [%2d %s]\r\n", GET_NAME(vict),
genders[(int) GET_SEX(vict)], GET_LEVEL(vict), class_abbrevs[(int) genders[(int) GET_SEX(vict)], GET_LEVEL(vict), class_abbrevs[(int)
GET_CLASS(vict)]); GET_CLASS(vict)]);
send_to_char(ch, "Au: %-8d Bal: %-8d Exp: %-8d Align: %-5d Lessons: %-3d\r\n", send_to_char(ch, "Gold: %-8d Bal: %-8d Exp: %-8d Align: %-5d Lessons: %-3d\r\n",
GET_GOLD(vict), GET_BANK_GOLD(vict), GET_EXP(vict), GET_GOLD(vict), GET_BANK_GOLD(vict), GET_EXP(vict),
GET_ALIGNMENT(vict), GET_PRACTICES(vict)); GET_ALIGNMENT(vict), GET_PRACTICES(vict));
send_to_char(ch, "Started: %-25.25s Last: %-25.25s\r\n", buf1, buf2);
/* ctime() uses static buffer: do not combine. */ send_to_char(ch, "Played: %dh %dm\r\n",
send_to_char(ch, "Started: %-20.16s ", ctime(&vict->player.time.birth));
send_to_char(ch, "Last: %-20.16s Played: %3dh %2dm\r\n",
ctime(&vict->player.time.logon),
(int) (vict->player.time.played / 3600), (int) (vict->player.time.played / 3600),
(int) (vict->player.time.played / 60 % 60)); (int) (vict->player.time.played / 60 % 60));
free_char(vict); free_char(vict);
break; break;
}
/* show rent */ /* show rent */
case 3: case 3:
if (!*value) { if (!*value) {
@@ -4412,7 +4421,7 @@ ACMD(do_file)
ACMD(do_changelog) ACMD(do_changelog)
{ {
time_t rawtime; time_t rawtime;
char tmstr[MAX_INPUT_LENGTH], line[READ_SIZE], last_buf[READ_SIZE], char timestr[12], line[READ_SIZE], last_buf[READ_SIZE],
buf[READ_SIZE]; buf[READ_SIZE];
FILE *fl, *new; FILE *fl, *new;
@@ -4452,9 +4461,9 @@ ACMD(do_changelog)
} }
rawtime = time(0); rawtime = time(0);
strftime(tmstr, sizeof(tmstr), "%b %d %Y", localtime(&rawtime)); strftime(timestr, sizeof(timestr), "%b %d %Y", localtime(&rawtime));
sprintf(buf, "[%s] - %s", tmstr, GET_NAME(ch)); sprintf(buf, "[%s] - %s", timestr, GET_NAME(ch));
fprintf(new, "%s\n", buf); fprintf(new, "%s\n", buf);
fprintf(new, " %s\n", argument); fprintf(new, " %s\n", argument);
@@ -4476,7 +4485,7 @@ ACMD(do_changelog)
ACMD(do_plist) ACMD(do_plist)
{ {
int i, len = 0, count = 0; int i, len = 0, count = 0;
char mode, buf[MAX_STRING_LENGTH * 20], name_search[MAX_NAME_LENGTH], time_str[MAX_STRING_LENGTH]; char mode, buf[MAX_STRING_LENGTH * 20], name_search[MAX_NAME_LENGTH], timestr[MAX_STRING_LENGTH];
struct time_info_data time_away; struct time_info_data time_away;
int low = 0, high = LVL_IMPL, low_day = 0, high_day = 10000, low_hr = 0, high_hr = 24; int low = 0, high = LVL_IMPL, low_day = 0, high_day = 10000, low_hr = 0, high_hr = 24;
@@ -4549,12 +4558,11 @@ ACMD(do_plist)
if (time_away.hours > high_hr || time_away.hours < low_hr) if (time_away.hours > high_hr || time_away.hours < low_hr)
continue; continue;
strcpy(time_str, asctime(localtime(&player_table[i].last))); strftime(timestr, sizeof(timestr), "%c", localtime(&player_table[i].last));
time_str[strlen(time_str) - 1] = '\0';
len += snprintf(buf + len, sizeof(buf) - len, "[%3ld] (%2d) %c%-15s %s\r\n", len += snprintf(buf + len, sizeof(buf) - len, "[%3ld] (%2d) %c%-15s %s\r\n",
player_table[i].id, player_table[i].level, player_table[i].id, player_table[i].level,
UPPER(*player_table[i].name), player_table[i].name + 1, time_str); UPPER(*player_table[i].name), player_table[i].name + 1, timestr);
count++; count++;
} }
snprintf(buf + len, sizeof(buf) - len, "%s-------------------------------------%s\r\n" snprintf(buf + len, sizeof(buf) - len, "%s-------------------------------------%s\r\n"
@@ -4949,7 +4957,7 @@ void free_recent_players(void)
ACMD(do_recent) ACMD(do_recent)
{ {
time_t ct; time_t ct;
char *tmstr, arg[MAX_INPUT_LENGTH]; char timestr[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
int hits = 0, limit = 0, count = 0; int hits = 0, limit = 0, count = 0;
struct recent_player *this; struct recent_player *this;
bool loc; bool loc;
@@ -4962,9 +4970,9 @@ ACMD(do_recent)
} }
if (GET_LEVEL(ch) >= LVL_GRGOD) { /* If High-Level Imm, then show Host IP */ if (GET_LEVEL(ch) >= LVL_GRGOD) { /* If High-Level Imm, then show Host IP */
send_to_char(ch, " ID | DATE/TIME | HOST IP | Player Name\r\n"); send_to_char(ch, " ID | DATE/TIME | HOST IP | Player Name\r\n");
} else { } else {
send_to_char(ch, " ID | DATE/TIME | Player Name\r\n"); send_to_char(ch, " ID | DATE/TIME | Player Name\r\n");
} }
this = recent_list; this = recent_list;
@@ -4973,8 +4981,8 @@ ACMD(do_recent)
loc = FALSE; loc = FALSE;
hits++; hits++;
ct = this->time; ct = this->time;
tmstr = asctime(localtime(&ct)); strftime(timestr, sizeof(timestr), "%a %b %d %H:%M:%S %Y", localtime(&ct));
*(tmstr + strlen(tmstr) - 1) = '\0'; /* Cut off last char */
if (this->host && *(this->host)) { if (this->host && *(this->host)) {
if (!strcmp(this->host, "localhost")) loc = TRUE; if (!strcmp(this->host, "localhost")) loc = TRUE;
} }
@@ -4984,21 +4992,21 @@ ACMD(do_recent)
if (GET_LEVEL(ch) >= LVL_GRGOD) /* If High-Level Imm, then show Host IP */ if (GET_LEVEL(ch) >= LVL_GRGOD) /* If High-Level Imm, then show Host IP */
{ {
if (this->new_player == TRUE) { if (this->new_player == TRUE) {
send_to_char(ch, "%3d | %-19.19s | %s%-37s%s | %s %s(New Player)%s\r\n", this->vnum, tmstr, loc ? QRED : "", this->host, QNRM, this->name, QYEL, QNRM); send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s %s(New Player)%s\r\n", this->vnum, timestr, loc ? QRED : "", this->host, QNRM, this->name, QYEL, QNRM);
} else if (this->copyover_player == TRUE) { } else if (this->copyover_player == TRUE) {
send_to_char(ch, "%3d | %-19.19s | %s%-37s%s | %s %s(Copyover)%s\r\n", this->vnum, tmstr, loc ? QRED : "", this->host, QNRM, this->name, QCYN, QNRM); send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s %s(Copyover)%s\r\n", this->vnum, timestr, loc ? QRED : "", this->host, QNRM, this->name, QCYN, QNRM);
} else { } else {
send_to_char(ch, "%3d | %-19.19s | %s%-37s%s | %s\r\n", this->vnum, tmstr, loc ? QRED : "", this->host, QNRM, this->name); send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s\r\n", this->vnum, timestr, loc ? QRED : "", this->host, QNRM, this->name);
} }
} }
else else
{ {
if (this->new_player == TRUE) { if (this->new_player == TRUE) {
send_to_char(ch, "%3d | %-19.19s | %s %s(New Player)%s\r\n", this->vnum, tmstr, this->name, QYEL, QNRM); send_to_char(ch, "%3d | %-24.24s | %s %s(New Player)%s\r\n", this->vnum, timestr, this->name, QYEL, QNRM);
} else if (this->copyover_player == TRUE) { } else if (this->copyover_player == TRUE) {
send_to_char(ch, "%3d | %-19.19s | %s %s(Copyover)%s\r\n", this->vnum, tmstr, this->name, QCYN, QNRM); send_to_char(ch, "%3d | %-24.24s | %s %s(Copyover)%s\r\n", this->vnum, timestr, this->name, QCYN, QNRM);
} else { } else {
send_to_char(ch, "%3d | %-19.19s | %s\r\n", this->vnum, tmstr, this->name); send_to_char(ch, "%3d | %-24.24s | %s\r\n", this->vnum, timestr, this->name);
} }
} }
count++; count++;
@@ -5012,9 +5020,8 @@ ACMD(do_recent)
} }
ct = time(0); /* Grab the current time */ ct = time(0); /* Grab the current time */
tmstr = asctime(localtime(&ct)); strftime(timestr, sizeof(timestr), "%c", localtime(&ct));
*(tmstr + strlen(tmstr) - 1) = '\0'; send_to_char(ch, "Current Server Time: %s\r\nShowing %d players since last copyover/reboot\r\n", timestr, hits);
send_to_char(ch, "Current Server Time: %-19.19s\r\nShowing %d players since last copyover/reboot\r\n", tmstr, hits);
} }

View File

@@ -118,7 +118,7 @@ static void write_ban_list(void)
return; return;
} }
#define BAN_LIST_FORMAT "%-25.25s %-8.8s %-10.10s %-16.16s\r\n" #define BAN_LIST_FORMAT "%-25.25s %-8.8s %-15.15s %-16.16s\r\n"
ACMD(do_ban) ACMD(do_ban)
{ {
char flag[MAX_INPUT_LENGTH], site[MAX_INPUT_LENGTH], *nextchar; char flag[MAX_INPUT_LENGTH], site[MAX_INPUT_LENGTH], *nextchar;
@@ -144,8 +144,7 @@ ACMD(do_ban)
for (ban_node = ban_list; ban_node; ban_node = ban_node->next) { for (ban_node = ban_list; ban_node; ban_node = ban_node->next) {
if (ban_node->date) { if (ban_node->date) {
strlcpy(timestr, asctime(localtime(&(ban_node->date))), 10); strftime(timestr, sizeof(timestr), "%a %b %d %Y", localtime(&(ban_node->date)));
timestr[10] = '\0';
} else } else
strcpy(timestr, "Unknown"); /* strcpy: OK (strlen("Unknown") < 16) */ strcpy(timestr, "Unknown"); /* strcpy: OK (strlen("Unknown") < 16) */

View File

@@ -291,7 +291,7 @@ const char *HCONTROL_FORMAT =
void hcontrol_list_houses(struct char_data *ch, char *arg) void hcontrol_list_houses(struct char_data *ch, char *arg)
{ {
int i; int i;
char *timestr, *temp; char *temp;
char built_on[128], last_pay[128], own_name[MAX_NAME_LENGTH + 1]; char built_on[128], last_pay[128], own_name[MAX_NAME_LENGTH + 1];
if (arg && *arg) { if (arg && *arg) {
@@ -315,8 +315,8 @@ void hcontrol_list_houses(struct char_data *ch, char *arg)
return; return;
} }
send_to_char(ch, send_to_char(ch,
"Address Atrium Build Date Guests Owner Last Paymt\r\n" "Address Atrium Build Date Guests Owner Last Paymt\r\n"
"------- ------ ---------- ------ ------------ ----------\r\n"); "------- ------ --------------- ------ ------------ ---------------\r\n");
for (i = 0; i < num_of_houses; i++) { for (i = 0; i < num_of_houses; i++) {
/* Avoid seeing <UNDEF> entries from self-deleted people. -gg 6/21/98 */ /* Avoid seeing <UNDEF> entries from self-deleted people. -gg 6/21/98 */
@@ -324,22 +324,18 @@ void hcontrol_list_houses(struct char_data *ch, char *arg)
continue; continue;
if (house_control[i].built_on) { if (house_control[i].built_on) {
timestr = asctime(localtime(&(house_control[i].built_on))); strftime(built_on, sizeof(built_on), "%a %b %d %Y", localtime(&(house_control[i].built_on)));
*(timestr + 10) = '\0';
strlcpy(built_on, timestr, sizeof(built_on));
} else } else
strcpy(built_on, "Unknown"); /* strcpy: OK (for 'strlen("Unknown") < 128') */ strcpy(built_on, "Unknown"); /* strcpy: OK */
if (house_control[i].last_payment) { if (house_control[i].last_payment) {
timestr = asctime(localtime(&(house_control[i].last_payment))); strftime(last_pay, sizeof(last_pay), "%a %b %d %Y", localtime(&(house_control[i].last_payment)));
*(timestr + 10) = '\0';
strlcpy(last_pay, timestr, sizeof(last_pay));
} else } else
strcpy(last_pay, "None"); /* strcpy: OK (for 'strlen("None") < 128') */ strcpy(last_pay, "None"); /* strcpy: OK */
/* Now we need a copy of the owner's name to capitalize. -gg 6/21/98 */ /* Now we need a copy of the owner's name to capitalize. -gg 6/21/98 */
strcpy(own_name, temp); /* strcpy: OK (names guaranteed <= MAX_NAME_LENGTH+1) */ strcpy(own_name, temp); /* strcpy: OK (names guaranteed <= MAX_NAME_LENGTH+1) */
send_to_char(ch, "%7d %7d %-10s %2d %-12s %s\r\n", send_to_char(ch, "%7d %7d %-15s %2d %-12s %s\r\n",
house_control[i].vnum, house_control[i].atrium, built_on, house_control[i].vnum, house_control[i].atrium, built_on,
house_control[i].num_of_guests, CAP(own_name), last_pay); house_control[i].num_of_guests, CAP(own_name), last_pay);

View File

@@ -453,7 +453,7 @@ static bool is_ibt_logger(IBT_DATA *ibtData, struct char_data *ch)
ACMD(do_ibt) ACMD(do_ibt)
{ {
char arg[MAX_STRING_LENGTH], arg2[MAX_STRING_LENGTH]; char arg[MAX_STRING_LENGTH], arg2[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH], *arg_text, imp[30]; char buf[MAX_STRING_LENGTH], *arg_text, imp[30], timestr[128];
int i, num_res, num_unres; int i, num_res, num_unres;
IBT_DATA *ibtData, *first_ibt, *last_ibt; IBT_DATA *ibtData, *first_ibt, *last_ibt;
int ano=0; int ano=0;
@@ -516,9 +516,13 @@ ACMD(do_ibt)
if ((GET_LEVEL(ch) < LVL_IMMORT) && (!is_ibt_logger(ibtData, ch))) { if ((GET_LEVEL(ch) < LVL_IMMORT) && (!is_ibt_logger(ibtData, ch))) {
send_to_char(ch, "Sorry but you may only view %ss you have posted yourself.\n\r", ibt_types[subcmd]); send_to_char(ch, "Sorry but you may only view %ss you have posted yourself.\n\r", ibt_types[subcmd]);
} else { } else {
send_to_char(ch, "%s%s by %s%s\r\n",QCYN, ibt_types[subcmd], QYEL, ibtData->name); send_to_char(ch, "%s%s by %s%s\r\n",QCYN, ibt_types[subcmd], QYEL, ibtData->name);
send_to_char(ch, "%sSubmitted: %s%s", QCYN, QYEL, ibtData->dated ? ctime((const time_t*)&ibtData->dated) : "Unknown\r\n"); if (ibtData->dated != 0) {
strftime(timestr, sizeof(timestr), "%c", localtime(&(ibtData->dated)));
} else {
strcpy(timestr, "Unknown");
}
send_to_char(ch, "%sSubmitted: %s%s\r\n", QCYN, QYEL, timestr);
if (GET_LEVEL(ch) >= LVL_IMMORT) { if (GET_LEVEL(ch) >= LVL_IMMORT) {
send_to_char(ch, "%sLevel: %s%d\r\n",QCYN, QYEL, ibtData->level); send_to_char(ch, "%sLevel: %s%d\r\n",QCYN, QYEL, ibtData->level);
send_to_char(ch, "%sRoom : %s%d\r\n",QCYN, QYEL, ibtData->room); send_to_char(ch, "%sRoom : %s%d\r\n",QCYN, QYEL, ibtData->room);

View File

@@ -211,10 +211,9 @@ char *read_delete(long recipient)
if (!record_to_keep) if (!record_to_keep)
sprintf(buf, "Mail system error - please report"); sprintf(buf, "Mail system error - please report");
else { else {
char *tmstr, *from, *to; char timestr[25], *from, *to;
tmstr = asctime(localtime(&record_to_keep->sent_time)); strftime(timestr, sizeof(timestr), "%c", localtime(&(record_to_keep->sent_time)));
*(tmstr + strlen(tmstr) - 1) = '\0';
from = get_name_by_id(record_to_keep->sender); from = get_name_by_id(record_to_keep->sender);
to = get_name_by_id(record_to_keep->recipient); to = get_name_by_id(record_to_keep->recipient);
@@ -227,7 +226,7 @@ char *read_delete(long recipient)
"\r\n" "\r\n"
"%s", "%s",
tmstr, timestr,
to ? to : "Unknown", to ? to : "Unknown",
from ? from : "Unknown", from ? from : "Unknown",
record_to_keep->body ? record_to_keep->body : "No message" ); record_to_keep->body ? record_to_keep->body : "No message" );

View File

@@ -778,7 +778,7 @@ void tag_argument(char *argument, char *tag)
* deleted by an immortal, or deleted by the auto-wipe system (if enabled). */ * deleted by an immortal, or deleted by the auto-wipe system (if enabled). */
void remove_player(int pfilepos) void remove_player(int pfilepos)
{ {
char filename[MAX_STRING_LENGTH]; char filename[MAX_STRING_LENGTH], timestr[25];
int i; int i;
if (!*player_table[pfilepos].name) if (!*player_table[pfilepos].name)
@@ -790,9 +790,10 @@ void remove_player(int pfilepos)
unlink(filename); unlink(filename);
} }
strftime(timestr, sizeof(timestr), "%c", localtime(&(player_table[pfilepos].last)));
log("PCLEAN: %s Lev: %d Last: %s", log("PCLEAN: %s Lev: %d Last: %s",
player_table[pfilepos].name, player_table[pfilepos].level, player_table[pfilepos].name, player_table[pfilepos].level,
asctime(localtime(&player_table[pfilepos].last))); timestr);
player_table[pfilepos].name[0] = '\0'; player_table[pfilepos].name[0] = '\0';
/* Update index table. */ /* Update index table. */

View File

@@ -196,7 +196,7 @@ int strn_cmp(const char *arg1, const char *arg2, int n)
void basic_mud_vlog(const char *format, va_list args) void basic_mud_vlog(const char *format, va_list args)
{ {
time_t ct = time(0); time_t ct = time(0);
char *time_s = asctime(localtime(&ct)); char timestr[20];
if (logfile == NULL) { if (logfile == NULL) {
puts("SYSERR: Using log() before stream was initialized!"); puts("SYSERR: Using log() before stream was initialized!");
@@ -206,9 +206,9 @@ void basic_mud_vlog(const char *format, va_list args)
if (format == NULL) if (format == NULL)
format = "SYSERR: log() received a NULL format."; format = "SYSERR: log() received a NULL format.";
time_s[strlen(time_s) - 1] = '\0'; strftime(timestr, sizeof(timestr), "%b %d %H:%M:%S %Y", localtime(&ct));
fprintf(logfile, "%-15.15s :: ", time_s + 4); fprintf(logfile, "%-20.20s :: ", timestr);
vfprintf(logfile, format, args); vfprintf(logfile, format, args);
fputc('\n', logfile); fputc('\n', logfile);
fflush(logfile); fflush(logfile);