-
Notifications
You must be signed in to change notification settings - Fork 0
/
etauspat.c
77 lines (68 loc) · 1.7 KB
/
etauspat.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
etauspat.c Version 0.1.0 - Generate Random Data Pattern
Copyright (C) 2016 aquila62 at github.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
*/
/* press 'r' to reset */
/* press 'q' to exit */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <curses.h>
#include "etaus.h"
#define SCRW 80.0
#define SCRH 24.0
void initcrss()
{
initscr();
cbreak();
noecho();
nonl();
intrflush(stdscr,FALSE);
nodelay(stdscr,TRUE);
} /* initcrss */
int main()
{
int ch,x,y;
etfmt *et;
et = (etfmt *) etausinit();
initcrss();
while(1)
{
y = etausint(et,SCRH);
if (y == 23)
x = etausint(et,SCRW-1);
else
x = etausint(et,SCRW);
move(y,x);
ch = etausint(et,95) + 33;
addch(ch);
refresh();
ch = getch();
if (ch == 0x1b) /* ESCAPE */
break;
if (ch == 'q') /* quit */
break;
if (ch == 'r') /* reset */
{
clear();
refresh();
} /* reset */
}
endwin();
free(et->state);
free(et);
return(0);
} /* main */