Hacker News new | ask | show | jobs
by smhenderson 4155 days ago
I thought about the same thing in regards to cp. I've been using OpenBSD a lot lately and having it's source installed wanted to take a look at their coding style and such. I picked cp as my first glance as I thought that should be simple enough to understand quickly.

As you say, it's option parsing makes up the bulk of the cp.c code, with utils.c doing most of the actual file copying. It turns out it's pretty tough to offer a lot of options with some of them being mutually exclusive. Obvious in hindsight but interesting to me at the time I was reading through it.

http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/bin/...

http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/bin/...