diff --git a/Makefile b/Makefile index 0f3cf11..56af379 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,8 @@ PREFIX ?= /usr/local EXEC_PREFIX ?= $(PREFIX) BINDIR ?= $(EXEC_PREFIX)/bin LIBEXECDIR ?= $(EXEC_PREFIX)/libexec +DATAROOTDIR ?= $(PREFIX)/share +MANDIR ?= $(DATAROOTDIR)/man CFLAGS += -Os -g -Wall -Wextra -pedantic CPPFLAGS += @@ -13,6 +15,7 @@ SED ?= sed BINS := ethermess LIBEXECS := ethermess-backend TOOLS := ethertype-dump arp-request +MAN1S := ethermess.1 .SUFFIXES: .SUFFIXES: .c .o @@ -40,11 +43,12 @@ ethermess-backend: ethermess-backend.o .c.o: $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $< -install: $(BINS) $(LIBEXECS) +install: $(BINS) $(LIBEXECS) $(MANS) mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(LIBEXECDIR) install $(BINS) $(DESTDIR)$(BINDIR) install $(LIBEXECS) $(DESTDIR)$(LIBEXECDIR) + cp $(MAN1S) $(DESTDIR)$(MANDIR)/man1 @echo @echo '--------------------------------------------------------------------------------' @echo 'To finish the installation, set the CAP_NET_RAW on $(LIBEXECDIR)/ethermess-backend with' @@ -58,7 +62,8 @@ install: $(BINS) $(LIBEXECS) uninstall: cd $(DESTDIR)$(BINDIR) && rm $(BINS) - cs $(DESTDIR)$(LIBEXECDIR) && rm $(LIBEXECS) + cd $(DESTDIR)$(LIBEXECDIR) && rm $(LIBEXECS) + cd $(DESTDIR)$(MANDIR)/man1 && rm $(MAN1S) clean: rm -f $(BINS) $(LIBEXECS) $(TOOLS) *.o diff --git a/ethermess.1 b/ethermess.1 new file mode 100644 index 0000000..134a1f9 --- /dev/null +++ b/ethermess.1 @@ -0,0 +1,116 @@ +.Dd July 07, 2019 +.Dt ETHERMESS 1 +.Os +.Sh NAME +.Nm ethermess +.Nd simple messenger over bare Ethernet +.Sh SYNOPSIS +.Nm +.Ar interface +.Ar nick +.Sh DESCRIPTION +.Nm +allows sending and receiving messages over Ethernet or Wi-Fi networks using +the EtherMess protocol. +Since EtherMess protocol uses bare Ethernet frames as its transport, IP +connectivity is not needed. +.Pp +The +.Nm +command requires two arguments: +.Bl -tag -width Ds +.It Ar interface +Network interface to talk over. +.It Ar nick +The nick to use for yourself. +.El +.Pp +.Nm +uses a very bare-bones line-oriented user interface. +.Pp +Lines that start with +.Sq / +are considered commands. +Lines that do not will be sent as messages to the default target. +.Ss Commands +.Bl -tag -width Ds +.It / Ar message +Send a message to the default target. +This form is only really useful for sending a message that starts with +.Sq / . +.It /msg Ar target Ar message +Send a message to the specified target. +.It /status Op Ar target +Display the status of either a target (if specified) or yourself (if not). +.It /peers +List all the peers that +.Nm +knows about. +.It /available +Set your status to available. +.It /unavailable +Set your status to unavailable +.It /nick Op Ar nick +Set your nick to the one specified or display the current one. +.It /target Ar target +Set the default target. +.El +.Ss Nick and Target +The full form of a nick as used by +.Nm +is +.Dq ~nick . +Here the +.Sq ~ +refers to the fact that it is set by the user and untrusted, and also helps +to differentiate it from a MAC address. +In most cases you can drop the +.Sq ~ +without any effect. +.Pp +A target can be either a nick or a raw MAC address. +.Ss Messages +A message not from your default target will generally look like: +.Bd -literal -compact + 16:20:03 < ~hutenosa> Lorem ipsum. +.Ed +.Pp +A message from your default target will instead look like: +.Bd -literal -compact + 16:20:03 <*~hutenosa> Lorem ipsum. +.Ed +.Ss Status +There are four main types of status notification: join, quit, status +change, and nick change. +.Pp +The maximal form of a join is +.Bd -literal -compact + 20:08:19 >>> ~nick (status) [b7:00:f0:9f:a4:94] +.Ed +If the status is available, the +.Dq (status) +part will not be present. +.Pp +A normal quit looks like +.Bd -literal -compact + 18:09:22 <<< ~nick [b7:00:f0:9f:8d:86] +.Ed +And one due to a timeout looks like +.Bd -literal -compact + 18:14:23 <<< (timeout) ~nick [b7:00:f0:9f:8d:86] +.Ed +.Pp +A status change looks like +.Bd -literal -compact + 19:06:49 === ~nick (status) [b7:00:f0:9f:8d:91] +.Ed +.Pp +A nick change looks like +.Bd -literal -compact + 03:00:40 === ~oldnick -> ~newnick [b7:00:f0:9f:98:85] +.Ed +.Sh EXIT STATUS +.Nm +exit with status code 0 if it is exiting on user command and 1 if it is exiting due to backend having quit. +.Sh SEE ALSO +.Xr ethermess 7