[comp.sources.amiga] v90i274: kickdate - saves date to kickstart disk, Part01/01

amiga-request@abcfd20.larc.nasa.gov (Amiga Sources/Binaries Moderator) (10/10/90)

Submitted-by: jap@convex.cl.msu.edu (Joe Porkka)
Posting-number: Volume 90, Issue 274
Archive-name: util/kickdate/part01

[ uuencoded executable enclosed  ...tad ]

	Kickdate saves and retrieves the current system date stamp
	to the first sector of the kickstart disk. This is handy
	for A1000 users with autobooting hard drives, since it
	can save the system time across system resets and power
	cycles.

#!/bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  cli.asm doc kickdate.c kickdate.uu settime.c
# Wrapped by tadguy@abcfd20 on Tue Oct  9 21:43:44 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'cli.asm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cli.asm'\"
else
echo shar: Extracting \"'cli.asm'\" \(3656 characters\)
sed "s/^X//" >'cli.asm' <<'END_OF_FILE'
X* 
X* /* KICKDATE - Copyright 1990 Joe Porkka
X* 		FREELY DISTRIBUTABLE
X* 
X* 	Purpose: Keeps the current date on the Kickstart disk
X* 		 for A1000 owners with autoboot harddrives.
X* 
X* Version 1.0
X* 
X* */
X* 
Xpr_CLI	equ $00ac
Xcli_CommandName equ $0010
X
X* This is a modified ASTARTUP.ASM file
X* it is stripped down to work only from a CLI
X
X******* Imported *******************************************************
X
Xxlib	macro
X	xref	_LVO\1
X	endm
X
X	xref	_AbsExecBase
X	xlib	Input
X	xlib	Output
X
X	xref	_main			; C code entry point
X
X	xlib	FindTask
X	xlib	OpenLibrary
X	xlib	CloseLibrary
X
X******* Exported *******************************************************
X
X	xdef	_SysBase
X	xdef	_DOSBase
X
X	xdef	_errno
X	xdef	_stdin
X	xdef	_stdout
X	xdef	_stderr
X
X	xdef	_exit			; standard C exit function
X
Xcallsys macro
X	jsr _LVO\1(a6)
X	endm
X
X
X************************************************************************
X*
X*	Standard Program Entry Point
X*
X************************************************************************
X*
X*	main (argc, argv)
X*	   int	argc;
X*	   char *argv[];
X*
X************************************************************************
X
Xstartup:				; reference for Wack users
X		move.l	sp,initialSP	; initial task stack pointer
X		move.l	d0,dosCmdLen
X		move.l	a0,dosCmdBuf
X
X	;------ get Exec's library base pointer:
X		move.l	_AbsExecBase,a6
X		move.l	a6,_SysBase
X
X	;------ get the address of our task
X		suba.l	a1,a1
X		callsys FindTask
X		move.l	d0,a4
X
XfromCLI:
X	;------ attempt to open DOS library:
X		bsr	openDOS
X
X	;------ find command name:
X		move.l	pr_CLI(a4),a0
X		add.l	a0,a0		; bcpl pointer conversion
X		add.l	a0,a0
X		move.l	cli_CommandName(a0),a0
X		add.l	a0,a0		; bcpl pointer conversion
X		add.l	a0,a0
X
X	;------ create buffer and array:
X		movem.l d2/a2/a3,-(sp)
X		lea	argvArray,a3
X		moveq.l #1,d2		; param counter
X
X	;------ fetch command name:
X		moveq.l #0,d0
X		move.b	(a0)+,d0        ; size of command name
X		move.l	a0,(a3)+        ; ptr to command name
X		clr.b  0(a0,d0.w)          ; zero byte at end
X
X	;------ collect parameters:
X		move.l	dosCmdLen,d0
X		move.l	dosCmdBuf,a0
X	;------ skip control characters and space:
X3$:		move.b	(a0)+,d1
X		subq.l	#1,d0
X		ble.s	parmExit
X		cmp.b	#' ',d1
X		ble.s	3$
X
X	;------ copy parameter:
X		addq.l	#1,d2	; param count
X		lea.l  -1(a0),a1
X		move.l	a1,(a3)+
X;		 bra.s	 5$
X4$:		move.b	(a0)+,d1
X		subq.l	#1,d0
X		cmp.b	#' ',d1
X		bgt	4$
X;		 ble.s	 6$
X5$:		;move.b  d1,(a2)+
X;		 bra.s	 4$
X;6$:
X		clr.b	-1(a0)
X		cmp	#32,d2
X		blt	3$
X;		 bra.s	 3$
XparmExit:	clr.b	(a0)+
X		clr.l	(a3)+
X
X		move.l	d2,d0
X		movem.l (sp)+,d2/a2/a3
X		pea	argvArray
X		move.l	d0,-(sp)
X
X
X*
X*  The above code relies on the end of line containing a control
X*  character of any type, i.e. a valid character must not be the
X*  last.  This fact is ensured by DOS.
X*
X
X
X	;------ get standard input handle:
X		move.l	_DOSBase,a6
X		callsys Input
X		move.l	d0,_stdin
X
X	;------ get standard output handle:
X		callsys  Output
X		move.l	d0,_stdout
X		move.l	d0,_stderr
X
X	;------ call C main entry point
X		jsr	_main
X
X	;------ return success code:
X		moveq.l #0,D0
X		move.l	initialSP,sp	; restore stack ptr
X		rts
X
X_exit:
X		move.l	4(SP),d0        ; extract return code
Xexit2:
X		move.l	initialSP,SP	; restore stack pointer
X		move.l	d0,-(SP)        ; save return code
X
X	;------ close DOS library:
X		move.l	_AbsExecBase,A6
X		move.l	_DOSBase,d0
X******************************************
X
X	DATA
X
X************************************************************************
X
X_SysBase	dc.l	0
X_DOSBase	dc.l	0
X
X_errno		dc.l	0
X_stdin		dc.l	0
X_stdout 	dc.l	0
X_stderr 	dc.l	0
X
XinitialSP	dc.l	0
X
XdosCmdLen	dc.l	0
XdosCmdBuf	dc.l	0
X
XargvArray	ds.l	32  ; MAX 32 args
X
XDOSName 	dc.b 'dos.library',0
X
X
X	END
END_OF_FILE
if test 3656 -ne `wc -c <'cli.asm'`; then
    echo shar: \"'cli.asm'\" unpacked with wrong size!
