home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-01-09 | 54.4 KB | 1,657 lines |
- Newsgroups: comp.sources.misc
- From: lm@rmit.edu.au (Luke Mewburn)
- Subject: v41i077: casu - comms. & status utils, v3.3, Part02/04
- Message-ID: <1994Jan10.025537.3829@sparky.sterling.com>
- X-Md4-Signature: bfeef26666718500897d92f0a15fc4d5
- Sender: kent@sparky.sterling.com (Kent Landfield)
- Organization: Sterling Software
- Date: Mon, 10 Jan 1994 02:55:37 GMT
- Approved: kent@sparky.sterling.com
-
- Submitted-by: lm@rmit.edu.au (Luke Mewburn)
- Posting-number: Volume 41, Issue 77
- Archive-name: casu/part02
- Environment: UNIX, ANSI-C
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: casu-3.3/COPYING casu-3.3/ChangeLog casu-3.3/Makefile.in
- # casu-3.3/init.c
- # Wrapped by kent@sparky on Sun Jan 9 20:46:38 1994
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 2 (of 4)."'
- if test -f 'casu-3.3/COPYING' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'casu-3.3/COPYING'\"
- else
- echo shar: Extracting \"'casu-3.3/COPYING'\" \(17982 characters\)
- sed "s/^X//" >'casu-3.3/COPYING' <<'END_OF_FILE'
- X GNU GENERAL PUBLIC LICENSE
- X Version 2, June 1991
- X
- X Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- X 675 Mass Ave, Cambridge, MA 02139, USA
- X Everyone is permitted to copy and distribute verbatim copies
- X of this license document, but changing it is not allowed.
- X
- X Preamble
- X
- X The licenses for most software are designed to take away your
- Xfreedom to share and change it. By contrast, the GNU General Public
- XLicense is intended to guarantee your freedom to share and change free
- Xsoftware--to make sure the software is free for all its users. This
- XGeneral Public License applies to most of the Free Software
- XFoundation's software and to any other program whose authors commit to
- Xusing it. (Some other Free Software Foundation software is covered by
- Xthe GNU Library General Public License instead.) You can apply it to
- Xyour programs, too.
- X
- X When we speak of free software, we are referring to freedom, not
- Xprice. Our General Public Licenses are designed to make sure that you
- Xhave the freedom to distribute copies of free software (and charge for
- Xthis service if you wish), that you receive source code or can get it
- Xif you want it, that you can change the software or use pieces of it
- Xin new free programs; and that you know you can do these things.
- X
- X To protect your rights, we need to make restrictions that forbid
- Xanyone to deny you these rights or to ask you to surrender the rights.
- XThese restrictions translate to certain responsibilities for you if you
- Xdistribute copies of the software, or if you modify it.
- X
- X For example, if you distribute copies of such a program, whether
- Xgratis or for a fee, you must give the recipients all the rights that
- Xyou have. You must make sure that they, too, receive or can get the
- Xsource code. And you must show them these terms so they know their
- Xrights.
- X
- X We protect your rights with two steps: (1) copyright the software, and
- X(2) offer you this license which gives you legal permission to copy,
- Xdistribute and/or modify the software.
- X
- X Also, for each author's protection and ours, we want to make certain
- Xthat everyone understands that there is no warranty for this free
- Xsoftware. If the software is modified by someone else and passed on, we
- Xwant its recipients to know that what they have is not the original, so
- Xthat any problems introduced by others will not reflect on the original
- Xauthors' reputations.
- X
- X Finally, any free program is threatened constantly by software
- Xpatents. We wish to avoid the danger that redistributors of a free
- Xprogram will individually obtain patent licenses, in effect making the
- Xprogram proprietary. To prevent this, we have made it clear that any
- Xpatent must be licensed for everyone's free use or not licensed at all.
- X
- X The precise terms and conditions for copying, distribution and
- Xmodification follow.
- X
- X GNU GENERAL PUBLIC LICENSE
- X TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- X
- X 0. This License applies to any program or other work which contains
- Xa notice placed by the copyright holder saying it may be distributed
- Xunder the terms of this General Public License. The "Program", below,
- Xrefers to any such program or work, and a "work based on the Program"
- Xmeans either the Program or any derivative work under copyright law:
- Xthat is to say, a work containing the Program or a portion of it,
- Xeither verbatim or with modifications and/or translated into another
- Xlanguage. (Hereinafter, translation is included without limitation in
- Xthe term "modification".) Each licensee is addressed as "you".
- X
- XActivities other than copying, distribution and modification are not
- Xcovered by this License; they are outside its scope. The act of
- Xrunning the Program is not restricted, and the output from the Program
- Xis covered only if its contents constitute a work based on the
- XProgram (independent of having been made by running the Program).
- XWhether that is true depends on what the Program does.
- X
- X 1. You may copy and distribute verbatim copies of the Program's
- Xsource code as you receive it, in any medium, provided that you
- Xconspicuously and appropriately publish on each copy an appropriate
- Xcopyright notice and disclaimer of warranty; keep intact all the
- Xnotices that refer to this License and to the absence of any warranty;
- Xand give any other recipients of the Program a copy of this License
- Xalong with the Program.
- X
- XYou may charge a fee for the physical act of transferring a copy, and
- Xyou may at your option offer warranty protection in exchange for a fee.
- X
- X 2. You may modify your copy or copies of the Program or any portion
- Xof it, thus forming a work based on the Program, and copy and
- Xdistribute such modifications or work under the terms of Section 1
- Xabove, provided that you also meet all of these conditions:
- X
- X a) You must cause the modified files to carry prominent notices
- X stating that you changed the files and the date of any change.
- X
- X b) You must cause any work that you distribute or publish, that in
- X whole or in part contains or is derived from the Program or any
- X part thereof, to be licensed as a whole at no charge to all third
- X parties under the terms of this License.
- X
- X c) If the modified program normally reads commands interactively
- X when run, you must cause it, when started running for such
- X interactive use in the most ordinary way, to print or display an
- X announcement including an appropriate copyright notice and a
- X notice that there is no warranty (or else, saying that you provide
- X a warranty) and that users may redistribute the program under
- X these conditions, and telling the user how to view a copy of this
- X License. (Exception: if the Program itself is interactive but
- X does not normally print such an announcement, your work based on
- X the Program is not required to print an announcement.)
- X
- XThese requirements apply to the modified work as a whole. If
- Xidentifiable sections of that work are not derived from the Program,
- Xand can be reasonably considered independent and separate works in
- Xthemselves, then this License, and its terms, do not apply to those
- Xsections when you distribute them as separate works. But when you
- Xdistribute the same sections as part of a whole which is a work based
- Xon the Program, the distribution of the whole must be on the terms of
- Xthis License, whose permissions for other licensees extend to the
- Xentire whole, and thus to each and every part regardless of who wrote it.
- X
- XThus, it is not the intent of this section to claim rights or contest
- Xyour rights to work written entirely by you; rather, the intent is to
- Xexercise the right to control the distribution of derivative or
- Xcollective works based on the Program.
- X
- XIn addition, mere aggregation of another work not based on the Program
- Xwith the Program (or with a work based on the Program) on a volume of
- Xa storage or distribution medium does not bring the other work under
- Xthe scope of this License.
- X
- X 3. You may copy and distribute the Program (or a work based on it,
- Xunder Section 2) in object code or executable form under the terms of
- XSections 1 and 2 above provided that you also do one of the following:
- X
- X a) Accompany it with the complete corresponding machine-readable
- X source code, which must be distributed under the terms of Sections
- X 1 and 2 above on a medium customarily used for software interchange; or,
- X
- X b) Accompany it with a written offer, valid for at least three
- X years, to give any third party, for a charge no more than your
- X cost of physically performing source distribution, a complete
- X machine-readable copy of the corresponding source code, to be
- X distributed under the terms of Sections 1 and 2 above on a medium
- X customarily used for software interchange; or,
- X
- X c) Accompany it with the information you received as to the offer
- X to distribute corresponding source code. (This alternative is
- X allowed only for noncommercial distribution and only if you
- X received the program in object code or executable form with such
- X an offer, in accord with Subsection b above.)
- X
- XThe source code for a work means the preferred form of the work for
- Xmaking modifications to it. For an executable work, complete source
- Xcode means all the source code for all modules it contains, plus any
- Xassociated interface definition files, plus the scripts used to
- Xcontrol compilation and installation of the executable. However, as a
- Xspecial exception, the source code distributed need not include
- Xanything that is normally distributed (in either source or binary
- Xform) with the major components (compiler, kernel, and so on) of the
- Xoperating system on which the executable runs, unless that component
- Xitself accompanies the executable.
- X
- XIf distribution of executable or object code is made by offering
- Xaccess to copy from a designated place, then offering equivalent
- Xaccess to copy the source code from the same place counts as
- Xdistribution of the source code, even though third parties are not
- Xcompelled to copy the source along with the object code.
- X
- X 4. You may not copy, modify, sublicense, or distribute the Program
- Xexcept as expressly provided under this License. Any attempt
- Xotherwise to copy, modify, sublicense or distribute the Program is
- Xvoid, and will automatically terminate your rights under this License.
- XHowever, parties who have received copies, or rights, from you under
- Xthis License will not have their licenses terminated so long as such
- Xparties remain in full compliance.
- X
- X 5. You are not required to accept this License, since you have not
- Xsigned it. However, nothing else grants you permission to modify or
- Xdistribute the Program or its derivative works. These actions are
- Xprohibited by law if you do not accept this License. Therefore, by
- Xmodifying or distributing the Program (or any work based on the
- XProgram), you indicate your acceptance of this License to do so, and
- Xall its terms and conditions for copying, distributing or modifying
- Xthe Program or works based on it.
- X
- X 6. Each time you redistribute the Program (or any work based on the
- XProgram), the recipient automatically receives a license from the
- Xoriginal licensor to copy, distribute or modify the Program subject to
- Xthese terms and conditions. You may not impose any further
- Xrestrictions on the recipients' exercise of the rights granted herein.
- XYou are not responsible for enforcing compliance by third parties to
- Xthis License.
- X
- X 7. If, as a consequence of a court judgment or allegation of patent
- Xinfringement or for any other reason (not limited to patent issues),
- Xconditions are imposed on you (whether by court order, agreement or
- Xotherwise) that contradict the conditions of this License, they do not
- Xexcuse you from the conditions of this License. If you cannot
- Xdistribute so as to satisfy simultaneously your obligations under this
- XLicense and any other pertinent obligations, then as a consequence you
- Xmay not distribute the Program at all. For example, if a patent
- Xlicense would not permit royalty-free redistribution of the Program by
- Xall those who receive copies directly or indirectly through you, then
- Xthe only way you could satisfy both it and this License would be to
- Xrefrain entirely from distribution of the Program.
- X
- XIf any portion of this section is held invalid or unenforceable under
- Xany particular circumstance, the balance of the section is intended to
- Xapply and the section as a whole is intended to apply in other
- Xcircumstances.
- X
- XIt is not the purpose of this section to induce you to infringe any
- Xpatents or other property right claims or to contest validity of any
- Xsuch claims; this section has the sole purpose of protecting the
- Xintegrity of the free software distribution system, which is
- Ximplemented by public license practices. Many people have made
- Xgenerous contributions to the wide range of software distributed
- Xthrough that system in reliance on consistent application of that
- Xsystem; it is up to the author/donor to decide if he or she is willing
- Xto distribute software through any other system and a licensee cannot
- Ximpose that choice.
- X
- XThis section is intended to make thoroughly clear what is believed to
- Xbe a consequence of the rest of this License.
- X
- X 8. If the distribution and/or use of the Program is restricted in
- Xcertain countries either by patents or by copyrighted interfaces, the
- Xoriginal copyright holder who places the Program under this License
- Xmay add an explicit geographical distribution limitation excluding
- Xthose countries, so that distribution is permitted only in or among
- Xcountries not thus excluded. In such case, this License incorporates
- Xthe limitation as if written in the body of this License.
- X
- X 9. The Free Software Foundation may publish revised and/or new versions
- Xof the General Public License from time to time. Such new versions will
- Xbe similar in spirit to the present version, but may differ in detail to
- Xaddress new problems or concerns.
- X
- XEach version is given a distinguishing version number. If the Program
- Xspecifies a version number of this License which applies to it and "any
- Xlater version", you have the option of following the terms and conditions
- Xeither of that version or of any later version published by the Free
- XSoftware Foundation. If the Program does not specify a version number of
- Xthis License, you may choose any version ever published by the Free Software
- XFoundation.
- X
- X 10. If you wish to incorporate parts of the Program into other free
- Xprograms whose distribution conditions are different, write to the author
- Xto ask for permission. For software which is copyrighted by the Free
- XSoftware Foundation, write to the Free Software Foundation; we sometimes
- Xmake exceptions for this. Our decision will be guided by the two goals
- Xof preserving the free status of all derivatives of our free software and
- Xof promoting the sharing and reuse of software generally.
- X
- X NO WARRANTY
- X
- X 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
- XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
- XOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
- XPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
- XOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- XMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
- XTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
- XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
- XREPAIR OR CORRECTION.
- X
- X 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
- XWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
- XREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
- XINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
- XOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
- XTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
- XYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
- XPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
- XPOSSIBILITY OF SUCH DAMAGES.
- X
- X END OF TERMS AND CONDITIONS
- X
- X Appendix: How to Apply These Terms to Your New Programs
- X
- X If you develop a new program, and you want it to be of the greatest
- Xpossible use to the public, the best way to achieve this is to make it
- Xfree software which everyone can redistribute and change under these terms.
- X
- X To do so, attach the following notices to the program. It is safest
- Xto attach them to the start of each source file to most effectively
- Xconvey the exclusion of warranty; and each file should have at least
- Xthe "copyright" line and a pointer to where the full notice is found.
- X
- X <one line to give the program's name and a brief idea of what it does.>
- X Copyright (C) 19yy <name of author>
- X
- X This program is free software; you can redistribute it and/or modify
- X it under the terms of the GNU General Public License as published by
- X the Free Software Foundation; either version 2 of the License, or
- X (at your option) any later version.
- X
- X This program is distributed in the hope that it will be useful,
- X but WITHOUT ANY WARRANTY; without even the implied warranty of
- X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- X GNU General Public License for more details.
- X
- X You should have received a copy of the GNU General Public License
- X along with this program; if not, write to the Free Software
- X Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- X
- XAlso add information on how to contact you by electronic and paper mail.
- X
- XIf the program is interactive, make it output a short notice like this
- Xwhen it starts in an interactive mode:
- X
- X Gnomovision version 69, Copyright (C) 19yy name of author
- X Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- X This is free software, and you are welcome to redistribute it
- X under certain conditions; type `show c' for details.
- X
- XThe hypothetical commands `show w' and `show c' should show the appropriate
- Xparts of the General Public License. Of course, the commands you use may
- Xbe called something other than `show w' and `show c'; they could even be
- Xmouse-clicks or menu items--whatever suits your program.
- X
- XYou should also get your employer (if you work as a programmer) or your
- Xschool, if any, to sign a "copyright disclaimer" for the program, if
- Xnecessary. Here is a sample; alter the names:
- X
- X Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- X `Gnomovision' (which makes passes at compilers) written by James Hacker.
- X
- X <signature of Ty Coon>, 1 April 1989
- X Ty Coon, President of Vice
- X
- XThis General Public License does not permit incorporating your program into
- Xproprietary programs. If your program is a subroutine library, you may
- Xconsider it more useful to permit linking proprietary applications with the
- Xlibrary. If this is what you want to do, use the GNU Library General
- XPublic License instead of this License.
- END_OF_FILE
- if test 17982 -ne `wc -c <'casu-3.3/COPYING'`; then
- echo shar: \"'casu-3.3/COPYING'\" unpacked with wrong size!
- fi
- # end of 'casu-3.3/COPYING'
- fi
- if test -f 'casu-3.3/ChangeLog' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'casu-3.3/ChangeLog'\"
- else
- echo shar: Extracting \"'casu-3.3/ChangeLog'\" \(16463 characters\)
- sed "s/^X//" >'casu-3.3/ChangeLog' <<'END_OF_FILE'
- XThu Dec 23 12:36:26 EST 1993 Luke Mewburn (lm@yallara)
- X
- X * increased to version 3.3.1, 931223 and prepared
- X for patch01 generation and release.
- X
- X * touched up README a bit.
- X
- X * separated installation of manuals from programs, and
- X provided installation directives for unformatted (install.man)
- X and formatted (install.catman) manual pages.
- X
- X * changed bitmask from 0x077 to 077 in source for
- X determining tty permissions in configure.in. (Bug
- X found by Michael Schroeder <screen@uni-erlangen.de>)
- X
- X
- XWed Dec 22 16:22:16 EST 1993 Luke Mewburn (lm@yallara)
- X
- X * added patchlevel.h as a header that source should be
- X dependant upon.
- X
- X * terminated an echo in Makefile.in with a `;' so that
- X the multiline statement that makes _to_ setgid tty
- X work correctly.
- X
- X * split VERSION into VERSION and RELDATE, updated
- X usage statements in source accordingly.
- X
- X
- XTue Dec 21 17:04:46 EST 1993 Luke Mewburn (lm@yallara)
- X
- X * prepared for comp.sources.misc submission, created patchlevel.h
- X
- X * increased to version 3.3
- X
- X
- XTue Dec 21 14:42:42 EST 1993 Luke Mewburn (lm@yallara)
- X
- X * added %b (host in brackets) to flon.
- X
- X * rename bsearch.c::bsearch to nbsearch, and always use it.
- X
- X * determine if YP/NIS is running, and define USE_GETPWENT
- X if that is the case.
- X
- X * updated email address to <lm@rmit.edu.au>
- X
- X
- XSun Nov 7 00:07:00 EST 1993 Luke Mewburn (root@ironbark)
- X
- X * Added <paths.h> inclusion (if it exists), for definition
- X of _PATH_DEV
- X
- X * If _to_ is running setgid(tty), then ensure that .torc
- X is written with the user's group by first doing
- X setgid(getgid()).
- X
- X * Slightly re-word the ``you're not logged in'' message.
- X
- X
- XTue Sep 7 13:55:32 EST 1993 Luke Mewburn (lm@yallara)
- X
- X * Released as v 3.2.2 to alt.sources
- X
- X
- XWed Aug 25 15:24:45 EST 1993 Luke Mewburn (lm@yallara)
- X
- X * check if bsearch() is declared in <stdlib.h> and don't
- X define if that's the case.
- X
- X
- XSun Aug 15 23:22:25 EST 1993 Luke Mewburn (nroot@icosahedron)
- X
- X * upgraded to version 3.2.2
- X
- X * touched up manual pages & other documentation for new version
- X
- X * added LN_S checks to configure.in
- X
- X * re-ordered output of -r and -l for to (-r is now first.)
- X * if you->tty == NULL, and no message got through, but you're
- X on (and the message was to yourself), there are two entries
- X in the passwd file for your uid (root/croot/nroot is usual case
- X :). So, print `you are only logged on once.' This may not be
- X correct for all situations like this, but I'm pretty sure it is.
- X
- X * determine if malloc(), read(), open(), and gethostname()
- X are declared in <*.h> and don't prototype if that's the case.
- X
- X * re-ordered & touched up configure.in & Makefile.in
- X
- X
- XSat Aug 14 12:08:06 EST 1993 Luke Mewburn (lm@yallara)
- X
- X * removed formatted manual pages from distribution (because
- X 'make -f Makefile.in dist' relies upon @ROFF@ & @TBL@ from
- X configure, and configure hasn't been run yet...)
- X
- X * all strings which are modifiable by a user (pseudonym,
- X autoreplies, and the message) are now passed through
- X filter_buf() to remove `illegal' characters. Just make this
- X a dummy function if you don't like this behaviour.
- X
- X * changed u_char to unsigned char in qsort.c
- X
- X * added Steve Riehm's patchs (with minor changes) for
- X a dottty (remember user AND tty), with relevant changes
- X to manual.
- X
- X
- XFri Aug 6 18:05:25 EST 1993 Luke Mewburn (lm@yallara)
- X
- X * added '\" t as the first line of the *.rof files so that
- X Solaris 2's man(1) would preprocess the pages through tbl.
- X
- X * added `remove exclude entry'.
- X
- X * ignore multiple additions of an exclude entry for a user.
- X
- X * renamed add_alias & remove_alias to add_alist_ent &
- X remove_alist_ent, which better describes their function
- X
- X * fixed a couple of linked list bugs when adding an exclude
- X entry to the alist (experienced when an exclude & an alias
- X had the same userid).
- X
- X * changed argv & argc globals in to.c to be explicitly
- X static
- X
- X
- XSun Aug 1 00:49:49 EST 1993 Luke Mewburn (nroot@icosahedron)
- X
- X * changed version to 3.2.1, and released to alt.sources
- X
- X * check for <sys/utsname.h> & uname() if gethostname()
- X is not available. If neither is available, print no
- X host information in the _to_ header. Store `@' in host[]
- X if we need it (in to.c:send_message)
- X
- X * ensured man page, option parsing, and usage were all
- X consistant with each other (WRT command line options.)
- X Updated the manual pages for the new features.
- X
- X * added some important porting information to `README'
- X Included a `NEWS' file.
- X
- X * distribution now supplied with preformatted manuals
- X for those without nroff.
- X
- X * reset default width for %h back to 16
- X
- X * casu.h will only proto malloc/calloc/etc if stdlib.h
- X isn't included.
- X
- X * added -lsocket if found (for gethostname() on SCO)
- X
- X
- XSat Jul 31 00:28:56 EST 1993 Luke Mewburn (s902113@minyos)
- X
- X * added (non extern) definition of Kludge to to.c
- X for SCO
- X
- X * added the ability to exclude users in _to_, and an
- X appropriate auto-reply message.
- X
- X * fixed Makefile.in so object files were correctly rebuilt
- X if casu.h was modified
- X
- X * limit message to LINESIZ (256) chars, and replace all
- X non-ascii & control codes with `?'.
- X
- X
- XWed Jul 28 16:21:06 EST 1993 Luke Mewburn (s902113@minyos)
- X
- X * added 3rd arg (of 0) to open() in getutent.c
- X
- X * added reading of message from stdin in _to_, but only
- X if stdin is a terminal.
- X
- X * renamed qsort in qsort.c to nqsort to avoid conflicts
- X with partially ANSI compilers/headers (This version of
- X qsort is always used over the libc version because it
- X is guaranteed to have O(NlgN) worst case, unlike a lot
- X of versions shipped with older systems.)
- X
- X * changed all use of buffers using MAXPATHLEN, MAXHOSTNAMELEN,
- X BUFSIZ, etc to have an extra char (for NUL), and to strnc0py
- X values using sizeof(buffer).
- X
- X
- XTue Jul 27 01:13:10 EST 1993 Luke Mewburn (s902113@minyos)
- X
- X * RELEASE of CaSU 3.2 to alt.sources!
- X
- X * used autoconf 1.5 to generate configure script
- X
- X * cleaned up a couple of warnings generated by the
- X Solaris 2 compiler.
- X
- X
- XMon Jul 26 02:04:49 EST 1993 Luke Mewburn (nroot@icosahedron)
- X
- X * allowed _to_ to recognize `.user' or `. user' in .torc.
- X
- X * cleaned up the docs, added the format of the .torc to
- X TO.rof.
- X
- X
- XWed Jul 21 22:49:16 EST 1993 Luke Mewburn (nroot@icosahedron)
- X
- X * fixed error messages for _to_ to correctly indicate
- X why the transmission failed.
- X
- X * _to_ now sends the message to the least idle tty (if
- X one exists.)
- X
- X
- XWed Jul 21 05:03:51 EST 1993 Luke Mewburn (nroot@icosahedron)
- X
- X * fixed minor definition problems with utmp & utmpx
- X formats. NULL_UTMP_ENTRY for checks ut_name[0] as well
- X as ut_type - necessary for SVR4 & possibly IRIX.
- X
- X * changed default width for %h to 32
- X
- X * doc fixes (added standard INSTALL file, moved old
- X INSTALL & Notes to README, made __TODO__)
- X
- X * fixed a couple of typos in Makefile.in which prevented
- X the installation from working correctly.
- X
- X * re-introduced system call/library prototypes to casu.h.
- X Should be ok for most systems. If problems occur, just hack
- X the definition of __PROT.
- X
- X
- XTue Jul 20 20:18:52 EST 1993 Luke Mewburn (s902113@yallara)
- X
- X * include -lnsl so Solaris 2 can find gethostname()
- X
- X * include <netdb.h> if MAXHOSTNAMELEN defined there
- X (for Solaris 2)
- X
- X
- XTue Jul 20 13:25:24 EST 1993 Luke Mewburn (nroot@icosahedron)
- X
- X * autodetect if _to_ must be setgid tty (because terminals
- X are owned by tty, and there is no global write perms to
- X them.) Set TTY_RESTRICTED if this is the case, and TO_GRP
- X to the numeric GID to install _to_ setgid.
- X
- X * autodetect /etc/passwd.dir || /etc/pwd.db and set
- X USE_GETPWENT if either exists. Otherwise, _flon_ will use
- X custom /etc/passwd reading code.
- X
- X * added support for SVR4's <utmpx.h>. Assumes that ut_host
- X field exists, and ut_time is actually ut_tv.tv_sec.
- X
- X * checked for potential overrun of buffer in convert_realname
- X
- X * doc fixes (to .rof sources)
- X
- X * depreciated the NO_GETLOGIN define (since the machine
- X that it was a hack for has been replaced)
- X
- X * began implementation of the GNU auto-configuration package.
- X
- X * upgraded the version to 3.2 in light of the changes made.
- X
- X
- XTue Jul 20 01:30:38 EST 1993 Luke Mewburn (s902113@minyos)
- X
- X * placed _flon_ & _to_ changelogs into this file at this point,
- X for easier reference.
- X
- X
- X*
- X* CHANGELOG for _flon_ v3.1 and before:
- X*
- X
- X 3.1, 930715
- X - added -P (minimum time before it prints time instead of
- X `...' in %i)
- X - added seconds & minutes suffixes (s & m) for -p & -P
- X - added -e & -E back in, with a different meaning. (Because
- X it's Not Good to make an option, even a useless one, illegal
- X in a newer version). This pair of options toggles the
- X Exclusion of people in your friends file (implicit -a).
- X 930621
- X - compare_utmp now returns 0 for 2 NULL entries, not -1.
- X (just an optimization)
- X 930619
- X - hostname info is now from least idle tty.
- X - `flon -w ...' is synonymous with `who ...'.
- X - fixed `not clearing cur_ent' with no duplicates & a user who
- X was `totally idled out'
- X 930613
- X - deprecieated 'no errors' (-e & -E) options (it wasn't _that_ useful).
- X - cleaned up version info, etc.
- X - cur_ent.on now is #times_on - 1.
- X 930610
- X - fixed yet another quote bug. should be robust now!
- X - upped to v 3.1 and added to casu package.
- X
- X 3.0.4c, 930530
- X - improved quote and backslash parsing of $FLON
- X 930529
- X - %h handling not correct on machines which didn't support UT_HOST
- X - finally got varient width and truncation working (I hope!)
- X - number parsing (for -p and %<num><specifier>) improved.
- X - moved misc routines from init.c & main.c to various.c
- X
- X 3.0.4b, 930528
- X - wasn't null-terminating outbuf, so varient records overlapped stuff.
- X 930526
- X - fixed bug in C_COUNT printing for duplicates.
- X 930525
- X - version upped to 3.0.4, and released for general
- X beta-testing.
- X
- X 3.0.3d, 930525
- X - dumped heapsort() - trashes data created by malloc() on cc on minyos.
- X Back to Net/2's qsort().
- X 930524:
- X - moved putstr code directly into loop - makes debugging
- X easier and speeds up the code a bit.
- X 930523
- X - finished varient records
- X 930522
- X - began implementing varient records.
- X - rewrote outbuf handling code - doesn't rely upon chars
- X being signed 8bit values.
- X
- X 3.0.3b, 930520
- X - cleaned up printing code, and code in general (WRT
- X localizing variable use, etc)
- X - totally rewrote ' parsing in add_envopt. Should work with
- X any number of ' pairs/word (a la csh) instead of only
- X allowing 1 pair of 's per word.
- X - using NET/2 bsearch() and heapsort() routines. (instead
- X of qsort())
- X - moved all printbuf stuff into 1 struct.
- X
- X 3.0.3a, 930519
- X - %c and %x will print spaces if -d not given
- X - -v is synonym for -V
- X - added %a (availability). %m is always correct for
- X the current tty. %a is as %[cx] when -d not given.
- X 930518
- X - Moved all #define stuff from Makefile into lon.h
- X - Removed BSEARCH define and associated qsort() stuff for
- X passwd file.
- X
- X 3.0.2, 930504
- X - Fixed definition of struct utmp Kludge for SCO boxes
- X 930503
- X - Cleaned up parsing of output format.
- X - Fixed bug with get_username() when getlogin() fails.
- X
- X 3.0.1, 930414
- X - Fixed up who am I (it was not checking `I' correctly, only `i')
- X
- X 3.0, 930328
- X - Entirely redesigned method of parsing format string. Only
- X limitation is 1 %X (X == any specifier type) field can't
- X exceed 127 bytes.
- X - Cleaned up manual.
- X
- X 2.7, 930316
- X - Enhanced $FLON parsing. Use modified code from gzip 1.0.6
- X (which in itself was code modified from stuff I wrote &
- X donated :), so $FLON format is now like:
- X setenv FLON "-ht -o'%-u %p' -p30"
- X
- X 2.6.4b, 930125
- X - Prototyped lon.h with __PROT() technique.
- X
- X 2.6.4a, 930123
- X - Added optional use of getpw*() routines (for BSD boxes with
- X cached entries).
- X - Fixed error reporting for $FLON (got progname and varname
- X mixed somehow between 2.6.2 and 2.6.4...)
- X
- X 2.6.3, 921019
- X - Put options -O, -N, and -Y which reset the -o, -y, and -n
- X options respectively to their compiled in defaults.
- X
- X 2.6.2, 920916
- X - Default idle cutoff was 0 seconds instead of 5 minutes (an
- X accidental change caused this...) Found by Albert Zvara, who,
- X unlike the author, hadn't changed the default...
- X
- X 2.6.1, 920912
- X - Fixed 'who am I <anyfile' so that it acts like 386BSD who(1).
- X (I.e, outputs something like: "nroot tty?? current_time")
- X - Talk status when duplicates are removed is calculated
- X differently, depending upon whether the idle time/tty for
- X the least idle terminal is required or not.
- X - Rewrote print.c so that flags that needed to be reset
- X between lines of different users were being reset.
- X - Put the global variables as a conditional extern in lon.h
- X
- X 2.6, 920905
- X - Finally put flon under the GNU Public License, Version 2.
- X
- X 2.5.2, 920903
- X - Modified Makefile to generate tarfile based on current
- X version number in header file.
- X - Fixed a fatal bug in the passwd file routine (which was
- X only discovered after a kernel upgrade - I suspected the
- X upgrade at first :) where I was overrunning the end of
- X malloc region.
- X
- X 2.5.1, 920831
- X - Fixed mix-ups with ttys. Caused when you a) wanted psuedonums,
- X b) only wanted friends. I was resetting a flag (li_valid)
- X which indicates the idle data is invalid. Thanx to W. Kasdorp
- X for notifying me of the bug.
- X
- X 2.5rel, 920826
- X - Entries for duplicates are printed with the most useful
- X bit of info. The login/idle time and tty from the tty
- X which has been idle the least is used.
- X 920825
- X - By default, entries with ttys which can't be statted are
- X printed, but without idle time or mesg status displayed.
- X -e now just doesn't print those entries.
- X
- X 2.5b, 920824
- X - Really cleaned up Makefile: now you just edit the defines
- X - Fixed up some of the compile options (WANTPROTO, etc)
- X - 'who am I </dev/null' returns "Must be attached to tty.."
- X (a la Sys V.).
- X
- X 2.5a, 920823
- X - Made output compatible with 386BSD who(1). (Acts like who(1)
- X when argv[0] is found to be 'who'). Doesn't do the (...) of
- X hostname properly though...
- X BUG: Can't handle 'who am I < anyfile' - acts as 'who'.
- X - Fixed ampersand handling in passwd file. (Expands & in
- X gcos field to username.)
- X
- X 2.4.4 (internal beta version), 920822
- X - Cleaned up detection of different utmp/passwd defines.
- X - decided to create a changelog/notes file (This is that
- X file...)
- X
- X 2.4.3, 920820
- X - Fixed the tolower() problem in init.c (where uppercase
- X formats were recogised, but were not being stored as lowercase)
- X - Ported to 386BSD. (Added <stdlib.h> and <unistd.h>)
- X
- X 2.4.2
- X - Friends files specified on the cmd line or in $FLON are
- X taken to be relative to $cwd - let the OS decide (instead
- X of assuming everything was relative to $HOME)
- X
- X 2.4.1
- X - Fixed some of the passwd file stuff.
- X - Added -e (ignore errors when statting /dev).
- X
- X 2.4
- X - Added '%r' (real name of user).
- X - Added -b. (%p acts as %r if no pseudonym found).
- X
- X 2.1->2.3
- X - Undocumented bug fixes and featuritis adding.
- X
- X 2.0
- X - First release to alt.sources.
- X
- X 1.0 -> 1.2
- X - Undocumented original internal (to RMIT) version.
- X
- X
- X*
- X* CHANGELOG for _to_ v3.1 and before.
- X*
- X
- X 3.1, 930715
- X - changed a couple of global variable names to reflect changes in
- X casu.h
- X 930619
- X - fixed bug when stdin redirected away from tty.
- X 930615
- X - cleaned up error messages.
- X 930613
- X - Improved code consistancy.
- X - Removed assumption that alias & name in .torc were going to be
- X 16 & 8 chars long respectively.
- X 930609
- X - Moved the code around, reduced the # of global variables.
- X 930608
- X - Updated the version, included as part as CaSU package.
- X - Hacked to code to work as part of CaSU.
- X
- X 3.0.6, 930503
- X - Fixed up minor bugs with confusion between idle & gone auto-reply.
- X (I.e, I cut & pasted a lot of lines :)
- X 930425
- X - Fixed up pseudo handling. (Only writes pseudo from $NAME or
- X $PSEUDONYM _if_ no pseudo currently defined in .torc)
- X 930423
- X - Give a warning if your messages are off.
- X - Fixed up usage message (and basenamed progname)
- X 930421
- X - Added idle auto-reply.
- X - Added unalias
- X - Give warning if no arguments are given at all.
- X
- X 3.0.5, 930419
- X - Cleaned up userid/name display.
- X
- X 3.0.4, 930415
- X - Added name/pseudonym storage in the .torc (only if it's from
- X - -P, $PSEUDONYM, or $NAME)
- X - Improved name handling.
- X - Cleaned up code & argument passing, global variables, external
- X function definitions.
- X
- X 3.0.3, 930408
- X - Added -t tty option.
- X
- X 3.0.2, 930407
- X - Fixed up inconsistancies with the dotuser (moved the variable
- X to the user_t struct.)
- X - Made all function passing of user_t with pointers.
- X
- X 3.0.1, 930406
- X - Cleaned up messages to destinations.
- X
- X 3.0, 930327
- X - First release of version by Luke Mewburn.
- END_OF_FILE
- if test 16463 -ne `wc -c <'casu-3.3/ChangeLog'`; then
- echo shar: \"'casu-3.3/ChangeLog'\" unpacked with wrong size!
- fi
- # end of 'casu-3.3/ChangeLog'
- fi
- if test -f 'casu-3.3/Makefile.in' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'casu-3.3/Makefile.in'\"
- else
- echo shar: Extracting \"'casu-3.3/Makefile.in'\" \(5317 characters\)
- sed "s/^X//" >'casu-3.3/Makefile.in' <<'END_OF_FILE'
- X#
- X# CaSU Makefile
- X#
- X# Version: 3.3.1
- X# Written 931223 by Luke Mewburn <lm@rmit.edu.au>
- X#
- X
- X
- X#### Start of system configuration section. ####
- X
- Xsrcdir = @srcdir@
- XVPATH = @srcdir@
- X
- X# Compiler related directives. If necessary, change to suit.
- X
- XCC = @CC@
- X
- XINSTALL = @INSTALL@
- XINSTALL_PROGRAM = @INSTALL_PROGRAM@
- XINSTALL_DATA = @INSTALL_DATA@
- XLN = @LN_S@
- X
- X#
- X# Defines currently available. Add to DEFS if necessary (if configure
- X# doesn't get it right)
- X#
- X# STDC_HEADERS=1 if the system's got full ANSI headers.
- X# const= if the compiler doesn't grok `const'.
- X# uid_t=int if <sys/types.h> doesn't have uid_t.
- X# gid_t=int if <sys/types.h> doesn't have gid_t.
- X# mode_t=int if <sys/types.h> doesn't have mode_t.
- X# size_t=int if <sys/types.h> doesn't have size_t.
- X# HAVE_UNISTD_H=1 if <unistd.h> exists.
- X# HAVE_STDLIB_H=1 if <stdlib.h> exists.
- X# HAVE_PATHS_H=1 if <paths.h> exists.
- X# HAVE_UT_TYPE=1 struct utmp has ut_type (usually a SysV system.)
- X# HAVE_UT_HOST=1 struct utmp has ut_host (usually a BSD system.)
- X# Note that SVR4 does, but in struct utmpx.
- X# HAVE_UTMPX_H=1 if <utmpx.h> & related getutx() funcs exist
- X# (SVR4 does).
- X# HAVE_STRERROR=1 if strerror() exists.
- X# TTY_RESTRICTED=1 if there are no world write permissions to ttys,
- X# so `to' must be setgid, and mask is 020 not 022.
- X# USE_GETPWENT=1 flon has 2 ways of getting passwd information:
- X# a) use getpwent(), or b) use custom code.
- X# The former is faster when /etc/passwd has some
- X# form of database caching, otherwise the custom
- X# code is usually faster.
- X# NEED_NETDB_H=1 if MAXHOSTNAMELEN is defined in <netdb.h>.
- X# MALLOC_DECL=1 if malloc() is declared in <stdlib.h>.
- X# OPEN_DECL=1 if open() is declared in <fcntl.h>.
- X# READ_DECL=1 if read() is declared in <unistd.h>.
- X# HAVE_GETHOSTNAME=1 if gethostname() exists (check -lnsl & -lsocket.)
- X# GETHOSTNAME_DECL=1 if gethostname() is declared in <unistd.h>.
- X# HAVE_UNAME=1 if uname() exists, but NOT gethostname().
- X# HAVE_SYS_UTSNAME_H=1 if <sys/utsname.h> exists, and using uname().
- X#
- X
- XDEFS = @DEFS@
- XLIBS = @LIBS@
- X
- XCFLAGS = -O
- X#CFLAGS = -pipe -Wall -O # gcc <2.0
- X#CFLAGS = -pipe -Wall -O2 # gcc 2.0+
- X
- XLDFLAGS =
- X
- X
- X# Manual formatting directives - if necessary, change to suit.
- XROFF = @ROFF@
- XTBL = @TBL@
- X
- X
- X# Destination directories & files
- X
- Xprefix = /usr/local
- Xexec_prefix = $(prefix)
- Xbinprefix =
- Xmanprefix =
- Xcatprefix =
- X
- Xbindir = $(exec_prefix)/bin
- Xlibdir = /etc
- Xmandir = $(prefix)/man/man1
- Xmanext = 1
- Xcatdir = $(prefix)/cat/cat1
- Xcatext = 0
- X
- X# Set who_prog to empty if you don't want flon linked to who
- Xwho_prog = who
- X#who_prog =
- X
- X# Group to install `to' setgid to - if empty, don't setgid.
- Xto_group = @TO_GRP@
- X
- X
- X#### End of system configuration section. ####
- X
- X
- XSHELL = /bin/sh
- X
- XLSRCS = various.c getutent.c
- XFSRCS = fileio.c main.c init.c print.c qsort.c bsearch.c
- XTSRCS = to.c
- XLOBJS = various.o @LIBOBJS@
- XFOBJS = fileio.o main.o init.o print.o qsort.o bsearch.o $(LOBJS)
- XTOBJS = to.o $(LOBJS)
- XSRCS = $(FSRCS) $(TSRCS) $(LSRCS)
- XOBJS = $(FOBJS) $(TOBJS) $(LOBJS)
- X
- XHDRS = casu.h patchlevel.h
- X
- XDISTFILES = $(SRCS) $(HDRS) COPYING ChangeLog Makefile.in \
- X INSTALL README __TODO__ TO.rof FLON.rof \
- X eg.friends eg.torc tags configure.in configure NEWS
- X
- X
- Xall: @PROGS@
- X
- X$(OBJS): $(HDRS)
- X
- X.c.o:
- X $(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -I$(srcdir) $<
- X
- Xinstall: all
- X $(INSTALL_PROGRAM) flon $(bindir)/$(binprefix)flon
- X if test -n "$(who_prog)"; then \
- X rm -f $(bindir)/$(binprefix)$(who_prog); \
- X $(LN) $(bindir)/$(binprefix)flon $(bindir)/$(binprefix)$(who_prog);\
- X fi
- X $(INSTALL_PROGRAM) to $(bindir)/$(binprefix)to
- X if test -n "$(to_group)"; then \
- X echo "Installing _to_ setgid to group $(to_group)"; \
- X chgrp $(to_group) $(bindir)/$(binprefix)to; \
- X chmod g+s $(bindir)/$(binprefix)to; \
- X fi
- X
- Xinstall.man:
- X $(INSTALL_DATA) $(srcdir)/FLON.rof $(mandir)/$(manprefix)flon.$(manext)
- X $(INSTALL_DATA) $(srcdir)/TO.rof $(mandir)/$(manprefix)to.$(manext)
- X
- Xinstall.catman: catman
- X $(INSTALL_DATA) $(srcdir)/flon.0 $(catdir)/$(catprefix)flon.$(catext)
- X $(INSTALL_DATA) $(srcdir)/to.0 $(catdir)/$(catprefix)to.$(catext)
- X
- X
- Xflon: $(FOBJS)
- X $(CC) $(LDFLAGS) $(FOBJS) $(LIBS) -o $@
- X if test -n "$(who_prog)"; then \
- X rm -f $(who_prog); \
- X $(LN) $@ $(who_prog); \
- X fi
- X
- Xto: $(TOBJS)
- X $(CC) $(LDFLAGS) $(TOBJS) $(LIBS) -o $@
- X
- X
- Xcatman: flon.0 to.0
- X
- Xflon.0: FLON.rof
- X if test -n "$(ROFF)"; then \
- X $(TBL) FLON.rof | $(ROFF) > $@; \
- X else \
- X cp FLON.rof $@; \
- X fi
- X
- Xto.0: TO.rof
- X if test -n "$(ROFF)"; then \
- X $(TBL) TO.rof | $(ROFF) > $@; \
- X else \
- X cp TO.rof $@; \
- X fi
- X
- Xinctree:
- X inctree $(DEFS) $(SRCS)
- X
- XTAGS: $(SRCS)
- X ctags $(SRCS)
- X
- Xclean:
- X rm -f $(TOBJS) $(FOBJS) core* mon.out gmon.out
- X
- Xmostlyclean: clean
- X
- Xdistclean: clean
- X rm -f Makefile config.status @PROGS@ $(who_prog)
- X
- Xrealclean: distclean
- X rm -f tags flon.0 to.0
- X
- Xdist: $(DISTFILES)
- X echo `pwd` | sed 's|.*/||' > .fname
- X rm -rf `cat .fname`
- X mkdir `cat .fname`
- X ln $(DISTFILES) `cat .fname`
- X tar -zcf `cat .fname`.tar.gz `cat .fname`
- X rm -rf `cat .fname` .fname
- X
- Xdistshar: $(DISTFILES)
- X echo `pwd` | sed 's|.*/||' > .fname
- X rm -rf `cat .fname`
- X mkdir `cat .fname`
- X ln $(DISTFILES) `cat .fname`
- X shar -a -n `cat .fname` -s 'lm@rmit.edu.au (Luke Mewburn)' -c \
- X -L 30 -o `cat .fname`.sha `cat .fname`
- X rm -rf `cat .fname` .fname
- X
- X
- X# Prevent GNU make v3 from overflowing arg limit on SysV.
- X.NOEXPORT:
- END_OF_FILE
- if test 5317 -ne `wc -c <'casu-3.3/Makefile.in'`; then
- echo shar: \"'casu-3.3/Makefile.in'\" unpacked with wrong size!
- fi
- # end of 'casu-3.3/Makefile.in'
- fi
- if test -f 'casu-3.3/init.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'casu-3.3/init.c'\"
- else
- echo shar: Extracting \"'casu-3.3/init.c'\" \(11248 characters\)
- sed "s/^X//" >'casu-3.3/init.c' <<'END_OF_FILE'
- X/*
- X * CaSU - communications & status utilities.
- X * Copyright (C) 1992, 1993 Luke Mewburn <lm@rmit.edu.au>
- X * incorporating:
- X * flon - lists your friends who are logged on.
- X * to - send a short message to a friend
- X *
- X * This program is free software; you can redistribute it and/or modify
- X * it under the terms of the GNU General Public License as published by
- X * the Free Software Foundation; either version 2 of the License, or
- X * (at your option) any later version.
- X *
- X * This program is distributed in the hope that it will be useful,
- X * but WITHOUT ANY WARRANTY; without even the implied warranty of
- X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- X * GNU General Public License for more details.
- X *
- X * You should have received a copy of the GNU General Public License
- X * along with this program; if not, write to the Free Software
- X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- X *
- X */
- X
- X#include "casu.h"
- X
- X/*
- X * getenvopts
- X *
- X * argcp - pointer to original argc
- X * argvp - pointer to original argv
- X * env - name of env var to check.
- X *
- X * This function is partially derived from code in gzip 1.0.6,
- X * Copyright (C) 1992-1993 Jean-loup Gailly, (which itself was
- X * derived from a function that I donated to Jean-loup :)
- X */
- X
- X /* to assist in compatibility with previous versions */
- Xstatic int dodgy_env = 0;
- X
- Xvoid add_envopt(argcp, argvp, name)
- X int *argcp; /* pointer to argc */
- X char ***argvp; /* pointer to argv */
- X char *name; /* name of environment variable */
- X{
- X char *p, *env, **oargv, **nargv;
- X int oargc = *argcp; /* old argc */
- X int nargc = 0; /* number of arguments in env variable */
- X int op, tp; /* pos in origenv, pos in tmp buf */
- X int quote; /* # of single quotes in var. */
- X
- X env = getenv(name);
- X if (env == NULL)
- X return;
- X p = (char *) malloc(strlen(env)+1);
- X if (!p)
- X errexit(strerror(errno), NULL);
- X
- X if (!strchr(env, '-')) /* no `-' options in environment variable */
- X dodgy_env++;
- X for (op = tp = 0; env[op]; nargc++ )
- X { /* move through env */
- X quote = 0;
- X while (env[op] == ' ' || env[op] == '\t')
- X op++; /* skip leading whitespace */
- X if (!env[op])
- X break;
- X
- X while (env[op])
- X {
- X if (env[op] == '\'')
- X {
- X quote++; /* single quote */
- X op++;
- X continue;
- X }
- X if ( !(quote % 2) && (env[op] == ' ' || env[op] == '\t') )
- X break; /* nonquoted whitespace */
- X if (env[op] == '\\')
- X {
- X op++; /* backslashed char */
- X if (!env[op])
- X errexit("Unterminated \\", name);
- X }
- X p[tp++] = env[op++];
- X }
- X if (quote % 2) /* uneven # of 's */
- X errexit("Unmatched '", name);
- X p[tp++] = '\0';
- X }
- X if (nargc == 0)
- X return;
- X *argcp += nargc;
- X /*
- X * Allocate the new argv array, with an extra element just in case
- X * the original arg list did not end with a NULL.
- X */
- X nargv = (char**) calloc(*argcp+1, sizeof(char *));
- X if (nargv == NULL)
- X errexit(strerror(errno), NULL);
- X oargv = *argvp;
- X *argvp = nargv;
- X
- X /* Copy the program name first */
- X if (oargc-- < 0)
- X errexit("Argc<=0", NULL);
- X *(nargv++) = *(oargv++);
- X
- X /* Then copy the environment args */
- X for (tp = 0; nargc > 0; nargc--)
- X {
- X *(nargv++) = &p[tp]; /* store start */
- X while (p[tp++])
- X ; /* skip over word */
- X }
- X
- X /* Finally copy the old args */
- X while (oargc--)
- X *(nargv++) = *(oargv++);
- X return;
- X} /* add_envopt */
- X
- X
- X/*
- X * parse_options
- X *
- X * get all the options parsed...
- X */
- X
- Xvoid
- Xparse_options(origargc, myArgc, myArgv, frfile, format, yes_str, no_str)
- X int origargc, myArgc;
- X char *myArgv[], **frfile, **format, **yes_str, **no_str;
- X{
- X int ch;
- X
- X opterr=1;
- X while ((ch= getopt(myArgc, myArgv, "aAbBeEhHiIp:P:tTdDf:o:Oy:Yn:NvVU:w")) != -1)
- X switch (ch)
- X {
- X case 'a':
- X flags |= ALL_ON;
- X break;
- X case 'A':
- X flags &= ~ALL_ON;
- X break;
- X case 'b':
- X flags |= BEST_NAME;
- X break;
- X case 'B':
- X flags &= ~BEST_NAME;
- X break;
- X case 'e':
- X flags |= NO_MATES;
- X break;
- X case 'E':
- X flags &= ~NO_MATES;
- X break;
- X case 'h':
- X flags |= NO_HEADER;
- X break;
- X case 'H':
- X flags &= ~NO_HEADER;
- X break;
- X case 'i':
- X flags |= NO_IDLE;
- X break;
- X case 'I':
- X flags &= ~NO_IDLE;
- X break;
- X case 'p':
- X case 'P':
- X {
- X int p=0, v=0;
- X /* loop whilst this is a number < MAXIDLE */
- X while (optarg[p] && (v <= MAXIDLE) && isdigit(optarg[p]))
- X {
- X v *= 10;
- X v += optarg[p] - '0';
- X p++;
- X }
- X if ( (!optarg[p])
- X || ((strchr("sSmM", optarg[p]) && !optarg[p+1])))
- X {
- X if (strchr("mM", optarg[p])) /* not in seconds */
- X v *= IDLE_MULTIPLY;
- X if (ch == 'P')
- X min_idle = v;
- X else
- X max_idle = v;
- X }
- X else
- X {
- X flags |= ERROR_OPT; /* not a full number */
- X errmesg("illegal idle limit", optarg);
- X }
- X }
- X break;
- X case 't':
- X flags |= NO_TAILER;
- X break;
- X case 'T':
- X flags &= ~NO_TAILER;
- X break;
- X case 'd':
- X flags |= ONE_ONLY;
- X break;
- X case 'D':
- X flags &= ~ONE_ONLY;
- X break;
- X case 'f':
- X *frfile=optarg;
- X break;
- X case 'o':
- X *format=optarg;
- X break;
- X case 'O':
- X *format = STRformat;
- X break;
- X case 'y':
- X *yes_str=optarg;
- X break;
- X case 'Y':
- X *yes_str=STRyes;
- X break;
- X case 'n':
- X *no_str=optarg;
- X break;
- X case 'N':
- X *no_str=STRno;
- X break;
- X case 'U':
- X utmp_file=optarg;
- X break;
- X case 'w':
- X progname = WHO_PROG;
- X optind--;
- X who_main(myArgc - optind, &myArgv[optind]);
- X exit(0);
- X /* NOT REACHED */
- X case 'v':
- X case 'V':
- X flags |= COPYLEFT;
- X case '?':
- X flags |= ERROR_OPT;
- X break;
- X }
- X if (optind != myArgc)
- X flags |= ERROR_OPT;
- X
- X if (flags >= ERROR_OPT)
- X {
- X if (dodgy_env || origargc == 1)
- X fprintf(stderr, "\
- XWarning: Your $%s environment variable is of, or has, an older, incorrect,\n\
- Xformat. Please check this, referring to the manual for further help.\n",
- XSTRflon);
- X fprintf(stderr, "\
- XUsage: %s [-aAbBeEhHiItTdD] [-f friendsfile] [-o format] [-O] [-U utmpfile]\n\
- X\t\t[-y ys] [-Y] [-n ns] [-N] [-p max] [-P min] [-vV]\n", progname);
- X
- X if (flags & COPYLEFT)
- X {
- X fprintf(stderr, "\
- X\n\
- X%s version %s, %s.\n\
- XCopyright (C) 1992, 1993 Luke Mewburn.\n\
- XEmail: <lm@rmit.edu.au>\n\
- XThis is free software, and you are welcome to redistribute it under certain\n\
- Xconditions. See version 2 of the GNU Public License for more details.\n\
- X", progname, VERSION, RELDATE);
- X exit(0);
- X }
- X exit(1);
- X }
- X if (*format == NULL)
- X *format = STRformat;
- X if (*yes_str == NULL)
- X *yes_str = STRyes;
- X if (*no_str == NULL)
- X *no_str = STRno;
- X} /* parse_options */
- X
- X
- X/*
- X * parse_format
- X *
- X * parse the format string, and generate the outbuffer, template buffer,
- X * and command buffer.
- X * The following structures are created inside printdat:
- X * buf - has the template copied to each for each line output
- X * (used in print.c, but allocated here).
- X * form - contains the text which is static in each output line.
- X * cmds - contains 16bit entries of the form:
- X * | RA | VW | 13..8 CMD | 7..0 WIDTH |
- X * RA - right align
- X * VW - variant width
- X * CMD - 6 bit command
- X * WIDTH - 8 bit width (unsigned) 255 maxwidth limit
- X *
- X * note that these strings are all one continuous chunk of memory, in
- X * this format:
- X * cmds x ints long
- X * form x chars long, starts at command + x
- X * buf x chars long, starts at template + y
- X */
- X
- Xvoid
- Xparse_format(format)
- X char *format;
- X{
- X char *clp;
- X int cpos, fpos;
- X int width, lp;
- X
- X static struct
- X {
- X char spec [NUM_SPECIFIERS];
- X int wid [NUM_SPECIFIERS];
- X int cmd [NUM_SPECIFIERS];
- X int flags[NUM_SPECIFIERS];
- X } defwids =
- X {
- X { 'u', 'p', 'r', 'c', 'x',
- X 'l', 'i', 't', 'm', 'h',
- X 'b', 'a' },
- X { 8, 20, 20, 2, 1,
- X 15, 5, 8, 3, 16,
- X 18, 3 },
- X { C_USER, C_PSEUDO, C_REAL, C_COUNT, C_X,
- X C_LOGIN, C_IDLE, C_TTY, C_MESG, C_HOST,
- X C_HOSTBRK, C_AVAIL },
- X { 0, NEED_FFILE, NEED_PASSWD, BLANKF, BLANKF,
- X 0, NEED_STAT, 0, NEED_STAT, 0,
- X 0, NEED_STAT | BLANKF }
- X };
- X
- X if (flags & NO_IDLE) /* stat is needed to remove idle entries */
- X flags |= NEED_STAT;
- X if (!(flags & ALL_ON)) /* don't need friends file with -a */
- X flags |= NEED_FFILE;
- X if (flags & NO_MATES) /* need .friends & all people for no mates */
- X flags |= (ALL_ON + NEED_FFILE);
- X
- X width = 0;
- X for (clp=format; *clp; clp++)
- X {
- X int newwid = 0;
- X while (*clp)
- X {
- X if (*clp == '%')
- X if (clp[1] == '\0')
- X errexit("No specifier after %", NULL);
- X else
- X if (clp[1] == '%')
- X clp++;
- X else
- X break;
- X newwid++;
- X clp++;
- X }
- X width += newwid;
- X if (! *clp)
- X break;
- X clp++;
- X if (*clp == '-' || *clp == '.')
- X clp++;
- X if (! *clp)
- X errexit("No specifier after %", NULL);
- X
- X newwid=0;
- X while ((*clp) && isdigit(*clp) && (newwid <= MAX_WIDTH))
- X {
- X newwid = newwid*10 + *clp - '0';
- X clp++;
- X }
- X if (! *clp)
- X errexit("No specifier after %", NULL);
- X if (newwid > MAX_WIDTH)
- X {
- X clp[1] = '\0'; /* so the fprintf in errexit doesn't die */
- X errexit("Field width is too large", clp);
- X }
- X width += newwid;
- X if (isupper(*clp))
- X *clp = tolower(*clp);
- X for ( lp = 0; lp < NUM_SPECIFIERS; lp++ )
- X if ( defwids.spec[lp] == *clp )
- X break;
- X if (lp == NUM_SPECIFIERS)
- X {
- X clp[1] = '\0'; /* so printf in errexit doesn't die */
- X errexit("Invalid format char", clp);
- X }
- X if (!newwid)
- X width += defwids.wid[lp];
- X } /* for */
- X
- X printdat.cmds = (int *) malloc((width + 1) * sizeof(int));
- X if (printdat.cmds == NULL)
- X errexit(strerror(errno), NULL);
- X printdat.form = (char *) malloc((width + 1) * 2 * sizeof(char));
- X if (printdat.form == NULL)
- X errexit(strerror(errno), NULL);
- X printdat.buf = &printdat.form[width+1];
- X
- X for (lp=0; lp<width;lp++)
- X printdat.form[lp]=' ';
- X
- X cpos = fpos = 0;
- X for (clp=format; *clp; clp++)
- X {
- X width = 0;
- X while (*clp)
- X {
- X if (*clp == '%')
- X if (clp[1] == '%')
- X clp++;
- X else
- X break;
- X printdat.form[fpos++] = *clp;
- X width++;
- X clp++;
- X }
- X while (width > MAX_WIDTH) /* mark in 'static' slots */
- X {
- X printdat.cmds[cpos++] = C_NULL + MAX_WIDTH;
- X width -= MAX_WIDTH;
- X }
- X if (width > 0)
- X printdat.cmds[cpos++] = C_NULL + (width & C_WIDMASK);
- X if (!*clp)
- X break;
- X clp++;
- X printdat.cmds[cpos] = 0;
- X if (*clp == '-')
- X {
- X clp++;
- X printdat.cmds[cpos] |= C_RIGHT;
- X }
- X if (*clp == '.')
- X {
- X clp++;
- X printdat.cmds[cpos] |= C_VARIENT;
- X }
- X width=0;
- X while ((*clp) && isdigit(*clp))
- X {
- X width = width*10 + *clp - '0';
- X clp++;
- X }
- X if (isupper(*clp))
- X *clp = tolower(*clp);
- X for (lp = 0; lp < NUM_SPECIFIERS; lp++)
- X if (defwids.spec[lp] == *clp)
- X break;
- X flags |= defwids.flags[lp];
- X if (!width)
- X width = defwids.wid[lp];
- X printdat.cmds[cpos] |= width + defwids.cmd[lp];
- X if (flags & BLANKF)
- X {
- X if (!(flags & ONE_ONLY))
- X {
- X /* don't print this field if not using -d */
- X printdat.cmds[cpos] &= C_WIDMASK;
- X printdat.cmds[cpos] |= C_NULL;
- X }
- X flags &= ~BLANKF;
- X }
- X cpos++;
- X fpos += width;
- X }
- X printdat.form[fpos] = '\0';
- X printdat.cmds[cpos] = 0;
- X#if 0 /* debugging... */
- X {
- X int l = -1;
- X while (printdat.cmds[++l])
- X printf("%.3d %4.4x %d\n", l, printdat.cmds[l],
- X printdat.cmds[l] & C_WIDMASK);
- X l = -1;
- X while (printdat.form[++l])
- X printf("%c", printdat.form[l] == ' '? '_' : printdat.form[l]);
- X printf("\n");
- X }
- X#endif
- X} /* parse_format */
- END_OF_FILE
- if test 11248 -ne `wc -c <'casu-3.3/init.c'`; then
- echo shar: \"'casu-3.3/init.c'\" unpacked with wrong size!
- fi
- # end of 'casu-3.3/init.c'
- fi
- echo shar: End of archive 2 \(of 4\).
- cp /dev/null ark2isdone
- MISSING=""
- for I in 1 2 3 4 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 4 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-