viewing the source code
how can i view the source code for the general commands of the shell
for example ls, echo, cat etc similarly how can i view the source code for standard c functions for example pow, strcpy, strlen. |
The standard shell commands are mostly in the GNU packages bash and coreutils. The standard C library is a GNU package called GLIBC. You can find source for these on ftp.gnu.org/gnu. Other packages you may be interested in are GNU grep, and procps from procps.sf.net.
|
Oh, one other thing. If you use a distro with package management utilities there is a general answer to your problem. You can use look up which package owns a file, then download its source. For example:
For RPM-based (Fedora, Mandrake, SUSE, ...): rpm -qf /path/to/file For Debian/Ubuntu: dpkg --search /path/to/file |
The commands such as ls and cp are supplied by the coreutils package. Download a source package if you don't have one. The C library is called glibc. You can download the source for that as well. Look at "man <function>" and see which header contains the definition. The source for the function is probably in a directory by the same name, minus the .c.
|
All times are GMT -5. The time now is 08:15 AM. |