add strip command (lol)

This commit is contained in:
Lisa Milne 2023-12-14 15:55:37 +10:00
parent 0ac73e2a5a
commit 13113b59d5

View file

@ -51,7 +51,7 @@ Options:
-u Display access time in long format
-a Do not ignore entries starting with .
-1 Display one entry per line
`);
`);
}
function writeNodeData(st,fd) {
@ -188,7 +188,7 @@ Options:
-? Print this help information
-d Download the file data, instead of printing it
-l Only display files if remote data is loaded
`);
`);
}
for (var i=1; i<args.length; i++) {
@ -309,7 +309,7 @@ Usage: touch [OPTION] <FILE>
Options:
-? Print this help information
`);
`);
}
for (var i=1; i<args.length; i++) {
@ -368,7 +368,7 @@ Usage: less [OPTION] <FILE>
Options:
-? Print this help information
`);
`);
}
for (var i=1; i<args.length; i++) {
@ -535,7 +535,7 @@ Options:
-r Remove directories and their contents recusively
-f Ignore nonexistant files and arguments
-? Print this help information
`);
`);
}
for (var i=1; i<args.length; i++) {
@ -637,7 +637,7 @@ Usage: mkdir [OPTION] <DIRECTORY>
Options:
-p Make the full path, not just the final directory
-? Print this help information
`);
`);
}
for (var i=1; i<args.length; i++) {
@ -717,7 +717,7 @@ Usage: chmod [OPTION] <MODE> <FILE>
Options:
-? Print this help information
`);
`);
}
function getModMask(str) {
@ -1020,7 +1020,7 @@ Usage: file [OPTION] <FILE>
Options:
-? Print this help information
`);
`);
}
for (var i=1; i<args.length; i++) {
@ -1103,7 +1103,7 @@ Usage: reboot [OPTION]
Options:
-? Print this help information
`);
`);
}
for (var i=1; i<args.length; i++) {
@ -1154,7 +1154,7 @@ Options:
-s Print the operating system name
-v Print the operating system version
-? Print this help information
`);
`);
}
for (var i=1; i<args.length; i++) {
@ -1230,7 +1230,7 @@ Usage: date [OPTION] [FORMAT]
Options:
-u use UTC instead of local time
-? Print this help information
`);
`);
}
//tm_sec:0, // seconds (0-60)
@ -1306,7 +1306,7 @@ Usage: head [OPTION] <FILE>
Options:
-n N the number of lines to print (default 10)
-? Print this help information
`);
`);
}
function writeFile(fd) {
@ -1392,7 +1392,7 @@ Options:
-n N the number of lines to print (default 10)
-c N instead of lines, print the last N characters
-? Print this help information
`);
`);
}
function writeFile(fd) {
@ -1491,6 +1491,50 @@ Options:
return main(args);
});
clite.commands.load('strip',function(args,env,io) {
var stdio = io.include('stdio');
function help() {
stdio.printf(`
strip - remove unnecessary data from strippable files
Usage: strip [OPTION] <FILE> [FILE...]
Options:
-? Print this help information
`);
}
// this is a no op program, it always succeeds
// it exists solely because posix says it should
// but does nothing because there's nothing to strip from files
// "The strip utility shall remove from strippable files named by
// the file operands any information the implementor deems
// unnecessary for execution of those files" - doing nothing is
// compliant
function main(args) {
for (var i=1; i<args.length; i++) {
if (args[i][0] == '-') {
for (var j=1; j<args[i].length; j++) {
switch (args[i][j]) {
case '?':
help();
return 0;
break;
default:
stdio.fprintf(io.stderr,'unknown argument: -%c\n',args[i][j]);
}
}
}else{
stdio.fprintf(io.stderr,'unknown argument: %s\n',args[i]);
}
}
return 0;
}
return main(args);
});
if (window.location.protocol == 'file:')
clite.commands.load('test',function(args,env,io) {
var stdio = io.include('stdio');