File: cmdwall.c

package info (click to toggle)
xshipwars 1.32-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 17,176 kB
  • ctags: 6,357
  • sloc: ansic: 157,152; makefile: 226; sh: 75
file content (37 lines) | stat: -rw-r--r-- 669 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "swserv.h"


/*
 *	Prints message to all connections.
 */
int CmdWall(int condescriptor, char *arg)
{
	char mesg[CS_MESG_MAX];
        char sndbuf[CS_DATA_MAX_LEN];
	long object_num;
	xsw_object_struct *obj_ptr;


	if(arg == NULL) return(-1);
	if(!ConIsLoggedIn(condescriptor)) return(-1);	

	object_num = connection[condescriptor]->object_num;
	if(DBIsObjectGarbage(object_num))
	    return(-1);
	else
	    obj_ptr = xsw_object[object_num];

	strncpy(mesg, arg, CS_MESG_MAX);
	mesg[CS_MESG_MAX - 1] = '\0';
        StringStripSpaces(mesg);

	sprintf(sndbuf, "<%s>: \"%s\"",
		obj_ptr->name,
		mesg
	);

	NetSendLiveMessage(-1, sndbuf);


        return(0);
}