plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

rune.c (429B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include <bio.h>
      4 #include <libsec.h>
      5 
      6 #include "iso9660.h"
      7 
      8 Rune*
      9 strtorune(Rune *r, char *s)
     10 {
     11 	Rune *or;
     12 
     13 	if(s == nil)
     14 		return nil;
     15 
     16 	or = r;
     17 	while(*s)
     18 		s += chartorune(r++, s);
     19 	*r = L'\0';
     20 	return or;
     21 }
     22 
     23 Rune*
     24 runechr(Rune *s, Rune c)
     25 {
     26 	for(; *s; s++)
     27 		if(*s == c)
     28 			return s;
     29 	return nil;
     30 }
     31 
     32 int
     33 runecmp(Rune *s, Rune *t)
     34 {
     35 	while(*s && *t && *s == *t)
     36 		s++, t++;
     37 	return *s - *t;
     38 }