Issue
POSIX contains a header called libgen.h (not very explicit by itself), described as
definitions for pattern matching functions
And contains the following function definitions:
char *basename(char *);
char *dirname(char *);
It used to contain two Regex-related functions, but they were removed in Issue 6.
Which leads me to the question: why "libgen"?
Solution
The name <libgen.h>
is probably some variant of 'general library' — but history doesn't really relate.
In my printed copy of the AT&T Unix SVR4 Programmer's Reference Manual (published by Prentice-Hall in 1990 with ISBN 0-13-947029-8, but Google doesn't know much about that ISBN), there were many other functions defined in the <libgen.h>
header. Section 3G "General Purpose Library Routines" listed basename()
and dirname()
and these other functions:
bgets()
(similar to moderngetdelim()
)bufsplit()
copylist()
gmatch()
(similar to modernfnmatch()
)isencrypt()
mkdirp()
(create directories in a path name)rmdirp()
(remove directories in a path name)p2open()
andp2close()
(bi-directional communication with a sub-process — related topopen()
andpclose()
)pathfind()
regcmp()
andregex()
(regular expressions)strfind()
,strrspn()
,strtrns()
strccpy()
,strcadd()
,strecpy()
,streadd()
You needed to link the program with -lgen
(libgen.a
, libgen.so
) to gain access to these functions.
Answered By - Jonathan Leffler Answer Checked By - Candace Johnson (WPSolving Volunteer)