SHELL 0.6.4: relative passes support for scripts

git-svn-id: svn://kolibrios.org@3988 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-10-08 21:38:43 +00:00
parent b9625388ab
commit 88ac946b40
4 changed files with 27 additions and 5 deletions

View File

@ -1,5 +1,5 @@
#define SHELL_VERSION "0.6.3" #define SHELL_VERSION "0.6.4"
extern char PATH[256]; extern char PATH[256];
extern char PARAM[256]; extern char PARAM[256];

View File

@ -128,10 +128,16 @@ con_set_cursor_height(con_get_font_height()-1);
ALIASES = malloc(128*1024); ALIASES = malloc(128*1024);
if (strlen(PARAM) > 0) if (PARAM[0] == 0) strcpy(CMD, ".shell");
strcpy(CMD, PARAM);
else else
strcpy(CMD, ".shell"); {
if (PARAM[0] == '/')
{
strcpy(cur_dir, PARAM);
*strrchr(cur_dir, '/')=0;
}
strcpy(CMD, PARAM);
}
command_execute(); command_execute();

View File

@ -123,6 +123,21 @@ char* strchr(const char* string, int c)
} }
char* strrchr(const char* string, int c)
{
int last_found;
while (*string)
{
if (*string==c)
{
last_found = string;
}
string++;
}
return (char*)last_found;
}
void _itoa(int i, char *s) void _itoa(int i, char *s)
{ {

View File

@ -13,7 +13,8 @@ void strcpy(char strDest[], const char strSource[]);
char* strncpy(char *strDest, const char *strSource, unsigned n); char* strncpy(char *strDest, const char *strSource, unsigned n);
int strlen(const char* string); int strlen(const char* string);
char* strchr(const char* string, int c); char* strchr(const char* string, int c);
char* strrchr(const char* string, int c);
void _itoa(int i, char *s); void _itoa(int i, char *s);
void reverse(char *s); void reverse(char *s);
void itoa(int i, char *s); void itoa(int i, char *s);
int _atoi ( char *s ); int _atoi( char *s );