]> gitweb.factorcode.org Git - factor.git/commitdiff
curl: enable use from command-line.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 9 Apr 2015 17:44:03 +0000 (10:44 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 9 Apr 2015 17:44:03 +0000 (10:44 -0700)
extra/curl/curl.factor

index fcd7f2d068be4d6ca3f47b040471aa663df3aff3..bc041756ac341881989191f42e03cfc99f09296c 100644 (file)
@@ -1,7 +1,10 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
 USING: alien alien.c-types alien.data alien.destructors
-alien.syntax curl.ffi destructors io io.encodings.string
-io.encodings.utf8 io.streams.c kernel math namespaces present
-sequences ;
+alien.syntax command-line curl.ffi destructors io
+io.encodings.string io.encodings.utf8 io.streams.c kernel math
+namespaces present sequences ;
 
 IN: curl
 
@@ -38,3 +41,12 @@ PRIVATE>
         [ swap curl-set-url ]
         [ curl-perform ] tri
     ] with-destructors ;
+
+: curl-main ( -- )
+    command-line get [
+        curl-init
+        [ swap curl-set-url ]
+        [ curl-perform ] bi
+    ] each ;
+
+MAIN: curl-main