Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define BUFFER 4096
- #define RUN_FOREVER 1
- int main(int argc , char * argv[] )
- {
- char input[BUFFER];
- //Get always a command line from the user.
- while(RUN_FOREVER)
- {
- char *stringBeforeAmpersand = NULL;
- char ch;
- if (isatty(0))
- {
- // input is from terminal
- // need to put something here
- }
- printf("$ ");
- memset(input, '\0', BUFFER);
- scanf("%[^\n]",input);
- scanf("%c",&ch);
- if(0 == strcmp(input, "exit"))
- break;
- //Separate the command according to the "&".
- stringBeforeAmpersand = strtok( input, "&");
- fprintf (stderr, "%s\n",stringBeforeAmpersand);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement