mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-29 16:14:43 +00:00
progress (#18)
* Added: Signal handlers for SIGILL and SIGABRT ifdef DEBUG * Added: New command: CRASH, for debugging/development... * Changed: configure now defaults to optimizing for code size. * Added: configuration option --optimize=speed or --optimize=size changes to configure #17
This commit is contained in:
11
src/socket.c
11
src/socket.c
@@ -18,6 +18,7 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
#ifndef GENCMD_C
|
||||
#define SOCKET_C
|
||||
#include "config.h"
|
||||
|
||||
@@ -263,13 +264,15 @@ int SockAccept(int sock)
|
||||
return(s);
|
||||
}
|
||||
|
||||
#endif /* GENCMD_C */
|
||||
|
||||
/*
|
||||
* Format text and send to a socket or file descriptor
|
||||
*/
|
||||
int to_file(int sock, const char *format, ...)
|
||||
{
|
||||
va_list msg;
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(GENCMD_C)
|
||||
char *line,*rest;
|
||||
int i;
|
||||
#endif /* DEBUG */
|
||||
@@ -281,7 +284,7 @@ int to_file(int sock, const char *format, ...)
|
||||
vsprintf(gsockdata,format,msg);
|
||||
va_end(msg);
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(GENCMD_C)
|
||||
i = write(sock,gsockdata,strlen(gsockdata));
|
||||
rest = gsockdata;
|
||||
while((line = get_token(&rest,"\n"))) /* rest cannot be NULL */
|
||||
@@ -294,6 +297,8 @@ int to_file(int sock, const char *format, ...)
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
#ifndef GENCMD_C
|
||||
|
||||
/*
|
||||
* Format a message and send it to the current bots server
|
||||
* to_server needs a newline (\n) it wont manufacture it itself.
|
||||
@@ -672,3 +677,5 @@ int killsock(int sock)
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
#endif /* GENCMD_C */
|
||||
|
||||
Reference in New Issue
Block a user