diff options
-rw-r--r-- | extension/ChangeLog | 3 | ||||
-rw-r--r-- | extension/filefuncs.3am | 26 | ||||
-rw-r--r-- | extension/fnmatch.3am | 6 | ||||
-rw-r--r-- | extension/fork.3am | 11 | ||||
-rw-r--r-- | extension/ordchr.3am | 4 | ||||
-rw-r--r-- | extension/readdir.3am | 22 | ||||
-rw-r--r-- | extension/readfile.3am | 4 | ||||
-rw-r--r-- | extension/rwarray.3am | 19 | ||||
-rw-r--r-- | extension/time.3am | 10 |
9 files changed, 78 insertions, 27 deletions
diff --git a/extension/ChangeLog b/extension/ChangeLog index 22b72019..bc4b060b 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -11,6 +11,9 @@ * readdir.c (dir_can_take_file): Use members in iobuf. * rwarray.c (do_writea): Initialize fp to NULL. + * filefuncs.3am, fnmatch.3am, fork.3am, ordchr.3am, readdir.3am, + readfile.3am, rwarray.3am, time.3am: Updated. + 2012-08-03 Andrew J. Schorr <aschorr@telemetry-investments.com> * readdir.c (dir_get_record): Fix for systems where ino_t is diff --git a/extension/filefuncs.3am b/extension/filefuncs.3am index 79694370..592dc070 100644 --- a/extension/filefuncs.3am +++ b/extension/filefuncs.3am @@ -1,4 +1,4 @@ -.TH FILEFUNCS 3am "Jul 15 2012" "Free Software Foundation" "GNU Awk Extension Modules" +.TH FILEFUNCS 3am "Aug 08 2012" "Free Software Foundation" "GNU Awk Extension Modules" .SH NAME filefuncs \- provide some file related functionality to gawk .SH SYNOPSIS @@ -170,7 +170,7 @@ The function provides a hook to the .IR fts (3) set of routines for traversing file heirarchies. -Instead of returning data about one file at a time in a ``stream,'' +Instead of returning data about one file at a time in a stream, it fills in a multi-dimensional array with data about each file and directory encountered in the requested heirarchies. .PP @@ -295,7 +295,9 @@ The .B fts() function returns 0 if there were no errors. Otherwise it returns \-1. .SH NOTES -The AWK extension does not exactly mimic the interface of the +The AWK +.B fts() +extension does not exactly mimic the interface of the .IR fts (3) routines, choosing instead to provide an interface that is based on associative arrays, which should be more comfortable to use from @@ -306,13 +308,15 @@ already provides powerful array sorting facilities. While an interface could have been provided, this felt less natural than simply creating a multi-dimensional array to represent the file heirarchy and its information. -... .SH BUGS +.SH BUGS +There are many more file-related functions for which AWK +interfaces would be desirable. .SH EXAMPLE -.ft CW -.nf -FIXME: NEED AN EXAMPLE -.fi -.ft R +See +.B test/fts.awk +in the +.I gawk +distribution for an example. .SH "SEE ALSO" .IR "GAWK: Effective AWK Programming" , .IR fnmatch (3am), @@ -322,6 +326,10 @@ FIXME: NEED AN EXAMPLE .IR readfile (3am), .IR rwarray (3am), .IR time (3am). +.PP +.IR chdir (2), +.IR fts (3), +.IR stat (2). .SH AUTHOR Arnold Robbins, .BR arnold@skeeve.com . diff --git a/extension/fnmatch.3am b/extension/fnmatch.3am index d4384974..b35f626d 100644 --- a/extension/fnmatch.3am +++ b/extension/fnmatch.3am @@ -1,10 +1,10 @@ -.TH FNMATCH 3am "Jul 12 2012" "Free Software Foundation" "GNU Awk Extension Modules" +.TH FNMATCH 3am "Aug 08 2012" "Free Software Foundation" "GNU Awk Extension Modules" .SH NAME fnmatch \- compare a string against a filename wildcard .SH SYNOPSIS .ft CW @load "fnmatch" -.br +.sp result = fnmatch(pattern, string, flags) .ft R .SH DESCRIPTION @@ -89,6 +89,8 @@ if (fnmatch("*.a", "foo.c", flags) == FNM_NOMATCH) .IR readfile (3am), .IR rwarray (3am), .IR time (3am). +.PP +.IR fnmatch (3). .SH AUTHOR Arnold Robbins, .BR arnold@skeeve.com . diff --git a/extension/fork.3am b/extension/fork.3am index 804ad0c9..9e545a14 100644 --- a/extension/fork.3am +++ b/extension/fork.3am @@ -1,10 +1,10 @@ -.TH FORK 3am "Jul 30 2012" "Free Software Foundation" "GNU Awk Extension Modules" +.TH FORK 3am "Aug 08 2012" "Free Software Foundation" "GNU Awk Extension Modules" .SH NAME fork, wait, waitpid \- basic process management .SH SYNOPSIS .ft CW @load "fork" -.br +.sp pid = fork() .sp ret = waitpid(pid) @@ -42,7 +42,8 @@ There is no corresponding .B exec() function. .PP -The interfaces could be enhanced to provide more facilities. +The interfaces could be enhanced to provide more facilities, +including pulling out the various bits of the return status. .SH EXAMPLE .ft CW .nf @@ -63,6 +64,10 @@ else .IR readfile (3am), .IR rwarray (3am), .IR time (3am). +.PP +.IR fork (2), +.IR wait (2), +.IR waitpid (2). .SH AUTHOR Arnold Robbins, .BR arnold@skeeve.com . diff --git a/extension/ordchr.3am b/extension/ordchr.3am index a7d7b902..343c49b0 100644 --- a/extension/ordchr.3am +++ b/extension/ordchr.3am @@ -1,10 +1,10 @@ -.TH ORDCHR 3am "Jul 11 2012" "Free Software Foundation" "GNU Awk Extension Modules" +.TH ORDCHR 3am "Aug 08 2012" "Free Software Foundation" "GNU Awk Extension Modules" .SH NAME ordchr \- convert characters to strings and vice versa .SH SYNOPSIS .ft CW @load "ordchr" -.br +.sp number = ord("A") .br string = chr(65) diff --git a/extension/readdir.3am b/extension/readdir.3am index 57c61f33..5f6ae06f 100644 --- a/extension/readdir.3am +++ b/extension/readdir.3am @@ -1,10 +1,10 @@ -.TH READDIR 3am "Jul 30 2012" "Free Software Foundation" "GNU Awk Extension Modules" +.TH READDIR 3am "Aug 08 2012" "Free Software Foundation" "GNU Awk Extension Modules" .SH NAME readdir \- directory input parser for gawk .SH SYNOPSIS .ft CW @load "readdir" -.br +.sp readdir_do_ftype(1) # or 0 .ft R .SH DESCRIPTION @@ -28,7 +28,19 @@ file: .B f for file, .B d -for directory, and so on. +for directory, +.B b +for a block device, +.B c +for a character device, +.B p +for a FIFO, +.B l +for a symbolic link, +.B s +for a socket, and +.B u +(unknown) for anything else. .PP On systems without the file type information, calling .B readdir_do_ftype(1) @@ -57,6 +69,10 @@ BEGIN { FS = "/" } .IR readfile (3am), .IR rwarray (3am), .IR time (3am). +.PP +.IR opendir (3), +.IR readdir (3), +.IR stat (2). .SH AUTHOR Arnold Robbins, .BR arnold@skeeve.com . diff --git a/extension/readfile.3am b/extension/readfile.3am index 1bcb94f3..f68850a4 100644 --- a/extension/readfile.3am +++ b/extension/readfile.3am @@ -1,10 +1,10 @@ -.TH READFILE 3am "Jul 11 2012" "Free Software Foundation" "GNU Awk Extension Modules" +.TH READFILE 3am "Aug 08 2012" "Free Software Foundation" "GNU Awk Extension Modules" .SH NAME readfile \- return the entire contents of a file as a string .SH SYNOPSIS .ft CW @load "readfile" -.br +.sp result = readfile("/some/path") .ft R .SH DESCRIPTION diff --git a/extension/rwarray.3am b/extension/rwarray.3am index b8977604..c68e4b4a 100644 --- a/extension/rwarray.3am +++ b/extension/rwarray.3am @@ -1,12 +1,12 @@ -.TH RWARRAY 3am "Aug 01 2012" "Free Software Foundation" "GNU Awk Extension Modules" +.TH RWARRAY 3am "Aug 08 2012" "Free Software Foundation" "GNU Awk Extension Modules" .SH NAME writea, reada \- write and read gawk arrays to/from files .SH SYNOPSIS .ft CW @load "rwarray" -.br -ret = writea(file, array) .sp +ret = writea(file, array) +.br ret = reada(file, array) .ft R .SH DESCRIPTION @@ -34,6 +34,19 @@ the array named as the second argument. It clears the array first. Here too, the return value is 1 on success and 0 on failure. .SH NOTES +The array created by +.B reada() +is identical to that written by +.B writea() +in the sense that the contents are the same. However, due +to implementation issues, the array traversal order of the recreated +array will likely be different from that of the original array. +As array traversal order in AWK is by default undefined, this is +not (technically) a problem. If you need to guarantee a particular +traversal order, use the array sorting features in +.I gawk +to do so. +.PP The file contains binary data. All integral values are written in network byte order. However, double precision floating-point values are written as diff --git a/extension/time.3am b/extension/time.3am index 53cd1751..eba015bb 100644 --- a/extension/time.3am +++ b/extension/time.3am @@ -1,12 +1,12 @@ -.TH TIME 3am "Jul 30 2012" "Free Software Foundation" "GNU Awk Extension Modules" +.TH TIME 3am "Aug 08 2012" "Free Software Foundation" "GNU Awk Extension Modules" .SH NAME time \- time functions for gawk .SH SYNOPSIS .ft CW @load "time" -.br -time = gettimeofday() .sp +time = gettimeofday() +.br ret = sleep(amount) .ft R .SH DESCRIPTION @@ -55,6 +55,10 @@ printf "Pausing for a while... " ; sleep(2.5) ; print "done" .IR readdir (3am), .IR readfile (3am), .IR rwarray (3am). +.PP +.IR gettimeofday (2), +.IR nanosleep (2), +.IR select (2). .SH AUTHOR Arnold Robbins, .BR arnold@skeeve.com . |