| 190 | } |
| 191 | |
| 192 | void copyFile(const char *src, const char *dst) |
| 193 | { |
| 194 | ssize_t rd, wr; |
| 195 | char buf[1024], *fnd; |
| 196 | int s, d; |
| 197 | |
| 198 | // assume the source is case-insensitive |
| 199 | fnd = findFileObjectNoCase(src, false); |
| 200 | if (!fnd) |
| 201 | return; |
| 202 | |
| 203 | s = open(fnd, O_RDONLY); |
| 204 | free(fnd); |
| 205 | if (!s) |
| 206 | return; |
| 207 | d = open(dst, O_WRONLY | O_CREAT, 00644); |
| 208 | if (!d) { |
| 209 | close(s); |
| 210 | return; |
| 211 | } |
| 212 | |
| 213 | do { |
| 214 | rd = read(s, buf, 1024); |
| 215 | if (rd <= 0) |
| 216 | break; |
| 217 | wr = write(d, buf, rd); |
| 218 | if (wr < 0 || wr != rd) |
| 219 | break; |
| 220 | } while (rd > 0); |
| 221 | close(d); |
| 222 | close(s); |
| 223 | } |
| 224 | |
| 225 | void deleteFile(const char *fn) |
| 226 | { |
nothing calls this directly
no test coverage detected