|
Next
Previous
Contents
11. Third Example: FortuneThis example requires some knowledge of C programming. The majority of UNIX/Linux software is written in C, and learning at least a little bit of C would certainly be an asset for anyone serious about software installation. The notorious fortune program displays up a humorous saying, a "fortune cookie", every time Linux boots up. Unfortunately (pun intended), attempting to build fortune on a Red Hat distribution with a 2.0.30 kernel generates fatal errors.
Looking at
We need to find the structure
This appears to be a system library include file, therefore, the logical
place to look for dirent.h is in /usr/include.
Indeed, there does exist a dirent.h file in
/usr/include, but that file does not contain the declaration of
the
At last, going to /usr/include/linux/dirent.h, we find the structure declaration we need.
Sure enough, the structure declaration contains no d_namelen, but there are a couple of "candidates" for its equivalent. The most likely of these is d_reclen, since this structure member probably represents the length of something and it is a short integer. The other possibility, d_ino, could be an inode number, judging by its name and type. As a matter of fact, we are probably dealing with a "directory entry" structure, and these elements represent attributes of a file, its name, inode, and length (in blocks). This would seem to validate our guess. Let us edit the file
Next Previous Contents Linux HOWTO full list |
|
This document, LDP HOWTO-INDEX, is copyrighted (c) 1995 - 2002 by Tim Bynum, Guylhem Aznar, Joshua Drake and Greg Ferguson. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html. If you have questions, please contact the LDP.
Web Design Copyright © 1999-2003. Chrisranjana Software Solutions Pvt Ltd. syndicate rss feed |