summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Beppu <beppu@lbox.org>1999-12-22 17:57:31 +0000
committerJohn Beppu <beppu@lbox.org>1999-12-22 17:57:31 +0000
commit019513a59ffd966cca51d6616757295a46869e4a (patch)
tree5d03c4e7c4ba676fef529c52a4a55c46e246259e
parent38efa7902e7d266fbc78e1d39780ca0866d98dad (diff)
downloadbusybox-w32-019513a59ffd966cca51d6616757295a46869e4a.tar.gz
busybox-w32-019513a59ffd966cca51d6616757295a46869e4a.tar.bz2
busybox-w32-019513a59ffd966cca51d6616757295a46869e4a.zip
added hooks for sort
-rw-r--r--applets/busybox.c3
-rw-r--r--busybox.c3
-rw-r--r--busybox.def.h1
-rw-r--r--coreutils/sort.c24
-rw-r--r--internal.h1
-rw-r--r--sort.c24
6 files changed, 52 insertions, 4 deletions
diff --git a/applets/busybox.c b/applets/busybox.c
index 895accd93..cd4ab8fcd 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -184,6 +184,9 @@ static const struct Applet applets[] = {
184#ifdef BB_SLEEP //bin 184#ifdef BB_SLEEP //bin
185 {"sleep", sleep_main}, 185 {"sleep", sleep_main},
186#endif 186#endif
187#ifdef BB_SORT //bin
188 {"sort", sort_main},
189#endif
187#ifdef BB_SYNC //bin 190#ifdef BB_SYNC //bin
188 {"sync", sync_main}, 191 {"sync", sync_main},
189#endif 192#endif
diff --git a/busybox.c b/busybox.c
index 895accd93..cd4ab8fcd 100644
--- a/busybox.c
+++ b/busybox.c
@@ -184,6 +184,9 @@ static const struct Applet applets[] = {
184#ifdef BB_SLEEP //bin 184#ifdef BB_SLEEP //bin
185 {"sleep", sleep_main}, 185 {"sleep", sleep_main},
186#endif 186#endif
187#ifdef BB_SORT //bin
188 {"sort", sort_main},
189#endif
187#ifdef BB_SYNC //bin 190#ifdef BB_SYNC //bin
188 {"sync", sync_main}, 191 {"sync", sync_main},
189#endif 192#endif
diff --git a/busybox.def.h b/busybox.def.h
index 3a64c1a54..3c290f7a4 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -64,6 +64,7 @@
64//#define BB_SFDISK 64//#define BB_SFDISK
65#define BB_SED 65#define BB_SED
66#define BB_SLEEP 66#define BB_SLEEP
67#define BB_SORT
67#define BB_SWAPONOFF 68#define BB_SWAPONOFF
68#define BB_SYNC 69#define BB_SYNC
69#define BB_SYSLOGD 70#define BB_SYSLOGD
diff --git a/coreutils/sort.c b/coreutils/sort.c
index d82351797..f3f9fca1d 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -90,6 +90,17 @@ line_newFromFile(FILE *src)
90 return NULL; 90 return NULL;
91} 91}
92 92
93/* Line destructor */
94static Line *
95line_release(Line *self)
96{
97 if (self->data) {
98 free(self->data);
99 free(self);
100 }
101 return self;
102}
103
93 104
94/* Comparison */ 105/* Comparison */
95 106
@@ -148,7 +159,16 @@ list_writeToFile(List *self, FILE* dst)
148static List * 159static List *
149list_release(List *self) 160list_release(List *self)
150{ 161{
151 return self; 162 Line *i;
163 Line *die;
164
165 i = self->head;
166 while (i) {
167 die = i;
168 i = die->next;
169 line_delete(die);
170 }
171 return self; /* bad poetry? */
152} 172}
153 173
154 174
@@ -195,4 +215,4 @@ sort_main(int argc, char **argv)
195 exit(0); 215 exit(0);
196} 216}
197 217
198/* $Id: sort.c,v 1.2 1999/12/22 00:30:29 beppu Exp $ */ 218/* $Id: sort.c,v 1.3 1999/12/22 17:57:31 beppu Exp $ */
diff --git a/internal.h b/internal.h
index 6bb9341ef..05e3904e6 100644
--- a/internal.h
+++ b/internal.h
@@ -113,6 +113,7 @@ extern int sh_main(int argc, char** argv);
113extern int sfdisk_main(int argc, char** argv); 113extern int sfdisk_main(int argc, char** argv);
114extern int sed_main(int argc, char** argv); 114extern int sed_main(int argc, char** argv);
115extern int sleep_main(int argc, char** argv); 115extern int sleep_main(int argc, char** argv);
116extern int sort_main(int argc, char** argv);
116extern int swap_on_off_main(int argc, char** argv); 117extern int swap_on_off_main(int argc, char** argv);
117extern int sync_main(int argc, char** argv); 118extern int sync_main(int argc, char** argv);
118extern int syslogd_main(int argc, char **argv); 119extern int syslogd_main(int argc, char **argv);
diff --git a/sort.c b/sort.c
index d82351797..f3f9fca1d 100644
--- a/sort.c
+++ b/sort.c
@@ -90,6 +90,17 @@ line_newFromFile(FILE *src)
90 return NULL; 90 return NULL;
91} 91}
92 92
93/* Line destructor */
94static Line *
95line_release(Line *self)
96{
97 if (self->data) {
98 free(self->data);
99 free(self);
100 }
101 return self;
102}
103
93 104
94/* Comparison */ 105/* Comparison */
95 106
@@ -148,7 +159,16 @@ list_writeToFile(List *self, FILE* dst)
148static List * 159static List *
149list_release(List *self) 160list_release(List *self)
150{ 161{
151 return self; 162 Line *i;
163 Line *die;
164
165 i = self->head;
166 while (i) {
167 die = i;
168 i = die->next;
169 line_delete(die);
170 }
171 return self; /* bad poetry? */
152} 172}
153 173
154 174
@@ -195,4 +215,4 @@ sort_main(int argc, char **argv)
195 exit(0); 215 exit(0);
196} 216}
197 217
198/* $Id: sort.c,v 1.2 1999/12/22 00:30:29 beppu Exp $ */ 218/* $Id: sort.c,v 1.3 1999/12/22 17:57:31 beppu Exp $ */