Permalink
Browse files

Fixes

  • Loading branch information...
1 parent 58f319b commit 7ad42b0b53c73c3575c16092f00aaaa52da04248 @pilliq committed Feb 12, 2012
Showing with 21 additions and 12 deletions.
  1. +21 −12 execute.c
View
@@ -3,6 +3,7 @@
#include <string.h>
#include <unistd.h>
#include <ctype.h>
+
/**
* Returns a integer indicating whether the command provided
* is a built in command or not.
@@ -14,15 +15,15 @@
int builtIn(char* command)
{
-if(strcmp(command, "")==1)
-{
- return null;
-}
-else if(strcmp(command,"cd")==1||strcmp(command,"exit")==1)
-{
- return 1;
-}
-return 0;
+ if(strcmp(command, "")==1)
+ {
+ return 0;
+ }
+ else if(strcmp(command,"cd")==1||strcmp(command,"exit")==1)
+ {
+ return 1;
+ }
+ return 0;
}
int fork()
@@ -36,15 +37,23 @@ int fork()
default: /* a fork returns a pid to the parent */
sleep(5);
printf("I'm still here!\n");
- break; case -1: /* something went wrong */ perror("fork"); exit(1);
+ break;
+ case -1: /* something went wrong */
+ perror("fork");
+ exit(1);
}
exit(0);
}
void runit(void) {
- printf("About to run ls\n";
- exelp("ls","ls", "-aF", "/" , (char*)0);
+ printf("About to run ls\n");
+ execlp("ls","ls", "-aF", "/" , (char*)0);
perror("execlp");
exit(1);
}
+
+int main (int argc, char ** argv) {
+
+ return 0;
+}

0 comments on commit 7ad42b0

Please sign in to comment.