10 Commits
0.2 ... 0.3

Author SHA1 Message Date
78e0c4f9ee new tag 2006-09-26 14:27:31 +02:00
b3412f0a14 new stuff 2006-09-26 14:24:26 +02:00
1230561e3d Added tag 0.3 for changeset dc05747ec127039afaa350094add73d151d17b72 2006-09-26 14:14:48 +02:00
b8950627a7 hotfix 2006-09-20 11:18:27 +02:00
5d19f0415e simplified sic 2006-09-19 16:54:52 +02:00
2c257c70bc fixed several annoyances 2006-09-05 09:47:15 +02:00
fb185a5e18 removed html crap 2006-09-05 07:32:24 +02:00
c9668b78f2 preparing new sic version 2006-09-05 07:31:46 +02:00
c2fcf48e6d applied Adriens patch 2006-09-04 08:54:14 +02:00
ee77b8efae Added tag 0.2 for changeset 56350a01f27753cfbdbb3dbc25f2a53dd4c2ac45 2006-07-21 21:12:33 +02:00
6 changed files with 84 additions and 131 deletions

View File

@ -1 +1,2 @@
de32c537aaf66554894712563ffba8d9bc4c2714 0.1
56350a01f27753cfbdbb3dbc25f2a53dd4c2ac45 0.2

View File

@ -1,59 +1,57 @@
# ii - irc it - simple but flexible IRC client
# (C)opyright MMV Anselm R. Garbe, Nico Golde
# sic - simple irc client
# (C)opyright MMVI Anselm R. Garbe
include config.mk
SRC = sic.c
OBJ = ${SRC:.c=.o}
MAN1 = sic.1
BIN = sic
all: options sic
@echo built sic
options:
@echo ii build options:
@echo "LIBS = ${LIBS}"
@echo sic build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
@echo "LD = ${LD}"
.c.o:
@echo CC $<
@${CC} -c ${CFLAGS} $<
${OBJ}: config.mk
sic: ${OBJ}
@echo LD $@
@${LD} -o $@ ${OBJ} ${LDFLAGS}
@strip $@
clean:
rm -f sic *.o core sic-${VERSION}.tar.gz
@echo cleaning
@rm -f sic ${OBJ} sic-${VERSION}.tar.gz
dist: clean
@echo creating dist tarball
@mkdir -p sic-${VERSION}
@cp -R Makefile README LICENSE config.mk sic.c sic.1 sic-${VERSION}
@cp -R LICENSE Makefile README config.mk sic.1 ${SRC} sic-${VERSION}
@tar -cf sic-${VERSION}.tar sic-${VERSION}
@gzip sic-${VERSION}.tar
@rm -rf sic-${VERSION}
sic: ${OBJ}
@echo LD $@
@${CC} -o $@ ${OBJ} ${LDFLAGS}
install: all
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin
@cp -f ${BIN} ${DESTDIR}${PREFIX}/bin
@for i in ${BIN}; do \
chmod 755 ${DESTDIR}${PREFIX}/bin/`basename $$i`; \
done
@echo installed executable files to ${DESTDIR}${PREFIX}/bin
@cp -f sic ${DESTDIR}${PREFIX}/bin
@chmod 755 ${DESTDIR}${PREFIX}/bin/sic
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
@cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1
@for i in ${MAN1}; do \
chmod 444 ${DESTDIR}${MANPREFIX}/man1/`basename $$i`; \
done
@echo installed manual pages to ${DESTDIR}${MANPREFIX}/man1
@sed 's/VERSION/${VERSION}/g' < sic.1 > ${DESTDIR}${MANPREFIX}/man1/sic.1
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/sic.1
uninstall:
for i in ${BIN}; do \
rm -f ${DESTDIR}${PREFIX}/bin/`basename $$i`; \
done
for i in ${MAN1}; do \
rm -f ${DESTDIR}${MANPREFIX}/man1/`basename $$i`; \
done
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
@rm -f ${DESTDIR}${PREFIX}/bin/sic
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/sic.1
.PHONY: all options clean dist install uninstall

