3 ms·
> I'm not a fan of Unix man page section numbers in parentheses. Why not? Confusion if function call with section number as argument?
by bear8642 2y ago
> I'm not a fan of Unix man page section numbers in parentheses.
Why not? Confusion if function call with section number as argument?
- shrimp_emoji 2y agoI once learned what they mean. But I forgot and now do not.
- Karellen 2y agoThey describe the section of the manual, where 1 = programs, 2 = syscalls, 3 = userspace functions, 4 = special files, 5 = file formats, 6 = games, 7 = misc/overviews. So printf(1) is the man page for the /usr/bin/printf command, while printf(3) is the man page for the libc printf() function. Alternatively, readdir(2) is the man page for the readdir syscall, while readdir(3) is the man page for the libc wrapper, which no longer actually calls readdir(2). See also syslog(2) and syslog(3). Or, time(1) is the man page for /usr/bin/time to time how long commands take. time(2) is the syscall to return the number of seconds since the epoch. And time(7) gives you an overview of time and timers on the system.
- _kst_ 2y agoI just discovered that typing man 'printf(1)' or man 'printf(3)' actually works (at least with the man command on Ubuntu, provided by the "man-db" package). You have to quote or escape the parentheses because they're shell metacharacters, which IMHO makes that syntax more trouble than it's worth. Other commands that work are "man 3 printf", "man -s 3 printf", and "man printf.3". I think "man 3 printf" is the oldest version. At least one other version of the man command (NetBSD) doesn't accept "man printf.3" or "man 'printf(3)'".
- spauldo 2y agoUnless you're on a UNIX system the number isn't important. If you are on a UNIX system, then it's useful for telling the difference between commands (like write(1), hostname(1), or printf(1)), system calls (like write(2)), library functions (like printf(3)), or config files (like hostname(5)).
- kazinator 2y agoIn an article about C programming, the context tells you that everything that is given in a typewriter font is a C identifier, unless noted otherwise.
- kazinator 2y agoIt's visual clutter that only communicates - I see the entire computing world with Unix blinders on my eyes. - I can't imagine a strlcpy function being used on a system that isn't Unix and that doesn't have a man page for it in section 3. - I don't care that C has been internationally standardized since 1989 with a printf(3) function; printf(3) it's just another Unix function in section 3 of my man pages. - If I don't affix (2) or (3), how will people know I'm not talking about something other than a C library function? I don't understand this "context" stuff in writing and speaking.