aboutsummaryrefslogtreecommitdiffstats
path: root/man3/strncat.3
AgeCommit message (Collapse)AuthorFilesLines
2024-05-02man/, share/mk/: Move man*/ to man/Alejandro Colomar1-132/+0
This is a scripted change: $ mkdir man/; $ mv man* man/; $ ln -st . man/man*; $ find share/mk/ -type f \ | xargs grep -l '^MANDIR *:=' \ | xargs sed -i '/^MANDIR *:=/s,$,/man,'; $ find share/mk/dist/ -type f \ | xargs grep -l man \ | xargs sed -i 's,man%,man/%,g'; Link: <https://lore.kernel.org/linux-man/YxcV4h+Xn7cd6+q2@pevik/T/> Cc: Petr Vorel <pvorel@suse.cz> Cc: Jakub Wilk <jwilk@jwilk.net> Cc: Stefan Puiu <stefan.puiu@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-05strncat.3: Clarify that it terminates the stringAlejandro Colomar1-1/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-04strncat.3: Fix return value of possible implementationAlejandro Colomar1-1/+2
Accidentally, I changed the return while changing something else. Fix it. Fixes: 790795ec4e5e ("strncat.3: Write the null byte with stpcpy(3)") Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-04strncat.3: Write the null byte with stpcpy(3)Alejandro Colomar1-5/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-04strncat.3: Implement strncat(3) in terms of strnul()Alejandro Colomar1-1/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: CAVEATS: wfixAlejandro Colomar1-2/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Reword descriptionAlejandro Colomar1-4/+9
While rewording, use "byte" instead of "character". This function is also used with multi-byte characters, so character can be confusing. Suggested-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Say that if dst isn't a string, the behavior is undefinedAlejandro Colomar1-3/+5
Suggested-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: SEE ALSO: tfixAlejandro Colomar1-1/+1
Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: EXAMPLES: Fix name of variableAlejandro Colomar1-4/+3
It was called maxsize, but it was really a number of elements. And it wasn't maximum; it was exact. Reported-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Simplify possible implementation of strncat()Alejandro Colomar1-5/+2
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Rename third parameter to ssizeAlejandro Colomar1-5/+5
This better clarifies that the size is of src. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Fix bug in possible implementation of strncat(3)Alejandro Colomar1-2/+2
Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: SYNOPSIS: ffixAlejandro Colomar1-1/+1
Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Don't say 'width' when 'size' is meantAlejandro Colomar1-2/+2
Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Say append instead of (con)catenateAlejandro Colomar1-2/+2
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-10-31man*/: srcfix (Use .P instead of .PP or .LP)Alejandro Colomar1-4/+4
We're trying to "standardize" on a paragraphing macro from the three equivalent ones (P, PP, LP). We (somewhat arbitrarily) agreed on P. Scripted change: $ find man* -type f | xargs sed -i '/\.PP/s/PP/P/' $ find man* -type f | xargs sed -i '/\.LP/s/LP/P/' Suggested-by: "G. Branden Robinson" <branden@debian.org> Cc: Ingo Schwarze <schwarze@openbsd.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-29strcpy.3, strncat.3, string_copying.7: tfixAlejandro Colomar1-1/+1
Remove non-breaking space (0xC2A0) that accidentally landed in the source of some string pages. Replace by a normal space (0x20). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-13man*/: Remove .sp 1 calls right before SH or PPAlejandro Colomar1-1/+0
Scripted patch: $ grep -rl '^\.sp ' man* | xargs sed -z -i 's/\n\.TE\n\.sp 1\n\.SH/\n.TE\n.SH/' $ grep -rl '^\.sp ' man* | xargs sed -z -i 's/\n\.TE\n\.sp 1\n\.PP/\n.TE\n.PP/' plus a few other cases where roff(7) comments made it more complex. This was a workaround for some groff-1.22.4 bug, but it has been fixed in groff-1.23.0. Link: <https://savannah.gnu.org/bugs/index.php?49390> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-20man*/: ffix (un-bracket tables)G. Branden Robinson1-4/+2
* Stop disabling adjustment and automatic hyphenation before tables, and incorrectly "restoring" it afterward. In addition to repetitious boilerplate around tables, the `ad` and `hy` requests, when not given arguments, do not behave as many man page authors expect. If adjustment was initially disabled when rendering the page, it was being activated after `TE` calls, frustrating the desire of the reader. Furthermore, `hy` when given no argument enables automatic hyphenation in mode "1", which is not an appropriate value for the TeX-based hyphenation patterns for English that groff has used for over 30 years. And analogously to `ad`, a simple `hy` request would reactivate automatic hyphenation even if the reader had disabled it. Moreover, such fiddling is often unnecessary. tbl(1) from groff 1.23.0 describes how tbl(1) has always worked, dating back to Michael Lesk's original implementation at Bell Labs in the 1970s. "Ordinarily, a table entry is typeset rigidly. It is not filled, broken, hyphenated, adjusted, or populated with additional inter- sentence space. ... Text blocks are formatted as was the text prior to the table, modified by applicable column descriptors. ... Add na or ad requests to the beginning of a text block to alter its adjustment distinctly from other text in the document. As with other table entries, when a text block ends, any alterations to formatting parameters are discarded. They do not affect subsequent table entries, not even other text blocks." * Apropos of the foregoing, add `na` and `nh` requests to the "Interface" columns of MT-safety tables in pages' "ATTRIBUTES" sections, so that C function names are not inappropriately hyphenated. I produced this change with the following GNU sed script. :start /^\.ad l/{N;/\n\.nh/{N;/\n\.TS/s/.*/.TS/}} /^\.TE/{N;/\n\.hy/{N;/\n\.ad/s/.*/.TE/}} /^Interface.*Attribute.*Value/{N;/\nT{/s/.*/&\n.na\n.nh/ :loop n /T{/s/.*/&\n.na\n.nh/ /^\.TE/b start; b loop } Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-05-03man*/, man.ignore.grep: srcfix; warn about blank linesAlejandro Colomar1-9/+9
- Use the dummy character to avoid warnings in examples. - Re-enable the warning. Suggested-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-30man*/, man-pages.7: VERSIONS, STANDARDS, HISTORY: Reorganize sectionsAlejandro Colomar1-1/+3
- Add a new HISTORY section that covers the history of an API, both regarding implementations and regarding old standards. This was previously covered in VERSIONS, and in some cases in STANDARDS. - Repurpose VERSIONS to cover differing implementations in _current_ systems. - STANDARDS is reduced to only cover current versions of standards. That basically means only C11 (C99 has been superseeded by C11; C17 is just a bugfix of C11, so not really a new version), and POSIX.1-2008 (*-2001 was superseeded by *-2008; *-2017 was just a bugfix for *-2008). The section also mentions for example 'Linux', 'GNU' or 'BSD' when a non-standard API is Linux- or GNU-only or if it's (de-facto) standard in the BSDs. - In some cases content that should go into one of these sections was in NOTES. Move it from there to where it corresponds. - In the SYNOPSIS, I added [[deprecated]] in some functions that I found are deprecated by the relevant standards. - A few other related changes... Cc: Oskari Pirhonen <xxc3ncoredxx@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-13Revert "Many pages: Remove references to C89"Alejandro Colomar1-1/+1
This reverts commit 72b349dd8c209d7375d4d4f76e2315943d654ee9. This removal caused inconveniences to some programmers. We've agreed to keep the information about C89, since there's an easy way to keep it correct by checking against a plain-text copy of the standard itself: $ stdc89() { grep "[[:alpha:]] \**\b$1([[:alnum:]*,. ]*);" /path/to/c89-draft.txt; } $ stdc89 printf int printf(const char *format, ...); int printf(const char *format, ...); We will also do a split of the information in STANDARDS, since now it's a mix of what a proper STANDARDS section would be plus a HISTORY section commonly-found in other manual pages. C89 will go into HISTORY. Link: <https://lore.kernel.org/linux-man/b73a9636-1a17-36f3-3718-d9ca3b9293ed@gmail.com/T/> Link: <https://port70.net/~nsz/c/c89/c89-draft.txt> Reported-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com> Reported-by: Matt Jolly <Matt.Jolly@footclan.ninja> Cc: Brian Inglis <Brian.Inglis@Shaw.ca> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-05Many pages: Use \[aq] instead of \(aqAlejandro Colomar1-2/+2
This improves readability in the source code, since it delimits where the escape sequence ends. Cc: наб <nabijaczleweli@nabijaczleweli.xyz> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Cc: Brian Inglis <Brian.Inglis@Shaw.ca> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-12-29Many pages: Remove references to C89Alejandro Colomar1-1/+1
C89 is obsolete, and programs should target newer standards. If someone needs information about is, the Standard itself is a better resource. Let's move forward, so readers get the intended notice that C89 is not a useful version of C. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-12-21strncat.3: EXAMPLES: Check the return of malloc(3)Alejandro Colomar1-0/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-12-20strncat.3: Rewrite to be consistent with string_copying.7Alejandro Colomar1-100/+57
Cc: Martin Sebor <msebor@redhat.com> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Cc: Douglas McIlroy <douglas.mcilroy@dartmouth.edu> Cc: Jakub Wilk <jwilk@jwilk.net> Cc: Serge Hallyn <serge@hallyn.com> Cc: Iker Pedrosa <ipedrosa@redhat.com> Cc: Andrew Pinski <pinskia@gmail.com> Cc: Stefan Puiu <stefan.puiu@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-12-06strncat.3: Overrunning the dest buffer is not that badAlejandro Colomar1-117/+28
With the right function call, that is, one that always copies the same amount of bytes, and is so simple that can be inlined, the behavior will be consistent enough to be warned by the compiler in most cases of overrun, and crash quite consistently in the remaining. Prefer simplicity over correctness, so suggest the simpler ustr2stp(). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-12-06string.3, strncat.3: Undeprecate strncat(3)Alejandro Colomar1-22/+184
After some investigation, I found a case where this function is useful: Concatenating an unterminated string into a string. It's not an ideal API for that, but there's no other API that does it. The closest thing, and something that some projects use instead of strncat(3), is calling mempcpy(3) directly. However mempcpy(3) isn't ideal either (it's faster; just that). It even requires a multiline pattern to use correctly, which is a source of bugs. So, suggest using a custom alternative that needs to be defined by the programmer, which handles all the subtle details much better than any of the conventional functions: ustr2stpe(). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-12-06string.3, strncat.3: Fix typo in prototype of strncat(3)Alejandro Colomar1-1/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-12-06strncat.3: tfixAlejandro Colomar1-1/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-12-05strncat.3: BUGS: TruncationAlejandro Colomar1-0/+7
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-12-05strcat.3, strncat.3: RIP strncat(3)Alejandro Colomar1-1/+91
Never use this function. Really. Cc: <pkg-shadow-devel@alioth-lists.debian.net> Cc: <libc-alpha@sourceware.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-09-09Revert "src.mk, All pages: Move man* to man/"Alejandro Colomar1-0/+1
This reverts commit 70ac1c4785fc1e158ab2349a962dba2526bf4fbc. Link: <https://lore.kernel.org/linux-man/YxcV4h+Xn7cd6+q2@pevik/T/> Reported-by: Petr Vorel <pvorel@suse.cz> Reported-by: Jakub Wilk <jwilk@jwilk.net> Cc: Stefan Puiu <stefan.puiu@gmail.com> Signed-off-by: Alex Colomar <alx.manpages@gmail.com>
2022-09-05src.mk, All pages: Move man* to man/Alejandro Colomar1-1/+0
The root of the repository is becoming a bit overpopulated and unorganized, due to the recent addition of more mandirs, and more informative and configuration files too. Let's create a specific mandir <man/> that contains the mandirs <man[1-8]*>. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
2004-11-03Import of man-pages 1.70man-pages-1.70Michael Kerrisk1-0/+1