Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
1
Task/Unix-ls/Smalltalk/unix-ls-1.st
Normal file
1
Task/Unix-ls/Smalltalk/unix-ls-1.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
Stdout printCR: ( PipeStream outputFromCommand:'ls' )
|
||||
1
Task/Unix-ls/Smalltalk/unix-ls-2.st
Normal file
1
Task/Unix-ls/Smalltalk/unix-ls-2.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
Stdout printCR:('.' asFilename directoryContents sort asStringWith:Character cr)
|
||||
1
Task/Unix-ls/Smalltalk/unix-ls-3.st
Normal file
1
Task/Unix-ls/Smalltalk/unix-ls-3.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
'.' asFilename directoryContents sort do:#printCR
|
||||
34
Task/Unix-ls/Smalltalk/unix-ls-4.st
Normal file
34
Task/Unix-ls/Smalltalk/unix-ls-4.st
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
dir := '.' asFilename.
|
||||
dir directoryContentsAsFilenames sort do:[:fn |
|
||||
|line|
|
||||
"
|
||||
generate a line of the form of ls -l:
|
||||
drwxrwxrwx user group size date time name
|
||||
where year is printed if not current, time of day otherwise
|
||||
"
|
||||
line := String streamContents:[:s |
|
||||
|accessRights|
|
||||
|
||||
s nextPut:(fn isDirectory ifTrue:[$d] ifFalse:[$-]).
|
||||
accessRights := fn symbolicAccessRights.
|
||||
#( readUser writeUser executeUser
|
||||
readGroup writeGroup executeGroup
|
||||
readOthers writeOthers executeOthers
|
||||
)
|
||||
with:'rwxrwxrwx'
|
||||
do:[:eachRight :charToPrint |
|
||||
s nextPut:((accessRights includes:eachRight) ifTrue:[charToPrint] ifFalse:[$-])
|
||||
].
|
||||
(OperatingSystem getUserNameFromID:fn info uid) printOn:s leftPaddedTo:10.
|
||||
(OperatingSystem getGroupNameFromID:fn info gid) printOn:s leftPaddedTo:10.
|
||||
fn fileSize printOn:s leftPaddedTo:12.
|
||||
fn modificationTime year = Date today year ifTrue:[
|
||||
fn modificationTime printOn:s format:' %(dayPadded) %(ShortMonthName) %h:%m'.
|
||||
] ifFalse:[
|
||||
fn modificationTime asDate printOn:s format:' %(dayPadded) %(ShortMonthName) %y'.
|
||||
].
|
||||
s space.
|
||||
s nextPutAll:fn baseName
|
||||
].
|
||||
line printCR
|
||||
].
|
||||
Loading…
Add table
Add a link
Reference in a new issue