remove manual and add help message in readme and program

This commit is contained in:
Night Kaly 2024-05-21 14:38:38 +00:00
parent f64fcb259d
commit ada89a098a
4 changed files with 7 additions and 25 deletions

View file

@ -4,10 +4,8 @@
CC = cc CC = cc
VERSION = 1.0 VERSION = 1.0
TARGET = lcc TARGET = lcc
MANPAGE = $(TARGET).1
PREFIX ?= /usr/local PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
# Flags # Flags
CFLAGS = -O3 -march=native -mtune=native -pipe -s -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 CFLAGS = -O3 -march=native -mtune=native -pipe -s -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600
@ -19,7 +17,7 @@ $(TARGET): $(SRC)
dist: dist:
mkdir -p $(TARGET)-$(VERSION) mkdir -p $(TARGET)-$(VERSION)
cp -R README.md $(MANPAGE) $(TARGET) $(TARGET)-$(VERSION) cp -R README.md $(TARGET) $(TARGET)-$(VERSION)
tar -cf $(TARGET)-$(VERSION).tar $(TARGET)-$(VERSION) tar -cf $(TARGET)-$(VERSION).tar $(TARGET)-$(VERSION)
gzip $(TARGET)-$(VERSION).tar gzip $(TARGET)-$(VERSION).tar
rm -rf $(TARGET)-$(VERSION) rm -rf $(TARGET)-$(VERSION)
@ -29,12 +27,9 @@ install: $(TARGET)
mkdir -p $(DESTDIR)$(MANDIR) mkdir -p $(DESTDIR)$(MANDIR)
cp -p $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET) cp -p $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)
chmod 755 $(DESTDIR)$(BINDIR)/$(TARGET) chmod 755 $(DESTDIR)$(BINDIR)/$(TARGET)
cp -p $(MANPAGE) $(DESTDIR)$(MANDIR)/$(MANPAGE)
chmod 644 $(DESTDIR)$(MANDIR)/$(MANPAGE)
uninstall: uninstall:
$(RM) $(DESTDIR)$(BINDIR)/$(TARGET) $(RM) $(DESTDIR)$(BINDIR)/$(TARGET)
$(RM) $(DESTDIR)$(MANDIR)/$(MANPAGE)
clean: clean:
$(RM) $(TARGET) $(RM) $(TARGET)

View file

@ -1,10 +1,10 @@
# lcc # lcc
Lines of Code Counter Fast lines of code counter.
# Usage # Usage
```sh ```sh
lcc <path> <path2> <path3> ... lcc <path> <path2> <path3> - Count lines of code in supplied paths(no argument would be considered counting in current directory)
``` ```
# Dependencies # Dependencies

17
lcc.1
View file

@ -1,17 +0,0 @@
.TH lcc 1 lcc\-1.0.0
.SH NAME
lcc \- Lines of Code Counter
.SH SYNOPSIS
.B lcc
.SH DESCRIPTION
lcc is a fast and lightweight source lines of code counter.
.SH OPTIONS
.TP
.B apm <path> <path2> <path3>
Count lines of code in the supplied paths.
.SH AUTHOR
Made by Night Kaly
.B <night@night0721.xyz>

4
lcc.c
View file

@ -134,6 +134,10 @@ int compare_stats(const void *a, const void *b) {
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
if (argc == 2 && strncmp(argv[1], "-h", 2) == 0) {
fprintf(stderr, "lcc - Lines of Code Counter\n\nUsage: lcc <path> <path2> <path3> - Count lines of code in supplied paths(no argument would be considered counting in current directory)\n");
return 0;
}
for (size_t i = 0; i < NUM_LANGS; i++) { for (size_t i = 0; i < NUM_LANGS; i++) {
stats[i].name = languages[i].name; stats[i].name = languages[i].name;
} }