@@ -0,0 +1,26 @@
|
||||
/** Shared helpers for drive-resident /bin scripts (prepended before each command). */
|
||||
function bareStdin(ctx) {
|
||||
return typeof ctx.shellStdin === 'string' ? ctx.shellStdin : ''
|
||||
}
|
||||
|
||||
async function run(ctx, argv) {
|
||||
const paths = argv.slice(1).filter((a) => !a.startsWith('-'))
|
||||
if (!paths.length) {
|
||||
ctx.console.error('pathchk: missing operand')
|
||||
return
|
||||
}
|
||||
for (const p of paths) {
|
||||
if (!p.length) {
|
||||
ctx.console.error('pathchk: empty path name')
|
||||
continue
|
||||
}
|
||||
if (p.length > 4096) {
|
||||
ctx.console.error('pathchk: path too long')
|
||||
continue
|
||||
}
|
||||
if (p.includes('\0')) {
|
||||
ctx.console.error('pathchk: NUL in path')
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user