SDDS ToolKit Programs and Libraries for C and Python
Loading...
Searching...
No Matches
clean_filename.c File Reference

Detailed Description

Utility for stripping path and version information from filenames.

The file implements the clean_filename function, which removes any path components enclosed in square brackets and truncates the string at the first semicolon. The result is a plain filename without VMS style path or version suffixes.

License
This file is distributed under the terms of the Software License Agreement found in the file LICENSE included with this distribution.
Author
M. Borland, C. Saunders, R. Soliday

Definition in file clean_filename.c.

#include "mdb.h"
#include <ctype.h>

Go to the source code of this file.

Functions

char * clean_filename (char *filename)
 Removes path and version specifications from a filename string.
 

Function Documentation

◆ clean_filename()

char * clean_filename ( char * filename)

Removes path and version specifications from a filename string.

This function eliminates any path components enclosed in ']' and truncates the filename at the first occurrence of ';' to remove version information.

Parameters
filenameThe filename string to be cleaned.
Returns
A pointer to the cleaned filename.

Definition at line 34 of file clean_filename.c.

34 {
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}
char * strcpy_ss(char *dest, const char *src)
Safely copies a string, handling memory overlap.
Definition str_copy.c:34