=CAWKLib CAWKlib is a library of functions for for awk intended to be used with preprocessors/wrappers like app, runawk, or bangcawk. The focus has been mostly on implementing functionality that exists in other dynamic languages "out of the box" but requires some (non?)trivial work for the uninitiated in awk. ==Why the name CAWKLib? The name CAWKLib was chosen by a series of references # I was working on a Web Framework to be written in AWK called Cliff's Awesome Web (application) Kit or CAWK ## The official name would be less egotistical: CAWK's Another Web-app Kit # I needed a pre-processor to handle the functions I was building and none of the existing ones (that I knew of) met my needs so I created BangCAWK ## The name referenced the "shebang" line that it would replace/alter ## I thought "shebangawk" was quite lengthy and slightly vulgar # Initially the libraries were "packaged" with BangCAWK and thanks to some insight from others (thanks Ben) they were eventually pulled out into their own repository ## I'd run out of imaginative names at this point so I just called the thing CAWKLib ==What sort of functionality is implemented in CAWKLib? There is much more work to be done but here are some of the functions in CAWKlib as it is today arrays.awk: *ary_length() -- return the length of an array (meaning the number of elements/values/indices) *ary_width() -- return the width of an array (meaning the number of "dimensions" in a multi-dimensional array) *ary_choice() -- return random index from an array strings.awk: *str_capitalize() -- returns a string with the first character capitalized and the rest lowercase. If a second parameter is specified it is used as a separator and every first character after that separator character is capitalized. *str_insert() -- returns string 's1' with string 's2' inserted at index 'i' *str_repeat() -- repeats a string x number of times (thanks again Ben) *str_repeat_to() -- repeat a string up to a certain length *str_reverse() -- revers a string *str_squeeze() -- reduce successive occurrences of a characters to one instance each *str_center() -- center the supplied string inside the new string of the specified length shc_test.awk: *shc_test() -- low level wrapper function for the 'test' shell command *file_isblock() -- returns 1 if file is a block device *file_ischar() -- returns 1 if file is a character device *file_isdir() -- return 1 if file is a directory *file_isthere() -- returns 1 if file exists *fie_isreg() -- returns 1 if file is a regular file *file_issgid() -- returns 1 if file is set gid *file_issticky() -- returns 1 if the file has the sticky bit set *file_isfifo() -- returns 1 if file is a named pipe (often called fifo) *file_isreadable() -- returns 1 if the file is readable by the current user *file_isnotempty() -- returns 1 if the file is not empty *file_hasterm() -- returns 1 if the file descriptor supplied has a terminal device associated with it *file_issuid() -- returns 1 if file is suid *file_iswritable() -- returns 1 if the file is writable by the current user *file_isexecutable() -- returns 1 if the file is executable by the current user *file_islink() -- returns 1 if the file is a symbolic link *file_hasmyuid() -- returns 1 if the current users euid and the file's owern id match *file_hasmygid() -- returns 1 if the current users gid and the files group id match *file_issocket() -- returns 1 if the file is a socket *file_newerthan() -- returns 1 if the first file is newer than the second *file_olderthan() -- returns 1 if the first file is older than the second *file_samefile() -- returns 1 if two links point to the same file More will come and this page may not be the best place to find out about updates. You should check the repository. ==What sort of functionality will be implemented in the future? Well that depends. The original goal was to make separate libraries from the tools that would be built for CAWK but work on that has slowed as I've been working with Orbit and Web2py. I'm still interested in implementing functionality found in other languages (in particular PHP, Lua, Python and Ruby). I'm open to suggestions for new features/functionality. ==Where can I get it? I'm currently hosting it on my git repository at [[http://git.secution.com/cgit/CAWKLib|http://git.secution.com/cgit/CAWKLib]] **UPDATE**: The repository is currently (temporarily) hosted on github at [[https://github.com/gcw/CAWKLib|https://github.com/gcw/CAWKLib]] ==How can I get it? #Install git (The version control system not the image toolkit) #run this command: git clone https://github.com/gcw/CAWKLib.git ==How do I make suggestions/comments/bug reports Send email to me at gcw (at) Not A Discussion (dot) com
Summary:
This change is a minor edit.
Username: