On 4/12/21 9:44 AM, Zhiheng Li wrote:
---
man3/setbuf.3 | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/man3/setbuf.3 b/man3/setbuf.3
index 5e5d57f89..e6d41b2a9 100644
--- a/man3/setbuf.3
+++ b/man3/setbuf.3
@@ -224,14 +224,15 @@ For example, the following is invalid:
.PP
.EX
#include <stdio.h>
+#include <unistd.h>
int
main(void)
{
char buf[BUFSIZ];
- setbuf(stdin, buf);
+ setbuf(stdout, buf);
printf("Hello, world!\en");
- return 0;
+ _exit(0);
}
.EE
.SH SEE ALSO
Hello Zhiheng Li,
I never used setbuf(3), so I don't know much about this example and why
it is "invalid", and therefore also don't know why it is wrong in being
invalid.
As far as I can see, 'stdin' just seems to be a typo because it's not
being used, and probably 'stdout' was meant instead, as you point out.
What about _exit(0)? Why _exit(2) and not return (or equivalently
exit(3))? Could you explain that a bit more?
BTW, Could you please use a mailer that allows you to write plain text
emails? Mozilla Thunderbird may be easy to use for you, and it comes
with most Linux distros.
Thanks,
Alex
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/