~ubuntu-branches/ubuntu/raring/unrar-nonfree/raring-proposed

« back to all changes in this revision

Viewing changes to cmddata.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Martin Meredith
  • Date: 2010-03-26 10:23:49 UTC
  • mfrom: (1.1.12 upstream) (5.1.10 sid)
  • Revision ID: james.westby@ubuntu.com-20100326102349-v1oi9pg7orpuko6y
Tags: 1:3.9.10-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
  if (FileArgs->ItemsCount()==0 && !FileLists)
134
134
    FileArgs->AddString(MASKALL);
135
135
  char CmdChar=etoupper(*Command);
136
 
  bool Extract=CmdChar=='X' || CmdChar=='E';
 
136
  bool Extract=CmdChar=='X' || CmdChar=='E' || CmdChar=='P';
137
137
  if (Test && Extract)
138
 
    Test=false;
 
138
    Test=false;        // Switch '-t' is senseless for 'X', 'E', 'P' commands.
139
139
  BareOutput=(CmdChar=='L' || CmdChar=='V') && Command[1]=='B';
140
140
}
141
141
 
194
194
    char *Str;
195
195
    while ((Str=List.GetString())!=NULL)
196
196
    {
197
 
      while (isspace(*Str))
 
197
      while (IsSpace(*Str))
198
198
        Str++;
199
199
      if (strnicomp(Str,"switches=",9)==0)
200
200
        ProcessSwitchesString(Str+9);
515
515
              break;
516
516
          }
517
517
          break;
518
 
        case 'D':
519
 
          ExclEmptyDir=true;
520
 
          break;
521
518
        case 'E':
522
519
          ProcessEA=false;
523
520
          break;
576
573
                int Param1=0,Param2=0;
577
574
                FilterState State=FILTER_AUTO;
578
575
                FilterType Type=FILTER_NONE;
579
 
                if (isdigit(*Str))
 
576
                if (IsDigit(*Str))
580
577
                {
581
578
                  Param1=atoi(Str);
582
 
                  while (isdigit(*Str))
 
579
                  while (IsDigit(*Str))
583
580
                    Str++;
584
581
                }
585
 
                if (*Str==':' && isdigit(Str[1]))
 
582
                if (*Str==':' && IsDigit(Str[1]))
586
583
                {
587
584
                  Param2=atoi(++Str);
588
 
                  while (isdigit(*Str))
 
585
                  while (IsDigit(*Str))
589
586
                    Str++;
590
587
                }
591
588
                switch(etoupper(*(Str++)))
770
767
        else
771
768
          GetConfigName(SFXName,SFXModule,true);
772
769
      }
773
 
      if (isdigit(Switch[1]))
 
770
      if (IsDigit(Switch[1]))
774
771
      {
775
772
        Solid|=SOLID_COUNT;
776
773
        SolidCount=atoi(&Switch[1]);
794
791
            Solid|=SOLID_VOLUME_DEPENDENT;
795
792
            break;
796
793
          case 'L':
797
 
            if (isdigit(Switch[2]))
 
794
            if (IsDigit(Switch[2]))
798
795
              FileSizeLess=atoil(Switch+2);
799
796
            break;
800
797
          case 'M':
801
 
            if (isdigit(Switch[2]))
 
798
            if (IsDigit(Switch[2]))
802
799
              FileSizeMore=atoil(Switch+2);
803
800
            break;
804
801
          case 'C':
956
953
    MCHelpSwTB,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU,MCHelpSwVUnr,
957
954
    MCHelpSwVER,MCHelpSwVP,MCHelpSwX,MCHelpSwXa,MCHelpSwXal,MCHelpSwY
958
955
#else
959
 
    // RAR switches definition.
960
 
    MRARTitle1,MRARTitle2,MCHelpCmd,MCHelpCmdA,MCHelpCmdC,MCHelpCmdCF,
961
 
    MCHelpCmdCH,MCHelpCmdCW,MCHelpCmdD,MCHelpCmdE,MCHelpCmdF,MCHelpCmdI,
962
 
    MCHelpCmdK,MCHelpCmdL,MCHelpCmdM,MCHelpCmdP,MCHelpCmdR,MCHelpCmdRC,
963
 
    MCHelpCmdRN,MCHelpCmdRR,MCHelpCmdRV,MCHelpCmdS,MCHelpCmdT,MCHelpCmdU,
964
 
    MCHelpCmdV,MCHelpCmdX,MCHelpSw,MCHelpSwm,MCHelpSwAC,MCHelpSwAD,MCHelpSwAG,
965
 
    MCHelpSwAI,MCHelpSwAO,MCHelpSwAP,MCHelpSwAS,MCHelpSwAV,MCHelpSwAVm,
966
 
    MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,MCHelpSwDF,MCHelpSwDH,
967
 
    MCHelpSwDR,MCHelpSwDS,MCHelpSwDW,MCHelpSwEa,MCHelpSwED,MCHelpSwEE,
968
 
    MCHelpSwEN,MCHelpSwEP,MCHelpSwEP1,MCHelpSwEP2,MCHelpSwEP3,MCHelpSwF,
969
 
    MCHelpSwHP,MCHelpSwIDP,MCHelpSwIEML,MCHelpSwIERR,MCHelpSwILOG,MCHelpSwINUL,
970
 
    MCHelpSwIOFF,MCHelpSwISND,MCHelpSwK,MCHelpSwKB,MCHelpSwMn,MCHelpSwMC,
971
 
    MCHelpSwMD,MCHelpSwMS,MCHelpSwMT,MCHelpSwN,MCHelpSwNa,MCHelpSwNal,
972
 
    MCHelpSwO,MCHelpSwOC,MCHelpSwOL,MCHelpSwOR,MCHelpSwOS,MCHelpSwOW,
973
 
    MCHelpSwP,MCHelpSwPm,MCHelpSwR,MCHelpSwRm,MCHelpSwR0,MCHelpSwRI,
974
 
    MCHelpSwRR,MCHelpSwRV,MCHelpSwS,MCHelpSwSm,MCHelpSwSC,MCHelpSwSFX,
975
 
    MCHelpSwSI,MCHelpSwSL,MCHelpSwSM,MCHelpSwT,MCHelpSwTA,MCHelpSwTB,
976
 
    MCHelpSwTK,MCHelpSwTL,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU,
977
 
    MCHelpSwV,MCHelpSwVn,MCHelpSwVD,MCHelpSwVER,MCHelpSwVN,MCHelpSwVP,
978
 
    MCHelpSwW,MCHelpSwX,MCHelpSwXa,MCHelpSwXal,MCHelpSwY,MCHelpSwZ
979
956
#endif
980
957
  };
