summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZoRo <dos21h@gmail.com>2020-06-27 18:02:17 +0100
committerZoRo <dos21h@gmail.com>2020-06-27 18:02:17 +0100
commit81cece0dc62e1ba9d162ab12ae361b870d74568a (patch)
treeaeb1c75ec74c1d27d616656eb3d27452105edb2f
downloadosystem-81cece0dc62e1ba9d162ab12ae361b870d74568a.tar.gz
osystem-81cece0dc62e1ba9d162ab12ae361b870d74568a.zip
oecho,omkdir,ormdir,omkfile
-rw-r--r--oecho/Makefile7
-rw-r--r--oecho/oecho.ml10
-rw-r--r--oecho/oecho0.ml9
-rw-r--r--omkdir/Makefile8
-rw-r--r--omkdir/omkdir.ml12
-rw-r--r--omkfile/Makefile8
-rw-r--r--omkfile/omkfile.ml13
-rw-r--r--ormdir/Makefile8
-rw-r--r--ormdir/ormdir.ml12
9 files changed, 87 insertions, 0 deletions
diff --git a/oecho/Makefile b/oecho/Makefile
new file mode 100644
index 0000000..d47d838
--- /dev/null
+++ b/oecho/Makefile
@@ -0,0 +1,7 @@
+make:
+ ocamlopt oecho.ml -o oecho
+ ocamlopt oecho0.ml -o oecho0
+
+static:
+ ocamlopt -ccopt -static oecho.ml -o oecho
+ ocamlopt -ccopt -static oecho0.ml -o oecho0 \ No newline at end of file
diff --git a/oecho/oecho.ml b/oecho/oecho.ml
new file mode 100644
index 0000000..eae9ffe
--- /dev/null
+++ b/oecho/oecho.ml
@@ -0,0 +1,10 @@
+open Arg
+open Unix
+open Scanf
+open Printf
+
+let num = Array.length Sys.argv
+let _ = if num == 2 then
+ Printf.printf "%s\n" Sys.argv.(1)
+ else Printf.printf "\n"
+
diff --git a/oecho/oecho0.ml b/oecho/oecho0.ml
new file mode 100644
index 0000000..fed5a00
--- /dev/null
+++ b/oecho/oecho0.ml
@@ -0,0 +1,9 @@
+open Arg
+open Unix
+open Scanf
+open Printf
+
+let num = Array.length Sys.argv
+let _ = if num >= 2 then
+ Printf.printf "%s\n" Sys.argv.(1)
+ else Printf.printf "\n"
diff --git a/omkdir/Makefile b/omkdir/Makefile
new file mode 100644
index 0000000..3ea1d08
--- /dev/null
+++ b/omkdir/Makefile
@@ -0,0 +1,8 @@
+make:
+ ocamlc unix.cma str.cma omkdir.ml -o omkdir
+
+static:
+ ocamlopt unix.cmxa -ccopt -static omkdir.ml -o omkdir
+
+clean:
+ rm -f *.cmi *.cmx *.o *.cmo \ No newline at end of file
diff --git a/omkdir/omkdir.ml b/omkdir/omkdir.ml
new file mode 100644
index 0000000..4e4b053
--- /dev/null
+++ b/omkdir/omkdir.ml
@@ -0,0 +1,12 @@
+open Arg
+open Scanf
+open Printf
+open Unix
+
+let argnum = Array.length Sys.argv
+
+let _ =
+ if argnum >= 2 then
+ let _ = mkdir Sys.argv.(1) 0o755 in ()
+ else
+ Printf.printf "ERR only one argument\n" \ No newline at end of file
diff --git a/omkfile/Makefile b/omkfile/Makefile
new file mode 100644
index 0000000..368a183
--- /dev/null
+++ b/omkfile/Makefile
@@ -0,0 +1,8 @@
+make:
+ ocamlc unix.cma str.cma omkfile.ml -o omkfile
+
+static:
+ ocamlopt unix.cmxa -ccopt -static omkfile.ml -o omkfile
+
+clean:
+ rm -f *.cmi *.cmx *.o *.cmo \ No newline at end of file
diff --git a/omkfile/omkfile.ml b/omkfile/omkfile.ml
new file mode 100644
index 0000000..fbc7a6d
--- /dev/null
+++ b/omkfile/omkfile.ml
@@ -0,0 +1,13 @@
+open Arg
+open Scanf
+open Printf
+open Unix
+
+let argnum = Array.length Sys.argv
+
+let _ =
+ if argnum >= 2 then
+ let fd = openfile Sys.argv.(1) [Unix.O_RDWR;Unix.O_CREAT] 0o666
+ in close fd
+ else
+ Printf.printf "ERR only one argument\n" \ No newline at end of file
diff --git a/ormdir/Makefile b/ormdir/Makefile
new file mode 100644
index 0000000..4ae0c5d
--- /dev/null
+++ b/ormdir/Makefile
@@ -0,0 +1,8 @@
+make:
+ ocamlc unix.cma str.cma ormdir.ml -o ormdir
+
+static:
+ ocamlopt unix.cmxa -ccopt -static ormdir.ml -o ormdir
+
+clean:
+ rm -f *.cmi *.cmx *.o *.cmo \ No newline at end of file
diff --git a/ormdir/ormdir.ml b/ormdir/ormdir.ml
new file mode 100644
index 0000000..db3edc2
--- /dev/null
+++ b/ormdir/ormdir.ml
@@ -0,0 +1,12 @@
+open Arg
+open Scanf
+open Printf
+open Unix
+
+let argnum = Array.length Sys.argv
+
+let _ =
+ if argnum >= 2 then
+ let _ = rmdir Sys.argv.(1) in ()
+ else
+ Printf.printf "ERR only one argument\n" \ No newline at end of file