=== modified file 'uspace/app/bdsh/cmds/modules/cp/cp.c'
--- uspace/app/bdsh/cmds/modules/cp/cp.c	2011-10-29 17:02:30 +0000
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	2012-04-03 15:30:25 +0000
@@ -49,6 +49,7 @@
 static struct option const long_options[] = {
 	{ "buffer", required_argument, 0, 'b' },
 	{ "force", no_argument, 0, 'f' },
+        { "interactive", no_argument, 0, 'i'},
 	{ "recursive", no_argument, 0, 'r' },
 	{ "help", no_argument, 0, 'h' },
 	{ "version", no_argument, 0, 'v' },
@@ -139,9 +140,9 @@
 }
 
 static int64_t do_copy(const char *src, const char *dest,
-    size_t blen, int vb, int recursive, int force)
+    size_t blen, int vb, int recursive, int force, int interactive)
 {
-	int r = -1;
+	int r = 0;
 	char dest_path[PATH_MAX];
 	char src_path[PATH_MAX];
 	DIR *dir = NULL;
@@ -191,16 +192,49 @@
 		} else if (dest_type == TYPE_FILE) {
 			/* e.g. cp file_name existing_file */
 
-			/* dest already exists, if force is set we will
-			 * try to remove it.
+			/* dest already exists, 
+                         * if force is set we will try to remove it.
+                         * if interactive is set user input is required.
 			 */
-			if (force) {
+			if (force && !interactive) {
 				if (unlink(dest_path)) {
 					printf("Unable to remove %s\n",
 					    dest_path);
+                                        r = -1;
 					goto exit;
 				}
-			} else {
+			} else if (!force && interactive) {
+                                char test_char = 'n';
+
+                                do {
+                                        printf("File already exists: %s. "
+                                                "Overwrite? [y/N]: ", dest_path);
+                                        test_char = fgetc(stdin);
+                                        if('\n' == test_char)
+                                                test_char = 'n';
+                                        printf("%c\n", test_char);
+
+                                        switch(test_char) {
+                                        case 'y':
+                                        case 'Y':
+                                                printf("Overwriting file: %s\n",
+                                                        dest_path);
+                                                if (unlink(dest_path)) {
+                                                        printf("Unable to remove %s\n",
+                                                                dest_path);
+                                                        r = -1;
+                                                        goto exit;
+                                                }
+                                                break;
+                                        case 'n':
+                                        case 'N':
+                                                printf("Not overwriting file: %s\n",
+                                                        dest_path);
+                                                goto exit;
+                                                break;
+                                        }
+                                } while(test_char != 'y' && test_char !='Y');
+                        } else {
 				printf("file already exists: %s\n", dest_path);
 				goto exit;
 			}
@@ -301,7 +335,7 @@
 
 			/* Recursively call do_copy() */
 			r = do_copy(src_dent, dest_dent, blen, vb, recursive,
-			    force);
+			    force, interactive);
 			if (r)
 				goto exit;
 
@@ -379,7 +413,8 @@
 	    "  -h, --help       A short option summary\n"
 	    "  -v, --version    Print version information and exit\n"
 	    "  -V, --verbose    Be annoyingly noisy about what's being done\n"
-	    "  -f, --force      Do not complain when <dest> exists\n"
+	    "  -f, --force      Do not complain when <dest> exists (overrides a previous -i)\n"
+            "  -i, --interactive Ask what to do when <dest> exists (overrides a previous -f)\n"
 	    "  -r, --recursive  Copy entire directories\n"
 	    "  -b, --buffer ## Set the read buffer size to ##\n";
 	if (level == HELP_SHORT) {
@@ -396,14 +431,14 @@
 {
 	unsigned int argc, verbose = 0;
 	int buffer = 0, recursive = 0;
-	int force = 0;
+	int force = 0, interactive = 0;
 	int c, opt_ind;
 	int64_t ret;
 
 	argc = cli_count_args(argv);
 
 	for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
-		c = getopt_long(argc, argv, "hvVfrb:", long_options, &opt_ind);
+		c = getopt_long(argc, argv, "hvVfirb:", long_options, &opt_ind);
 		switch (c) { 
 		case 'h':
 			help_cmd_cp(1);
@@ -415,8 +450,13 @@
 			verbose = 1;
 			break;
 		case 'f':
+                        interactive = 0;
 			force = 1;
 			break;
+                case 'i':
+                        force = 0;
+                        interactive = 1;
+                        break;
 		case 'r':
 			recursive = 1;
 			break;
@@ -445,7 +485,7 @@
 	}
 
 	ret = do_copy(argv[optind], argv[optind + 1], buffer, verbose,
-	    recursive, force);
+	    recursive, force, interactive);
 
 	if (ret == 0)
 		return CMD_SUCCESS;

