Skip to content

Commit 4994034

Browse files
authored
add manpage (#46)
* Create kirc.1 * add VERSION and man page * change kirc version to definition in Makefile * fix separator char (TAB) * remove double parenthesis in puts() command * change VERSION to be controlled by kirc.c
1 parent b6115ac commit 4994034

File tree

3 files changed

+101
-16
lines changed

3 files changed

+101
-16
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
PREFIX = /usr/local
44
BINDIR = $(PREFIX)/bin
5+
MANPREFIX = $(PREFIX)/share/man
56

67
all: kirc
78

@@ -13,11 +14,16 @@ kirc: kirc.o Makefile
1314

1415
install: all
1516
mkdir -p $(DESTDIR)$(BINDIR)
17+
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
1618
cp -f kirc $(DESTDIR)$(BINDIR)
1719
chmod 755 $(DESTDIR)$(BINDIR)/kirc
20+
version=$$(sed -n '/#define VERSION/{s/^[^"]*"//;s/".*//;p;q}' kirc.c); \
21+
sed "s/VERSION/$$version/g" kirc.1 > $(DESTDIR)$(MANPREFIX)/man1/kirc.1
22+
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/kirc.1
1823

1924
uninstall:
2025
rm -f $(DESTDIR)$(BINDIR)/kirc
26+
rm -f $(DESTDIR)$(MANPREFIX)/man1/kirc.1
2127

2228
clean:
2329
rm -f kirc *.o

kirc.1

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
.TH KIRC 1 kirc\-VERSION
2+
.SH NAME
3+
kirc \- KISS for IRC
4+
.SH SYNOPSIS
5+
.B kirc
6+
.RB [ \-s
7+
.IR server ]
8+
.RB [ \-p
9+
.IR port ]
10+
.RB [ \-n
11+
.IR nick ]
12+
.RB [ \-c
13+
.IR chan ]
14+
.RB ...
15+
.SH DESCRIPTION
16+
.B kirc
17+
is an extremely fast and simple IRC client designed with portability in mind.
18+
This client reads from stdin and prints to stdout, so all traffic can
19+
multiplexed and text parsed or modified using external commands. All highlighted
20+
text and color can be controlled with ANSI escape sequences.
21+
.SH OPTIONS
22+
.TP
23+
.BI \-s " server"
24+
Overrides the default host (irc.freenode.org)
25+
.TP
26+
.BI \-p " port"
27+
Overrides the default port (6697)
28+
.TP
29+
.BI \-c " chan"
30+
Specifies the channel(s) to JOIN (delimited by "," or "|")
31+
.TP
32+
.BI \-n " nick"
33+
Specifies the NICK connection nickname
34+
.TP
35+
.BI \-u " real"
36+
Specifies the users real name
37+
.TP
38+
.BI \-u " user"
39+
Specifies the USER connection username
40+
.TP
41+
.BI \-k " pass"
42+
Specifies the PASS connection password
43+
.TP
44+
.BI \-w " nick_width"
45+
Specifies max character width printed in the left column
46+
.TP
47+
.BI \-W " max_width"
48+
Specifies max printed with of the IRC stream
49+
.TP
50+
.BI \-a " auth"
51+
Specifies SASL PLAIN authentication token
52+
.TP
53+
.BI \-e
54+
Specifies SASL EXTERNAL
55+
.TP
56+
.BI \-v
57+
Prints the version information to stderr, then exits
58+
.SH COMMANDS
59+
.TP
60+
.BI /<command>
61+
Send message to IRC host (e.g. /JOIN, /PART, /WHOIS, etc.)
62+
.TP
63+
.BI /?
64+
Print current default message channel
65+
.TP
66+
.BI /#<channel>
67+
Set default message channel to <channel>
68+
.TP
69+
.BI <message>
70+
Send PRIVMSG to default message channel with <message> as the content
71+
.TP
72+
.BI /@<channel|nick>
73+
Send PRIVMSG to specified <channel> or <nick>
74+
.SH AUTHOR
75+
Michael Czigler <michaelczigler at icloud dot com>
76+
.SH BUGS
77+
Please report them!

kirc.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <sys/socket.h>
1414
#include <sys/ioctl.h>
1515

16+
#define VERSION "0.1.3"
17+
1618
#define MSG_MAX 512 /* guaranteed max message length */
1719
#define CHA_MAX 200 /* guaranteed max channel length */
1820

@@ -280,22 +282,22 @@ main(int argc, char **argv) {
280282

281283
while ((cval = getopt(argc, argv, "s:p:o:n:k:c:u:r:x:w:W:a:hevV")) != -1) {
282284
switch (cval) {
283-
case 'V' : ++verb; break;
284-
case 'e' : ++sasl; break;
285-
case 's' : host = optarg; break;
286-
case 'p' : port = optarg; break;
287-
case 'r' : real = optarg; break;
288-
case 'u' : user = optarg; break;
289-
case 'a' : auth = optarg; break;
290-
case 'o' : olog = optarg; break;
291-
case 'n' : nick = optarg; break;
292-
case 'k' : pass = optarg; break;
293-
case 'c' : chan = optarg; break;
294-
case 'x' : inic = optarg; break;
295-
case 'w' : gutl = atoi(optarg); break;
296-
case 'W' : cmax = atoi(optarg); break;
297-
case 'v' : puts("kirc 0.1.2\n"); break;
298-
case '?' : usage(); break;
285+
case 'V' : ++verb; break;
286+
case 'e' : ++sasl; break;
287+
case 's' : host = optarg; break;
288+
case 'p' : port = optarg; break;
289+
case 'r' : real = optarg; break;
290+
case 'u' : user = optarg; break;
291+
case 'a' : auth = optarg; break;
292+
case 'o' : olog = optarg; break;
293+
case 'n' : nick = optarg; break;
294+
case 'k' : pass = optarg; break;
295+
case 'c' : chan = optarg; break;
296+
case 'x' : inic = optarg; break;
297+
case 'w' : gutl = atoi(optarg); break;
298+
case 'W' : cmax = atoi(optarg); break;
299+
case 'v' : puts("kirc-" VERSION); break;
300+
case '?' : usage(); break;
299301
}
300302
}
301303

0 commit comments

Comments
 (0)