Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -1,17 +1,11 @@
main:(
PROC remove = (STRING file name)INT:
BEGIN
FILE actual file;
INT errno = open(actual file, file name, stand back channel);
IF errno NE 0 THEN stop remove FI;
scratch(actual file); # detach the book and burn it #
errno
EXIT
stop remove:
errno
END;
remove("input.txt");
remove("/input.txt");
remove("docs");
remove("/docs")
)
BEGIN
# note the pathnames and commands are Windows specific - adjust for other systems #
STRING root = "\", del = "del ", rmdir = "rmdir ";
PROC remove file = (STRING file name)INT: system( del + file name );
PROC remove dir = (STRING file name)INT: system(rmdir + file name );
PROC report error = ( STRING message )VOID: print( ( message, newline ) );
IF remove file("input.txt") NE 0 THEN report error( "Unable to remove input.txt" ) FI;
IF remove file(root + "input.txt") NE 0 THEN report error( "Unable to remove " + root + "input.txt" ) FI;
IF remove dir("docs") NE 0 THEN report error( "Unable to remove docs" ) FI;
IF remove dir(root + "docs") NE 0 THEN report error( "Unable to remove " + root + "docs" ) FI
END

View file

@ -0,0 +1,12 @@
# by Artyom Bologov
# Write nothing to the file.
# That's the best one can do with ed native APIs.
,d
w input.txt
# Invoking the shell.
# More reliable but surrendering to the OS.
!rm input.txt
!rm -r docs/
!rm /input.txt
!rm -r /docs/
Q

View file

@ -0,0 +1,15 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
public final class DeleteAFile {
public static void main(String[] args) throws IOException {
Files.delete(Path.of("output.txt"));
Files.delete(Path.of("docs"));
Files.delete(Path.of("/output.txt"));
Files.delete(Path.of("/docs"));
}
}