TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jasen Betts
from: Dave Kelly
date: 1998-09-08 20:31:00
subject: Help Needed

Jasen Betts,
  In a message on 6 September, to Dave Kelly, wrote :

For 'fork()' and 'getpgrp()' see the previous message to
Christopher Butler.

JB> DK> #3.
JB> DK>         unlink (new_filename);
JB> DK>
JB> DK>         if (link (old_filename, new_filename) == -1) {
JB> DK>         ^^^^
JB> DK> Is this trying to verify that 'new_filename' has been deleted
JB> DK> from the disk, since it compares to less than. Could I use
JB> DK> 'access()' instead?
JB> 
JB> it appears to erasing new_filename, and then creating a link to
JB> old_filename called new_filename so that now both old_filename and
JB> new_filename refer to the same file.

OF COURSE! "Too many late nights staring at this screen."

To me and the OS I'm use to 'link' means attach. This function is
renameing the file. AND if I would just look at the name of the 
function I would realize that, "rename_file".

My C library does not have a 'rename()', however I do have a
command line process that will do just that, so I will write the function
thus and call it 'link'.

char *argblk[] = {
   "rename",
    0,
    0,
    0,
   };

int link( oldname, newname )
char *oldname, *newname;
{
   int Pid;

   strcpy( argblk[1], oldname );
   strcpy( argblk[2], newname );

   if ((Pid = os9exec( os9forkc, argblk[0], argblk,
                       enfiron, 0, 0, 3 )) > 0 ) wait(0);
   else
       printf( "Can not rename %s to %s\n", oldname, newname );
       return (-1);
}

DUH! And all this time I could have had a V-8.

Thanks for the feed back.  
...
 * ATP/OSK 1.40 * A rag of colts.
--- T.A.G. 2.7d Standard
* Origin: Coyote's Den (1:106/3198)
SEEN-BY: 396/1 622/419 632/0 371 633/260 267 270 371 634/397 635/506 728 810
SEEN-BY: 639/252 670/213 218
@PATH: 106/3198 8277 270/101 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.