1 /* 2 * mntent 3 * mntent.h - compatibility header for FreeBSD 4 * 5 * Copyright (c) 2001 David Rufino <daverufino@btinternet.com> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 #ifndef VIFM__UTILS__MNTENT_H__ 31 #define VIFM__UTILS__MNTENT_H__ 32 33 #if defined(HAVE_MNTENT_H) && HAVE_MNTENT_H 34 /* We have a usable <mntent.h>. */ 35 36 #include <mntent.h> 37 38 #elif defined(HAVE_GETMNTINFO) && HAVE_GETMNTINFO 39 /* We can emulate *mntent() using getmntinfo(). */ 40 41 #include <stddef.h> 42 #include <stdio.h> 43 44 #define MOUNTED "dummy" 45 46 #define MNTTYPE_NFS "nfs" 47 48 struct mntent 49 { 50 char *mnt_fsname; 51 char *mnt_dir; 52 char *mnt_type; 53 char *mnt_opts; 54 int mnt_freq; 55 int mnt_passno; 56 }; 57 58 #define setmntent(x,y) ((FILE *)0x1) 59 struct mntent * getmntent(FILE *fp); 60 char * hasmntopt(const struct mntent *mnt, const char option[]); 61 #define endmntent(x) ((int)1) 62 63 #else 64 /* The best we can do is provide stubs that do nothing. */ 65 66 struct mntent 67 { 68 #ifndef _WIN32 69 char *mnt_fsname; 70 char *mnt_dir; 71 char *mnt_type; 72 char *mnt_opts; 73 int mnt_freq; 74 int mnt_passno; 75 #else 76 const char *mnt_dir; 77 const char *mnt_type; 78 #endif 79 }; 80 81 #define setmntent(x,y) ((FILE *)0x1) 82 #define getmntent(x) ((struct mntent *)NULL) 83 #define hasmntopt(x,y) ((char *)NULL) 84 #define endmntent(x) ((int)1) 85 86 #endif 87 88 #endif /* VIFM__UTILS__MNTENT_H__ */ 89 90 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ 91 /* vim: set cinoptions+=t0 filetype=c : */ 92