Skip to contentSkip to conversation

string_copying.7: Clarifying ustr and zustr

PATCH Alejandro Colomar 2 participants 3 messages Oct 10, 2023 – Oct 12, 2023 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

Alejandro Colomar

author maintainer
#0 lore raw

Hi Serge,

I'm clarifying zustr after your suggestion. Please check this text.

DESCRIPTION
Terms (and abbreviations)
string (str)
is a sequence of zero or more non‐null characters fol‐ lowed by a null byte.

character sequence
is a sequence of zero or more non‐null characters. A
program should never use a character sequence where a string is required. However, with appropriate care, a string can be used in the place of a character sequence.

null‐padded character sequence (zustr)
Character sequences can be contained in fixed‐ width buffers, which contain padding null bytes after the character sequence, to fill the rest of the buffer without affecting the character se‐ quence; however, those padding null bytes are not part of the character sequence. zustr stands for
Zero‐padded Unterminated STRing. Don’t confuse
zero‐padded with null‐terminated: zero‐padded
means 0 or more padding zeros (null characters), while null‐terminated means exactly 1 terminating null character.

measured character sequence (ustr)
Character sequence delimited by its length. It may be a slice of a larger character sequence, or even of a string. ustr stands for Unterminated STRing.

The patch is:

man7/string_copying.7 +7 -0
index e03c2dda6..c5f374025 100644
@@ -102,12 +102,19 @@ .SS Terms (and abbreviations)
 to fill the rest of the buffer
 without affecting the character sequence;
 however, those padding null bytes are not part of the character sequence.
+.I zustr
+stands for Zero-padded Unterminated STRing.
+Don't confuse zero-padded with null-terminated:
+zero-padded means 0 or more padding zeros (null characters),
+while null-terminated means exactly 1 terminating null character.
 .\" ----- DESCRIPTION :: Terms (and abbreviations) :: measured character sequence
 .TP
 .IR "measured character sequence " ( ustr )
 Character sequence delimited by its length.
 It may be a slice of a larger character sequence,
 or even of a string.
+.I ustr
+stands for Unterminated STRing.
 .RE
 .\" ----- DESCRIPTION :: Terms (and abbreviations) :: length (len) ----/
 .TP

Thanks,
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
#1 lore raw
Quoted 3 lines · Alejandro Colomar

Hi Serge,

I'm clarifying zustr after your suggestion. Please check this text.

Thanks, this looks good.

Quoted 64 lines

DESCRIPTION
Terms (and abbreviations)
string (str)
is a sequence of zero or more non‐null characters fol‐ lowed by a null byte.

character sequence
is a sequence of zero or more non‐null characters. A
program should never use a character sequence where a string is required. However, with appropriate care, a string can be used in the place of a character sequence.

null‐padded character sequence (zustr)
Character sequences can be contained in fixed‐ width buffers, which contain padding null bytes after the character sequence, to fill the rest of the buffer without affecting the character se‐ quence; however, those padding null bytes are not part of the character sequence. zustr stands for
Zero‐padded Unterminated STRing. Don’t confuse
zero‐padded with null‐terminated: zero‐padded
means 0 or more padding zeros (null characters), while null‐terminated means exactly 1 terminating null character.

measured character sequence (ustr)
Character sequence delimited by its length. It may be a slice of a larger character sequence, or even of a string. ustr stands for Unterminated STRing.

The patch is:

man7/string_copying.7 +7 -0
index e03c2dda6..c5f374025 100644
@@ -102,12 +102,19 @@ .SS Terms (and abbreviations)
 to fill the rest of the buffer
 without affecting the character sequence;
 however, those padding null bytes are not part of the character sequence.
+.I zustr
+stands for Zero-padded Unterminated STRing.
+Don't confuse zero-padded with null-terminated:
+zero-padded means 0 or more padding zeros (null characters),
+while null-terminated means exactly 1 terminating null character.
 .\" ----- DESCRIPTION :: Terms (and abbreviations) :: measured character sequence
 .TP
 .IR "measured character sequence " ( ustr )
 Character sequence delimited by its length.
 It may be a slice of a larger character sequence,
 or even of a string.
+.I ustr
+stands for Unterminated STRing.
 .RE
 .\" ----- DESCRIPTION :: Terms (and abbreviations) :: length (len) ----/
 .TP

Thanks,
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>