예제 #1
0
파일: wcslocal.c 프로젝트: shuowen/OpenNT
int
_wcsicmp(
    IN wchar_t * string1,
    IN wchar_t * string2
)
/*++
Routine Description :
    case insensitive comparition of two wide charecter strings.

Arguments :
    string1 : string to be compared
    string2 : string to be compared

Return Value :
    return  = if string1 == string2
            < 1 if string1 < string2
            > 1 if string1 > string2

--*/
{
    int ret = 0 ;

    while( !(ret = (int)wcsupper(*string1) - (int)wcsupper(*string2)) && *string2) {
        ++string1, ++string2;
    }

    if ( ret < 0 )
        ret = -1 ;
    else if ( ret > 0 )
        ret = 1 ;

    return ret;
}
예제 #2
0
파일: wcslocal.c 프로젝트: shuowen/OpenNT
int
wcsncmpi(
    IN const wchar_t * string1,
    IN const wchar_t * string2,
    IN size_t n
)
/*++
Routine Description :
    case insensitive comparition of two wide charecter strings of length upto
    'n' wide-charecters.

Arguments :
    string1 : string to be compared
    string2 : string to be compared

Return Value :
    return  = if string1 == string2
            < 1 if string1 < string2
            > 1 if string1 > string2

--*/
{
    int ret = 0 ;

    while(((ret = ((int)wcsupper(*string1) - (int)wcsupper(*string2))) == 0) &&
            ((int)*string2 != 0) &&
            (n != 0)) {
        ++string1, ++string2, n--;
    }

    if ( ret < 0 )
        ret = -1 ;
    else if ( ret > 0 )
        ret = 1 ;

    return ret;
}
예제 #3
0
void CommandData::ParseArg(wchar *Arg)
{
  if (IsSwitch(*Arg) && !NoMoreSwitches)
    if (Arg[1]=='-' && Arg[2]==0)
      NoMoreSwitches=true;
    else
      ProcessSwitch(Arg+1);
  else
    if (*Command==0)
    {
      wcsncpyz(Command,Arg,ASIZE(Command));


      *Command=toupperw(*Command);
      // 'I' and 'S' commands can contain case sensitive strings after
      // the first character, so we must not modify their case.
      // 'S' can contain SFX name, which case is important in Unix.
      if (*Command!='I' && *Command!='S')
        wcsupper(Command);
    }
    else
      if (*ArcName==0)
        wcsncpyz(ArcName,Arg,ASIZE(ArcName));
      else
      {
        // Check if last character is the path separator.
        size_t Length=wcslen(Arg);
        wchar EndChar=Length==0 ? 0:Arg[Length-1];
        bool EndSeparator=IsDriveDiv(EndChar) || IsPathDiv(EndChar);

        wchar CmdChar=toupperw(*Command);
        bool Add=wcschr(L"AFUM",CmdChar)!=NULL;
        bool Extract=CmdChar=='X' || CmdChar=='E';
        if (EndSeparator && !Add)
          wcsncpyz(ExtrPath,Arg,ASIZE(ExtrPath));
        else
          if ((Add || CmdChar=='T') && (*Arg!='@' || ListMode==RCLM_REJECT_LISTS))
            FileArgs.AddString(Arg);
          else
          {
            FindData FileData;
            bool Found=FindFile::FastFind(Arg,&FileData);
            if ((!Found || ListMode==RCLM_ACCEPT_LISTS) && 
                ListMode!=RCLM_REJECT_LISTS && *Arg=='@' && !IsWildcard(Arg))
            {
              FileLists=true;

              ReadTextFile(Arg+1,&FileArgs,false,true,FilelistCharset,true,true,true);

            }
            else
              if (Found && FileData.IsDir && Extract && *ExtrPath==0)
              {
                wcsncpyz(ExtrPath,Arg,ASIZE(ExtrPath));
                AddEndSlash(ExtrPath,ASIZE(ExtrPath));
              }
              else
                FileArgs.AddString(Arg);
          }
      }
}