diff options
Diffstat (limited to 'awklib/eg')
-rw-r--r-- | awklib/eg/lib/gettime.awk | 4 | ||||
-rw-r--r-- | awklib/eg/lib/inplace.awk | 14 | ||||
-rw-r--r-- | awklib/eg/prog/alarm.awk | 4 |
3 files changed, 18 insertions, 4 deletions
diff --git a/awklib/eg/lib/gettime.awk b/awklib/eg/lib/gettime.awk index 95f9c329..4cb56330 100644 --- a/awklib/eg/lib/gettime.awk +++ b/awklib/eg/lib/gettime.awk @@ -1,4 +1,4 @@ -# gettimeofday.awk --- get the time of day in a usable format +# getlocaltime.awk --- get the time of day in a usable format # # Arnold Robbins, arnold@skeeve.com, Public Domain, May 1993 # @@ -25,7 +25,7 @@ # time["weeknum"] -- week number, Sunday first day # time["altweeknum"] -- week number, Monday first day -function gettimeofday(time, ret, now, i) +function getlocaltime(time, ret, now, i) { # get time once, avoids unnecessary system calls now = systime() diff --git a/awklib/eg/lib/inplace.awk b/awklib/eg/lib/inplace.awk new file mode 100644 index 00000000..6403a228 --- /dev/null +++ b/awklib/eg/lib/inplace.awk @@ -0,0 +1,14 @@ +# inplace --- load and invoke the inplace extension. + +@load "inplace" + +# Please set INPLACE_SUFFIX to make a backup copy. For example, you may +# want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule. + +BEGINFILE { + inplace_begin(FILENAME, INPLACE_SUFFIX) +} + +ENDFILE { + inplace_end(FILENAME, INPLACE_SUFFIX) +} diff --git a/awklib/eg/prog/alarm.awk b/awklib/eg/prog/alarm.awk index 53563d15..9bb1633c 100644 --- a/awklib/eg/prog/alarm.awk +++ b/awklib/eg/prog/alarm.awk @@ -1,6 +1,6 @@ # alarm.awk --- set an alarm # -# Requires gettimeofday() library function +# Requires getlocaltime() library function # # Arnold Robbins, arnold@skeeve.com, Public Domain # May 1993 @@ -53,7 +53,7 @@ BEGIN \ minute = atime[2] + 0 # force numeric # get current broken down time - gettimeofday(now) + getlocaltime(now) # if time given is 12-hour hours and it's after that # hour, e.g., `alarm 5:30' at 9 a.m. means 5:30 p.m., |