Created
August 14, 2014 19:17
-
-
Save gdisneyleugers/0f0de83778afd03fe71c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <readline/readline.h> | |
#include <readline/history.h> | |
/* to compile run gcc shell.c -o shell -Wformat-security -Wint-conversion -Wincompatible-pointer-types -lreadline -lgtk */ | |
int shell(void) | |
{ | |
rl_bind_key('\t', rl_complete); | |
const char *b[4096]; | |
const char *a = fgets("shell->", *b, 4096); | |
char *f = readline("shell-> "); | |
char ex = 'exit'; | |
if (*f == &ex ) { | |
exit(0); | |
} | |
const char *d = system(f); | |
return(0); | |
} | |
int main(void) | |
{ | |
while(1) | |
shell(); | |
return(0); | |
if(1) { | |
exit(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment