| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

strip_extension

#include "sflfile.h"
char *
strip_extension (
    char *name)

Synopsis

Removes dot and extension from the name, if any was present. If the name contained multiple extensions, removes the last one only. Returns name.

Source Code - (sflfile.c)

{
    char *dot, *slash;

    ASSERT (name);

    dot   = strrchr (name, '.');        /*  Find dot in name, if any         */
    slash = strrchr (name, '\\');       /*  Find last slash (DOS or Unix)    */
    if (slash == NULL)
        slash = strrchr (name, '/');
    if (dot > slash)
        *dot = 0;                       /*  If we had a dot, truncate name   */

    return (name);
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation