summaryrefslogtreecommitdiff
path: root/lib/interface.c
blob: fc238b500a21611f23fd3887e8790b220dbe61e0 (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
47
48
49
#include <stdio.h>
#include <string.h>
#include "config.h"
#include "interface.h"
#include "terminal.h"
#include "exceptions.h"

void supprime(char * ch) {
	for (; *ch; ch++) {
		*ch = *(ch + 1);
	}
}

void insert(char * ch, char c) {
	int i;
	
	for (i = strlen(ch) - 1; i; i--) {
		*(ch + i + 1) = *(ch + i);
	}
	
	*ch = c;
}

void ifloop(void) {
	int cread;
	int gotesc = 0;
	char buffer[BUFSIZ];
	int position;
	
	while (1) {
		cread = fgetc(input);
		printf("%u\n", cread);
		
		if (gotesc) {
		} else {
			switch(cread) {
			case 27: /* Caractère ESC */
				gotesc = 1;
				break;
			case 8: /* Caractère <--- */
				if (position) {
				}
				break;
			case 127: /* Caractère Suppr */
				break;
			}
		}
	}
}