Recently Written · git

sad

sad (2f30.org simple audio daemon) with a Cygwin/OSS port on branch cygwin

git clone https://github.com/equwal/sad

Log | Files | Refs


commit 0980fcf469f60da81145b9e5bb630cd9f42edacc
equwal <13551856+equwal@users.noreply.github.com>
2026-10-04 05:08:06 -0700

Add sad.1 and sacc.1 man pages and install them

Install to /usr/local/share/man, which Cygwin's man_db.conf always searches.

 Makefile |   8 +++--
 sacc.1   |  47 ++++++++++++++++++++++++++++
 sad.1    | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 160 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 3984457..bb75302 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 0.0
 
 PREFIX = /usr/local
-MANPREFIX = $(PREFIX)/man
+MANPREFIX = $(PREFIX)/share/man
 
 CFLAGS = -I/usr/local/include
 LDFLAGS = -L /usr/local/lib
@@ -45,14 +45,18 @@ $(OBJ): arg.h compat.h config.h queue.h sad.h
 install: all
 	mkdir -p $(DESTDIR)$(PREFIX)/bin
 	cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
+	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
+	cp -f sad.1 $(DESTDIR)$(MANPREFIX)/man1
 
 install-cygwin:
 	sed 's/SOUNDSYS ALSA/SOUNDSYS OSS/' config.def.h > config.h
 	$(MAKE) install OUTOBJ=oss.o OUTLIBS=
 	cp -f cygwin/sacc $(DESTDIR)$(PREFIX)/bin
+	cp -f sacc.1 $(DESTDIR)$(MANPREFIX)/man1
 
 uninstall:
-	rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
+	rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) $(DESTDIR)$(PREFIX)/bin/sacc
+	rm -f $(DESTDIR)$(MANPREFIX)/man1/sad.1 $(DESTDIR)$(MANPREFIX)/man1/sacc.1
 
 clean:
 	rm -f $(BIN) $(OBJ)
diff --git a/sacc.1 b/sacc.1
new file mode 100644
index 0000000..3affeb7
--- /dev/null
+++ b/sacc.1
@@ -0,0 +1,47 @@
+.Dd October 4, 2026
+.Dt SACC 1
+.Os
+.Sh NAME
+.Nm sacc
+.Nd send one command to sad
+.Sh SYNOPSIS
+.Nm
+.Ar command
+.Op Ar arg ...
+.Sh DESCRIPTION
+.Nm
+sends
+.Ar command
+and its arguments as one line to the
+.Xr sad 1
+socket with
+.Xr socat 1
+and prints the reply.
+.Pp
+For
+.Cm add ,
+.Nm
+sends one
+.Cm add
+line per path and converts each path, including Windows paths,
+to an absolute Cygwin path with
+.Xr cygpath 1 .
+.Sh ENVIRONMENT
+.Bl -tag -width Ds
+.It Ev SAD_SOCK
+Socket path.
+Default:
+.Pa /tmp/sad-sock .
+.El
+.Sh EXIT STATUS
+.Nm
+exits 1 when no command is given; otherwise it exits with the status of
+.Xr socat 1 .
+.Sh EXAMPLES
+.Bd -literal -offset indent
+$ sacc add 'C:\eUsers\eme\eMusic\esong.mp3'
+$ sacc play
+$ sacc status playback
+.Ed
+.Sh SEE ALSO
+.Xr sad 1
diff --git a/sad.1 b/sad.1
new file mode 100644
index 0000000..c7ff66f
--- /dev/null
+++ b/sad.1
@@ -0,0 +1,107 @@
+.Dd October 4, 2026
+.Dt SAD 1
+.Os
+.Sh NAME
+.Nm sad
+.Nd simple audio daemon
+.Sh SYNOPSIS
+.Nm
+.Op Fl f Ar sock
+.Sh DESCRIPTION
+.Nm
+plays MP3, Ogg Vorbis and WAV files from a playlist.
+Clients control it with line-based text commands over a
+.Ux
+domain socket.
+Each reply ends with
+.Ql OK
+on success, or
+.Ql ERR
+and a message on failure.
+.Sh OPTIONS
+.Bl -tag -width Ds
+.It Fl f Ar sock
+Listen on
+.Ar sock
+instead of
+.Pa /tmp/sad-sock .
+.El
+.Sh COMMANDS
+.Bl -tag -width Ds
+.It Cm add Ar path
+Add
+.Ar path
+to the playlist.
+.It Cm clear
+Clear the playlist and stop playback.
+.It Cm close
+Close the client connection.
+.It Cm disable Ar output
+Disable the named output.
+.It Cm enable Ar output
+Enable the named output.
+.It Cm kill
+Stop the daemon.
+.It Cm next
+Play the next song.
+.It Cm pause Op Cm 0 | 1
+Pause or resume.
+Toggle when no argument is given.
+.It Cm ping
+Reply with
+.Ql pong .
+.It Cm play Op Ar id
+Play song
+.Ar id ,
+or the current song.
+.It Cm playlist
+Print the playlist as
+.Ql id: path
+lines.
+.It Cm prev
+Play the previous song.
+.It Cm random
+Set random playback mode.
+.It Cm remove Op Ar id
+Remove song
+.Ar id ,
+or the current song, from the playlist.
+.It Cm repeat
+Set repeat mode, the default: cycle through the playlist.
+.It Cm status Op Ar state
+Print
+.Ql state: value
+lines for
+.Cm random , repeat , single , songid , playback
+and
+.Cm volume ,
+or only for
+.Ar state .
+.It Cm stop
+Stop playback.
+.It Cm version
+Print the protocol version.
+.It Cm volume Ar 0-100
+Set the volume of all outputs.
+.It Cm wait Ar event
+Reply with
+.Ql event: name
+when
+.Ar event
+fires.
+.El
+.Sh FILES
+.Bl -tag -width Ds
+.It Pa /tmp/sad-sock
+Default socket.
+.El
+.Sh EXAMPLES
+Start the daemon and queue a song:
+.Bd -literal -offset indent
+$ sad &
+$ echo 'add /music/song.mp3' | nc -U /tmp/sad-sock
+$ echo 'play' | nc -U /tmp/sad-sock
+.Ed
+.Sh SEE ALSO
+.Xr nc 1 ,
+.Xr sacc 1