documentation
This commit is contained in:
@@ -50,3 +50,7 @@ modules.order
|
|||||||
Module.symvers
|
Module.symvers
|
||||||
Mkfile.old
|
Mkfile.old
|
||||||
dkms.conf
|
dkms.conf
|
||||||
|
|
||||||
|
# documentation
|
||||||
|
|
||||||
|
doc/*
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
# beluga
|
# Beluga
|
||||||
|
|
||||||
|
Beluga is a project of CLI text editor that will fit perfectly with your azerty keyboard.
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* \file main.c
|
||||||
|
* \author Arthur Barraux
|
||||||
|
* \brief Base file of Beluga text editor. Contain fonctions for terminal
|
||||||
|
* interactions. \version 0.1 \date 21 septembre 2024
|
||||||
|
*/
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -13,6 +20,11 @@ struct termios orig_termios;
|
|||||||
|
|
||||||
/* terminal */
|
/* terminal */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \fn void die(const char *s)
|
||||||
|
* \brief Exit program and return s error message.
|
||||||
|
* \param *s Error string
|
||||||
|
* */
|
||||||
void die(const char *s) {
|
void die(const char *s) {
|
||||||
wipeScreen();
|
wipeScreen();
|
||||||
perror(s);
|
perror(s);
|
||||||
@@ -70,6 +82,7 @@ void editorProcessKeypress() {
|
|||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case CTRL_KEY('q'):
|
case CTRL_KEY('q'):
|
||||||
|
wipeScreen();
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
#ifndef MAIN_H
|
#ifndef MAIN_H
|
||||||
#define MAIN_H
|
#define MAIN_H
|
||||||
|
/* terminal */
|
||||||
|
|
||||||
|
void die(const char *s);
|
||||||
|
void disableRawMode();
|
||||||
|
void enableRawMode();
|
||||||
|
char editorReadKey();
|
||||||
|
|
||||||
|
/* output */
|
||||||
void wipeScreen();
|
void wipeScreen();
|
||||||
|
|
||||||
|
/* input */
|
||||||
|
void editorProcessKeypress();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user