Sun, 05 Jul 2026 12:26:02 +0200
add man page and fix uwproj config
resolves #916
| Makefile | file | annotate | diff | comparison | revisions | |
| configure | file | annotate | diff | comparison | revisions | |
| make/project.xml | file | annotate | diff | comparison | revisions | |
| man/cline.1 | file | annotate | diff | comparison | revisions | |
| src/Makefile | file | annotate | diff | comparison | revisions | |
| src/cline.c | file | annotate | diff | comparison | revisions |
--- a/Makefile Sat Jul 04 12:28:16 2026 +0200 +++ b/Makefile Sun Jul 05 12:26:02 2026 +0200 @@ -21,7 +21,7 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -VERSION=1.6.0-dev +VERSION=1.6.0 all: build config.mk FORCE @cd src && $(MAKE) VERSION=$(VERSION) @@ -32,7 +32,7 @@ dist: FORCE @mkdir -p dist/cline @cp -R README LICENSE Makefile configure \ - make src test dist/cline/ + make src test man dist/cline/ @cd dist; tar -czf cline-$(VERSION).tar.gz -Hustar cline @rm -f -R dist/cline @echo "Dist file created: dist/cline-$(VERSION).tar.gz"
--- a/configure Sat Jul 04 12:28:16 2026 +0200 +++ b/configure Sun Jul 05 12:26:02 2026 +0200 @@ -89,6 +89,41 @@ echo echo "Configuration:" fi +if true \ + ; then + : + if [ -z "$prefix__described__" ] ; then + prefix__described__=1 + cat << '__EOF__' + --prefix path prefix for architecture-independent files [/usr] +__EOF__ + fi + if [ -z "$exec_prefix__described__" ] ; then + exec_prefix__described__=1 + cat << '__EOF__' + --exec-prefix path prefix for architecture-dependent files [PREFIX] +__EOF__ + fi + if [ -z "$bindir__described__" ] ; then + bindir__described__=1 + cat << '__EOF__' + --bindir user executables [EPREFIX/bin] +__EOF__ + fi + if [ -z "$datarootdir__described__" ] ; then + datarootdir__described__=1 + cat << '__EOF__' + --datarootdir read-only architecture-independent data root + [PREFIX/share] +__EOF__ + fi + if [ -z "$mandir__described__" ] ; then + mandir__described__=1 + cat << '__EOF__' + --mandir man documentation [DATAROOTDIR/man] +__EOF__ + fi +fi cat << '__EOF__' Build Types: @@ -114,6 +149,35 @@ # config variables has_overridable_config_vars__=0 +if true \ + ; then + : + if [ -z "$prefix__initialized__" ] ; then + has_overridable_config_vars__=1 + prefix__initialized__=1 + prefix='/usr' + fi + if [ -z "$exec_prefix__initialized__" ] ; then + has_overridable_config_vars__=1 + exec_prefix__initialized__=1 + exec_prefix='' + fi + if [ -z "$bindir__initialized__" ] ; then + has_overridable_config_vars__=1 + bindir__initialized__=1 + bindir='' + fi + if [ -z "$datarootdir__initialized__" ] ; then + has_overridable_config_vars__=1 + datarootdir__initialized__=1 + datarootdir='' + fi + if [ -z "$mandir__initialized__" ] ; then + has_overridable_config_vars__=1 + mandir__initialized__=1 + mandir='' + fi +fi # features @@ -124,6 +188,11 @@ for ARG in "$@" do case "$ARG" in + "--prefix="*) prefix=${ARG#--prefix=} ;; + "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; + "--bindir="*) bindir=${ARG#--bindir=} ;; + "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; + "--mandir="*) mandir=${ARG#--mandir=} ;; "--help"*) printhelp ;; "--debug") BUILD_TYPE="debug" ;; "--release") BUILD_TYPE="release" ;; @@ -228,6 +297,11 @@ # generate vars.mk echo '# configuration' > "$TEMP_DIR/vars.mk" +echo "prefix=$prefix" >> "$TEMP_DIR/vars.mk" +echo "exec_prefix=$exec_prefix" >> "$TEMP_DIR/vars.mk" +echo "bindir=$bindir" >> "$TEMP_DIR/vars.mk" +echo "datarootdir=$datarootdir" >> "$TEMP_DIR/vars.mk" +echo "mandir=$mandir" >> "$TEMP_DIR/vars.mk" echo >> "$TEMP_DIR/vars.mk" # @@ -361,6 +435,26 @@ if [ $has_overridable_config_vars__ -eq 1 ]; then echo echo "Config:" + if [ -n "$prefix__initialized__" ]; then + printf ' %-16s' 'prefix:' + echo "$prefix" + fi + if [ -n "$exec_prefix__initialized__" ]; then + printf ' %-16s' 'exec-prefix:' + echo "$exec_prefix" + fi + if [ -n "$bindir__initialized__" ]; then + printf ' %-16s' 'bindir:' + echo "$bindir" + fi + if [ -n "$datarootdir__initialized__" ]; then + printf ' %-16s' 'datarootdir:' + echo "$datarootdir" + fi + if [ -n "$mandir__initialized__" ]; then + printf ' %-16s' 'mandir:' + echo "$mandir" + fi fi echo
--- a/make/project.xml Sat Jul 04 12:28:16 2026 +0200 +++ b/make/project.xml Sun Jul 05 12:26:02 2026 +0200 @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://unixwork.de/uwproj" version="0.4"> + <config> + <bindir/> + <mandir/> + </config> <dependency> <lang>c</lang> </dependency>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/man/cline.1 Sun Jul 05 12:26:02 2026 +0200 @@ -0,0 +1,160 @@ +.TH cline 1 "2026-07-05" "cline 1.6.0" "cline Manual" +.SH NAME +cline \- count line terminator characters in files +.SH SYNOPSIS +.B cline +.RI [ Options ] +.RI [ Directories... ] +.SH DESCRIPTION +.B cline +counts the line terminator characters +.RB ( \en ) +within all files in the specified directories. + +If no directory is specified, +.B cline +scans the current directory. +.SH OPTIONS +.TP +.BI \-b " level" +Set the binary file heuristics level. The default is +.BR medium . +Valid levels are: +.BR ignore , +.BR low , +.BR medium , +and +.BR high . +The heuristics use the ratio of non-printable characters after seeing +enough printable characters in the file (see +.MR isprint 3 ). +The higher the detection level, the +more printable characters the algorithm wants to see before making a decision. + +Note that some Unicode files with a high ratio of non-printable +characters from the perspective of +.MR isprint 3 , +might be misdetected by this algorithm as binary files. +.TP +.B \-c +Count non-whitespace characters instead of lines. +.TP +.B \-d +Report only directory sums. +.TP +.BI \-D " path" +Exclude the directory at the specified +.IR path . +A path can be relative or absolute but must always contain at least one path +separator. For example, if you want to exclude the top-level +.IR target +directory in a project of yours, use +.BI \-D " ./target" +to specify a path relative to your current directory. If you just write +.BI \-D " target" +you would exclude +.IR all +directories with that name in an recursive search with the +.BR -r +option. +This option may be used multiple times. +.TP +.BI \-D " name" +Exclude all directories with the given +.IR name . +This option may be used multiple times. +.TP +.BI \-E " pattern" +Exclude any line matching the regular expression +.IR pattern . +This option may be used multiple times. +.TP +.BI \-e " start end" +Exclude lines between the regular expressions +.I start +and +.IR end . +The first and the last line are only excluded when they completely match the +.IR start " or " end +pattern, respectively. +Similarly, when used with the +.BR \-c +option, characters within a line before +.IR start +matches and after +.IR end +matches are still counted. +This option may be used multiple times. +.TP +.BR \-h ", " \-\-help +Print help text and exit. +.TP +.B \-i +Print individual sums per file extension. +This option cannot be used together with +.BR \-V . +.TP +.B \-m +Print information about matching files only. +.TP +.BI \-s " suffixes" +Only count files with these suffixes. +Suffixes are separated by commas. +.TP +.BI \-S " suffixes" +Count any file except those with these suffixes. +Suffixes are separated by commas. +.TP +.BR \-r ", " \-R +Scan subdirectories recursively. +.TP +.BR \-v ", " \-\-version +Print version information. +.TP +.B \-V +Turn verbose output off and print the result only. +.SH SHORTCUTS +.TP +.B \-\-exclude\-cstyle\-comments +Equivalent to: +.BR "\-E '\es*//'" " " "\-e '\es*/\e*' '\e*/\es*'" +.TP +.B \-\-exclude\-blank\-lines +Equivalent to: +.BR "\-E '^\es*$'" +.SH EXAMPLES +.TP +.B cline \-rms .c,.h \-\-exclude\-cstyle\-comments +Recursively count matching +.I .c +and +.I .h +files, print matching files only, and exclude C-style comments. +.TP +.B cline \-Vc src +Print only the total number of non-whitespace characters in +.IR src . +.TP +.B cline \-rms .rs \-D ./target +Recursively count matching Rust source files starting with the current +directory, but skip the target directory. Print only matching files. +.TP +.B cline \-rb high -d -D .git +Recursively count all non-binary files with a high binary file detection +heuristic. Report only sums per directory and skip all directories with the +name +.IR .git . +.SH SEE ALSO +.UR https://uap-core.de/man/cline.html +https://uap-core.de/man/cline.html +.UE + +.UR https://uap-core.de/hg/cline +https://uap-core.de/hg/cline +.UE + +.UR https://sourceforge.net/projects/cline/ +https://sourceforge.net/projects/cline/ +.UE +.SH AUTHOR +Copyright 2018 Mike Becker. \ No newline at end of file
--- a/src/Makefile Sat Jul 04 12:28:16 2026 +0200 +++ b/src/Makefile Sun Jul 05 12:26:02 2026 +0200 @@ -24,22 +24,29 @@ include ../config.mk BUILD_DIR = ../build +MAN_DIR = ../man SRC = arguments.c bfile_heuristics.c cline.c regex_parser.c scanner.c \ settings.c string_list.c OBJ = $(SRC:%.c=$(BUILD_DIR)/%.o) CFLAGS += -DVERSION='"$(VERSION)"' -all: $(BUILD_DIR)/cline FORCE +all: $(BUILD_DIR)/cline $(BUILD_DIR)/cline.1.gz FORCE @echo "Build successful." -install: $(BUILD_DIR)/cline FORCE - cd .. && cp "build/cline" "$(bindir)/cline" +install: $(BUILD_DIR)/cline $(BUILD_DIR)/cline.1.gz FORCE + cp "$(BUILD_DIR)/cline" "$(bindir)/cline" @echo "Installed to: $(bindir)/cline" + cp "$(BUILD_DIR)/cline.1.gz" "$(mandir)/man1/cline.1.gz" + @echo "Man page: $(mandir)/man1/cline.1.gz" $(BUILD_DIR)/cline: $(OBJ) @echo "Linking executable..." $(CC) $(LDFLAGS) -o $@ $^ +$(BUILD_DIR)/cline.1.gz: $(MAN_DIR)/cline.1 + cp $< $(BUILD_DIR)/ + gzip $(BUILD_DIR)/cline.1 + FORCE: $(BUILD_DIR)/arguments.o: arguments.c arguments.h stdinc.h string_list.h
--- a/src/cline.c Sat Jul 04 12:28:16 2026 +0200 +++ b/src/cline.c Sun Jul 05 12:26:02 2026 +0200 @@ -64,20 +64,9 @@ "\n\nShortcuts:" "\n --exclude-cstyle-comments : -E '\\s*//' -e '\\s*/\\*' '\\*/\\s*'" "\n --exclude-blank-lines : -E '^\\s*$'" - "\n\n" - "The default call without any options is:" - "\n cline ./\n\n" - "So each file in the working directory is counted. If you want to count C" - "\nsource code in your working directory and its subdirectories, type:" - "\n cline -rs .c\n" - "\nIf you want to exclude comment lines, you may use the -e/-E option." - "\nAfter a line matches the regex pattern <start>, this and any following" - "\nline is not counted unless a line matches the <end> pattern. A line is" - "\nstill counted when it does not start or end with the respective pattern." - "\nPlease note, that cline does not trim the lines before matching against" - "\nthe pattern." - "\n\nExample (C without comments):" - "\n cline -s .c,.h --exclude-cstyle-comments" + "\n" + "\nMore infos are available in the man page" + "\nor at https://uap-core.de/man/cline.html" "\n"); }