Cleanup and refactor of inlcudes, added head files
This commit is contained in:
parent
1c0d2508cf
commit
a5d1cbc133
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
14
src/ped.c
14
src/ped.c
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue