dtree

Програм из командне линије за исцртавање стабала
git clone https://git.sr.ht/~strahinja/dtree
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 239defaf6fee4b279e042bde728f0f0296420798
родитељ 3410bb5ad32b49016627899fd6dba6a7cfde9244
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Mon, 18 Sep 2023 18:42:47 +0200

Project rename: ftree -> dtree

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
M.gitignore | 6+++---
MINSTALL | 4++--
MREADME | 6+++---
MTODO | 2+-
Mall.do | 2+-
Mclean.do | 2+-
Adtree.1.in | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rftree.c -> dtree.c | 0
Adtree.do | 11+++++++++++
Dftree.1.in | 68--------------------------------------------------------------------
Dftree.do | 11-----------
Minstall.do | 6+++---
Mtest/test-002.txt | 2+-
Muninstall.do | 4++--
Mversion.h.in | 2+-
измењених датотека: 15, додавања: 97(+), брисања: 97(-)

diff --git a/.gitignore b/.gitignore @@ -19,9 +19,9 @@ nohup.out *.1 config.redo cscope.out -ftree -ftree.1 -ftree.html +dtree +dtree.1 +dtree.html date version version.h diff --git a/INSTALL b/INSTALL @@ -8,8 +8,8 @@ Prerequisites Install ------- - $ git clone https://git.sr.ht/~strahinja/ftree - $ cd ftree + $ git clone https://git.sr.ht/~strahinja/dtree + $ cd dtree $ su If you have djb redo: diff --git a/README b/README @@ -1,4 +1,4 @@ -ftree +dtree ===== Command line program to draw trees @@ -11,7 +11,7 @@ Examples Format a tree using double-stroke box drawing characters: - $ printf "A\n\tB\n\t\tC\n\tD\n" | ftree -sd + $ printf "A\n\tB\n\t\tC\n\tD\n" | dtree -sd A ╠══B ║ ╚══C @@ -21,7 +21,7 @@ Format a tree using double-stroke box drawing characters: License ------- -ftree - Command line program to draw trees +dtree - Command line program to draw trees Copyright (C) 2023 Страхиња Радић This program is free software: you can redistribute it and/or modify it under diff --git a/TODO b/TODO @@ -10,5 +10,5 @@ TODO '`' and '+' besides having two passes, one for reading the input and the other for output, because there needs to be a way to know when a group of node's children ends. (Maybe with seek/rewind, but that can't - be done for stdin, so the code would need to include both cases.) + be done for stdin, so the code would need to account for both cases.) - Now looking at tree(1)'s source, it also creates a tree in memory. diff --git a/all.do b/all.do @@ -1 +1 @@ -redo-ifchange version.h ftree ftree.1.gz +redo-ifchange version.h dtree dtree.1.gz diff --git a/clean.do b/clean.do @@ -1,2 +1,2 @@ redo-always -rm -f ftree ftree.1 ftree.1.gz *.o *~ version date +rm -f dtree dtree.1 dtree.1.gz *.o *~ version date diff --git a/dtree.1.in b/dtree.1.in @@ -0,0 +1,68 @@ +.Dd %DATE% +.Dt DTREE 1 +.Os +.Sh NAME +.Nm dtree +.Nd Command line program to draw trees +.Sh SYNOPSIS +.Nm +.Op Fl hv +.Pp +.Nm +.Oo Fl s Ar set Oc Op Ar file +.Sh DESCRIPTION +.Nm +is a simple command line program which reads a number of lines and formats them +as a tree using line drawing characters in several sets. +Each input line represents one node in a tree. +The number of tabs at the start of each input line determines the nesting level +of that node. +It is intended for the root node to have no tabs at the start. +.Pp +If the +.Ar file +is omitted, +.Nm +will read from stdin. +Any additional arguments after +.Ar file +will be ignored. +. +.Ss Command line options +.Bl -tag -width ".Nm Fl h" -offset indent +. +.It Nm Fl h +Prints usage information. +. +.It Nm Fl s Ar set +Selects the symbol set +.Ar set . +Allowed values for +.Ar set +are: +.Cm a +(ASCII set), +.Cm d +(double\-stroke set), +and +.Cm s +(single\-stroke set, default). +. +.It Nm Fl v +Prints version and commit date. +.El +.Sh EXAMPLES +Format a tree using double-stroke box drawing characters: +. +.Bd -literal +$ printf \(dqA\en\etB\en\et\etC\en\etD\en\(dq | dtree -sd +A +╠══B +║ ╚══C +╚══D +.Ed +.Sh SEE ALSO +.Xr tree 1 +.Sh AUTHORS +.An "Strahinya Radich" Aq contact@strahinja.org , +2023 diff --git a/ftree.c b/dtree.c diff --git a/dtree.do b/dtree.do @@ -0,0 +1,11 @@ +if [ -r ./config.redo ]; then + . ./config.redo +fi +for f in *.h.in; do + echo $f | sed -e's/\.in$//g' +done | xargs redo-ifchange +for f in *.h *.c; do + echo $f + echo $f | sed -e's/\.c$/.o/g' +done | xargs redo-ifchange +${CC:-gcc -g} -Wall -pedantic -std=c99 -o $3 dtree.o utf8.o ${LIBS} diff --git a/ftree.1.in b/ftree.1.in @@ -1,68 +0,0 @@ -.Dd %DATE% -.Dt FTREE 1 -.Os -.Sh NAME -.Nm ftree -.Nd Command line program to draw trees -.Sh SYNOPSIS -.Nm -.Op Fl hv -.Pp -.Nm -.Oo Fl s Ar set Oc Op Ar file -.Sh DESCRIPTION -.Nm -is a simple command line program which reads a number of lines and formats them -as a tree using line drawing characters in several sets. -Each input line represents one node in a tree. -The number of tabs at the start of each input line determines the nesting level -of that node. -It is intended for the root node to have no tabs at the start. -.Pp -If the -.Ar file -is omitted, -.Nm -will read from stdin. -Any additional arguments after -.Ar file -will be ignored. -. -.Ss Command line options -.Bl -tag -width ".Nm Fl h" -offset indent -. -.It Nm Fl h -Prints usage information. -. -.It Nm Fl s Ar set -Selects the symbol set -.Ar set . -Allowed values for -.Ar set -are: -.Cm a -(ASCII set), -.Cm d -(double\-stroke set), -and -.Cm s -(single\-stroke set, default). -. -.It Nm Fl v -Prints version and commit date. -.El -.Sh EXAMPLES -Format a tree using double-stroke box drawing characters: -. -.Bd -literal -$ printf \(dqA\en\etB\en\et\etC\en\etD\en\(dq | ftree -sd -A -╠══B -║ ╚══C -╚══D -.Ed -.Sh SEE ALSO -.Xr tree 1 -.Sh AUTHORS -.An "Strahinya Radich" Aq contact@strahinja.org , -2023 diff --git a/ftree.do b/ftree.do @@ -1,11 +0,0 @@ -if [ -r ./config.redo ]; then - . ./config.redo -fi -for f in *.h.in; do - echo $f | sed -e's/\.in$//g' -done | xargs redo-ifchange -for f in *.h *.c; do - echo $f - echo $f | sed -e's/\.c$/.o/g' -done | xargs redo-ifchange -${CC:-gcc -g} -Wall -pedantic -std=c99 -o $3 ftree.o utf8.o ${LIBS} diff --git a/install.do b/install.do @@ -4,13 +4,13 @@ if [ -r ./config.redo ]; then fi PREFIX=${PREFIX:-/usr/local} BINDIR=$PREFIX/bin -DOCDIR=$PREFIX/share/doc/ftree +DOCDIR=$PREFIX/share/doc/dtree MANDIR=$PREFIX/share/man/man1 install -d $DOCDIR -for executable in ftree; do +for executable in dtree; do install -Dm 0755 "${executable}" "${BINDIR}/${executable}" done for docfile in README; do install -Dm 0644 "${docfile}" "${DOCDIR}/${docfile}" done -install -Dm 0644 ftree.1.gz "${MANDIR}/ftree.1.gz" +install -Dm 0644 dtree.1.gz "${MANDIR}/dtree.1.gz" diff --git a/test/test-002.txt b/test/test-002.txt @@ -1,5 +1,5 @@ . - ftree + dtree test test-001.txt test-002.txt diff --git a/uninstall.do b/uninstall.do @@ -4,6 +4,6 @@ if [ -r ./config.redo ]; then fi PREFIX=${PREFIX:-/usr/local} BINDIR=$PREFIX/bin -DOCDIR=$PREFIX/share/doc/ftree +DOCDIR=$PREFIX/share/doc/dtree MANDIR=$PREFIX/share/man/man1 -rm -f $BINDIR/ftree $(find $DOCDIR -type f) $MANDIR/ftree.1.gz +rm -f $BINDIR/dtree $(find $DOCDIR -type f) $MANDIR/dtree.1.gz diff --git a/version.h.in b/version.h.in @@ -2,6 +2,6 @@ * any later version. Copyright (C) 2023 Страхиња Радић. * See the file LICENSE for exact copyright and license details. */ -#define PROGRAMNAME "ftree" +#define PROGRAMNAME "dtree" #define DATE "%DATE%" #define VERSION "%VERSION%"