Re: directory data structure



sid <kingsiddharth@xxxxxxxxx> writes:

Actually what I was thinking of was that since everything is a file
in
a Linux kernel/system, I would just read the directory files and
interpret them... and I know that we could do so in the older
versions
of Linux as well as UNIX. Say, if you wanted to read the current
directory, you could just do "od -bc ." and this would octal dump the
contents the of current directory. Also, even now you could read the
contents of the directory file using VI ( vi <directory name> ). So I
planned to do something similar and was thinking that you guys might
help me with it.

Well, then why not try to do exactly that, and tell us what your next
problem is?

But if you want to interpret the binary information, you need to
understand the various *.h files.

How do you plan to split bits and bytes into something that makes
sense without using the *.h files?
If you just want the filenames, you can use "strings <."

but then "echo *" or "ls" will also work, and be much more accurate.

So - again - I don't understand what you are trying to do.

If you want to learn the internals, you need to understand the API's
and the manual pages. Otherwise you are just guessing.

As I said before, perl allows you to write a script to examine the
contents of a directory, without compiling a program. See the
opendir/readdir functions.



.