Changeset 8717 in project


Ignore:
Timestamp:
02/23/08 22:13:14 (12 years ago)
Author:
sjamaan
Message:

Add an example for 9p-client

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/9p

    r8484 r8717  
    508508Note: The converse procedure, {{9p:directory-listing->data}}, is currently not implemented.
    509509
     510=== Example
     511
     512==== 9p-client
     513
     514Here's a simple example that talks to a wmii server.
     515
     516<enscript highlight=scheme>
     517(use 9p-client posix unix-sockets)
     518
     519(receive (in out)
     520    (unix-connect (sprintf "/tmp/ns.~A.:0/wmii" (getenv "USER")))
     521  (let ((con (9p:client-connect in out)))
     522    (printf "Current tabs on left bar: ~A\n" (9p:directory con "/lbar"))
     523    (printf "Label on first tab on left bar: ~A\n"
     524            (9p:with-input-from-file con `("lbar" ,(car (9p:directory con "/lbar"))) read-string ))
     525    ;; Write something to the right bar
     526    (9p:with-output-to-file con "/rbar/status" (lambda () (printf "Yo, what's up?")))
     527    (9p:client-disconnect con)))
     528</enscript>
     529
     530This prints something like
     531
     532  Current tabs on left bar: (3 2 1)
     533  Label on first tab on left bar: #888888 #222222 #333333 3
     534
     535And it shows the string "Yo, what's up?" on your status bar.
     536
    510537=== Changelog
    511538
Note: See TracChangeset for help on using the changeset viewer.