ValeryC
ValeryC

Reputation: 486

Cannot find puts() in glibc source code

I'm very new to Linux/C.

In the glibc(eglibs-2.15) sources on my Linux I can only find puts() declaration in /libio/stdio.h

extern int puts (__const char *__s);

but cannot find sources for puts() anywhere in glibc sources. My guess is that puts() is system dependent and its sources are somewhere else. Question: where can I find puts() sources?

Also, it looks like on some systems sources for puts() are available, for instance on Apple (http://www.opensource.apple.com/source/Libc/Libc-186/stdio.subproj/puts.c) or NetBSD (https://www-asim.lip6.fr/trac/netbsdtsar/browser/vendor/netbsd/5-20091104/src/lib/libc/stdio/puts.c?rev=160).

Why is it so?

Upvotes: 5

Views: 2413

Answers (1)

nos
nos

Reputation: 229158

In glibc, puts is aliased to the _IO_puts function, defined in ./libio/ioputs.c

Upvotes: 7

Related Questions