#!/bin/rc # # command: /bin/boddle /n/juke/plan_9/sys/src/cmd/eqn/text.c /n/dump/1995/0717/sys/src/cmd/eqn/text.c # srcdir: /n/juke/plan_9/sys/src/cmd/eqn # version: 811708041 # date: Thu Sep 21 14:27:21 EDT 1995 # myname=$0 doextract=no fn usage{ echo $myname: usage: $myname '[-X] [src-directory]' >[1=2] exit usage } fn sigint{ rm -rf 811708041 exit interrupt } while(~ $1 -*){ switch($1){ case -X doextract=yes case -* usage } shift } switch($#*){ case 0 srcdir=/sys/src/cmd/eqn case 1 srcdir=$1 case * usage } if(! ~ $doextract yes){ echo This shell file contains a bundle of diffs representing changes echo to original source files in the Plan 9 distribution. It will run echo against the files in echo ' ' $srcdir echo '(unless overridden by the optional source directory argument)' echo and create a directory 811708041 containing the updated files. echo It will NOT automatically update the original files. echo echo Invoke with argument -X to perform the actual extraction. exit 0 } rm -rf 811708041 mkdir 811708041 target=811708041/text.c echo -n '811708041/text.c: ' if(! test -f $srcdir/text.c || ! test -r $srcdir/text.c){ echo $srcdir/text.c unreadable exit unreadable } sum=`{sum < $srcdir/text.c} if(! ~ a7e590bb6294 $sum(1)^$sum(2)){ echo $srcdir/text.c is not the original distribution file exit original } cp $srcdir/text.c 811708041/text.c ed 811708041/text.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM text.c' 286c w = wctomb(csp, c); if(w > 0) /* ignore bad characters */ csp += w; . 264a int w; . 262c void cadd(int c) /* add character c to end of cs */ . 111c if (isdigitrune(c)) { . 106c if (isalpharune(c) && ft != ITAL) { /* other letter */ . 101c if (isalpharune(c) && ft == ITAL && c != 'f' && c != 'j') { /* italic letter */ . 96a int isalpharune(int c) { return ('a'<=c && c<='z') || ('A'<=c && c<='Z'); } int isdigitrune(int c) { return ('0'<=c && c<='9'); } . 74c for (psp = p1; (c = textc()) != '\0'; ) { . 39a int textc(void) /* read next UTF rune from psp */ { wchar_t r; int w; w = mbtowc(&r, psp, 3); if(w == 0){ psp++; return 0; } if(w < 0){ psp += 1; return 0x80; /* Plan 9-ism */ } psp += w; return r; } . wq //GO.SYSIN DD VADIM text.c sum=`{sum < 811708041/text.c} if(~ 0af492996732 $sum(1)^$sum(2)) echo if not{ echo 811708041/text.c checksum error creating updated file exit checksum }