Script started on Sat Feb 16 20:08:03 2002
ice% cat README

README for CSCI-e215      2/16/2002

Russell J Lowke

Assignment 1: "almost ac"

______

files: aac.h           // header file for aac
       aac.c           // aac main code
       aac.buffer      // buffer for aac (utmplib)
       myLib.c         // my c lib of useful routines
       Makefile        // Makefile to complile aac

       aacPlan         // general plan for aac
       README          // this file

______

ISSUES:

(1) I can't get  aac $USER  to match  ac $USER

Below are the two programs, run only seconds apart.

ice% ./aac lowke
        total      4.03
ice% ac lowke
        total      4.67

A. I know that at the instant of calling ./aac lowke   there is only one USER_PROCESS that contains lowke, it is:

lowke    ttyr7    ttyr7     11014    7 USER_PROCESS     1013871763 bstnma1-ar1-4-3-189-177.elnk.dsl.gtei.net

B. I know also that at that moment  time(NULL)  is:   1013886265
C. I know there are no other entries that contain ttry7

When I do the math by hand I find that:

[current time]  1013886265 - [login time] 1013871763  = 14502
[result in hours] 14502 / 3600.0 = 4.028333

Doing the numbers I find my aac result 4.03 (rounded to two decimal places) is correct while the ac answer of 4.67 is not.


(2) ..Error running test.aac

I tried using the test.aac and I get the following result:


ice% ~lib215/hw/aac/test.aac
        A report of this test will be saved in a file called
        aac.report
        Overwrite existing aac.report ?y

        Testing your program and regular ac on sample files..

        testing nobody.wtmp :
                nobody ..Error running /home01/l/o/lowke/215/aac/aac


On opening the aac.report file I find it empty.

ice% cat aac.report
Test of /home01/l/o/lowke/215/aac/aac
        at Sat Feb 16 18:59:43 EST 2002

I have tested many of the users in the sample.wtmp file, comparing the ac result to the aac. 
i.e.  ./aac -w sample.wtmp sdas     v      ac -w sample.wtmp sdas
All users tested yielded the same result.


(3) I can't test the reboot problem, nor the admin changing system time.  Without being able to conduct tests I can't solve the issues.  In an attempt to compensate I completed the Extra Credit problem. 




Russell
ice% cat aacPlan

PROJECT PLAN for CSCI-e215 Assignment 1: "almost ac"

2/16/2002

Russell J Lowke


Project: aac



Purpose: To mimick the ac command, implementing login times and external 
         data with -w option



Outline:

        "Outputs connect-session records"

        aac creates a list for each user.  This list contains the id 
        number, logIn and logOut time for all sessions, concurrent or 
        otherwise.  Total log times are calculated for each user listed, 
        then a total log time is made and printed in a single printF



Output:

        Output is a single print statement showing total hours(two decimal 
        places), that the users listed were/are logged for.



Arguments:

        acc accepts a list of users to calculate their total login time.
        There is also a -w option to read from an external data 
        file(struct), Default file used is the UTMP_FILE.



Input:

        Argument list of users and an optional external (-w) data file. 


Data Structures:

        acc reads the UTMP_FILE or selected external data file via 
        aacbuffer. Data is analyzed line by line looking for key user names
        and id's. Sets of user times are stored in a struct linked list, 
        each struct holding the id, the logIn time and the logOut time. 
        Once a users list is complete a tally is made of the times.



Files:
        See Arguments and Input sections above.
ice% 

ice% 

ice% 

ice% 

ice% 

ice% make

gcc -g -Wall -c aac.c
gcc -g -Wall -c aacbuffer.c
aacbuffer.c: In function `utmp_reload':
aacbuffer.c:54: warning: implicit declaration of function `read'
aacbuffer.c: In function `utmp_close':
aacbuffer.c:67: warning: implicit declaration of function `close'
gcc -g -Wall -c myLib.c
gcc -g -Wall aac.o aacbuffer.o myLib.o -o aac
ice% 

ice% makecat aacPlanREADME[K
ice% exit[K./aac -w sample.wtmp ahprice[K[K[K[K[K[K[Kxliu

        total      0.04
ice% ./aac -w sample.wtmp xliua[Pc[Pa[Pa

        total      0.04
ice% ac -w sample.wtmp xliu
ice% [4h./a[4lac -w sample.wtmp xliu[K[K[K[Kbfriedm

        total      0.01
ice% ./aac -w sample.wtmp bfriedm[Pc[Pa[Pa

        total      0.01
ice% ac -w sample.wtmp bfriedm
ice% [4h./a[4lac -w sample.wtmp bfriedm[K[K[K[K[K[K[Ksdas

        total      0.00
ice% ./aac -w sample.wtmp sdas[Pc[Pa[Pa

        total      0.00
ice% ac -w sample.wtmp sdas
ice% [4h./a[4lac -w sample.wtmp sdas[K[K[K[Kcholy

        total      2.14
ice% ./aac -w sample.wtmp choly[Pc[Pa[Pa

        total      2.14
ice% ac -w sample.wtmp choly
ice% [4h./a[4lac -w sample.wtmp choly[K[K[K[K[Kmluber

        total      0.08
ice% ./aac -w sample.wtmp mluber[Pc[Pa[Pa

        total      0.08
ice% ac -w sample.wtmp mluber
ice% [4h./a[4lac -w sample.wtmp mluber[K[K[K[K[K[Knazim

        total      0.19
ice% ./aac -w sample.wtmp nazim[Pc[Pa[Pa

        total      0.19
ice% ac -w sample.wtmp nazim
ice% [4h./a[4lac -w sample.wtmp nazim[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K$USER[K[K[K[K[K[K[Klowke

        total      10.13
ice% ac lowke

        total     13.48
ice% ac lowke
ice% [4h./a[4lac lowke
ice% ac -w sample.wtmp nazim[K[K[K[K[Kenos

        total      0.04
ice% ac -w sample.wtmp enosac lowke[K-w sample.wtmp enos[4h.[4la[4h/[4laa[4ha[4lc

        total      0.04
ice% ./aac -w sample.wtmp enos enos

        total      0.09
ice% ./aac -w sample.wtmp enos enos enos

        total      0.13
ice% ./aac -w sample.wtmp enos enos enos mluber

        total      0.21
ice% ./aac -w sample.wtmp enos enos enos mluber flink

        total      0.64
ice% ./a[K[K[K./aac $USER

        total      10.16
ice% ./aac $USER $USER

        total      20.32
ice% ./aac

ERROR: No user specified
ice% exit

exit

script done on Sat Feb 16 20:13:12 2002
