Skip to contentSkip to conversation

string_copying.7: tfix

PATCH Superseded Lennart Jablonka 3 participants 7 messages Jul 28, 2023 – Jul 29, 2023 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 string_copying.7: tfix

---
On some of the commas: There are a few of instances of

Subject verb object partclause, advphrase.

For example:

This function catenates the input character sequence contained in a null-padded wixed-width buffer, into a destination string.
| subject | verb | object | participial clause | adverbial phrase |

Dropping the relative clause, there shouldn't be a comma preceding the restrictive adverbial phrase: The input character sequence is really, always catenated into a destination string; that is essential.

The participial clause, being non-restrictive---there is but one input character sequence that could be meant---, should be enclosed by commas. That is the existing comma's purpose and doesn't work without the added, first comma.

 man7/string_copying.7 | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
man7/string_copying.7 +13 -13
index da1fc6752..04426ef77 100644
@@ -49,7 +49,7 @@ const char *restrict " src ,
 .PP
 // Zero a fixed-width buffer, and
 // copy a string into a character sequence with truncation.
-.BI "char *strncpy(char " dest "[restrict ." sz "], \
+.BI "char *strncpy(char " dst "[restrict ." sz "], \
 const char *restrict " src ,
 .BI "               size_t " sz );
 .PP
@@ -280,9 +280,9 @@ instead of
 In programs that make considerable use of strings or character sequences,
 and need the best performance,
 using overlapping character sequences can make a big difference.
-It allows holding subsequences of a larger character sequence.
+It allows holding sub-sequences of a larger character sequence,
 while not duplicating memory
-nor using time to do a copy.
+or using time to do a copy.
 .PP
 However, this is delicate,
 since it requires using character sequences.
@@ -397,7 +397,7 @@ It returns a pointer suitable for chaining.
 Truncation needs to be detected only once after the last chained call.
 .IP
 This function is not provided by any library;
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.
 .\" ----- DESCRIPTION :: Functions :: strlcpy(3bsd), strlcat(3bsd) ----/
 .TP
 .BR strlcpy (3bsd)
@@ -427,7 +427,7 @@ isn't large enough to hold the copy,
 the resulting character sequence is truncated.
 Since it creates a character sequence,
 it doesn't need to write a terminating null byte.
-It's impossible to distinguish truncation by the result of the call,
+It's impossible to distinguish truncation by the result of the call
 from a character sequence that just fits the destination buffer;
 truncation should be detected by
 comparing the length of the input string
@@ -444,8 +444,8 @@ is a more useful alternative to this function.
 .\" ----- DESCRIPTION :: Functions :: zustr2ustp(3) --------------------/
 .TP
 .BR zustr2ustp (3)
-This function copies the input character sequence
-contained in a null-padded wixed-width buffer,
+This function copies the input character sequence,
+contained in a null-padded fixed-width buffer,
 into a destination character sequence.
 The programmer is responsible for allocating a buffer large enough.
 It returns a pointer suitable for chaining.
@@ -455,12 +455,12 @@ since the size of the original character sequence is always known,
 so it wouldn't be very useful.
 .IP
 This function is not provided by any library;
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.
 .\" ----- DESCRIPTION :: Functions :: zustr2stp(3) --------------------/
 .TP
 .BR zustr2stp (3)
-This function copies the input character sequence
-contained in a null-padded wixed-width buffer,
+This function copies the input character sequence,
+contained in a null-padded fixed-width buffer,
 into a destination string.
 The programmer is responsible for allocating a buffer large enough.
 It returns a pointer suitable for chaining.
@@ -470,7 +470,7 @@ since the size of the original character sequence is always known,
 so it wouldn't be very useful.
 .IP
 This function is not provided by any library;
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.
 .\" ----- DESCRIPTION :: Functions :: strncat(3) ----------------------/
 .TP
 .BR strncat (3)
@@ -478,8 +478,8 @@ Do not confuse this function with
 .BR strncpy (3);
 they are not related at all.
 .IP
-This function catenates the input character sequence
-contained in a null-padded wixed-width buffer,
+This function catenates the input character sequence,
+contained in a null-padded fixed-width buffer,
 into a destination string.
 The programmer is responsible for allocating a buffer large enough.
 The return value is useless.
Signature · 1 line
2.41.0
#1 lore raw

Hi Lennart,

(CC += Branden)

Quoted 28 lines · Lennart Jablonka

