Module Name: othersrc
Committed By: agc
Date: Sat Jun 1 22:26:11 UTC 2013
Added Files:
othersrc/external/historical/eawk/scripts: bg.sh
Log Message:
add a script to exercise the buffer gap routines
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/historical/eawk/scripts/bg.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Added files:
Index: othersrc/external/historical/eawk/scripts/bg.sh
diff -u /dev/null othersrc/external/historical/eawk/scripts/bg.sh:1.1
--- /dev/null Sat Jun 1 22:26:11 2013
+++ othersrc/external/historical/eawk/scripts/bg.sh Sat Jun 1 22:26:11 2013
@@ -0,0 +1,23 @@
+#! /bin/sh
+
+env LD_LIBRARY_PATH=lib:extend/bufgap bin/eawk -v f=$1 '
+BEGIN {
+ use("bufgap");
+ gap = bufgap_alloc();
+ if (bufgap_open(gap, f) == 0) print "phooey#1";
+ for (i = bufgap_size(gap, BGByte) - 1 ; i >= 0 ; --i) {
+ printf("%c", bufgap_peek(gap, 0));
+ bufgap_seek(gap, 1, BGFromHere, BGByte);
+ }
+ printf("\n===========\n");
+ for (i = bufgap_size(gap, BGByte) - 1 ; i >= 0 ; --i) {
+ printf("%c", bufgap_peek(gap, 0));
+ (void) bufgap_seek(gap, -1, BGFromHere, BGByte);
+ }
+ printf("\n===========\n");
+ for (i = bufgap_size(gap, BGByte) - 1 ; i >= 0 ; --i) {
+ printf("%c", bufgap_peek(gap, 0));
+ (void) bufgap_seek(gap, 1, BGFromHere, BGByte);
+ }
+ printf("\n===========\n");
+}'