Subversion Repositories HelenOS

Rev

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

Rev 3413 Rev 3814
Line 48... Line 48...
48
#include "ls.h"
48
#include "ls.h"
49
#include "cmds.h"
49
#include "cmds.h"
50
 
50
 
51
static char *cmdname = "ls";
51
static char *cmdname = "ls";
52
 
52
 
-
 
53
static inline uint64_t flen(const char *f)
-
 
54
{
-
 
55
    int fd;
-
 
56
    uint64_t size;
-
 
57
 
-
 
58
    fd = open(f, O_RDONLY);
-
 
59
    if (fd == -1)
-
 
60
        return 0;
-
 
61
 
-
 
62
    size = lseek(fd, 0, SEEK_END);
-
 
63
    close(fd);
-
 
64
 
-
 
65
    if (size < 0)
-
 
66
        size = 0;
-
 
67
 
-
 
68
    return size;
-
 
69
}
-
 
70
 
53
static unsigned int ls_scope(const char *path)
71
static unsigned int ls_scope(const char *path)
54
{
72
{
55
    int fd;
73
    int fd;
56
    DIR *dirp;
74
    DIR *dirp;
57
 
75
 
Line 118... Line 136...
118
 *
136
 *
119
 * Now we just print basic DOS style lists */
137
 * Now we just print basic DOS style lists */
120
 
138
 
121
static void ls_print_dir(const char *d)
139
static void ls_print_dir(const char *d)
122
{
140
{
123
    printf("%-40s\t<DIR>\n", d);
141
    printf("%-40s\t<dir>\n", d);
124
 
142
 
125
    return;
143
    return;
126
}
144
}
127
 
145
 
128
static void ls_print_file(const char *f)
146
static void ls_print_file(const char *f)
129
{
147
{
130
    printf("%-40s\n", f);
148
    printf("%-40s\t%u\n", f, flen(f));
131
 
149
 
132
    return;
150
    return;
133
}
151
}
134
 
152
 
135
void help_cmd_ls(unsigned int level)
153
void help_cmd_ls(unsigned int level)