---
On some of the commas: There are a few of instances of

Subject verb object partclause, advphrase.

For example:

This function catenates the input character sequence contained in a null-padded wixed-width buffer, into a destination string.
| subject | verb | object | participial clause | adverbial phrase |

Dropping the relative clause, there shouldn't be a comma preceding the restrictive adverbial phrase: The input character sequence is really, always catenated into a destination string; that is essential.

The participial clause, being non-restrictive---there is but one input character sequence that could be meant---, should be enclosed by commas. That is the existing comma's purpose and doesn't work without the added, first comma.

 man7/string_copying.7 | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
man7/string_copying.7 +0 -0
index da1fc6752..04426ef77 100644

man7/string_copying.7 const char *restrict " src , · line 52

Quoted 5 lines
man7/string_copying.7 +1 -1
@@ -49,7 +49,7 @@ const char *restrict " src ,
 .PP
 // Zero a fixed-width buffer, and
 // copy a string into a character sequence with truncation.
-.BI "char *strncpy(char " dest "[restrict ." sz "], \
+.BI "char *strncpy(char " dst "[restrict ." sz "], \

Ok

man7/string_copying.7 instead of · line 283

Quoted 9 lines
man7/string_copying.7 +1 -1
 const char *restrict " src ,
 .BI "               size_t " sz );
 .PP
@@ -280,9 +280,9 @@ instead of
 In programs that make considerable use of strings or character sequences,
 and need the best performance,
 using overlapping character sequences can make a big difference.
-It allows holding subsequences of a larger character sequence.
+It allows holding sub-sequences of a larger character sequence,

In this case, man-pages(7) advises to not hyphenate:

Hyphenation with multi, non, pre, re, sub, and so on
The general tendency in modern English is not to hyphenate af‐ ter prefixes such as "multi", "non", "pre", "re", "sub", and so
on. Manual pages should generally follow this rule when these
prefixes are used in natural English constructions with simple
suffixes. The following list gives some examples of the pre‐
ferred forms:

[...]
subcomponent
subdirectory
subsystem

man7/string_copying.7 instead of · line 285

Quoted 3 lines
man7/string_copying.7 +1 -1
 while not duplicating memory
-nor using time to do a copy.
+or using time to do a copy.

Is nor incorrect here? I'm not a native English speaker and would like to understand why it is incorrect.

man7/string_copying.7 It returns a pointer suitable for chaining. · line 400

Quoted 9 lines
man7/string_copying.7 +1 -1
 .PP
 However, this is delicate,
 since it requires using character sequences.
@@ -397,7 +397,7 @@ It returns a pointer suitable for chaining.
 Truncation needs to be detected only once after the last chained call.
 .IP
 This function is not provided by any library;
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.

Ok

man7/string_copying.7 isn't large enough to hold the copy, · line 431

Quoted 10 lines
man7/string_copying.7 +1 -1
 .\" ----- DESCRIPTION :: Functions :: strlcpy(3bsd), strlcat(3bsd) ----/
 .TP
 .BR strlcpy (3bsd)
@@ -427,7 +427,7 @@ isn't large enough to hold the copy,
 the resulting character sequence is truncated.
 Since it creates a character sequence,
 it doesn't need to write a terminating null byte.
-It's impossible to distinguish truncation by the result of the call,
+It's impossible to distinguish truncation by the result of the call
 from a character sequence that just fits the destination buffer;

I guess it's ok (to me they both sound good)

man7/string_copying.7 is a more useful alternative to this function. · line 447

Quoted 9 lines
man7/string_copying.7 +1 -2
 truncation should be detected by
 comparing the length of the input string
@@ -444,8 +444,8 @@ is a more useful alternative to this function.
 .\" ----- DESCRIPTION :: Functions :: zustr2ustp(3) --------------------/
 .TP
 .BR zustr2ustp (3)
-This function copies the input character sequence
-contained in a null-padded wixed-width buffer,
+This function copies the input character sequence,

I believe the below is like a parenthetical, which is why I put it between commas; isn't it? Although your version also looks good.

man7/string_copying.7 is a more useful alternative to this function. · line 448

Quoted 1 line
man7/string_copying.7 +1 -0
+contained in a null-padded fixed-width buffer,

Ok

man7/string_copying.7 since the size of the original character sequence is always known, · line 458

Quoted 9 lines
man7/string_copying.7 +1 -1
 into a destination character sequence.
 The programmer is responsible for allocating a buffer large enough.
 It returns a pointer suitable for chaining.
