Now treating a line starting with #! at the start of a picoc file as a

comment line so we can execute it as a shell script.


git-svn-id: http://picoc.googlecode.com/svn/trunk@573 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2012-05-31 05:59:34 +00:00
parent cb4c34b506
commit f37ea8c96d

View file

@ -83,6 +83,7 @@ char *PlatformReadFile(const char *FileName)
char *ReadText;
FILE *InFile;
int BytesRead;
char *p;
if (stat(FileName, &FileInfo))
ProgramFail(NULL, "can't read file %s\n", FileName);
@ -102,6 +103,14 @@ char *PlatformReadFile(const char *FileName)
ReadText[BytesRead] = '\0';
fclose(InFile);
if ((ReadText[0] == '#') && (ReadText[1] == '!'))
{
for (*p = ReadText; (*p != '\r') && (*p != '\n'); ++p)
{
*p = ' ';
}
}
return ReadText;
}