blob: a3c336b54e3d484ca75abeb523add1f52409019e (
plain)
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
|
#include <util.h>
#include <ctype.h>
#include <unistd.h>
#include <string.h>
#include <curses.h>
#include "strings.h"
void allLower(char* str)
{
for(int i=0;str[i];++i)
{
str[i]=tolower(str[i]);
}
}
void print_string(const char* str) /* print string, slowly */
{
int window_height;
int junk;
getmaxyx(stdscr, window_height, junk);
int i=0;
while(str[i])
{
addch(str[i]);
int cursx, cursy;
getyx(stdscr, cursy, cursx);
if(cursy==window_height)
{
scroll(stdscr);
}
usleep(SLEEP_TIME);
refresh();
++i;
}
}
void remove_punct(char* buf)
{
for(int i=0;buf[i];++i)
{
for(int j=0;j<sizeof(punctuation_marks)/sizeof(char);++j)
{
if(buf[i]==punctuation_marks[j])
{
memmove(&buf[i], &buf[i+1], strlen(buf)-i);
}
}
}
}
|