mirror of
https://github.com/schoebel/mars
synced 2025-03-02 11:30:37 +00:00
marsadm: add primitive macro errno-text
This commit is contained in:
parent
6c41326f7a
commit
cc1074fc53
@ -7339,6 +7339,23 @@ marsadm
|
||||
\begin_layout Labeling
|
||||
\labelwidthstring 00.00.0000
|
||||
|
||||
\family typewriter
|
||||
errno-text
|
||||
\family default
|
||||
This macro takes 1 argument, which must represent a Linux
|
||||
\family typewriter
|
||||
errno
|
||||
\family default
|
||||
number, and converts it to human readable form (similar to the C
|
||||
\family typewriter
|
||||
strerror()
|
||||
\family default
|
||||
function).
|
||||
\end_layout
|
||||
|
||||
\begin_layout Labeling
|
||||
\labelwidthstring 00.00.0000
|
||||
|
||||
\family typewriter
|
||||
todo-{attach,sync,fetch,replay,primary}
|
||||
\family default
|
||||
|
@ -1159,7 +1159,7 @@ sub __conv_errno {
|
||||
my ($txt, $error) = @_;
|
||||
return "$txt$error" if !defined($error) || ($error <= 0);
|
||||
$! = $error;
|
||||
my $res = "${txt}${error} [$!]";
|
||||
my $res = "${txt}${error}[$!]";
|
||||
$! = 0;
|
||||
return $res;
|
||||
}
|
||||
@ -2783,6 +2783,12 @@ sub eval_fn {
|
||||
my $max = make_numeric(parse_macro($arg4, $env));
|
||||
return progress_bar($length, $min, $mid, $max);
|
||||
}
|
||||
if (/^errno[-_]?text$/) {
|
||||
my $code = parse_macro($arg1, $env);
|
||||
return "" unless defined($code) && $code != 0;
|
||||
$code = -$code if $code < 0;
|
||||
return __conv_errno("", $code);
|
||||
}
|
||||
if (/^get[-_]?log[-_]?status/) {
|
||||
return get_error_text($$env{"cmd"}, $$env{"res"});
|
||||
}
|
||||
@ -3994,6 +4000,8 @@ my %trivial_globs =
|
||||
=> "",
|
||||
"replay-code"
|
||||
=> "When negative, this indidates that a replay/recovery error has occurred.",
|
||||
"errno-text"
|
||||
=> "Convert errno numbers (positive or negative) into human readable text.",
|
||||
"{sync,fetch,replay,work,syncpos}-{size,pos}"
|
||||
=> "",
|
||||
"{sync,fetch,replay,work}-{rest,{almost-,threshold-,}reached,percent,permille,vector}"
|
||||
|
Loading…
Reference in New Issue
Block a user