чување d915fbbbdc4764a3cc7e4189813df26f180d1124
родитељ 596bc6a8e9719075206f7c736b242342615bcfb9
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Fri, 19 Jan 2024 13:06:00 +0100
Add example (findmnt replacement); update copyright years
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 6, додавања: 41(+), брисања: 7(-)
diff --git a/README b/README
@@ -26,7 +26,7 @@ License
-------
dtree - Command line program to draw trees
-Copyright (C) 2023 Страхиња Радић
+Copyright (C) 2023-2024 Страхиња Радић
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
diff --git a/dtree.1.in b/dtree.1.in
@@ -1,5 +1,5 @@
.\" This program is licensed under the terms of GNU GPL v3 or (at your option)
-.\" any later version. Copyright (C) 2023 Страхиња Радић.
+.\" any later version. Copyright (C) 2023-2024 Страхиња Радић.
.\" See the file LICENSE for exact copyright and license details.
.Dd %DATE%
.Dt DTREE 1
@@ -65,8 +65,42 @@ replacement:
.Pp
same, using ASCII characters:
.Dl "find \. \-print | sed \-E \(dqs,[^/]+/,$(printf '\et'),g\(dq | dtree \-sa"
+.Pp
+poor man's
+.Xr findmnt 1
+(depends on having
+.Pa /proc/mounts
+active):
+.Bd -literal
+sort -k2 /proc/mounts |
+awk '{ # pp = previous pointer
+ sl = $2;
+ gsub("[^/]", "", sl);
+ slashc = length(sl); # slash count
+ if ($2 != "/" &&
+ slashc > prevsc[pp] &&
+ substr($2,0,length(prev[pp])) == prev[pp])
+ {
+ for (i = 0; i < pp+1; i++)
+ printf "\t";
+ pp++;
+ }
+ else if ($2 != "/")
+ {
+ if (slashc < prevsc[pp] &&
+ substr($2,0,length(prev[pp-1])) != prev[pp-1])
+ pp--;
+ for (i = 0; i < pp; i++)
+ printf "\t";
+ }
+ print $2;
+ prev[pp] = $2; # previous mountpoint
+ prevsc[pp] = slashc; # previous slash count
+}' |
+dtree
+.Ed
.Sh SEE ALSO
.Xr tree 1
.Sh AUTHORS
.An "Strahinya Radich" Aq contact@strahinja.org ,
-2023
+2023\-2024
diff --git a/dtree.c b/dtree.c
@@ -1,5 +1,5 @@
/* This program is licensed under the terms of GNU GPL v3 or (at your option)
- * any later version. Copyright (C) 2023 Страхиња Радић.
+ * any later version. Copyright (C) 2023-2024 Страхиња Радић.
* See the file LICENSE for exact copyright and license details. */
#include <stdarg.h>
diff --git a/utf8.c b/utf8.c
@@ -1,5 +1,5 @@
/* This program is licensed under the terms of GNU GPL v3 or (at your option)
- * any later version. Copyright (C) 2023 Страхиња Радић.
+ * any later version. Copyright (C) 2023-2024 Страхиња Радић.
* See the file LICENSE for exact copyright and license details. */
#include "utf8.h"
diff --git a/utf8.h b/utf8.h
@@ -1,5 +1,5 @@
/* This program is licensed under the terms of GNU GPL v3 or (at your option)
- * any later version. Copyright (C) 2023 Страхиња Радић.
+ * any later version. Copyright (C) 2023-2024 Страхиња Радић.
* See the file LICENSE for exact copyright and license details. */
#include <stdint.h>
diff --git a/version.h.in b/version.h.in
@@ -1,5 +1,5 @@
/* This program is licensed under the terms of GNU GPL v3 or (at your option)
- * any later version. Copyright (C) 2023 Страхиња Радић.
+ * any later version. Copyright (C) 2023-2024 Страхиња Радић.
* See the file LICENSE for exact copyright and license details. */
#define PROGRAMNAME "dtree"