diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | CMakeLists.txt | 22 | ||||
| -rwxr-xr-x | build.sh | 4 | ||||
| -rw-r--r-- | man/dir_monitor.1.adoc | 102 |
4 files changed, 128 insertions, 1 deletions
@@ -1,2 +1,3 @@ bin/* +man/*.1 .gdbinit diff --git a/CMakeLists.txt b/CMakeLists.txt index 5afa72d..ee93f0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,3 +32,25 @@ add_executable(dir_monitor ${SOURCE_DM}) target_include_directories(dir_monitor PRIVATE include) target_compile_options(dir_monitor PUBLIC -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -FPIE -pie -Wl,-z,noexecstack -Wl,--as-needed -Wl,--no-copy-dt-needed-entries) + +# The man page generation... + +set(MANPAGE dir_monitor.1) +set(ASCIIDOC_MAN asciidoc -b docbook -d manpage) +add_custom_command( + OUTPUT ${MANPAGE}.xml + COMMAND ${ASCIIDOC_MAN} -o ${MANPAGE}.xml ${CMAKE_CURRENT_SOURCE_DIR}/man/${MANPAGE}.adoc + COMMENT "Create DocBook XML ${MANPAGE}.xml ..." +) + +set(XMLTO_MAN xmlto man) +add_custom_command( + OUTPUT ${MANPAGE} + COMMAND ${XMLTO_MAN} ${MANPAGE}.xml + DEPENDS ${MANPAGE}.xml + COMMENT "Create man page from DocBook XML ${MANPAGE}.xml ..." +) + +add_custom_target(man ALL + DEPENDS ${MANPAGE} +) @@ -2,5 +2,7 @@ # I'm a lazy guy BDIR="/dev/shm/${PWD##*/}_cmakebuild/" mkdir -p bin -cmake -S . -B "${BDIR}" && ( cd "${BDIR}" ; make ) && find "${BDIR}" -maxdepth 1 -perm /u=x,g=x,o=x -type f -exec cp "{}" bin/ \; +cmake -S . -B "${BDIR}" && ( cd "${BDIR}" ; make) && \ + find "${BDIR}" -maxdepth 1 -perm /u=x,g=x,o=x -type f -exec cp "{}" bin/ \; && \ + cp -v "${BDIR}${PWD##*/}.1" man/ diff --git a/man/dir_monitor.1.adoc b/man/dir_monitor.1.adoc new file mode 100644 index 0000000..d3ed9fe --- /dev/null +++ b/man/dir_monitor.1.adoc @@ -0,0 +1,102 @@ +dir_monitor(1) +============== + +== NAME + +dir_monitor - present stat information of a path formatted and sorted + + +== SYNOPSIS + +**dir_monitor** [*OPTION*]... directory + + +== DESCRIPTION +dir_monitor is a simple tool, intended to present the content of a directory in a sorted order with definition of which information from the *stat(2)* call are to be presented. + +It can be used for continuous monitoring of a path by wrappers like *watch*. + + +== OPTIONS + +**--format-string** 'format':: +define columns to print, details below + +**--help**, **-h**:: + Show this message and exit + +**--long-timestamp**, **-t**:: +Print timestamp in long form 'yyyymmdd HH:MM:SS ZONE' + +**--print-header**, **-H**:: +Print a header above the columns + +**--reverse-sort**:: +Sort reversed + +**--show-hidden-entries**, **-a**:: +Show hidden entries in the directory + +**--sort-by** 'name | size | time':: +Sort either by size or time + +**--time-field** 'a | c | m':: +Sort by (a)ccess, (c)hange or (m)odification time. Default: 'm' + + +=== format-string characters +Other characters than the following are ignored. + +[cols=2] +|=== + +|A +|access time + +|C +|change time + +|G +|group name + +|g +|group id + +|M +|modification time + +|n +|file name + +|p +|permissions + +|s +|size + +|T +|type + +|t +|time defined by **--time-field** (default: 'modification time') + +|U +|user name + +|u +|user id + +|=== + + +== EXAMPLES + +dir_monitor --long-timestamp --print-header --format-string \'sAMn' --sort-by time --show-hidden /tmp + +watch -d \'*dir_monitor -t -H /tmp/*' + +== SEE ALSO +*watch(1)* + +== AUTHOR +Thorsten Töpper |
