"Fossies" - the Fresh Open Source Software Archive

Member "unrar/cmdmix.cpp" (4 May 2022, 3076 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 "cmdmix.cpp" see the Fossies "Dox" file reference documentation.

    1 void CommandData::OutTitle()
    2 {
    3   if (BareOutput || DisableCopyright)
    4     return;
    5 #if defined(__GNUC__) && defined(SFX_MODULE)
    6   mprintf(St(MCopyrightS));
    7 #else
    8 #ifndef SILENT
    9   static bool TitleShown=false;
   10   if (TitleShown)
   11     return;
   12   TitleShown=true;
   13 
   14   wchar Version[80];
   15   if (RARVER_BETA!=0)
   16     swprintf(Version,ASIZE(Version),L"%d.%02d %ls %d",RARVER_MAJOR,RARVER_MINOR,St(MBeta),RARVER_BETA);
   17   else
   18     swprintf(Version,ASIZE(Version),L"%d.%02d",RARVER_MAJOR,RARVER_MINOR);
   19 #if defined(_WIN_32) || defined(_WIN_64)
   20   wcsncatz(Version,L" ",ASIZE(Version));
   21 #endif
   22 #ifdef _WIN_32
   23   wcsncatz(Version,St(Mx86),ASIZE(Version));
   24 #endif
   25 #ifdef _WIN_64
   26   wcsncatz(Version,St(Mx64),ASIZE(Version));
   27 #endif
   28   if (PrintVersion)
   29   {
   30     mprintf(L"%s",Version);
   31     exit(0);
   32   }
   33   mprintf(St(MUCopyright),Version,RARVER_YEAR);
   34 #endif
   35 #endif
   36 }
   37 
   38 
   39 inline bool CmpMSGID(MSGID i1,MSGID i2)
   40 {
   41 #ifdef MSGID_INT
   42   return i1==i2;
   43 #else
   44   // If MSGID is const char*, we cannot compare pointers only.
   45   // Pointers to different instances of same string can differ,
   46   // so we need to compare complete strings.
   47   return wcscmp(i1,i2)==0;
   48 #endif
   49 }
   50 
   51 void CommandData::OutHelp(RAR_EXIT ExitCode)
   52 {
   53 #if !defined(SILENT)
   54   OutTitle();
   55   static MSGID Help[]={
   56 #ifdef SFX_MODULE
   57     // Console SFX switches definition.
   58     MCHelpCmd,MSHelpCmdE,MSHelpCmdT,MSHelpCmdV
   59 #else
   60     // UnRAR switches definition.
   61     MUNRARTitle1,MRARTitle2,MCHelpCmd,MCHelpCmdE,MCHelpCmdL,
   62     MCHelpCmdP,MCHelpCmdT,MCHelpCmdV,MCHelpCmdX,MCHelpSw,MCHelpSwm,
   63     MCHelpSwAT,MCHelpSwAC,MCHelpSwAD,MCHelpSwAG,MCHelpSwAI,MCHelpSwAP,
   64     MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,MCHelpSwDH,MCHelpSwEP,
   65     MCHelpSwEP3,MCHelpSwEP4,MCHelpSwF,MCHelpSwIDP,MCHelpSwIERR,
   66     MCHelpSwINUL,MCHelpSwIOFF,MCHelpSwKB,MCHelpSwME,MCHelpSwN,MCHelpSwNa,
   67     MCHelpSwNal,MCHelpSwO,MCHelpSwOC,MCHelpSwOL,MCHelpSwOP,MCHelpSwOR,
   68     MCHelpSwOW,MCHelpSwP,MCHelpSwR,MCHelpSwRI,MCHelpSwSC,MCHelpSwSI,
   69     MCHelpSwSL,MCHelpSwSM,MCHelpSwTA,MCHelpSwTB,MCHelpSwTN,MCHelpSwTO,
   70     MCHelpSwTS,MCHelpSwU,MCHelpSwVUnr,MCHelpSwVER,MCHelpSwVP,MCHelpSwX,
   71     MCHelpSwXa,MCHelpSwXal,MCHelpSwY
   72 #endif
   73   };
   74 
   75   for (uint I=0;I<ASIZE(Help);I++)
   76   {
   77 #ifndef SFX_MODULE
   78     if (CmpMSGID(Help[I],MCHelpSwV))
   79       continue;
   80 #ifndef _WIN_ALL
   81     static MSGID Win32Only[]={
   82       MCHelpSwIEML,MCHelpSwVD,MCHelpSwAO,MCHelpSwOS,MCHelpSwIOFF,
   83       MCHelpSwEP2,MCHelpSwOC,MCHelpSwONI,MCHelpSwDR,MCHelpSwRI
   84     };
   85     bool Found=false;
   86     for (uint J=0;J<ASIZE(Win32Only);J++)
   87       if (CmpMSGID(Help[I],Win32Only[J]))
   88       {
   89         Found=true;
   90         break;
   91       }
   92     if (Found)
   93       continue;
   94 #endif
   95 #if !defined(_UNIX) && !defined(_WIN_ALL)
   96     if (CmpMSGID(Help[I],MCHelpSwOW))
   97       continue;
   98 #endif
   99 #if !defined(_WIN_ALL) && !defined(_EMX)
  100     if (CmpMSGID(Help[I],MCHelpSwAC))
  101       continue;
  102 #endif
  103 #ifndef SAVE_LINKS
  104     if (CmpMSGID(Help[I],MCHelpSwOL))
  105       continue;
  106 #endif
  107 #ifndef RAR_SMP
  108     if (CmpMSGID(Help[I],MCHelpSwMT))
  109       continue;
  110 #endif
  111 #endif
  112     mprintf(St(Help[I]));
  113   }
  114   mprintf(L"\n");
  115   ErrHandler.Exit(ExitCode);
  116 #endif
  117 }
  118