Boost logo

Boost :

From: Mark Coletti (mcoletti_at_[hidden])
Date: 2001-03-26 14:29:07


I'm a programmer that's been slinging C++ for several years. I've
developed the (possible) beginnings for a C++ system library. I'll
discuss the motivation for it and what I have so far so that you can
decide whether it's worthy to include in the Boost library.

Eric Raymond said that a number of software projects are engendered to
scratch a programmer's "itch." The itch for th e"C++ sysutils
library" started because of the frustration with dirname(2) and
basename(2). These are C functions that provide the programmer the
same functionality as their shell equivalents. That is, the former
will return the directory portion of a path string; the latter returns
the last "name" in a similar path. (E.g., dirname("/foo/bar") returns
"/foo" and basename("/foo/bar") returns "bar".) The problem is that
these functions are inconsistently available from OS to OS; and, when
available, there's typically more than one implementation. For
example, these functions can be found in BOTH <string.h> AND
<libgen.h> on linux; worse yet, they have slightly differing semantics
in that the latter will potentially modify the argument whereas the
former doesn't. FreeBSD doesn't have these functions at all.

I had cobbled my own to be used when autoconf determined that the
current system was bereft of these functions; but I found myself
copying this code and hacking on it from project to project. I
finally decided to generalize them into a general purpose "fill in
system function gaps" project. I started writing "" that
would check for the myriad dirname()/basename() implementations.

Then I realized this was insane. These were inherently simple text
processing system functions. Why go through all the trouble to find a
good implementation when I could just re-write them in C++?

So, that's what I did.

I imagine that there are other C++ programmers that would like these
functions. There's the possibility that more "missing" functions
could be added; maybe even C++ wrappers for common C system functions
could be added. Who knows?

In any case, the first thing I thought of was to submit the first
incarnation of this thing to you folks for possible admission into the
Boost library suite. I haven't gone through the trouble of modifying
it to meet the Boost source spec. (Why bother when it may not even
make it in?) Instead, I've attached the tarball of the source for you
to look at and consider. If you don't think it should be added, then
I'll just plop it on for others to grab. It
ultimately doesn't matter to me either way.



Mark Coletti | mailto:mcoletti_at_[hidden] |
  Things only appear to get lost--they're waiting for you in next week.

Boost list run by bdawes at, gregod at, cpdaniel at, john at