hirc

IRC client
Log | Files | Refs

commit 7c4e3a80cdf1c966820d76fa3e059e1272006c2e
parent b10e4b7b02f55f9478a18f96805eb22afe2d48bc
Author: hhvn <dev@hhvn.uk>
Date:   Sun, 14 Nov 2021 16:15:54 +0000

Makefile commands.c hirc.h main.c hirc.1.{header,footer}: documentation

Diffstat:
MMakefile | 8+++++++-
Mcommands.c | 2+-
Ahirc.1.footer | 5+++++
Ahirc.1.header | 30++++++++++++++++++++++++++++++
Mhirc.h | 3+++
Mmain.c | 27++++++++++++++++++++++++++-
6 files changed, 72 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -6,6 +6,7 @@ BIN = hirc OBJ = main.o handle.o hist.o nick.o \ chan.o serv.o ui.o commands.o \ config.o +MAN = hirc.1 # Comment to disable TLS LDTLS = -ltls @@ -14,11 +15,16 @@ CTLS = -DTLS CFLAGS = -g -O0 $(CTLS) LDFLAGS = -lncursesw $(LDTLS) +all: $(BIN) $(MAN) + $(BIN): $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) +$(MAN): $(BIN) $(MAN).header $(MAN).footer + ./$(BIN) -d | cat $(MAN).header - $(MAN).footer > $(MAN) + clean: - -rm -f $(OBJ) + -rm -f $(OBJ) $(MAN) $(BIN) .c.o: $(CC) $(CFLAGS) -c $< diff --git a/commands.c b/commands.c @@ -16,7 +16,7 @@ enum { CMD_ARG, }; -static struct Command commands[] = { +struct Command commands[] = { {"quit", command_quit, { "usage: /quit", "Cleanup and exit", NULL}}, diff --git a/hirc.1.footer b/hirc.1.footer @@ -0,0 +1,5 @@ +.\" vim: set syntax=nroff : +.Sh SEE ALSO +.Xr irssi 1 +.Sh AUTHOR +.An hhvn Aq Mt dev@hhvn.uk diff --git a/hirc.1.header b/hirc.1.header @@ -0,0 +1,30 @@ +.\" vim: set syntax=nroff : +.Dd COMMIT +.Dt hirc 1 +.Os +.Sh NAME +.Nm hirc +.Nd hhvn's IRC client +.Sh SYNOPSIS +.Nm +.Op Fl d +.Op Ar configfile +.Sh OPTIONS +.Bl -tag -width "-d" +.It Fl d +dump documentation data and exit +.El +.Sh DESCRIPTION +.Nm +is the result of a love/hate relationship with irssi. +It is an attempt to majorly simplify irssi whilst keeping +a lot of configurability and integrating some things only +possible with perl plugins. That said, +.Nm +does not share any code with irssi. +.Sh CONFIGURATION +.Nm +reads each line of +.Ar configfile +executing any that are begin with '/' as commands. +Any line beginning with a character other than '/' are ignored. diff --git a/hirc.h b/hirc.h @@ -174,4 +174,7 @@ extern int uineedredraw; /* config.c */ extern struct Config config[]; +/* commands.c */ +extern struct Command commands[]; + #endif /* H_HIRC */ diff --git a/main.c b/main.c @@ -209,14 +209,39 @@ main(int argc, char *argv[]) { struct Selected oldselected; struct Server *sp; FILE *file; - int i, refreshed, inputrefreshed; + int i, j, refreshed, inputrefreshed; long pinginact, reconnectinterval, maxreconnectinterval; if (argc > 2) { fprintf(stderr, "usage: %s [configfile]", dirname(argv[0])); + fprintf(stderr, " %s -d", dirname(argv[0])); return EXIT_FAILURE; } + if (argc == 2 && strcmp(argv[1], "-d") == 0) { + printf(".Ss Variables\n"); + printf(".Bl -tag\n"); + for (i=0; config[i].name; i++) { + printf(".It %s\n", config[i].name); + printf(".Bd -literal -compact\n"); + for (j=0; config[i].description[j]; j++) + printf("%s\n", config[i].description[j]); + printf(".Ed\n"); + } + printf(".El\n"); + printf(".Sh COMMANDS\n"); + printf(".Bl -tag\n"); + for (i=0; commands[i].name && commands[i].func; i++) { + printf(".It %s\n", commands[i].name); + printf(".Bd -literal -compact\n"); + for (j=0; commands[i].description[j]; j++) + printf("%s\n", commands[i].description[j]); + printf(".Ed\n"); + } + printf(".El\n"); + return 0; + } + main_buf = emalloc(sizeof(struct HistInfo)); main_buf->activity = Activity_ignore; main_buf->unread = 0;