commit 08120e1735f38fbcc9daee90144e4c890460d729
parent e451d349a012369e4296721f1b6f8a6b9b45ecbd
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 19 Nov 2025 20:41:36 +0100
Write the manual page
Diffstat:
3 files changed, 115 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
@@ -75,12 +75,17 @@ install: all
done; \
}; \
install 755 "$(DESTDIR)$(BINPREFIX)" mesh-tool; \
+ install 644 "$(DESTDIR)$(MANPREFIX)/man1" doc/mesh-tool.1; \
install 644 "$(DESTDIR)$(PREFIX)/share/doc/mesh-tool" COPYING README.md
uninstall:
rm -f "$(DESTDIR)$(BINPREFIX)/mesh-tool"
+ rm -f "$(DESTDIR)$(MANPREFIX)/man1/mesh-tool.1"
rm -f "$(DESTDIR)$(PREFIX)/share/doc/mesh-tool/COPYING"
rm -f "$(DESTDIR)$(PREFIX)/share/doc/mesh-tool/README.md"
clean:
rm -f $(HDR) $(OBJ) $(DEP) .config mesh-tool
+
+lint:
+ mandoc -Tlint -Wall doc/mesh-tool.1
diff --git a/doc/mesh-tool.1 b/doc/mesh-tool.1
@@ -0,0 +1,108 @@
+.\" Copyright (C) 2025 |Méso|Star> (contact@meso-star.com)
+.\"
+.\" This program is free software: you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation, either version 3 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful,
+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.\" GNU Lesser General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU Lesser General Public License
+.\" along with this program. If not, see <http://www.gnu.org/licenses/>.
+.Dd November 19, 2025
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Dt MESH-TOOL 1
+.Os
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh NAME
+.Nm mesh-tool
+.Nd transform an StL mesh
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh SYNOPSIS
+.Nm
+.Op Fl abdhrv
+.Op Fl i Ar input
+.Op Fl o Ar output
+.Op Fl S Ar sx , Ns Ar sy , Ns Ar sz
+.Op Fl T Ar tx , Ns Ar ty , Ns Ar tz
+.Op Fl V Ar verbosity
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh DESCRIPTION
+.Nm
+aims to transform a mesh stored in StL format.
+Multiple transformations can be applied in a single invocation by
+repeating the transformation options as needed
+.Po
+options
+.Fl S
+and
+.Fl T
+.Pc .
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl a
+Assume an ASCII StL format.
+.It Fl b
+Assumes a binary StL format.
+.It Fl d
+Output mesh description and exit.
+.It Fl h
+Output short help and exit.
+.It Fl i Ar input
+Path to the input StL file.
+If not defined, the mesh is read from standard input.
+.It Fl o Ar output
+Path to the output StL file.
+If not defined, the transformed mesh is written to standard output.
+.It Fl r
+Reverse the normals.
+.It Fl S Ar sx , Ns Ar sy , Ns Ar sz
+Scale the mesh.
+Repeating this option allows you to apply multiple scales.
+.It Fl T Ar tx , Ns Ar ty , Ns Ar tz
+Translate the mesh.
+Repeating this option allows you to apply multiple translations.
+.It Fl V Ar verbosity
+Set the verbosity level.
+Possible values are
+.Ql 0
+.Pq no message ,
+.Ql 1
+.Pq error messages only ,
+.Ql 2
+.Pq error and warning messages ,
+and
+.Ql 3
+.Pq error, warning and informative messages .
+All the messages are written to standard error.
+Default is 0.
+.It Fl v
+Output version information and exit.
+.El
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh EXIT STATUS
+.Ex -std
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh EXAMPLES
+Make the
+.Pa bunny.stl
+mesh twice as big and move it 5 units along the X ansi and 3.14 units
+along the Z axis.
+Store the transformed mesh in the
+.Pa big_move_bunny.stl
+file:
+.Bd -literal -offset Ds
+mesh-tool -i bunny.st -S 2,2,2 -T 5,0,3.14 -o big_move_bunny.stl
+.Ed
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh SEE ALSO
+.Rs
+.%T The StL Format: Standard Data Format for Fabbers
+.%A Marshall Burns
+.%D 1993
+.%U https://www.fabbers.com/tech/STL_Format
+.Re
diff --git a/src/mtool_args.c b/src/mtool_args.c
@@ -30,8 +30,8 @@ static INLINE void
usage(FILE* stream)
{
fprintf(stream,
-"usage: mesh-tool [-abdhrv] [-i file] [-o file] [-S sx,sy,sz] [-T tx,ty,tz]\n"
-" [-V verbosity_level]\n");
+"usage: mesh-tool [-abdhrv] [-i input] [-o output] [-S sx,sy,sz] [-T tx,ty,tz]\n"
+" [-V verbosity]\n");
}
static INLINE void