Subversion Repositories HelenOS

Rev

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

Rev 3346 Rev 3364
Line 55... Line 55...
55
    { "force", no_argument, 0, 'f' },
55
    { "force", no_argument, 0, 'f' },
56
    { "safe", no_argument, 0, 's' },
56
    { "safe", no_argument, 0, 's' },
57
    { 0, 0, 0, 0 }
57
    { 0, 0, 0, 0 }
58
};
58
};
59
 
59
 
60
unsigned int rm_start(rm_job_t *rm)
60
static unsigned int rm_start(rm_job_t *rm)
61
{
61
{
62
    rm->recursive = 0;
62
    rm->recursive = 0;
63
    rm->force = 0;
63
    rm->force = 0;
64
    rm->safe = 0;
64
    rm->safe = 0;
65
 
65
 
Line 83... Line 83...
83
        return 0;
83
        return 0;
84
 
84
 
85
    return 1;
85
    return 1;
86
}
86
}
87
 
87
 
88
void rm_end(rm_job_t *rm)
88
static void rm_end(rm_job_t *rm)
89
{
89
{
90
    if (NULL != rm->nwd)
90
    if (NULL != rm->nwd)
91
        free(rm->nwd);
91
        free(rm->nwd);
92
 
92
 
93
    if (NULL != rm->owd)
93
    if (NULL != rm->owd)
Line 97... Line 97...
97
        free(rm->cwd);
97
        free(rm->cwd);
98
 
98
 
99
    return;
99
    return;
100
}
100
}
101
 
101
 
102
unsigned int rm_recursive(const char *path)
102
static unsigned int rm_recursive(const char *path)
103
{
103
{
104
    int rc;
104
    int rc;
105
 
105
 
106
    /* First see if it will just go away */
106
    /* First see if it will just go away */
107
    rc = rmdir(path);
107
    rc = rmdir(path);
Line 112... Line 112...
112
    cli_error(CL_ENOTSUP,
112
    cli_error(CL_ENOTSUP,
113
        "Can not remove %s, directory not empty", path);
113
        "Can not remove %s, directory not empty", path);
114
    return 1;
114
    return 1;
115
}
115
}
116
 
116
 
117
unsigned int rm_single(const char *path)
117
static unsigned int rm_single(const char *path)
118
{
118
{
119
    if (unlink(path)) {
119
    if (unlink(path)) {
120
        cli_error(CL_EFAIL, "rm: could not remove file %s", path);
120
        cli_error(CL_EFAIL, "rm: could not remove file %s", path);
121
        return 1;
121
        return 1;
122
    }
122
    }
123
    return 0;
123
    return 0;
124
}
124
}
125
 
125
 
126
unsigned int rm_scope(const char *path)
126
static unsigned int rm_scope(const char *path)
127
{
127
{
128
    int fd;
128
    int fd;
129
    DIR *dirp;
129
    DIR *dirp;
130
 
130
 
131
    dirp = opendir(path);
131
    dirp = opendir(path);