SDDS ToolKit Programs and Libraries for C and Python
Loading...
Searching...
No Matches
SDDS
mdblib
clean_filename.c
Go to the documentation of this file.
1
/**
2
* @file clean_filename.c
3
* @brief Utility for stripping path and version information from filenames.
4
*
5
* The file implements the `clean_filename` function, which removes any path
6
* components enclosed in square brackets and truncates the string at the first
7
* semicolon. The result is a plain filename without VMS style path or version
8
* suffixes.
9
*
10
* @copyright
11
* - (c) 2002 The University of Chicago, as Operator of Argonne National Laboratory.
12
* - (c) 2002 The Regents of the University of California, as Operator of Los Alamos National Laboratory.
13
*
14
* @license
15
* This file is distributed under the terms of the Software License Agreement
16
* found in the file LICENSE included with this distribution.
17
*
18
* @author M. Borland, C. Saunders, R. Soliday
19
*/
20
21
22
#include "mdb.h"
23
#include <ctype.h>
24
25
/**
26
* @brief Removes path and version specifications from a filename string.
27
*
28
* This function eliminates any path components enclosed in ']' and
29
* truncates the filename at the first occurrence of ';' to remove version information.
30
*
31
* @param filename The filename string to be cleaned.
32
* @return A pointer to the cleaned filename.
33
*/
34
char
*
clean_filename
(
char
*filename) {
35
register
char
*ptr;
36
37
if
((ptr = strchr(filename,
']'
)))
38
strcpy_ss
(filename, ptr + 1);
39
if
((ptr = strchr(filename,
';'
)))
40
*ptr = 0;
41
return
(filename);
42
}
clean_filename
char * clean_filename(char *filename)
Removes path and version specifications from a filename string.
Definition
clean_filename.c:34
strcpy_ss
char * strcpy_ss(char *dest, const char *src)
Safely copies a string, handling memory overlap.
Definition
str_copy.c:34
Generated by
1.12.0