Change max. length of mail message from magic number to a define.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@526 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2010-02-25 17:02:32 +00:00
parent 298178b49f
commit 445e54f8f8
2 changed files with 7 additions and 5 deletions

View File

@ -833,7 +833,7 @@ wall_email(char *from, char *msg)
graceful_exit(121);
}
if (strlen(msg) >= 80) {
if (strlen(msg) >= DGL_MAILMSGLEN) {
fprintf(stderr, "Error: wall: message too long!\n");
debug_write("wall: message too long");
graceful_exit(120);
@ -870,7 +870,7 @@ void
domailuser (char *username)
{
unsigned int len, i;
char *spool_fn, message[81];
char *spool_fn, message[DGL_MAILMSGLEN+1];
FILE *user_spool = NULL;
time_t now;
int mail_empty = 1;
@ -896,11 +896,12 @@ domailuser (char *username)
/* print the enter your message line */
clear ();
drawbanner (&banner, 1, 1);
mvaddstr (5, 1,
"Enter your message here. It is to be one line only and 80 characters or less.");
mvprintw (5, 1,
"Enter your message here. It is to be one line only and %i characters or less.",
DGL_MAILMSGLEN);
mvaddstr (7, 1, "=> ");
if (mygetnstr (message, 80, 1) != OK)
if (mygetnstr (message, DGL_MAILMSGLEN, 1) != OK)
return;
for (i = 0; i < strlen (message); i++)

View File

@ -17,6 +17,7 @@
#define DGL_PLAYERNAMELEN 30 /* max. length of player name */
#define DGL_PASSWDLEN 20 /* max. length of passwords */
#define DGL_MAILMSGLEN 80 /* max. length of mail message */
typedef enum
{