/***************************************************************************1* _ _ ____ _2* Project ___| | | | _ \| |3* / __| | | | |_) | |4* | (__| |_| | _ <| |___5* \___|\___/|_| \_\_____|6*7* Copyright (C) Daniel Stenberg, <[email protected]>, et al.8*9* This software is licensed as described in the file COPYING, which10* you should have received as part of this distribution. The terms11* are also available at https://curl.se/docs/copyright.html.12*13* You may opt to use, copy, modify, merge, publish, distribute and/or sell14* copies of the Software, and permit persons to whom the Software is15* furnished to do so, under the terms of the COPYING file.16*17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY18* KIND, either express or implied.19*20* SPDX-License-Identifier: curl21*22***************************************************************************/23#include "tool_setup.h"2425#include "tool_bname.h"2627#include <memdebug.h> /* keep this as LAST include */2829#ifndef HAVE_BASENAME3031char *tool_basename(char *path)32{33char *s1;34char *s2;3536s1 = strrchr(path, '/');37s2 = strrchr(path, '\\');3839if(s1 && s2) {40path = (s1 > s2) ? s1 + 1 : s2 + 1;41}42else if(s1)43path = s1 + 1;44else if(s2)45path = s2 + 1;4647return path;48}4950#endif /* HAVE_BASENAME */515253