848ba7303b
FossilOrigin-Name: b5feea667d30aac255d1cfca61fed355d438d2ce6021677f1e53af6302b15eee
28 lines
823 B
Forth
Executable file
28 lines
823 B
Forth
Executable file
#!/usr/bin/env retro
|
|
|
|
This implements `s:paste`, a string to private pastebin in
|
|
RETRO. It uses a Unix pipe to `md5` to create the paste name,
|
|
keeping in line with the `share.forth` example code.
|
|
|
|
It takes a string and returns a pointer to the URL of the
|
|
paste.
|
|
|
|
~~~
|
|
{{
|
|
:pipe{ dup 'md5_-s_"%s" s:format file:R unix:popen ;
|
|
:skip-space dup file:read drop ;
|
|
:skip-info [ dup file:read $= eq? ] until skip-space ;
|
|
:get-checksum #127 [ dup file:read , ] here × dip swap ;
|
|
:} unix:pclose ;
|
|
:cleanup s:chop s:temp ;
|
|
:save [ '/home/crc/public/%s s:format file:spew ] sip ;
|
|
:url 'http://forth.works/%s s:format ;
|
|
---reveal---
|
|
:s:paste (s-s)
|
|
&Heap [ pipe{ skip-info get-checksum } cleanup save url ] v:preserve ;
|
|
}}
|
|
~~~
|
|
|
|
```
|
|
'Hello_#forth s:paste s:put nl
|
|
```
|