From 0789a4c719f74d03fe9a16f7c09846bd171180ae Mon Sep 17 00:00:00 2001 From: "zik.saleeba" Date: Tue, 28 Aug 2012 10:26:12 +0000 Subject: [PATCH] Added Nikolaus Klepp's shebang patch git-svn-id: http://picoc.googlecode.com/svn/trunk@574 21eae674-98b7-11dd-bd71-f92a316d2d60 --- platform/platform_unix.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/platform_unix.c b/platform/platform_unix.c index 2b84e9d..e40477d 100644 --- a/platform/platform_unix.c +++ b/platform/platform_unix.c @@ -119,6 +119,13 @@ void PicocPlatformScanFile(const char *FileName) { char *SourceStr = PlatformReadFile(FileName); + /* ignore "#!/path/to/picoc" .. by replacing the "#!" with "//" */ + if (SourceStr != NULL && SourceStr[0] == '#' && SourceStr[1] == '!') + { + SourceStr[0] = '/'; + SourceStr[1] = '/'; + } + PicocParse(FileName, SourceStr, strlen(SourceStr), TRUE, FALSE, TRUE, TRUE); }