/*
 * SPDX-FileCopyrightText: (c) 2009 RWTH Aachen University <rwth-aachen.de>
 * SPDX-FileCopyrightText: (c) 2009 Gesellschaft für numerische Simulation mbH Braunschweig <gns-mbh.com>
 * SPDX-FileCopyrightText: (c) 2009 Technische Universität Dresden <tu-dresden.de>
 * SPDX-FileCopyrightText: (c) 2009 University of Oregon <uoregon.edu>
 * SPDX-FileCopyrightText: (c) 2009 Forschungszentrum Jülich GmbH <fz-juelich.de>
 * SPDX-FileCopyrightText: (c) 2009 German Research School for Simulation Sciences GmbH
 * SPDX-FileCopyrightText: (c) 2009 Technische Universität München <tum.de>
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */


#ifndef UTILS_NORMALIZE_FILE_H
#define UTILS_NORMALIZE_FILE_H


#include <string.h>


/**
 * @file
 *
 *
 */


static const char*
normalize_file( const char* srcdir,
                const char* file )
{
    size_t      srcdir_len      = strlen( srcdir );
    const char* normalized_file = file;

    /* srcdir is guaranteed to have an trailing slash, so no need to test for it
       in the file */
    if ( strncmp( normalized_file, srcdir, srcdir_len ) == 0 )
    {
        normalized_file += srcdir_len;
    }

    return normalized_file;
}


#endif /* UTILS_NORMALIZE_FILE_H */
