source: trunk/minix/commands/awk/k.c@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 740 bytes
Line 
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
18isKanji(c)
19{
20 c &= 0xff;
21 return (c > 0x80 && c < 0xa0 || c > 0xdf && c < 0xfd);
22}
23
24jstrlen(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
34char *
35jStrchr(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.