Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have ocaml support the '-' option (for standard input) #2757

vicuna opened this issue May 4, 2001 · 2 comments

have ocaml support the '-' option (for standard input) #2757

vicuna opened this issue May 4, 2001 · 2 comments


Copy link

@vicuna vicuna commented May 4, 2001

Original bug ID: 352
Reporter: administrator
Assigned to: @damiendoligez
Status: closed (set by @damiendoligez on 2011-12-30T16:29:41Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #5232

Bug description

Full_Name: Sven Luther
Version: 3.01
OS: debian GNU/linux
Submission from: (

Note : this is a feature wish, i didn't find the 'priority' entry in the bug
fill form, so ...

Hello, ...

I wanted to run the labgltk examples from the lablgtk debian package, they are
on a read only directory, and some of them are compressed.

it is easy to run the uncompressed ones (lablgtk -labels, but not so
easy to run the compressed ones.

I thought it would be nice to be able to do as follows :

gunzip -c | lablgtk -labels -

but ocaml clearly don't support this syntax yet.

I know about at least 2 workaround :

  1. under bash you cna do :

(gunzip -c; echo ";;") | lablgtk -labels

but this will scroll up the display, and is not so nice.

  1. you can also do :

gunzip -c | lablgtk -labels /dev/fd/0

but i don't think this is the nicest of solutions

  1. it could be possible also to patch toplevel/,changing :

< let filename = find_in_path !Config.load_path name in
< let ic = open_in_bin filename in

to :

let (filename, ic) =
  if name = "-" then
    (name, stdin)
    let filename = find_in_path !Config.load_path name in
  (filename, open_in_bin_filename) in

or something such more appropriate.

Thanks to Nicolas GEORGE, for hinting me to those and
provide the (untested) patch.

What do you think of it ? Is this something that would be a nice addition to
ocaml, or is it not worth it, to difficult to do ?

Also you could link ocaml with zlib, so as to be able to read compressed files
directly, but i don't know if it is worth it.


Sven Luther
(Thanks to

Copy link

@vicuna vicuna commented Nov 13, 2002

Comment author: administrator

Looks good. To be implemented.

Copy link

@vicuna vicuna commented Dec 30, 2011

Comment author: @damiendoligez

[speaking for the OCaml toplevel rather than labltk]
The "-" syntax is already used by this option:

  • Treat as a file name (even if it starts with `-')

So I have implemented it as a "-stdin" option.

Implemented in trunk (3.13).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants