"Fossies" - the Fresh Open Source Software Archive 
Member "unrar/uicommon.cpp" (4 May 2022, 1882 Bytes) of package /linux/misc/unrarsrc-6.1.7.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "uicommon.cpp" see the
Fossies "Dox" file reference documentation.
1 static SOUND_NOTIFY_MODE uiSoundNotify;
2
3 void uiInit(SOUND_NOTIFY_MODE Sound)
4 {
5 uiSoundNotify = Sound;
6 }
7
8
9 // Additionally to handling user input, it analyzes and sets command options.
10 // Returns only 'replace', 'skip' and 'cancel' codes.
11 UIASKREP_RESULT uiAskReplaceEx(RAROptions *Cmd,wchar *Name,size_t MaxNameSize,int64 FileSize,RarTime *FileTime,uint Flags)
12 {
13 if (Cmd->Overwrite==OVERWRITE_NONE)
14 return UIASKREP_R_SKIP;
15
16 #if !defined(SFX_MODULE) && !defined(SILENT)
17 // Must be before Cmd->AllYes check or -y switch would override -or.
18 if (Cmd->Overwrite==OVERWRITE_AUTORENAME && GetAutoRenamedName(Name,MaxNameSize))
19 return UIASKREP_R_REPLACE;
20 #endif
21
22 // This check must be after OVERWRITE_AUTORENAME processing or -y switch
23 // would override -or.
24 if (Cmd->AllYes || Cmd->Overwrite==OVERWRITE_ALL)
25 {
26 PrepareToDelete(Name);
27 return UIASKREP_R_REPLACE;
28 }
29
30 wchar NewName[NM];
31 wcsncpyz(NewName,Name,ASIZE(NewName));
32 UIASKREP_RESULT Choice=uiAskReplace(NewName,ASIZE(NewName),FileSize,FileTime,Flags);
33
34 if (Choice==UIASKREP_R_REPLACE || Choice==UIASKREP_R_REPLACEALL)
35 PrepareToDelete(Name);
36
37 if (Choice==UIASKREP_R_REPLACEALL)
38 {
39 Cmd->Overwrite=OVERWRITE_ALL;
40 return UIASKREP_R_REPLACE;
41 }
42 if (Choice==UIASKREP_R_SKIPALL)
43 {
44 Cmd->Overwrite=OVERWRITE_NONE;
45 return UIASKREP_R_SKIP;
46 }
47 if (Choice==UIASKREP_R_RENAME)
48 {
49 if (PointToName(NewName)==NewName)
50 SetName(Name,NewName,MaxNameSize);
51 else
52 wcsncpyz(Name,NewName,MaxNameSize);
53 if (FileExist(Name))
54 return uiAskReplaceEx(Cmd,Name,MaxNameSize,FileSize,FileTime,Flags);
55 return UIASKREP_R_REPLACE;
56 }
57 #if !defined(SFX_MODULE) && !defined(SILENT)
58 if (Choice==UIASKREP_R_RENAMEAUTO && GetAutoRenamedName(Name,MaxNameSize))
59 {
60 Cmd->Overwrite=OVERWRITE_AUTORENAME;
61 return UIASKREP_R_REPLACE;
62 }
63 #endif
64 return Choice;
65 }