Subversion Repositories HelenOS

Rev

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

Rev 3294 Rev 3309
Line 70... Line 70...
70
    return LS_BOGUS;
70
    return LS_BOGUS;
71
}
71
}
72
 
72
 
73
void ls_print(const char *f)
73
void ls_print(const char *f)
74
{
74
{
-
 
75
    unsigned int scope;
-
 
76
 
75
    if (ls_scope(f) == LS_FILE)
77
    scope = ls_scope(f);
-
 
78
 
-
 
79
    /* If this function is called in a readdir loop, LS_BOGUS
-
 
80
     * can be treated as LS_FILE, since we aren't presenting
-
 
81
     * the full path to open(), just pointer->d_name as obtained
-
 
82
     * from opendir(). This will not happen if ../path/to/file
-
 
83
     * is passed, as may be the argument to ls */
-
 
84
 
76
        printf("%-40s\n", f);
85
    switch (scope) {
77
    else
86
    case LS_DIR:
78
        printf("%-40s <DIR>\n", f);
87
        printf("%-40s <DIR>\n", f);
-
 
88
        break;
-
 
89
    case LS_FILE:
-
 
90
        printf("%-40s\n", f);
-
 
91
        break;
-
 
92
    /* This is never reached unless in a readdir() loop */
-
 
93
    case LS_BOGUS:
-
 
94
        printf("%-40s\n", f);
-
 
95
        break;
-
 
96
    }
79
    return;
97
    return;
80
}
98
}
81
 
99
 
82
/* Dispays help for ls in various levels */
100
/* Dispays help for ls in various levels */
83
void * help_cmd_ls(unsigned int level)
101
void * help_cmd_ls(unsigned int level)
Line 96... Line 114...
96
int * cmd_ls(char **argv)
114
int * cmd_ls(char **argv)
97
{
115
{
98
    unsigned int argc;
116
    unsigned int argc;
99
    unsigned int scope;
117
    unsigned int scope;
100
    char *buff;
118
    char *buff;
-
 
119
    char s[PATH_MAX];
101
 
120
 
102
    DIR *dirp;
121
    DIR *dirp;
103
    struct dirent *dp;
122
    struct dirent *dp;
104
 
123
 
105
    /* Count the arguments */
124
    /* Count the arguments */