From ada89a098a25a954282306902895c4fd300ebad0 Mon Sep 17 00:00:00 2001 From: night0721 Date: Tue, 21 May 2024 14:38:38 +0000 Subject: [PATCH] remove manual and add help message in readme and program --- Makefile | 7 +------ README.md | 4 ++-- lcc.1 | 17 ----------------- lcc.c | 4 ++++ 4 files changed, 7 insertions(+), 25 deletions(-) delete mode 100644 lcc.1 diff --git a/Makefile b/Makefile index f2fcf6a..1acfe45 100644 --- a/Makefile +++ b/Makefile @@ -4,10 +4,8 @@ CC = cc VERSION = 1.0 TARGET = lcc -MANPAGE = $(TARGET).1 PREFIX ?= /usr/local BINDIR = $(PREFIX)/bin -MANDIR = $(PREFIX)/share/man/man1 # Flags 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: 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) gzip $(TARGET)-$(VERSION).tar rm -rf $(TARGET)-$(VERSION) @@ -29,12 +27,9 @@ install: $(TARGET) mkdir -p $(DESTDIR)$(MANDIR) cp -p $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET) chmod 755 $(DESTDIR)$(BINDIR)/$(TARGET) - cp -p $(MANPAGE) $(DESTDIR)$(MANDIR)/$(MANPAGE) - chmod 644 $(DESTDIR)$(MANDIR)/$(MANPAGE) uninstall: $(RM) $(DESTDIR)$(BINDIR)/$(TARGET) - $(RM) $(DESTDIR)$(MANDIR)/$(MANPAGE) clean: $(RM) $(TARGET) diff --git a/README.md b/README.md index 5dbd6a0..d6a7a4e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # lcc -Lines of Code Counter +Fast lines of code counter. # Usage ```sh -lcc ... +lcc - Count lines of code in supplied paths(no argument would be considered counting in current directory) ``` # Dependencies diff --git a/lcc.1 b/lcc.1 deleted file mode 100644 index 98da224..0000000 --- a/lcc.1 +++ /dev/null @@ -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 -Count lines of code in the supplied paths. - -.SH AUTHOR -Made by Night Kaly -.B diff --git a/lcc.c b/lcc.c index 2852c2b..49f0356 100644 --- a/lcc.c +++ b/lcc.c @@ -134,6 +134,10 @@ int compare_stats(const void *a, const void *b) { 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 - 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++) { stats[i].name = languages[i].name; }