home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!fho!ds009.et-inf.fho-emden.de!lichtenb
- From: lichtenb@ds009.et-inf.fho-emden.de (Claas Lichtenberg)
- Newsgroups: comp.unix.xenix.sco
- Subject: Hello Jeff Liebermann
- Message-ID: <1731@fho.de>
- Date: 12 Nov 92 18:40:28 GMT
- Sender: news@fho.de
- Distribution: comp
- Lines: 130
-
-
-
- Hello Jeff
- I have to set this into the news, because I cannot send any mail out of
- germany. I hope the other reader will not kill me.
-
- A few weeks ago you sent me the following shellscript:
-
- :
- clear
- while :
- do
- echo "Software Time: \c"
- date '+%m%d%H%M%y'
- echo "Hardware Time: \c"
- cat /dev/clock
- echo "\n"
- sleep 5
- clear
- done
-
-
-
-
- Thanks for it but it did not run, because the device /dev/clock does not
- exist on my computer and even not in our "Fachhochschule".
- (Don't ask me for the translation. It's something like a University.)
-
- Can you tell me how to create it? (Perhaps with mknod.)
-
- It would be very nice if you send me the the directory of /dev.
- (It must be in the format of ls -l so that I can see the major and minor
- device numbers.)
-
- I pasted the source of the program that I need this for at the end of this
- mail.
-
- yours Claas
-
-
- ==============================================================================
- - Claas Lichtenberg Fachochschule Ostfriesland -
- -- Cirksena Strasse 43 Fachbereich Elektrotechnik und Informatik --
- --- D-W-2970 Emden D-W-2970 Emden ---
- ---- EMail: lichtenb@server.et-inf.fho-emden.de ----
- ==============================================================================
- PS:
- Nothing is impossible for a man who doesn't have to do it himself.
-
-
- ----------CUT HERE----------
- #include <stdio.h>
- #include <fcntl.h>
- #include <signal.h>
- #include <sys/rtc.h>
- /* Real Time Clock Definitionen */
-
- #include <sys/console.h>
-
- extern int errno;
-
- main () {
- int fd;
-
- int r, i;
- int delete;
- unsigned char *screen;
-
- struct rtc_t rtc;
-
- if ((fd=open("/dev/clock",O_RDONLY))==-1) {
- perror ("clock open");
- exit (errno);
- }
-
- for (i=0;i!=32;ii++) {
- signal (i,SIG_IGN);
- signal (i, delete);
- }
-
- if ((r=ioctl(0,SW_VGA80x25,0))==-1) {
- perror ("SW_VGA80x25");
- exit (errno);
- }
-
- if ((r=ioctl(0,MAPVGA,0))==-1) {
- perror ("MAPVGA");
- exit (errno);
- }
-
- screen = (unsigned char *) r;
-
- if (!fork()) {
- while (1) {
- sleep (1);
- if ((r=ioctl(fd,RTCRTIME,&rtc))==-1) {
- perror ("RCRTIME");
- exit (errno);
- }
-
- putclock (screen+14,rtc.rtc.hr);
- *(screen+148)=':';
- *(screen+149)=0x4f;
- putclock (screen+150,rtc.rtc_min);
- *(screen+154)=':';
- *(screen+155)=0x4f;
- putclock (screen+156,rtc.rtc_sec);
-
- }
- } else puts ("rtc initialisiert ...");
- }
-
- putclock (scr,value)
- unsigned char *scr;
- int value;
- {
- *scr++ = (value >> 4) | '0';
- *scr++ = 0x4f;
- *scr++ = (value & 0x0f) | '0';
- *scr++ = 0x4f;
- }
-
- delete (sig)
- int sig;
- {
- ioctl (0,SW_VGA80x25,0);
- fprintf (stderr,"Signal %d received. RTC terminated\n", sig);
- }
-
- ----------CUT HERE----------
-