#***************************************************************************
#*
time.awk - description
#*
-------------------
#*
begin
: Mon 26 Dec 2005 04:41:40 PM EST
#*
copyright
: (C) 2005 by Terry D. Boldt
#*
email
: fastsnip-wm1@yahoo.com
#***************************************************************************/
#
#***************************************************************************
#*
*
#* This program is free software; you can redistribute it
and/or modify *
#* it under the terms of the GNU General Public License as
published by *
#* the Free Software Foundation; either version 2 of the
License, or *
#* (at your option) any later
version.
*
#*
*
#***************************************************************************/
#*
#*
#* QTAwk program to demostrate dynamically loaded user
function
#*/
BEGIN {
display_PROCINFO();
display_user_functions();
display_modules();
time_mod_version = "Not Installed";
print("Time Module Version:",time_mod_version);
# load desired module specifying initialization
function
# exit function uses default name
module_name = "./time_mod.so";
load_module(module_name);
print("Time Module Version:",time_mod_version);
display_PROCINFO();
display_user_functions();
display_modules();
print("System Time:",systime());
# get time values in returned array
# NOTE: the following line:
# time = local_time(aa);
# may be uncommented to generate a run-time error
# indicating that the user defined function loaded
# in the time module is called with more arguments
# than it was defined with. The following error
# is displayed:
# Error (4460): More Arguments For Function Than
Defined. Function: local_time.
# Action File: time_mod.awk
# Action File Line: 19
time = local_time();
print("Printing Time structure Return values:");
for ( i in time ) {
print("time[" >< i
>< "] == ">< time[i]);
} ## endfor
# now get time values in both returned array and
# returned in the argument to the function call
# NOTE: although the argument to the function call
# 'atime' has not been referenced as an
array here yet
# the user function function can define
the array elements
# and return the array values in the
argument variable also.
# This is true for user defined
functions defined in the
# QTAwk utility and in user defined
functions loaded in modules.
time = local_time_a(atime);
print("Printing Time structure Argument values:");
for ( i in atime ) {
print(i >< " ==
">< atime[i]);
} ## endfor
# unload module - exit function will be executed
unload_module(module_name);
display_PROCINFO();
display_user_functions();
display_modules();
print("Time Module Version:",time_mod_version);
} ## BEGIN
#include "display_funcs.awk"