Subversion Repositories HelenOS

Rev

Rev 3628 | Rev 3638 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3628 Rev 3634
Line 35... Line 35...
35
 * @brief   Functions that work with FAT directory entries.
35
 * @brief   Functions that work with FAT directory entries.
36
 */
36
 */
37
 
37
 
38
#include "fat_dentry.h"
38
#include "fat_dentry.h"
39
#include <ctype.h>
39
#include <ctype.h>
-
 
40
#include <string.h>
40
 
41
 
41
#define FAT_PAD         ' ' 
42
#define FAT_PAD         ' ' 
42
 
43
 
43
#define FAT_DENTRY_UNUSED   0x00
44
#define FAT_DENTRY_UNUSED   0x00
44
#define FAT_DENTRY_E5_ESC   0x05
45
#define FAT_DENTRY_E5_ESC   0x05
Line 51... Line 52...
51
        return true;
52
        return true;
52
    else
53
    else
53
        return false;
54
        return false;
54
}
55
}
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
 */
-
 
69
int 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;
-
 
84
}
-
 
85
 
56
bool fat_dentry_name_verify(const char *name)
86
bool fat_dentry_name_verify(const char *name)
57
{
87
{
58
    unsigned i, dot;
88
    unsigned i, dot;
59
    bool dot_found = false;
89
    bool dot_found = false;
60
   
90