LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to implement ls command in c? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-implement-ls-command-in-c-789527/)

nehapawar 02-16-2010 01:39 PM

how to implement ls command in c?
 
is there any function like mkdir() or link() for command ls?
if not, how is ls implemented ?

pixellany 02-16-2010 01:55 PM

You can get the source code for bash--and the various utilities. I would try sourceforge, or maybe the free software foundation.

OR--Google using something like "ls source code linux".

I would have thought that "ls" was part of the BASH built-ins, but it is on my system as /bin/ls

MTK358 02-16-2010 01:58 PM

I doubt that it's built into bash, why couldn't you make a program that lists files independent?

chrism01 02-16-2010 05:55 PM

http://linux.die.net/man/3/readdir
http://linux.die.net/man/3/opendir
http://linux.die.net/man/3/scandir

and friends

tanvir1 02-16-2010 06:21 PM

Quote:

Originally Posted by nehapawar (Post 3865873)
is there any function like mkdir() or link() for command ls?
if not, how is ls implemented ?

Here is the source code: http://www.openbsd.org/cgi-bin/cvsweb/src/bin/ls/


All times are GMT -5. The time now is 06:31 PM.