SDDSlib
Loading...
Searching...
No Matches
clean_filename.c File Reference

Provides functions to manipulate and clean filename strings. More...

#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.
 

Detailed Description

Provides functions to manipulate and clean filename strings.

This file contains functions to create, manage, and manipulate buffers that store lines of text strings. Buffers can be dynamically created, added to, cleared, and printed to files.

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.

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 33 of file clean_filename.c.

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