'Rename' Library Function?

Maarten Litmaath maart at cs.vu.nl
Wed Sep 20 09:41:43 AEST 1989


jbayer at ispi.UUCP (Jonathan Bayer) writes:
\...	if ( (z = link (oldname, newname)) == 0) {
\		z = unlink (oldname);
	}
\
\	if (z) printf ("Sorry -- error in renaming file %s to %s!\n", oldname,
\                 finalname);
\	printf ("error: %d\n",errno);

...leading to `interesting' error messages like:

	error: 25	/* Not a typewriter */

Use something like the following instead:

	if (z) {
		int	saved_errno = errno;

		printf(...);
		printf("error: %d\n", saved_errno);
	}
-- 
   creat(2) shouldn't have been create(2): |Maarten Litmaath @ VU Amsterdam:
      it shouldn't have existed at all.    |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.xenix mailing list