2 * compat.c - Tweaks for Windows compatibility
4 * Copyright (c) 2002 Richard Russon
5 * Copyright (c) 2002-2004 Anton Altaparmakov
7 * This program/include file is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program/include file is distributed in the hope that it will be
13 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program (in the main directory of the NTFS-3G
19 * distribution in the file COPYING); if not, write to the Free Software
20 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 * ffs - Find the first set bit in an int
69 /* ************************************************************
70 * From: src.opensolaris.org
71 * src/lib/libresolv2/common/bsd/daemon.c
74 * Copyright (c) 1997-2000 by Sun Microsystems, Inc.
75 * All rights reserved.
78 #if defined(LIBC_SCCS) && !defined(lint)
79 static const char sccsid
[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93";
80 static const char rcsid
[] = "$Id: compat.c,v 1.1.1.1.2.1 2008-08-16 15:17:44 jpandre Exp $";
81 #endif /* LIBC_SCCS and not lint */
84 * Copyright (c) 1990, 1993
85 * The Regents of the University of California. All rights reserved.
87 * Redistribution and use in source and binary forms, with or without
88 * modification, are permitted provided that the following conditions
90 * 1. Redistributions of source code must retain the above copyright
91 * notice, this list of conditions and the following disclaimer.
92 * 2. Redistributions in binary form must reproduce the above copyright
93 * notice, this list of conditions and the following disclaimer in the
94 * documentation and/or other materials provided with the distribution.
95 * 3. All advertising materials mentioning features or use of this software
96 * must display the following acknowledgement:
97 * This product includes software developed by the University of
98 * California, Berkeley and its contributors.
99 * 4. Neither the name of the University nor the names of its contributors
100 * may be used to endorse or promote products derived from this software
101 * without specific prior written permission.
103 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
104 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
105 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
106 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
107 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
108 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
109 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
110 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
111 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
112 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
123 int daemon(int nochdir
, int noclose
) {
141 if (!noclose
&& (fd
= open("/dev/null", O_RDWR
, 0)) != -1) {
151 * End: src/lib/libresolv2/common/bsd/daemon.c
152 *************************************************************/
153 #endif /* HAVE_DAEMON */
156 /* ************************************************************
157 * From: src.opensolaris.org
158 * src/lib/libresolv2/common/bsd/strsep.c
161 * Copyright (c) 1997, by Sun Microsystems, Inc.
162 * All rights reserved.
165 #if defined(LIBC_SCCS) && !defined(lint)
166 static const char sccsid
[] = "strsep.c 8.1 (Berkeley) 6/4/93";
167 static const char rcsid
[] = "$Id: compat.c,v 1.1.1.1.2.1 2008-08-16 15:17:44 jpandre Exp $";
168 #endif /* LIBC_SCCS and not lint */
171 * Copyright (c) 1990, 1993
172 * The Regents of the University of California. All rights reserved.
174 * Redistribution and use in source and binary forms, with or without
175 * modification, are permitted provided that the following conditions
177 * 1. Redistributions of source code must retain the above copyright
178 * notice, this list of conditions and the following disclaimer.
179 * 2. Redistributions in binary form must reproduce the above copyright
180 * notice, this list of conditions and the following disclaimer in the
181 * documentation and/or other materials provided with the distribution.
182 * 3. All advertising materials mentioning features or use of this software
183 * must display the following acknowledgement:
184 * This product includes software developed by the University of
185 * California, Berkeley and its contributors.
186 * 4. Neither the name of the University nor the names of its contributors
187 * may be used to endorse or promote products derived from this software
188 * without specific prior written permission.
190 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
191 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
192 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
193 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
194 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
195 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
196 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
197 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
198 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
199 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
211 * Get next token from string *stringp, where tokens are possibly-empty
212 * strings separated by characters from delim.
214 * Writes NULs into the string at *stringp to end tokens.
215 * delim need not remain constant from call to call.
216 * On return, *stringp points past the last NUL written (if there might
217 * be further tokens), or is NULL (if there are definitely no more tokens).
219 * If *stringp is NULL, strsep returns NULL.
221 char *strsep(char **stringp
, const char *delim
) {
227 if ((s
= *stringp
) == NULL
)
233 if ((sc
= *spanp
++) == c
) {
247 * End: src/lib/libresolv2/common/bsd/strsep.c
248 *************************************************************/
249 #endif /* HAVE_STRSEP */