Difference between revisions of "Source:Hack 1.0/hack.stat.c"

From NetHackWiki
Jump to navigation Jump to search
m (Automated source code upload)
 
m (Hack 1.0/hack.stat.c moved to Source:Hack 1.0/hack.stat.c: Robot: moved page)
 
(No difference)

Latest revision as of 22:37, 3 March 2008

Below is the full text to hack.stat.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/hack.stat.c#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

Screenshots and source code from Hack are used under the CWI license.

1.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */
2.    
3.    #include <sys/types.h>
4.    #include <sys/stat.h>
5.    extern char *index();
6.    struct stat buf,hbuf;
7.    
8.    gethdate(name) char *name; {
9.    register char *np;
10.   	if(stat(name, &hbuf))
11.   		error("Cannot get status of %s.",
12.   			(np = index(name, '/')) ? np+1 : name);
13.   }
14.   
15.   uptodate(fd) {
16.   	if(fstat(fd, &buf)) {
17.   		pline("Cannot get status?");
18.   		return(0);
19.   	}
20.   	if(buf.st_ctime < hbuf.st_ctime) {
21.   		pline("Saved level is out of date.");
22.   		return(0);
23.   	}
24.    return(1);
25.   }