mirror of
https://agent.ghink.cloud/wb2osz/direwolf
synced 2025-04-03 19:28:40 +00:00
this step unify the builing system for all platforms (windows, linux, osx and *BSD) * Requirements: - gcc/clang (C/C++ compiler) (in debian build-essential) - cmake (in debian cmake) - git if you build from source (in debian git) - posix threads ** Requirements on *BSD/macOS: - portaudio ** Optional Requirements: - gpsd (in debian libgps-dev) - libhamlib (in debian libhamlib-dev) ** Optional Requirements in Linux - udev (in debian libudev-dev) - alsa (in debian libasound2-dev) * Main changes: - version is now set only on CMakeLists.txt and automatically used on the code - cpu flags are auto-discovered in the default build and it works on gcc/clang/msvc on x86/x86_64/arm; you can force cpu flags with -DFORCE_SSE=1 for example (see CMakeLists.txt on root) - use a more "complex" tag on generic.conf to facilitate parsing by cmake (not more platform dependent). Now it is %C% or %R% for example - target `tocalls-symbols` is now called `data-update` - created debian/ directory to contains files to use debuild * Example to build: mkdir build && cd build cmake .. make make install make install-conf then you have the binary files on src/ and in the system directory * CMake options (see the head of CMakeLists.txt) - FORCE_SSE force sse instruction - FORCE_SSSE3 force ssse3 instruction - FORCE_SSE41 force ssse4.1 instruction - OPTIONAL_TEST compile optional test (might be broken) - BUILD_TESTING enable tests (ctest framework) - CMAKE_INSTALL_PREFIX if you want to change your install path prefix for example: cmake .. -DOPTIONAL_TEST=ON
73 lines
2.5 KiB
C
73 lines
2.5 KiB
C
/* $NetBSD: strsep.c,v 1.5 2014/10/31 18:59:32 spz Exp $ */
|
|
/* from NetBSD: strsep.c,v 1.14 2003/08/07 16:43:52 agc Exp */
|
|
|
|
/*-
|
|
* Copyright (c) 1990, 1993
|
|
* The Regents of the University of California. All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* 3. Neither the name of the University nor the names of its contributors
|
|
* may be used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*/
|
|
|
|
//#include "tnftp.h"
|
|
#include <string.h>
|
|
|
|
/*
|
|
* Get next token from string *stringp, where tokens are possibly-empty
|
|
* strings separated by characters from delim.
|
|
*
|
|
* Writes NULs into the string at *stringp to end tokens.
|
|
* delim need not remain constant from call to call.
|
|
* On return, *stringp points past the last NUL written (if there might
|
|
* be further tokens), or is NULL (if there are definitely no more tokens).
|
|
*
|
|
* If *stringp is NULL, strsep returns NULL.
|
|
*/
|
|
char *
|
|
strsep(char **stringp, const char *delim)
|
|
{
|
|
char *s;
|
|
const char *spanp;
|
|
int c, sc;
|
|
char *tok;
|
|
|
|
if ((s = *stringp) == NULL)
|
|
return (NULL);
|
|
for (tok = s;;) {
|
|
c = *s++;
|
|
spanp = delim;
|
|
do {
|
|
if ((sc = *spanp++) == c) {
|
|
if (c == 0)
|
|
s = NULL;
|
|
else
|
|
s[-1] = 0;
|
|
*stringp = s;
|
|
return (tok);
|
|
}
|
|
} while (sc != 0);
|
|
}
|
|
/* NOTREACHED */
|
|
}
|