Sponsored Content
Top Forums Programming When I am writing my own interpreter... Post 302142013 by porter on Wednesday 24th of October 2007 01:04:11 AM
Old 10-24-2007
It should be simpler than the way you have it....

all that "|" means is give the write end to stdout of the left hand process and the read end to stdin for the right hand process.

but apart from > and <, the stdin/stdout/stderr should just be left alone.

To do ">" you just open a file and use it for stdout, end of story.

I personally would parse the line into a tree where each node is what I want to run in one process, each node would have pointers to where they get their stdin/stdout/stderr from.
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

an command interpreter

if somebody can help me pls. i need the source code for a shell which compiles C or java programs. i need a very short and simple one, just for the compiling part, in UNIX Respect (4 Replies)
Discussion started by: zlatan005
4 Replies

2. UNIX for Dummies Questions & Answers

m4 as script interpreter

#!/usr/bin/m4 when running m4 scripts with "#!/usr/bin/m4" they are executed properly, but "#!/usr/bin/m4" is printed out - how to avoid it? Thanks in advance. (5 Replies)
Discussion started by: Action
5 Replies

3. Programming

Java Interpreter

Hello guys - do you have any sample program implementing UNIX commands in an interpreter with Java? I can look up the simple ones such "ls" etc and then write my own commands. I would appreciate it. (2 Replies)
Discussion started by: cmontr
2 Replies

4. Shell Programming and Scripting

Multiple interpreter declarations

Hi, I am writing a shell script that connects to a remote server and performs some tasks on the server and exits. Since i am using a ssh connection, i am using a "expect" utility to supply the password automatically (which is present within the script). In order to use this utility, i need to... (3 Replies)
Discussion started by: sunrexstar
3 Replies

5. Shell Programming and Scripting

Bad Interpreter

Hi. My name is Caleb (a.k.a RagingNinja) form the whited00r forums. (Whited00r makes custom firmware for iOS devices). I have been learning and creating simple shells scripts. I have been recently using VIM for Windows or using VirtualBox to run the UBUNTU OS within VirtualBox to create my shell... (2 Replies)
Discussion started by: RagingNinja
2 Replies

6. Linux

interpreter files

Can you explain me what is ment by interpreter files ?? Why and how they are used?? (1 Reply)
Discussion started by: kkalyan
1 Replies

7. Shell Programming and Scripting

Dynamically choosing the interpreter

Hi, Is it possible to choose the inerpreter conditionally. For example, if whereis bash returns /usr/bin/bash then i need to choose #!/usr/bin/bash else i need to use #!/usr/bin/sh. Is it possible to achieve in a shell script? Thanks (1 Reply)
Discussion started by: pandeesh
1 Replies
AUTHOPEN(1)						    BSD General Commands Manual 					       AUTHOPEN(1)

NAME
authopen -- open file with authorization SYNOPSIS
authopen [-stdoutpipe] [-extauth] filename authopen [-stdoutpipe] [-extauth] -w [-a] filename authopen [-stdoutpipe] [-extauth] -c [-x -m mode -w] filename authopen [-stdoutpipe] [-extauth] -o flags filename authopen -h DESCRIPTION
authopen provides authorization-based file opening services. In its simplest form, authopen verifies that it is allowed to open filename (using an appropriate sys.openfile.* authorization right) and then writes the file to stdout. If -w is specified, authopen will read from stdin and write to the file. authopen is designed to be used both from the command line and programmatically. The -stdoutpipe flag allows a parent process to receive an open file descriptor pointing to the file in question. Before opening filename, authopen will make an authorization request for a right of the form: sys.openfile.[readonly|readwrite|readwritecreate]./fully/qualified/path '.readonly' rights only allow for read-only file descriptors. '.readwrite' rights allow for read/write file descriptors. '.readwritecreate' rights allow for read/write descriptors and the creation of new files. The -extauth option can be used to provide an AuthorizationRef constructed by the client. This generally prevents authopen from presenting an authorization dialog containing its own name. OPTIONS
-stdoutpipe specifies that STDOUT_FILENO has been dup2()'d onto a pipe to a parent process and that an open file descriptor to filename (with the appropriate access mode) should be sent back across it using the SCM_RIGHTS extension to sendmsg(2) rather than having the file itself written to or read from stdin / stdout. -extauth specifies that authopen should read one AuthorizationExternalForm structure from stdin, convert it to an AuthorizationRef, and attempt to use it to authorize the open(2) operation. The authorization should refer to the sys.apenfile right corresponding to the requested operation. The authorization data will be read before any additional data supplied on stdin, and will not be included in data written with -w. -w instructs authopen to open filename read/write and truncate it. If -stdoutpipe has not been specified, authopen will then copy stdin to filename until stdin is closed. -a append to filename rather than truncating it (truncating is the default). -c create the file if it doesn't exist. -m requires -c. -m mode specify the mode bits if a file is created. -o flags numerically specify the flags that should be passed to open(2). -x require that the file being created not exist. EXAMPLES
To replace /etc/hostconfig (assuming sys.openfile.readwrite./etc/hostconfig or better can be obtained): $ cat tmpdata | authopen -w /etc/hostconfig ERRORS
authopen will fail if an appropriate sys.openfile.readonly.*, sys.openfile.readwrite.*, or sys.openfile.readwritecreate.* right cannot be obtained or if the named path does not exist. BUGS
authopen should support prefix path authentication such that the right sys.openfile.*./dev/ could give access to all /dev entries and sys.openfile.*./dev/disk1 could give access to all disk1-related /dev entries. authopen should use getopt(3). LOCATION
/usr/libexec/authopen SEE ALSO
open(2), Security/Authorization.h, realpath(3), recvmsg(2). W. Richard Stevens, "Passing File Descriptors", Advanced Programming in the UNIX Environment. HISTORY
authopen appeared in Mac OS X 10.1 to assist with the manipulation of disk devices. Darwin 28 Feb 2013 Darwin
All times are GMT -4. The time now is 11:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy