modified: src1/input.c
[GalaxyCodeBases.git] / c_cpp / etc / calc / have_ustat.c
blob7e2f5b2a6c9af40d2eed4073b01a437152bdb104
1 /*
2 * have_ustat - Determine if we have ustat()
4 * Copyright (C) 1999 Landon Curt Noll
6 * Calc is open software; you can redistribute it and/or modify it under
7 * the terms of the version 2.1 of the GNU Lesser General Public License
8 * as published by the Free Software Foundation.
10 * Calc is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
13 * Public License for more details.
15 * A copy of version 2.1 of the GNU Lesser General Public License is
16 * distributed with calc under the filename COPYING-LGPL. You should have
17 * received a copy with calc; if not, write to Free Software Foundation, Inc.
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * @(#) $Revision: 30.1 $
21 * @(#) $Id: have_ustat.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
22 * @(#) $Source: /usr/local/src/bin/calc/RCS/have_ustat.c,v $
24 * Under source code control: 1999/10/20 22:51:13
25 * File existed as early as: 1999
27 * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
28 * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
32 * usage:
33 * have_ustat
35 * Not all systems have the ustat() function, so this may not
36 * compile on your system.
38 * This prog outputs several defines:
40 * HAVE_USTAT
41 * defined ==> use ustat()
42 * undefined ==> do not call or cannot call ustat()
46 #include <sys/types.h>
47 #include <sys/stat.h>
48 #include <ustat.h>
50 int
51 main(void)
53 #if defined(HAVE_NO_USTAT)
55 printf("#undef HAVE_USTAT /* no */\n");
57 #else /* HAVE_NO_USTAT */
59 struct stat stat_dot; /* stat of "." */
60 struct ustat ustat_dot; /* usage stat of "." */
62 (void) stat(".", &stat_dot);
63 (void) ustat(stat_dot.st_dev, &ustat_dot);
65 printf("#define HAVE_USTAT /* yes */\n");
67 #endif /* HAVE_NO_USTAT */
69 /* exit(0); */
70 return 0;