changes for ii-1.2
This commit is contained in:
parent
e27930f4cd
commit
cc58fcc068
6
Makefile
6
Makefile
@ -24,7 +24,7 @@ options:
|
|||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
@mkdir -p ii-${VERSION}
|
@mkdir -p ii-${VERSION}
|
||||||
@cp -R query.sh Makefile README FAQ LICENSE config.mk ii.c ii.1 ii-${VERSION}
|
@cp -R query.sh Makefile CHANGES README FAQ LICENSE config.mk ii.c ii.1 ii-${VERSION}
|
||||||
@tar -cf ii-${VERSION}.tar ii-${VERSION}
|
@tar -cf ii-${VERSION}.tar ii-${VERSION}
|
||||||
@gzip ii-${VERSION}.tar
|
@gzip ii-${VERSION}.tar
|
||||||
@rm -rf ii-${VERSION}
|
@rm -rf ii-${VERSION}
|
||||||
@ -40,7 +40,7 @@ install: all
|
|||||||
@mkdir -p ${DESTDIR}${MAN1DIR}
|
@mkdir -p ${DESTDIR}${MAN1DIR}
|
||||||
|
|
||||||
@install -d ${DESTDIR}${BINDIR} ${DESTDIR}${MAN1DIR}
|
@install -d ${DESTDIR}${BINDIR} ${DESTDIR}${MAN1DIR}
|
||||||
@install -m 644 README query.sh FAQ LICENSE ${DESTDIR}${DOCDIR}
|
@install -m 644 CHANGES README query.sh FAQ LICENSE ${DESTDIR}${DOCDIR}
|
||||||
@install -m 775 ii ${DESTDIR}${BINDIR}
|
@install -m 775 ii ${DESTDIR}${BINDIR}
|
||||||
@install -m 444 ii.1 ${DESTDIR}${MAN1DIR}
|
@install -m 444 ii.1 ${DESTDIR}${MAN1DIR}
|
||||||
@echo "installed ii"
|
@echo "installed ii"
|
||||||
@ -52,4 +52,4 @@ uninstall: all
|
|||||||
@echo "uninstalled ii"
|
@echo "uninstalled ii"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f ii *~ *.o *core
|
rm -f ii *~ *.o *core *.tar.gz
|
||||||
|
2
README
2
README
@ -47,7 +47,7 @@ Changelog
|
|||||||
---------
|
---------
|
||||||
Since I missed the chance to add a proper changelog right from the beginning,
|
Since I missed the chance to add a proper changelog right from the beginning,
|
||||||
please have a look at the commit messages on http://www.suckless.org/hg.rc/ii
|
please have a look at the commit messages on http://www.suckless.org/hg.rc/ii
|
||||||
they are fairly descriptive.
|
they are fairly descriptive on releases prior to 1.2.
|
||||||
|
|
||||||
Contact
|
Contact
|
||||||
-------
|
-------
|
||||||
|
@ -12,7 +12,7 @@ DESTDIR =
|
|||||||
|
|
||||||
INCDIR = ${PREFIX}/include
|
INCDIR = ${PREFIX}/include
|
||||||
LIBDIR = ${PREFIX}/lib
|
LIBDIR = ${PREFIX}/lib
|
||||||
VERSION = 1.1
|
VERSION = 1.2
|
||||||
|
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCLUDES = -I. -I${INCDIR} -I/usr/include
|
INCLUDES = -I. -I${INCDIR} -I/usr/include
|
||||||
|
25
ii.c
25
ii.c
@ -53,7 +53,7 @@ static void usage() {
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
static char *lower(char *s) {
|
static char *lower(char *s) {
|
||||||
char *p;
|
char *p = NULL;
|
||||||
for(p = s; p && *p; p++) *p = tolower(*p);
|
for(p = s; p && *p; p++) *p = tolower(*p);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -120,8 +120,7 @@ static void add_channel(char *name) {
|
|||||||
perror("ii: cannot allocate memory");
|
perror("ii: cannot allocate memory");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if(!channels)
|
if(!channels) channels = c;
|
||||||
channels = c;
|
|
||||||
else {
|
else {
|
||||||
c->next = channels;
|
c->next = channels;
|
||||||
channels = c;
|
channels = c;
|
||||||
@ -132,8 +131,7 @@ static void add_channel(char *name) {
|
|||||||
|
|
||||||
static void rm_channel(Channel *c) {
|
static void rm_channel(Channel *c) {
|
||||||
Channel *p;
|
Channel *p;
|
||||||
if(channels == c)
|
if(channels == c) channels = channels->next;
|
||||||
channels = channels->next;
|
|
||||||
else {
|
else {
|
||||||
for(p = channels; p && p->next != c; p = p->next);
|
for(p = channels; p && p->next != c; p = p->next);
|
||||||
if(p->next == c)
|
if(p->next == c)
|
||||||
@ -144,13 +142,12 @@ static void rm_channel(Channel *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void login(char *key, char *fullname) {
|
static void login(char *key, char *fullname) {
|
||||||
if(key)
|
if(key) snprintf(message, PIPE_BUF,
|
||||||
snprintf(message, PIPE_BUF,
|
|
||||||
"PASS %s\r\nNICK %s\r\nUSER %s localhost %s :%s\r\n", key,
|
"PASS %s\r\nNICK %s\r\nUSER %s localhost %s :%s\r\n", key,
|
||||||
nick, nick, host, fullname ? fullname : nick);
|
nick, nick, host, fullname ? fullname : nick);
|
||||||
else
|
else snprintf(message, PIPE_BUF, "NICK %s\r\nUSER %s localhost %s :%s\r\n",
|
||||||
snprintf(message, PIPE_BUF, "NICK %s\r\nUSER %s localhost %s :%s\r\n",
|
|
||||||
nick, nick, host, fullname ? fullname : nick);
|
nick, nick, host, fullname ? fullname : nick);
|
||||||
|
|
||||||
write(irc, message, strlen(message)); /* login */
|
write(irc, message, strlen(message)); /* login */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +176,7 @@ static int tcpopen(unsigned short port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static size_t tokenize(char **result, size_t reslen, char *str, char delim) {
|
static size_t tokenize(char **result, size_t reslen, char *str, char delim) {
|
||||||
char *p, *n;
|
char *p = NULL, *n = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if(!str)
|
if(!str)
|
||||||
@ -202,8 +199,7 @@ static size_t tokenize(char **result, size_t reslen, char *str, char delim) {
|
|||||||
return i; /* number of tokens */
|
return i; /* number of tokens */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_out(char *channel, char *buf)
|
static void print_out(char *channel, char *buf) {
|
||||||
{
|
|
||||||
static char outfile[256];
|
static char outfile[256];
|
||||||
FILE *out;
|
FILE *out;
|
||||||
static char buft[18];
|
static char buft[18];
|
||||||
@ -211,6 +207,7 @@ static void print_out(char *channel, char *buf)
|
|||||||
|
|
||||||
create_filepath(outfile, sizeof(outfile), channel, "out");
|
create_filepath(outfile, sizeof(outfile), channel, "out");
|
||||||
if(!(out = fopen(outfile, "a"))) return;
|
if(!(out = fopen(outfile, "a"))) return;
|
||||||
|
|
||||||
strftime(buft, sizeof(buft), "%F %R", localtime(&t));
|
strftime(buft, sizeof(buft), "%F %R", localtime(&t));
|
||||||
fprintf(out, "%s %s\n", buft, buf);
|
fprintf(out, "%s %s\n", buft, buf);
|
||||||
fclose(out);
|
fclose(out);
|
||||||
@ -237,7 +234,7 @@ static void proc_channels_input(Channel *c, char *buf) {
|
|||||||
p = strchr(&buf[3], ' ');
|
p = strchr(&buf[3], ' ');
|
||||||
if(p) *p = 0;
|
if(p) *p = 0;
|
||||||
if((buf[3]=='#')||(buf[3]=='&')||(buf[3]=='+')||(buf[3]=='!')){
|
if((buf[3]=='#')||(buf[3]=='&')||(buf[3]=='+')||(buf[3]=='!')){
|
||||||
if(p) snprintf(message, PIPE_BUF, "JOIN %s %s\r\n", &buf[3], p + 1);
|
if(p) snprintf(message, PIPE_BUF, "JOIN %s %s\r\n", &buf[3], p + 1); /* password protected channel */
|
||||||
else snprintf(message, PIPE_BUF, "JOIN %s\r\n", &buf[3]);
|
else snprintf(message, PIPE_BUF, "JOIN %s\r\n", &buf[3]);
|
||||||
add_channel(&buf[3]);
|
add_channel(&buf[3]);
|
||||||
}
|
}
|
||||||
@ -275,7 +272,7 @@ static void proc_channels_input(Channel *c, char *buf) {
|
|||||||
snprintf(message, PIPE_BUF, "PART %s :%s\r\n", c->name, &buf[3]);
|
snprintf(message, PIPE_BUF, "PART %s :%s\r\n", c->name, &buf[3]);
|
||||||
else
|
else
|
||||||
snprintf(message, PIPE_BUF,
|
snprintf(message, PIPE_BUF,
|
||||||
"PART %s :ii - 500 LOC are too much\r\n", c->name);
|
"PART %s :ii - 500 SLOC are too much\r\n", c->name);
|
||||||
write(irc, message, strlen(message));
|
write(irc, message, strlen(message));
|
||||||
close(c->fd);
|
close(c->fd);
|
||||||
create_filepath(infile, sizeof(infile), c->name, "in");
|
create_filepath(infile, sizeof(infile), c->name, "in");
|
||||||
|
Loading…
Reference in New Issue
Block a user