@@ -455,12 +455,12 @@ since the size of the original character sequence is always known,
 so it wouldn't be very useful.
 .IP
 This function is not provided by any library;
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.

Ok

man7/string_copying.7 since the size of the original character sequence is always known, · line 462

Quoted 6 lines
man7/string_copying.7 +1 -2
 .\" ----- DESCRIPTION :: Functions :: zustr2stp(3) --------------------/
 .TP
 .BR zustr2stp (3)
-This function copies the input character sequence
-contained in a null-padded wixed-width buffer,
+This function copies the input character sequence,

Same.

man7/string_copying.7 since the size of the original character sequence is always known, · line 463

Quoted 1 line
man7/string_copying.7 +1 -0
+contained in a null-padded fixed-width buffer,

Heh, my text is wixed!

man7/string_copying.7 since the size of the original character sequence is always known, · line 473

Quoted 9 lines
man7/string_copying.7 +1 -1
 into a destination string.
 The programmer is responsible for allocating a buffer large enough.
 It returns a pointer suitable for chaining.
@@ -470,7 +470,7 @@ since the size of the original character sequence is always known,
 so it wouldn't be very useful.
 .IP
 This function is not provided by any library;
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.

Ok

man7/string_copying.7 Do not confuse this function with · line 482

Quoted 11 lines
man7/string_copying.7 +2 -2
 .\" ----- DESCRIPTION :: Functions :: strncat(3) ----------------------/
 .TP
 .BR strncat (3)
@@ -478,8 +478,8 @@ Do not confuse this function with
 .BR strncpy (3);
 they are not related at all.
 .IP
-This function catenates the input character sequence
-contained in a null-padded wixed-width buffer,
+This function catenates the input character sequence,
+contained in a null-padded fixed-width buffer,

And same.

Thanks,
Alex

Quoted 3 lines
man7/string_copying.7 +0 -0
 into a destination string.
 The programmer is responsible for allocating a buffer large enough.
 The return value is useless.
Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
#2 lore raw
Quoted 4 lines
Quoted 4 lines
man7/string_copying.7 +0 -0
index da1fc6752..04426ef77 100644
Quoted 8 lines

man7/string_copying.7 instead of · line 283

Quoted 6 lines
man7/string_copying.7 +1 -1
@@ -280,9 +280,9 @@ instead of
 In programs that make considerable use of strings or character sequences,
 and need the best performance,
 using overlapping character sequences can make a big difference.
-It allows holding subsequences of a larger character sequence.
+It allows holding sub-sequences of a larger character sequence,

In this case, man-pages(7) advises to not hyphenate:

I see. I stumbled a little, “subsequences” being similar to “subsequent.” I don’t have a strong opinion.

Quoted 5 lines

man7/string_copying.7 instead of · line 285

Quoted 3 lines
man7/string_copying.7 +1 -1
 while not duplicating memory
-nor using time to do a copy.
+or using time to do a copy.

Is nor incorrect here?

It’s not exactly incorrect here. Such a usage is common; who am I to say that it’s wrong? It’s not useful to use it here, either. The most common use of nor is a neither-nor construction: The weather is neither good nor bad. Not good and not bad. Not either good or bad. Admire the construction’s elegance: two little conjunctions, forming a pair (though a pair it need not be) to give you the anticipated meaning, clear in every word along the way. Though that construction isn’t what’s used here.

Here, compare

while (not ((duplicating memory) or (using time to do a copy)))

to

while not duplicating memory nor using time to do a copy

which you might imagine as expanding to

while not duplicating memory and not using time to do a copy

with imagined precedence as

while ((not (duplicating memory)) and (not (using time to do a copy)))

where, thus, the word “nor” seems to be split in half. It works. It’s correct. And yet it instills in me a strange feeling of unorderedness.

Your mileage may vary.

Quoted 1 line

I'm not a native English speaker

Neither am I.

Quoted 13 lines

and would like to understand why it is incorrect.

man7/string_copying.7 is a more useful alternative to this function. · line 447

Quoted 7 lines
man7/string_copying.7 +1 -2
@@ -444,8 +444,8 @@ is a more useful alternative to this function.
 .\" ----- DESCRIPTION :: Functions :: zustr2ustp(3) --------------------/
 .TP
 .BR zustr2ustp (3)
