From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: Stephen Kitt <steve@sk2.org>
Cc: linux-man@vger.kernel.org, Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: [PATCH 8/9] strtok.3: Enable example analysis, fix declaration
Date: Sat, 8 Jan 2022 03:04:18 +0100 [thread overview]
Message-ID: <e980398d-0a21-45e4-73c5-6727e4f552a2@gmail.com> (raw)
In-Reply-To: <20220107164621.275794-8-steve@sk2.org>
Hi Stephen,
On 1/7/22 17:46, Stephen Kitt wrote:
> for (int j = 1, str1 = argv[1]; ...
>
> declares two variables of type int, j and str1; the pre-existing
> char * str1 isn't used. This causes compiler warnings. Declaring j
> outside the loop fixes everything.
>
> To enable automated source extraction, separate the text following the
> code.
>
> Signed-off-by: Stephen Kitt <steve@sk2.org>
Since these are two completely unrelated things, I'd prefer 2 patches.
If you resend this one without the subsection heading, I'll apply it.
Thanks,
Alex
> ---
> man3/strtok.3 | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/man3/strtok.3 b/man3/strtok.3
> index aec914094..19d5d9204 100644
> --- a/man3/strtok.3
> +++ b/man3/strtok.3
> @@ -255,6 +255,7 @@ main(int argc, char *argv[])
> {
> char *str1, *str2, *token, *subtoken;
> char *saveptr1, *saveptr2;
> + int j;
>
> if (argc != 4) {
> fprintf(stderr, "Usage: %s string delim subdelim\en",
> @@ -262,7 +263,7 @@ main(int argc, char *argv[])
> exit(EXIT_FAILURE);
> }
>
> - for (int j = 1, str1 = argv[1]; ; j++, str1 = NULL) {
> + for (j = 1, str1 = argv[1]; ; j++, str1 = NULL) {
> token = strtok_r(str1, argv[2], &saveptr1);
> if (token == NULL)
> break;
> @@ -280,6 +281,7 @@ main(int argc, char *argv[])
> }
> .EE
> .PP
> +.SS Further examples
> Another example program using
> .BR strtok ()
> can be found in
--
Alejandro Colomar
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
next prev parent reply other threads:[~2022-01-08 2:04 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 16:46 [PATCH 1/9] Add a target to check example programs Stephen Kitt
2022-01-07 16:46 ` [PATCH 2/9] seccomp.2: Use syscall() in the example code Stephen Kitt
2022-01-08 1:18 ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 3/9] inet.3: Switch to _DEFAULT_SOURCE in the example Stephen Kitt
2022-01-08 1:26 ` Alejandro Colomar (man-pages)
2022-01-08 9:06 ` Stephen Kitt
2022-01-07 16:46 ` [PATCH 4/9] matherr.3: Exclude the example from analysis Stephen Kitt
2022-01-08 1:31 ` Alejandro Colomar (man-pages)
2022-01-08 9:12 ` Stephen Kitt
2022-01-07 16:46 ` [PATCH 5/9] mq_notify.3: Add signal.h for SIGEV_THREAD Stephen Kitt
2022-01-08 1:38 ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 6/9] newlocale.3: Use LC_GLOBAL_LOCALE, not ..._HANDLE Stephen Kitt
2022-01-08 1:41 ` Alejandro Colomar (man-pages)
2022-01-08 9:13 ` Jakub Wilk
2022-01-08 17:58 ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 7/9] pkeys.7: Update the example to match glibc Stephen Kitt
2022-01-08 1:59 ` Alejandro Colomar (man-pages)
2022-01-08 14:18 ` Stephen Kitt
2022-01-08 19:20 ` Alejandro Colomar (man-pages)
2022-01-07 16:46 ` [PATCH 8/9] strtok.3: Enable example analysis, fix declaration Stephen Kitt
2022-01-08 2:04 ` Alejandro Colomar (man-pages) [this message]
2022-01-07 16:46 ` [PATCH 9/9] malloc_info.3: Use intptr_t to store pointers Stephen Kitt
2022-01-08 2:25 ` Alejandro Colomar (man-pages)
2022-01-08 10:30 ` Jakub Wilk
2022-01-08 17:09 ` Stephen Kitt
2022-01-08 19:17 ` Alejandro Colomar (man-pages)
2022-01-08 1:15 ` [PATCH 1/9] Add a target to check example programs Alejandro Colomar (man-pages)
2022-01-08 9:22 ` Stephen Kitt
2022-01-08 19:05 ` Alejandro Colomar (man-pages)
2022-01-08 19:38 ` Alejandro Colomar (man-pages)
2022-01-08 2:02 ` Alejandro Colomar (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e980398d-0a21-45e4-73c5-6727e4f552a2@gmail.com \
--to=alx.manpages@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=steve@sk2.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox