Changeset 0ce9eb8 in mainline for uspace/app/copy/copy.c
- Timestamp:
- 2026-02-10T12:52:07Z (8 days ago)
- Branches:
- master
- Children:
- 857fba8
- Parents:
- 26a9388
- git-author:
- Jiri Svoboda <jiri@…> (2026-02-10 18:51:59)
- git-committer:
- Jiri Svoboda <jiri@…> (2026-02-10 12:52:07)
- File:
-
- 1 edited
-
uspace/app/copy/copy.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/copy/copy.c
r26a9388 r0ce9eb8 1 1 /* 2 * Copyright (c) 202 5Jiri Svoboda2 * Copyright (c) 2026 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 49 49 static void copy_progress(void *, fmgt_progress_t *); 50 50 static fmgt_error_action_t copy_io_error_query(void *, fmgt_io_error_t *); 51 static fmgt_exists_action_t copy_exists_query(void *, fmgt_exists_t *); 51 52 52 53 static bool prog_upd = false; … … 59 60 .abort_query = copy_abort_query, 60 61 .io_error_query = copy_io_error_query, 62 .exists_query = copy_exists_query, 61 63 .progress = copy_progress, 62 64 }; … … 188 190 if (ev->key == KC_C) 189 191 return fmgt_er_abort; 192 } 193 } 194 } 195 } 196 197 /** Called by fmgt to let user choose destination exists recovery action. 198 * 199 * @param arg Argument (not used) 200 * @param err I/O error report 201 * @return Error recovery action. 202 */ 203 static fmgt_exists_action_t copy_exists_query(void *arg, fmgt_exists_t *exists) 204 { 205 cons_event_t event; 206 kbd_event_t *ev; 207 errno_t rc; 208 209 (void)arg; 210 211 if (nonint) 212 return fmgt_exr_abort; 213 214 if (prog_upd) 215 putchar('\n'); 216 217 fprintf(stderr, "File %s exists.\n", exists->fname); 218 fprintf(stderr, "[O]verwrite, [S]kip or [A]bort?\n"); 219 220 if (con == NULL) 221 return fmgt_exr_abort; 222 223 while (true) { 224 rc = console_get_event(con, &event); 225 if (rc != EOK) 226 return fmgt_exr_abort; 227 228 if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS) { 229 ev = &event.ev.key; 230 if ((ev->mods & KM_ALT) == 0 && 231 (ev->mods & KM_CTRL) == 0) { 232 if (ev->c == 'o' || ev->c == 'O') 233 return fmgt_exr_overwrite; 234 if (ev->c == 's' || ev->c == 'S') 235 return fmgt_exr_skip; 236 if (ev->c == 'a' || ev->c == 'A') 237 return fmgt_exr_abort; 238 } 239 } 240 241 if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS) { 242 ev = &event.ev.key; 243 if ((ev->mods & KM_ALT) == 0 && 244 (ev->mods & KM_SHIFT) == 0 && 245 (ev->mods & KM_CTRL) != 0) { 246 if (ev->key == KC_C) 247 return fmgt_exr_abort; 190 248 } 191 249 } … … 256 314 putchar('\n'); 257 315 if (rc != EOK) { 258 printf("Error c reating file: %s.\n", str_error(rc));316 printf("Error copying file(s): %s.\n", str_error(rc)); 259 317 goto error; 260 318 }
Note:
See TracChangeset
for help on using the changeset viewer.
