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:
parent
cb4c34b506
commit
f37ea8c96d
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue