forked from KolibriOS/kolibrios
shell:
- fixed definitions - stack locals changed to heap variables (reduced app size) git-svn-id: svn://kolibrios.org@9808 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
68d6fe5255
commit
7805691d08
@ -6,6 +6,8 @@
|
|||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h> // Added by Coldy (this should be right here)
|
||||||
|
|
||||||
#include "system/boolean.h"
|
#include "system/boolean.h"
|
||||||
#include "system/kolibri.h"
|
#include "system/kolibri.h"
|
||||||
//#include "system/stdlib.h"
|
//#include "system/stdlib.h"
|
||||||
@ -37,8 +39,6 @@ while (1)
|
|||||||
}
|
}
|
||||||
//--------
|
//--------
|
||||||
|
|
||||||
extern int _FUNC(sprintf)(char* buffer, const char* format, ...);
|
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ int cmd_ls(char dir[]) {
|
|||||||
unsigned *t;
|
unsigned *t;
|
||||||
unsigned type_of_file; // check is this a file or a folder
|
unsigned type_of_file; // check is this a file or a folder
|
||||||
int i, result;
|
int i, result;
|
||||||
char tmp[FILENAME_MAX];
|
char* tmp = (char*) malloc(FILENAME_MAX);
|
||||||
|
|
||||||
bool single_column_mode = FALSE;
|
bool single_column_mode = FALSE;
|
||||||
|
|
||||||
@ -121,6 +121,7 @@ int cmd_ls(char dir[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
free((void*)k70.p16);
|
free((void*)k70.p16);
|
||||||
|
free(tmp);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ int cmd_more(char file[]) {
|
|||||||
unsigned result, i;
|
unsigned result, i;
|
||||||
unsigned long long filesize, pos;
|
unsigned long long filesize, pos;
|
||||||
char buf[81]; //<2F><><EFBFBD><EFBFBD>
|
char buf[81]; //<2F><><EFBFBD><EFBFBD>
|
||||||
char temp[FILENAME_MAX];
|
char* temp = (char*) malloc(FILENAME_MAX);
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
|
||||||
if (strlen(file)<1) {
|
if (strlen(file)<1) {
|
||||||
@ -87,6 +87,7 @@ int cmd_more(char file[]) {
|
|||||||
}
|
}
|
||||||
con_set_flags(flags);
|
con_set_flags(flags);
|
||||||
printf ("\n\r");
|
printf ("\n\r");
|
||||||
|
free(temp);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
int cmd_rm(char file[]) {
|
int cmd_rm(char file[]) {
|
||||||
|
|
||||||
kol_struct70 k70;
|
kol_struct70 k70;
|
||||||
char temp[FILENAME_MAX];
|
char* temp = (char*) malloc(FILENAME_MAX);
|
||||||
unsigned result;
|
unsigned result;
|
||||||
|
|
||||||
if (NULL == file || strlen(file) == 0) {
|
if (NULL == file || strlen(file) == 0) {
|
||||||
@ -42,6 +42,8 @@ int cmd_rm(char file[]) {
|
|||||||
|
|
||||||
result = kol_file_70(&k70);
|
result = kol_file_70(&k70);
|
||||||
|
|
||||||
|
free(temp);
|
||||||
|
|
||||||
if (0 == result)
|
if (0 == result)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
int cmd_rmdir(char dir[]) {
|
int cmd_rmdir(char dir[]) {
|
||||||
char temp[FILENAME_MAX];
|
char* temp = (char*) malloc(FILENAME_MAX);
|
||||||
kol_struct70 k70;
|
kol_struct70 k70;
|
||||||
unsigned result;
|
unsigned result;
|
||||||
|
|
||||||
@ -35,6 +35,8 @@ int cmd_rmdir(char dir[]) {
|
|||||||
|
|
||||||
result = kol_file_70(&k70);
|
result = kol_file_70(&k70);
|
||||||
|
|
||||||
|
free(temp);
|
||||||
|
|
||||||
if (0 == result)
|
if (0 == result)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
int cmd_touch(char file[])
|
int cmd_touch(char file[])
|
||||||
{
|
{
|
||||||
kol_struct70 k70;
|
kol_struct70 k70;
|
||||||
char temp[FILENAME_MAX];
|
char* temp = (char*) malloc(FILENAME_MAX);
|
||||||
unsigned result;
|
unsigned result;
|
||||||
|
|
||||||
if (NULL == file || strlen(file) == 0) {
|
if (NULL == file || strlen(file) == 0) {
|
||||||
@ -43,6 +43,8 @@ int cmd_touch(char file[])
|
|||||||
|
|
||||||
result = kol_file_70(&k70);
|
result = kol_file_70(&k70);
|
||||||
|
|
||||||
|
free(temp);
|
||||||
|
|
||||||
if (0 == result)
|
if (0 == result)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#define E_NOMEM 30
|
#define E_NOMEM 30
|
||||||
#define E_PARAM 33
|
#define E_PARAM 33
|
||||||
|
|
||||||
|
#undef FILENAME_MAX // Added by Coldy (elimination of conflict with stdio.h)
|
||||||
#define FILENAME_MAX 1024
|
#define FILENAME_MAX 1024
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
|
Loading…
Reference in New Issue
Block a user