param.h and MAXHOSTNAMELEN cleanup
This commit is contained in:
parent
8f5ba64c71
commit
0519a8785b
3
cmd.c
3
cmd.c
@ -14,8 +14,9 @@
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/types.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
|
#include <netdb.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
9
icb.c
9
icb.c
@ -14,8 +14,9 @@
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/types.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
|
#include <netdb.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -30,7 +31,7 @@
|
|||||||
#include "icbd.h"
|
#include "icbd.h"
|
||||||
|
|
||||||
extern int creategroups;
|
extern int creategroups;
|
||||||
extern char srvname[MAXHOSTNAMELEN];
|
extern char srvname[NI_MAXHOST];
|
||||||
|
|
||||||
void icb_command(struct icb_session *, char *, char *);
|
void icb_command(struct icb_session *, char *, char *);
|
||||||
void icb_groupmsg(struct icb_session *, char *);
|
void icb_groupmsg(struct icb_session *, char *);
|
||||||
@ -49,7 +50,7 @@ icb_init(void)
|
|||||||
if (strlen(srvname) == 0)
|
if (strlen(srvname) == 0)
|
||||||
(void)gethostname(srvname, sizeof srvname);
|
(void)gethostname(srvname, sizeof srvname);
|
||||||
/*
|
/*
|
||||||
* MAXHOSTNAMELEN is usually greater than what we
|
* NI_MAXHOST is usually greater than what we
|
||||||
* can actually send, hence truncation:
|
* can actually send, hence truncation:
|
||||||
*/
|
*/
|
||||||
if (strlen(srvname) > 200)
|
if (strlen(srvname) > 200)
|
||||||
@ -184,6 +185,8 @@ icb_login(struct icb_session *is, char *grp, char *nick, char *client)
|
|||||||
|
|
||||||
if (client && strlen(client) > 0)
|
if (client && strlen(client) > 0)
|
||||||
icb_vis(is->client, client, sizeof is->client, VIS_SP);
|
icb_vis(is->client, client, sizeof is->client, VIS_SP);
|
||||||
|
else
|
||||||
|
strlcpy(is->client, is->nick, sizeof is->client);
|
||||||
is->group = ig;
|
is->group = ig;
|
||||||
is->login = time(NULL);
|
is->login = time(NULL);
|
||||||
is->last = getmonotime();
|
is->last = getmonotime();
|
||||||
|
2
icb.h
2
icb.h
@ -76,7 +76,7 @@ struct icb_session {
|
|||||||
char nick[ICB_MAXNICKLEN];
|
char nick[ICB_MAXNICKLEN];
|
||||||
char client[ICB_MAXNICKLEN];
|
char client[ICB_MAXNICKLEN];
|
||||||
char host[ICB_MAXHOSTLEN];
|
char host[ICB_MAXHOSTLEN];
|
||||||
char hostname[MAXHOSTNAMELEN];
|
char hostname[NI_MAXHOST];
|
||||||
char buffer[ICB_MSGSIZE];
|
char buffer[ICB_MSGSIZE];
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
struct event ev;
|
struct event ev;
|
||||||
|
4
icbd.h
4
icbd.h
@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
#define TCP_BACKLOG 5
|
#define TCP_BACKLOG 5
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EVBUFFER_FD(x) (EVENT_FD(&(x)->ev_read))
|
#define EVBUFFER_FD(x) (EVENT_FD(&(x)->ev_read))
|
||||||
|
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
|
4
logger.c
4
logger.c
@ -15,13 +15,13 @@
|
|||||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <netdb.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user