예제 #1
0
파일: kanji.c 프로젝트: AllardJ/Tomato
static char *sj_strtok(char *s1, const char *s2)
{
  static char *s = NULL;
  char *q;
  if (!s1) {
    if (!s) {
      return NULL;
    }
    s1 = s;
  }
  for (q = s1; *s1; ) {
    if (is_shift_jis (*s1)) {
      s1 += 2;
    } else if (is_kana (*s1)) {
      s1++;
    } else {
      char *p = strchr (s2, *s1);
      if (p) {
        if (s1 != q) {
          s = s1 + 1;
          *s1 = '\0';
          return q;
        }
        q = s1 + 1;
      }
      s1++;
    }
  }
  s = NULL;
  if (*q) {
    return q;
  }
  return NULL;
}
예제 #2
0
파일: smbencrypt.c 프로젝트: kinkie/squid
void
strupper(char *s)
{
    while (*s) {
#if UNUSED_CODE
#if !defined(KANJI_WIN95_COMPATIBILITY)
        if (lp_client_code_page() == KANJI_CODEPAGE) {

            if (is_shift_jis(*s)) {
                if (is_sj_lower(s[0], s[1]))
                    s[1] = sj_toupper2(s[1]);
                s += 2;
            } else if (is_kana(*s)) {
                s++;
            } else {
                if (islower((int)(unsigned char)*s))
                    *s = toupper((int)(unsigned char)*s);
                s++;
            }
        } else
#endif /* KANJI_WIN95_COMPATIBILITY */
#endif /* UNUSED_CODE */
        {
            if (islower((int)(unsigned char)*s))
                *s = toupper((int)(unsigned char)*s);
            s++;
        }
    }
}
예제 #3
0
파일: kanji.c 프로젝트: AllardJ/Tomato
static size_t skip_kanji_multibyte_char(char c)
{
  if(is_shift_jis(c)) {
    return 2;
  } else if (is_kana(c)) {
    return 1;
  }
  return 0;
}
예제 #4
0
파일: util_str.c 프로젝트: ActionLuzifer/mc
/****************************************************************************
does a string have any lowercase chars in it?
****************************************************************************/
BOOL
strhaslower (const char *s)
{
    while (*s)
    {
#if !defined(KANJI_WIN95_COMPATIBILITY)
        /*
         * For completeness we should put in equivalent code for code pages
         * 949 (Korean hangul) and 950 (Big5 Traditional Chinese) here - but
         * doubt anyone wants Samba to behave differently from Win95 and WinNT
         * here. They both treat full width ascii characters as case senstive
         * filenames (ie. they don't do the work we do here).
         * JRA. 
         */

        if (lp_client_code_page () == KANJI_CODEPAGE)
        {
            /* Win95 treats full width ascii characters as case sensitive. */
            if (is_shift_jis (*s))
            {
                if (is_sj_upper (s[0], s[1]))
                    return (True);
                if (is_sj_lower (s[0], s[1]))
                    return (True);
                s += 2;
            }
            else if (is_kana (*s))
            {
                s++;
            }
            else
            {
                if (islower (*s))
                    return (True);
                s++;
            }
        }
        else
#endif /* KANJI_WIN95_COMPATIBILITY */
        {
            size_t skip = skip_multibyte_char (*s);
            if (skip != 0)
                s += skip;
            else
            {
                if (islower (*s))
                    return (True);
                s++;
            }
        }
    }
    return (False);
}
예제 #5
0
파일: mangle.c 프로젝트: tridge/junkcode
/*******************************************************************
  convert a string to upper case
********************************************************************/
void strupper(char *s)
{
    while (*s)
    {
#ifdef KANJI
        if (is_shift_jis (*s)) {
            s += 2;
        } else if (is_kana (*s)) {
            s++;
        } else {
            if (islower(*s))
                *s = toupper(*s);
            s++;
        }
#else
        if (islower(*s))
            *s = toupper(*s);
        s++;
#endif
    }
}