The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Oddness in V6 'mv'
@ 2018-02-14 17:47 Noel Chiappa
  0 siblings, 0 replies; only message in thread
From: Noel Chiappa @ 2018-02-14 17:47 UTC (permalink / raw)


So, in:

  http://minnie.tuhs.org/cgi-bin/utree.pl?file=V6/usr/source/s2/mv.c

what's the point of this piece of code:

	p = place;
	p1 = p;
	while(*p++ = *argp3++);
	p2 = p;
	while(*p++ = *argp4++);
	execl("/bin/cp","cp", p1, p2, 0);

I mean, I get that it's copying the two strings pointed to by 'argp3' and
'argp4' into a temporary buffer at 'place', and leaving 'p1' and 'p2' as
pointers to the copies of said strings, but... why is it doing that?

I at first thought that maybe the execl() call was smashing the stack (and
thus the copies pointed to by 'argp3' and 'argp4'), or something, but I don't
think it does that. So why couldn't the code have just been:

	execl("/bin/cp","cp", argp3, argp4, 0);

Is this code maybe just a left-over from some previous variant?

	Noel


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-14 17:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 17:47 [TUHS] Oddness in V6 'mv' Noel Chiappa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).