View File

@ -1,18 +1,22 @@
# Customize to fit your system
# sic version
VERSION = 0.3
# Customize below to fit your system
# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
VERSION = 0.2
# includes and libs
LIBS = -L${PREFIX}/lib -L/usr/lib -lc
INCS = -I. -I/usr/include
LIBS = -L/usr/lib -lc
# compiler
CFLAGS = -O3 -I${PREFIX}/include -I/usr/include \
-DVERSION=\"${VERSION}\"
LDFLAGS = ${LIBS}
#CFLAGS = -g -Wall -O2 -I${PREFIX}/include -I/usr/include \
# -DVERSION=\"${VERSION}\"
#LDFLAGS = -g ${LIBS}
# flags
CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
LDFLAGS = ${LIBS}
#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = -g ${LIBS}
# compiler and linker
CC = cc
LD = ${CC}

38
sic.1
View File

@ -1,19 +1,13 @@
.TH SIC 1 sic-0.2
.TH SIC 1 sic-VERSION
.SH NAME
sic \- simple irc client
.SH SYNOPSIS
.B sic
.RB [ \-s
.IR server ]
.RB [ \-p
.IR port ]
.RB [ \-n
.IR nick ]
.RB [ \-k
.IR keyword ]
.RB [ \-f
.IR fullname ]
.RB \-v
.RB [ \-s <server> ]
.RB [ \-p <port> ]
.RB [ \-n <nick> ]
.RB [ \-k <keyword> ]
.RB [ \-f <fullname> ]
.RB [ \-v ]
.SH DESCRIPTION
.B sic
@ -23,38 +17,38 @@ also all channel traffic into one output, that you don't have to switch
different channel buffers, that's actually a feature.
.SH OPTIONS
.TP
.BI \-s " server"
.B \-s <server>
Overrides the default server (irc.oftc.net)
.TP
.BI \-p " port"
.B \-p <port>
Overrides the default port (6667)
.TP
.BI \-n " nickname"
.B \-n <nickname>
Override the default nick ($USER)
.TP
.BI \-k " keyword"
.B \-k <keyword>
Specifies the keyword to authenticate your nick on the server
.TP
.BI \-f " fullname"
.B \-f <fullname>
Specify the real name (default is $USER)
.TP
.BI \-v
Prints version information to standard output, then exits.
.SH COMMANDS
.TP
.BI /j " #channel "
.B /j #channel
Join a channel
.TP
.BI /l " #channel "
.B /l #channel
Leave a channel
.TP
.BI /m " #channel/user msg "
.B /m #channel/user msg
Write a message to #channel/user
.TP
.BI /s " #channel/user "
.B /s #channel/user
Set default channel/user
.TP
.BI /t " topic"
.B /t topic
Set the channel topic
.TP
Everything which is not a command will simply be posted into the channel or to

55
sic.c
View File

@ -11,6 +11,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/time.h>
@ -20,7 +21,7 @@
enum { Tnick, Tuser, Tcmd, Tchan, Targ, Ttext, Tlast };
static char *server = "irc.oftc.net";
static int port = 6667;
static unsigned short port = 6667;
static char *nick = NULL;
static char *fullname = NULL;
static char *password = NULL;
@ -75,36 +76,27 @@ parsein(char *msg)
privmsg(channel, msg);
return;
}
if((p = strchr(&msg[3], ' ')))
*(p++) = 0;
switch (msg[1]) {
default:
snprintf(bufout, sizeof(bufout), "%s\r\n", &msg[1]);
break;
case 'j':
if(msg[3] == '#')
snprintf(bufout, sizeof(bufout), "JOIN %s\r\n", &msg[3]);
else if(p) {
privmsg(&msg[3], p + 1);
return;
}
break;
case 'l':
if(p)
snprintf(bufout, sizeof(bufout), "PART %s :%s\r\n", &msg[3], p);
else
snprintf(bufout, sizeof(bufout), "PART %s :sic\r\n", &msg[3]);
break;
case 'm':
if(!strncmp(msg + 1, "j ", 2) && (msg[3] == '#'))
snprintf(bufout, sizeof(bufout), "JOIN %s\r\n", &msg[3]);
else if(!strncmp(msg + 1, "l ", 2))
snprintf(bufout, sizeof(bufout), "PART %s :sic\r\n", &msg[3]);
else if(!strncmp(msg + 1, "m ", 2)) {
if(p = strchr(&msg[3], ' '))
*(p++) = 0;
privmsg(&msg[3], p);
return;
case 's':
}
else if(!strncmp(msg + 1, "s ", 2)) {
strncpy(channel, &msg[3], sizeof(channel));
return;
case 't':
snprintf(bufout, sizeof(bufout), "TOPIC %s :%s\r\n", &msg[3], p);
break;
}
else if(!strncmp(msg + 1, "t ", 2)) {
if(p = strchr(&msg[3], ' '))
*(p++) = 0;
snprintf(bufout, sizeof(bufout), "TOPIC %s :%s\r\n", &msg[3], p);
}
else
snprintf(bufout, sizeof(bufout), "%s\r\n", &msg[1]);
write(srv, bufout, strlen(bufout));
}
@ -241,7 +233,7 @@ main(int argc, char *argv[])
int i;
struct timeval tv;
struct hostent *hp;
struct sockaddr_in addr = { 0 };
static struct sockaddr_in addr; /* initially filled with 0's */
char ping[256];
fd_set rd;
@ -257,7 +249,7 @@ main(int argc, char *argv[])
server = argv[++i];
break;
case 'p':
port = atoi(argv[++i]);
port = (unsigned short)atoi(argv[++i]);
break;
case 'n':
nick = argv[++i];
@ -280,10 +272,13 @@ main(int argc, char *argv[])
fprintf(stderr, "sic: cannot connect server '%s'\n", server);
exit(EXIT_FAILURE);
}
hp = gethostbyname(server);
if (NULL == (hp = gethostbyname(server))) {
fprintf(stderr, "sic: cannot resolve hostname '%s'\n", server);
exit(EXIT_FAILURE);
}
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
bcopy(hp->h_addr, &addr.sin_addr, hp->h_length);
memcpy(&addr.sin_addr, hp->h_addr, hp->h_length);
if(connect(srv, (struct sockaddr *) &addr, sizeof(struct sockaddr_in))) {
close(srv);
fprintf(stderr, "sic: cannot connect server '%s'\n", server);

View File

@ -1,39 +0,0 @@
<html>
<head>
<title>sic - simple irc client</title>
<meta name="author" content="Anselm R. Garbe">
<meta name="generator" content="ed">
<meta name="copyright" content="(C)opyright 2006 by Anselm R. Garbe">
<style type="text/css">
body {
color: #000000;
font-family: sans-serif;
margin: 20px 20px 20px 20px;
}
</style>
</head>
<body>
<center>
<h3>simple irc client</h3>
</center>
<h3>Description</h3>
<p>
sic is an extremly simple IRC client. It consists of lesser than 400 lines of code.
</p>
<ul>
<li><a href="http://10kloc.org/cgi-bin/man/man2html?query=sic">Man page</a></li>
</ul>
<h3>Download</h3>
<ul>
<li><a href="http://10kloc.org/download/sic-0.2.tar.gz">sic 0.2</a> (5kb) (20060721)</li>
</ul>
<h3>Development</h3>
<p>
You can <a href="http://10kloc.org/cgi-bin/hgwebdir.cgi/sic">browse</a> its source code repository or get a copy using <a href="http://www.selenic.com/mercurial/">Mercurial</a> with following command:
</p>
<p>
<code>hg clone http://10kloc.org/cgi-bin/hgwebdir.cgi/sic</code>
</p>
<p><small>--Anselm (20060719)</small></p>
</body>
</html>