Skip to content

Commit 063c292

Browse files
committed
Rename ShellWget to be ShellHttpGet; ShellHttpGet now tries to use curl if wget is not present; ShellHttpGet now resides in the file library/ONLINEUTILS (rather than library/UNIXUTILS) and is loaded only into the Online Medley docker image and not the standard Medley loadups
1 parent 244cadb commit 063c292

File tree

8 files changed

+72
-33
lines changed

8 files changed

+72
-33
lines changed

docker_medley/Dockerfile_medley

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ COPY scripts/* ${ONLINE_BINDIR}
114114
RUN chmod ugo+x ${ONLINE_BINDIR}/* \
115115
&& ln -s ${ONLINE_BINDIR}/request_new_tab.sh ${ONLINE_BINDIR}/request_new_tab
116116

117+
# copy online-specific files into medley/library
118+
COPY --chown=${USER_NAME}:${USER_NAME} library/ONLINEUTILS ${MEDLEY_INSTALLDIR}/library
119+
COPY --chown=${USER_NAME}:${USER_NAME} library/ONLINEUTILS.LCOM ${MEDLEY_INSTALLDIR}/library
117120

118121
# copy INIT file into home directory
119122
COPY --chown=${USER_NAME}:${USER_NAME} init/INIT ${MEDLEY_USERDIR}

docker_medley/init/ONLINE-INIT

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
22

3-
(FILECREATED "29-Oct-2025 23:56:02" {DSK}<home>frank>il>medley>greetfiles>ONLINE-INIT.;2 11034
3+
(FILECREATED "18-Nov-2025 23:19:56" {DSK}<home>frank>il>online>docker_medley>init>ONLINE-INIT.;51 10938
44

55
:EDIT-BY "FGH"
66

7-
:CHANGES-TO (ADVICE (SAVEVM :IN \IDLER))
8-
(FNS Online.SftpInitInfo Online.SftpUpdateInfo Online.SetUpNOTECARDSDIRECTORIES
9-
Online.DoInit ONLINEP Online.FileButton)
10-
(VARS ONLINE-INITCOMS)
7+
:CHANGES-TO (VARS ONLINE-INITCOMS)
118

12-
:PREVIOUS-DATE "18-Mar-2025 22:45:51" {DSK}<home>frank>il>medley>greetfiles>ONLINE-INIT.;1)
9+
:PREVIOUS-DATE "29-Oct-2025 23:56:02"
10+
{DSK}<home>frank>il>online>docker_medley>init>ONLINE-INIT.;50)
1311

1412

1513
(PRETTYCOMPRINT ONLINE-INITCOMS)
@@ -19,6 +17,8 @@
1917
APPS-INIT)
2018
(FILES (SYSLOAD)
2119
VTCHAT)
20+
(FILES (SYSLOAD)
21+
ONLINEUTILS)
2222
(GLOBALVARS Online.LogoutTimeout Online.SftpPort Online.SftpPassword Online.SftpDisplay
2323
IDLE.PROFILE IDLE.BOUNCING.BOX Online.SftpDisplayMenu ONLINEP ShellBrowser ShellOpener
2424
CLHS.OPENER MEDLEYDIR)
@@ -35,6 +35,9 @@
3535

3636
(FILESLOAD (SYSLOAD)
3737
VTCHAT)
38+
39+
(FILESLOAD (SYSLOAD)
40+
ONLINEUTILS)
3841
(DECLARE%: DOEVAL@COMPILE DONTCOPY
3942

4043
(GLOBALVARS Online.LogoutTimeout Online.SftpPort Online.SftpPassword Online.SftpDisplay IDLE.PROFILE
@@ -247,7 +250,7 @@
247250
(BKSYSBUF " ")
248251
)
249252
(DECLARE%: DONTCOPY
250-
(FILEMAP (NIL (1924 10898 (Online.SftpInitInfo 1934 . 2807) (Online.SftpUpdateInfo 2809 . 3064) (
251-
Online.SetUpNOTECARDSDIRECTORIES 3066 . 4774) (Online.FileButton 4776 . 7604) (Online.DoInit 7606 .
252-
10759) (ONLINEP 10761 . 10896)))))
253+
(FILEMAP (NIL (1828 10802 (Online.SftpInitInfo 1838 . 2711) (Online.SftpUpdateInfo 2713 . 2968) (
254+
Online.SetUpNOTECARDSDIRECTORIES 2970 . 4678) (Online.FileButton 4680 . 7508) (Online.DoInit 7510 .
255+
10663) (ONLINEP 10665 . 10800)))))
253256
STOP
-60 Bytes
Binary file not shown.

docker_medley/library/ONLINEUTILS

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
2+
3+
(FILECREATED "18-Nov-2025 22:54:33" {DSK}<home>frank>il>medley>library>ONLINEUTILS.;2 2078
4+
5+
:EDIT-BY "FGH"
6+
7+
:CHANGES-TO (FNS ShellHttpGet)
8+
9+
:PREVIOUS-DATE "18-Nov-2025 22:48:48" {DSK}<home>frank>il>medley>library>ONLINEUTILS.;1)
10+
11+
12+
(PRETTYCOMPRINT ONLINEUTILSCOMS)
13+
14+
(RPAQQ ONLINEUTILSCOMS ((FNS ShellHttpGet)))
15+
(DEFINEQ
16+
17+
(ShellHttpGet
18+
[LAMBDA (URL OUTFILENAME) (* ; "Edited 18-Nov-2025 22:54 by FGH")
19+
20+
(* ;; "Download a file specified by URL from the internet and place it in anew file name OUTFILENAME. OUTFILENAME will be versioned if it is on a versioned file device. Protocol of URL must be http: or https:. Uses wget (if it exists) or curl (if it exists) via a ShellCommand. It is an error if the underlying system doesn't have either wget or curl.")
21+
 (* ; "Edited 18-Nov-2025 22:39 by FGH")
22+
(LET ((UURL (U-CASE URL)))
23+
(if (NOT (OR (STRPOS "HTTP:://" UURL NIL NIL T)
24+
(STRPOS "HTTPS://" UURL NIL NIL T)))
25+
then (ERROR "ShellHttpGet URL argument is not a HTTP:// or HTTPS:// Url")))
26+
(LET* ((WGET (ShellWhich "wget"))
27+
(CURL (if (NULL WGET)
28+
then (ShellWhich "curl")
29+
else NIL))
30+
(OUTNAME (OUTFILEP OUTFILENAME))
31+
(TMPFILE (CONCAT "/tmp/wget" (CLOCK)))
32+
(UNIXFILE (CONCAT "{UNIX}" TMPFILE))
33+
(CMD (if WGET
34+
then (CONCAT WGET " " URL " -O " TMPFILE)
35+
elseif CURL
36+
then (CONCAT CURL " " URL " --output " TMPFILE)
37+
else NIL)))
38+
(if (NULL CMD)
39+
then (ERROR "ShellHttpGet - neither wget nor curl are available on this system"))
40+
(ShellCommand CMD)
41+
(COPYFILE UNIXFILE OUTNAME)
42+
(DELFILE UNIXFILE)
43+
OUTNAME])
44+
)
45+
(DECLARE%: DONTCOPY
46+
(FILEMAP (NIL (414 2055 (ShellHttpGet 424 . 2053)))))
47+
STOP
1.31 KB
Binary file not shown.

docs/Demo_mode.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Any LOADable Lisp file (source or compiled, Interlisp or Medley CommonLisp) can
2727

2828
Sample start scripts can be found in the Interlisp/Online Github repo in the start-scripts directory.
2929

30-
Most demos will require Lisp (or other) files that are not included in the standard Online Medley image. One very handy function to be used in start scripts for these demos is ```(ShellWget URL OUTFILE)```. This function will download (using wget) the file specified by URL and store it in the versioned Online Medley file system under the name OUTFILE. OUTFILE can then be LOADed by the start script.
30+
Most demos will require Lisp (or other) files that are not included in the standard Online Medley image. One very handy function to be used in start scripts for these demos is ```(ShellHttpGet URL OUTFILE)```. This function will download (using wget or curl) the file specified by URL and store it in the versioned Online Medley file system under the name OUTFILE. OUTFILE can then be LOADed by the start script.
3131

32-
Below is the start script for a demo of Pamoroso's INSPHEX utility. The start script defines and then runs a function called START-INSPHEX. The START-INPHEX function in turn uses ShellWget to download the source code to INSPHEX from Github, compiles it, loads the compiled file and then uses ADD.PROCESS to run the main HEXDUMP function. There is some additional complication in the call to ADD.PROCESS to ensure that packages are handled correctly. But most existing Interlisp demos will not need this complexity since they don't use packages.
32+
Below is the start script for a demo of Pamoroso's INSPHEX utility. The start script defines and then runs a function called START-INSPHEX. The START-INPHEX function in turn uses ShellHttpGet to download the source code to INSPHEX from Github, compiles it, loads the compiled file and then uses ADD.PROCESS to run the main HEXDUMP function. There is some additional complication in the call to ADD.PROCESS to ensure that packages are handled correctly. But most existing Interlisp demos will not need this complexity since they don't use packages.
3333

3434
```
3535
(DEFINE-FILE-INFO ^^PACKAGE "INTERLISP" ^^READTABLE "INTERLISP" ^^BASE 10)
@@ -46,7 +46,7 @@ Below is the start script for a demo of Pamoroso's INSPHEX utility. The start s
4646
[LAMBDA NIL
4747
(LET* ((INSPHEX.FILE (OUTFILEP "{CORE}INSPHEX"))
4848
INSPHEX.DFASL)
49-
(ShellWget "https://raw.githubusercontent.com/pamoroso/insphex/refs/heads/main/INSPHEX"
49+
(ShellHttpGet "https://raw.githubusercontent.com/pamoroso/insphex/refs/heads/main/INSPHEX"
5050
INSPHEX.FILE)
5151
(SETQ INSPHEX.DFASL (CL:COMPILE-FILE INSPHEX.FILE))
5252
(LOAD INSPHEX.DFASL)

start-scripts/START-INSPHEX

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,29 @@
11
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
22

3-
(FILECREATED "11-Nov-2025 23:54:22" {DSK}<home>frank>il>online>start-scripts>START-INSPHEX.;18 2203
3+
(FILECREATED "18-Nov-2025 23:40:40" {DSK}<home>frank>il>online>start-scripts>START-INSPHEX.;25 1665
44

55
:EDIT-BY "FGH"
66

77
:CHANGES-TO (FNS START-INSPHEX)
8-
(FUNCTIONS TmpShellWget)
98
(VARS START-INSPHEXCOMS)
109

11-
:PREVIOUS-DATE "11-Nov-2025 23:50:23" {DSK}<home>frank>il>online>start-scripts>START-INSPHEX.;17
10+
:PREVIOUS-DATE "11-Nov-2025 23:54:22" {DSK}<home>frank>il>online>start-scripts>START-INSPHEX.;18
1211
)
1312

1413

1514
(PRETTYCOMPRINT START-INSPHEXCOMS)
1615

17-
(RPAQQ START-INSPHEXCOMS ((FUNCTIONS TmpShellWget)
18-
(FNS START-INSPHEX)
16+
(RPAQQ START-INSPHEXCOMS ((FNS START-INSPHEX)
1917
(P (START-INSPHEX))))
20-
21-
(CL:DEFUN TmpShellWget (URL OUTFILENAME) (* ; "Edited 11-Nov-2025 23:50 by FGH")
22-
(LET* ((WGET (ShellWhich "wget"))
23-
(OUTNAME (OUTFILEP OUTFILENAME))
24-
(TMPFILE (CONCAT "/tmp/wget" (CLOCK)))
25-
(UNIXFILE (CONCAT "{UNIX}" TMPFILE))
26-
(CMD (CONCAT WGET " " URL " -O " TMPFILE)))
27-
(if (NULL WGET)
28-
then (ERROR "ShellWget - wget not available"))
29-
(ShellCommand CMD)
30-
(COPYFILE UNIXFILE OUTNAME)
31-
(DELFILE UNIXFILE)
32-
OUTNAME))
3318
(DEFINEQ
3419

3520
(START-INSPHEX
36-
[LAMBDA NIL (* ; "Edited 11-Nov-2025 23:54 by FGH")
21+
[LAMBDA NIL (* ; "Edited 18-Nov-2025 23:40 by FGH")
22+
(* ; "Edited 11-Nov-2025 23:54 by FGH")
3723
(* ; "Edited 7-Nov-2025 10:43 by FGH")
3824
(LET* ((INSPHEX.FILE (OUTFILEP "{CORE}INSPHEX"))
3925
INSPHEX.DFASL)
40-
(TmpShellWget "https://raw.githubusercontent.com/pamoroso/insphex/refs/heads/main/INSPHEX"
26+
(ShellHttpGet "https://raw.githubusercontent.com/pamoroso/insphex/refs/heads/main/INSPHEX"
4127
INSPHEX.FILE)
4228
(SETQ INSPHEX.DFASL (CL:COMPILE-FILE INSPHEX.FILE))
4329
(LOAD INSPHEX.DFASL)
@@ -51,5 +37,5 @@
5137

5238
(START-INSPHEX)
5339
(DECLARE%: DONTCOPY
54-
(FILEMAP (NIL (623 1170 (TmpShellWget 623 . 1170)) (1171 2159 (START-INSPHEX 1181 . 2157)))))
40+
(FILEMAP (NIL (528 1621 (START-INSPHEX 538 . 1619)))))
5541
STOP

start-scripts/START-INSPHEX.LCOM

-461 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)