From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6544 invoked from network); 2 Mar 2023 16:32:39 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 2 Mar 2023 16:32:39 -0000 Received: (qmail 5805 invoked by uid 550); 2 Mar 2023 16:32:36 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 5773 invoked from network); 2 Mar 2023 16:32:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1677774743; i=nullplan@gmx.net; bh=mF2lvDAVnEpwPfMEwfRsj/BBetPzjWZB/klXJwRhcyI=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=Y3zkslGrM5Zd84B5amzWYd04lEWxhwSD3RIHjxxdiVOwekvd1Y8zwp6Xn9NpdRzaE lrpk0KtV1MlO9nT4eDusO163EeGnuIrZRZ2zQdwPNYjigOEPSA0L51NiYsJMuNbWHD Cl6KnMuJdvkQ6VOv+cEUxAOxt3QJ5lixK5woe8wX9g3vWaj5IB6IhcJd5BW/+8fKCU kqGQjYMYkhqyYJ4EHJG9ObHvmwcgUJ0oSy8f38QabR82WveJDNX0DsfYbtLM84P0IO HhdlnvVZY2sxySeX5Yyabl1lTU+IrsW+ptUWg4zl0F9jIMaeDxJBOeFAeIWrq2w8Yr ur1hFT80wvuMA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Date: Thu, 2 Mar 2023 17:32:22 +0100 From: Markus Wichmann To: musl@lists.openwall.com Message-ID: <20230302163222.GI1903@voyager> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Provags-ID: V03:K1:qXkHdcWWg/5lNKNrgdAebdJokzMSj8d+f3miU7/22XpFkZyrjjB nCtQRA8/yLdF+M3agUBH6vEgAWF9NjM9I4jWQzvIJKOqhjfrDwRDgjqEYXrLP0g8/gw3Ve0 Ahh/VR/H3XrB0YPfAN5lfSd2Ewh7eg+d/5S5L7hPEfMhABE26CadQFWj2ENQ/s4qDnQ/+DZ gIZuZDh4EVU8BkuG15J/g== UI-OutboundReport: notjunk:1;M01:P0:0++VE/Un6sM=;uaedeB7AmGNg+25A5RMJGkdN1QC RD2HYMJbadZdHiCOUeVHzc966Bf4tClD339BDlLOkWFgaF4IEDnrEJpk8MUuJJEFh5kPfRq4e McfOQi3lT+HLTtxmrthRwqKou/0aYLwP+a8zpfQ3hgmlOo9QKumhxR6TkAee8sF5MsWfXjgZs rfdAXqKwhqpdnQs40slAB3bAZBuKjjDvSpM6n4rVhjClsqc+v2Z1DnxfvsB2mAt0V6knVb2NM S0diZ74vEjseZBD0gYcoU8WFdccUwVH7i1Cmt/0NckuCXLCYhgVHe3ScIjifMBGgiszpN4fMd ZWzlhAhlw2ZigBAChoPeQlOtiIyjxFeLpvAJw1NaRyAoh1ze96wX+zYEDwSDz4xkVj++anxhx c/dPz0Ew4cxa86iN3IPLeRVjFczd3HQZJ/Y+ouf/6MgFMc0/SwPTOuHQSz+bB021Tb21S69kI xza0YiiyhL2qvwReaeArAmclM4DuwVVP55X8EN5kvrDuARPFl03XtSEzI00g6vCrJzXy3+1Yx l+cXwz6JHgco0Wx5HNDorpuWWcXOyeRWnIkFAQ0CW6LNABwzTDWn0i+fFyFF8uQRcflrmdiLK sHpuJTtcJN3UvKNwqdYc2nWUEPWvRytc7m74wNVz0OoEpUMmrlFfD5aiKytiMdrDhQUABa4h8 f2OKRZUYBw7H1C7jWs8qjHB33W/JEW0wMZ1Zts5PpVvSK7hLHC36cjRuyW8qT01tBRrTxMaWG arhgsLrRB/rnnxkximfNjKDMaUYOl2J4n8RZgwcwgEheBopO0T8cmKkmAr2pU4V2rws84MfQa ci1Vwqi7uwUFGExQ1nCrHg9eS+glvaMv5lpaD1eyys6WhJjH/q7ihc01MwtFoYEqmyfQh8J8d UfX9zF8ymcCTlS1X0CbG6w+IltPRmsCTRS/CFFhVV751mMHtS1z/+BBxJKbU5hesAahKxG1ik hVKO6e/MRlBx9BYAJmSfBKAcDHI= Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] Off topic question about shebang and exec() On Thu, Mar 02, 2023 at 04:15:38PM +0200, Paul Schutte wrote: > Hi all > > I apologize for abusing the knowledge of the people on this list, but I > know they will know the answer. Google does not provide a usable answer. > > I am busy writing a toy language and I would like it to be used as both = a > compiler and "interpreter" > > I would like it to compile the source and then run the resulting binary > when the source file is called via the shebang and it should just do a > normal compile when called with "compile code.src" > > argv[0] contains the path to the compiler in both cases, which makes sen= se. > > Is there any way to determine which method was used to call the compiler= ? > > Kind Regards > Paul Not to my knowledge. I would also consider it poor design to use a trick like that. The normal assumption is that a shebang and just running the command from command line are equivalent. Normal solution here is to have a command line switch to select one behavior or the other. That switch can be added to the shebang or the command line, whatever you choose. Ciao, Markus