-This function copies the input character sequence
-contained in a null-padded wixed-width buffer,
+This function copies the input character sequence,

I believe the below is like a parenthetical, which is why I put it between commas; isn't it? Although your version also looks good.

Quoted 5 lines

man7/string_copying.7 is a more useful alternative to this function. · line 448

Quoted 1 line
man7/string_copying.7 +1 -0
+contained in a null-padded fixed-width buffer,

Ok

Quoted 1 line
man7/string_copying.7 +0 -0
 into a destination character sequence.

The “contained in a null-padded fixed-width buffer” indeed looks like a parenthetical (or rather, a non-restrictive participial clause—the “contained” is the participle), which is why it should be between commas. You didn’t do quite that: You put a comma after it, but not before.

This case is what I tried to explain: You set off the “into a destination character sequence” prepositional phrase (the “into” being the preposition) by a comma. You did not surround the participial clause by commas. That’s what I did.

#4 lore raw
In reply to Alejandro Colomar

Hi Alex,

Quoted 1 line · Alejandro Colomar

(CC += Branden)

I think I just received my grammar prescriptivist's draft notice... ;-)

Quoted 7 lines · Lennart Jablonka

man7/string_copying.7 instead of · line 285

Quoted 3 lines

while not duplicating memory

man7/string_copying.7 +1 -1
-nor using time to do a copy.
+or using time to do a copy.

Is nor incorrect here? I'm not a native English speaker and would like to understand why it is incorrect.

With the humbling caveat that you find me more persuasive than some online grammar authorities, the foregoing suggestion is in my view a hypercorrection. The (coordinating) conjunction "nor" is not restricted to sentences using "neither".

https://newsroom.unl.edu/announce/snr/3511/19686
https://study.com/learn/lesson/neither-nor-usage-examples-sentences.html
https://www.grammarbook.com/blog/effective-writing/using-nor-properly/

In the last, attend particularly to section "Using Nor Properly:
Interchanging with Or".

I'm a +0 on this hunk of the patch. It's correct either way.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.

Ok

Strong +1 here. It is volcanically nonstandard to apply sentence capitalization to an independent clause after a semicolon.

Quoted 4 lines
Quoted 4 lines

.\" ----- DESCRIPTION :: Functions :: strlcpy(3bsd), strlcat(3bsd) ----/ .TP
.BR strlcpy (3bsd)

(quoted diff) +0 -0
@@ -427,7 +427,7 @@ isn't large enough to hold the copy,
Quoted 8 lines

man7/string_copying.7 isn't large enough to hold the copy, · line 431

Quoted 6 lines
man7/string_copying.7 +1 -1
 the resulting character sequence is truncated.
 Since it creates a character sequence,
 it doesn't need to write a terminating null byte.
-It's impossible to distinguish truncation by the result of the call,
+It's impossible to distinguish truncation by the result of the call
 from a character sequence that just fits the destination buffer;

I guess it's ok (to me they both sound good)

I think the comma arose there due to good instincts: you have a long chain of prepositional (and participial) phrases that do _not_ grow strictly narrower in scope as they proceed.

Consider:

"Due to the dense foliage, it's impossible to distinguish the man in the tree growing from the loamy soil laid down in the Cenozoic Era that I remember learning about in geology class."

This (admittedly goofy) sentence is not difficult to interpret: each phrase (after the first, "Due to", which serves as a topicalizer) modifies only the preceding one.

By contrast, the sentence in this man page is structurally complex and therefore challenging to parse.

