startup workdir fix

git-svn-id: svn://kolibrios.org@6862 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
siemargl 2017-02-10 17:36:03 +00:00
parent 95c7aad99e
commit 568fb16110
5 changed files with 27 additions and 14 deletions

View File

@ -1,11 +1,4 @@
static inline void set_cwd(const char* cwd)
{
__asm__ __volatile__(
"int $0x40"
::"a"(30),"b"(1),"c"(cwd));
};
int cmd_cd(char dir[])
{

View File

@ -5,7 +5,7 @@ extern char PATH[256];
extern char PARAM[256];
char title[64];
char cur_dir[256];
char cur_dir[FILENAME_MAX];
/// ===========================================================
@ -16,8 +16,8 @@ unsigned ALIAS_NUM = 0;
#define CMD_HISTORY_NUM 11
char CMD[256];
char CMD_HISTORY[CMD_HISTORY_NUM][256];
char CMD[FILENAME_MAX * 2];
char CMD_HISTORY[CMD_HISTORY_NUM][FILENAME_MAX * 2];
char CMD_NUM = 0;
char CMD_HISTORY_NUM_REAL = 0;
unsigned LAST_PID = 0;

View File

@ -129,16 +129,19 @@ if (sizeof (kol_struct70) != 25)
}
strcpy(cur_dir, PATH);
dir_truncate(cur_dir);
//strcpy(cur_dir, PATH);
//dir_truncate(cur_dir);
getcwd(cur_dir, sizeof cur_dir);
//printf("curdir %s\n", cur_dir);
con_set_cursor_height(con_get_font_height()-1);
ALIASES = malloc(128*1024);
if (PARAM[0] == 0)
if (!PARAM || PARAM[0] == 0)
{
strcpy(CMD, cur_dir);
strcpy(CMD, PATH);
dir_truncate(CMD);
strcat(CMD, ".shell");
if ( !file_check(CMD) )
strcpy(CMD, "/sys/settings/.shell");

View File

@ -436,3 +436,17 @@ int kol_clip_set(int n, char buffer[])
{
asm volatile ("int $0x40"::"a"(54), "b"(2), "c"(n), "d"(buffer));
}
void set_cwd(const char* cwd)
{
__asm__ __volatile__(
"int $0x40"
::"a"(30),"b"(1),"c"(cwd));
};
int getcwd(char *buf, unsigned size)
{
__asm__ __volatile__(
"int $0x40"
::"a"(30),"b"(2),"c"(buf), "d"(size));
}

View File

@ -114,3 +114,6 @@ void kol_buffer_close(char name[]);
int kol_clip_num();
char* kol_clip_get(int n);
int kol_clip_set(int n, char buffer[]);
void set_cwd(const char* cwd);
int getcwd(char *buf, unsigned size);