Don't open sharetab in parse_sharetab() - it's already open!
+ Reuse the handle, fseek to beginning and read...
Instead of opening a temporary sharetab and then renaming it,
just open it with freopen() writeable and write the info.
+ If sharetab isn't opened, open it with fopen() instead of
  freopen() to avoid segfault if it doesn't exist.