"It's impossible to distinguish
(truncation (by the result (of the call))
from (a character sequence (that just fits
([inside] the destination
buffer))).

That's pretty tough sledding. Only semantic knowledge permits the experienced programmer to make sense of it.

The use of the comma prompts the reader that an ambiguous parse is possible, and that they should pause, as they would in speaking, to permit the modifying phrases just uttered to bind to the preceding language. Or, alternatively, the comma (or pause) is a warning that the phrase stack is being popped, cueing the reader or listener to attempt multiple parses in search of one that seems suitable.

That this exhibit took so much meta-analysis to explain is what motivates my advice: it would be better to recast the sentence until clarity is achieved.

Quoted 7 lines

man7/string_copying.7 is a more useful alternative to this function. · line 447

Quoted 3 lines
man7/string_copying.7 +1 -2
-This function copies the input character sequence
-contained in a null-padded wixed-width buffer,
+This function copies the input character sequence,

I believe the below is like a parenthetical, which is why I put it between commas; isn't it? Although your version also looks good.

Quoted 5 lines

Review isn't large enough to hold the copy, · line 433

Quoted 1 line
(quoted diff) +1 -0
+contained in a null-padded fixed-width buffer,

Ok

Quoted 1 line

into a destination character sequence.

I'm a +0 on this one, too. To me, it reads equivalently either way.

[duplicates of the foregoing cases snipped]

Regards,
Branden

#3 lore raw
In reply to Lennart Jablonka

On 2023-07-29 01:26, Lennart Jablonka wrote:

[...]

Quoted 23 lines
Quoted 11 lines

man7/string_copying.7 is a more useful alternative to this function. · line 447

Quoted 7 lines
man7/string_copying.7 +1 -2
@@ -444,8 +444,8 @@ is a more useful alternative to this function.
 .\" ----- DESCRIPTION :: Functions :: zustr2ustp(3) --------------------/
 .TP
 .BR zustr2ustp (3)
-This function copies the input character sequence
-contained in a null-padded wixed-width buffer,
+This function copies the input character sequence,

I believe the below is like a parenthetical, which is why I put it between commas; isn't it? Although your version also looks good.

Quoted 5 lines

Review is a more useful alternative to this function. · line 448

Quoted 1 line
(quoted diff) +1 -0
+contained in a null-padded fixed-width buffer,

Ok

Quoted 1 line
man7/string_copying.7 +0 -0
 into a destination character sequence.

The “contained in a null-padded fixed-width buffer” indeed looks like a parenthetical (or rather, a non-restrictive participial clause—the “contained” is the participle), which is why it should be between commas. You didn’t do quite that: You put a comma after it, but not before.

Quoted 4 lines

This case is what I tried to explain: You set off the “into a destination character sequence” prepositional phrase (the “into” being the preposition) by a comma. You did not surround the participial clause by commas. That’s what I did.

D'oh! I misread the diff; I thought you were removing the comma instead of adding it. I certainly like your addition.

Cheers,
Alex

Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
#5 lore raw
In reply to G. Branden Robinson

Hi Branden,

Quoted 15 lines · G. Branden Robinson

Hi Alex,

Quoted 1 line · Alejandro Colomar

(CC += Branden)

I think I just received my grammar prescriptivist's draft notice... ;-)

Quoted 7 lines · Lennart Jablonka

man7/string_copying.7 instead of · line 285

Quoted 3 lines

while not duplicating memory

man7/string_copying.7 +1 -1
-nor using time to do a copy.
+or using time to do a copy.

Is nor incorrect here? I'm not a native English speaker and would like to understand why it is incorrect.

Quoted 2 lines

With the humbling caveat that you find me more persuasive than some online grammar authorities,

;-)

Quoted 4 lines

the foregoing suggestion is in my view a
hypercorrection. The (coordinating) conjunction "nor" is not restricted to sentences using "neither".

Quoted 8 lines

https://newsroom.unl.edu/announce/snr/3511/19686
https://study.com/learn/lesson/neither-nor-usage-examples-sentences.html
https://www.grammarbook.com/blog/effective-writing/using-nor-properly/

In the last, attend particularly to section "Using Nor Properly:
Interchanging with Or".

I'm a +0 on this hunk of the patch. It's correct either way.

I prefer nor in this case. It sounds better to me.

Quoted 8 lines
Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +1 -1
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.

Ok

Strong +1 here. It is volcanically nonstandard to apply sentence capitalization to an independent clause after a semicolon.

Yep; I don't know why I wrote it like that. Maybe I had initially written a period; I'll never know.

Quoted 47 lines
Quoted 13 lines

man7/string_copying.7 isn't large enough to hold the copy, · line 431

Quoted 11 lines

.\" ----- DESCRIPTION :: Functions :: strlcpy(3bsd), strlcat(3bsd) ----/ .TP
.BR strlcpy (3bsd)

man7/string_copying.7 +1 -1
@@ -427,7 +427,7 @@ isn't large enough to hold the copy,
 the resulting character sequence is truncated.
 Since it creates a character sequence,
 it doesn't need to write a terminating null byte.
-It's impossible to distinguish truncation by the result of the call,
+It's impossible to distinguish truncation by the result of the call
 from a character sequence that just fits the destination buffer;

I guess it's ok (to me they both sound good)

