Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify ncdump to print char-valued variables as utf8. #2921

Merged
merged 9 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 0 additions & 157 deletions .github/workflows/run_tests_s3.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DennisHeimbigner why was this file deleted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was never being used. Its purpose was to show in theory how to store the secret key
for accessing the Unidata S3 bucket. But it never worked so I decided to delete it.
We can return to it if/when we figure out how to do this safely.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An addendum.
The action can still test S3 read access if you set the following options:

--netcdf-enable-s3 --with-s3-testing=public

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Dennis!

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/run_tests_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: Run Ubuntu/Linux netCDF Tests

on: [pull_request, workflow_dispatch]
on: [ pull_request, workflow_dispatch]

concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
Expand Down
15 changes: 12 additions & 3 deletions ncdump/vardata.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
#include "vardata.h"
#include "netcdf_aux.h"

/* If set, then print char variables as utf-8.
If not set, then print non-printable characters as octal.
The latter was the default before this change.
*/
#define UTF8CHARS

/* maximum len of string needed for one value of a primitive type */
#define MAX_OUTPUT_LEN 100

Expand Down Expand Up @@ -340,6 +346,7 @@ pr_tvals(
sp = vals + len;
while (len != 0 && *--sp == '\0')
len--;
/* Walk the sequence of characters and write control characters in escape form. */
for (iel = 0; iel < len; iel++) {
unsigned char uc;
switch (uc = (unsigned char)(*vals++ & 0377)) {
Expand Down Expand Up @@ -371,10 +378,12 @@ pr_tvals(
printf("\\\"");
break;
default:
if (isprint(uc))
printf("%c",uc);
else
#ifdef UTF8CHARS
if (!isprint(uc))
printf("\\%.3o",uc);
else
#endif /*UTF8CHARS*/
printf("%c",uc);
break;
}
}
Expand Down
Loading