···11-/***************************************************************************
22- * __________ __ ___.
33- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77- * \/ \/ \/ \/ \/
88- * $Id$
99- *
1010- * Copyright (C) 2002 by Björn Stenberg
1111- *
1212- * This program is free software; you can redistribute it and/or
1313- * modify it under the terms of the GNU General Public License
1414- * as published by the Free Software Foundation; either version 2
1515- * of the License, or (at your option) any later version.
1616- *
1717- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1818- * KIND, either express or implied.
1919- *
2020- ****************************************************************************/
2121-#include "config.h"
2222-#include "dir.h"
2323-#include "stdlib.h"
2424-#include "string.h"
2525-2626-#ifdef HAVE_MULTIVOLUME
2727-/* returns on which volume this is, and copies the reduced name
2828- (sortof a preprocessor for volume-decorated pathnames) */
2929-int strip_volume(const char* name, char* namecopy)
3030-{
3131- int volume = 0;
3232- const char *temp = name;
3333-3434- while (*temp == '/') /* skip all leading slashes */
3535- ++temp;
3636-3737- if (*temp && !strncmp(temp, VOL_NAMES, VOL_ENUM_POS))
3838- {
3939- temp += VOL_ENUM_POS; /* behind special name */
4040- volume = atoi(temp); /* number is following */
4141- temp = strchr(temp, '/'); /* search for slash behind */
4242- if (temp != NULL)
4343- name = temp; /* use the part behind the volume */
4444- else
4545- name = "/"; /* else this must be the root dir */
4646- }
4747-4848- strlcpy(namecopy, name, MAX_PATH);
4949-5050- return volume;
5151-}
5252-#endif /* #ifdef HAVE_MULTIVOLUME */