stcall(3)
π stcall(3) β the "call a command processor with a command string" page π
okay bestie, welcome to stcall, part of the ShapeTools Toolkit Library. this is the page for stCallEditor, stCallCmd, stCallCmdErrno and stFindProgram β yes it's giving "four functions, one manpage, one chaotic group chat" and honestly? iconic. grab a snack, we're doing this. π
β¨ NAME β¨
stCallEditor, stCallCmd, stCallCmdErrno, stFindProgram β call command processor with command string. that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <config.h>
#include <sttk.h.h>
int stCallEditor (char *editor, char *file, char *contents, char
**newcontents);
int stCallCmd (char *commandProcessor, char *commandString);
int stCallCmdErrno;
char*stFindProgram (char *fileName)
lowkey note that the include is literallysttk.h.hand thestFindProgramline has no space before the*. i am not touching a single character of that, that's the original's whole aesthetic. π
π¦ DESCRIPTION π¦
stCallEditor π
so stCallEditor calls up editor editor on file file, and then hands you back its contents after the editor session in newcontents. the return value? the length of the new text. periodt.
if it fails, 0 is returned to signal the error. on failure newcontents is not updated and points to nowhere (rip). and on error, the file will be removed β yes, gone, deleted, evaporated. π
if contents points to a valid text, that text gets put (not appended!! we're replacing, not stacking) into the temporary file before the editor starts.
π¨contentsmust beNULLterminated, otherwise strange things will happen. and when the manpage says strange things, bestie, it means strange things. don't test it. π
stCallCmd β¨
stCallCmd invokes commandProcessor as a child process and writes commandString to its standard input. the current process then waits for the child process to terminate β no multitasking, no cutting the line, we're waiting. π«Ά
stCallCmd returns the exit status of the child process as reported by wait(2).
the commandProcessor string may contain command line arguments to the command processor, separated by whitespace. (this is necessary for some programs to make them read commands from standard input β iykyk.)
the command processor program is searched for in the directories given in the environment variable PATH.
and if commandString doesn't end with a newline, a newline is added. we're polite like that. π
stFindProgram π
stFindProgram returns the full pathname of programName if the program is found and executable. otherwise it returns NULL. simple as that, no notes. π
π ENVIRONMENT π
PATHβ list of colon-separated directoriy names whereexecvp(3)searches for the program to execute (default/bin:/usr/bin:/usr/ucb).
yes it says "directoriy". we're keeping it. it's part of the family now. π
π SEE ALSO π
π©Ί DIAGNOSTICS π©Ί
on a successful call, stCallCmd returns the exit status of the child process. if an error occurred, stCallCmd returns a negative number as defined in sttk.h:
CMDPROC_EMPTYβ an empty orNULLstring has been supplied forcommandProcessor. (you gave it nothing, bestie, it's giving nothing back.)NO_MORE_COREβ a call tomalloc(3)orcalloc(3)returned aNULLpointer. πFORK_FAILEDβfork(2)could not create a child process.PIPE_FAILEDβ a call topipe(2)failed.WAIT_ERRORβ a call towait(2)failed.EXEC_FAILEDβexecvp(3)could not executecommandProcessor.CHILD_KILLEDβ the child process was killed by an uncaught signal. πWRITE_FAILEDβwrite(2)could not writecommandStringto the pipe. this usually happens whencommandProcessordoes not read its standard input and terminates beforecommandStringis written.NO_PROGRAMβcommandProcessorcould not be found.
for the most error conditions, the integer variable stCallCmdErrno (declared in sttk.h) contains additional information about the error condition β usually the contents of errno(3) after a failed system call.
in the case of CHILD_KILLED, stCallCmdErrno contains the status of the child process as reported by wait(2).
π BUGS π
- on systems where no usable
vfork(2)is available, the value ofstCallCmdErrnodoes not make sense in case ofEXEC_FAILED. like, it's there, it's just lying to you. π - under IRIX,
stCallCmdsometimes (or always?) returnsWAIT_ERRORwhere it should beEXEC_FAILED,NO_PROGRAM, orWRITE_FAILED. IRIX really said "mystery box" and we're all just living with it. π
π AUTHORS π
JΓΌrgen Nickelsen <nickel@cs.tu-berlin.de> and Andreas.Lampen@cs.tu-berlin.de
and that's the page, bestie! π this whole thing came from sttk-1.7, dated Thu Jun 24 17:43:29 1993 β yes, 1993, it's vintage, it's archival, it's main character energy from another era. mwah. π β¨π¦πΈ
π¦ where this page comes from
- debian bookworm: atfs-dev 1.4pl6-15+b1
- ubuntu jammy: atfs-dev 1.4pl6-15
- ubuntu noble: atfs-dev 1.4pl6-16.1build1
- ubuntu resolute: atfs-dev 1.4pl6-17
- ubuntu stonking: atfs-dev 1.4pl6-17
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms