TNC v.95
TNC v.95

file:a/Makefile -> file:b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,47 @@
-CC=clang
-#That's the crappiest makefile in the world, don't you think ? :P
-all:
-	$(CC) -Wall -D_GNU_SOURCE src/*.c -o bin/tnc
+CC ?= clang
+CFLAGS ?= -O2
+LDFLAGS +=
+CFDEBUG = -g3 -Wall -Wextra -Wunused -Wunused-parameter
 
-debug:
-	$(CC) -g3 -Wall -Wextra -D_GNU_SOURCE src/*.c -o bin/tnc
+SRC = src
+MAN = man
+EXEC = tnc
+
+SRCS =  ${SRC}/chat.c ${SRC}/connections.c ${SRC}/options.c ${SRC}/utils.c \
+${SRC}/config.c ${SRC}/extra_options.c ${SRC}/users.c ${SRC}/connect.c \
+${SRC}/main.c ${SRC}/users_file.c
+
+OBJS = ${SRCS:.c=.o}
+
+.PATH: ${SRC}
+
+PREFIX ?= /usr/local
+BINDIR = ${PREFIX}/bin
+MANDIR = ${PREFIX}/man
+
+all: ${EXEC}
+
+.c.o:
+	${CC} ${CFLAGS} -o $@ -c $<
+
+${EXEC}: ${OBJS}
+	${CC} ${LDFLAGS} -o bin/${EXEC} ${OBJS}
+
+install-main: ${EXEC}
+	test -d ${DESTDIR}${BINDIR} || mkdir -p ${DESTDIR}${BINDIR}
+	install -m755 ${EXEC} ${DESTDIR}${BINDIR}/${EXEC}
+
+install-data: ${MAN}/${EXEC}.1
+	test -d ${DESTDIR}${MANDIR}/man1 || mkdir -p ${DESTDIR}${MANDIR}/man1
+	install -m644 ${MAN}/${EXEC}.1 ${DESTDIR}${MANDIR}/man1/${EXEC}.1
+
+install: all install-main install-data
+
+debug: ${EXEC}
+debug: CC += ${CFDEBUG}
 
 clean:
-	rm a.out
+	rm -rf ${SRC}/*.o bin/${EXEC}
 
+.PHONY: all clean install install-main install-data
+

--- a/doc/Server_Options
+++ b/doc/Server_Options
@@ -13,13 +13,14 @@
 	To quit with a reason, or not.
 
 
+* /register PASSWD
+* /id NICK PASSWD
+
 TODO
 * /kick ID/User
 	To kick person ID
 
-* /register PASSWD
-
-* /id NICK PASSWD
-
 * /passwd OLD NEW
 
+
+

--- a/src/.vstmDB
+++ b/src/.vstmDB
@@ -4,4 +4,6 @@
 handle registering
 @H variables MAX_NICK_LEN and NICK_SPACE_NEEDED
 @L implement locking for users file
+@H greeting message
+@H implement /help
 

--- a/src/options.c
+++ b/src/options.c
@@ -74,11 +74,36 @@
 	else if(cmp_arg_is(sent+1, "dummy")) {
 		client_opt_dummy(srv, client, get_args(sent));
 	}
+	else if(cmp_arg_is(sent+1, "help")) {
+		client_opt_help(srv, client, get_args(sent));
+	}
 	else {
 		send_msg_to_client(srv, TNCMSG_OPT_NO_SUCH_OPTION"\n", client);
 	}
 
 	return 1;
+} /* }}} */
+
+void
+client_opt_help(struct srv_conf *srv, int client, char *args)
+{ /* {{{ */
+
+	char *help_msg = 
+"List of available options:\n \
+	* /nick BLAH\n\
+		Change your nick to BLAH\n\
+	* /quit\n\
+	* /list\n\
+		To list users\n\
+	* /say Foo bar\n\
+		To say \"Foo bar\"\n\
+	* /color Y/N\n\
+		To enable or disable colors\n\
+	* /slap User\n\
+	* /login User Password\n\
+	* /register Password\n";
+
+	send_msg_to_client(srv, help_msg, client);
 } /* }}} */
 
 int

--- a/src/options.h
+++ b/src/options.h
@@ -5,6 +5,9 @@
 
 int
 handle_option(struct srv_conf *srv, int client, char *sent);
+
+void
+client_opt_help(struct srv_conf *srv, int client, char *args);
 
 int
 cmp_arg_is(char *arg, char *is);

--- a/src/server.h
+++ b/src/server.h
@@ -7,7 +7,7 @@
 #include <netinet/in.h> /* IPv6 */
 #include <poll.h>
 
-#define VERSION "0.912"
+#define VERSION "0.95"
 #define NAME "telnetChat"