🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Robert S. Maier Sun, 15 Oct 1989 01:39
a slight enhancement to the GNU `mv'
#499
Author: Robert S. Maier
Date: Sun, 15 Oct 1989 01:39
48 lines
2037 bytes
The following is a slight enhancement to the GNU `mv', written by Mike
Parker.

Like the BSD mv (the only one I'm familiar with) the GNU mv asks the
user ``Override mode xxx for filename?'' if access(2) reports no write
access to the target file.  But write access can be denied for reasons
other than bad permission flags.  In particular it can be denied if
the target is on a read-only filesystem, or if the target is a busy
executable.

The following diff uses perror(3) to report such problems.  I have
already found it useful...

-- 
Robert S. Maier   | Internet: rsm@math.arizona.edu	[128.196.128.99]
Dept. of Math.    | UUCP: ..{allegra,cmcl2,hao!noao}!arizona!amethyst!rsm
Univ. of Arizona  | Bitnet: maier@arizrvax
Tucson, AZ  85721 | FAX: +1 602 621 8322
U.S.A.            | Voice: +1 602 621 6893  /  +1 602 621 2617


----------------------------------------------------------------------
224,226c224,226
<       if ((access (to, W_OK) < 0 ||
< 	   (stb.st_mode & ((S_IWRITE>>6)*0111)) == 0)
< 	  && !force )
---
>       if ( (access (to, W_OK) < 0 ||
> 	    (stb.st_mode & ((S_IWRITE>>6)*0111)) == 0)
> 	   && !force )
228,230c228,240
< 	  printf ("Override mode %04o for `%s'? ", stb.st_mode & 0777 ,to);
< 	  if (! yes ())
< 	    return;
---
> 	  if (errno == EACCES || (stb.st_mode & ((S_IWRITE>>6)*0111)) == 0)
> 	    {
> 	      printf ("Override mode %04o for `%s'? ", stb.st_mode & 0777 ,to);
> 	      if (! yes ())
> 		return;
> 	    }
> 	  else			/* RO filesystem, text busy etc. */
> 	    {
> 	      fprintf (stderr, "%s: no write access to `%s': ", 
> 		       pgm, to); 
> 	      perror (0);
> 	      return;
> 	    }
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads