vip script: urls & files ------------------------ -- general ----------------------------------------------------- device: file: block sequential device read-write r/w pointer dir: block special device read-only yields a list link: block special device read-write pipe: sequential device read-only or write-only sock: sequential device read-write // sio: sequential device via file:/dev/ // read-write // block: block device via file:/dev/ // read-write // r/w pointer // null: sequential device via file:/dev/ // read-write // tty: sequential device via file:/dev/ // read-write // write pointer: x/y path: not x-www-url-encoded, protocol "file": "relative/path" caveat: amiguous with url.protocol specifier "./relative/path" "../relative/path" "~/path" "/absolute/aka/hard/path" "/" url: not x-www-url-encoded, protocol "file": "path" x-www-url-encoded: "protocol://host/hard/path" "protocol:///hard/path" --> short for localhost "protocol:/hard/path" --> implies localhost "protocol:[//[[user[:pw]@]host[:port]]]/hard/path" "protocol:[//[[user[:pw]@]host[:port]]]/hard/path?vname=value&var2=value2" "protocol:[//[[user[:pw]@]host[:port]]]/hard/path#anchor" protocol: file, ftp, http, scp, tcp, udp, mail, smtp, ... symbolic links: symbolic links are always followed except for device "link", which does not follow the last path component -- shell commands -------------------------------------------------------- dir "url[/mask]" device = "dir" print beautified directory listing if "url" does not lead to a directory device, then the last component is handled as a match pattern pwd print full real "path" of local working directory same as: fullpath "." -- instructions -------------------------------------------------------- cd: cd "path" device = "dir" change local working directory [new] device|var: block device only [new] device "url" [= text] or other assignment operator [new] device ("url",flags) [= text] whether you can't, may, or must store initial data depends on the type of device shell: "new" can hardly be omitted for device "dir" [[new][var]] var.ref [= number|text|list|proc] or other assignment operator [new] proc var.ref() { ... } if "new" is given, then the device|var must not yet exist. if "new" is omitted, then the device|var may or may not yet exist. if "new" and "var" is omitted, then the var must already exist. del device|var: del device "url" delete file, pipe, empty directory, etc. device must match actual device found at "path" del [var] var.ref del [var] * name device|var: name device "url" = "newname" | "new/path" rename and optionally move device to other directory the actual device type is not checked; use "file" or "link" name [var] var.ref = "newname" swap device|var: swap device "url" , [device2] "path2" you can only swap devices on the same host and hard device both devices should be the same type but sometimes you can also swap different types, e.g. dir and file actual device types are not checked; use "file" or "link" swap [var] var.ref, [var] var.ref2 swap location of variables. swaps contents and names! open[|in|out] serialdevice: open [#number,] [device] "url" if device is omitted, then "file" is assumed openin [#number,] [device] "url" openout [#number,] [device] "url" open [#number,] device("url",flags) openin [#number,] device("url",flags) openout [#number,] device("url",flags) -- functions -------------------------------------------------------- fullpath device: text = fullpath [device] "url" final symbolic link is followed except for device "link" does not set error if path components do not exist does not check the actual device at the path position returned path ends on "/" if fileprot==dir or path=="/" exists device|var: bool = exists device "url" returns true if device exists AND is of requested type bool = exists [var] var.ref typeof device|var: text = typeof device "url" text = typeof value return values: "number", "text", "list", "proc" "file", "dir", "pipe", "link", "sock", "unknown", "free" <-- match device names! isfile|isdir|islink device: bool = isfile "url" bool = isdir "url" bool = islink "url" count device|var: number = count device "url" block devices only number = count [list|text] mdate device: number = mdate [device] "url" default device = "file" device|var: text = device "url" block devices only list = dir "url[/mask]" number|text|list|proc = value -- function|instructions -------------------------------------------------------- call url: call [device] "url" [, arguments] default device = "file" value = call( [device] "url" [, arguments] ) sys url: sys [device] "path" [, arguments] default device = "file" list = sys( [device] "path" [, arguments] ) returned list = { "stdout_data", "stderr_data", return_code } include url | eval var: include [device] "url" default device = "file" value = include [device] "url" eval text value = eval text freeze|melt|convert|import|export file|var: freeze file "url" freeze or melt freeze [var] text.var.ref convert file "url" from|to xyz convert, import or export convert [var] text.var.ref from|to xyz