]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lslocks: add --notruncate, minor fixes in man page
authorKarel Zak <kzak@redhat.com>
Wed, 29 Feb 2012 13:26:46 +0000 (14:26 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 29 Feb 2012 13:26:46 +0000 (14:26 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lslocks.8
misc-utils/lslocks.c

index f4160ff87ba86196b869a8dfc5a4a69b1266eda6..3257d79522bc67df34053d460807368dc1c88b97 100644 (file)
@@ -23,10 +23,11 @@ Print a help text and exit.
 Specify which output columns to print. Use
 .B "--help"
 to get a list of all supported columns.
-.IP "\fB\-\-noheadings\fP"
+.IP "\fB\-n, \-\-noheadings\fP"
 Do not print a header line.
-
-.IP "\fB\-\-raw\fP"
+.IP "\fB\-u, \-\-notruncate\fP"
+Do not truncate text in columns.
+.IP "\fB\-r, \-\-raw\fP"
 Use the raw output format.
 
 .SH OUTPUT
@@ -53,7 +54,9 @@ Ending offset of the lock.
 
 .IP "PATH"
 Full path of the lock - if none is found or no permissions to read the path it
-will fallback to the device's mountpoint.
+will fallback to the device's mountpoint. The path might be truncated, use
+.B "--notruncate"
+to get the full path.
 
 .SH NOTES
 .nf
index 9a23d3543112154ae121afcecaf1a5a0b48fd123..39ab18d5962c795f008fad17ffae04656b25db35 100644 (file)
@@ -62,7 +62,7 @@ struct colinfo {
 };
 
 /* columns descriptions */
-struct colinfo infos[] = {
+static struct colinfo infos[] = {
        [COL_SRC]     = { "COMMAND", 15, 0, N_("command of the process holding the lock") },
        [COL_PID]     = { "PID",     5,  TT_FL_RIGHT, N_("PID of the process holding the lock") },
        [COL_SIZE]    = { "SIZE",    4,  TT_FL_RIGHT, N_("size of the lock") },
@@ -91,6 +91,14 @@ struct lock {
        char *size;
 };
 
+static void disable_columns_truncate(void)
+{
+       size_t i;
+
+       for (i = 0; i < NCOLS; i++)
+               infos[i].flags &= ~TT_FL_TRUNC;
+}
+
 /*
  * Return a PID's command name
  */
@@ -465,6 +473,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
                " -o, --output <list>    define which output columns to use\n"
                " -n, --noheadings       don't print headings\n"
                " -r  --raw              use the raw output format\n"
+               " -u, --notruncate       don't truncate text in columns\n"
                " -h, --help             display this help and exit\n"
                " -V, --version          output version information and exit\n"), out);
 
@@ -486,6 +495,7 @@ int main(int argc, char *argv[])
                { "pid",        required_argument, NULL, 'p' },
                { "help",       no_argument,       NULL, 'h' },
                { "output",     required_argument, NULL, 'o' },
+               { "notruncate", no_argument,       NULL, 'u' },
                { "version",    no_argument,       NULL, 'V' },
                { "noheadings", no_argument,       NULL, 'n' },
                { "raw",        no_argument,       NULL, 'r' },
@@ -497,7 +507,7 @@ int main(int argc, char *argv[])
        textdomain(PACKAGE);
 
        while ((c = getopt_long(argc, argv,
-                               "p:o:nrhV", long_opts, NULL)) != -1) {
+                               "p:o:nruhV", long_opts, NULL)) != -1) {
 
                switch(c) {
                case 'p':
@@ -521,6 +531,9 @@ int main(int argc, char *argv[])
                case 'r':
                        tt_flags |= TT_FL_RAW;
                        break;
+               case 'u':
+                       disable_columns_truncate();
+                       break;
                case '?':
                default:
                        usage(stderr);