From a1a7e3796f3244b6a021be872e167a9bad9f31c6 Mon Sep 17 00:00:00 2001 From: Jeremy Lorelli Date: Thu, 19 Mar 2026 12:44:04 -0700 Subject: [PATCH] Add -S option to pvget/pvmonitor to stringify byte arrays --- pvtoolsSrc/pvget.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pvtoolsSrc/pvget.cpp b/pvtoolsSrc/pvget.cpp index f5081908f..ae96ccb97 100644 --- a/pvtoolsSrc/pvget.cpp +++ b/pvtoolsSrc/pvget.cpp @@ -39,6 +39,8 @@ namespace { size_t pvnamewidth; +bool stringify = false; + int haderror; void usage (void) @@ -46,6 +48,7 @@ void usage (void) fprintf (stderr, "\nUsage: " EXECNAME " [options] ...\n" "\n" COMMON_OPTIONS + " -S: Print array of bytes as a string\n" " deprecated options:\n" " -q, -t, -i, -n, -F: ignored\n" " -f : errors\n" @@ -85,6 +88,7 @@ struct Getter : public pvac::ClientChannel::GetCallback, public Tracker pvd::PVStructure::Formatter fmt(event.value->stream() .format(outmode)); + fmt.arrayAsString(stringify); if(verbosity>=2) fmt.highlight(*event.valid); // show all, highlight valid else @@ -276,7 +280,7 @@ int MAIN (int argc, char *argv[]) // ================ Parse Arguments - while ((opt = getopt(argc, argv, ":hvVRM:r:w:tmp:qdcF:f:ni")) != -1) { + while ((opt = getopt(argc, argv, ":hvVRM:r:w:tmp:qdcF:f:niS")) != -1) { switch (opt) { case 'h': /* Print usage */ usage(); @@ -336,6 +340,9 @@ int MAIN (int argc, char *argv[]) case 'q': /* Quiet mode */ // deprecate break; + case 'S': + stringify = true; /* Stringify byte scalar arrays */ + break; case 'f': /* Use input stream as input */ fprintf(stderr, "Unsupported option -f\n"); return 1;