k.c

Go to the documentation of this file.
00001 /*
00002  * a small awk clone
00003  *
00004  * (C) 1989 Saeko Hirabauashi & Kouichi Hirabayashi
00005  *
00006  * Absolutely no warranty. Use this software with your own risk.
00007  *
00008  * Permission to use, copy, modify and distribute this software for any
00009  * purpose and without fee is hereby granted, provided that the above
00010  * copyright and disclaimer notice.
00011  *
00012  * This program was written to fit into 64K+64K memory of the Minix 1.2.
00013  */
00014 
00015 
00016 #include <stdio.h>
00017 
00018 isKanji(c)
00019 {
00020   c &= 0xff;
00021   return (c > 0x80 && c < 0xa0 || c > 0xdf && c < 0xfd);
00022 }
00023 
00024 jstrlen(s) char *s;
00025 {
00026   int i;
00027 
00028   for (i = 0; *s; i++, s++)
00029         if (isKanji(*s))
00030                 s++;
00031   return i;
00032 }
00033 
00034 char *
00035 jStrchr(s, c) char *s;
00036 {
00037   for ( ; *s; s++)
00038         if (isKanji(*s))
00039                 s++;
00040         else if (*s == c)
00041                 return s;
00042   return NULL;
00043 }

Generated on Fri Apr 14 22:56:41 2006 for minix by  doxygen 1.4.6