fi
# end of 'cli.asm'
fi
if test -f 'doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'doc'\"
else
echo shar: Extracting \"'doc'\" \(1013 characters\)
sed "s/^X//" >'doc' <<'END_OF_FILE'
X
XKICKDATE(1)            AmigaOS Programmer's Manual            KICKDATE(1)
X
XNAME
X	kickdate - saves date to kickstart disk
X
XSYNOPSIS
X     kickdate set | get | getset
X
XDESCRIPTION
X	Kickdate saves and retrieves the current system date stamp
X	to the first sector of the kickstart disk. This is handy
X	for A1000 users with autobooting hard drives, since it
X	can save the system time across system resets and power
X	cycles.
X
X	kickdate set
X		Writes the date stamp to the disk.
X
X	kickdate get
X		Reads the date stamp from the disk.
X
X	kickdate getset
X		Reads the date stamp from the disk, and stays
X		resident, updating the date on the disk every
X		five mintues.
X
X	The intended use is as follows:
X
X	In your startup sequence, place the command
X		run >nil: kickdate getset
X
X		type
X		kickdate set
X		kickdate getset
X
X	Now you are all set. 
X
X
X	Kickdate is carefull not to scribble onto non-kickstart
X	disks. It can be removed by sending it a CTRL-C (by
X	using the break command).
XBUGS
X	Removeing it can take up to five minutes.
END_OF_FILE
if test 1013 -ne `wc -c <'doc'`; then
    echo shar: \"'doc'\" unpacked with wrong size!
