mirror of
1
0
Fork 0

Cleanup and refactor of inlcudes, added head files

This commit is contained in:
Stephen Cochrane 2020-05-05 20:03:05 +02:00
parent 1c0d2508cf
commit a5d1cbc133
3 changed files with 14 additions and 9 deletions

View File

@ -1,3 +1,7 @@
#include <string.h>
#include "types.h"
#include "ped.h"
void runCommand(char* str, struct Session* session)
{
if(strcmp(str, "help") == 0)
@ -8,4 +12,4 @@ void runCommand(char* str, struct Session* session)
{
session->isActive = 0;
}
}
}

View File

@ -6,16 +6,12 @@
#include<sys/stat.h>
#include<sys/types.h>
#include<string.h>
#include<termios.h>
#include "types.h"
#include "ped.h"
#include "commands.c"
struct Session* newSession(char*);
struct termios oldSettings;
int main(int argc, char** args)
@ -42,8 +38,10 @@ int main(int argc, char** args)
}
else
{
printf("Too many args, or missing a file.\n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
void output(char* string, unsigned int length)
@ -210,7 +208,7 @@ void newEditor(struct Session* session)
redraw(session);
}
char* bye = "Bye mate!";
char* bye = "\nBye mate!\n";
output(bye, strlen(bye));
/* Restore the tty settings back to the original */
@ -271,4 +269,4 @@ struct Session* newSession(char* filename)
/* On error */
return 0;
}
}

3
src/ped.h Normal file
View File

@ -0,0 +1,3 @@
void output(char *string, unsigned int length);
struct Session *newSession(char*);
void newEditor(struct Session* session);