Subject: pax-tar -C enhancement proposal
To: None <tech-userlevel@netbsd.org>
From: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
List: tech-userlevel
Date: 07/23/1999 16:51:40
Hello,

it has come to my attention that:

<hubertf> phone: "you" would have to fix things that use multiple -Cs first
	  (-> pkg_*)

is the main reason we still need to ship with gnu tar in the base distribution.

I looked at the code, and propose this plan to add positional -C arguments:


a) in pax.c: move the tail of main() to a new function, starting
right after the options() call. 

Actually, we need 2 of them:
- one which calls gen_init(), tty_init(), time(&starttime) and sets up
  the signal handler, main_inits(). Make it use exit() instead of return()
  for errors.

- one which contains the switch: main_switch().

b1) in pat_rep.c, add a function pat_clear() that clears the linked list of
patterns (after freeing the members).

b2) in ftree.c, add a function ftree_clear() that clears the linked file list
(after freeing the members).

c) in options.c:tar_options(), compare each argv[N] to "-C" before processing
it as a file/pattern.

If yes {
	if (!inited)
		main_inits();
	main_switch();
	chdir_name = *++argv;
	++argv;
	pat_clear(); ftree_clear();
	if (no more argv) {usage() and exit()}
	goto start of loop.
}

d) in options.c:allother_options, add a call of main_inits() and main_switch()
at the end.

Comments?

	-is
-- 
 * Progress (n.): The process through which Usenet has evolved from
   smart people in front of dumb terminals to dumb people in front of
   smart terminals.  -- obs@burnout.demon.co.uk (obscurity)