fi
# end of 'doc'
fi
if test -f 'kickdate.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'kickdate.c'\"
else
echo shar: Extracting \"'kickdate.c'\" \(3816 characters\)
sed "s/^X//" >'kickdate.c' <<'END_OF_FILE'
X/* KICKDATE - Copyright 1990 Joe Porkka
X		FREELY DISTRIBUTABLE
X
X	Purpose: Keeps the current date on the Kickstart disk
X		 for A1000 owners with autoboot harddrives.
X
XVersion 1.0
X
X*/
X
X
X#include <exec/types.h>
X#include <exec/io.h>
X#include <devices/trackdisk.h>
X#include <exec/memory.h>
X
Xchar *buffer;
X
Xstruct IOStdReq *diskreq, *CreateStdIO();
Xstruct	MsgPort *rport=0,*CreatePort();
Xint dev=0, ioreqs=0, ports=0;
Xint limit;
Xint outcount=0;
X
XDeleteStdIO(req) struct IOStdReq *req;
X{
X    if(req==0) {
X	/* printf("Delete a null message-ignored\n"); */
X    } else {
X	req->io_Message.mn_Node.ln_Type=0xff;
X	req->io_Device=(struct Device *)-1;
X	req->io_Unit=(struct Unit *)-1;
X	/* printf("Freeing a stdio\n"); */
X	FreeMem(req,sizeof(struct IOStdReq));
X    }
X}
X
Xvoid
Xmain(av,ac)
X    int av;
X    char **ac;
X{
X
X    int status;
X    int fetchtime=0;
X    if(av!=2) {
X	printf("Usage: kickdate set | get | getset\n");
X	printf("       set -> write date to disk. get -> get date from disk\n");
X	printf("       getset -> get, then periodically write date\n");
X	return;
X    }
X    if( stricmp(ac[1],"set")==0 ) fetchtime=0;
X    if( stricmp(ac[1],"get")==0 ) fetchtime = 1;
X    if( stricmp(ac[1],"getset")==0 ) fetchtime = 2;
X    buffer=0;
X    rport=CreatePort("disk.port",0);
X    if(rport==0) {
X	printf("port open failed\n");
X	goto portfail;
X    }
X    ports=1;
X    /* printf("GEE!\n"); */
X    diskreq=CreateStdIO(rport);
X    if(diskreq==0) {
X	printf("CreateStdIO failed\n");
X	goto iofail;
X    }
X    ioreqs=1;
X    /* printf("Attempt OpenDevice\n"); */
X    status=OpenDevice("trackdisk.device",0,diskreq,0);
X    if(status!=0) {
X	printf("Opendevice failed\n");
X	goto iofail;
X    }
X    dev=1;
X
X    buffer = (char *)AllocMem(512, MEMF_CHIP);
X    if(buffer==0) goto memfail;
X    getsector(0,0,0);
X    if(!(diskreq->io_Error || diskreq->io_Actual!=512)) {
X	if( ((long *)buffer)[0]=='KICK') {
X	    if(fetchtime) {
X		SetNewTime( ((long *)buffer)[1]);
X	    } else {
X		((long*)buffer)[1]=GetSysTime();
X		writesector(0,0,0);
X		if(diskreq->io_Error || diskreq->io_Actual!=512) {
X		    fetchtime=0;
X		}
X	    }
X	}
X	if(fetchtime==2) {  /* Stay resident */
X	    while(1) {
X		Delay(5*60*50); /* Sleep for 5 minutes */
X		/* printf("Done sleep %ld\n", SetSignal(0,0)); */
X		if(SetSignal(0,0)&(1<<12)) break;  /* CTRL_C */
X		getsector(0,0,0);
X		/* printf("Got it!\n"); */
X		if(!(diskreq->io_Error || diskreq->io_Actual!=512)) {
X		    if( ((long *)buffer)[0]=='KICK') {
X			((long*)buffer)[1]=GetSysTime();
X			writesector(0,0,0);
X			/* printf("Wrote it!\n"); */
X			if(diskreq->io_Error || diskreq->io_Actual!=512) {
X			    /* break; */
X			}
X			MotorOff();
X		    }
X		    MotorOff();
X		} else break;
X	    }
X	}
X    }
X
X
X    MotorOff();
X
X
Xmemfail:
X    if(buffer) FreeMem(buffer, 512);
X    CloseDevice(diskreq);
Xiofail:
X    DeleteStdIO(diskreq);
Xportfail:
X    if(rport) {
X	RemPort(rport);
X	FreeMem(rport,sizeof(*rport));
X    }
X}
X
XCXBRK() {
X    MotorOff();
X
X    if(dev) {CloseDevice(diskreq);}
X    if(ioreqs) {
X	DeleteStdIO(diskreq);
X    }
X    if(ports) {
X	if(rport) {
X	    RemPort(rport);
X	    FreeMem(rport,sizeof(*rport));
X	}
X    }
X    exit(0);
X}
X
Xgetsector(cyl,sec,head)
X    int cyl,sec,head;
X{
X    diskreq->io_Offset = TD_SECTOR * (sec+NUMSECS*head+NUMSECS*2*cyl);
X    diskreq->io_Length=TD_SECTOR;
X    diskreq->io_Data=(APTR)buffer;
X    diskreq->io_Command=CMD_READ;
X    diskreq->io_Flags=0;
X    DoIO(diskreq);
X}
X
Xwritesector(cyl,sec,head)
X    int cyl,sec,head;
X{
X    diskreq->io_Offset = TD_SECTOR * (sec+NUMSECS*head+NUMSECS*2*cyl);
X    diskreq->io_Length=TD_SECTOR;
X    diskreq->io_Data=(APTR)buffer;
X    diskreq->io_Command=CMD_WRITE;
X    diskreq->io_Flags=0;
X    DoIO(diskreq);
X    diskreq->io_Command=CMD_UPDATE;
X    diskreq->io_Flags=0;
X    DoIO(diskreq);
X}
X
XMotorOff()
X{
X    diskreq->io_Command=TD_MOTOR;
X    diskreq->io_Length=0;
X    DoIO(diskreq);
X}
END_OF_FILE
if test 3816 -ne `wc -c <'kickdate.c'`; then
    echo shar: \"'kickdate.c'\" unpacked with wrong size!
fi
# end of 'kickdate.c'
fi
if test -f 'kickdate.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'kickdate.uu'\"
else
echo shar: Extracting \"'kickdate.uu'\" \(6131 characters\)
sed "s/^X//" >'kickdate.uu' <<'END_OF_FILE'
Xbegin 644 kickdate
XM```#\P`````````.``````````T```!#```!/0```&````!S````!````!0`]
XM```(````!0```#D````+````(0````P````]````%P```^D```!#(\\````8+
XM(\`````<(\@````@+'D````$(\X`````D\E.KO[:*$!A``#"(&P`K-'(T<@@I
XM:``0T<C1R$CG(#!'^0```"1T`7``$!@FR$(P```@.0```!P@>0```"`2&%.`E
XM;R(,`0`@;_12@D/H__\FR1(84X`,`0`@;O9"*/__#$(`(&W80AA"FR`"3-\,&
XM!$AY````)"\`+'D````$3J[_RB/`````#$ZN_\0CP````!`CP````!1.N0``E
XM`#)P`"YY````&$YU("\`!"YY````&"\`+'D````$(#D````$9P(B0$ZN_F(@R
XM'TYU0KD````$0_D```"D(#P````>3J[]V"/`````!&?>3G4``````^P````!K
XM`````0```+@````2`````P```0(```#R````[````-H```#,````P````+(`'
XM``"L````H@```)@```"0````6````%(```!`````&@````X````(`````@``2
XM``````/R```#Z0```3U.50``2JT`"&<D(&T`"!%\`/\`"")\_____R%)`!0AN
XM20`8<#`O`"\(3KH$CE"/3EU.=4Y5__1"K?_X#*T````"``AG*$AY````Q$ZZI
XM!)98CTAY````Z$ZZ!(I8CTAY```!)4ZZ!'Y8CTY=3G5(>0```5D@;0`,+R@`X
XM!$ZZ!!Y0CTJ`9@1"K?_X2'D```%=(&T`#"\H``1.N@0"4(]*@&8&<`$K0/_XP
XM2'D```%A(&T`#"\H``1.N@/D4(]*@&8&<`(K0/_XD<@CR``````O"$AY```!L
XM:$ZZ`\I0CR/`````L$J`9A!(>0```7).N@/V6(]@``'L<`$CP````+PO.0``0
XM`+!.N@.06(\CP`````1*@&802'D```&$3KH#R%B/8``!LG`!(\````"X<``O7
XM`"\Y````!"\`2'D```&83KH#C$_O`!`K0/_\2H!G$$AY```!J4ZZ`XY8CV``,
XM`7AP`2/`````M'`"+P`O/````@!.N@-X4(\CP`````!*@&<``2YP`"\`+P`OQ
XM`&$``=Y/[P`,('D````$2B@`'V8``0P,J````@``(&8``0`@>0`````,D$M)Q
XM0TMF4DJM__AG#"\H``1.N@+Z6(]@0"!Y`````"](``!.N@,8(&\``"%```1PD
XM`"\`+P`O`&$``?!/[P`,('D````$2B@`'V8*#*@```(``"!G!$*M__@,K0``G
XM``+_^&8``)0O/```.IA.N@*R6(]P`"\`+P!.N@*R4(\(```,9G1P`"\`+P`OG
XM`&$``2I/[P`,('D````$2B@`'V98#*@```(``"!F3B!Y`````"](```,D$M),
XM0TMF-$ZZ`H`@;P``(4``!'``+P`O`"\`80`!6$_O``P@>0````1**``?9@@,/
XMJ````@``(&$``=!A``',8`#_<&$``<1*N0````!G$B\\```"`"\Y`````$ZZX
XM`?90CR\Y````!$ZZ`?98CR\Y````!&$`_298CTJY````L&<<+SD```"P3KH!6
XMQ%B/<"(O`"\Y````L$ZZ`;I0CTY=3G5A``%F2KD```"T9PPO.0````1.N@&JE
XM6(]*N0```+AG#"\Y````!&$`_-)8CTJY````O&<D2KD```"P9QPO.0```+!.]
XMN@%H6(]P(B\`+SD```"P3KH!7E"/0J=.N@%T6(].=4Y5__P@+0`0<@M.N@$XR
XM(BT`#-*`("T`""]!``!R%DZZ`20B+P``TH!P">&A('D````$(4$`+"%\```"/
XM```D('D````$(7D``````"@@>0````0Q?``"`!P@>0````1"*``>+SD````$\
XM3KH`U%B/3EU.=4Y5__P@+0`0<@M.N@#&(BT`#-*`("T`""]!``!R%DZZ`+(B-
XM+P``TH!P">&A('D````$(4$`+"%\```"```D('D````$(7D``````"@@>0``B
XM``0Q?``#`!P@>0````1"*``>+SD````$3KH`8EB/('D````$,7P`!``<('D`U
XM```$0B@`'B\Y````!$ZZ`$!8CTY=3G4@>0````0Q?``)`!P@>0````1"J``DO
XM+SD````$3KH`&EB/3G4``$[Y`````$[Y`````$[Y`````$[Y````X$[Y````[
XM/$[Y````F$[Y````&$[Y`````$[Y````S$[Y````K$[Y````'$[Y````QD[Y^
XM````1$[Y`````$[Y`````$[Y````1@```^P````!````````!-@````"````M
XM`@``!/````3`````&0````,```-4```#1````SP```,T```#(````PP```+X6
XM```"Z````N````%@```!3@```3@```$F```!%````/X```#X````Y@```-P`I
XM``#0````J````(H```!N````7@```%(```!&````(P````0```2&```$?```7
XM!'````1@```$5@``!$H```0^```$-```!"@```0@```$&@``!`@```/,```#&
XMP@```[8```.N```#J````Y8```,H```#%````M0```+(```"O````JX```**,
XM```"7````D8```'R```!S````:P```&2```!=@```3````$*````R`````$`B
XM```&```$Y`````$````(```$H@````$````)```$E@````$````+```$T@``C
XM``<````,```$J```!+0```3&```$W@``!.H```3,```$N@````(````-```$R
XMK@``!)P````````#\@```^D```!@3E7__$*G80``T%B/*T#__$J`9@9P_TY=D
XM3G4@;?_\,7P`"P`<(6T`"``@0J@`)"\(3KH!*%B/+RW__&$``%I8CW``3EU.4
XM=4Y5__1"IV$``(I8CRM`__1*@&8&</].74YU(&W_]#%\``H`'"\(3KH`[%B/<
XM(&W_]-#\`"!#[?_X<`<2V%'(__PO+?_T80I8CR`M__A.74YU3E7__$JM``AG?
XM-")M``@@:0`.*TC__+'\`````&<(+PA.N@"T6(\O+0`(3KH`I%B/<"@O`"\M@
XM``A.N@"H4(].74YU3E7_]'``+P`O`$ZZ`'!0CRM`__A*@&8&<`!.74YU<"@O]
XM`"\M__A.N@!@4(\K0/_T2H!F$"\M__A.N@!:6(]P`$Y=3G5"IR\M__0O+0`(.
XM2'D```&\3KH`1$_O`!`K0/_\2H!G$"\M__1A`/]46(]P`$Y=3G4@+?_T3EU.`
XM=4[Y`````$[Y````X$[Y`````$[Y````S$[Y````G$[Y````K$[Y````2``&H
XM```#[`````$````#```!*`````(````(```!5@```6X````"````"@```6(`;
XM``%Z`````P````P```%T```!:````5P````````#\@```^H```!S````````:
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM``````````````````````````````!D;W,N;&EB<F%R>0``````````````I
XM`````````````%5S86=E.B!K:6-K9&%T92!S970@?"!G970@?"!G971S970*)
XM`"`@("`@("!S970@+3X@=W)I=&4@9&%T92!T;R!D:7-K+B!G970@+3X@9V5T'
XM(&1A=&4@9G)O;2!D:7-K"@`@("`@("`@9V5T<V5T("T^(&=E="P@=&AE;B!P)
XM97)I;V1I8V%L;'D@=W)I=&4@9&%T90H`<V5T`&=E=`!G971S970`9&ES:RYP%
XM;W)T`'!O<G0@;W!E;B!F86EL960*`$-R96%T95-T9$E/(&9A:6QE9`H`=')AH
XM8VMD:7-K+F1E=FEC90!/<&5N9&5V:6-E(&9A:6QE9`H`=&EM97(N9&5V:6-EG
XM`````````_(```/K````!````_(```/I````%$CG`#HH;P`4(&\`&")O`!Q%)
XM^@`Z3^__="9/+'D````$3J[]]G#_2AM7R/_\1H!G$B\`2&\`!$A43KD`````L
XM3^\`#$_O`(Q,WUP`3G46P$YU```#[`````$````+````.@````````/R```#D
XMZ0````@O`B0O``A(;P`,+P(O.0```!!.N0````!/[P`,)!].=0```^P````!P
XM`````P````X````!````!0```!0````````#\@```^D````%(&\`!""(6)!"V
XMJ``$(4@`"$YU``````/R```#Z0```#E(YS\@*"\`(!8O`"<O//____].N0``9
XM`%PJ`"P%=/^TA5B/9@9P`&```&XO/``!``%(>``B3KD`````)$#/BDJ'SXI0!
XMCV8.+P9.N0```'!P`%B/8$(E1``*%4,`"15\``0`"$(J``X51@`/0J=.N0``M
XM`#`E0``02H18CV<,+PI.N0```(18CV`,2&H`%$ZY`````%B/(`I,WP3\3G5(X
XMYR`@)&\`#$JJ``IG"B\*3KD```"86(\5?`#_``AT_R5"`!1T`!0J``\O`DZYS
XM````<$AX`"(O"DZY````&$_O``Q,WP0$3G4```/L`````0````<```".````O
XM"`````P````V````%````&X```#*````2@```(````"N````U@````````/R9
XM```#Z0````LO`B0O``A(>``P+P).N0````!0CR0?3G4O`B0O``@O`DZY````4
XM2%B/)!].=0```^P````"````"@````X````B`````````_(```/I````(4CG1
XM.``D+P`0)B\`%$J"9@1P`&`N+SP``0`!+P-.N0`````@0,F(2H3)B%"/9@1PG
XM`&`0$7P`!0`(,4,`$B%"``X@"$S?`!Q.=4CG,``@;P`,QXA*@\>(9P``)A%\R
XM`/\`"'3_(4(`%'3_(4(`&'0`-"@`$B\"+PA.N0```!A0CTS?``Q.=0```^P`0
XM```"````#````!X```!X`````````_(```/I````#$CG,`(L>0````1,[P`.D
XM`!!.KO_03-]`#$YU```O#BQY````!"(O``A.KO\Z+%].=0```^P````"````(
XM`P```"`````&`````````_(```/I````/2\.+'D`````3.\``P`(3J[_.BQ?O
XM3G4``"\.+'D`````(F\`""`O``Q.KO\N+%].=2\.+'D`````(F\`"$ZN_MHL+
XM7TYU+PXL>0````!,[P`#``A.KO[.+%].=0``+PXL>0`````@+P`(3J[^MBQ?4
XM3G4O#BQY`````"`O``A.KOZP+%].=2\.+'D`````(F\`"$ZN_IXL7TYU+PXL^
XM>0`````B;P`(3J[^F"Q?3G4O#BQY`````"!O``A,[P(!``PB+P`43J[^1"Q?C
XM3G4``"\.+'D`````(F\`"$ZN_CXL7TYU+PXL>0`````B;P`(3J[^."Q?3G4`_
XM``/L````"P````,```#D````T````+````"<````B````'0```!@````2```A
XM`#0````<````!`````````/R```#Z0```!<@;P`$(F\`"'``<@`0&!(9#```Y
XM86T*#```>FX$!```(`P!`&%M"@P!`'IN!`0!`""0@68$2@%FU$YU```@0B)#!
X@)``F`4A"2$/$P<;`P,'40TA"0D+0@B8))`A.=0```_($Z
X``
Xend
Xsize 4352
END_OF_FILE
if test 6131 -ne `wc -c <'kickdate.uu'`; then
    echo shar: \"'kickdate.uu'\" unpacked with wrong size!
fi
# end of 'kickdate.uu'
fi
if test -f 'settime.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'settime.c'\"
else
echo shar: Extracting \"'settime.c'\" \(1778 characters\)
sed "s/^X//" >'settime.c' <<'END_OF_FILE'
X/* KICKDATE - Copyright 1990 Joe Porkka
X		FREELY DISTRIBUTABLE
X
X	Purpose: Keeps the current date on the Kickstart disk
X		 for A1000 owners with autoboot harddrives.
X
XVersion 1.0
X
X*/
X
X#include <exec/types.h>
X#include <exec/nodes.h>
X#include <exec/memory.h>
X#include <exec/interrupts.h>
X#include <exec/ports.h>
X#include <exec/libraries.h>
X#include <exec/tasks.h>
X#include <exec/io.h>
X#include <exec/devices.h>
X#include <devices/timer.h>
X#include "settime.h"
X
XAPTR TimerBase;
Xlong
XSetNewTime(secs)
X    long secs;
X{
X    struct timerequest *tr;
X    tr= CreateTimer(UNIT_MICROHZ);
X    if(tr==0) return -1;
X    tr->tr_node.io_Command = TR_SETSYSTIME;
X    tr->tr_time.tv_secs=secs;
X    tr->tr_time.tv_micro=0;
X    DoIO(tr);
X    DeleteTimer(tr);
X    return 0;
X}
X
Xlong
XGetSysTime(void)
X{
X    struct timeval tv;
X    struct timerequest *tr;
X
X    tr= CreateTimer(UNIT_MICROHZ);
X    if(tr==0) return -1;
X    tr->tr_node.io_Command = TR_GETSYSTIME;
X    DoIO(tr);
X
X    tv =tr->tr_time;
X    DeleteTimer(tr);
X    return tv.tv_secs;
X}
X
Xvoid
XDeleteTimer(tr)
X    struct timerequest *tr;
X{
X    struct MsgPort *tp;
X
X    if(tr!=0) {
X	tp = tr->tr_node.io_Message.mn_ReplyPort;
X	if(tp!=0) DeletePort(tp);
X	CloseDevice(tr);
X	DeleteExtIO(tr, sizeof(struct timerequest));
X    }
X}
X
Xstruct timerequest *
XCreateTimer(unit)
X    ULONG unit;
X{
X    int error;
X
X    struct MsgPort *timerport;
X    struct timerequest *timermsg;
X
X    timerport = (struct MsgPort *)CreatePort(0,0);
X    if(timerport == 0) {
X	return 0;
X    }
X    timermsg = (struct timerequest *) CreateExtIO(timerport, sizeof(struct timerequest));
X    if(timermsg == 0) {
X	DeletePort(timerport);
X	return 0;
X    }
X    error = OpenDevice(TIMERNAME, unit, timermsg, 0);
X    if(error !=0) {
X	DeleteTimer(timermsg);
X	return 0;
X    }
X    return timermsg;
X}
X
END_OF_FILE
if test 1778 -ne `wc -c <'settime.c'`; then
    echo shar: \"'settime.c'\" unpacked with wrong size!
fi
# end of 'settime.c'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have the archive.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
Mail comments to the moderator at <amiga-request@uunet.uu.net>.
Post requests for sources, and general discussion to comp.sys.amiga.