Rev | Line | |
---|
[9] | 1 | /*
|
---|
| 2 | * a small awk clone
|
---|
| 3 | *
|
---|
| 4 | * (C) 1989 Saeko Hirabauashi & Kouichi Hirabayashi
|
---|
| 5 | *
|
---|
| 6 | * Absolutely no warranty. Use this software with your own risk.
|
---|
| 7 | *
|
---|
| 8 | * Permission to use, copy, modify and distribute this software for any
|
---|
| 9 | * purpose and without fee is hereby granted, provided that the above
|
---|
| 10 | * copyright and disclaimer notice.
|
---|
| 11 | *
|
---|
| 12 | * This program was written to fit into 64K+64K memory of the Minix 1.2.
|
---|
| 13 | */
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 | #include <stdio.h>
|
---|
| 17 |
|
---|
| 18 | isKanji(c)
|
---|
| 19 | {
|
---|
| 20 | c &= 0xff;
|
---|
| 21 | return (c > 0x80 && c < 0xa0 || c > 0xdf && c < 0xfd);
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | jstrlen(s) char *s;
|
---|
| 25 | {
|
---|
| 26 | int i;
|
---|
| 27 |
|
---|
| 28 | for (i = 0; *s; i++, s++)
|
---|
| 29 | if (isKanji(*s))
|
---|
| 30 | s++;
|
---|
| 31 | return i;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | char *
|
---|
| 35 | jStrchr(s, c) char *s;
|
---|
| 36 | {
|
---|
| 37 | for ( ; *s; s++)
|
---|
| 38 | if (isKanji(*s))
|
---|
| 39 | s++;
|
---|
| 40 | else if (*s == c)
|
---|
| 41 | return s;
|
---|
| 42 | return NULL;
|
---|
| 43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.