9 Commits
0.1 ... 0.2

5 changed files with 16 additions and 11 deletions

1
.hgtags Normal file
View File

@ -0,0 +1 @@
de32c537aaf66554894712563ffba8d9bc4c2714 0.1

View File

@ -4,13 +4,13 @@
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man MANPREFIX = ${PREFIX}/share/man
VERSION = 0.1 VERSION = 0.2
# includes and libs # includes and libs
LIBS = -L${PREFIX}/lib -L/usr/lib -lc LIBS = -L${PREFIX}/lib -L/usr/lib -lc
# compiler # compiler
CFLAGS = -Os -I${PREFIX}/include -I/usr/include \ CFLAGS = -O3 -I${PREFIX}/include -I/usr/include \
-DVERSION=\"${VERSION}\" -DVERSION=\"${VERSION}\"
LDFLAGS = ${LIBS} LDFLAGS = ${LIBS}
#CFLAGS = -g -Wall -O2 -I${PREFIX}/include -I/usr/include \ #CFLAGS = -g -Wall -O2 -I${PREFIX}/include -I/usr/include \

2
sic.1
View File

@ -1,4 +1,4 @@
.TH SIC 1 sic-0.1 .TH SIC 1 sic-0.2
.SH NAME .SH NAME
sic \- simple irc client sic \- simple irc client
.SH SYNOPSIS .SH SYNOPSIS

18
sic.c
View File

@ -10,8 +10,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/socket.h>
#include <time.h> #include <time.h>
#include <sys/socket.h>
#include <sys/time.h>
#define PINGTIMEOUT 300 #define PINGTIMEOUT 300
#define MAXMSG 4096 #define MAXMSG 4096
@ -51,7 +52,7 @@ pout(char *channel, char *msg)
time_t t = time(0); time_t t = time(0);
strftime(timestr, sizeof(timestr), "%a %R", localtime(&t)); strftime(timestr, sizeof(timestr), "%a %R", localtime(&t));
fprintf(stdout, "%s: %s %s\n", channel, timestr, msg); fprintf(stdout, "%-8.8s: %s %s\n", channel, timestr, msg);
} }
static void static void
@ -68,6 +69,8 @@ parsein(char *msg)
{ {
char *p; char *p;
if(msg[0] == 0)
return;
if(msg[0] != '/') { if(msg[0] != '/') {
privmsg(channel, msg); privmsg(channel, msg);
return; return;
@ -223,7 +226,8 @@ parsesrv(char *msg)
else if(!strncmp("NOTICE", argv[Tcmd], 7)) else if(!strncmp("NOTICE", argv[Tcmd], 7))
snprintf(bufout, sizeof(bufout), "-!- \"%s\")", snprintf(bufout, sizeof(bufout), "-!- \"%s\")",
argv[Ttext] ? argv[Ttext] : ""); argv[Ttext] ? argv[Ttext] : "");
else if(!strncmp("PRIVMSG", argv[Tcmd], 8)) snprintf(bufout, sizeof(bufout), "<%s> %s", else if(!strncmp("PRIVMSG", argv[Tcmd], 8))
snprintf(bufout, sizeof(bufout), "<%s> %s",
argv[Tnick], argv[Ttext] ? argv[Ttext] : ""); argv[Tnick], argv[Ttext] ? argv[Ttext] : "");
if(!argv[Tchan] || !strncmp(argv[Tchan], nick, strlen(nick))) if(!argv[Tchan] || !strncmp(argv[Tchan], nick, strlen(nick)))
pout(argv[Tnick], bufout); pout(argv[Tnick], bufout);
@ -289,11 +293,11 @@ main(int argc, char *argv[])
/* login */ /* login */
if(password) if(password)
snprintf(bufout, sizeof(bufout), snprintf(bufout, sizeof(bufout),
"PASS %s\r\nNICK %s\r\nUSER %s localserver %s :%s\r\n", "PASS %s\r\nNICK %s\r\nUSER %s localhost %s :%s\r\n",
password, nick, nick, server, fullname ? fullname : nick); password, nick, nick, server, fullname);
else else
snprintf(bufout, sizeof(bufout), "NICK %s\r\nUSER %s localserver %s :%s\r\n", snprintf(bufout, sizeof(bufout), "NICK %s\r\nUSER %s localhost %s :%s\r\n",
nick, nick, server, fullname ? fullname : nick); nick, nick, server, fullname);
write(srv, bufout, strlen(bufout)); write(srv, bufout, strlen(bufout));
snprintf(ping, sizeof(ping), "PING %s\r\n", server); snprintf(ping, sizeof(ping), "PING %s\r\n", server);

View File

@ -25,7 +25,7 @@
</ul> </ul>
<h3>Download</h3> <h3>Download</h3>
<ul> <ul>
<li><a href="http://10kloc.org/download/sic-0.1.tar.gz">sic 0.1</a> (5kb) (20060720)</li> <li><a href="http://10kloc.org/download/sic-0.2.tar.gz">sic 0.2</a> (5kb) (20060721)</li>
</ul> </ul>
<h3>Development</h3> <h3>Development</h3>
<p> <p>