It's been a while since my last post, so I figured I'd post some little thing...
If you're at all like me, you love reading OpenSource source code to see how things are really done. Like, maybe you want to see how bash does process substitution, or you want to see if shell IO redirection is done using
open. The easy way to answer these questions is to simply read the source code. And since we're all Mac users here, we'll choose to read the Darwin source.
So, I wrote a simple little (no joke, really simple and little) script to let you see what source is available and download and extract it for you. It's called
snagdar.sh, and can be found here.
When run with no arguments it simply displays a list of all available Darwin packages. This is useful for grepping to find the package you may want. Then, once you find the package, just run
snagdar.sh again passing it a regexp to match the package you want. If multiple packages match the regex, they will all be snagged.
So, say I want to see how lsof(8) works, I can run:
$ snagdar.sh | grep lsof
lsof 20 Other
to see if an lsof package exists. We see that it does, and we'd like the source for it, so we can simply do:
$ snagdar.sh lsof
+++++ Snagging http://darwinsource.opendarwin.org/tarballs/other/lsof-20.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 549k 100 549k 0 0 573k 0 --:--:-- --:--:-- --:--:-- 639k
Then, I'll end up with a directory named
lsof-20/in my current dir which contains the source for lsof.
This is a just a small, simple script that happens to make my daily life a little bit easier.
Since Open Darwin has closed its doors, this script no longer works. Darwin source can still be fetched from Apple, but it requires a login to download. I'll update the script when I get time.
Snagdar now works again. See the this post