home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.unix
- From: druid!darcy@uunet.UU.NET (D'Arcy J.M. Cain)
- Subject: v26i241: everex-led - LED driver for Everex Step machines, Part01/01
- Sender: unix-sources-moderator@gw.home.vix.com
- Approved: vixie@gw.home.vix.com
-
- Submitted-By: druid!darcy@uunet.UU.NET (D'Arcy J.M. Cain)
- Posting-Number: Volume 26, Issue 241
- Archive-Name: everex-led/part01
-
- #! /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: MANIFEST Makefile README led.7 led.c ledtime.1 ledtime.c
- # Wrapped by vixie@gw.home.vix.com on Sun Jun 20 11:57:04 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'MANIFEST' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MANIFEST'\"
- else
- echo shar: Extracting \"'MANIFEST'\" \(331 characters\)
- sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X MANIFEST 1 This shipping list
- X Makefile 1
- X README 1
- X led.7 1
- X led.c 1
- X ledtime.1 1
- X ledtime.c 1
- END_OF_FILE
- if test 331 -ne `wc -c <'MANIFEST'`; then
- echo shar: \"'MANIFEST'\" unpacked with wrong size!
- fi
- # end of 'MANIFEST'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(3852 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X# Makefile for LED driver
- X# Written by D'Arcy J.M. Cain
- X# For package written by Stephen J. Friedl and D'Arcy J.M. Cain
- X
- X# Note that anything that runs su displays the command line so that
- X# the builder knows what he/she is getting into.
- X
- X# Change LED_INIT_STR for your taste or remove it for default (version #)
- X# Define CLOCK12 to have ledtime display time in 12 hour format
- XCFLAGS = -O -Xa -v -DCLOCK12 -DLED_INIT_STR=\"`uname -n`\"
- X
- X# If you don't want to run ledtime automatically change "respawn" in
- X# the following definition to "off"
- XRESPAWN = respawn
- X
- X# If you want to build and install all the files but not activate
- X# the driver then change the 'Y' here to 'N'.
- XACTIVE = Y
- X
- X# modify these if things are kept somewhere else on your system
- XBIN = /usr/local/bin
- XMAN = /usr/share/man/man
- XCONFBIN = /etc/conf/bin
- XINCLUDE = /usr/include/sys
- X
- X# You shouldn't have to change anything after this (with the possible
- X# exception of Node, see comments below.) If you do find changes
- X# necessary I would appreciate a message at darcy@druid.UUCP. In
- X# fact please tell me when you have to make any changes to the package
- X# other than above.
- X
- XSU_INSTALL = "if $(CONFBIN)/idcheck -p led;\
- X then $(CONFBIN)/idinstall -k -a led;\
- X else $(CONFBIN)/idinstall -k -u led;\
- X fi"
- XSU_UNINSTALL = "$(CONFBIN)/idinstall -k -d led; $(CONFBIN)/idbuild"
- XSU_BUILD = "$(CONFBIN)/idbuild"
- X
- XSYSFILES = Init Master Name Node System
- X.SILENT:
- X
- Xall: Driver.o ledtime
- X
- XInit: Makefile
- X echo "Creating Init"
- X echo "led0:23:$(RESPAWN):nice -100 $(BIN)/ledtime" > Init
- X
- XMaster: Makefile
- X echo "Creating Master"
- X echo "led ocwiI icoH led 0 0 1 4 -1" > Master
- X
- XName: Makefile
- X echo "Creating Name"
- X echo "LED driver" > Name
- X
- X# If you change the number of minor devices you should probably
- X# make some changes here but this seems unlikely. I'm sure that
- X# four devices on a single 8 character display is overkill already
- XNode: Makefile
- X echo "Creating Node"
- X echo "led ledclock c 0" > Node
- X echo "led led1 c 1" >> Node
- X echo "led led2 c 2" >> Node
- X echo "led led c 3" >> Node
- X
- XSystem: Makefile
- X echo "Creating System"
- X echo "led $(ACTIVE) 1 0 0 0 0 0 0 0" > System
- X
- Xclean:
- X rm -f ledtime *.o core $(SYSFILES) install build led.shar
- X
- XDriver.o: led.c
- X echo "Creating Driver.o from led.c"
- X $(CC) -c $(CFLAGS) led.c
- X mv led.o Driver.o
- X
- Xinstall: Driver.o ledtime $(SYSFILES)
- X echo "Installing package files"
- X rm -f $(BIN)/ledtime
- X cp ledtime $(BIN)
- X chmod 711 $(BIN)/ledtime
- X cp led.7 $(MAN)7
- X cp ledtime.1 $(MAN)1
- X chmod 644 $(MAN)7/led.7 $(MAN)1/ledtime.1
- X echo "If ledtime is already running you should kill it in order"
- X echo "to let init restart with the new binary."
- X echo "I need the root password to run the following command"
- X echo $(SU_INSTALL)
- X su root -c $(SU_INSTALL)
- X touch install
- X
- Xuninstall:
- X echo "Removing LED driver"
- X echo "I need the root password to run the following command"
- X echo $(SU_UNINSTALL)
- X su root -c $(SU_UNINSTALL)
- X rm -f $(BIN)/ledtime $(MAN)7/led.7 $(MAN)1/ledtime.1
- X rm -f install
- X
- Xbuild: install
- X echo "Rebuilding kernel"
- X echo "I need the root password to run the following command"
- X echo $(SU_BUILD)
- X su root -c $(CONFBIN)/idbuild
- X touch build
- X
- Xshar: led.shar
- X
- Xled.shar: Readme Makefile led.7 ledtime.1 led.c ledtime.c
- X shar -vxf $^ > led.shar
- X
- Xwhat:
- X clear
- X echo "The following options are available in this makefile\n"
- X echo "all: This is the default. It makes the driver, the config"
- X echo " files and the user programs. Root password is not"
- X echo " required for this option\n"
- X echo "shar: Builds the shar distribution file\n"
- X echo "install: Installs the driver - root password required\n"
- X echo "build: Installs and builds the driver - root password required\n"
- X echo "uninstall: Removes the driver - root password required\n"
- X echo "clean: Removes files built from distribution"
- END_OF_FILE
- if test 3852 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(1290 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- XThis driver is based on the driver written by Stephen J. Friedl
- X(friedl@mtndew.Tustin.CA.US). I have made a few modifications:
- X
- X - The Makefile has been completely revamped. Many small files
- X are now created directly rather than being part of the shar
- X distribution. Type 'make what' for a list of the more
- X important make options.
- X
- X - All code is fully ANSI compliant.
- X
- X - The driver supports multiple devices with device minor numbers
- X corresponding to priority on the LED display.
- X
- X - The write function takes a regular stream of characters and
- X displays them in scrolling fashion. An ioctl performs the
- X function performed by the original write function.
- X
- X - The ledtime program has been modified to use the ioctl so that
- X the display of time doesn't chase across the LEDs. A makefile
- X option allows you to select 12 or 24 hour time styles.
- X
- X - The ledtime function uses /dev/ledclock which is minor 0. This
- X allows other programs to temporarily use the LEDs without
- X having to stop and restart the clock display.
- X
- XNote that if you do not have an ANSI compiler you will have to run
- Xthis through unproto or change it by hand. I have attempted to cast
- Xeverthing that may cause problems due to any such change.
- X
- XD'Arcy J.M. Cain
- Xdarcy@druid.UUCP
- END_OF_FILE
- if test 1290 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'led.7' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'led.7'\"
- else
- echo shar: Extracting \"'led.7'\" \(1979 characters\)
- sed "s/^X//" >'led.7' <<'END_OF_FILE'
- X.TH LED 7
- X.de I
- X\fI$0\fR
- X..
- X.SH NAME
- Xled - LED driver for Everex front panel
- X.SH DESCRIPTION
- XThis is a driver for the front-panel LEDs on an Everex
- XSTEP system. This is an eight-character display, and is
- Xnormally driven by the BIOS to show the current drive,
- Xcylinder, and head being accessed. UNIX bypasses the BIOS
- Xentirely, so it freezes shortly after bootup.
- X.PP
- XThis is a simple driver which displays a signon message then accepts
- Xcalls to write to the LEDs. Normal writes cause the text to scroll
- Xacross the display.
- X.PP
- XThere is also an ioctl call supported. Function 0 re-displays the
- Xsignon message and function 1 displays the string pointed to by the
- Xthird argument, padding to and truncating at 8 characters as necessary.
- X.PP
- XMore than one device is supported in this driver and the default
- Xconfiguration sets up four. Each device may only be opened by
- Xone process at a time. When more than one device is opened at
- Xthe same time the ones with the lower minor number are blocked
- Xuntil they become the highest. This allows something like a
- Xclock, for example, to continuously display the time but still
- Xallow other processes to take over the display on a temporary
- Xbasis. When the second process is finished with the device
- Xthe clock display will resume.
- X.PP
- XThis driver has been tested on an Everex STEP/25 running
- XESIX 5.4.0.4 beta. Information about the
- Xusage of the 8042 UPI has been derived from the Everex
- XSTEP 386 Hardware Service and Maintenance Guide, part
- Xnumber KIT 00076-00 (about a hundred bucks from your
- XAuthorized Everex dealer).
- X.SH FILES
- X/dev/led
- X.br
- X/dev/led1
- X.br
- X/dev/led2
- X.br
- X/dev/ledclock
- X.SH SEE ALSO
- Xledtime(1)
- X.SH AUTHOR
- XStephen J. Friedl (fred@mtndew.Tustin.CA.US)
- X.br
- XD'Arcy J.M. Cain (darcy@druid.UUCP)
- X.SH COPYRIGHT
- XIn the spirit of free interchange of (hopefully) high
- Xquality software, this driver is released to the public
- Xdomain and can be used for any purposes at all, including
- Xpersonal, commercial, military, blackmail, etc.
- END_OF_FILE
- if test 1979 -ne `wc -c <'led.7'`; then
- echo shar: \"'led.7'\" unpacked with wrong size!
- fi
- # end of 'led.7'
- fi
- if test -f 'led.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'led.c'\"
- else
- echo shar: Extracting \"'led.c'\" \(7859 characters\)
- sed "s/^X//" >'led.c' <<'END_OF_FILE'
- X/*
- X * led.c
- X *
- X * Written by: Stephen J. Friedl
- X * V-Systems, Inc.
- X * friedl@mtndew.Tustin.CA.US
- X * 29 July, 1989
- X *
- X * Re-written by D'Arcy J.M. Cain
- X * given version number 2.0
- X *
- X * This is a driver for the front-panel LEDs on an Everex
- X * STEP system. This is an eight-character display, and is
- X * normally driven by the BIOS to show the current drive,
- X * cylinder, and head being accessed. UNIX bypasses the BIOS
- X * entirely, so it freezes shortly after bootup.
- X *
- X * You can make the thing display some cute signon message when
- X * the machine boots by setting the string LED_INIT_STR in the make
- X * file. A normal write call will scroll the output across the LEDs
- X * (referred to by a friend as "times squaring" the output.) There
- X * are two ioctl calls available. Function 0 re-displays the signon
- X * message and function 1 displays the message pointed to by the third
- X * argument to ioctl. Both of these functions display all at once as
- X * opposed to the scroll effect of the normal write call.
- X *
- X * There are multiple devices available to the user. The way that this
- X * works is that any of the devices may be opened by any process but
- X * each is opened exclusively and each device blocks while devices
- X * with a higher minor number are open. The idea is to put something
- X * like ledtime on the lowest device and letting other things interupt
- X * it temporarily.
- X *
- X * This driver has been tested on an Everex STEP/25 running
- X * Esix System V Release 4.0.4 beta. Information about the
- X * usage of the 8042 UPI has been derived from the Everex
- X * STEP 386 Hardware Service and Maintenance Guide, part
- X * number KIT 00076-00 (about a hundred bucks from your
- X * Authorized Everex dealer).
- X *
- X * ========================================================
- X * In the spirit of free interchange of { hopefully } high-
- X * quality software, this driver is released to the public
- X * domain and can be used for any purposes at all, including
- X * personal, commercial, military, blackmail, etc.
- X *
- X * Have fun, folks.
- X * ========================================================
- X * Additional from D'Arcy: I am including my changes in the
- X * above release.
- X */
- X
- X#define _KERNEL 1
- X#include <limits.h>
- X#include <sys/types.h>
- X#include <sys/param.h>
- X#include <sys/user.h>
- X#include <sys/systm.h>
- X#include <sys/sysmacros.h>
- X#include <sys/inline.h>
- X#include <sys/errno.h>
- X#include <sys/signal.h>
- X#include <sys/dir.h>
- X#include <sys/clock.h>
- X#include <sys/cmn_err.h>
- X
- X#define LED_WIDTH 8
- X#define LED_BLANKS " "
- X
- X#ifndef LED_MAX_DEV
- X#define LED_MAX_DEV 4
- X#endif
- X
- X#ifndef LED_INIT_STR
- X#define LED_INIT_STR "led 2.0"
- X#endif
- X
- X#define DEBUGx
- X
- X/*----------------------------------------------------------------------
- X * Everex 8042 UPI controller chip port defines
- X */
- X#define DATA 0x60
- X#define COMMAND 0x64
- X#define STATUS 0x64
- X
- X#define BUSY 0x02
- X
- X#define waitbusy() while (inb(STATUS)&BUSY)
- X
- Xstatic char buf[LED_WIDTH]; /* the current display */
- Xstatic int dev_open; /* currently open devices */
- X
- X/* check priority of current process */
- X/* if higher device numbers are currently open then go to sleep */
- Xstatic void chk_pri(int d)
- X{
- X int k = 1 << d;
- X
- X d = -1 << d;
- X
- X while ((dev_open & d) > k)
- X {
- X#ifdef DEBUG
- X printf("\nled: priority - dev_open = %x, this = %d", dev_open, k);
- X#endif
- X
- X /* woken up by ledclose */
- X /* note that delays sleep on buf rather than &dev_open*/
- X sleep((caddr_t)(&dev_open), PZERO + 2);
- X }
- X}
- X
- Xstatic void end_timeout(void)
- X{
- X#ifdef DEBUG
- X printf("\nled: Rise and shine");
- X#endif
- X
- X wakeup((caddr_t)(buf));
- X}
- X
- X#ifndef waitbusy
- Xstatic void waitbusy(void)
- X{
- X while (inb(STATUS) & BUSY)
- X {
- X timeout(end_timeout, NULL, 1);
- X sleep((caddr_t)(buf), PZERO + 2);
- X }
- X}
- X#endif
- X
- X/*----------------------------------------------------------------------
- X * This routine outputs the current display in buf to the leds
- X */
- Xstatic void out_buf(void)
- X{
- X int k;
- X
- X waitbusy();
- X outb(COMMAND, 0xb0);
- X
- X for (k = 0; k < LED_WIDTH; k++)
- X {
- X waitbusy();
- X outb(DATA, buf[k]);
- X }
- X}
- X
- X/*----------------------------------------------------------------------
- X * This routine outputs a string. An arg of NULL outputs the signon
- X * string. At most LED_WIDTH characters are output. If there are
- X * less characters, the output is space padded.
- X */
- Xstatic void out_str(const char *str, int d)
- X{
- X int k;
- X
- X chk_pri(d);
- X
- X if (!str)
- X str = LED_INIT_STR;
- X
- X /* fill buffer with up to 8 characters padding with spaces if necessary */
- X for (k = 0; k < LED_WIDTH; k++)
- X if (*str)
- X buf[k] = *str++;
- X else
- X buf[k] = ' ';
- X
- X out_buf();
- X}
- X
- X/*----------------------------------------------------------------------
- X * This routine outputs a character. If the argument is -1 then it
- X * displays the signon message (defined in the make file.) The
- X * output (other than the signon) scrolls across the leds.
- X */
- Xstatic void out_char(int c, int d)
- X{
- X int k;
- X
- X timeout(end_timeout, (caddr_t)(0), (long)(HZ/10));
- X sleep((caddr_t)(buf), PZERO + 2);
- X
- X chk_pri(d);
- X
- X for (k = 0; k < LED_WIDTH - 1; k++)
- X buf[k] = buf[k + 1];
- X
- X buf[k] = c;
- X out_buf();
- X}
- X
- X/*----------------------------------------------------------------------
- X * ledinit()
- X *
- X * This is called by the kernel early in the boot sequence, and we
- X * simply display some more reasonable message here instead of the
- X * last cylinder accessed by the BIOS. This can be whatever you like,
- X * Define your message in the make file.
- X *
- X * Be creative!
- X */
- Xvoid ledinit(void)
- X{
- X printf("LED Device driver\n");
- X dev_open = 0; /* all devices closed */
- X out_str(NULL, 0); /* display signon */
- X}
- X
- X/*----------------------------------------------------------------------
- X * ledwrite()
- X *
- X * Do the actual write to the display.
- X */
- Xvoid ledwrite(dev_t dev)
- X{
- X int d, k;
- X static int sp = 0; /* precede next with space flag */
- X
- X /*--------------------------------------------------------------
- X * grab the characters from the user space and return a fault
- X * error on a bad address. CRs and LFs cause the display to
- X * pause for 1 second while FFs display the signon message.
- X * the other control characters are printed. Try them to
- X * see what they display.
- X */
- X
- X if ((d = minor(dev)) < 0 || d >= LED_MAX_DEV)
- X u.u_error = ENXIO;
- X else while (u.u_count)
- X {
- X if ((k = cpass()) == '\n' || k == '\r')
- X {
- X sp = 2;
- X
- X timeout(end_timeout, (caddr_t)(0), (long)(HZ));
- X sleep((caddr_t)(buf), PZERO + 2);
- X }
- X else if (k == '\f')
- X out_str(NULL, d);
- X else if (k == '\t')
- X out_char(' ', d);
- X else
- X {
- X if (sp)
- X out_char(' ', d);
- X
- X out_char(k, d);
- X }
- X
- X if (sp)
- X sp--;
- X }
- X}
- X
- X/* open clears the display */
- Xvoid ledopen(dev_t dev)
- X{
- X int d;
- X
- X#ifdef DEBUG
- X printf("\nledopen: dev = %x", dev);
- X#endif
- X
- X if ((d = minor(dev)) < 0 || d >= LED_MAX_DEV)
- X u.u_error = ENXIO;
- X else if ((1 << d) & dev_open)
- X u.u_error = EBUSY;
- X else
- X {
- X#ifdef DEBUG
- X printf("\nledopen: d = %x, 1 << d = %x", d, 1 << d);
- X#endif
- X
- X dev_open |= (1 << d);
- X out_str(LED_BLANKS, d);
- X }
- X
- X#ifdef DEBUG
- X printf("\nledopen: error = %d, d = %x, 1<<d = %x", u.u_error, d, 1 << d);
- X#endif
- X}
- X
- Xvoid ledclose(dev_t dev)
- X{
- X int d;
- X
- X if ((d = minor(dev)) < 0 || d >= LED_MAX_DEV)
- X u.u_error = ENXIO;
- X else
- X dev_open &= ~(1 << d);
- X
- X#ifdef DEBUG
- X printf("\nled: Close device %d", d);
- X#endif
- X
- X wakeup((caddr_t)(&dev_open));
- X}
- X
- X/*
- X * ioctl function allows signon message to be displayed (function
- X * 0) or any string to be display (1). In the case of function 1
- X * the last argument points to the string.
- X*/
- Xint ledioctl(dev_t dev, int cmd, char *cmdarg)
- X{
- X int d;
- X
- X if ((d = minor(dev)) < 0 || d >= LED_MAX_DEV)
- X u.u_error = ENXIO;
- X else if (cmd == 0)
- X out_str(NULL, d);
- X else if (cmd == 1)
- X {
- X int k;
- X
- X chk_pri(d);
- X
- X for (k = 0; k < LED_WIDTH; k++)
- X if (*cmdarg)
- X buf[k] = *cmdarg++;
- X else
- X buf[k] = ' ';
- X
- X out_buf();
- X }
- X else
- X u.u_error = EINVAL;
- X}
- END_OF_FILE
- if test 7859 -ne `wc -c <'led.c'`; then
- echo shar: \"'led.c'\" unpacked with wrong size!
- fi
- # end of 'led.c'
- fi
- if test -f 'ledtime.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ledtime.1'\"
- else
- echo shar: Extracting \"'ledtime.1'\" \(609 characters\)
- sed "s/^X//" >'ledtime.1' <<'END_OF_FILE'
- X\" t
- X.TH LEDTIME 1
- X.de I
- X\fI\\$0\fR
- X..
- X.SH NAME
- Xledtime - Displays time on Everex front panel
- X.SH DESCRIPTION
- XThis program displays the time on the front panel LEDs
- Xon an Everex Step machine. It requires that the LED driver be installed.
- X.SH FILES
- X/dev/ledclock
- X.SH SEE ALSO
- Xled(7)
- X.SH AUTHOR
- XStephen J. Friedl (fred@mtndew.Tustin.CA.US)
- X.br
- XD'Arcy J.M. Cain (darcy@druid.UUCP)
- X.SH COPYRIGHT
- XIn the spirit of free interchange of (hopefully) high
- Xquality software, this driver is released to the public
- Xdomain and can be used for any purposes at all, including
- Xpersonal, commercial, military, blackmail, etc.
- END_OF_FILE
- if test 609 -ne `wc -c <'ledtime.1'`; then
- echo shar: \"'ledtime.1'\" unpacked with wrong size!
- fi
- # end of 'ledtime.1'
- fi
- if test -f 'ledtime.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ledtime.c'\"
- else
- echo shar: Extracting \"'ledtime.c'\" \(1509 characters\)
- sed "s/^X//" >'ledtime.c' <<'END_OF_FILE'
- X/*
- X * ledtime()
- X *
- X * written by: Stephen J. Friedl
- X * V-Systems, Inc.
- X * +1 714 545 6442
- X * friedl@mtndew.Tustin.CA.US
- X *
- X * Modified to use ioctl() by D'Arcy J.M. Cain (darcy@druid.UUCP)
- X *
- X * This program sits in the background and writes the current time to the
- X * led device via ioctl function 1 so the Everex front-panel display always
- X * shows the time. This is run from inittab. If you prefer not to run this
- X * change the relevant line in the Makefile.
- X *
- X * This is in the public domain (not that you couldn't figure
- X * this out in about two minutes anyway).
- X */
- X
- X#include <stdio.h>
- X#include <stdlib.h>
- X#include <string.h>
- X#include <errno.h>
- X#include <unistd.h>
- X#include <fcntl.h>
- X#include <time.h>
- X
- Xint main(int argc, char **argv)
- X{
- X const char *led_device = "/dev/ledclock";
- X struct tm *tm;
- X time_t now; /* current UNIX time */
- X int led; /* LED device */
- X char buf[40]; /* buffer for the time string */
- X
- X if (argc > 1) /* we can name led device if we want */
- X led_device = argv[1];
- X
- X if ((led = open(led_device, O_WRONLY)) == -1)
- X {
- X fprintf(stderr, "Can't open %s - %s", led_device, strerror(errno));
- X return(1);
- X }
- X
- X for (;;)
- X {
- X time(&now);
- X tm = localtime(&now);
- X
- X#ifdef CLOCK12
- X if (tm->tm_hour > 12)
- X tm->tm_hour -= 12;
- X else if (!tm->tm_hour)
- X tm->tm_hour = 12;
- X
- X sprintf(buf, "%2d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
- X#else
- X sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
- X#endif
- X ioctl(led, 1, buf);
- X sleep(1);
- X }
- X}
- END_OF_FILE
- if test 1509 -ne `wc -c <'ledtime.c'`; then
- echo shar: \"'ledtime.c'\" unpacked with wrong size!
- fi
- # end of 'ledtime.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
-