From 11cf3f25d98f02e3e02984b5e372159d9b6c555b Mon Sep 17 00:00:00 2001 From: wens Date: Tue, 1 Mar 2005 16:26:11 +0000 Subject: able to choose ip to bind git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2568 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- cacheserver/utmpserver.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'cacheserver') diff --git a/cacheserver/utmpserver.c b/cacheserver/utmpserver.c index 82832b8f..94c6c0f1 100644 --- a/cacheserver/utmpserver.c +++ b/cacheserver/utmpserver.c @@ -73,20 +73,24 @@ int main(int argc, char **argv) { struct sockaddr_in clientaddr; int ch, port = 5120, sfd, cfd, len, index, i, uid; + char iface_ip[16] = {NULL}; - while( (ch = getopt(argc, argv, "p:h")) != -1 ) + while( (ch = getopt(argc, argv, "p:i:h")) != -1 ) switch( ch ){ case 'p': port = atoi(optarg); break; - + case 'i': + host = strncpy(iface_ip, optarg, 16); + host[15] = 0; + break; case 'h': default: - fprintf(stderr, "usage: utmpserver [-p port]\n"); + fprintf(stderr, "usage: utmpserver [-i interface_ip] [-p port]\n"); return 1; } - if( (sfd = tobind(port)) < 0 ) + if( (sfd = tobind(iface_ip, port)) < 0 ) return 1; while( 1 ){ -- cgit v1.2.3