TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: Steve Wegert 76703,4255 (X)
from: Bob van der Poel 76510,2203
date: 1993-03-29 19:24:33
subject: Blarslib fixes

#: 17827 S12/OS9/68000 (OSK)
    29-Mar-93  19:24:33
Sb: Blarslib fixes
Fm: Bob van der Poel 76510,2203
To: Steve Wegert 76703,4255 (X)

Steve, seeing MH's fix for the link() function in blarslib.l reminded me that I
had to make a fix to utime() awhile ago to get it to operate in the manner
expected by a program I was porting from unix. I'm not sure which is the
correct method...so I'll just post my revised source here in this message.
Guess if the program doesn't work one way...one could try this. I don't have
access to the proper docs, so I'm just guessing.

 #include 
 #include 
 #include 
 #define NULL 0
 int utime(file, timep)
 char *file;
 time_t timep[2];
 {
     register int p;
     register struct tm *when;
     struct fildes fd;

     if((when = gmtime(&timep[1])) == NULL) return -1;
     /* changed S_IREAD to S_IWRITE bvdp 92/12/17 */
     if((p = open(file, S_IWRITE)) < 0 &&
                (p = open(file, S_IWRITE|S_IFDIR)) < 0) {
        return -1;
     }
     if(_gs_gfd(p, &fd, sizeof fd) < 0) {
        close(p);
        return -1;
     }
     fd.fd_date[0] = when->tm_year;
     fd.fd_date[1] = when->tm_mon + 1;
     fd.fd_date[2] = when->tm_mday;
     fd.fd_date[3] = when->tm_hour;
     fd.fd_date[4] = when->tm_min;
     if(_ss_pfd(p, &fd) < 0) {
        close(p);
                return -1;
     }
     return(close(p)<0) ? -1 : 0;  /* changed!!! bvdp */
  }

SOURCE: compuserve via textfiles.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™.