Code:
diff -u a/main.c b/main.c
--- a/main.c 2008-09-21 04:29:37.000000000 +0300
+++ b/main.c 2008-09-21 19:11:07.000000000 +0300
@@ -6,9 +6,9 @@
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include "text.h"
#include "memory.h"
+#include "process.h"
@@ -25,6 +25,7 @@
inputArr = GetWordsFromString(input,BASIC_DELIMS); //format string using delims to string array
Command(inputArr,root); //
}
+
+ return EXIT_SUCCESS;
}
-
diff -u a/Makefile b/Makefile
--- a/Makefile 2008-09-21 04:28:17.000000000 +0300
+++ b/Makefile 2008-09-21 19:03:58.000000000 +0300
@@ -1,4 +1,5 @@
-cc = gcc
+CC = gcc
make default:
- $(cc) main.c process.c text.c memory.c -o program
+ $(CC) -Wall -pedantic -std=gnu99 main.c process.c text.c memory.c -o program
+
diff -u a/memory.c b/memory.c
--- a/memory.c 2008-09-20 17:48:57.000000000 +0300
+++ b/memory.c 2008-09-21 19:14:02.000000000 +0300
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <string.h>
#include "memory.h"
struct node *AddNodeToEnd(struct node *root_, char *name_, char *owner_, char *value_) {
@@ -23,7 +25,7 @@
struct node *FindNodeByName(struct node *root_, char *name_) {
struct node *traverse;
- char nameKey[32];
+ //char nameKey[32];
traverse = root_;
while (traverse->next != NULL) {
diff -u a/memory.h b/memory.h
--- a/memory.h 2008-09-20 17:44:54.000000000 +0300
+++ b/memory.h 2008-09-21 19:07:43.000000000 +0300
@@ -1,6 +1,5 @@
-#include <stdlib.h>
-#include <stdio.h>
-
+#ifndef MEMORY_H
+#define MEMORY_H
struct node {
char* name;
@@ -9,6 +8,9 @@
struct node *next;
};
-struct node *AddNodeToEnd(struct node*, char*, char*, char*);
+extern struct node *AddNodeToEnd(struct node*, char*, char*, char*);
+
+extern struct node *FindNodeByName(struct node*, char*);
+
+#endif // MEMORY_H
-struct node *FindNodeByName(struct node*, char*);
diff -u a/process.c b/process.c
--- a/process.c 2008-09-21 04:15:49.000000000 +0300
+++ b/process.c 2008-09-21 19:12:15.000000000 +0300
@@ -1,3 +1,6 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include "process.h"
void Command(char** string, struct node* root) {
diff -u a/process.h b/process.h
--- a/process.h 2008-09-21 00:00:30.000000000 +0300
+++ b/process.h 2008-09-21 19:07:20.000000000 +0300
@@ -1,7 +1,9 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
+#ifndef PROCESS_H
+#define PROCESS_H
-#include "memory.h"
+struct node;
+
+extern void Command(char**, struct node*);
+
+#endif // PROCESS_H
-void Command(char**, struct node*);
diff -u a/text.c b/text.c
--- a/text.c 2008-09-19 05:11:20.000000000 +0300
+++ b/text.c 2008-09-21 19:12:49.000000000 +0300
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <string.h>
#include "text.h"
char **GetWordsFromString(char* string, char* delims) {
diff -u a/text.h b/text.h
--- a/text.h 2008-09-21 04:26:15.000000000 +0300
+++ b/text.h 2008-09-21 19:08:38.000000000 +0300
@@ -1,7 +1,9 @@
-#include <stdlib.h>
-#include <string.h>
+#ifndef TEXT_H
+#define TEXT_H
#define BASIC_DELIMS " ,'\n"
-char **GetWordsFromString(char*, char*);
+extern char **GetWordsFromString(char*, char*);
+
+#endif // TEXT_H
Bookmarks