* [PATCH 01/23] swapon: align available columns section in usage()
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 02/23] docs: update deprecation banners Sami Kerola
` (22 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Commit 5db57cfc469b45ada0162a64d627ce25a3d2431f missed doing this change.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/swapon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c
index 976f87e..1170f9e 100644
--- a/sys-utils/swapon.c
+++ b/sys-utils/swapon.c
@@ -735,7 +735,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fputs(_("\nAvailable columns (for --show):\n"), out);
for (i = 0; i < ARRAY_SIZE(infos); i++)
- fprintf(out, " %4s %s\n", infos[i].name, _(infos[i].help));
+ fprintf(out, " %-5s %s\n", infos[i].name, _(infos[i].help));
fprintf(out, USAGE_MAN_TAIL("swapon(8)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 02/23] docs: update deprecation banners
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
2014-09-28 19:51 ` [PATCH 01/23] swapon: align available columns section in usage() Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 03/23] hexdump: remove deprecation message Sami Kerola
` (21 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
disk-utils/mkfs.c | 9 +++++++++
login-utils/newgrp.c | 9 ---------
login-utils/vipw.c | 9 ---------
sys-utils/tunelp.c | 9 +++++++++
text-utils/col.c | 9 +++++++++
text-utils/pg.c | 9 +++++++++
6 files changed, 36 insertions(+), 18 deletions(-)
diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c
index cb34951..5bdb931 100644
--- a/disk-utils/mkfs.c
+++ b/disk-utils/mkfs.c
@@ -13,6 +13,15 @@
*
*/
+/*
+ * This command is deprecated. The utility is in maintenance mode,
+ * meaning we keep them in source tree for backward compatibility
+ * only. Do not waste time making this command better, unless the
+ * fix is about security or other very critical issue.
+ *
+ * See Documentation/deprecated.txt for more information.
+ */
+
#include <getopt.h>
#include <limits.h>
#include <stdio.h>
diff --git a/login-utils/newgrp.c b/login-utils/newgrp.c
index 9c0f8f5..a5b1ef2 100644
--- a/login-utils/newgrp.c
+++ b/login-utils/newgrp.c
@@ -6,15 +6,6 @@
* - added Native Language Support
*/
-/*
- * This command is deprecated. The utility is in maintenance mode,
- * meaning we keep them in source tree for backward compatibility
- * only. Do not waste time making this command better, unless the
- * fix is about security or other very critical issue.
- *
- * See Documentation/deprecated.txt for more information.
- */
-
#include <errno.h>
#include <getopt.h>
#include <grp.h>
diff --git a/login-utils/vipw.c b/login-utils/vipw.c
index 6ca5f8c..ca90f65 100644
--- a/login-utils/vipw.c
+++ b/login-utils/vipw.c
@@ -44,15 +44,6 @@
* - fixed strerr(errno) in gettext calls
*/
-/*
- * This command is deprecated. The utility is in maintenance mode,
- * meaning we keep them in source tree for backward compatibility
- * only. Do not waste time making this command better, unless the
- * fix is about security or other very critical issue.
- *
- * See Documentation/deprecated.txt for more information.
- */
-
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
diff --git a/sys-utils/tunelp.c b/sys-utils/tunelp.c
index f9c362c..7beb8a7 100644
--- a/sys-utils/tunelp.c
+++ b/sys-utils/tunelp.c
@@ -7,6 +7,15 @@
*/
/*
+ * This command is deprecated. The utility is in maintenance mode,
+ * meaning we keep them in source tree for backward compatibility
+ * only. Do not waste time making this command better, unless the
+ * fix is about security or other very critical issue.
+ *
+ * See Documentation/deprecated.txt for more information.
+ */
+
+/*
* $Log: tunelp.c,v $
* Revision 1.9 1998/06/08 19:37:11 janl
* Thus compiles tunelp with 2.1.103 kernels
diff --git a/text-utils/col.c b/text-utils/col.c
index 9aa6a41..997f87b 100644
--- a/text-utils/col.c
+++ b/text-utils/col.c
@@ -44,6 +44,15 @@
*
*/
+/*
+ * This command is deprecated. The utility is in maintenance mode,
+ * meaning we keep them in source tree for backward compatibility
+ * only. Do not waste time making this command better, unless the
+ * fix is about security or other very critical issue.
+ *
+ * See Documentation/deprecated.txt for more information.
+ */
+
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
diff --git a/text-utils/pg.c b/text-utils/pg.c
index e9156c3..9ada00c 100644
--- a/text-utils/pg.c
+++ b/text-utils/pg.c
@@ -31,6 +31,15 @@
/* Sccsid @(#)pg.c 1.44 (gritter) 2/8/02 - modified for util-linux */
+/*
+ * This command is deprecated. The utility is in maintenance mode,
+ * meaning we keep them in source tree for backward compatibility
+ * only. Do not waste time making this command better, unless the
+ * fix is about security or other very critical issue.
+ *
+ * See Documentation/deprecated.txt for more information.
+ */
+
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 03/23] hexdump: remove deprecation message
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
2014-09-28 19:51 ` [PATCH 01/23] swapon: align available columns section in usage() Sami Kerola
2014-09-28 19:51 ` [PATCH 02/23] docs: update deprecation banners Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 04/23] textual: fix couple typos in comments Sami Kerola
` (20 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Message 'calling hexdump as od has been deprecated in favor of GNU
coreutils od' has informed the hexdump not to be used like that for three
and half years, and five releases. It is time to get rid of notice.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
text-utils/hexdump.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/text-utils/hexdump.c b/text-utils/hexdump.c
index 50b593e..afae334 100644
--- a/text-utils/hexdump.c
+++ b/text-utils/hexdump.c
@@ -179,7 +179,6 @@ int main(int argc, char **argv)
struct list_head *p;
struct hexdump_fs *tfs;
int ret;
- char *c;
struct hexdump *hex = xcalloc(1, sizeof (struct hexdump));
hex->length = -1;
@@ -190,11 +189,7 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
atexit(close_stdout);
- if (!(c = strrchr(argv[0], 'o')) || strcmp(c, "od")) {
- argv += parse_args(argc, argv, hex);
- } else
- errx(EXIT_FAILURE, _("calling hexdump as od has been deprecated "
- "in favor of GNU coreutils od"));
+ argv += parse_args(argc, argv, hex);
/* figure out the data block size */
hex->blocksize = 0;
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 04/23] textual: fix couple typos in comments
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (2 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 03/23] hexdump: remove deprecation message Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 05/23] flock: add error message to translations Sami Kerola
` (19 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
libfdisk/src/context.c | 2 +-
libfdisk/src/script.c | 2 +-
libsmartcols/src/table_print.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c
index 4931145..e44cc14 100644
--- a/libfdisk/src/context.c
+++ b/libfdisk/src/context.c
@@ -644,7 +644,7 @@ int fdisk_use_cylinders(struct fdisk_context *cxt)
* fdisk_get_units_per_sector:
* @cxt: context
*
- * This is neccessary only for brain dead situations when we use "cylinders";
+ * This is necessary only for brain dead situations when we use "cylinders";
*
* Returns: number of "units" per sector, default is 1 if display unit is sector.
*/
diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c
index bc92c82..d91cef9 100644
--- a/libfdisk/src/script.c
+++ b/libfdisk/src/script.c
@@ -344,7 +344,7 @@ int fdisk_script_read_context(struct fdisk_script *dp, struct fdisk_context *cxt
*
* Writes script @dp to the ile @f.
*
- * Returns: 0 on sucess, <0 on error.
+ * Returns: 0 on success, <0 on error.
*/
int fdisk_script_write_file(struct fdisk_script *dp, FILE *f)
{
diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c
index c9f3d8f..4191515 100644
--- a/libsmartcols/src/table_print.c
+++ b/libsmartcols/src/table_print.c
@@ -100,7 +100,7 @@ static int buffer_set_data(struct libscols_buffer *buf, const char *str)
return rc ? rc : buffer_append_data(buf, str);
}
-/* save the current buffer possition to art_idx */
+/* save the current buffer position to art_idx */
static void buffer_set_art_index(struct libscols_buffer *buf)
{
if (buf) {
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 05/23] flock: add error message to translations
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (3 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 04/23] textual: fix couple typos in comments Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 06/23] textual: use version printing macro everywhere Sami Kerola
` (18 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
And remove type casting.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/flock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-utils/flock.c b/sys-utils/flock.c
index f160eac..810a061 100644
--- a/sys-utils/flock.c
+++ b/sys-utils/flock.c
@@ -218,7 +218,7 @@ int main(int argc, char *argv[])
} else if (optind < argc) {
/* Use provided file descriptor */
- fd = (int)strtol_or_err(argv[optind], "bad number");
+ fd = strtos32_or_err(argv[optind], _("bad file descriptor"));
} else {
/* Bad options */
errx(EX_USAGE, _("requires file descriptor, file or directory"));
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 06/23] textual: use version printing macro everywhere
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (4 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 05/23] flock: add error message to translations Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 07/23] textual: use manual tail usage() macro Sami Kerola
` (17 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Only mount, umount, and blkid remains not using the macro because they
are print also library references.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
disk-utils/cfdisk.c | 3 +--
disk-utils/mkfs.minix.c | 2 +-
schedutils/chrt.c | 3 +--
schedutils/taskset.c | 3 +--
sys-utils/chcpu.c | 3 +--
sys-utils/dmesg.c | 3 +--
sys-utils/hwclock.c | 2 +-
sys-utils/lscpu.c | 3 +--
sys-utils/rtcwake.c | 3 +--
sys-utils/tunelp.c | 3 +--
term-utils/agetty.c | 3 +--
term-utils/script.c | 3 +--
term-utils/scriptreplay.c | 3 +--
term-utils/write.c | 4 +---
text-utils/col.c | 3 +--
text-utils/colcrt.c | 4 +---
text-utils/colrm.c | 4 +---
text-utils/column.c | 5 ++---
text-utils/rev.c | 3 +--
text-utils/tailf.c | 3 +--
text-utils/ul.c | 3 +--
21 files changed, 22 insertions(+), 44 deletions(-)
diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
index ef4e3ff..fabc397 100644
--- a/disk-utils/cfdisk.c
+++ b/disk-utils/cfdisk.c
@@ -2057,8 +2057,7 @@ int main(int argc, char *argv[])
_("unsupported color mode"));
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'z':
cf->zero_start = 1;
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index 2dafc86..81b7ae3 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -665,7 +665,7 @@ int main(int argc, char ** argv) {
if (argc == 2 &&
(!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) {
- printf(_("%s (%s)\n"), program_name, PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
exit(MKFS_EX_OK);
}
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index fec26fd..df115aa 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -261,8 +261,7 @@ int main(int argc, char **argv)
verbose = 1;
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
ret = EXIT_SUCCESS;
diff --git a/schedutils/taskset.c b/schedutils/taskset.c
index 6ebca06..4cda2eb 100644
--- a/schedutils/taskset.c
+++ b/schedutils/taskset.c
@@ -162,8 +162,7 @@ int main(int argc, char **argv)
ts.use_list = 1;
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
usage(stdout);
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
index ada0eaa..aba9d6b 100644
--- a/sys-utils/chcpu.c
+++ b/sys-utils/chcpu.c
@@ -327,8 +327,7 @@ int main(int argc, char *argv[])
cmd = CMD_CPU_RESCAN;
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
usage(stderr);
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index f95609f..53ac228 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -1332,8 +1332,7 @@ int main(int argc, char *argv[])
setbit(ctl.facilities, n);
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'w':
ctl.follow = 1;
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index d0d422d..9151d24 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -1543,7 +1543,7 @@ static int compare_clock (const bool utc, const bool local_opt)
static void out_version(void)
{
- printf(_("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
}
/*
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 8827424..8ae7028 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1724,8 +1724,7 @@ int main(int argc, char *argv[])
mod->hex = 1;
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
usage(stderr);
diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index 51ffb3c..e1cd41d 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -471,8 +471,7 @@ int main(int argc, char **argv)
break;
case 'V':
- printf(_("%s from %s\n"),
- program_invocation_short_name, PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
case 'h':
diff --git a/sys-utils/tunelp.c b/sys-utils/tunelp.c
index 7beb8a7..08cef5c 100644
--- a/sys-utils/tunelp.c
+++ b/sys-utils/tunelp.c
@@ -255,8 +255,7 @@ int main(int argc, char **argv)
#endif
case 'v':
case 'V':
- printf(_("%s from %s\n"),
- program_invocation_short_name, PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
print_usage(stderr);
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index a7044f0..5901228 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -770,8 +770,7 @@ static void parse_args(int argc, char **argv, struct options *op)
reload_agettys();
exit(EXIT_SUCCESS);
case VERSION_OPTION:
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
case HELP_OPTION:
usage(stdout);
diff --git a/term-utils/script.c b/term-utils/script.c
index b9f8738..ad16e74 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -217,8 +217,7 @@ main(int argc, char **argv) {
tflg = 1;
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
break;
case 'h':
diff --git a/term-utils/scriptreplay.c b/term-utils/scriptreplay.c
index ecea592..8e0cb97 100644
--- a/term-utils/scriptreplay.c
+++ b/term-utils/scriptreplay.c
@@ -174,8 +174,7 @@ main(int argc, char *argv[])
maxdelay = getnum(optarg);
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
case 'h':
usage(stdout);
diff --git a/term-utils/write.c b/term-utils/write.c
index 146f4ba..4d217c4 100644
--- a/term-utils/write.c
+++ b/term-utils/write.c
@@ -110,9 +110,7 @@ int main(int argc, char **argv)
while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (c) {
case 'V':
- printf(_("%s from %s\n"),
- program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
usage(stdout);
diff --git a/text-utils/col.c b/text-utils/col.c
index 997f87b..9b2f570 100644
--- a/text-utils/col.c
+++ b/text-utils/col.c
@@ -214,8 +214,7 @@ int main(int argc, char **argv)
compress_spaces = 0;
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'H':
usage(stdout);
diff --git a/text-utils/colcrt.c b/text-utils/colcrt.c
index 6c7f636..a5d5977 100644
--- a/text-utils/colcrt.c
+++ b/text-utils/colcrt.c
@@ -115,9 +115,7 @@ int main(int argc, char **argv) {
printall = 1;
break;
case 'V':
- printf(_("%s from %s\n"),
- program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
usage(stdout);
diff --git a/text-utils/colrm.c b/text-utils/colrm.c
index 454085e..111033d 100644
--- a/text-utils/colrm.c
+++ b/text-utils/colrm.c
@@ -171,9 +171,7 @@ int main(int argc, char **argv)
NULL)) != -1)
switch (opt) {
case 'V':
- printf(_("%s from %s\n"),
- program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
usage(stdout);
diff --git a/text-utils/column.c b/text-utils/column.c
index 0ee5a9e..e583dba 100644
--- a/text-utils/column.c
+++ b/text-utils/column.c
@@ -149,9 +149,8 @@ int main(int argc, char **argv)
usage(EXIT_SUCCESS);
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
- return EXIT_SUCCESS;
+ printf(UTIL_LINUX_VERSION);
+ return EXIT_SUCCESS;
case 'c':
termwidth = strtou32_or_err(optarg, _("invalid columns argument"));
break;
diff --git a/text-utils/rev.c b/text-utils/rev.c
index f1341cb..a661f0a 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -121,8 +121,7 @@ int main(int argc, char *argv[])
while ((ch = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch(ch) {
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
case 'h':
usage(stdout);
diff --git a/text-utils/tailf.c b/text-utils/tailf.c
index d2366a6..94f999e 100644
--- a/text-utils/tailf.c
+++ b/text-utils/tailf.c
@@ -261,8 +261,7 @@ int main(int argc, char **argv)
_("failed to parse number of lines"));
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
case 'h':
usage(stdout);
diff --git a/text-utils/ul.c b/text-utils/ul.c
index b3b3dc3..054f7b9 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -193,8 +193,7 @@ int main(int argc, char **argv)
iflag = 1;
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
usage(stdout);
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 07/23] textual: use manual tail usage() macro
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (5 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 06/23] textual: use version printing macro everywhere Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 08/23] textual: use usage() text element macros Sami Kerola
` (16 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
disk-utils/mkfs.bfs.c | 1 +
disk-utils/mkfs.c | 2 +-
login-utils/lslogins.c | 2 +-
misc-utils/getopt.c | 1 +
misc-utils/look.c | 1 +
misc-utils/namei.c | 2 +-
misc-utils/uuidgen.c | 1 +
misc-utils/wipefs.c | 2 +-
schedutils/chrt.c | 1 +
schedutils/taskset.c | 2 +-
sys-utils/lscpu.c | 2 +-
term-utils/script.c | 1 +
term-utils/scriptreplay.c | 1 +
term-utils/write.c | 1 +
text-utils/col.c | 1 +
text-utils/colcrt.c | 1 +
text-utils/colrm.c | 1 +
text-utils/rev.c | 2 +-
text-utils/tailf.c | 1 +
19 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/disk-utils/mkfs.bfs.c b/disk-utils/mkfs.bfs.c
index 23098e4..c2c2389 100644
--- a/disk-utils/mkfs.bfs.c
+++ b/disk-utils/mkfs.bfs.c
@@ -83,6 +83,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
" -V as version must be only option\n"
" -h, --help display this help and exit\n\n"));
+ fprintf(out, USAGE_MAN_TAIL("mkfs.bfs(8)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c
index 5bdb931..f10ba28 100644
--- a/disk-utils/mkfs.c
+++ b/disk-utils/mkfs.c
@@ -59,7 +59,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
" -V as --version must be the only option\n"));
fprintf(out, _(" -h, --help display this help text and exit\n"));
- fprintf(out, _("\nFor more information see mkfs(8).\n"));
+ fprintf(out, USAGE_MAN_TAIL("mkfs(8)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
index 9183183..1e0eb5a 100644
--- a/login-utils/lslogins.c
+++ b/login-utils/lslogins.c
@@ -1216,7 +1216,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fprintf(out, " %14s %s\n", coldescs[i].name,
_(coldescs[i].help));
- fprintf(out, _("\nFor more details see lslogins(1).\n"));
+ fprintf(out, USAGE_MAN_TAIL("lslogins(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/misc-utils/getopt.c b/misc-utils/getopt.c
index 7630173..74793ee 100644
--- a/misc-utils/getopt.c
+++ b/misc-utils/getopt.c
@@ -333,6 +333,7 @@ static void __attribute__ ((__noreturn__)) print_help(void)
fputs(_(" -V, --version Output version information\n"), stderr);
fputc('\n', stderr);
+ fprintf(stderr, USAGE_MAN_TAIL("getopt(1)"));
exit(PARAMETER_EXIT_CODE);
}
diff --git a/misc-utils/look.c b/misc-utils/look.c
index 502168b..d519cf6 100644
--- a/misc-utils/look.c
+++ b/misc-utils/look.c
@@ -375,5 +375,6 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
" -V, --version output version information and exit\n"
" -h, --help display this help and exit\n\n"), out);
+ fprintf(out, USAGE_MAN_TAIL("look(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index cac0e6c..a4496bc 100644
--- a/misc-utils/namei.c
+++ b/misc-utils/namei.c
@@ -438,7 +438,7 @@ static void usage(int rc)
" -n, --nosymlinks don't follow symlinks\n"
" -v, --vertical vertical align of modes and owners\n"), out);
- fputs(_("\nFor more information see namei(1).\n"), out);
+ fprintf(out, USAGE_MAN_TAIL("namei(1)"));
exit(rc);
}
diff --git a/misc-utils/uuidgen.c b/misc-utils/uuidgen.c
index 0c844d2..3883424 100644
--- a/misc-utils/uuidgen.c
+++ b/misc-utils/uuidgen.c
@@ -38,6 +38,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
" -V, --version output version information and exit\n"
" -h, --help display this help and exit\n\n"), out);
+ fprintf(out, USAGE_MAN_TAIL("uuidgen(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
index 58a643e..0671bb4 100644
--- a/misc-utils/wipefs.c
+++ b/misc-utils/wipefs.c
@@ -464,7 +464,7 @@ usage(FILE *out)
" -t, --types <list> limit the set of filesystem, RAIDs or partition tables\n"
" -V, --version output version information and exit\n"), out);
- fprintf(out, _("\nFor more information see wipefs(8).\n"));
+ fprintf(out, USAGE_MAN_TAIL("wipefs(8)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index df115aa..7988b2a 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -86,6 +86,7 @@ static void __attribute__((__noreturn__)) show_usage(int rc)
" -v | --verbose display status information\n"
" -V | --version output version information\n\n"));
+ fprintf(out, USAGE_MAN_TAIL("chrt(1)"));
exit(rc);
}
diff --git a/schedutils/taskset.c b/schedutils/taskset.c
index 4cda2eb..1bf1291 100644
--- a/schedutils/taskset.c
+++ b/schedutils/taskset.c
@@ -72,7 +72,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
" e.g. 0-31:2 is equivalent to mask 0x55555555\n"),
program_invocation_short_name);
- fprintf(out, _("\nFor more information see taskset(1).\n"));
+ fprintf(out, USAGE_MAN_TAIL("taskset(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 8ae7028..ef59410 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1646,7 +1646,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
for (i = 0; i < ARRAY_SIZE(coldescs); i++)
fprintf(out, " %13s %s\n", coldescs[i].name, _(coldescs[i].help));
- fprintf(out, _("\nFor more details see lscpu(1).\n"));
+ fprintf(out, USAGE_MAN_TAIL("lscpu(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/term-utils/script.c b/term-utils/script.c
index ad16e74..d2b8974 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -153,6 +153,7 @@ usage(FILE *out)
" -V, --version output version information and exit\n"
" -h, --help display this help and exit\n\n"), out);
+ fprintf(out, USAGE_MAN_TAIL("script(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/term-utils/scriptreplay.c b/term-utils/scriptreplay.c
index 8e0cb97..7ac50d8 100644
--- a/term-utils/scriptreplay.c
+++ b/term-utils/scriptreplay.c
@@ -50,6 +50,7 @@ usage(FILE *out)
" -V, --version output version information and exit\n"
" -h, --help display this help and exit\n\n"), out);
+ fprintf(out, USAGE_MAN_TAIL("scriptreplay(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/term-utils/write.c b/term-utils/write.c
index 4d217c4..e64bb43 100644
--- a/term-utils/write.c
+++ b/term-utils/write.c
@@ -86,6 +86,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fputs(_(" -V, --version output version information and exit\n"
" -h, --help display this help and exit\n\n"), out);
+ fprintf(out, USAGE_MAN_TAIL("write(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/text-utils/col.c b/text-utils/col.c
index 9b2f570..1218f25 100644
--- a/text-utils/col.c
+++ b/text-utils/col.c
@@ -145,6 +145,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
"%s reads from standard input and writes to standard output\n\n"),
program_invocation_short_name);
+ fprintf(out, USAGE_MAN_TAIL("col(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/text-utils/colcrt.c b/text-utils/colcrt.c
index a5d5977..c39c8b6 100644
--- a/text-utils/colcrt.c
+++ b/text-utils/colcrt.c
@@ -319,5 +319,6 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
" -V, --version output version information and exit\n"
" -h, --help display this help and exit\n\n"));
+ fprintf(out, USAGE_MAN_TAIL("colcrt(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/text-utils/colrm.c b/text-utils/colrm.c
index 111033d..f67524a 100644
--- a/text-utils/colrm.c
+++ b/text-utils/colrm.c
@@ -67,6 +67,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fprintf(out, _("%s reads from standard input and writes to standard output\n\n"),
program_invocation_short_name);
+ fprintf(out, USAGE_MAN_TAIL("colrm(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/text-utils/rev.c b/text-utils/rev.c
index a661f0a..60ad752 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -81,7 +81,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
" -V, --version output version information and exit\n"
" -h, --help display this help and exit\n"));
- fprintf(out, _("\nFor more information see rev(1).\n"));
+ fprintf(out, USAGE_MAN_TAIL("rev(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/text-utils/tailf.c b/text-utils/tailf.c
index 94f999e..bd38da2 100644
--- a/text-utils/tailf.c
+++ b/text-utils/tailf.c
@@ -205,6 +205,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
" -V, --version output version information and exit\n"
" -h, --help display this help and exit\n\n"));
+ fprintf(out, USAGE_MAN_TAIL("tailf(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 08/23] textual: use usage() text element macros
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (6 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 07/23] textual: use manual tail usage() macro Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 09/23] libuuid: remove _SVID_SOURCE pre-processor definition Sami Kerola
` (15 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Translating these text elements should happen only once, which is
more likely when the text macros are used properly.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
disk-utils/mkfs.c | 5 ++---
login-utils/chfn.c | 4 ++--
misc-utils/getopt.c | 12 +++++-------
misc-utils/look.c | 5 ++---
misc-utils/namei.c | 5 ++---
misc-utils/uuidd.c | 4 ++--
misc-utils/uuidgen.c | 4 ++--
misc-utils/wipefs.c | 5 ++---
sys-utils/hwclock.c | 4 ++--
term-utils/script.c | 4 ++--
term-utils/scriptreplay.c | 4 ++--
term-utils/write.c | 8 ++++----
text-utils/colrm.c | 9 +++------
text-utils/rev.c | 8 +++-----
14 files changed, 35 insertions(+), 46 deletions(-)
diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c
index f10ba28..dbc938f 100644
--- a/disk-utils/mkfs.c
+++ b/disk-utils/mkfs.c
@@ -44,11 +44,10 @@
static void __attribute__ ((__noreturn__)) usage(FILE * out)
{
- fprintf(out, _("Usage:\n"));
+ fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] [-t <type>] [fs-options] <device> [<size>]\n"),
program_invocation_short_name);
-
- fprintf(out, _("\nOptions:\n"));
+ fputs(USAGE_OPTIONS, out);
fprintf(out, _(" -t, --type=<type> filesystem type; when unspecified, ext2 is used\n"));
fprintf(out, _(" fs-options parameters for the real filesystem builder\n"));
fprintf(out, _(" <device> path to the device to be used\n"));
diff --git a/login-utils/chfn.c b/login-utils/chfn.c
index ca10fbf..25f7e91 100644
--- a/login-utils/chfn.c
+++ b/login-utils/chfn.c
@@ -87,8 +87,8 @@ static void __attribute__((__noreturn__)) usage(FILE *fp)
fputs(_(" -p, --office-phone <phone> office phone number\n"), fp);
fputs(_(" -h, --home-phone <phone> home phone number\n"), fp);
fputs(USAGE_SEPARATOR, fp);
- fputs(_(" -u, --help display this help and exit\n"), fp);
- fputs(_(" -v, --version output version information and exit\n"), fp);
+ fputs(USAGE_HELP, fp);
+ fputs(USAGE_VERSION, fp);
fprintf(fp, USAGE_MAN_TAIL("chfn(1)"));
exit(fp == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/misc-utils/getopt.c b/misc-utils/getopt.c
index 74793ee..b82b62a 100644
--- a/misc-utils/getopt.c
+++ b/misc-utils/getopt.c
@@ -311,17 +311,15 @@ static void set_shell(const char *new_shell)
static void __attribute__ ((__noreturn__)) print_help(void)
{
- fputs(_("\nUsage:\n"), stderr);
-
+ fputs(USAGE_HEADER, stderr);
fprintf(stderr, _(
" %1$s optstring parameters\n"
" %1$s [options] [--] optstring parameters\n"
" %1$s [options] -o|--options optstring [options] [--] parameters\n"),
program_invocation_short_name);
- fputs(_("\nOptions:\n"), stderr);
+ fputs(USAGE_OPTIONS, stderr);
fputs(_(" -a, --alternative Allow long options starting with single -\n"), stderr);
- fputs(_(" -h, --help This small usage guide\n"), stderr);
fputs(_(" -l, --longoptions <longopts> Long options to be recognized\n"), stderr);
fputs(_(" -n, --name <progname> The name under which errors are reported\n"), stderr);
fputs(_(" -o, --options <optstring> Short options to be recognized\n"), stderr);
@@ -330,9 +328,9 @@ static void __attribute__ ((__noreturn__)) print_help(void)
fputs(_(" -s, --shell <shell> Set shell quoting conventions\n"), stderr);
fputs(_(" -T, --test Test for getopt(1) version\n"), stderr);
fputs(_(" -u, --unquoted Do not quote the output\n"), stderr);
- fputs(_(" -V, --version Output version information\n"), stderr);
- fputc('\n', stderr);
-
+ fputs(USAGE_SEPARATOR, stderr);
+ fputs(USAGE_HELP, stderr);
+ fputs(USAGE_VERSION, stderr);
fprintf(stderr, USAGE_MAN_TAIL("getopt(1)"));
exit(PARAMETER_EXIT_CODE);
}
diff --git a/misc-utils/look.c b/misc-utils/look.c
index d519cf6..51938f2 100644
--- a/misc-utils/look.c
+++ b/misc-utils/look.c
@@ -363,11 +363,10 @@ compare(char *s2, char *s2end) {
static void __attribute__ ((__noreturn__)) usage(FILE * out)
{
- fputs(_("\nUsage:\n"), out),
+ fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] string [file]\n"), program_invocation_short_name);
-
- fputs(_("\nOptions:\n"), out);
+ fputs(USAGE_OPTIONS, out);
fputs(_(" -a, --alternative use alternative dictionary\n"
" -d, --alphanum compare only alphanumeric characters\n"
" -f, --ignore-case ignore case differences when comparing\n"
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index a4496bc..ff58c9b 100644
--- a/misc-utils/namei.c
+++ b/misc-utils/namei.c
@@ -424,11 +424,10 @@ static void usage(int rc)
if (!*p)
p = "namei";
- fputs(_("\nUsage:\n"), out);
+ fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] <pathname>...\n"), p);
-
- fputs(_("\nOptions:\n"), out);
+ fputs(USAGE_OPTIONS, out);
fputs(_(" -h, --help displays this help text\n"
" -V, --version output version information and exit\n"
" -x, --mountpoints show mount point directories with a 'D'\n"
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index 8909b51..55aac35 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -68,11 +68,11 @@ struct uuidd_cxt_t {
static void __attribute__ ((__noreturn__)) usage(FILE * out)
{
- fputs(_("\nUsage:\n"), out);
+ fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options]\n"), program_invocation_short_name);
- fputs(_("\nOptions:\n"), out);
+ fputs(USAGE_OPTIONS, out);
fputs(_(" -p, --pid <path> path to pid file\n"
" -s, --socket <path> path to socket\n"
" -T, --timeout <sec> specify inactivity timeout\n"
diff --git a/misc-utils/uuidgen.c b/misc-utils/uuidgen.c
index 3883424..48c6562 100644
--- a/misc-utils/uuidgen.c
+++ b/misc-utils/uuidgen.c
@@ -28,11 +28,11 @@ extern int optind;
static void __attribute__ ((__noreturn__)) usage(FILE * out)
{
- fputs(_("\nUsage:\n"), out);
+ fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options]\n"), program_invocation_short_name);
- fputs(_("\nOptions:\n"), out);
+ fputs(USAGE_OPTIONS, out);
fputs(_(" -r, --random generate random-based uuid\n"
" -t, --time generate time-based uuid\n"
" -V, --version output version information and exit\n"
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
index 0671bb4..70c3f23 100644
--- a/misc-utils/wipefs.c
+++ b/misc-utils/wipefs.c
@@ -448,11 +448,10 @@ do_wipe(struct wipe_desc *wp, const char *devname, int flags)
static void __attribute__((__noreturn__))
usage(FILE *out)
{
- fputs(_("\nUsage:\n"), out);
+ fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] <device>\n"), program_invocation_short_name);
-
- fputs(_("\nOptions:\n"), out);
+ fputs(USAGE_OPTIONS, out);
fputs(_(" -a, --all wipe all magic strings (BE CAREFUL!)\n"
" -b, --backup create a signature backup in $HOME\n"
" -f, --force force erasure\n"
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 9151d24..493ee88 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -1563,7 +1563,7 @@ static void usage(const char *fmt, ...)
usageto = fmt ? stderr : stdout;
- fputs(_("\nUsage:\n"), usageto);
+ fputs(USAGE_HEADER, usageto);
fputs(_(" hwclock [function] [option...]\n"), usageto);
fputs(_("\nFunctions:\n"), usageto);
@@ -1584,7 +1584,7 @@ static void usage(const char *fmt, ...)
fputs(_(" --predict predict RTC reading at time given with --date\n"
" -V, --version display version information and exit\n"), usageto);
- fputs(_("\nOptions:\n"), usageto);
+ fputs(USAGE_OPTIONS, usageto);
fputs(_(" -u, --utc the hardware clock is kept in UTC\n"
" --localtime the hardware clock is kept in local time\n"), usageto);
#ifdef __linux__
diff --git a/term-utils/script.c b/term-utils/script.c
index d2b8974..7d3787e 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -138,11 +138,11 @@ die_if_link(char *fn) {
static void __attribute__((__noreturn__))
usage(FILE *out)
{
- fputs(_("\nUsage:\n"), out);
+ fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] [file]\n"), program_invocation_short_name);
- fputs(_("\nOptions:\n"), out);
+ fputs(USAGE_OPTIONS, out);
fputs(_(" -a, --append append the output\n"
" -c, --command <command> run command rather than interactive shell\n"
" -e, --return return exit code of the child process\n"
diff --git a/term-utils/scriptreplay.c b/term-utils/scriptreplay.c
index 7ac50d8..fb5ded3 100644
--- a/term-utils/scriptreplay.c
+++ b/term-utils/scriptreplay.c
@@ -37,12 +37,12 @@
static void __attribute__((__noreturn__))
usage(FILE *out)
{
- fputs(_("\nUsage:\n"), out);
+ fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [-t] timingfile [typescript] [divisor]\n"),
program_invocation_short_name);
- fputs(_("\nOptions:\n"), out);
+ fputs(USAGE_OPTIONS, out);
fputs(_(" -t, --timing <file> script timing output file\n"
" -s, --typescript <file> script terminal session output file\n"
" -d, --divisor <num> speed up or slow down execution with time divisor\n"
diff --git a/term-utils/write.c b/term-utils/write.c
index e64bb43..ca40354 100644
--- a/term-utils/write.c
+++ b/term-utils/write.c
@@ -77,14 +77,14 @@ static gid_t root_access;
static void __attribute__ ((__noreturn__)) usage(FILE * out)
{
- fputs(_("\nUsage:\n"), out);
+ fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] <user> [<ttyname>]\n"),
program_invocation_short_name);
- fputs(_("\nOptions:\n"), out);
- fputs(_(" -V, --version output version information and exit\n"
- " -h, --help display this help and exit\n\n"), out);
+ fputs(USAGE_OPTIONS, out);
+ fputs(USAGE_HELP, out);
+ fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("write(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
diff --git a/text-utils/colrm.c b/text-utils/colrm.c
index f67524a..4264fe6 100644
--- a/text-utils/colrm.c
+++ b/text-utils/colrm.c
@@ -59,14 +59,11 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fprintf(out, _("\nUsage:\n"
" %s [startcol [endcol]]\n"),
program_invocation_short_name);
-
- fprintf(out, _("\nOptions:\n"
- " -V, --version output version information and exit\n"
- " -h, --help display this help and exit\n\n"));
-
+ fputs(USAGE_OPTIONS, out);
+ fputs(USAGE_HELP, out);
+ fputs(USAGE_VERSION, out);
fprintf(out, _("%s reads from standard input and writes to standard output\n\n"),
program_invocation_short_name);
-
fprintf(out, USAGE_MAN_TAIL("colrm(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
diff --git a/text-utils/rev.c b/text-utils/rev.c
index 60ad752..bda31d2 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -76,11 +76,9 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
{
fprintf(out, _("Usage: %s [options] [file ...]\n"),
program_invocation_short_name);
-
- fprintf(out, _("\nOptions:\n"
- " -V, --version output version information and exit\n"
- " -h, --help display this help and exit\n"));
-
+ fputs(USAGE_OPTIONS, out);
+ fputs(USAGE_HELP, out);
+ fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("rev(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 09/23] libuuid: remove _SVID_SOURCE pre-processor definition
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (7 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 08/23] textual: use usage() text element macros Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 10/23] include: fix compiler warnings Sami Kerola
` (14 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
The _SVID_SOURCE is deprecated.
In file included from /usr/include/stdio.h:27:0,
from libuuid/src/gen_uuid.c:46: /usr/include/features.h:148:3:
warning: #warning "_BSD_SOURCE and _SVID_SOURCE are
deprecated, use _DEFAULT_SOURCE" [-Wcpp]
Notice that the Makefile.am has
AM_CPPFLAGS = \
-include config.h \
that enforces the config.h is included before any other hearer. In the
configure.ac there is AC_USE_SYSTEM_EXTENSIONS that makes all possible
features that can be supported in a system are turned on. With these two
there is absolutely no need for any legacy _SOURCE definitions.
Reference: https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=c941736c92fa3a319221f65f6755659b2a5e0a20
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
libuuid/src/gen_uuid.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/libuuid/src/gen_uuid.c b/libuuid/src/gen_uuid.c
index 387518a..eb79339 100644
--- a/libuuid/src/gen_uuid.c
+++ b/libuuid/src/gen_uuid.c
@@ -32,12 +32,6 @@
* %End-Header%
*/
-/*
- * Force inclusion of SVID stuff since we need it if we're compiling in
- * gcc-wall wall mode
- */
-#define _SVID_SOURCE
-
#ifdef _WIN32
#define _WIN32_WINNT 0x0500
#include <windows.h>
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 10/23] include: fix compiler warnings
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (8 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 09/23] libuuid: remove _SVID_SOURCE pre-processor definition Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 11/23] lsblk: fix compiler warning Sami Kerola
` (13 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
This change has motivation to make -Wall -pedantic compiler options to
spit a little bit less noise, which with luck will increase change to
notice real issues.
Multiple of these:
warning: ISO C forbids braced-groups within expressions [-Wpedantic]
And nearly 300 times reported:
include/c.h:75:41: warning: struct has no named members [-Wpedantic]
#define UL_BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
include/c.h | 10 +++++-----
include/list.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/c.h b/include/c.h
index e423e8b..0f6e5b2 100644
--- a/include/c.h
+++ b/include/c.h
@@ -37,7 +37,7 @@
# define __must_be_array(a) \
UL_BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(__typeof__(a), __typeof__(&a[0])))
-# define ignore_result(x) ({ \
+# define ignore_result(x) __extension__ ({ \
__typeof__(x) __dummy __attribute__((__unused__)) = (x); (void) __dummy; \
})
@@ -72,7 +72,7 @@
* e.g. in a structure initializer (or wherever else comma expressions
* aren't permitted).
*/
-#define UL_BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
+#define UL_BUILD_BUG_ON_ZERO(e) __extension__ (sizeof(struct { int:-!!(e); }))
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
#ifndef ARRAY_SIZE
@@ -92,7 +92,7 @@
#endif
#ifndef min
-# define min(x, y) ({ \
+# define min(x, y) __extension__ ({ \
__typeof__(x) _min1 = (x); \
__typeof__(y) _min2 = (y); \
(void) (&_min1 == &_min2); \
@@ -100,7 +100,7 @@
#endif
#ifndef max
-# define max(x, y) ({ \
+# define max(x, y) __extension__ ({ \
__typeof__(x) _max1 = (x); \
__typeof__(y) _max2 = (y); \
(void) (&_max1 == &_max2); \
@@ -112,7 +112,7 @@
#endif
#ifndef container_of
-#define container_of(ptr, type, member) ({ \
+#define container_of(ptr, type, member) __extension__ ({ \
const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
#endif
diff --git a/include/list.h b/include/list.h
index cfbdb16..3c08aa5 100644
--- a/include/list.h
+++ b/include/list.h
@@ -166,7 +166,7 @@ _INLINE_ void list_splice(struct list_head *list, struct list_head *head)
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
-#define list_entry(ptr, type, member) ({ \
+#define list_entry(ptr, type, member) __extension__ ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 11/23] lsblk: fix compiler warning
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (9 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 10/23] include: fix compiler warnings Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 12/23] libblkid: use pre-processor to optimize out code Sami Kerola
` (12 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
warning: ISO C forbids empty initializer braces [-Wpedantic]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
misc-utils/lsblk.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index dc1cf69..a87d997 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -1143,7 +1143,7 @@ static int list_partitions(struct blkdev_cxt *wholedisk_cxt, struct blkdev_cxt *
{
DIR *dir;
struct dirent *d;
- struct blkdev_cxt part_cxt = {};
+ struct blkdev_cxt part_cxt = { 0 };
int r = -1;
assert(wholedisk_cxt);
@@ -1242,7 +1242,7 @@ static int list_deps(struct blkdev_cxt *cxt)
{
DIR *dir;
struct dirent *d;
- struct blkdev_cxt dep = {};
+ struct blkdev_cxt dep = { 0 };
char dirname[PATH_MAX];
const char *depname;
@@ -1293,7 +1293,7 @@ static int iterate_block_devices(void)
{
DIR *dir;
struct dirent *d;
- struct blkdev_cxt cxt = {};
+ struct blkdev_cxt cxt = { 0 };
if (!(dir = opendir(_PATH_SYS_BLOCK)))
return EXIT_FAILURE;
@@ -1341,7 +1341,7 @@ static char *devno_to_sysfs_name(dev_t devno, char *devname, char *buf, size_t b
static int process_one_device(char *devname)
{
- struct blkdev_cxt parent = {}, cxt = {};
+ struct blkdev_cxt parent = { 0 }, cxt = { 0 };
struct stat st;
char buf[PATH_MAX + 1], *name, *diskname = NULL;
dev_t disk = 0;
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 12/23] libblkid: use pre-processor to optimize out code
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (10 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 11/23] lsblk: fix compiler warning Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-10-01 10:22 ` Karel Zak
2014-09-28 19:51 ` [PATCH 13/23] libblkid: fix implicit constant conversion warning Sami Kerola
` (11 subsequent siblings)
23 siblings, 1 reply; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
libblkid/src/superblocks/zfs.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libblkid/src/superblocks/zfs.c b/libblkid/src/superblocks/zfs.c
index 6ffa24d..088d110 100644
--- a/libblkid/src/superblocks/zfs.c
+++ b/libblkid/src/superblocks/zfs.c
@@ -156,7 +156,6 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
}
}
-#define zdebug(fmt, ...) do {} while(0)
/*#define zdebug(fmt, a...) fprintf(stderr, fmt, ##a)*/
/* ZFS has 128x1kB host-endian root blocks, stored in 2 areas at the start
@@ -172,7 +171,9 @@ static int probe_zfs(blkid_probe pr,
int tried;
int found;
+#ifdef zdebug
zdebug("probe_zfs\n");
+#endif
/* Look for at least 4 uberblocks to ensure a positive match */
for (tried = found = 0, offset = VDEV_LABEL_UBERBLOCK;
tried < ZFS_TRIES && found < ZFS_WANT;
@@ -196,9 +197,10 @@ static int probe_zfs(blkid_probe pr,
ub_offset = offset;
found++;
}
-
+#ifdef zdebug
zdebug("probe_zfs: found %s-endian uberblock at %llu\n",
swab_endian ? "big" : "little", offset >> 10);
+#endif
}
if (found < 4)
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 12/23] libblkid: use pre-processor to optimize out code
2014-09-28 19:51 ` [PATCH 12/23] libblkid: use pre-processor to optimize out code Sami Kerola
@ 2014-10-01 10:22 ` Karel Zak
0 siblings, 0 replies; 30+ messages in thread
From: Karel Zak @ 2014-10-01 10:22 UTC (permalink / raw)
To: Sami Kerola; +Cc: util-linux
On Sun, Sep 28, 2014 at 08:51:45PM +0100, Sami Kerola wrote:
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
> libblkid/src/superblocks/zfs.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libblkid/src/superblocks/zfs.c b/libblkid/src/superblocks/zfs.c
> index 6ffa24d..088d110 100644
> --- a/libblkid/src/superblocks/zfs.c
> +++ b/libblkid/src/superblocks/zfs.c
> @@ -156,7 +156,6 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
> }
> }
>
> -#define zdebug(fmt, ...) do {} while(0)
> /*#define zdebug(fmt, a...) fprintf(stderr, fmt, ##a)*/
>
> /* ZFS has 128x1kB host-endian root blocks, stored in 2 areas at the start
> @@ -172,7 +171,9 @@ static int probe_zfs(blkid_probe pr,
> int tried;
> int found;
>
> +#ifdef zdebug
> zdebug("probe_zfs\n");
> +#endif
no, this is bad way. It's always better to use empty macros than
#ifdef, ifdef is evil
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 13/23] libblkid: fix implicit constant conversion warning
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (11 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 12/23] libblkid: use pre-processor to optimize out code Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 14/23] include/debug: remove duplicate 'const' declaration warning Sami Kerola
` (10 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
warning: overflow in implicit constant conversion [-Woverflow]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
libblkid/src/superblocks/bcache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libblkid/src/superblocks/bcache.c b/libblkid/src/superblocks/bcache.c
index b3e397b..010866c 100644
--- a/libblkid/src/superblocks/bcache.c
+++ b/libblkid/src/superblocks/bcache.c
@@ -20,7 +20,7 @@
#define node(i, j) ((i)->d + (j))
#define end(i) node(i, (i)->keys)
-static const char bcache_magic[] = {
+static const unsigned char bcache_magic[] = {
0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81
};
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 14/23] include/debug: remove duplicate 'const' declaration warning
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (12 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 13/23] libblkid: fix implicit constant conversion warning Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 15/23] cfdisk: add missing initializers to struct main_menuitems Sami Kerola
` (9 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
./include/debug.h:89:55: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
include/debug.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/debug.h b/include/debug.h
index 25045aa..4dfc1eb 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -86,7 +86,7 @@ ul_debugobj(void *handler, const char *mesg, ...)
fputc('\n', stderr);
}
-static inline int parse_envmask(const struct dbg_mask const flagnames[],
+static inline int parse_envmask(const struct dbg_mask flagnames[],
const char *mask)
{
int res;
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 15/23] cfdisk: add missing initializers to struct main_menuitems
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (13 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 14/23] include/debug: remove duplicate 'const' declaration warning Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-10-01 10:27 ` Karel Zak
2014-09-28 19:51 ` [PATCH 16/23] findmnt: add missing initializers to struct colinfo Sami Kerola
` (8 subsequent siblings)
23 siblings, 1 reply; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
disk-utils/cfdisk.c:149:77: warning: missing field 'userdata' initializer [-Wmissing-field-initializers]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
disk-utils/cfdisk.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
index fabc397..0325acb 100644
--- a/disk-utils/cfdisk.c
+++ b/disk-utils/cfdisk.c
@@ -146,15 +146,15 @@ struct cfdisk_menu {
/* main menu */
static struct cfdisk_menuitem main_menuitems[] = {
- { 'b', N_("Bootable"), N_("Toggle bootable flag of the current partition") },
- { 'd', N_("Delete"), N_("Delete the current partition") },
- { 'n', N_("New"), N_("Create new partition from free space") },
- { 'q', N_("Quit"), N_("Quit program without writing partition table") },
- { 't', N_("Type"), N_("Change the partition type") },
- { 'h', N_("Help"), N_("Print help screen") },
- { 's', N_("Sort"), N_("Fix partitions order") },
- { 'W', N_("Write"), N_("Write partition table to disk (this might destroy data)") },
- { 0, NULL, NULL }
+ { 'b', N_("Bootable"), N_("Toggle bootable flag of the current partition"), NULL },
+ { 'd', N_("Delete"), N_("Delete the current partition"), NULL },
+ { 'n', N_("New"), N_("Create new partition from free space"), NULL },
+ { 'q', N_("Quit"), N_("Quit program without writing partition table"), NULL },
+ { 't', N_("Type"), N_("Change the partition type"), NULL },
+ { 'h', N_("Help"), N_("Print help screen"), NULL },
+ { 's', N_("Sort"), N_("Fix partitions order"), NULL },
+ { 'W', N_("Write"), N_("Write partition table to disk (this might destroy data)"), NULL },
+ { 0, NULL, NULL, NULL }
};
/* top level control struct */
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 16/23] findmnt: add missing initializers to struct colinfo
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (14 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 15/23] cfdisk: add missing initializers to struct main_menuitems Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 17/23] lsblk: " Sami Kerola
` (7 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
warning: missing field 'match' initializer [-Wmissing-field-initializers]
warning: missing field 'match_data' initializer [-Wmissing-field-initializers]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
misc-utils/findmnt.c | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index 75099d9..57ee12a 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -118,31 +118,31 @@ struct colinfo {
/* columns descriptions (don't use const, this is writable) */
static struct colinfo infos[] = {
- [COL_SOURCE] = { "SOURCE", 0.25, SCOLS_FL_NOEXTREMES, N_("source device") },
- [COL_TARGET] = { "TARGET", 0.30, SCOLS_FL_TREE| SCOLS_FL_NOEXTREMES, N_("mountpoint") },
- [COL_FSTYPE] = { "FSTYPE", 0.10, SCOLS_FL_TRUNC, N_("filesystem type") },
- [COL_OPTIONS] = { "OPTIONS", 0.10, SCOLS_FL_TRUNC, N_("all mount options") },
- [COL_VFS_OPTIONS] = { "VFS-OPTIONS", 0.20, SCOLS_FL_TRUNC, N_("VFS specific mount options") },
- [COL_FS_OPTIONS] = { "FS-OPTIONS", 0.10, SCOLS_FL_TRUNC, N_("FS specific mount options") },
- [COL_LABEL] = { "LABEL", 0.10, 0, N_("filesystem label") },
- [COL_UUID] = { "UUID", 36, 0, N_("filesystem UUID") },
- [COL_PARTLABEL] = { "PARTLABEL", 0.10, 0, N_("partition label") },
- [COL_PARTUUID] = { "PARTUUID", 36, 0, N_("partition UUID") },
- [COL_MAJMIN] = { "MAJ:MIN", 6, 0, N_("major:minor device number") },
- [COL_ACTION] = { "ACTION", 10, SCOLS_FL_STRICTWIDTH, N_("action detected by --poll") },
- [COL_OLD_OPTIONS] = { "OLD-OPTIONS", 0.10, SCOLS_FL_TRUNC, N_("old mount options saved by --poll") },
- [COL_OLD_TARGET] = { "OLD-TARGET", 0.30, 0, N_("old mountpoint saved by --poll") },
- [COL_SIZE] = { "SIZE", 5, SCOLS_FL_RIGHT, N_("filesystem size") },
- [COL_AVAIL] = { "AVAIL", 5, SCOLS_FL_RIGHT, N_("filesystem size available") },
- [COL_USED] = { "USED", 5, SCOLS_FL_RIGHT, N_("filesystem size used") },
- [COL_USEPERC] = { "USE%", 3, SCOLS_FL_RIGHT, N_("filesystem use percentage") },
- [COL_FSROOT] = { "FSROOT", 0.25, SCOLS_FL_NOEXTREMES, N_("filesystem root") },
- [COL_TID] = { "TID", 4, SCOLS_FL_RIGHT, N_("task ID") },
- [COL_ID] = { "ID", 2, SCOLS_FL_RIGHT, N_("mount ID") },
- [COL_OPT_FIELDS] = { "OPT-FIELDS", 0.10, SCOLS_FL_TRUNC, N_("optional mount fields") },
- [COL_PROPAGATION] = { "PROPAGATION", 0.10, 0, N_("VFS propagation flags") },
- [COL_FREQ] = { "FREQ", 1, SCOLS_FL_RIGHT, N_("dump(8) period in days [fstab only]") },
- [COL_PASSNO] = { "PASSNO", 1, SCOLS_FL_RIGHT, N_("pass number on parallel fsck(8) [fstab only]") }
+ [COL_SOURCE] = { "SOURCE", 0.25, SCOLS_FL_NOEXTREMES, N_("source device"), NULL, NULL },
+ [COL_TARGET] = { "TARGET", 0.30, SCOLS_FL_TREE| SCOLS_FL_NOEXTREMES, N_("mountpoint"), NULL, NULL },
+ [COL_FSTYPE] = { "FSTYPE", 0.10, SCOLS_FL_TRUNC, N_("filesystem type"), NULL, NULL },
+ [COL_OPTIONS] = { "OPTIONS", 0.10, SCOLS_FL_TRUNC, N_("all mount options"), NULL, NULL },
+ [COL_VFS_OPTIONS] = { "VFS-OPTIONS", 0.20, SCOLS_FL_TRUNC, N_("VFS specific mount options"), NULL, NULL },
+ [COL_FS_OPTIONS] = { "FS-OPTIONS", 0.10, SCOLS_FL_TRUNC, N_("FS specific mount options"), NULL, NULL },
+ [COL_LABEL] = { "LABEL", 0.10, 0, N_("filesystem label"), NULL, NULL },
+ [COL_UUID] = { "UUID", 36, 0, N_("filesystem UUID"), NULL, NULL },
+ [COL_PARTLABEL] = { "PARTLABEL", 0.10, 0, N_("partition label"), NULL, NULL },
+ [COL_PARTUUID] = { "PARTUUID", 36, 0, N_("partition UUID"), NULL, NULL },
+ [COL_MAJMIN] = { "MAJ:MIN", 6, 0, N_("major:minor device number"), NULL, NULL },
+ [COL_ACTION] = { "ACTION", 10, SCOLS_FL_STRICTWIDTH, N_("action detected by --poll"), NULL, NULL },
+ [COL_OLD_OPTIONS] = { "OLD-OPTIONS", 0.10, SCOLS_FL_TRUNC, N_("old mount options saved by --poll"), NULL, NULL },
+ [COL_OLD_TARGET] = { "OLD-TARGET", 0.30, 0, N_("old mountpoint saved by --poll"), NULL, NULL },
+ [COL_SIZE] = { "SIZE", 5, SCOLS_FL_RIGHT, N_("filesystem size"), NULL, NULL },
+ [COL_AVAIL] = { "AVAIL", 5, SCOLS_FL_RIGHT, N_("filesystem size available"), NULL, NULL },
+ [COL_USED] = { "USED", 5, SCOLS_FL_RIGHT, N_("filesystem size used"), NULL, NULL },
+ [COL_USEPERC] = { "USE%", 3, SCOLS_FL_RIGHT, N_("filesystem use percentage"), NULL, NULL },
+ [COL_FSROOT] = { "FSROOT", 0.25, SCOLS_FL_NOEXTREMES, N_("filesystem root"), NULL, NULL },
+ [COL_TID] = { "TID", 4, SCOLS_FL_RIGHT, N_("task ID"), NULL, NULL },
+ [COL_ID] = { "ID", 2, SCOLS_FL_RIGHT, N_("mount ID"), NULL, NULL },
+ [COL_OPT_FIELDS] = { "OPT-FIELDS", 0.10, SCOLS_FL_TRUNC, N_("optional mount fields"), NULL, NULL },
+ [COL_PROPAGATION] = { "PROPAGATION", 0.10, 0, N_("VFS propagation flags"), NULL, NULL },
+ [COL_FREQ] = { "FREQ", 1, SCOLS_FL_RIGHT, N_("dump(8) period in days [fstab only]"), NULL, NULL },
+ [COL_PASSNO] = { "PASSNO", 1, SCOLS_FL_RIGHT, N_("pass number on parallel fsck(8) [fstab only]"), NULL, NULL }
};
/* columns[] array specifies all currently wanted output column. The columns
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 17/23] lsblk: add missing initializers to struct colinfo
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (15 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 16/23] findmnt: add missing initializers to struct colinfo Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 18/23] hwclock: use fabs() instead abs() when argument is double Sami Kerola
` (6 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
warning: missing field 'sort_type' initializer [-Wmissing-field-initializers]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
misc-utils/lsblk.c | 58 +++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index a87d997..8744cc9 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -134,50 +134,50 @@ struct colinfo {
/* columns descriptions */
static struct colinfo infos[] = {
- [COL_NAME] = { "NAME", 0.25, SCOLS_FL_TREE | SCOLS_FL_NOEXTREMES, N_("device name") },
- [COL_KNAME] = { "KNAME", 0.3, 0, N_("internal kernel device name") },
- [COL_PKNAME] = { "PKNAME", 0.3, 0, N_("internal parent kernel device name") },
+ [COL_NAME] = { "NAME", 0.25, SCOLS_FL_TREE | SCOLS_FL_NOEXTREMES, N_("device name"), SORT_STRING },
+ [COL_KNAME] = { "KNAME", 0.3, 0, N_("internal kernel device name"), SORT_STRING },
+ [COL_PKNAME] = { "PKNAME", 0.3, 0, N_("internal parent kernel device name"), SORT_STRING },
[COL_MAJMIN] = { "MAJ:MIN", 6, 0, N_("major:minor device number"), SORT_U64 },
- [COL_FSTYPE] = { "FSTYPE", 0.1, SCOLS_FL_TRUNC, N_("filesystem type") },
- [COL_TARGET] = { "MOUNTPOINT", 0.10, SCOLS_FL_TRUNC, N_("where the device is mounted") },
- [COL_LABEL] = { "LABEL", 0.1, 0, N_("filesystem LABEL") },
- [COL_UUID] = { "UUID", 36, 0, N_("filesystem UUID") },
+ [COL_FSTYPE] = { "FSTYPE", 0.1, SCOLS_FL_TRUNC, N_("filesystem type"), SORT_STRING },
+ [COL_TARGET] = { "MOUNTPOINT", 0.10, SCOLS_FL_TRUNC, N_("where the device is mounted"), SORT_STRING },
+ [COL_LABEL] = { "LABEL", 0.1, 0, N_("filesystem LABEL"), SORT_STRING },
+ [COL_UUID] = { "UUID", 36, 0, N_("filesystem UUID"), SORT_STRING },
- [COL_PARTTYPE] = { "PARTTYPE", 36, 0, N_("partition type UUID") },
- [COL_PARTLABEL] = { "PARTLABEL", 0.1, 0, N_("partition LABEL") },
- [COL_PARTUUID] = { "PARTUUID", 36, 0, N_("partition UUID") },
- [COL_PARTFLAGS] = { "PARTFLAGS", 36, 0, N_("partition flags") },
+ [COL_PARTTYPE] = { "PARTTYPE", 36, 0, N_("partition type UUID"), SORT_STRING },
+ [COL_PARTLABEL] = { "PARTLABEL", 0.1, 0, N_("partition LABEL"), SORT_STRING },
+ [COL_PARTUUID] = { "PARTUUID", 36, 0, N_("partition UUID"), SORT_STRING },
+ [COL_PARTFLAGS] = { "PARTFLAGS", 36, 0, N_("partition flags"), SORT_STRING },
[COL_RA] = { "RA", 3, SCOLS_FL_RIGHT, N_("read-ahead of the device"), SORT_U64 },
- [COL_RO] = { "RO", 1, SCOLS_FL_RIGHT, N_("read-only device") },
- [COL_RM] = { "RM", 1, SCOLS_FL_RIGHT, N_("removable device") },
- [COL_ROTA] = { "ROTA", 1, SCOLS_FL_RIGHT, N_("rotational device") },
- [COL_RAND] = { "RAND", 1, SCOLS_FL_RIGHT, N_("adds randomness") },
- [COL_MODEL] = { "MODEL", 0.1, SCOLS_FL_TRUNC, N_("device identifier") },
- [COL_SERIAL] = { "SERIAL", 0.1, SCOLS_FL_TRUNC, N_("disk serial number") },
+ [COL_RO] = { "RO", 1, SCOLS_FL_RIGHT, N_("read-only device"), SORT_STRING },
+ [COL_RM] = { "RM", 1, SCOLS_FL_RIGHT, N_("removable device"), SORT_STRING },
+ [COL_ROTA] = { "ROTA", 1, SCOLS_FL_RIGHT, N_("rotational device"), SORT_STRING },
+ [COL_RAND] = { "RAND", 1, SCOLS_FL_RIGHT, N_("adds randomness"), SORT_STRING },
+ [COL_MODEL] = { "MODEL", 0.1, SCOLS_FL_TRUNC, N_("device identifier"), SORT_STRING },
+ [COL_SERIAL] = { "SERIAL", 0.1, SCOLS_FL_TRUNC, N_("disk serial number"), SORT_STRING },
[COL_SIZE] = { "SIZE", 5, SCOLS_FL_RIGHT, N_("size of the device"), SORT_U64 },
- [COL_STATE] = { "STATE", 7, SCOLS_FL_TRUNC, N_("state of the device") },
- [COL_OWNER] = { "OWNER", 0.1, SCOLS_FL_TRUNC, N_("user name"), },
- [COL_GROUP] = { "GROUP", 0.1, SCOLS_FL_TRUNC, N_("group name") },
- [COL_MODE] = { "MODE", 10, 0, N_("device node permissions") },
+ [COL_STATE] = { "STATE", 7, SCOLS_FL_TRUNC, N_("state of the device"), SORT_STRING },
+ [COL_OWNER] = { "OWNER", 0.1, SCOLS_FL_TRUNC, N_("user name"), SORT_STRING },
+ [COL_GROUP] = { "GROUP", 0.1, SCOLS_FL_TRUNC, N_("group name"), SORT_STRING },
+ [COL_MODE] = { "MODE", 10, 0, N_("device node permissions"), SORT_STRING },
[COL_ALIOFF] = { "ALIGNMENT", 6, SCOLS_FL_RIGHT, N_("alignment offset"), SORT_U64 },
[COL_MINIO] = { "MIN-IO", 6, SCOLS_FL_RIGHT, N_("minimum I/O size"), SORT_U64 },
[COL_OPTIO] = { "OPT-IO", 6, SCOLS_FL_RIGHT, N_("optimal I/O size"), SORT_U64 },
[COL_PHYSEC] = { "PHY-SEC", 7, SCOLS_FL_RIGHT, N_("physical sector size"), SORT_U64 },
[COL_LOGSEC] = { "LOG-SEC", 7, SCOLS_FL_RIGHT, N_("logical sector size"), SORT_U64 },
- [COL_SCHED] = { "SCHED", 0.1, 0, N_("I/O scheduler name") },
+ [COL_SCHED] = { "SCHED", 0.1, 0, N_("I/O scheduler name"), SORT_STRING },
[COL_RQ_SIZE]= { "RQ-SIZE", 5, SCOLS_FL_RIGHT, N_("request queue size"), SORT_U64 },
- [COL_TYPE] = { "TYPE", 4, 0, N_("device type") },
+ [COL_TYPE] = { "TYPE", 4, 0, N_("device type"), SORT_STRING },
[COL_DALIGN] = { "DISC-ALN", 6, SCOLS_FL_RIGHT, N_("discard alignment offset"), SORT_U64 },
[COL_DGRAN] = { "DISC-GRAN", 6, SCOLS_FL_RIGHT, N_("discard granularity"), SORT_U64 },
[COL_DMAX] = { "DISC-MAX", 6, SCOLS_FL_RIGHT, N_("discard max bytes"), SORT_U64 },
- [COL_DZERO] = { "DISC-ZERO", 1, SCOLS_FL_RIGHT, N_("discard zeroes data") },
+ [COL_DZERO] = { "DISC-ZERO", 1, SCOLS_FL_RIGHT, N_("discard zeroes data"), SORT_STRING },
[COL_WSAME] = { "WSAME", 6, SCOLS_FL_RIGHT, N_("write same max bytes"), SORT_U64 },
- [COL_WWN] = { "WWN", 18, 0, N_("unique storage identifier") },
- [COL_HCTL] = { "HCTL", 10, 0, N_("Host:Channel:Target:Lun for SCSI") },
- [COL_TRANSPORT] = { "TRAN", 6, 0, N_("device transport type") },
- [COL_REV] = { "REV", 4, SCOLS_FL_RIGHT, N_("device revision") },
- [COL_VENDOR] = { "VENDOR", 0.1, SCOLS_FL_TRUNC, N_("device vendor") },
+ [COL_WWN] = { "WWN", 18, 0, N_("unique storage identifier"), SORT_STRING },
+ [COL_HCTL] = { "HCTL", 10, 0, N_("Host:Channel:Target:Lun for SCSI"), SORT_STRING },
+ [COL_TRANSPORT] = { "TRAN", 6, 0, N_("device transport type"), SORT_STRING },
+ [COL_REV] = { "REV", 4, SCOLS_FL_RIGHT, N_("device revision"), SORT_STRING },
+ [COL_VENDOR] = { "VENDOR", 0.1, SCOLS_FL_TRUNC, N_("device vendor"), SORT_STRING },
};
struct lsblk {
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 18/23] hwclock: use fabs() instead abs() when argument is double
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (16 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 17/23] lsblk: " Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 19/23] lscpu: add missing initializers to struct lscpu_coldesc Sami Kerola
` (5 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
sys-utils/hwclock.c:1219:13: warning: using integer absolute value function
'abs' when argument is of floating point type [-Wabsolute-value]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/hwclock.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 493ee88..e780158 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -60,6 +60,7 @@
#include <errno.h>
#include <getopt.h>
#include <limits.h>
+#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -1042,7 +1043,7 @@ adjust_drift_factor(struct adjtime *adjtime_p,
/* New drift factor */
drift_factor = adjtime_p->drift_factor + factor_adjust;
- if (abs(drift_factor) > MAX_DRIFT) {
+ if (fabs(drift_factor) > MAX_DRIFT) {
if (debug)
printf(_("Clock drift factor was calculated as "
"%f seconds/day.\n"
@@ -1215,7 +1216,7 @@ do_adjustment(struct adjtime *adjtime_p,
if (debug)
printf(_("Not setting clock because last adjustment time is zero, "
"so history is bad.\n"));
- } else if (abs(adjtime_p->drift_factor) > MAX_DRIFT) {
+ } else if (fabs(adjtime_p->drift_factor) > MAX_DRIFT) {
if (debug)
printf(_("Not setting clock because drift factor %f is far too high.\n"),
adjtime_p->drift_factor);
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 19/23] lscpu: add missing initializers to struct lscpu_coldesc
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (17 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 18/23] hwclock: use fabs() instead abs() when argument is double Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 20/23] libsmartcols: add explicit column flags default Sami Kerola
` (4 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
warning: missing field 'is_abbr' initializer [-Wmissing-field-initializers]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/lscpu.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index ef59410..30f2be6 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -300,17 +300,17 @@ struct lscpu_coldesc {
static struct lscpu_coldesc coldescs[] =
{
[COL_CPU] = { "CPU", N_("logical CPU number"), 1 },
- [COL_CORE] = { "CORE", N_("logical core number") },
- [COL_SOCKET] = { "SOCKET", N_("logical socket number") },
- [COL_NODE] = { "NODE", N_("logical NUMA node number") },
- [COL_BOOK] = { "BOOK", N_("logical book number") },
- [COL_CACHE] = { "CACHE", N_("shows how caches are shared between CPUs") },
- [COL_POLARIZATION] = { "POLARIZATION", N_("CPU dispatching mode on virtual hardware") },
- [COL_ADDRESS] = { "ADDRESS", N_("physical address of a CPU") },
- [COL_CONFIGURED] = { "CONFIGURED", N_("shows if the hypervisor has allocated the CPU") },
- [COL_ONLINE] = { "ONLINE", N_("shows if Linux currently makes use of the CPU") },
- [COL_MAXMHZ] = { "MAXMHZ", N_("shows the maximum MHz of the CPU") },
- [COL_MINMHZ] = { "MINMHZ", N_("shows the minimum MHz of the CPU") }
+ [COL_CORE] = { "CORE", N_("logical core number"), 0 },
+ [COL_SOCKET] = { "SOCKET", N_("logical socket number"), 0 },
+ [COL_NODE] = { "NODE", N_("logical NUMA node number"), 0 },
+ [COL_BOOK] = { "BOOK", N_("logical book number"), 0 },
+ [COL_CACHE] = { "CACHE", N_("shows how caches are shared between CPUs"), 0 },
+ [COL_POLARIZATION] = { "POLARIZATION", N_("CPU dispatching mode on virtual hardware"), 0 },
+ [COL_ADDRESS] = { "ADDRESS", N_("physical address of a CPU"), 0 },
+ [COL_CONFIGURED] = { "CONFIGURED", N_("shows if the hypervisor has allocated the CPU"), 0 },
+ [COL_ONLINE] = { "ONLINE", N_("shows if Linux currently makes use of the CPU"), 0 },
+ [COL_MAXMHZ] = { "MAXMHZ", N_("shows the maximum MHz of the CPU"), 0 },
+ [COL_MINMHZ] = { "MINMHZ", N_("shows the minimum MHz of the CPU"), 0 }
};
static int
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 20/23] libsmartcols: add explicit column flags default
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (18 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 19/23] lscpu: add missing initializers to struct lscpu_coldesc Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-10-01 10:29 ` Karel Zak
2014-09-28 19:51 ` [PATCH 21/23] lslogins: add missing initializers to struct lslogins_coldesc Sami Kerola
` (3 subsequent siblings)
23 siblings, 1 reply; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Useful when initializing without any specific action in mind, or when
reseting flags later on.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
libsmartcols/src/libsmartcols.h.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/libsmartcols/src/libsmartcols.h.in b/libsmartcols/src/libsmartcols.h.in
index e612560..1699a4a 100644
--- a/libsmartcols/src/libsmartcols.h.in
+++ b/libsmartcols/src/libsmartcols.h.in
@@ -78,6 +78,7 @@ enum {
* Column flags
*/
enum {
+ SCOLS_FL_DEFAULT = 0, /* use default functionality */
SCOLS_FL_TRUNC = (1 << 0), /* truncate fields data if necessary */
SCOLS_FL_TREE = (1 << 1), /* use tree "ascii art" */
SCOLS_FL_RIGHT = (1 << 2), /* align to the right */
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 20/23] libsmartcols: add explicit column flags default
2014-09-28 19:51 ` [PATCH 20/23] libsmartcols: add explicit column flags default Sami Kerola
@ 2014-10-01 10:29 ` Karel Zak
0 siblings, 0 replies; 30+ messages in thread
From: Karel Zak @ 2014-10-01 10:29 UTC (permalink / raw)
To: Sami Kerola; +Cc: util-linux
On Sun, Sep 28, 2014 at 08:51:53PM +0100, Sami Kerola wrote:
> Useful when initializing without any specific action in mind, or when
> reseting flags later on.
>
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
> libsmartcols/src/libsmartcols.h.in | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/libsmartcols/src/libsmartcols.h.in b/libsmartcols/src/libsmartcols.h.in
> index e612560..1699a4a 100644
> --- a/libsmartcols/src/libsmartcols.h.in
> +++ b/libsmartcols/src/libsmartcols.h.in
> @@ -78,6 +78,7 @@ enum {
> * Column flags
> */
> enum {
> + SCOLS_FL_DEFAULT = 0, /* use default functionality */
it would be better to use
SCOLS_FL_NONE
> SCOLS_FL_TRUNC = (1 << 0), /* truncate fields data if necessary */
> SCOLS_FL_TREE = (1 << 1), /* use tree "ascii art" */
> SCOLS_FL_RIGHT = (1 << 2), /* align to the right */
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 21/23] lslogins: add missing initializers to struct lslogins_coldesc
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (19 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 20/23] libsmartcols: add explicit column flags default Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-09-28 19:51 ` [PATCH 22/23] lslogins: use more narrow layout when initializing struct members Sami Kerola
` (2 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
login-utils/lslogins.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
index 1e0eb5a..44c389e 100644
--- a/login-utils/lslogins.c
+++ b/login-utils/lslogins.c
@@ -220,25 +220,25 @@ static const struct lslogins_coldesc coldescs[] =
[COL_PWDDENY] = { "PWD-DENY", N_("login by password disabled"), N_("Login by password disabled"), 1, SCOLS_FL_RIGHT },
[COL_PWDLOCK] = { "PWD-LOCK", N_("password defined, but locked"), N_("Password is locked"), 1, SCOLS_FL_RIGHT },
[COL_NOLOGIN] = { "NOLOGIN", N_("log in disabled by nologin(8) or pam_nologin(8)"), N_("No login"), 1, SCOLS_FL_RIGHT },
- [COL_GROUP] = { "GROUP", N_("primary group name"), N_("Primary group"), 0.1 },
+ [COL_GROUP] = { "GROUP", N_("primary group name"), N_("Primary group"), 0.1, SCOLS_FL_DEFAULT },
[COL_GID] = { "GID", N_("primary group ID"), "GID", 1, SCOLS_FL_RIGHT },
- [COL_SGROUPS] = { "SUPP-GROUPS", N_("supplementary group names"), N_("Supplementary groups"), 0.1 },
- [COL_SGIDS] = { "SUPP-GIDS", N_("supplementary group IDs"), N_("Supplementary group IDs"), 0.1 },
- [COL_HOME] = { "HOMEDIR", N_("home directory"), N_("Home directory"), 0.1 },
- [COL_SHELL] = { "SHELL", N_("login shell"), N_("Shell"), 0.1 },
+ [COL_SGROUPS] = { "SUPP-GROUPS", N_("supplementary group names"), N_("Supplementary groups"), 0.1, SCOLS_FL_DEFAULT },
+ [COL_SGIDS] = { "SUPP-GIDS", N_("supplementary group IDs"), N_("Supplementary group IDs"), 0.1, SCOLS_FL_DEFAULT },
+ [COL_HOME] = { "HOMEDIR", N_("home directory"), N_("Home directory"), 0.1, SCOLS_FL_DEFAULT },
+ [COL_SHELL] = { "SHELL", N_("login shell"), N_("Shell"), 0.1, SCOLS_FL_DEFAULT },
[COL_GECOS] = { "GECOS", N_("full user name"), N_("Gecos field"), 0.1, SCOLS_FL_TRUNC },
[COL_LAST_LOGIN] = { "LAST-LOGIN", N_("date of last login"), N_("Last login"), 0.1, SCOLS_FL_RIGHT },
- [COL_LAST_TTY] = { "LAST-TTY", N_("last tty used"), N_("Last terminal"), 0.05 },
- [COL_LAST_HOSTNAME] = { "LAST-HOSTNAME",N_("hostname during the last session"), N_("Last hostname"), 0.1},
- [COL_FAILED_LOGIN] = { "FAILED-LOGIN", N_("date of last failed login"), N_("Failed login"), 0.1 },
- [COL_FAILED_TTY] = { "FAILED-TTY", N_("where did the login fail?"), N_("Failed login terminal"), 0.05 },
+ [COL_LAST_TTY] = { "LAST-TTY", N_("last tty used"), N_("Last terminal"), 0.05, SCOLS_FL_DEFAULT },
+ [COL_LAST_HOSTNAME] = { "LAST-HOSTNAME",N_("hostname during the last session"), N_("Last hostname"), 0.1, SCOLS_FL_DEFAULT},
+ [COL_FAILED_LOGIN] = { "FAILED-LOGIN", N_("date of last failed login"), N_("Failed login"), 0.1, SCOLS_FL_DEFAULT },
+ [COL_FAILED_TTY] = { "FAILED-TTY", N_("where did the login fail?"), N_("Failed login terminal"), 0.05, SCOLS_FL_DEFAULT },
[COL_HUSH_STATUS] = { "HUSHED", N_("user's hush settings"), N_("Hushed"), 1, SCOLS_FL_RIGHT },
[COL_PWD_WARN] = { "PWD-WARN", N_("days user is warned of password expiration"), N_("Password expiration warn interval"), 0.1, SCOLS_FL_RIGHT },
[COL_PWD_EXPIR] = { "PWD-EXPIR", N_("password expiration date"), N_("Password expiration"), 0.1, SCOLS_FL_RIGHT },
[COL_PWD_CTIME] = { "PWD-CHANGE", N_("date of last password change"), N_("Password changed"), 0.1, SCOLS_FL_RIGHT},
[COL_PWD_CTIME_MIN] = { "PWD-MIN", N_("number of days required between changes"), N_("Minimum change time"), 0.1, SCOLS_FL_RIGHT },
[COL_PWD_CTIME_MAX] = { "PWD-MAX", N_("max number of days a password may remain unchanged"), N_("Maximum change time"), 0.1, SCOLS_FL_RIGHT },
- [COL_SELINUX] = { "CONTEXT", N_("the user's security context"), N_("Selinux context"), 0.1 },
+ [COL_SELINUX] = { "CONTEXT", N_("the user's security context"), N_("Selinux context"), 0.1, SCOLS_FL_DEFAULT },
[COL_NPROCS] = { "PROC", N_("number of processes run by the user"), N_("Running processes"), 1, SCOLS_FL_RIGHT },
};
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 22/23] lslogins: use more narrow layout when initializing struct members
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (20 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 21/23] lslogins: add missing initializers to struct lslogins_coldesc Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-10-01 10:32 ` Karel Zak
2014-09-28 19:51 ` [PATCH 23/23] tests: fix the ipcs test for shmall being too big to show Sami Kerola
2014-10-01 11:14 ` [PATCH 00/23] pull: mostly textual and compiler warning fix changes Karel Zak
23 siblings, 1 reply; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
This is more readable for normal size (24x80) terminals, and has
advantage to make each of the field members to be version controlled in
separate lines.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
login-utils/lslogins.c | 210 +++++++++++++++++++++++++++++++++++++++----------
1 file changed, 170 insertions(+), 40 deletions(-)
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
index 44c389e..4e62994 100644
--- a/login-utils/lslogins.c
+++ b/login-utils/lslogins.c
@@ -59,18 +59,6 @@
#include "readutmp.h"
#include "procutils.h"
-/*
- * column description
- */
-struct lslogins_coldesc {
- const char *name;
- const char *help;
- const char *pretty_name;
-
- double whint; /* width hint */
- long flag;
-};
-
static int lslogins_flag;
#define UL_UID_MIN 1000
@@ -212,34 +200,176 @@ static const char *const pretty_status[] = {
#define get_status(x) (outmode == OUT_PRETTY ? pretty_status[(x)] : status[(x)])
-static const struct lslogins_coldesc coldescs[] =
-{
- [COL_USER] = { "USER", N_("user name"), N_("Username"), 0.1, SCOLS_FL_NOEXTREMES },
- [COL_UID] = { "UID", N_("user ID"), "UID", 1, SCOLS_FL_RIGHT},
- [COL_PWDEMPTY] = { "PWD-EMPTY", N_("password not required"), N_("Password not required"), 1, SCOLS_FL_RIGHT },
- [COL_PWDDENY] = { "PWD-DENY", N_("login by password disabled"), N_("Login by password disabled"), 1, SCOLS_FL_RIGHT },
- [COL_PWDLOCK] = { "PWD-LOCK", N_("password defined, but locked"), N_("Password is locked"), 1, SCOLS_FL_RIGHT },
- [COL_NOLOGIN] = { "NOLOGIN", N_("log in disabled by nologin(8) or pam_nologin(8)"), N_("No login"), 1, SCOLS_FL_RIGHT },
- [COL_GROUP] = { "GROUP", N_("primary group name"), N_("Primary group"), 0.1, SCOLS_FL_DEFAULT },
- [COL_GID] = { "GID", N_("primary group ID"), "GID", 1, SCOLS_FL_RIGHT },
- [COL_SGROUPS] = { "SUPP-GROUPS", N_("supplementary group names"), N_("Supplementary groups"), 0.1, SCOLS_FL_DEFAULT },
- [COL_SGIDS] = { "SUPP-GIDS", N_("supplementary group IDs"), N_("Supplementary group IDs"), 0.1, SCOLS_FL_DEFAULT },
- [COL_HOME] = { "HOMEDIR", N_("home directory"), N_("Home directory"), 0.1, SCOLS_FL_DEFAULT },
- [COL_SHELL] = { "SHELL", N_("login shell"), N_("Shell"), 0.1, SCOLS_FL_DEFAULT },
- [COL_GECOS] = { "GECOS", N_("full user name"), N_("Gecos field"), 0.1, SCOLS_FL_TRUNC },
- [COL_LAST_LOGIN] = { "LAST-LOGIN", N_("date of last login"), N_("Last login"), 0.1, SCOLS_FL_RIGHT },
- [COL_LAST_TTY] = { "LAST-TTY", N_("last tty used"), N_("Last terminal"), 0.05, SCOLS_FL_DEFAULT },
- [COL_LAST_HOSTNAME] = { "LAST-HOSTNAME",N_("hostname during the last session"), N_("Last hostname"), 0.1, SCOLS_FL_DEFAULT},
- [COL_FAILED_LOGIN] = { "FAILED-LOGIN", N_("date of last failed login"), N_("Failed login"), 0.1, SCOLS_FL_DEFAULT },
- [COL_FAILED_TTY] = { "FAILED-TTY", N_("where did the login fail?"), N_("Failed login terminal"), 0.05, SCOLS_FL_DEFAULT },
- [COL_HUSH_STATUS] = { "HUSHED", N_("user's hush settings"), N_("Hushed"), 1, SCOLS_FL_RIGHT },
- [COL_PWD_WARN] = { "PWD-WARN", N_("days user is warned of password expiration"), N_("Password expiration warn interval"), 0.1, SCOLS_FL_RIGHT },
- [COL_PWD_EXPIR] = { "PWD-EXPIR", N_("password expiration date"), N_("Password expiration"), 0.1, SCOLS_FL_RIGHT },
- [COL_PWD_CTIME] = { "PWD-CHANGE", N_("date of last password change"), N_("Password changed"), 0.1, SCOLS_FL_RIGHT},
- [COL_PWD_CTIME_MIN] = { "PWD-MIN", N_("number of days required between changes"), N_("Minimum change time"), 0.1, SCOLS_FL_RIGHT },
- [COL_PWD_CTIME_MAX] = { "PWD-MAX", N_("max number of days a password may remain unchanged"), N_("Maximum change time"), 0.1, SCOLS_FL_RIGHT },
- [COL_SELINUX] = { "CONTEXT", N_("the user's security context"), N_("Selinux context"), 0.1, SCOLS_FL_DEFAULT },
- [COL_NPROCS] = { "PROC", N_("number of processes run by the user"), N_("Running processes"), 1, SCOLS_FL_RIGHT },
+/*
+ * column description
+ */
+struct lslogins_coldesc {
+ const char *name;
+ const char *help;
+ const char *pretty_name;
+
+ double whint; /* width hint */
+ long flag;
+};
+
+static const struct lslogins_coldesc
+ coldescs[] = {
+ [COL_USER] =
+ {"USER",
+ N_("user name"),
+ N_("Username"),
+ 0.1,
+ SCOLS_FL_NOEXTREMES},
+ [COL_UID] =
+ {"UID",
+ N_("user ID"),
+ "UID",
+ 1,
+ SCOLS_FL_RIGHT},
+ [COL_PWDEMPTY] =
+ {"PWD-EMPTY",
+ N_("password not required"),
+ N_("Password not required"),
+ 1,
+ SCOLS_FL_RIGHT},
+ [COL_PWDDENY] =
+ {"PWD-DENY",
+ N_("login by password disabled"),
+ N_("Login by password disabled"),
+ 1,
+ SCOLS_FL_RIGHT},
+ [COL_PWDLOCK] =
+ {"PWD-LOCK",
+ N_("password defined, but locked"),
+ N_("Password is locked"),
+ 1,
+ SCOLS_FL_RIGHT},
+ [COL_NOLOGIN] =
+ {"NOLOGIN",
+ N_("log in disabled by nologin(8) or pam_nologin(8)"),
+ N_("No login"),
+ 1,
+ SCOLS_FL_RIGHT},
+ [COL_GROUP] =
+ {"GROUP",
+ N_("primary group name"),
+ N_("Primary group"),
+ 0.1,
+ SCOLS_FL_DEFAULT},
+ [COL_GID] =
+ {"GID",
+ N_("primary group ID"),
+ "GID",
+ 1,
+ SCOLS_FL_RIGHT},
+ [COL_SGROUPS] =
+ {"SUPP-GROUPS",
+ N_("supplementary group names"),
+ N_("Supplementary groups"),
+ 0.1,
+ SCOLS_FL_DEFAULT},
+ [COL_SGIDS] =
+ {"SUPP-GIDS",
+ N_("supplementary group IDs"),
+ N_("Supplementary group IDs"),
+ 0.1,
+ SCOLS_FL_DEFAULT},
+ [COL_HOME] =
+ {"HOMEDIR",
+ N_("home directory"),
+ N_("Home directory"),
+ 0.1,
+ SCOLS_FL_DEFAULT},
+ [COL_SHELL] =
+ {"SHELL",
+ N_("login shell"),
+ N_("Shell"),
+ 0.1,
+ SCOLS_FL_DEFAULT},
+ [COL_GECOS] =
+ {"GECOS",
+ N_("full user name"),
+ N_("Gecos field"),
+ 0.1,
+ SCOLS_FL_TRUNC},
+ [COL_LAST_LOGIN] =
+ {"LAST-LOGIN",
+ N_("date of last login"),
+ N_("Last login"),
+ 0.1,
+ SCOLS_FL_RIGHT},
+ [COL_LAST_TTY] =
+ {"LAST-TTY",
+ N_("last tty used"),
+ N_("Last terminal"),
+ 0.05,
+ SCOLS_FL_DEFAULT},
+ [COL_LAST_HOSTNAME] =
+ {"LAST-HOSTNAME",
+ N_("hostname during the last session"),
+ N_("Last hostname"),
+ 0.1,
+ SCOLS_FL_DEFAULT},
+ [COL_FAILED_LOGIN] =
+ {"FAILED-LOGIN",
+ N_("date of last failed login"),
+ N_("Failed login"),
+ 0.1,
+ SCOLS_FL_DEFAULT},
+ [COL_FAILED_TTY] =
+ {"FAILED-TTY",
+ N_("where did the login fail?"),
+ N_("Failed login terminal"),
+ 0.05,
+ SCOLS_FL_DEFAULT},
+ [COL_HUSH_STATUS] =
+ {"HUSHED",
+ N_("user's hush settings"),
+ N_("Hushed"),
+ 1,
+ SCOLS_FL_RIGHT},
+ [COL_PWD_WARN] =
+ {"PWD-WARN",
+ N_("days user is warned of password expiration"),
+ N_("Password expiration warn interval"),
+ 0.1,
+ SCOLS_FL_RIGHT},
+ [COL_PWD_EXPIR] =
+ {"PWD-EXPIR",
+ N_("password expiration date"),
+ N_("Password expiration"),
+ 0.1,
+ SCOLS_FL_RIGHT},
+ [COL_PWD_CTIME] =
+ {"PWD-CHANGE",
+ N_("date of last password change"),
+ N_("Password changed"),
+ 0.1,
+ SCOLS_FL_RIGHT},
+ [COL_PWD_CTIME_MIN] =
+ {"PWD-MIN",
+ N_("number of days required between changes"),
+ N_("Minimum change time"),
+ 0.1,
+ SCOLS_FL_RIGHT},
+ [COL_PWD_CTIME_MAX] =
+ {"PWD-MAX",
+ N_("max number of days a password may remain unchanged"),
+ N_("Maximum change time"),
+ 0.1,
+ SCOLS_FL_RIGHT},
+ [COL_SELINUX] =
+ {"CONTEXT",
+ N_("the user's security context"),
+ N_("Selinux context"),
+ 0.1,
+ SCOLS_FL_DEFAULT},
+ [COL_NPROCS] =
+ {"PROC",
+ N_("number of processes run by the user"),
+ N_("Running processes"),
+ 1,
+ SCOLS_FL_RIGHT},
};
struct lslogins_control {
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 22/23] lslogins: use more narrow layout when initializing struct members
2014-09-28 19:51 ` [PATCH 22/23] lslogins: use more narrow layout when initializing struct members Sami Kerola
@ 2014-10-01 10:32 ` Karel Zak
0 siblings, 0 replies; 30+ messages in thread
From: Karel Zak @ 2014-10-01 10:32 UTC (permalink / raw)
To: Sami Kerola; +Cc: util-linux
On Sun, Sep 28, 2014 at 08:51:55PM +0100, Sami Kerola wrote:
> +static const struct lslogins_coldesc
> + coldescs[] = {
> + [COL_USER] =
> + {"USER",
> + N_("user name"),
> + N_("Username"),
> + 0.1,
> + SCOLS_FL_NOEXTREMES},
Oh, nooo.. don't be 80-cols fanatic. This bikeshed has already the
best possible color. Really. ;-)
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 23/23] tests: fix the ipcs test for shmall being too big to show
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (21 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 22/23] lslogins: use more narrow layout when initializing struct members Sami Kerola
@ 2014-09-28 19:51 ` Sami Kerola
2014-10-01 9:45 ` Karel Zak
2014-10-01 11:14 ` [PATCH 00/23] pull: mostly textual and compiler warning fix changes Karel Zak
23 siblings, 1 reply; 30+ messages in thread
From: Sami Kerola @ 2014-09-28 19:51 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa, Adam Sampson
From: Adam Sampson <ats@offog.org>
It was correct when originally introduced, but the shell overflow fix in
3a9ec12d6664527fad9c56347c88f3447d6c0856 accidentally reversed the sense
of the test.
Tested-by: Sami Kerola <kerolasa@iki.if>
Reviewed-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Adam Sampson <ats@offog.org>
---
tests/ts/ipcs/limits2 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/ts/ipcs/limits2 b/tests/ts/ipcs/limits2
index 1a49c46..4e96ce6 100755
--- a/tests/ts/ipcs/limits2
+++ b/tests/ts/ipcs/limits2
@@ -29,7 +29,7 @@ ts_check_prog "bc"
# TODO https://github.com/karelzak/util-linux/issues/51
SHMALL=$(</proc/sys/kernel/shmall)
-if [ $(bc <<<"2^64 / $PAGE_SIZE < $SHMALL") -ne 1 ]; then
+if [ $(bc <<<"(2^64 / $PAGE_SIZE) <= $SHMALL") -eq 1 ]; then
TS_KNOWN_FAIL="yes"
fi
--
2.1.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 00/23] pull: mostly textual and compiler warning fix changes
2014-09-28 19:51 [PATCH 00/23] pull: mostly textual and compiler warning fix changes Sami Kerola
` (22 preceding siblings ...)
2014-09-28 19:51 ` [PATCH 23/23] tests: fix the ipcs test for shmall being too big to show Sami Kerola
@ 2014-10-01 11:14 ` Karel Zak
23 siblings, 0 replies; 30+ messages in thread
From: Karel Zak @ 2014-10-01 11:14 UTC (permalink / raw)
To: Sami Kerola; +Cc: util-linux
On Sun, Sep 28, 2014 at 08:51:33PM +0100, Sami Kerola wrote:
> libblkid: fix implicit constant conversion warning
> cfdisk: add missing initializers to struct main_menuitems
> findmnt: add missing initializers to struct colinfo
> lsblk: add missing initializers to struct colinfo
> lscpu: add missing initializers to struct lscpu_coldesc
> libsmartcols: add explicit column flags default
> lslogins: add missing initializers to struct lslogins_coldesc
> lslogins: use more narrow layout when initializing struct members
Rejected, the rest merged. Thanks.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 30+ messages in thread