-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows you to collect the output of commands in cells. Previously This had to be done with a macro, but it's very convenient to write @value(@System("query value")).
- Loading branch information
Showing
7 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <stdbool.h> | ||
#include <stddef.h> | ||
|
||
#include "lottypes.h" | ||
#include "lotfuncs.h" | ||
#include "lotdefs.h" | ||
#include "atfuncs.h" | ||
|
||
int16_t at_system() | ||
{ | ||
FILE *cmd; | ||
char buf[512] = {0}; | ||
|
||
if (!check_one_string()) { | ||
return 0; | ||
} | ||
|
||
cmd = popen(peek_string(0), "r"); | ||
|
||
if (cmd == NULL) { | ||
return drop_one_push_err(); | ||
} | ||
|
||
// We can read at most 512 bytes of output. | ||
fscanf(cmd, "%511[^\n]", buf); | ||
|
||
// We return @ERR if the command returned failure. | ||
if (pclose(cmd) != EXIT_SUCCESS) { | ||
return drop_one_push_err(); | ||
} | ||
|
||
// Return the output as a string. | ||
return drop_one_push_stack_string(buf); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,3 +83,5 @@ display_filename | |
filename_length | ||
mac_nobreak | ||
mac_str | ||
drop_one_push_stack_string | ||
drop_one_push_err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2767,7 +2767,7 @@ | |
130 "PMT2" | ||
131 "PV2" | ||
132 "FV2" | ||
133 "TERM2" | ||
133 "SYSTEM" | ||
134 "?" | ||
|
||
=group 21, 256 bytes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters