param.h and MAXHOSTNAMELEN cleanup

This commit is contained in:
Mike Belopuhov 2015-01-18 17:05:42 +01:00
parent 8f5ba64c71
commit 0519a8785b
5 changed files with 15 additions and 7 deletions

3
cmd.c
View File

@ -14,8 +14,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

9
icb.c
View File

@ -14,8 +14,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <netdb.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@ -30,7 +31,7 @@
#include "icbd.h"
extern int creategroups;
extern char srvname[MAXHOSTNAMELEN];
extern char srvname[NI_MAXHOST];
void icb_command(struct icb_session *, char *, char *);
void icb_groupmsg(struct icb_session *, char *);
@ -49,7 +50,7 @@ icb_init(void)
if (strlen(srvname) == 0)
(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:
*/
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)
icb_vis(is->client, client, sizeof is->client, VIS_SP);
else
strlcpy(is->client, is->nick, sizeof is->client);
is->group = ig;
is->login = time(NULL);
is->last = getmonotime();

2
icb.h
View File

@ -76,7 +76,7 @@ struct icb_session {
char nick[ICB_MAXNICKLEN];
char client[ICB_MAXNICKLEN];
char host[ICB_MAXHOSTLEN];
char hostname[MAXHOSTNAMELEN];
char hostname[NI_MAXHOST];
char buffer[ICB_MSGSIZE];
struct sockaddr_storage ss;
struct event ev;

4
icbd.h
View File

@ -19,6 +19,10 @@
#define TCP_BACKLOG 5
#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
#define EVBUFFER_FD(x) (EVENT_FD(&(x)->ev_read))
extern int verbose;

View File

@ -15,13 +15,13 @@
* 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/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <errno.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>