summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2019-07-31 12:02:07 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-07-31 12:03:26 (GMT)
commit3491fb4f90691d3daa257bbcf39c746d93729a58 (patch) (side-by-side diff)
tree532e3669934e94487d83fe5ff51eabc93f17c7c6
parent9bda41410fb153f9c5cb7289e98f71d4f5a04a83 (diff)
downloadswu-3491fb4f90691d3daa257bbcf39c746d93729a58.tar.gz
swu-3491fb4f90691d3daa257bbcf39c746d93729a58.tar.bz2
Version 1.0v1.0
* swu.c: Use -? option to display the help text. * Makefile: Add the distcheck goal. * swu.1: Document changes. * NEWS: New file.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile31
-rw-r--r--NEWS35
-rw-r--r--swu.112
-rw-r--r--swu.c26
4 files changed, 73 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index 8c3fb6d..098853f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
# This file is part of swu
-# Copyright (C) 2016 Sergey Poznyakoff
+# Copyright (C) 2016, 2019 Sergey Poznyakoff
#
# Swu is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,9 +22,9 @@ MAN1DIR=$(MANDIR)/man1
PACKAGE=swu
VERSION=1.0
-distdir=$(PACKAGE)-$(VERSION)
+DISTDIR=$(PACKAGE)-$(VERSION)
-DISTFILES=Makefile swu.c swu.1 README
+DISTFILES=Makefile swu.c swu.1 README NEWS
swu: swu.c
cc -oswu $(CFLAGS) $(CPPFLAGS) swu.c
@@ -36,11 +36,20 @@ install: swu
install -D swu $(DESTDIR)$(BINDIR)/swu
install -D -m 644 swu.1 $(DESTDIR)$(MAN1DIR)/swu.1
-distdir:
- rm -rf $(distdir) && \
- mkdir $(distdir) && \
- cp $(DISTFILES) $(distdir)
-
-dist: distdir
- tar cfz $(distdir).tar.gz $(distdir)
- rm -rf $(distdir)
+DISTDIR:
+ rm -rf $(DISTDIR) && \
+ mkdir $(DISTDIR) && \
+ cp $(DISTFILES) $(DISTDIR)
+
+dist: DISTDIR
+ tar cfz $(DISTDIR).tar.gz $(DISTDIR)
+ rm -rf $(DISTDIR)
+
+distcheck: dist
+ tar xfz $(DISTDIR).tar.gz
+ @if $(MAKE) -C $(DISTDIR) $(DISTCHECKFLAGS); then \
+ echo "$(DISTDIR).tar.gz ready for distribution"; \
+ rm -rf $(DISTDIR); \
+ else \
+ exit 2; \
+ fi
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..40219d8
--- a/dev/null
+++ b/NEWS
@@ -0,0 +1,35 @@
+swu -- history of user-visible changes. 2019-07-31
+See the end of file for copying conditions.
+
+Please send swu bug reports to <gray@gnu.org.ua>
+
+Version 1.0, 2019-07-31
+
+Initial release.
+
+
+=========================================================================
+Copyright information:
+
+Copyright (C) 2016-2019 Sergey Poznyakoff
+
+ Permission is granted to anyone to make or distribute verbatim copies
+ of this document as received, in any medium, provided that the
+ copyright notice and this permission notice are preserved,
+ thus giving the recipient permission to redistribute in turn.
+
+ Permission is granted to distribute modified versions
+ of this document, or of portions of it,
+ under the above conditions, provided also that they
+ carry prominent notices stating who last changed them.
+
+Local variables:
+mode: outline
+paragraph-separate: "[ ]*$"
+eval: (add-hook 'write-file-hooks 'time-stamp)
+time-stamp-start: "changes. "
+time-stamp-format: "%:y-%02m-%02d"
+time-stamp-end: "\n"
+end:
+
+
diff --git a/swu.1 b/swu.1
index d60f478..f273cc9 100644
--- a/swu.1
+++ b/swu.1
@@ -1,5 +1,5 @@
.\" This file is part of swu -*- nroff -*-
-.\" Copyright (C) 2016 Sergey Poznyakoff
+.\" Copyright (C) 2016, 2019 Sergey Poznyakoff
.\"
.\" Swu is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
@@ -13,12 +13,12 @@
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with swu. If not, see <http://www.gnu.org/licenses/>.
-.TH SWU 1 "March 12, 2016" "SWU" "User Commands"
+.TH SWU 1 "July 31, 2019" "SWU" "User Commands"
.SH NAME
swu \- summarize swap usage
.SH SYNOPSIS
\fBswu\fR
-[\fB\-acHhnprstv\fR]
+[\fB\-?acHhnprstv\fR]
[\fB\-\-all\fR]
[\fB\-\-help\fR]
[\fB\-\-human-readable\fR]
@@ -30,8 +30,6 @@ swu \- summarize swap usage
[\fB\-\-total\fR]
[\fB\-\-verbose\fR]
[\fIPROGRAM\fR]...
-.sp
-\fBswu \-\-help\fR
.SH DESCRIPTION
Displays the amount of swap space used by each
.I PROGRAM
@@ -48,7 +46,7 @@ ascending order.
.BR \-a ", " \-\-all
Print all entries, including those with zero size.
.TP
-.B \-\-help
+.B \-?, \-\-help
Produce help output.
.TP
.BR \-h ", " \-\-human\-readable
@@ -85,7 +83,7 @@ Sergey Poznyakoff
.SH "BUG REPORTS"
Report bugs to <gray@gnu.org.ua>.
.SH COPYRIGHT
-Copyright \(co 2016 Sergey Poznyakoff
+Copyright \(co 2016, 2019 Sergey Poznyakoff
.br
.na
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
diff --git a/swu.c b/swu.c
index 5149879..7a12af8 100644
--- a/swu.c
+++ b/swu.c
@@ -1,5 +1,5 @@
/* This file is part of swu
- * Copyright (C) 2016 Sergey Poznyakoff
+ * Copyright (C) 2016, 2019 Sergey Poznyakoff
*
* Swu is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -304,7 +304,7 @@ help(void)
puts("Summarize swap usage");
putchar('\n');
puts("-a, --all print all entries, including those with zero size");
- puts("--help produce this help output");
+ puts("-?, --help produce this help output");
puts("-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)");
puts("-H, --si likewise, but use powers of 1000 not 1024");
puts("-n, --name sort output by name");
@@ -317,11 +317,9 @@ help(void)
puts("Report bugs to <gray@gnu.org>");
}
-#define OPT_HELP 256
-
struct option opt[] = {
{ "all", 0, NULL, 'a' },
- { "help", 0, NULL, OPT_HELP },
+ { "help", 0, NULL, '?' },
{ "human-readable", 0, NULL, 'h' },
{ "si", 0, NULL, 'H' },
{ "name", 0, NULL, 'n' },
@@ -343,7 +341,7 @@ main(int argc, char **argv)
++progname;
else
progname = argv[0];
- while ((c = getopt_long(argc, argv, "acHhnprstv", opt, NULL)) != EOF) {
+ while ((c = getopt_long(argc, argv, "?acHhnprstv", opt, NULL)) != EOF) {
switch (c) {
case 'a':
show_all = 1;
@@ -373,14 +371,16 @@ main(int argc, char **argv)
case 'v':
verbose++;
break;
- case OPT_HELP:
- help();
- exit(0);
default:
- fprintf(stderr,
- "try '%s --help' for more information.\n",
- progname);
- exit(1);
+ if (optopt == 0) {
+ help();
+ exit(0);
+ } else {
+ fprintf(stderr,
+ "try '%s --help' for more information.\n",
+ progname);
+ exit(1);
+ }
}
}
if (argc > optind)

Return to:

Send suggestions and report system problems to the System administrator.