home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / xenix / sco / 3308 < prev    next >
Encoding:
Text File  |  1992-11-12  |  3.0 KB  |  141 lines

  1. Path: sparky!uunet!mcsun!Germany.EU.net!fho!ds009.et-inf.fho-emden.de!lichtenb
  2. From: lichtenb@ds009.et-inf.fho-emden.de (Claas Lichtenberg)
  3. Newsgroups: comp.unix.xenix.sco
  4. Subject: Hello Jeff Liebermann
  5. Message-ID: <1731@fho.de>
  6. Date: 12 Nov 92 18:40:28 GMT
  7. Sender: news@fho.de
  8. Distribution: comp
  9. Lines: 130
  10.  
  11.  
  12.  
  13. Hello Jeff
  14. I have to set this into the news, because I cannot send any mail out of
  15. germany. I hope the other reader will not kill me.
  16.  
  17. A few weeks ago you sent me the following shellscript:
  18.  
  19. :
  20. clear
  21. while :
  22. do
  23.     echo "Software Time: \c"
  24.     date '+%m%d%H%M%y'
  25.     echo "Hardware Time: \c"
  26.     cat /dev/clock
  27.     echo "\n"
  28.     sleep 5
  29.     clear
  30. done
  31.  
  32.  
  33.  
  34.  
  35. Thanks for it but it did not run, because the device /dev/clock does not
  36. exist on my computer and even not in our "Fachhochschule".
  37. (Don't ask me for the translation. It's something like a University.)
  38.  
  39. Can you tell me how to create it? (Perhaps with mknod.)
  40.  
  41. It would be very nice if you send me the the directory of /dev.
  42. (It must be in the format of ls -l so that I can see the major and minor
  43. device numbers.)
  44.  
  45. I pasted the source of the program that I need this for at the end of this
  46. mail.
  47.  
  48. yours Claas
  49.  
  50.  
  51. ==============================================================================
  52. -  Claas Lichtenberg                             Fachochschule Ostfriesland  -
  53. --  Cirksena Strasse 43          Fachbereich Elektrotechnik und Informatik  --
  54. ---  D-W-2970 Emden                                        D-W-2970 Emden  ---
  55. ----              EMail: lichtenb@server.et-inf.fho-emden.de              ----
  56. ==============================================================================
  57. PS:
  58.      Nothing is impossible for a man who doesn't have to do it himself.
  59.  
  60.  
  61. ----------CUT HERE----------
  62. #include <stdio.h>
  63. #include <fcntl.h>
  64. #include <signal.h>
  65. #include <sys/rtc.h>
  66. /* Real Time Clock Definitionen */
  67.  
  68. #include <sys/console.h>
  69.  
  70. extern    int    errno;
  71.  
  72. main () {
  73.     int    fd;
  74.  
  75.     int        r, i;
  76.     int        delete;
  77.     unsigned    char    *screen;
  78.  
  79.     struct        rtc_t    rtc;
  80.  
  81.     if ((fd=open("/dev/clock",O_RDONLY))==-1) {
  82.         perror ("clock open");
  83.         exit (errno);
  84.     }
  85.  
  86.     for (i=0;i!=32;ii++) {
  87.         signal (i,SIG_IGN);
  88.         signal (i, delete);
  89.     }
  90.  
  91.     if ((r=ioctl(0,SW_VGA80x25,0))==-1) {
  92.         perror ("SW_VGA80x25");
  93.         exit (errno);
  94.     }
  95.  
  96.     if ((r=ioctl(0,MAPVGA,0))==-1) {
  97.         perror ("MAPVGA");
  98.         exit (errno);
  99.     }
  100.  
  101.     screen = (unsigned char *) r;
  102.  
  103.     if (!fork()) {
  104.         while (1) {
  105.             sleep (1);
  106.             if ((r=ioctl(fd,RTCRTIME,&rtc))==-1) {
  107.                 perror ("RCRTIME");
  108.                 exit (errno);
  109.             }
  110.  
  111.             putclock (screen+14,rtc.rtc.hr);
  112.             *(screen+148)=':';
  113.             *(screen+149)=0x4f;
  114.             putclock (screen+150,rtc.rtc_min);
  115.             *(screen+154)=':';
  116.             *(screen+155)=0x4f;
  117.             putclock (screen+156,rtc.rtc_sec);
  118.  
  119.         }
  120.     } else puts ("rtc initialisiert ...");
  121. }
  122.  
  123. putclock (scr,value)
  124. unsigned    char    *scr;
  125. int        value;
  126. {
  127.     *scr++ = (value >> 4) | '0';
  128.     *scr++ = 0x4f;
  129.     *scr++ = (value & 0x0f) | '0';
  130.     *scr++ = 0x4f;
  131. }
  132.  
  133. delete (sig)
  134. int    sig;
  135. {
  136.     ioctl (0,SW_VGA80x25,0);
  137.     fprintf (stderr,"Signal %d received. RTC terminated\n", sig);
  138. }
  139.  
  140. ----------CUT HERE----------
  141.