From 4ed0c07ea394819f1e6c80f3f99f5a7177a19823 Mon Sep 17 00:00:00 2001
From: michael <michael@freepascal.org>
Date: Sat, 5 Mar 2016 13:41:26 +0000
Subject: [PATCH] * Fix bug #29772

git-svn-id: trunk@33151 -
---
 utils/instantfpc/instantfpc.pas | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/utils/instantfpc/instantfpc.pas b/utils/instantfpc/instantfpc.pas
index 0a9a3549bf..dbd0571ea4 100644
--- a/utils/instantfpc/instantfpc.pas
+++ b/utils/instantfpc/instantfpc.pas
@@ -29,9 +29,11 @@ const
   // 1.3 compile in a separate directory, so that parallel invocations do not overwrite link.res files
 
 
-Procedure Usage;
+Procedure Usage(Err : string);
 
 begin
+  if (Err<>'') then
+    Writeln('Error : ',Err);
   writeln('instantfpc '+Version);
   writeln;
   writeln('Run pascal source files as scripts.');
@@ -76,7 +78,7 @@ begin
   writeln;
   writeln('  -B');
   writeln('      Always recompile.');
-  Halt(0);
+  Halt(Ord(Err<>''));
 end;
 
 Procedure DisplayCache;
@@ -108,7 +110,7 @@ begin
     Halt(1);
     end
   else if p='-h' then 
-    usage
+    usage('')
   else if p='--get-cache' then 
     DisplayCache
   else if copy(p,1,11)='--compiler=' then 
@@ -167,12 +169,8 @@ begin
       end;  
   end;
   if (Filename='') then 
-    begin
-    writeln('missing source file');
-    Halt(1);
-    end;
+    Usage('Missing source file');
   CheckSourceName(Filename);
-
   Src:=TStringList.Create;
   try
     Src.LoadFromFile(Filename);