aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extension/ChangeLog3
-rw-r--r--extension/filefuncs.3am3
-rw-r--r--extension/fnmatch.3am2
-rw-r--r--extension/fork.3am90
-rw-r--r--extension/ordchr.3am2
-rw-r--r--extension/readdir.3am85
-rw-r--r--extension/readfile.3am6
-rw-r--r--extension/time.3am83
8 files changed, 272 insertions, 2 deletions
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 75f0d79c..76b96f64 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -3,6 +3,9 @@
* ABOUT-NLS: New file.
* Makefile.am, configure.ac: Revised for gettext.
+ * fork.3am, readdir.3am, time.3am: New files.
+ * filefuncs.3am, fnmatch.3am, ordchr.3am, readfile.3am: Revised.
+
2012-07-29 Andrew J. Schorr <aschorr@telemetry-investments.com>
* readdir.c (dir_get_record): Adjust to new interface for RT.
diff --git a/extension/filefuncs.3am b/extension/filefuncs.3am
index 3e606bc5..bdb8fe52 100644
--- a/extension/filefuncs.3am
+++ b/extension/filefuncs.3am
@@ -305,12 +305,15 @@ heirarchy and its information.
.SH EXAMPLE
.ft CW
.nf
+FIXME: NEED AN EXAMPLE
.fi
.ft R
.SH "SEE ALSO"
.IR "GAWK: Effective AWK Programming" ,
.IR fnmatch (3am),
+.IR fork (3am),
.IR ordchr (3am),
+.IR readdir (3am),
.IR readfile (3am),
.IR rwarray (3am),
.IR time (3am).
diff --git a/extension/fnmatch.3am b/extension/fnmatch.3am
index eefa5dc4..2a922d21 100644
--- a/extension/fnmatch.3am
+++ b/extension/fnmatch.3am
@@ -84,7 +84,9 @@ if (fnmatch("*.a", "foo.c", flags) == FNM_NOMATCH)
.IR fnmatch (3),
.IR "GAWK: Effective AWK Programming" ,
.IR filefuncs (3am),
+.IR fork (3am),
.IR ordchr (3am),
+.IR readdir (3am),
.IR readfile (3am),
.IR rwarray (3am),
.IR time (3am).
diff --git a/extension/fork.3am b/extension/fork.3am
new file mode 100644
index 00000000..4fb9681c
--- /dev/null
+++ b/extension/fork.3am
@@ -0,0 +1,90 @@
+.TH FORK 3am "Jul 30 2012" "Free Software Foundation" "GNU Awk Extension Modules"
+.SH NAME
+fork, wait, waitpid \- basic process management
+.SH SYNOPSIS
+.ft CW
+@load "fork"
+.br
+pid = fork()
+.sp
+ret = waitpid(pid)
+.sp
+ret = wait();
+.ft R
+.SH DESCRIPTION
+The
+.I fork
+extension adds three functions, as follows.
+.TP
+.B fork()
+This function creates a new process. The return value is the zero
+in the child and the process-id number of the child in the parent,
+or \-1 upon error. In the latter case,
+.B ERRNO
+indicates the problem.
+In the child, \fBPROCINFO["pid"]\fP and \fBPROCINFO["ppid"]\fP
+are updated to reflect the correct values.
+.TP
+.B waitpid()
+This function takes a numeric argument, which is the process-id to
+wait for. The return value is that of the
+.IR waitpid (2)
+system call.
+.TP
+.B wait()
+This function waits for the first child to die.
+The return value is that of the
+.IR wait (2)
+system call.
+... .SH NOTES
+.SH BUGS
+There is no corresponding
+.B exec()
+function.
+.PP
+The interfaces could be enhanced to provide more facilities.
+.SH EXAMPLE
+.ft CW
+.nf
+@load "fork"
+\&...
+if ((pid = fork()) == 0)
+ print "hello from the child"
+else
+ print "hello from the parent"
+.fi
+.ft R
+.SH "SEE ALSO"
+.IR "GAWK: Effective AWK Programming" ,
+.IR filefuncs (3am),
+.IR fnmatch (3am),
+.IR readdir (3am),
+.IR readfile (3am),
+.IR rwarray (3am),
+.IR time (3am).
+.SH AUTHOR
+Arnold Robbins,
+.BR arnold@skeeve.com .
+.SH COPYING PERMISSIONS
+Copyright \(co 2012
+Free Software Foundation, Inc.
+.PP
+Permission is granted to make and distribute verbatim copies of
+this manual page provided the copyright notice and this permission
+notice are preserved on all copies.
+.ig
+Permission is granted to process this file through troff and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual page).
+..
+.PP
+Permission is granted to copy and distribute modified versions of this
+manual page under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+.PP
+Permission is granted to copy and distribute translations of this
+manual page into another language, under the above conditions for
+modified versions, except that this permission notice may be stated in
+a translation approved by the Foundation.
diff --git a/extension/ordchr.3am b/extension/ordchr.3am
index f2aec9c2..a7d7b902 100644
--- a/extension/ordchr.3am
+++ b/extension/ordchr.3am
@@ -43,6 +43,8 @@ printf("The string value of 65 is %s\en", chr(65))
.IR "GAWK: Effective AWK Programming" ,
.IR filefuncs (3am),
.IR fnmatch (3am),
+.IR fork (3am),
+.IR readdir (3am),
.IR readfile (3am),
.IR rwarray (3am),
.IR time (3am).
diff --git a/extension/readdir.3am b/extension/readdir.3am
new file mode 100644
index 00000000..57c61f33
--- /dev/null
+++ b/extension/readdir.3am
@@ -0,0 +1,85 @@
+.TH READDIR 3am "Jul 30 2012" "Free Software Foundation" "GNU Awk Extension Modules"
+.SH NAME
+readdir \- directory input parser for gawk
+.SH SYNOPSIS
+.ft CW
+@load "readdir"
+.br
+readdir_do_ftype(1) # or 0
+.ft R
+.SH DESCRIPTION
+The
+.I readdir
+extension
+adds an input parser for directories, and
+adds a single function named
+.BR readdir_do_ftype() .
+.PP
+When this extension is in use, instead of skipping directories named
+on the command line (or with
+.BR getline ),
+they are read, with each entry returned as a record.
+.PP
+The record consists of at least two fields: the inode number and the
+filename, separated by a forward slash character.
+On systems where the directory entry contains the file type, the record
+has a third field which is a single letter indicating the type of the
+file:
+.B f
+for file,
+.B d
+for directory, and so on.
+.PP
+On systems without the file type information, calling
+.B readdir_do_ftype(1)
+causes the extension to use
+.IR stat (2)
+to retrieve the appropriate information. This is not the default, since
+.IR stat (2)
+is a potentially expensive operation.
+... .SH NOTES
+... .SH BUGS
+.SH EXAMPLE
+.ft CW
+.nf
+@load "readdir"
+\&...
+BEGIN { FS = "/" }
+{ print "file name is", $2 }
+.fi
+.ft R
+.SH "SEE ALSO"
+.IR "GAWK: Effective AWK Programming" ,
+.IR filefuncs (3am),
+.IR fnmatch (3am),
+.IR fork (3am),
+.IR ordchr (3am),
+.IR readfile (3am),
+.IR rwarray (3am),
+.IR time (3am).
+.SH AUTHOR
+Arnold Robbins,
+.BR arnold@skeeve.com .
+.SH COPYING PERMISSIONS
+Copyright \(co 2012
+Free Software Foundation, Inc.
+.PP
+Permission is granted to make and distribute verbatim copies of
+this manual page provided the copyright notice and this permission
+notice are preserved on all copies.
+.ig
+Permission is granted to process this file through troff and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual page).
+..
+.PP
+Permission is granted to copy and distribute modified versions of this
+manual page under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+.PP
+Permission is granted to copy and distribute translations of this
+manual page into another language, under the above conditions for
+modified versions, except that this permission notice may be stated in
+a translation approved by the Foundation.
diff --git a/extension/readfile.3am b/extension/readfile.3am
index 76a38cad..1bcb94f3 100644
--- a/extension/readfile.3am
+++ b/extension/readfile.3am
@@ -27,8 +27,8 @@ Upon error, the function returns the empty string and sets
\&...
contents = readfile("/path/to/file");
if (contents == "" && ERRNO != "") {
- print("problem reading file", ERRNO) > "/dev/stderr"
- ...
+ print("problem reading file", ERRNO) > "/dev/stderr"
+ ...
}
.fi
.ft R
@@ -36,7 +36,9 @@ if (contents == "" && ERRNO != "") {
.IR "GAWK: Effective AWK Programming" ,
.IR filefuncs (3am),
.IR fnmatch (3am),
+.IR fork (3am),
.IR ordchr (3am),
+.IR readdir (3am),
.IR rwarray (3am),
.IR time (3am).
.SH AUTHOR
diff --git a/extension/time.3am b/extension/time.3am
new file mode 100644
index 00000000..ad582b72
--- /dev/null
+++ b/extension/time.3am
@@ -0,0 +1,83 @@
+.TH TIME 3am "Jul 30 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
+ret = sleep(amount)
+.ft R
+.SH DESCRIPTION
+The
+.I time
+extension adds two functions named
+.BR gettimeofday() .
+and
+.BR sleep() ,
+as follows.
+.TP
+.B gettimeofday()
+This function returns the number of seconds since the Epoch
+as a floating-point value. It should have subsecond precision.
+It returns \-1 upon error and sets
+.B ERRNO
+to indicate the problem.
+.TP
+.BI sleep( seconds )
+This function attempts to sleep for the given amount of seconds, which
+may include a fractional portion.
+If
+.I seconds
+is negative, or the attempt to sleep fails,
+then it returns \-1 and sets
+.BR ERRNO .
+Otherwise, the function should return 0 after sleeping
+for the indicated amount of time.
+... .SH NOTES
+... .SH BUGS
+.SH EXAMPLE
+.ft CW
+.nf
+@load "time"
+\&...
+printf "It is now %g seconds since the Epoch\en", gettimeofday()
+printf "Pausing for a while... " ; sleep(2.5) ; print "done"
+.fi
+.ft R
+.SH "SEE ALSO"
+.IR "GAWK: Effective AWK Programming" ,
+.IR filefuncs (3am),
+.IR fnmatch (3am),
+.IR fork (3am),
+.IR ordchr (3am),
+.IR readdir (3am),
+.IR readfile (3am),
+.IR rwarray (3am),
+.SH AUTHOR
+Arnold Robbins,
+.BR arnold@skeeve.com .
+.SH COPYING PERMISSIONS
+Copyright \(co 2012
+Free Software Foundation, Inc.
+.PP
+Permission is granted to make and distribute verbatim copies of
+this manual page provided the copyright notice and this permission
+notice are preserved on all copies.
+.ig
+Permission is granted to process this file through troff and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual page).
+..
+.PP
+Permission is granted to copy and distribute modified versions of this
+manual page under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+.PP
+Permission is granted to copy and distribute translations of this
+manual page into another language, under the above conditions for
+modified versions, except that this permission notice may be stated in
+a translation approved by the Foundation.