Add support for --extra-display to --remote (#123).

This commit is contained in:
Andrew Wood
2024-12-03 23:48:44 +00:00
parent ddd9430bc9
commit ebb209a371
5 changed files with 21 additions and 5 deletions
+1
View File
@@ -1,6 +1,7 @@
### UNRELEASED
* *fix:* add _configure_ script fallback for **--remote** check when cross-compiling (#120)
* *fix:* allow **extra-display** to be changed by **--remote** (#123)
### 1.9.7 - 2 December 2024
+14 -5
View File
@@ -44,11 +44,13 @@ struct remote_msg {
bool height_set_manually; /* height was set manually, not detected */
char name[256]; /* flawfinder: ignore */
char format[256]; /* flawfinder: ignore */
char extra_display[256]; /* flawfinder: ignore */
};
/*
* flawfinder rationale: name and format are always explicitly zeroed and
* bounded to one less than their size so they are always \0 terminated.
* flawfinder rationale: name, format, and extra_display are always
* explicitly zeroed and bounded to one less than their size so they are
* always \0 terminated.
*/
@@ -207,11 +209,14 @@ int pv_remote_set(opts_t opts, pvstate_t state)
if (opts->format != NULL) {
strncpy(msgbuf.format, opts->format, sizeof(msgbuf.format) - 1); /* flawfinder: ignore */
}
if (opts->extra_display != NULL) {
strncpy(msgbuf.extra_display, opts->extra_display, sizeof(msgbuf.extra_display) - 1); /* flawfinder: ignore */
}
/*
* flawfinder rationale: both name and format are explicitly bounded
* to 1 less than the size of their buffer and the buffer is \0
* terminated by memset() earlier.
* flawfinder rationale: name, format, and extra_display are
* explicitly bounded to 1 less than the size of their buffer and
* the buffer is \0 terminated by memset() earlier.
*/
/*
@@ -364,9 +369,11 @@ void pv_remote_check(pvstate_t state)
pv_state_format_string_set(state, NULL);
pv_state_name_set(state, NULL);
pv_state_extra_display_set(state, NULL);
msgbuf.name[sizeof(msgbuf.name) - 1] = '\0';
msgbuf.format[sizeof(msgbuf.format) - 1] = '\0';
msgbuf.extra_display[sizeof(msgbuf.extra_display) - 1] = '\0';
pv_state_set_format(state, msgbuf.progress, msgbuf.timer,
msgbuf.eta, msgbuf.fineta, msgbuf.rate,
@@ -389,6 +396,8 @@ void pv_remote_check(pvstate_t state)
pv_state_height_set(state, msgbuf.height, msgbuf.height_set_manually);
if (msgbuf.format[0] != '\0')
pv_state_format_string_set(state, msgbuf.format);
if (msgbuf.extra_display[0] != '\0')
pv_state_extra_display_set(state, msgbuf.extra_display);
}
@@ -33,6 +33,8 @@ for loopCount in 1 2 3; do
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile4}")" -F "%e" || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile4}")" -x "window:%b" || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile4}")" -N "." || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
echo "${loopCount}" >/dev/null # dummy for shellcheck
@@ -34,6 +34,8 @@ for loopCount in 1 2 3; do
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile3}")" -F "%e" || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile4}")" -x "window:%b" || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile3}")" -N "." || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
echo "${loopCount}" >/dev/null # dummy for shellcheck
@@ -33,6 +33,8 @@ runWithValgrind -R "$(cat "${workFile3}")" -N "test" 4>&1 || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
runWithValgrind -R "$(cat "${workFile3}")" -F "%e" 4>&1 || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
runWithValgrind -R "$(cat "${workFile3}")" -x "window:%b" 4>&1 || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
runWithValgrind -R "$(cat "${workFile3}")" -N "." 4>&1 || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
runWithValgrind -R "$(cat "${workFile3}")" -L 10M 4>&1 || exit 1