forked from KolibriOS/kolibrios
Improved in KolibriOS.
git-svn-id: svn://kolibrios.org@6447 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
6bd5a354f5
commit
fc59549902
@ -1,9 +1,18 @@
|
|||||||
#define _MAIN_
|
#define _MAIN_
|
||||||
|
|
||||||
#ifdef _UNIX_
|
#ifdef _UNIX_
|
||||||
#define DIV_PATH ':'
|
#define DIV_PATH ':' //äåëèòåëü ïóòåé â ïåðåìåííîé îêðóæåíèÿ PATH
|
||||||
#else
|
#define DIV_FOLD '/' //ýòèì ñèìâîëîì ðàçäåëÿþòñÿ ïàïêè â ïóòè ê ôàéëó
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32_
|
||||||
#define DIV_PATH ';'
|
#define DIV_PATH ';'
|
||||||
|
#define DIV_FOLD '\\'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _KOS_
|
||||||
|
#define DIV_PATH ';'
|
||||||
|
#define DIV_FOLD '/'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -25,7 +34,6 @@ char *winstub=NULL;
|
|||||||
FILE *hout=NULL;
|
FILE *hout=NULL;
|
||||||
char *namestartupfile="startup.h--";
|
char *namestartupfile="startup.h--";
|
||||||
|
|
||||||
|
|
||||||
char outext[4]="com";
|
char outext[4]="com";
|
||||||
short extflag=TRUE;//ðàñøèðåíèå ìîæíî ïðèñâîèòü
|
short extflag=TRUE;//ðàñøèðåíèå ìîæíî ïðèñâîèòü
|
||||||
//int scrsize;
|
//int scrsize;
|
||||||
@ -232,6 +240,7 @@ int main(int argc,char *argv[])
|
|||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
unsigned char pari=FALSE;
|
unsigned char pari=FALSE;
|
||||||
|
char *buffer;
|
||||||
|
|
||||||
printf("\nSPHINX C-- Compiler Version %d.%d%s %s\r\n",ver1,ver2,betta,__DATE__);
|
printf("\nSPHINX C-- Compiler Version %d.%d%s %s\r\n",ver1,ver2,betta,__DATE__);
|
||||||
|
|
||||||
@ -243,7 +252,7 @@ unsigned char pari=FALSE;
|
|||||||
outputdata=output;
|
outputdata=output;
|
||||||
postbuf=(postinfo *)MALLOC(MAXPOSTS*sizeof(postinfo));
|
postbuf=(postinfo *)MALLOC(MAXPOSTS*sizeof(postinfo));
|
||||||
strcpy((char *)string,argv[0]);
|
strcpy((char *)string,argv[0]);
|
||||||
rawext=strrchr((char *)string,'\\');
|
rawext=strrchr((char *)string,DIV_FOLD);
|
||||||
|
|
||||||
if(rawext!=NULL){
|
if(rawext!=NULL){
|
||||||
rawext[0]=0;
|
rawext[0]=0;
|
||||||
@ -256,7 +265,8 @@ unsigned char pari=FALSE;
|
|||||||
LoadIni("c--.ini");
|
LoadIni("c--.ini");
|
||||||
|
|
||||||
for(count=1;count<argc;count++){ //îáðàáîòêà êîìàíäíîé ñòðîêè
|
for(count=1;count<argc;count++){ //îáðàáîòêà êîìàíäíîé ñòðîêè
|
||||||
if(argv[count][0]=='/'||argv[count][0]=='-'){
|
//if(argv[count][0]=='/'||argv[count][0]=='-'){
|
||||||
|
if(argv[count][0]=='-'){
|
||||||
if(SelectComand(argv[count]+1,&count)==c_end) BadCommandLine(argv[count]);
|
if(SelectComand(argv[count]+1,&count)==c_end) BadCommandLine(argv[count]);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -267,7 +277,7 @@ unsigned char pari=FALSE;
|
|||||||
if(stricmp(rawext,".ini")==0){ //óêàçàí ini ôàéë
|
if(stricmp(rawext,".ini")==0){ //óêàçàí ini ôàéë
|
||||||
rawfilename=NULL;
|
rawfilename=NULL;
|
||||||
rawext=NULL;
|
rawext=NULL;
|
||||||
//LoadIni(argv[count]);
|
LoadIni(argv[count]);
|
||||||
if(rawfilename==NULL)pari=FALSE;
|
if(rawfilename==NULL)pari=FALSE;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -1049,23 +1059,21 @@ FILE *inih;
|
|||||||
char m1[256];
|
char m1[256];
|
||||||
|
|
||||||
// load name
|
// load name
|
||||||
//printf("pth: %s\r\n",name);
|
if (inih = fopen(name,"rb"))
|
||||||
//if (inih = fopen(name,"rb"))
|
{_loadIni(inih);return;}
|
||||||
//{_loadIni(inih);return;}
|
|
||||||
|
|
||||||
//if(strcmp(name,"c--.ini")!=0)
|
if(strcmp(name,"c--.ini")!=0)
|
||||||
// return;
|
return;
|
||||||
|
|
||||||
//load findpath[0]\c--.ini
|
//load findpath[0]\c--.ini
|
||||||
/*if (findpath[0]!=0)
|
if (findpath[0]!=0)
|
||||||
{
|
{
|
||||||
sprintf(m1,"%s\\%s",findpath[0],name);
|
sprintf(m1,"%s%s",findpath[0],name);
|
||||||
printf("pth: %s\r\n",m1);
|
|
||||||
if (inih = fopen(m1,"rb"))
|
if (inih = fopen(m1,"rb"))
|
||||||
{_loadIni(inih);return;}
|
{_loadIni(inih);return;}
|
||||||
} //http://android-films.net/download4/iz_mashiny_mp4_480x320_android-films.net.torrent
|
}
|
||||||
//load PATH[i=0..end]/c--.ini
|
//load PATH[i=0..end]/c--.ini
|
||||||
char* pth = 0;//getenv("PATH");
|
char* pth = getenv("PATH");
|
||||||
if (pth != 0)
|
if (pth != 0)
|
||||||
{
|
{
|
||||||
char* start;
|
char* start;
|
||||||
@ -1078,11 +1086,10 @@ char m1[256];
|
|||||||
size = (endp == 0)? strlen(start): endp-start;
|
size = (endp == 0)? strlen(start): endp-start;
|
||||||
strncpy(m1, start, size);
|
strncpy(m1, start, size);
|
||||||
start += size + 1;
|
start += size + 1;
|
||||||
if ((m1[size - 1] != '/') && (m1[size - 1] != '\\'))
|
if (m1[size - 1] != DIV_FOLD)
|
||||||
m1[size++] = '/';
|
m1[size++] = '/';
|
||||||
|
|
||||||
strcpy(m1 + size,"c--.ini");
|
strcpy(m1 + size,"c--.ini");
|
||||||
printf("pth: %s\r\n",m1);
|
|
||||||
if (inih = fopen(m1,"rb"))
|
if (inih = fopen(m1,"rb"))
|
||||||
{_loadIni(inih);return;}
|
{_loadIni(inih);return;}
|
||||||
}
|
}
|
||||||
@ -1097,19 +1104,18 @@ char m1[256];
|
|||||||
if (p){
|
if (p){
|
||||||
p++;
|
p++;
|
||||||
strcpy(m1+p,"c--.ini");
|
strcpy(m1+p,"c--.ini");
|
||||||
printf("pth: %s\r\n",m1);
|
if (inih = fopen(m1,"rb"))
|
||||||
//if (inih = fopen(m1,"rb"))
|
{_loadIni(inih);return;}
|
||||||
//{_loadIni(inih);return;}
|
|
||||||
}
|
}
|
||||||
*/ //for KolibriOS: load /rd/0/settings/c--.ini
|
//for KolibriOS: load /rd/0/settings/c--.ini
|
||||||
inih = fopen("/rd/1/settings/c--.ini","rb");
|
inih = fopen("/rd/1/settings/c--.ini","rb");
|
||||||
//for(;;){
|
for(;;){
|
||||||
// if(fgets(m1,255,inih)==NULL)break;
|
if(fgets(m1,255,inih)==NULL)break;
|
||||||
// if(SelectComand(m1,0)==c_end)BadCommandLine(m1);
|
if(SelectComand(m1,0)==c_end)BadCommandLine(m1);
|
||||||
//}
|
}
|
||||||
fclose(inih);
|
fclose(inih);
|
||||||
//return;
|
return;
|
||||||
//#endif //_KOS_
|
#endif //_KOS_
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -1146,13 +1152,15 @@ void *mem;
|
|||||||
|
|
||||||
void IncludePath(char *buf)
|
void IncludePath(char *buf)
|
||||||
{
|
{
|
||||||
|
char divfold[3];
|
||||||
|
sprintf(divfold,"%c",DIV_FOLD);
|
||||||
if(numfindpath<MAXNUMPATH-1){
|
if(numfindpath<MAXNUMPATH-1){
|
||||||
int len=strlen(buf);
|
int len=strlen(buf);
|
||||||
if(buf[len-1]=='\\')buf[len-1]=0;
|
if(buf[len-1]==DIV_FOLD)buf[len-1]=0;
|
||||||
else len++;
|
else len++;
|
||||||
char *a=(char *)MALLOC(len+1);
|
char *a=(char *)MALLOC(len+1);
|
||||||
strcpy(a,buf);
|
strcpy(a,buf);
|
||||||
strcat(a,"\\");
|
strcat(a,divfold);
|
||||||
findpath[numfindpath]=a;
|
findpath[numfindpath]=a;
|
||||||
numfindpath++;
|
numfindpath++;
|
||||||
findpath[numfindpath]="";
|
findpath[numfindpath]="";
|
||||||
|
Loading…
Reference in New Issue
Block a user