SDDSlib
Loading...
Searching...
No Matches
clean_filename.c
Go to the documentation of this file.
1/**
2 * @file clean_filename.c
3 * @brief Provides functions to manipulate and clean filename strings.
4 *
5 * This file contains functions to create, manage, and manipulate buffers that store
6 * lines of text strings. Buffers can be dynamically created, added to, cleared, and
7 * printed to files.
8 *
9 * @copyright
10 * - (c) 2002 The University of Chicago, as Operator of Argonne National Laboratory.
11 * - (c) 2002 The Regents of the University of California, as Operator of Los Alamos National Laboratory.
12 *
13 * @license
14 * This file is distributed under the terms of the Software License Agreement
15 * found in the file LICENSE included with this distribution.
16 *
17 * @author M. Borland, C. Saunders, R. Soliday
18 */
19
20
21#include "mdb.h"
22#include <ctype.h>
23
24/**
25 * @brief Removes path and version specifications from a filename string.
26 *
27 * This function eliminates any path components enclosed in ']' and
28 * truncates the filename at the first occurrence of ';' to remove version information.
29 *
30 * @param filename The filename string to be cleaned.
31 * @return A pointer to the cleaned filename.
32 */
33char *clean_filename(char *filename) {
34 register char *ptr;
35
36 if ((ptr = strchr(filename, ']')))
37 strcpy_ss(filename, ptr + 1);
38 if ((ptr = strchr(filename, ';')))
39 *ptr = 0;
40 return (filename);
41}
char * clean_filename(char *filename)
Removes path and version specifications from a filename string.
char * strcpy_ss(char *dest, const char *src)
Safely copies a string, handling memory overlap.
Definition str_copy.c:34