1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
int replace(string target)
{
while (g_askReplace)
{
printf("`", target, "' exists.\n"
"Replace [?akNqy] ? ");
string answer = getch();
printf('\n');
if (answer == "a")
{
g_replace = 1;
g_askReplace = 0;
break;
}
if (answer == "k")
{
g_askReplace = 0;
g_modIcmconf = 0;
break;
}
if (answer == "y")
return 1;
if (answer == "q")
exit(0);
if (answer == "n" || answer == "\n")
{
if (target == "icmconf")
g_modIcmconf = 0;
return 0;
}
// ? or something else requested
printf("Press `a' : replace ", target, " and ALL remaining files,\n"
" `k' : KEEP ", target, " and all remaining files\n"
" `n' : (or press Enter) do NOT replace ", target,
" (default)\n"
" `q' : QUIT (do NOT replace ", target,
", and END icmstart NOW)\n"
" 'y' : REPLACE ", target, "\n"
" `?' : show this help\n");
}
return g_replace;
}
|