xref: /csrg-svn/usr.bin/m4/TEST/string.m4 (revision 38817)
1*38817Sbostic#
2*38817Sbostic# Copyright (c) 1989 The Regents of the University of California.
3*38817Sbostic# All rights reserved.
4*38817Sbostic#
5*38817Sbostic# This code is derived from software contributed to Berkeley by
6*38817Sbostic# Ozan Yigit.
7*38817Sbostic#
8*38817Sbostic# Redistribution and use in source and binary forms are permitted
9*38817Sbostic# provided that the above copyright notice and this paragraph are
10*38817Sbostic# duplicated in all such forms and that any documentation,
11*38817Sbostic# advertising materials, and other materials related to such
12*38817Sbostic# distribution and use acknowledge that the software was developed
13*38817Sbostic# by the University of California, Berkeley.  The name of the
14*38817Sbostic# University may not be used to endorse or promote products derived
15*38817Sbostic# from this software without specific prior written permission.
16*38817Sbostic# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17*38817Sbostic# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18*38817Sbostic# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19*38817Sbostic#
20*38817Sbostic#	@(#)string.m4	5.1 (Berkeley) 08/28/89
21*38817Sbostic#
22*38817Sbostic
23*38817Sbosticdefine(string,`integer $1(len(substr($2,1)))
24*38817Sbosticstr($1,substr($2,1),0)
25*38817Sbosticdata $1(len(substr($2,1)))/EOS/
26*38817Sbostic')
27*38817Sbostic
28*38817Sbosticdefine(str,`ifelse($2,",,data $1(incr($3))/`LET'substr($2,0,1)/
29*38817Sbostic`str($1,substr($2,1),incr($3))')')
30