Changeset 14c331a in mainline for uspace/srv/fs/fat/fat_dentry.c


Ignore:
Timestamp:
2008-11-25T12:14:31Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
46321fb
Parents:
49df572
Message:

Consider "prd" and "prd." to be the same FAT dentry names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_dentry.c

    r49df572 r14c331a  
    3838#include "fat_dentry.h"
    3939#include <ctype.h>
     40#include <string.h>
    4041
    4142#define FAT_PAD                 ' '
     
    5253        else
    5354                return false;
     55}
     56
     57/** Compare path component with the name read from the dentry.
     58 *
     59 * This function compares the path component with the name read from the dentry.
     60 * The comparison is case insensitive and tolerates a mismatch on the trailing
     61 * dot character at the end of the name (i.e. when there is a dot, but no
     62 * extension).
     63 *
     64 * @param name          Node name read from the dentry.
     65 * @param component     Path component.
     66 *
     67 * @return              Zero on match, non-zero otherwise.
     68 */
     69int fat_dentry_namecmp(char *name, const char *component)
     70{
     71        int rc;
     72        if (!(rc = stricmp(name, component)))
     73                return rc;
     74        if (!strchr(name, '.')) {
     75                /*
     76                 * There is no '.' in the name, so we know that there is enough
     77                 * space for appending an extra '.' to name.
     78                 */
     79                name[strlen(name)] = '.';
     80                name[strlen(name) + 1] = '\0';
     81                rc = stricmp(name, component);
     82        }
     83        return rc;
    5484}
    5585
Note: See TracChangeset for help on using the changeset viewer.