981
958
 
1060
1037
}
1061
1038
 
1062
1039
 
1063
 
bool CommandData::ExclCheck(char *CheckName,bool CheckFullPath)
 
1040
// Return 'true' if we need to exclude the file from processing as result
 
1041
// of -x switch. If CheckInclList is true, we also check the file against
 
1042
// the include list created with -n switch.
 
1043
bool CommandData::ExclCheck(char *CheckName,bool CheckFullPath,bool CheckInclList)
1064
1044
{
1065
1045
  if (ExclCheckArgs(ExclArgs,CheckName,CheckFullPath,MATCH_WILDSUBPATH))
1066
1046
    return(true);
1067
 
  if (InclArgs->ItemsCount()==0)
 
1047
  if (!CheckInclList || InclArgs->ItemsCount()==0)
1068
1048
    return(false);
1069
1049
  if (ExclCheckArgs(InclArgs,CheckName,false,MATCH_WILDSUBPATH))
1070
1050
    return(false);
1072
1052
}
1073
1053
 
1074
1054
 
 
1055
// Return 'true' if we need to exclude the directory from archiving as result
 
1056
// of -x switch. We do not want -x*. switch to exclude all directories,
 
1057
// so when archiving we process exclusion arguments for directories specially.
 
1058
bool CommandData::ExclCheckDir(char *CheckName)
 
1059
{
 
1060
  // If exclusion mask and directory name match exactly, return true.
 
1061
  if (ExclCheckArgs(ExclArgs,CheckName,true,MATCH_EXACT))
 
1062
    return(true);
 
1063
 
 
1064
  // Now we want to allow wildcards in exclusion mask only if it has
 
1065
  // '\' at the end. So 'dir*\' will exclude all dir* directories.
 
1066
  // We append '\' to directory name, so it will match only masks having
 
1067
  // '\' at the end.
 
1068
  char DirName[NM+1];
 
1069
  ConvertPath(CheckName,DirName);
 
1070
  AddEndSlash(DirName);
 
1071
 
 
1072
  char *CurMask;
 
1073
  ExclArgs->Rewind();
 
1074
  while ((CurMask=ExclArgs->GetString())!=NULL)
 
1075
    if (IsPathDiv(*PointToLastChar(CurMask)))
 
1076
      if (CmpName(CurMask,DirName,MATCH_SUBPATH))
 
1077
        return(true);
 
1078
  
 
1079
  return(false);
 
1080
}
 
1081
 
 
1082
 
1075
1083
 
1076
1084
 
1077
1085
#ifndef SFX_MODULE
 
1086
// Return 'true' if we need to exclude the file from processing.
1078
1087
bool CommandData::TimeCheck(RarTime &ft)
1079
1088
{
1080
1089
  if (FileTimeBefore.IsSet() && ft>=FileTimeBefore)
1087
1096
 
1088
1097
 
1089
1098
#ifndef SFX_MODULE
 
1099
// Return 'true' if we need to exclude the file from processing.
1090
1100
bool CommandData::SizeCheck(int64 Size)
1091
1101
{
1092
1102
  if (FileSizeLess!=INT64NDF && Size>=FileSizeLess)
1104
1114
{
1105
1115
  if (strlen(NewLhd.FileName)>=NM || strlenw(NewLhd.FileNameW)>=NM)
1106
1116
    return(0);
1107
 
  if (ExclCheck(NewLhd.FileName,false))
 
1117
  if (ExclCheck(NewLhd.FileName,false,true))
1108
1118
    return(0);
1109
1119
#ifndef SFX_MODULE
1110
1120
  if (TimeCheck(NewLhd.mtime))
1242
1252
#ifndef SFX_MODULE
1243
1253
uint CommandData::GetExclAttr(char *Str)
1244
1254
{
1245
 
  if (isdigit(*Str))
 
1255
  if (IsDigit(*Str))
1246
1256
    return(strtol(Str,NULL,0));
1247
1257
  else
1248
1258
  {