=head1 NAME getas - execute a command and reveive its translated stdout =head1 SYNOPSIS getas(command, [Options...]) =head1 DESCRIPTION This funcion execute C, reads its output and translate it acording the options received (using the external PERL command C. By default the standard output of the command is tranlated to a C (the seq of the lines). The external command C (that can be enriched if we want) knows about tables C: getas("ps", ['type -> "tab", 'fs -> "...fieldseparator", 'rs -> "...registerSeparator"]) As soon as you have it in camila, you can build a function to translate the values to a more suitable model if necessary. =head1 Examples Listing currend directory: pp(getas("ls -1",[])); Reading date and time: pp(getas("date +'%m %d %H %M %S'", [ 'type -> 'txt, 'rs -> " "])); Process status: pp(getas("ps", ['type -> 'tab])); Which files use C: pp(getas("grep getas *.cam", ['type -> 'tab, 'fs -> ":"])); =cut func getas(com,o) ; o is a mapping with command and options ; Example getas("cat /etc/passwd", ['type-> "tab", 'fs ->":"]); ; options = the options available in "any2sexp" command ; Ex 'type : ("txt" | "tab" ) ; 'F : STR Field separator ; 'R : STR register separator returns let(comm= com ++ " | any2sexp " ++ strcat-red("", <" -" ++ tostr(x) ++ "=\"" ++ tostr(o[x]) ++ "\""| x <- dom(o)>), a = popen(comm,"r"), b = readf(a), = pclose(a)) in b; tostr(x)=if( is-STR(x) -> x, is-SYM(x) -> symstr(x), is-INT(x) -> itoa(x));