Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When programming in C, I like to use man sections 2 and 3 to look up the form of system and library calls.

But I also often need to look up the form of a struct that is defined in a standard library. For example, sockaddr/sockaddr_un in 'sys/socket.h'. Is there any way I can look up structs or header files through man pages?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

To find these, it's helpful to use, for example, apropos socket to see which man pages may correspond to the information you desire. In this case, it's man 7 unix:

#define UNIX_PATH_MAX    108
struct sockaddr_un {
    sa_family_t sun_family;               /* AF_UNIX */
    char        sun_path[UNIX_PATH_MAX];  /* pathname */
};

Is this what you were looking for?

share|improve this answer
    
Helpful, I did not know about apropos. But this still leaves something to be desired. For example, I would not be able to find the man page for socketaddr_in by apropos socket. (It's under man 7 ip) But there may not be a better solution? –  StuartHa Jan 9 '12 at 5:02
    
No, not unless you want to let your IDE pick those things up for you. –  user8290 Jan 9 '12 at 12:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.