-
Notifications
You must be signed in to change notification settings - Fork 57
pipe/fork/exec and friends as custom functions #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 6 commits
515981b
3f106bf
1d70a1f
70d93c2
2d89d7f
6217a66
fb70358
6d25ccc
f64f199
7891cbd
9bc9a09
c294b20
ff174b1
b429fd8
b7bd76b
6a80a24
84f74d9
f33aa19
dbd0392
eb1447e
02a0a68
bc2ed54
0d72217
3112846
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our plan is to make your PR the basis for calc version 2.16.0.1, and so we will "mod your mod" and update We will add a TODO about the pending changes prior to the calc v2 / v3 fork. |
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
custom |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 although we will update as per |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, good catch. 👍 We wonder if this mistake you corrected has happened elsewhere in calc. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 (except for a minor bit of trailing whitespace where we will "mod your mod" 😉) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the help file! Too many contributors fail to add this! We plan to address the trailing whitespace and convert to the ASCII tab into spaces as your terminal appears to use a 4 character tab stop that others might not use. Better to use just ASCII space as they are more "portable" 🤓. So we plan to "mod your mod" 😉. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
NAME | ||
pfe - pipe/fork/exec and friends | ||
|
||
SYNOPSIS | ||
pipe = custom("pipe") ## create descriptor pair for interprocess communication | ||
pid = custom("fork") ## create process | ||
tgt = custom("dup", src) ## duplicate a file descriptor | ||
tgt = custom("dup2", src, tgt) ## duplicate a file descriptor | ||
e = custom("close", fd) ## remove a file descriptor | ||
e = custom("execvp", arg0, args) ## execute a file | ||
count = custom("write", fd, str) ## write output | ||
str = custom("read", fd) ## read input | ||
count = custom("select", rd, wt, exc[, timeout]) ## examine file descriptors | ||
count = custom("poll", chk, &ret[, msecs]) ## synchronous I/O multiplexing | ||
pid = custom("wait", [pid, ]&stt[, opts][, &usg]) ## wait for process | ||
|
||
pid = custom("pfe", &in, &out, &err, args) ## pipe/fork/exec | ||
count = custom("pwrite", fd, str) ## write and close | ||
e = custom("pread", pid, out, err) ## read until eof, close and wait for exit status | ||
|
||
str = custom("inputname") ## get name of input | ||
path = custom("getcwd") ## get working directory pathname | ||
|
||
path = custom("basename", path) ## extract the base portion of a pathname | ||
path = custom("dirname", path) ## extract the directory part of a pathname | ||
|
||
pid = custom("getpid") ## get calling process identification | ||
pid = custom("getppid") ## get parent process identification | ||
|
||
TYPES | ||
fd int num | ||
pipe list of fd | ||
pid int num | ||
src tgt fd | ||
arg0 str | ||
args list of str | ||
e int num | ||
count int num | ||
rd wt exc list of fd | ||
in out err list of fd | ||
timeout num | ||
|
||
arg1 str | ||
...argN str | ||
chk list of list(fd[, arg1[, ...argN]]) | ||
ret list of list(fd[, arg1[, ...argN]]) | ||
msec int num | ||
|
||
stt assoc str => int num | ||
opts list of str | ||
usg assoc str => int num | ||
|
||
path str | ||
|
||
EXAMPLE | ||
global i, o, e | ||
if(pid = pfe(&i, &o, &e,list("sh","-c","read||:;echo $REPLY"))){ | ||
pwrite(i,"test") | ||
pread(pid,o,e)} | ||
|
||
LIMITS | ||
calc must be built with ALLOW_CUSTOM= -DCUSTOM | ||
calc must be executed with a -C arg. | ||
|
||
LIBRARY | ||
none | ||
|
||
SEE ALSO | ||
custom | ||
|
||
## Copyright (C) 2024 Viktor Bergquist | ||
## | ||
## Calc is open software; you can redistribute it and/or modify it under | ||
## the terms of the version 2.1 of the GNU Lesser General Public License | ||
## as published by the Free Software Foundation. | ||
## | ||
## Calc is distributed in the hope that it will be useful, but WITHOUT | ||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General | ||
## Public License for more details. | ||
## | ||
## A copy of version 2.1 of the GNU Lesser General Public License is | ||
## distributed with calc under the filename COPYING-LGPL. You should have | ||
## received a copy with calc; if not, write to Free Software Foundation, Inc. | ||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are curious about these additions to .gitignore (not that we have any problem when them), @vike2000:
Can you tell us about each of the ignored additions? Some seem clang related and have hints at being useful. What do each of the excludes do?
Ignoring
custom/.gitignore
is an interning choice. We might skip that addition when we "mod your mod" to the.gitignore
file.How are you using such files?
Are you willing to give us, where makes sense, what sort of content they contain>
Perhaps, where reasonable and you feel comfortable, you could also attach ignored files as a tarball.
This won't impact our processing your PR: we just are interested in knowing.