- 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:
Coldy 2022-05-08 08:22:31 +00:00
parent 68d6fe5255
commit 7805691d08
7 changed files with 16 additions and 7 deletions

View File

@ -6,6 +6,8 @@
#include "lang.h"
#endif
#include <stdio.h> // Added by Coldy (this should be right here)
#include "system/boolean.h"
#include "system/kolibri.h"
//#include "system/stdlib.h"
@ -37,8 +39,6 @@ while (1)
}
//--------
extern int _FUNC(sprintf)(char* buffer, const char* format, ...);
#include "globals.h"
#include "prototypes.h"

View File

@ -7,7 +7,7 @@ int cmd_ls(char dir[]) {
unsigned *t;
unsigned type_of_file; // check is this a file or a folder
int i, result;
char tmp[FILENAME_MAX];
char* tmp = (char*) malloc(FILENAME_MAX);
bool single_column_mode = FALSE;
@ -121,6 +121,7 @@ int cmd_ls(char dir[]) {
}
free((void*)k70.p16);
free(tmp);
return TRUE;
}

View File

@ -6,7 +6,7 @@ int cmd_more(char file[]) {
unsigned result, i;
unsigned long long filesize, pos;
char buf[81]; //<2F><><EFBFBD><EFBFBD>
char temp[FILENAME_MAX];
char* temp = (char*) malloc(FILENAME_MAX);
unsigned flags;
if (strlen(file)<1) {
@ -87,6 +87,7 @@ int cmd_more(char file[]) {
}
con_set_flags(flags);
printf ("\n\r");
free(temp);
return TRUE;
}

View File

@ -2,7 +2,7 @@
int cmd_rm(char file[]) {
kol_struct70 k70;
char temp[FILENAME_MAX];
char* temp = (char*) malloc(FILENAME_MAX);
unsigned result;
if (NULL == file || strlen(file) == 0) {
@ -41,6 +41,8 @@ int cmd_rm(char file[]) {
k70.p21 = temp;
result = kol_file_70(&k70);
free(temp);
if (0 == result)
return TRUE;

View File

@ -1,6 +1,6 @@
int cmd_rmdir(char dir[]) {
char temp[FILENAME_MAX];
char* temp = (char*) malloc(FILENAME_MAX);
kol_struct70 k70;
unsigned result;
@ -35,6 +35,8 @@ int cmd_rmdir(char dir[]) {
result = kol_file_70(&k70);
free(temp);
if (0 == result)
return TRUE;
else

View File

@ -2,7 +2,7 @@
int cmd_touch(char file[])
{
kol_struct70 k70;
char temp[FILENAME_MAX];
char* temp = (char*) malloc(FILENAME_MAX);
unsigned result;
if (NULL == file || strlen(file) == 0) {
@ -43,6 +43,8 @@ int cmd_touch(char file[])
result = kol_file_70(&k70);
free(temp);
if (0 == result)
return TRUE;
else

View File

@ -12,6 +12,7 @@
#define E_NOMEM 30
#define E_PARAM 33
#undef FILENAME_MAX // Added by Coldy (elimination of conflict with stdio.h)
#define FILENAME_MAX 1024
#pragma pack(push,1)