Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!aero-c!usasoc.soc.mil!news From: ted@arsocomvax.socom.mil (Ted Nolan) Newsgroups: comp.protocols.nfs Subject: Re: When NFS fails Message-ID: <1991Apr30.221106.8559@usasoc.soc.mil> Date: 30 Apr 91 22:11:06 GMT References: <1991Apr30.165109.23950@jadpc.cts.com> Reply-To: ted@usasoc.soc.mil (Ted Nolan) Organization: SRI International, Ft. Bragg NC Lines: 44 In article <1991Apr30.165109.23950@jadpc.cts.com> jdeitch@jadpc.cts.com (Jim Deitch) writes: >Does anyone have sample source for a program that checks to see if an >NFS mounted drive is valid? > We have used this from time to time, and it seems to work. As presented, it is intended to set the DOS errorlevel for batch file use, but it could easily be incorporated into a larger program. I think it was written in MIX Power C, but probably Turbo or MS would work also: #include #include #include #include int dstatus = 0; main(int argc, char **argv) { int harderror(int error, int ax, int bp, int si); char path[15]; struct stat statbuf; if( argc != 2) { fprintf(stderr,"Usage %s d\n",argv[0]); fprintf(stderr,"Where d is a drive letter\n"); exit(1); } sprintf(path,"%s:\\foo\\bar",argv[1]); harderr(harderror); (void) stat(path,&statbuf); exit(dstatus); } int harderror(int error, int ax, int bp, int si) { dstatus = 1; hardresume(0); }