X-Git-Url: https://pd.if.org/git/?p=pd_readline;a=blobdiff_plain;f=funcs.c;fp=funcs.c;h=36241e5cb97ddfd6adac38d3e1caca31de25c72b;hp=8ac14c685c0d129e797959084f007ad2ee7a3d14;hb=851ac869ee55686234ae246ab9b5d938aec0f225;hpb=a2ded27fbbe1d152bcc1927e6decff86e2c940a7 diff --git a/funcs.c b/funcs.c index 8ac14c6..36241e5 100644 --- a/funcs.c +++ b/funcs.c @@ -19,8 +19,38 @@ /* Also test for the top and bottom of the history file. */ +/* Display a buffer */ +void show(buf b) +{ + printf("%s", b.array); +} + + + +/* Enter a char into a buffer and display the buffer array. */ +buf set(buf b, int i) +{ + if ( (b.index < 80) ) + { + b.array[b.index] = i; + b.index += 1 ; + } + else + { + memset(b.array[0], 0, sizeof(b.array) ); + b.array[0] = i; + b.index += 1 ; + } + + show(b); + return b; + +} + + + /* Move up in history list. */ -buf up(int i) +buf up(buf b) { @@ -29,7 +59,7 @@ buf up(int i) /* Move down in history list. */ -buf down(int i) +buf down(buf b) {