Nicolas Williams writes:
> OK, I've decided to follow Jim's preferred approach of re-writing
> i.services using nawk to get the merge right.

What Jim actually suggested was just reimplementing the _existing_
very simple logic using a different mechanism that doesn't require
zillions of expensive execs to get the work done.  Not a redesign for
some new requirements, which I think is probably out of scope.

> I'm not sure how I'll manage to preserve comments though.  Here's the
> rough algorithm:

The existing code is simple.  It reads the uncommented services in the
user's existing /etc/services file.  For each one, it checks if that
service name is in the new file from the updated package.  If it is,
then it does nothing (keeping the same entry from the update).  If
it's not present, then it tosses it to the end of the new file.

What you end up with is a copy of the file from the updated package,
with your own additions (if any) preserved at the bottom of the file.
Comments are tossed.

You can certainly do better if you want, but the bar here is pretty
low.

-- 
James Carlson, Solaris Networking              <[EMAIL PROTECTED]>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to