From owner-freebsd-current@FreeBSD.ORG Tue Sep 28 18:12:30 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 49C6916A4CE for ; Tue, 28 Sep 2004 18:12:30 +0000 (GMT) Received: from ptcnat.era.pl (ptcnat.era.pl [213.158.197.100]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7367343D31 for ; Tue, 28 Sep 2004 18:12:29 +0000 (GMT) (envelope-from zaks@era.pl) Received: by localhost (Postfix, from userid 1001) id 9168611652; Tue, 28 Sep 2004 20:12:22 +0200 (CEST) Resent-To: freebsd-current@freebsd.org Resent-From: szak@era.pl (=?iso-8859-2?q?S=B3awek_=AFak?=) Resent-Date: Tue, 28 Sep 2004 20:12:22 +0200 Resent-Message-ID: <86y8iu460p.fsf@thirst.unx.era.pl> X-From-Line: nobody Tue Sep 28 19:45:29 2004 From: =?iso-8859-2?q?S=B3awek_=AFak?= To: freebsd-current@freebsd.org Date: Tue, 28 Sep 2004 19:45:28 +0200 Message-ID: <861xgm5ltz.fsf@thirst.unx.era.pl> User-Agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Reasonable Discussion, berkeley-unix) Lines: 65 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Bug in #! processing X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2004 18:12:30 -0000 Hi, It seems that there is a long standing bug in processing of command-line options for scripts and such. Take following files: [main.c] #include int main(int ac, char **av) { int i; printf("Main.c test\n"); for(i = 0; i < ac; i++) { printf("%s\n", av[i]); } } [tst.sh] #!./main -#! print ok On FreeBSD 5.x: thirst(1790)% ./tst.sh Main.c test ./main - ./tst.sh On Solaris: sb8:root> ./tst.sh Main.c test ./main -#! ./tst.sh sb8:root> uname -a SunOS sb8 5.8 Generic_108528-21 sun4u sparc SUNW,UltraAX-i2 On Tru64: root@tytus> ./tst.sh Main.c test main -#! ./tst.sh root@tytus> uname -a OSF1 tytus V5.1 2650 alpha On AIX: scooter:/tmp # ./tst.sh Main.c test ./main -#! ./tst.sh scooter:/tmp # uname -a AIX scooter 2 5 005EF19C4C00 Any takers? /S