[systemd-devel] [PATCH] Use normal English elide in place of ellipsize
Barry Scott
barry.scott at onelan.co.uk
Tue Feb 4 07:31:58 PST 2014
Change the messages output and also all internal
function names and variables to match.
---
man/journalctl.xml | 2 +-
man/loginctl.xml | 2 +-
man/machinectl.xml | 2 +-
man/systemctl.xml | 4 ++--
man/systemd-cgls.xml | 2 +-
src/cgls/cgls.c | 2 +-
src/cgtop/cgtop.c | 2 +-
src/journal/journalctl.c | 6 +++---
src/libsystemd/sd-bus/busctl.c | 2 +-
src/login/loginctl.c | 2 +-
src/login/sysfs-show.c | 4 ++--
src/machine/machinectl.c | 2 +-
src/shared/logs-show.c | 28 ++++++++++++++--------------
src/shared/logs-show.h | 4 ++--
src/shared/util.c | 16 ++++++++--------
src/shared/util.h | 4 ++--
src/systemctl/systemctl.c | 38 +++++++++++++++++++-------------------
src/test/test-ellipsize.c | 2 +-
18 files changed, 62 insertions(+), 62 deletions(-)
diff --git a/man/journalctl.xml b/man/journalctl.xml
index 3b05e80..78417f1 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -156,7 +156,7 @@
<term><option>--full</option></term>
<term><option>-l</option></term>
- <listitem><para>Ellipsize fields when
+ <listitem><para>Elide fields when
they do not fit in available columns.
The default is to show full fields,
allowing them to wrap or be truncated
diff --git a/man/loginctl.xml b/man/loginctl.xml
index 13105d4..682ed1d 100644
--- a/man/loginctl.xml
+++ b/man/loginctl.xml
@@ -163,7 +163,7 @@
<term><option>-l</option></term>
<term><option>--full</option></term>
- <listitem><para>Do not ellipsize
+ <listitem><para>Do not elide
process tree entries.</para>
</listitem>
</varlistentry>
diff --git a/man/machinectl.xml b/man/machinectl.xml
index 6e991ee..1d62ff0 100644
--- a/man/machinectl.xml
+++ b/man/machinectl.xml
@@ -153,7 +153,7 @@
<term><option>-l</option></term>
<term><option>--full</option></term>
- <listitem><para>Do not ellipsize
+ <listitem><para>Do not elide
process tree entries.</para>
</listitem>
</varlistentry>
diff --git a/man/systemctl.xml b/man/systemctl.xml
index ed1bf48..efa1d28 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -174,7 +174,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<term><option>--full</option></term>
<listitem>
- <para>Do not ellipsize unit names, process tree entries,
+ <para>Do not elide unit names, process tree entries,
journal output, or truncate unit descriptions in the output
of <command>status</command>, <command>list-units</command>,
<command>list-jobs</command>, and
@@ -731,7 +731,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
<para>This function is intended to generate human-readable
output. If you are looking for computer-parsable output,
use <command>show</command> instead. By default this
- function only shows 10 lines of output and ellipsizes
+ function only shows 10 lines of output and elides
lines to fit in the terminal window. This can be changes
with <option>--lines</option> and <option>--full</option>,
see above. In addition, <command>journalctl
diff --git a/man/systemd-cgls.xml b/man/systemd-cgls.xml
index 955e0da..c570269 100644
--- a/man/systemd-cgls.xml
+++ b/man/systemd-cgls.xml
@@ -116,7 +116,7 @@
<term><option>-l</option></term>
<term><option>--full</option></term>
- <listitem><para>Do not ellipsize
+ <listitem><para>Do not elide
process tree members.</para>
</listitem>
</varlistentry>
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index b8e275d..7e04912 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -50,7 +50,7 @@ static int help(void) {
" --version Show package version\n"
" --no-pager Do not pipe output into a pager\n"
" -a --all Show all groups, including empty\n"
- " -l --full Do not ellipsize output\n"
+ " -l --full Do not elide output\n"
" -k Include kernel threads in output\n"
" -M --machine Show container\n",
program_invocation_short_name);
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index c56f7a8..ab20045 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -512,7 +512,7 @@ static int display(Hashmap *a) {
g = array[j];
- p = ellipsize(g->path, path_columns, 33);
+ p = elide(g->path, path_columns, 33);
printf("%-*s", path_columns, p ? p : g->path);
free(p);
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 482795b..8bf1493 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -190,7 +190,7 @@ static int help(void) {
" short-precise, short-monotonic, verbose,\n"
" export, json, json-pretty, json-sse, cat)\n"
" -x --catalog Add message explanations where available\n"
- " --no-full Ellipsize fields\n"
+ " --no-full Elide fields\n"
" -a --all Show all fields, including long and unprintable\n"
" -q --quiet Do not show privilege warning\n"
" --no-pager Do not pipe output into a pager\n"
@@ -1564,7 +1564,7 @@ int main(int argc, char *argv[]) {
sd_id128_t previous_boot_id;
bool previous_boot_id_valid = false, first_line = true;
int n_shown = 0;
- bool ellipsized = false;
+ bool elided = false;
setlocale(LC_ALL, "");
log_parse_environment();
@@ -1897,7 +1897,7 @@ int main(int argc, char *argv[]) {
on_tty() * OUTPUT_COLOR |
arg_catalog * OUTPUT_CATALOG;
- r = output_journal(stdout, j, arg_output, 0, flags, &ellipsized);
+ r = output_journal(stdout, j, arg_output, 0, flags, &elided);
need_seek = true;
if (r == -EADDRNOTAVAIL)
break;
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index 1d7f575..0ee3066 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -183,7 +183,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
if (r >= 0) {
_cleanup_free_ char *e;
- e = ellipsize(unit, 25, 100);
+ e = elide(unit, 25, 100);
if (!e)
return log_oom();
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 6900253..db1fe82 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -1055,7 +1055,7 @@ static int help(void) {
" -M --machine=CONTAINER Operate on local container\n"
" -p --property=NAME Show only properties by this name\n"
" -a --all Show all properties, including empty ones\n"
- " -l --full Do not ellipsize output\n"
+ " -l --full Do not elide output\n"
" --kill-who=WHO Who to send signal to\n"
" -s --signal=SIGNAL Which signal to send\n\n"
"Commands:\n"
diff --git a/src/login/sysfs-show.c b/src/login/sysfs-show.c
index 939bd61..173d42f 100644
--- a/src/login/sysfs-show.c
+++ b/src/login/sysfs-show.c
@@ -103,7 +103,7 @@ static int show_sysfs_one(
lookahead = udev_list_entry_get_next(lookahead);
}
- k = ellipsize(sysfs, n_columns, 20);
+ k = elide(sysfs, n_columns, 20);
if (!k)
return -ENOMEM;
@@ -117,7 +117,7 @@ static int show_sysfs_one(
return -ENOMEM;
free(k);
- k = ellipsize(l, n_columns, 70);
+ k = elide(l, n_columns, 70);
if (!k)
return -ENOMEM;
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index b3a7018..228caef 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -615,7 +615,7 @@ static int help(void) {
" -M --machine=CONTAINER Operate on local container\n"
" -p --property=NAME Show only properties by this name\n"
" -a --all Show all properties, including empty ones\n"
- " -l --full Do not ellipsize output\n"
+ " -l --full Do not elide output\n"
" --kill-who=WHO Who to send signal to\n"
" -s --signal=SIGNAL Which signal to send\n\n"
"Commands:\n"
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 61c3652..55fa547 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -111,7 +111,7 @@ static bool shall_print(const char *p, size_t l, OutputFlags flags) {
static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, OutputFlags flags, int priority, const char* message, size_t message_len) {
const char *color_on = "", *color_off = "";
const char *pos, *end;
- bool ellipsized = false;
+ bool elided = false;
int line = 0;
if (flags & OUTPUT_COLOR) {
@@ -153,7 +153,7 @@ static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, Output
}
/* Beyond this point, ellipsization will happen. */
- ellipsized = true;
+ elided = true;
if (prefix < n_columns && n_columns - prefix >= 3) {
if (n_columns - prefix > (unsigned) len + 3)
@@ -163,7 +163,7 @@ static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, Output
else {
_cleanup_free_ char *e;
- e = ellipsize_mem(pos, len, n_columns - prefix,
+ e = elide_mem(pos, len, n_columns - prefix,
tail_line ? 100 : 90);
if (!e)
fprintf(f, "%*s%s%.*s%s\n",
@@ -181,7 +181,7 @@ static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, Output
break;
}
- return ellipsized;
+ return elided;
}
static int output_short(
@@ -198,7 +198,7 @@ static int output_short(
_cleanup_free_ char *hostname = NULL, *identifier = NULL, *comm = NULL, *pid = NULL, *fake_pid = NULL, *message = NULL, *realtime = NULL, *monotonic = NULL, *priority = NULL;
size_t hostname_len = 0, identifier_len = 0, comm_len = 0, pid_len = 0, fake_pid_len = 0, message_len = 0, realtime_len = 0, monotonic_len = 0, priority_len = 0;
int p = LOG_INFO;
- bool ellipsized = false;
+ bool elided = false;
assert(f);
assert(j);
@@ -373,14 +373,14 @@ static int output_short(
fprintf(f, ": [%s blob data]\n", format_bytes(bytes, sizeof(bytes), message_len));
} else {
fputs(": ", f);
- ellipsized |=
+ elided |=
print_multiline(f, n + 2, n_columns, flags, p, message, message_len);
}
if (flags & OUTPUT_CATALOG)
print_catalog(f, j);
- return ellipsized;
+ return elided;
}
static int output_verbose(
@@ -904,7 +904,7 @@ int output_journal(
OutputMode mode,
unsigned n_columns,
OutputFlags flags,
- bool *ellipsized) {
+ bool *elided) {
int ret;
assert(mode >= 0);
@@ -916,8 +916,8 @@ int output_journal(
ret = output_funcs[mode](f, j, mode, n_columns, flags);
fflush(stdout);
- if (ellipsized && ret > 0)
- *ellipsized = true;
+ if (elided && ret > 0)
+ *elided = true;
return ret;
}
@@ -929,7 +929,7 @@ static int show_journal(FILE *f,
usec_t not_before,
unsigned how_many,
OutputFlags flags,
- bool *ellipsized) {
+ bool *elided) {
int r;
unsigned line = 0;
@@ -980,7 +980,7 @@ static int show_journal(FILE *f,
line ++;
- r = output_journal(f, j, mode, n_columns, flags, ellipsized);
+ r = output_journal(f, j, mode, n_columns, flags, elided);
if (r < 0)
goto finish;
}
@@ -1235,7 +1235,7 @@ int show_journal_by_unit(
uid_t uid,
OutputFlags flags,
bool system,
- bool *ellipsized) {
+ bool *elided) {
_cleanup_journal_close_ sd_journal*j = NULL;
int r;
@@ -1270,7 +1270,7 @@ int show_journal_by_unit(
log_debug("Journal filter: %s", filter);
}
- return show_journal(f, j, mode, n_columns, not_before, how_many, flags, ellipsized);
+ return show_journal(f, j, mode, n_columns, not_before, how_many, flags, elided);
}
static const char *const output_mode_table[_OUTPUT_MODE_MAX] = {
diff --git a/src/shared/logs-show.h b/src/shared/logs-show.h
index 3a99160..44fde20 100644
--- a/src/shared/logs-show.h
+++ b/src/shared/logs-show.h
@@ -36,7 +36,7 @@ int output_journal(
OutputMode mode,
unsigned n_columns,
OutputFlags flags,
- bool *ellipsized);
+ bool *elided);
int add_match_this_boot(sd_journal *j, const char *machine);
@@ -59,7 +59,7 @@ int show_journal_by_unit(
uid_t uid,
OutputFlags flags,
bool system,
- bool *ellipsized);
+ bool *elided);
void json_escape(
FILE *f,
diff --git a/src/shared/util.c b/src/shared/util.c
index f76ed6f..bdad083 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2857,7 +2857,7 @@ int status_vprintf(const char *status, bool ellipse, bool ephemeral, const char
if (emax < 3)
emax = 3;
- e = ellipsize(s, emax, 75);
+ e = elide(s, emax, 75);
if (e) {
free(s);
s = e;
@@ -3151,7 +3151,7 @@ int running_in_chroot(void) {
a.st_ino != b.st_ino;
}
-static char *ascii_ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent) {
+static char *ascii_elide_mem(const char *s, size_t old_length, size_t new_length, unsigned percent) {
size_t x;
char *r;
@@ -3182,7 +3182,7 @@ static char *ascii_ellipsize_mem(const char *s, size_t old_length, size_t new_le
return r;
}
-char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent) {
+char *elide_mem(const char *s, size_t old_length, size_t new_length, unsigned percent) {
size_t x;
char *e;
const char *i, *j;
@@ -3192,9 +3192,9 @@ char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne
assert(percent <= 100);
assert(new_length >= 3);
- /* if no multibyte characters use ascii_ellipsize_mem for speed */
+ /* if no multibyte characters use ascii_elide_mem for speed */
if (ascii_is_valid(s))
- return ascii_ellipsize_mem(s, old_length, new_length, percent);
+ return ascii_elide_mem(s, old_length, new_length, percent);
if (old_length <= 3 || old_length <= new_length)
return strndup(s, old_length);
@@ -3228,7 +3228,7 @@ char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne
}
assert(i <= j);
- /* we don't actually need to ellipsize */
+ /* we don't actually need to elide */
if (i == j)
return memdup(s, old_length + 1);
@@ -3256,8 +3256,8 @@ char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne
return e;
}
-char *ellipsize(const char *s, size_t length, unsigned percent) {
- return ellipsize_mem(s, strlen(s), length, percent);
+char *elide(const char *s, size_t length, unsigned percent) {
+ return elide_mem(s, strlen(s), length, percent);
}
int touch(const char *path) {
diff --git a/src/shared/util.h b/src/shared/util.h
index 219e489..8b3127c 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -444,9 +444,9 @@ static inline const char *ansi_highlight_off(void) {
int running_in_chroot(void);
-char *ellipsize(const char *s, size_t length, unsigned percent);
+char *elide(const char *s, size_t length, unsigned percent);
/* bytes columns */
-char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent);
+char *elide_mem(const char *s, size_t old_length, size_t new_length, unsigned percent);
int touch(const char *path);
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index d850b8b..14bbffa 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -419,7 +419,7 @@ static void output_units_list(const UnitInfo *unit_infos, unsigned c) {
} else
on_active = off_active = "";
- e = arg_full ? NULL : ellipsize(u->id, id_len, 33);
+ e = arg_full ? NULL : elide(u->id, id_len, 33);
printf("%s%-*s%s %s%-*s%s %s%-*s %-*s%s %-*s",
on, id_len, e ? e : u->id, off,
@@ -1067,7 +1067,7 @@ static void output_unit_file_list(const UnitFileList *units, unsigned c) {
id = basename(u->path);
- e = arg_full ? NULL : ellipsize(id, id_cols, 33);
+ e = arg_full ? NULL : elide(id, id_cols, 33);
printf("%-*s %s%-*s%s\n",
id_cols, e ? e : id,
@@ -1209,7 +1209,7 @@ static int list_dependencies_print(const char *name, int level, unsigned int bra
return 0;
}
- n = ellipsize(name, max_len-len, 100);
+ n = elide(name, max_len-len, 100);
if (!n)
return log_oom();
@@ -1597,7 +1597,7 @@ static void output_jobs_list(const struct job_info* jobs, unsigned n, bool skipp
} else
on = off = "";
- e = shorten ? ellipsize(j->name, unit_len, 33) : NULL;
+ e = shorten ? elide(j->name, unit_len, 33) : NULL;
printf("%*u %s%-*s%s %-*s %s%-*s%s\n",
id_len, j->id,
on, unit_len, e ? e : j->name, off,
@@ -2728,7 +2728,7 @@ typedef struct UnitStatusInfo {
static void print_status_info(
UnitStatusInfo *i,
- bool *ellipsized) {
+ bool *elided) {
ExecStatusInfo *p;
const char *on, *off, *ss;
@@ -3005,7 +3005,7 @@ static void print_status_info(
getuid(),
flags,
arg_scope == UNIT_FILE_SYSTEM,
- ellipsized);
+ elided);
}
if (i->need_daemon_reload)
@@ -3612,7 +3612,7 @@ static int show_one(
const char *path,
bool show_properties,
bool *new_line,
- bool *ellipsized) {
+ bool *elided) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
@@ -3691,7 +3691,7 @@ static int show_one(
if (streq(verb, "help"))
show_unit_help(&info);
else
- print_status_info(&info, ellipsized);
+ print_status_info(&info, elided);
}
strv_free(info.documentation);
@@ -3763,7 +3763,7 @@ static int show_all(
sd_bus *bus,
bool show_properties,
bool *new_line,
- bool *ellipsized) {
+ bool *elided) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_free_ UnitInfo *unit_infos = NULL;
@@ -3788,7 +3788,7 @@ static int show_all(
if (!p)
return log_oom();
- r = show_one(verb, bus, p, show_properties, new_line, ellipsized);
+ r = show_one(verb, bus, p, show_properties, new_line, elided);
if (r != 0)
return r;
}
@@ -3892,7 +3892,7 @@ static int cat(sd_bus *bus, char **args) {
static int show(sd_bus *bus, char **args) {
bool show_properties, show_status, new_line = false;
- bool ellipsized = false;
+ bool elided = false;
int r, ret = 0;
assert(bus);
@@ -3907,10 +3907,10 @@ static int show(sd_bus *bus, char **args) {
/* If no argument is specified inspect the manager itself */
if (show_properties && strv_length(args) <= 1)
- return show_one(args[0], bus, "/org/freedesktop/systemd1", show_properties, &new_line, &ellipsized);
+ return show_one(args[0], bus, "/org/freedesktop/systemd1", show_properties, &new_line, &elided);
if (show_status && strv_length(args) <= 1)
- ret = show_all(args[0], bus, false, &new_line, &ellipsized);
+ ret = show_all(args[0], bus, false, &new_line, &elided);
else {
_cleanup_free_ char **patterns = NULL;
char **name;
@@ -3938,7 +3938,7 @@ static int show(sd_bus *bus, char **args) {
}
}
- show_one(args[0], bus, unit, show_properties, &new_line, &ellipsized);
+ show_one(args[0], bus, unit, show_properties, &new_line, &elided);
}
if (!strv_isempty(patterns)) {
@@ -3955,13 +3955,13 @@ static int show(sd_bus *bus, char **args) {
if (!unit)
return log_oom();
- show_one(args[0], bus, unit, show_properties, &new_line, &ellipsized);
+ show_one(args[0], bus, unit, show_properties, &new_line, &elided);
}
}
}
- if (ellipsized && !arg_quiet)
- printf("Hint: Some lines were ellipsized, use -l to show in full.\n");
+ if (elided && !arg_quiet)
+ printf("Hint: Some lines were elided, use -l to show in full.\n");
return ret;
}
@@ -4962,7 +4962,7 @@ static int systemctl_help(void) {
" -a --all Show all loaded units/properties, including dead/empty\n"
" ones. To list all units installed on the system, use\n"
" the 'list-unit-files' command instead.\n"
- " -l --full Don't ellipsize unit names on output\n"
+ " -l --full Don't elide unit names on output\n"
" --reverse Show reverse dependencies with 'list-dependencies'\n"
" --job-mode=MODE Specify how to deal with already queued jobs, when\n"
" queueing a new job\n"
@@ -6336,7 +6336,7 @@ int main(int argc, char*argv[]) {
/* Explicitly not on_tty() to avoid setting cached value.
* This becomes relevant for piping output which might be
- * ellipsized. */
+ * elided. */
original_stdout_is_tty = isatty(STDOUT_FILENO);
r = parse_argv(argc, argv);
diff --git a/src/test/test-ellipsize.c b/src/test/test-ellipsize.c
index f97c78e..42a4d3b 100644
--- a/src/test/test-ellipsize.c
+++ b/src/test/test-ellipsize.c
@@ -27,7 +27,7 @@
static void test_one(const char *p) {
_cleanup_free_ char *t;
- t = ellipsize(p, columns(), 70);
+ t = elide(p, columns(), 70);
puts(t);
}
--
1.8.4.2
More information about the systemd-devel
mailing list