I think the comma arose there due to good instincts: you have a long chain of prepositional (and participial) phrases that do _not_ grow strictly narrower in scope as they proceed.

Consider:

"Due to the dense foliage, it's impossible to distinguish the man in the tree growing from the loamy soil laid down in the Cenozoic Era that I remember learning about in geology class."

This (admittedly goofy) sentence is not difficult to interpret: each phrase (after the first, "Due to", which serves as a topicalizer) modifies only the preceding one.

By contrast, the sentence in this man page is structurally complex and therefore challenging to parse.

"It's impossible to distinguish
(truncation (by the result (of the call))
from (a character sequence (that just fits
([inside] the destination
buffer))).

That's pretty tough sledding. Only semantic knowledge permits the experienced programmer to make sense of it.

The use of the comma prompts the reader that an ambiguous parse is possible, and that they should pause, as they would in speaking, to permit the modifying phrases just uttered to bind to the preceding language. Or, alternatively, the comma (or pause) is a warning that the phrase stack is being popped, cueing the reader or listener to attempt multiple parses in search of one that seems suitable.

Quoted 3 lines

That this exhibit took so much meta-analysis to explain is what motivates my advice: it would be better to recast the sentence until clarity is achieved.

Yep, I also like that comma to simplify parsing.

Quoted 8 lines
Quoted 8 lines

man7/string_copying.7 is a more useful alternative to this function. · line 447

Quoted 4 lines
man7/string_copying.7 +1 -2
-This function copies the input character sequence
-contained in a null-padded wixed-width buffer,
+This function copies the input character sequence,

I believe the below is like a parenthetical, which is why I put it between commas; isn't it? Although your version also looks good.

Quoted 7 lines
Quoted 5 lines

Review isn't large enough to hold the copy, · line 433

Quoted 1 line
(quoted diff) +1 -0
+contained in a null-padded fixed-width buffer,

Ok

Quoted 1 line

into a destination character sequence.

I'm a +0 on this one, too. To me, it reads equivalently either way.

In this case I prefer the proposed hunk. In fact, I doubted because I misread the hunk as doing the inverse of what it really does.

Thanks for your prescriptions!

Cheers,
Alex

Quoted 5 lines

[duplicates of the foregoing cases snipped]

Regards,
Branden

Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
#6 lore raw
In reply to Lennart Jablonka

Hi Lennart,

Quoted 1 line · Lennart Jablonka

Please send v2 with

Cc "G. Branden Robinson" <[email protected]>

I'll comment below on what should be removed from the patch in v2. Reword the commit message as you find appropriate for the revision.

Quoted 10 lines

---
On some of the commas: There are a few of instances of

Subject verb object partclause, advphrase.

For example:

This function catenates the input character sequence contained in a null-padded wixed-width buffer, into a destination string.
| subject | verb | object | participial clause | adverbial phrase |

Quoted 8 lines

Dropping the relative clause, there shouldn't be a comma preceding the restrictive adverbial phrase: The input character sequence is really, always catenated into a destination string; that is essential.

The participial clause, being non-restrictive---there is but one input character sequence that could be meant---, should be enclosed by commas. That is the existing comma's purpose and doesn't work without the added, first comma.

Please include these things in the commit message. The same it can be useful for me to review now, it can be useful for anyone revisiting the patch in the future.

Quoted 9 lines
 man7/string_copying.7 | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
man7/string_copying.7 +0 -0
index da1fc6752..04426ef77 100644

man7/string_copying.7 const char *restrict " src , · line 52

Quoted 5 lines
man7/string_copying.7 +1 -1
@@ -49,7 +49,7 @@ const char *restrict " src ,
 .PP
 // Zero a fixed-width buffer, and
 // copy a string into a character sequence with truncation.
-.BI "char *strncpy(char " dest "[restrict ." sz "], \
+.BI "char *strncpy(char " dst "[restrict ." sz "], \

ok

man7/string_copying.7 instead of · line 283

Quoted 9 lines
man7/string_copying.7 +1 -1
 const char *restrict " src ,
 .BI "               size_t " sz );
 .PP
@@ -280,9 +280,9 @@ instead of
 In programs that make considerable use of strings or character sequences,
 and need the best performance,
 using overlapping character sequences can make a big difference.
-It allows holding subsequences of a larger character sequence.
+It allows holding sub-sequences of a larger character sequence,

Use subsequences (but the s/./,/ is good).

man7/string_copying.7 instead of · line 285

Quoted 3 lines
man7/string_copying.7 +1 -1
 while not duplicating memory
-nor using time to do a copy.
+or using time to do a copy.

revert

man7/string_copying.7 It returns a pointer suitable for chaining. · line 400

Quoted 9 lines
man7/string_copying.7 +1 -1
 .PP
 However, this is delicate,
 since it requires using character sequences.
@@ -397,7 +397,7 @@ It returns a pointer suitable for chaining.
 Truncation needs to be detected only once after the last chained call.
 .IP
 This function is not provided by any library;
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.

ok

man7/string_copying.7 isn't large enough to hold the copy, · line 430

Quoted 9 lines
man7/string_copying.7 +1 -1
 .\" ----- DESCRIPTION :: Functions :: strlcpy(3bsd), strlcat(3bsd) ----/
 .TP
 .BR strlcpy (3bsd)
@@ -427,7 +427,7 @@ isn't large enough to hold the copy,
 the resulting character sequence is truncated.
 Since it creates a character sequence,
 it doesn't need to write a terminating null byte.
-It's impossible to distinguish truncation by the result of the call,
+It's impossible to distinguish truncation by the result of the call

revert

man7/string_copying.7 is a more useful alternative to this function. · line 447

Quoted 10 lines
man7/string_copying.7 +1 -2
 from a character sequence that just fits the destination buffer;
 truncation should be detected by
 comparing the length of the input string
@@ -444,8 +444,8 @@ is a more useful alternative to this function.
 .\" ----- DESCRIPTION :: Functions :: zustr2ustp(3) --------------------/
 .TP
 .BR zustr2ustp (3)
-This function copies the input character sequence
-contained in a null-padded wixed-width buffer,
+This function copies the input character sequence,

ok

man7/string_copying.7 is a more useful alternative to this function. · line 448

Quoted 1 line
man7/string_copying.7 +1 -0
+contained in a null-padded fixed-width buffer,

ok

man7/string_copying.7 since the size of the original character sequence is always known, · line 458

Quoted 9 lines
man7/string_copying.7 +1 -1
 into a destination character sequence.
 The programmer is responsible for allocating a buffer large enough.
 It returns a pointer suitable for chaining.
@@ -455,12 +455,12 @@ since the size of the original character sequence is always known,
 so it wouldn't be very useful.
 .IP
 This function is not provided by any library;
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.

ok

man7/string_copying.7 since the size of the original character sequence is always known, · line 462

Quoted 6 lines
man7/string_copying.7 +1 -2
 .\" ----- DESCRIPTION :: Functions :: zustr2stp(3) --------------------/
 .TP
 .BR zustr2stp (3)
-This function copies the input character sequence
-contained in a null-padded wixed-width buffer,
+This function copies the input character sequence,

ok

man7/string_copying.7 since the size of the original character sequence is always known, · line 463

Quoted 1 line
man7/string_copying.7 +1 -0
+contained in a null-padded fixed-width buffer,

ok

man7/string_copying.7 since the size of the original character sequence is always known, · line 473

Quoted 9 lines
man7/string_copying.7 +1 -1
 into a destination string.
 The programmer is responsible for allocating a buffer large enough.
 It returns a pointer suitable for chaining.
@@ -470,7 +470,7 @@ since the size of the original character sequence is always known,
 so it wouldn't be very useful.
 .IP
 This function is not provided by any library;
-See EXAMPLES for a reference implementation.
+see EXAMPLES for a reference implementation.

ok

man7/string_copying.7 Do not confuse this function with · line 481

Quoted 10 lines
man7/string_copying.7 +1 -2
 .\" ----- DESCRIPTION :: Functions :: strncat(3) ----------------------/
 .TP
 .BR strncat (3)
@@ -478,8 +478,8 @@ Do not confuse this function with
 .BR strncpy (3);
 they are not related at all.
 .IP
-This function catenates the input character sequence
-contained in a null-padded wixed-width buffer,
+This function catenates the input character sequence,

ok

man7/string_copying.7 Do not confuse this function with · line 482

Quoted 1 line
man7/string_copying.7 +1 -0
+contained in a null-padded fixed-width buffer,

ok

man7/string_copying.7 Do not confuse this function with · line 485

Quoted 3 lines
man7/string_copying.7 +0 -0
 into a destination string.
 The programmer is responsible for allocating a buffer large enough.
 The return value is useless.

Cheers,
Alex

Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5