wmwork: Add version 0.2.5 to repository.
From ftp://ftp.oregonstate.edu/.2/gentoo/distfiles/wmwork-0.2.5.tar.gz
This commit is contained in:
parent
7335ef2927
commit
be3ddab93d
106
wmwork/CHANGES
Normal file
106
wmwork/CHANGES
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
wmwork: CHANGES
|
||||||
|
---------------
|
||||||
|
For further information please visit http://www.godisch.de/cvs/wmwork/.
|
||||||
|
|
||||||
|
0.2.5 - Dec 02, 2005
|
||||||
|
|
||||||
|
* Solaris portability fixes, thanks to Ben Stern.
|
||||||
|
Lockfile removal still does not work perfectly, since Solaris
|
||||||
|
/proc is not the same as Linux /proc.
|
||||||
|
* Small bugfix in display code, thanks to Josep Portella Florit.
|
||||||
|
* Build system cleanup.
|
||||||
|
* Fixed manual dashes.
|
||||||
|
|
||||||
|
0.2.4 - Apr 29, 2003
|
||||||
|
|
||||||
|
* Fixed lock file removal on program exit.
|
||||||
|
* Moved exit code out of the signal handler.
|
||||||
|
|
||||||
|
0.2.3 - Mar 25, 2003
|
||||||
|
|
||||||
|
* Updated autoconf support and README file.
|
||||||
|
* Wrote PID into lock file, added PID check on startup.
|
||||||
|
|
||||||
|
0.2.2 - Jan 02, 2003
|
||||||
|
|
||||||
|
* Added lock file and --force.
|
||||||
|
* Removed strip option from Makefile.in.
|
||||||
|
|
||||||
|
0.2.1 - Nov 02, 2002
|
||||||
|
|
||||||
|
* Made ~/.wmwork/XYZ timestamp format RFC 822 compliant.
|
||||||
|
* Wrote logging information to stderr if an error occurs.
|
||||||
|
* Changed --days format 'dd:hh:mm' to 'dd.hh:mm'.
|
||||||
|
* Changed the default project id 'NN' to '---'.
|
||||||
|
* Moved timers and project id one pixel to the left.
|
||||||
|
* Let ':' always be shown when the timer is not running.
|
||||||
|
* Raised an error on additional arguments.
|
||||||
|
* Fixed 'make uninstall'.
|
||||||
|
* Documentation cleanups.
|
||||||
|
|
||||||
|
0.2.0 - Oct 19, 2002
|
||||||
|
|
||||||
|
* Introduced ~/.wmwork directory.
|
||||||
|
* Comments in ~/.wmwork/worklog will be preserved now.
|
||||||
|
* Added --display and --geometry support.
|
||||||
|
* Applied the FreeBSD patch for wmwork.c.
|
||||||
|
Thanks to Alexey Dokuchaev.
|
||||||
|
* Added autoconf support.
|
||||||
|
|
||||||
|
0.1.0 - Mar 30, 2002
|
||||||
|
|
||||||
|
* Added signal handling: a running timer will be saved before
|
||||||
|
exiting on usual signals.
|
||||||
|
* Fixed options handling.
|
||||||
|
* Extended viewable characters (#32...#126) for project id.
|
||||||
|
Please note that #47 (slash) is the directory delimiter,
|
||||||
|
hence it cannot be used here.
|
||||||
|
|
||||||
|
0.0.10
|
||||||
|
|
||||||
|
* Some bugfixes in wmwork.c and wmwork.xpm.
|
||||||
|
Thanks to Daniel Tschan.
|
||||||
|
|
||||||
|
0.0.9
|
||||||
|
|
||||||
|
* Added command line option -d.
|
||||||
|
* Changed source directory.
|
||||||
|
|
||||||
|
0.0.8
|
||||||
|
|
||||||
|
* Added long options.
|
||||||
|
* Changed error messages.
|
||||||
|
|
||||||
|
0.0.7
|
||||||
|
|
||||||
|
* Separated Debian packaging information.
|
||||||
|
* Fixed a bug when scanning project identifiers with length < 3.
|
||||||
|
* Changed error reporting and human readable timestamp logging.
|
||||||
|
* Changed look of the < > buttons and fixed a single coordinate.
|
||||||
|
* Updated manual page.
|
||||||
|
|
||||||
|
0.0.6
|
||||||
|
|
||||||
|
* Fixed segfault when reading a logfile starting with comments.
|
||||||
|
|
||||||
|
0.0.5
|
||||||
|
|
||||||
|
* Updated manual page.
|
||||||
|
|
||||||
|
0.0.4
|
||||||
|
|
||||||
|
* Added command line options -h and -v.
|
||||||
|
* Fixed nullpointer in error message.
|
||||||
|
|
||||||
|
0.0.3
|
||||||
|
|
||||||
|
* Updated Makefile and manual page.
|
||||||
|
|
||||||
|
0.0.2
|
||||||
|
|
||||||
|
* Replaced project array by linked list.
|
||||||
|
* Updated Makefile and manual page.
|
||||||
|
|
||||||
|
0.0.1
|
||||||
|
|
||||||
|
* Initial revision.
|
340
wmwork/COPYING
Normal file
340
wmwork/COPYING
Normal file
|
@ -0,0 +1,340 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
30
wmwork/README
Normal file
30
wmwork/README
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
wmwork: README
|
||||||
|
--------------
|
||||||
|
|
||||||
|
INSTALLATION
|
||||||
|
|
||||||
|
On Debian systems, install the Debian package: type 'dpkg -i wmwork_*.deb' as
|
||||||
|
root. If you need to compile it first, e.g. you want to install the unstable
|
||||||
|
version on a woody system, type 'dpkg-buildpackage -rfakeroot -tc -uc -us'.
|
||||||
|
|
||||||
|
This program requires GNU make. On Non-Debian systems compile the program
|
||||||
|
typing './configure', 'make' and then 'make install' as root.
|
||||||
|
|
||||||
|
|
||||||
|
UPGRADING
|
||||||
|
|
||||||
|
If you are upgrading from a version prior to 0.2.0, wmwork will move
|
||||||
|
~/.wmworklog to ~/.wmwork/worklog and ~/.wmworklog.XYZ to ~/.wmwork/XYZ if it
|
||||||
|
detects a missing ~/.wmwork and an existing ~/.wmworklog.
|
||||||
|
|
||||||
|
|
||||||
|
HOW TO USE THIS PROGRAM
|
||||||
|
|
||||||
|
Please read the manual page, type 'man wmwork'.
|
||||||
|
|
||||||
|
|
||||||
|
WHAT DO YOU WANT?
|
||||||
|
|
||||||
|
All of the author's requirements are implemented in wmwork now. Are there any
|
||||||
|
additional features you would like to see implemented? Please tell me if you
|
||||||
|
are missing some functionality...
|
43
wmwork/src/Makefile.in
Normal file
43
wmwork/src/Makefile.in
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# $Id: Makefile.in,v 1.13 2003/08/04 12:27:22 godisch Exp $
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
DESTDIR =
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
bindir = @bindir@
|
||||||
|
mandir = @mandir@
|
||||||
|
|
||||||
|
CC = @CC@
|
||||||
|
CPPFLAGS = -I. @CPPFLAGS@
|
||||||
|
CFLAGS = -Wall @CFLAGS@
|
||||||
|
LDFLAGS = -Wall @LDFLAGS@
|
||||||
|
LDLIBS = @LIBS@
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
|
||||||
|
all: wmwork
|
||||||
|
|
||||||
|
wmwork: wmwork.o wmgeneral.o
|
||||||
|
|
||||||
|
wmwork.o: wmwork.c wmwork.h config.h wmwork.xpm
|
||||||
|
wmgeneral.o: wmgeneral.c wmgeneral.h
|
||||||
|
|
||||||
|
install: wmwork wmwork.1
|
||||||
|
${INSTALL} -d ${DESTDIR}${bindir} ${DESTDIR}${mandir}/man1
|
||||||
|
${INSTALL_PROGRAM} wmwork ${DESTDIR}${bindir}
|
||||||
|
${INSTALL_DATA} wmwork.1 ${DESTDIR}${mandir}/man1
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
${RM} ${DESTDIR}${bindir}/wmwork ${DESTDIR}${mandir}/man1/wmwork.1
|
||||||
|
|
||||||
|
clean:
|
||||||
|
${RM} *.o config.log config.status *~
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
${RM} Makefile wmwork wmwork.1 config.h
|
||||||
|
|
||||||
|
cvsclean: distclean
|
||||||
|
${RM} configure config.h.in
|
||||||
|
|
||||||
|
.PHONY: all install uninstall clean distclean cvsclean
|
20
wmwork/src/autogen.sh
Executable file
20
wmwork/src/autogen.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# $Id: autogen.sh,v 1.4 2005/12/02 07:36:59 godisch Exp $
|
||||||
|
#
|
||||||
|
# Copyright (c) 2002-2005 Martin A. Godisch <martin@godisch.de>
|
||||||
|
|
||||||
|
test -e wmwork.c
|
||||||
|
umask 022
|
||||||
|
aclocal
|
||||||
|
autoheader
|
||||||
|
autoconf
|
||||||
|
./configure
|
||||||
|
make distclean
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
rm -f configure.scan autoscan.log
|
||||||
|
cd ..
|
||||||
|
chmod -R go=u-w .
|
||||||
|
version="`pwd`"
|
||||||
|
version="${version##*-}"
|
||||||
|
cd ..
|
||||||
|
tar cvzf wmwork_$version.orig.tar.gz --exclude CVS --exclude .cvsignore --exclude debian wmwork-$version
|
131
wmwork/src/config.h.in
Normal file
131
wmwork/src/config.h.in
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
|
/* Define to 1 if the `closedir' function returns void instead of `int'. */
|
||||||
|
#undef CLOSEDIR_VOID
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `atexit' function. */
|
||||||
|
#undef HAVE_ATEXIT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||||
|
*/
|
||||||
|
#undef HAVE_DIRENT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||||
|
#undef HAVE_FCNTL_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `gettimeofday' function. */
|
||||||
|
#undef HAVE_GETTIMEOFDAY
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `X11' library (-lX11). */
|
||||||
|
#undef HAVE_LIBX11
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `Xext' library (-lXext). */
|
||||||
|
#undef HAVE_LIBXEXT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `Xpm' library (-lXpm). */
|
||||||
|
#undef HAVE_LIBXPM
|
||||||
|
|
||||||
|
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||||
|
to 0 otherwise. */
|
||||||
|
#undef HAVE_MALLOC
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mkdir' function. */
|
||||||
|
#undef HAVE_MKDIR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||||
|
#undef HAVE_NDIR_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
|
#undef HAVE_STDLIB_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strcspn' function. */
|
||||||
|
#undef HAVE_STRCSPN
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strdup' function. */
|
||||||
|
#undef HAVE_STRDUP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strerror' function. */
|
||||||
|
#undef HAVE_STRERROR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strftime' function. */
|
||||||
|
#undef HAVE_STRFTIME
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
|
#undef HAVE_STRINGS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strspn' function. */
|
||||||
|
#undef HAVE_STRSPN
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strstr' function. */
|
||||||
|
#undef HAVE_STRSTR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strtol' function. */
|
||||||
|
#undef HAVE_STRTOL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||||
|
*/
|
||||||
|
#undef HAVE_SYS_DIR_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||||
|
*/
|
||||||
|
#undef HAVE_SYS_NDIR_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||||
|
#undef HAVE_SYS_TIME_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#undef PACKAGE_BUGREPORT
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#undef PACKAGE_NAME
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#undef PACKAGE_STRING
|
||||||
|
|
||||||
|
/* Define to the one symbol short name of this package. */
|
||||||
|
#undef PACKAGE_TARNAME
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||||
|
#undef RETSIGTYPE
|
||||||
|
|
||||||
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
|
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#undef TIME_WITH_SYS_TIME
|
||||||
|
|
||||||
|
/* Define to 1 if the X Window System is missing or not being used. */
|
||||||
|
#undef X_DISPLAY_MISSING
|
||||||
|
|
||||||
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
|
#undef const
|
||||||
|
|
||||||
|
/* Define to rpl_malloc if the replacement function should be used. */
|
||||||
|
#undef malloc
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> does not define. */
|
||||||
|
#undef pid_t
|
7051
wmwork/src/configure
vendored
Executable file
7051
wmwork/src/configure
vendored
Executable file
File diff suppressed because it is too large
Load diff
36
wmwork/src/configure.ac
Normal file
36
wmwork/src/configure.ac
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# $Id: configure.ac,v 1.19 2005/02/14 19:14:58 godisch Exp $
|
||||||
|
# copyright (c) 2002-2005 Martin A. Godisch <martin@godisch.de>
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
AC_PREREQ(2.59)
|
||||||
|
AC_INIT([wmwork],[0.2.5],[martin@godisch.de])
|
||||||
|
AC_REVISION([$Revision: 1.19 $])
|
||||||
|
AC_CONFIG_SRCDIR([wmwork.c])
|
||||||
|
AC_CONFIG_HEADER([config.h])
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
AC_PROG_MAKE_SET
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
AC_PATH_XTRA
|
||||||
|
LDFLAGS="$LDFLAGS $X_LIBS"
|
||||||
|
AC_CHECK_LIB([X11], [XNextEvent],, [AC_MSG_ERROR(cannot find libX11.so)], [$X_LIBS])
|
||||||
|
AC_CHECK_LIB([Xext], [XShapeCombineMask],, [AC_MSG_ERROR(cannot find libXext.so)], [$X_LIBS])
|
||||||
|
AC_CHECK_LIB([Xpm], [XpmCreatePixmapFromData],, [AC_MSG_ERROR(cannot find libXpm.so)], [$X_LIBS])
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
AC_LANG([C])
|
||||||
|
AC_C_CONST
|
||||||
|
AC_HEADER_DIRENT
|
||||||
|
AC_HEADER_STDC
|
||||||
|
AC_HEADER_TIME
|
||||||
|
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/time.h unistd.h],, [AC_MSG_ERROR([required header file missing])])
|
||||||
|
AC_TYPE_PID_T
|
||||||
|
AC_TYPE_SIGNAL
|
||||||
|
AC_FUNC_CLOSEDIR_VOID
|
||||||
|
AC_FUNC_MALLOC
|
||||||
|
AC_FUNC_MEMCMP
|
||||||
|
AC_FUNC_STRFTIME
|
||||||
|
AC_CHECK_FUNCS([atexit gettimeofday mkdir strcspn strdup strerror strspn strstr strtol],, [AC_MSG_ERROR([required standard library function missing])])
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
AC_CONFIG_FILES([Makefile wmwork.1])
|
||||||
|
AC_OUTPUT
|
||||||
|
# ----------------------------------------------------------------------------
|
251
wmwork/src/install-sh
Normal file
251
wmwork/src/install-sh
Normal file
|
@ -0,0 +1,251 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# install - install a program, script, or datafile
|
||||||
|
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||||
|
#
|
||||||
|
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
|
# documentation for any purpose is hereby granted without fee, provided that
|
||||||
|
# the above copyright notice appear in all copies and that both that
|
||||||
|
# copyright notice and this permission notice appear in supporting
|
||||||
|
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||||
|
# publicity pertaining to distribution of the software without specific,
|
||||||
|
# written prior permission. M.I.T. makes no representations about the
|
||||||
|
# suitability of this software for any purpose. It is provided "as is"
|
||||||
|
# without express or implied warranty.
|
||||||
|
#
|
||||||
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||||
|
# `make' implicit rules from creating a file called install from it
|
||||||
|
# when there is no Makefile.
|
||||||
|
#
|
||||||
|
# This script is compatible with the BSD install script, but was written
|
||||||
|
# from scratch. It can only install one file at a time, a restriction
|
||||||
|
# shared with many OS's install programs.
|
||||||
|
|
||||||
|
|
||||||
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
|
doit="${DOITPROG-}"
|
||||||
|
|
||||||
|
|
||||||
|
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||||
|
|
||||||
|
mvprog="${MVPROG-mv}"
|
||||||
|
cpprog="${CPPROG-cp}"
|
||||||
|
chmodprog="${CHMODPROG-chmod}"
|
||||||
|
chownprog="${CHOWNPROG-chown}"
|
||||||
|
chgrpprog="${CHGRPPROG-chgrp}"
|
||||||
|
stripprog="${STRIPPROG-strip}"
|
||||||
|
rmprog="${RMPROG-rm}"
|
||||||
|
mkdirprog="${MKDIRPROG-mkdir}"
|
||||||
|
|
||||||
|
transformbasename=""
|
||||||
|
transform_arg=""
|
||||||
|
instcmd="$mvprog"
|
||||||
|
chmodcmd="$chmodprog 0755"
|
||||||
|
chowncmd=""
|
||||||
|
chgrpcmd=""
|
||||||
|
stripcmd=""
|
||||||
|
rmcmd="$rmprog -f"
|
||||||
|
mvcmd="$mvprog"
|
||||||
|
src=""
|
||||||
|
dst=""
|
||||||
|
dir_arg=""
|
||||||
|
|
||||||
|
while [ x"$1" != x ]; do
|
||||||
|
case $1 in
|
||||||
|
-c) instcmd="$cpprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-d) dir_arg=true
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-m) chmodcmd="$chmodprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-o) chowncmd="$chownprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-s) stripcmd="$stripprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
*) if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
src=$1
|
||||||
|
else
|
||||||
|
# this colon is to work around a 386BSD /bin/sh bug
|
||||||
|
:
|
||||||
|
dst=$1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no input file specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]; then
|
||||||
|
dst=$src
|
||||||
|
src=""
|
||||||
|
|
||||||
|
if [ -d $dst ]; then
|
||||||
|
instcmd=:
|
||||||
|
chmodcmd=""
|
||||||
|
else
|
||||||
|
instcmd=mkdir
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||||
|
# might cause directories to be created, which would be especially bad
|
||||||
|
# if $src (and thus $dsttmp) contains '*'.
|
||||||
|
|
||||||
|
if [ -f $src -o -d $src ]
|
||||||
|
then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
echo "install: $src does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dst" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no destination specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If destination is a directory, append the input filename; if your system
|
||||||
|
# does not like double slashes in filenames, you may need to add some logic
|
||||||
|
|
||||||
|
if [ -d $dst ]
|
||||||
|
then
|
||||||
|
dst="$dst"/`basename $src`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
## this sed command emulates the dirname command
|
||||||
|
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||||
|
|
||||||
|
# Make sure that the destination directory exists.
|
||||||
|
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||||
|
|
||||||
|
# Skip lots of stat calls in the usual case.
|
||||||
|
if [ ! -d "$dstdir" ]; then
|
||||||
|
defaultIFS='
|
||||||
|
'
|
||||||
|
IFS="${IFS-${defaultIFS}}"
|
||||||
|
|
||||||
|
oIFS="${IFS}"
|
||||||
|
# Some sh's can't handle IFS=/ for some reason.
|
||||||
|
IFS='%'
|
||||||
|
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||||
|
IFS="${oIFS}"
|
||||||
|
|
||||||
|
pathcomp=''
|
||||||
|
|
||||||
|
while [ $# -ne 0 ] ; do
|
||||||
|
pathcomp="${pathcomp}${1}"
|
||||||
|
shift
|
||||||
|
|
||||||
|
if [ ! -d "${pathcomp}" ] ;
|
||||||
|
then
|
||||||
|
$mkdirprog "${pathcomp}"
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="${pathcomp}/"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]
|
||||||
|
then
|
||||||
|
$doit $instcmd $dst &&
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# If we're going to rename the final executable, determine the name now.
|
||||||
|
|
||||||
|
if [ x"$transformarg" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
dstfile=`basename $dst $transformbasename |
|
||||||
|
sed $transformarg`$transformbasename
|
||||||
|
fi
|
||||||
|
|
||||||
|
# don't allow the sed command to completely eliminate the filename
|
||||||
|
|
||||||
|
if [ x"$dstfile" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make a temp file name in the proper directory.
|
||||||
|
|
||||||
|
dsttmp=$dstdir/#inst.$$#
|
||||||
|
|
||||||
|
# Move or copy the file name to the temp name
|
||||||
|
|
||||||
|
$doit $instcmd $src $dsttmp &&
|
||||||
|
|
||||||
|
trap "rm -f ${dsttmp}" 0 &&
|
||||||
|
|
||||||
|
# and set any options; do chmod last to preserve setuid bits
|
||||||
|
|
||||||
|
# If any of these fail, we abort the whole thing. If we want to
|
||||||
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
|
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
|
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||||
|
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||||
|
|
||||||
|
fi &&
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
485
wmwork/src/wmgeneral.c
Normal file
485
wmwork/src/wmgeneral.c
Normal file
|
@ -0,0 +1,485 @@
|
||||||
|
/*
|
||||||
|
Best viewed with vim5, using ts=4
|
||||||
|
|
||||||
|
wmgeneral was taken from wmppp.
|
||||||
|
|
||||||
|
It has a lot of routines which most of the wm* programs use.
|
||||||
|
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
Author: Martijn Pieterse (pieterse@xs4all.nl)
|
||||||
|
|
||||||
|
---
|
||||||
|
CHANGES:
|
||||||
|
---
|
||||||
|
25/08/2002 (Martin A. Godisch, godisch@tcs.inf.tu-dresden.de)
|
||||||
|
* Fixed --display handling.
|
||||||
|
23/08/2002 (Martin A. Godisch, godisch@tcs.inf.tu-dresden.de)
|
||||||
|
* Fixed --geometry handling.
|
||||||
|
05/07/2002 (Martin A. Godisch, godisch@tcs.inf.tu-dresden.de)
|
||||||
|
* Fixed --geometry handling.
|
||||||
|
23/05/2002 (Martin A. Godisch, godisch@tcs.inf.tu-dresden.de)
|
||||||
|
* Added missing prototype for parse_rcfile2.
|
||||||
|
18/04/2002 (Martin A. Godisch, godisch@tcs.inf.tu-dresden.de)
|
||||||
|
* Improved bugfix in createXBMfromXPM from 17/04/2002.
|
||||||
|
17/04/2002 (Martin A. Godisch, godisch@tcs.inf.tu-dresden.de)
|
||||||
|
* Fixed a bug in createXBMfromXPM, introduced on 10/03/2002.
|
||||||
|
31/03/2002 (Martin A. Godisch, godisch@tcs.inf.tu-dresden.de)
|
||||||
|
* Some changes to make this file work with wmweather v1.31 and v2.0:
|
||||||
|
+ extracted initXwindow from openXwindow,
|
||||||
|
+ added XpmColorSymbols to valuemask in GetXPM,
|
||||||
|
+ added colorspec to colorsymbols in openXwindow.
|
||||||
|
10/03/2002 (Martin A. Godisch, godisch@tcs.inf.tu-dresden.de)
|
||||||
|
* Added > 1 char/pixel support in createXBMfromXPM.
|
||||||
|
09/03/2002 (Martin A. Godisch, godisch@tcs.inf.tu-dresden.de)
|
||||||
|
* Added EnterWindowMask, LeaveWindowMask, KeyPressMask,
|
||||||
|
KeyReleaseMask in XSelectInput
|
||||||
|
11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||||
|
* Removed a bug from parse_rcfile. You could
|
||||||
|
not use "start" in a command if a label was
|
||||||
|
also start.
|
||||||
|
* Changed the needed geometry string.
|
||||||
|
We don't use window size, and don't support
|
||||||
|
negative positions.
|
||||||
|
03/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||||
|
* Added parse_rcfile2
|
||||||
|
02/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||||
|
* Added -geometry support (untested)
|
||||||
|
28/08/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||||
|
* Added createXBMfromXPM routine
|
||||||
|
* Saves a lot of work with changing xpm's.
|
||||||
|
02/05/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||||
|
* changed the read_rc_file to parse_rcfile, as suggested by Marcelo E. Magallon
|
||||||
|
* debugged the parse_rc file.
|
||||||
|
30/04/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||||
|
* Ripped similar code from all the wm* programs,
|
||||||
|
and put them in a single file.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/xpm.h>
|
||||||
|
#include <X11/extensions/shape.h>
|
||||||
|
|
||||||
|
#include "wmgeneral.h"
|
||||||
|
|
||||||
|
/*****************/
|
||||||
|
/* X11 Variables */
|
||||||
|
/*****************/
|
||||||
|
|
||||||
|
Window Root;
|
||||||
|
int screen;
|
||||||
|
int x_fd;
|
||||||
|
int d_depth;
|
||||||
|
XSizeHints mysizehints;
|
||||||
|
XWMHints mywmhints;
|
||||||
|
Pixel back_pix, fore_pix;
|
||||||
|
Window iconwin, win;
|
||||||
|
GC NormalGC;
|
||||||
|
XpmIcon wmgen;
|
||||||
|
Pixmap pixmask;
|
||||||
|
|
||||||
|
/*****************/
|
||||||
|
/* Mouse Regions */
|
||||||
|
/*****************/
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int enable;
|
||||||
|
int top;
|
||||||
|
int bottom;
|
||||||
|
int left;
|
||||||
|
int right;
|
||||||
|
} MOUSE_REGION;
|
||||||
|
|
||||||
|
MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
|
||||||
|
|
||||||
|
/***********************/
|
||||||
|
/* Function Prototypes */
|
||||||
|
/***********************/
|
||||||
|
|
||||||
|
static void GetXPM(XpmIcon *, char **);
|
||||||
|
static Pixel GetColor(char *);
|
||||||
|
void RedrawWindow(void);
|
||||||
|
void AddMouseRegion(int, int, int, int, int);
|
||||||
|
int CheckMouseRegion(int, int);
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* parse_rcfile *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void parse_rcfile(const char *filename, rckeys *keys) {
|
||||||
|
|
||||||
|
char *p,*q;
|
||||||
|
char temp[128];
|
||||||
|
char *tokens = " :\t\n";
|
||||||
|
FILE *fp;
|
||||||
|
int i,key;
|
||||||
|
|
||||||
|
fp = fopen(filename, "r");
|
||||||
|
if (fp) {
|
||||||
|
while (fgets(temp, 128, fp)) {
|
||||||
|
key = 0;
|
||||||
|
q = strdup(temp);
|
||||||
|
q = strtok(q, tokens);
|
||||||
|
while (key >= 0 && keys[key].label) {
|
||||||
|
if ((!strcmp(q, keys[key].label))) {
|
||||||
|
p = strstr(temp, keys[key].label);
|
||||||
|
p += strlen(keys[key].label);
|
||||||
|
p += strspn(p, tokens);
|
||||||
|
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||||
|
free(*keys[key].var);
|
||||||
|
*keys[key].var = strdup(p);
|
||||||
|
key = -1;
|
||||||
|
} else key++;
|
||||||
|
}
|
||||||
|
free(q);
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* parse_rcfile2 *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||||
|
|
||||||
|
char *p;
|
||||||
|
char temp[128];
|
||||||
|
char *tokens = " :\t\n";
|
||||||
|
FILE *fp;
|
||||||
|
int i,key;
|
||||||
|
char *family = NULL;
|
||||||
|
|
||||||
|
fp = fopen(filename, "r");
|
||||||
|
if (fp) {
|
||||||
|
while (fgets(temp, 128, fp)) {
|
||||||
|
key = 0;
|
||||||
|
while (key >= 0 && keys[key].label) {
|
||||||
|
if ((p = strstr(temp, keys[key].label))) {
|
||||||
|
p += strlen(keys[key].label);
|
||||||
|
p += strspn(p, tokens);
|
||||||
|
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||||
|
free(*keys[key].var);
|
||||||
|
*keys[key].var = strdup(p);
|
||||||
|
key = -1;
|
||||||
|
} else key++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
free(family);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* GetXPM *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
|
||||||
|
|
||||||
|
XWindowAttributes attributes;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
/* For the colormap */
|
||||||
|
XGetWindowAttributes(display, Root, &attributes);
|
||||||
|
|
||||||
|
wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions | XpmColorSymbols);
|
||||||
|
|
||||||
|
err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
|
||||||
|
&(wmgen->mask), &(wmgen->attributes));
|
||||||
|
|
||||||
|
if (err != XpmSuccess) {
|
||||||
|
fprintf(stderr, "wm.app: not enough free colorcells.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* GetColor *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
static Pixel GetColor(char *name) {
|
||||||
|
|
||||||
|
XColor color;
|
||||||
|
XWindowAttributes attributes;
|
||||||
|
|
||||||
|
XGetWindowAttributes(display, Root, &attributes);
|
||||||
|
|
||||||
|
color.pixel = 0;
|
||||||
|
if (!XParseColor(display, attributes.colormap, name, &color)) {
|
||||||
|
fprintf(stderr, "wm.app: can't parse %s.\n", name);
|
||||||
|
} else if (!XAllocColor(display, attributes.colormap, &color)) {
|
||||||
|
fprintf(stderr, "wm.app: can't allocate %s.\n", name);
|
||||||
|
}
|
||||||
|
return color.pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* flush_expose *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
static int flush_expose(Window w) {
|
||||||
|
|
||||||
|
XEvent dummy;
|
||||||
|
int i=0;
|
||||||
|
|
||||||
|
while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
|
||||||
|
i++;
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* RedrawWindow *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void RedrawWindow(void) {
|
||||||
|
|
||||||
|
flush_expose(iconwin);
|
||||||
|
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
|
||||||
|
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
||||||
|
flush_expose(win);
|
||||||
|
XCopyArea(display, wmgen.pixmap, win, NormalGC,
|
||||||
|
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* RedrawWindowXY *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void RedrawWindowXY(int x, int y) {
|
||||||
|
|
||||||
|
flush_expose(iconwin);
|
||||||
|
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
|
||||||
|
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
||||||
|
flush_expose(win);
|
||||||
|
XCopyArea(display, wmgen.pixmap, win, NormalGC,
|
||||||
|
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* AddMouseRegion *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void AddMouseRegion(int index, int left, int top, int right, int bottom) {
|
||||||
|
|
||||||
|
if (index < MAX_MOUSE_REGION) {
|
||||||
|
mouse_region[index].enable = 1;
|
||||||
|
mouse_region[index].top = top;
|
||||||
|
mouse_region[index].left = left;
|
||||||
|
mouse_region[index].bottom = bottom;
|
||||||
|
mouse_region[index].right = right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* CheckMouseRegion *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
int CheckMouseRegion(int x, int y) {
|
||||||
|
|
||||||
|
int i;
|
||||||
|
int found;
|
||||||
|
|
||||||
|
found = 0;
|
||||||
|
|
||||||
|
for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
|
||||||
|
if (mouse_region[i].enable &&
|
||||||
|
x <= mouse_region[i].right &&
|
||||||
|
x >= mouse_region[i].left &&
|
||||||
|
y <= mouse_region[i].bottom &&
|
||||||
|
y >= mouse_region[i].top)
|
||||||
|
found = 1;
|
||||||
|
}
|
||||||
|
if (!found) return -1;
|
||||||
|
return (i-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* createXBMfromXPM *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
int width, height, numcol, chars;
|
||||||
|
char *zero, *color, *pos;
|
||||||
|
unsigned char bwrite;
|
||||||
|
int bcount;
|
||||||
|
|
||||||
|
|
||||||
|
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &chars);
|
||||||
|
|
||||||
|
zero = malloc(chars * sizeof(char));
|
||||||
|
color = malloc(chars * sizeof(char));
|
||||||
|
memcpy(zero, xpm[1], chars);
|
||||||
|
for (i = numcol+1; i < numcol+sy+1; i++) {
|
||||||
|
bcount = 0;
|
||||||
|
bwrite = 0;
|
||||||
|
pos = xpm[i];
|
||||||
|
for (j = 0; j < sx; j++) {
|
||||||
|
bwrite >>= 1;
|
||||||
|
memcpy(color, pos, chars);
|
||||||
|
if (memcmp(color, zero, chars)) {
|
||||||
|
bwrite += 128;
|
||||||
|
}
|
||||||
|
bcount++;
|
||||||
|
if (bcount == 8) {
|
||||||
|
*xbm = bwrite;
|
||||||
|
xbm++;
|
||||||
|
bcount = 0;
|
||||||
|
bwrite = 0;
|
||||||
|
}
|
||||||
|
pos += chars * sizeof(char);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(zero);
|
||||||
|
free(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* copyXPMArea *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
|
||||||
|
|
||||||
|
XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* copyXBMArea *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
|
||||||
|
|
||||||
|
XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* setMaskXY *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void setMaskXY(int x, int y) {
|
||||||
|
|
||||||
|
XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
|
||||||
|
XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* initXwindow *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void initXwindow(char *display_name) {
|
||||||
|
|
||||||
|
if (!(display = XOpenDisplay(display_name))) {
|
||||||
|
fprintf(stderr, "wm.app: can't open display %s\n",
|
||||||
|
XDisplayName(display_name));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
screen = DefaultScreen(display);
|
||||||
|
Root = RootWindow(display, screen);
|
||||||
|
d_depth = DefaultDepth(display, screen);
|
||||||
|
x_fd = XConnectionNumber(display);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************\
|
||||||
|
|* openXwindow *|
|
||||||
|
\*******************************************************************************/
|
||||||
|
|
||||||
|
void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height, char *geometry, XpmColorSymbol *colorspec) {
|
||||||
|
|
||||||
|
unsigned int borderwidth = 1;
|
||||||
|
XClassHint classHint;
|
||||||
|
char *wname = argv[0];
|
||||||
|
XTextProperty name;
|
||||||
|
|
||||||
|
XGCValues gcv;
|
||||||
|
unsigned long gcm;
|
||||||
|
|
||||||
|
int dummy=0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Convert XPM to XImage */
|
||||||
|
if (colorspec) {
|
||||||
|
for (i = 0; colorspec[i].name; i++)
|
||||||
|
colorspec[i].pixel = GetColor(colorspec[i].value);
|
||||||
|
wmgen.attributes.numsymbols = i;
|
||||||
|
wmgen.attributes.colorsymbols = colorspec;
|
||||||
|
}
|
||||||
|
GetXPM(&wmgen, pixmap_bytes);
|
||||||
|
|
||||||
|
/* Create a window to hold the stuff */
|
||||||
|
mysizehints.flags = USSize | USPosition;
|
||||||
|
mysizehints.x = 0;
|
||||||
|
mysizehints.y = 0;
|
||||||
|
|
||||||
|
back_pix = GetColor("white");
|
||||||
|
fore_pix = GetColor("black");
|
||||||
|
|
||||||
|
XWMGeometry(display, screen, geometry, NULL, borderwidth, &mysizehints,
|
||||||
|
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||||
|
|
||||||
|
mysizehints.width = 64;
|
||||||
|
mysizehints.height = 64;
|
||||||
|
|
||||||
|
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
|
||||||
|
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
|
||||||
|
|
||||||
|
iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
|
||||||
|
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
|
||||||
|
|
||||||
|
/* Activate hints */
|
||||||
|
XSetWMNormalHints(display, win, &mysizehints);
|
||||||
|
classHint.res_name = wname;
|
||||||
|
classHint.res_class = wname;
|
||||||
|
XSetClassHint(display, win, &classHint);
|
||||||
|
|
||||||
|
XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | KeyPressMask | KeyReleaseMask);
|
||||||
|
XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | KeyPressMask | KeyReleaseMask);
|
||||||
|
|
||||||
|
if (XStringListToTextProperty(&wname, 1, &name) == 0) {
|
||||||
|
fprintf(stderr, "%s: can't allocate window name\n", wname);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
XSetWMName(display, win, &name);
|
||||||
|
|
||||||
|
/* Create GC for drawing */
|
||||||
|
|
||||||
|
gcm = GCForeground | GCBackground | GCGraphicsExposures;
|
||||||
|
gcv.foreground = fore_pix;
|
||||||
|
gcv.background = back_pix;
|
||||||
|
gcv.graphics_exposures = 0;
|
||||||
|
NormalGC = XCreateGC(display, Root, gcm, &gcv);
|
||||||
|
|
||||||
|
/* ONLYSHAPE ON */
|
||||||
|
|
||||||
|
pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height);
|
||||||
|
|
||||||
|
XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
|
||||||
|
XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
|
||||||
|
|
||||||
|
/* ONLYSHAPE OFF */
|
||||||
|
|
||||||
|
mywmhints.initial_state = WithdrawnState;
|
||||||
|
mywmhints.icon_window = iconwin;
|
||||||
|
mywmhints.icon_x = mysizehints.x;
|
||||||
|
mywmhints.icon_y = mysizehints.y;
|
||||||
|
mywmhints.window_group = win;
|
||||||
|
mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
|
||||||
|
|
||||||
|
XSetWMHints(display, win, &mywmhints);
|
||||||
|
|
||||||
|
XSetCommand(display, win, argv, argc);
|
||||||
|
XMapWindow(display, win);
|
||||||
|
}
|
61
wmwork/src/wmgeneral.h
Normal file
61
wmwork/src/wmgeneral.h
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
#ifndef _WMGENERAL_H
|
||||||
|
#define _WMGENERAL_H
|
||||||
|
|
||||||
|
/***********/
|
||||||
|
/* Defines */
|
||||||
|
/***********/
|
||||||
|
|
||||||
|
#define MAX_MOUSE_REGION (16)
|
||||||
|
|
||||||
|
/************/
|
||||||
|
/* Typedefs */
|
||||||
|
/************/
|
||||||
|
|
||||||
|
typedef struct _rckeys rckeys;
|
||||||
|
|
||||||
|
struct _rckeys {
|
||||||
|
const char *label;
|
||||||
|
char **var;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _rckeys2 rckeys2;
|
||||||
|
|
||||||
|
struct _rckeys2 {
|
||||||
|
const char *family;
|
||||||
|
const char *label;
|
||||||
|
char **var;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Pixmap pixmap;
|
||||||
|
Pixmap mask;
|
||||||
|
XpmAttributes attributes;
|
||||||
|
} XpmIcon;
|
||||||
|
|
||||||
|
/*******************/
|
||||||
|
/* Global variable */
|
||||||
|
/*******************/
|
||||||
|
|
||||||
|
Display *display;
|
||||||
|
|
||||||
|
/***********************/
|
||||||
|
/* Function Prototypes */
|
||||||
|
/***********************/
|
||||||
|
|
||||||
|
void AddMouseRegion(int index, int left, int top, int right, int bottom);
|
||||||
|
int CheckMouseRegion(int x, int y);
|
||||||
|
|
||||||
|
void initXwindow(char *display_name);
|
||||||
|
void openXwindow(int argc, char *argv[], char **, char *, int, int, char *, XpmColorSymbol *);
|
||||||
|
void RedrawWindow(void);
|
||||||
|
void RedrawWindowXY(int x, int y);
|
||||||
|
|
||||||
|
void createXBMfromXPM(char *, char **, int, int);
|
||||||
|
void copyXPMArea(int, int, int, int, int, int);
|
||||||
|
void copyXBMArea(int, int, int, int, int, int);
|
||||||
|
void setMaskXY(int, int);
|
||||||
|
|
||||||
|
void parse_rcfile (const char *, rckeys *);
|
||||||
|
void parse_rcfile2(const char *, rckeys2 *);
|
||||||
|
|
||||||
|
#endif
|
135
wmwork/src/wmwork.1.in
Normal file
135
wmwork/src/wmwork.1.in
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
.ig
|
||||||
|
@configure_input@
|
||||||
|
$Id: wmwork.1.in,v 1.21 2005/02/14 19:14:58 godisch Exp $
|
||||||
|
.
|
||||||
|
Copyright (c) 2002-2005 Martin A. Godisch <martin@godisch.de>
|
||||||
|
..
|
||||||
|
.TH WMWORK 1 "January 2005" "The Debian Project" "Version @PACKAGE_VERSION@"
|
||||||
|
.
|
||||||
|
.SH NAME
|
||||||
|
.
|
||||||
|
wmwork \- keep track of time worked on projects
|
||||||
|
.
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.
|
||||||
|
.B wmwork
|
||||||
|
.RI [ options ]
|
||||||
|
.
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.
|
||||||
|
.B wmwork
|
||||||
|
provides a monitor on a 64x64 mini window that helps you keeping track of
|
||||||
|
your time. The idea is based on the program
|
||||||
|
.I Worklog
|
||||||
|
written by Truxton King Fulton II. In contrast to
|
||||||
|
.I Worklog
|
||||||
|
.B wmwork
|
||||||
|
is a graphical application designed to work with the WindowMaker dock, but
|
||||||
|
will work with other window managers as well.
|
||||||
|
.
|
||||||
|
.SH OPTIONS
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-d ,\ \-\-days
|
||||||
|
displays time in ddd.hh:mm instead of hhh:mm:ss. Note that if one timer is
|
||||||
|
at least 1000 hours large this will be the case anyway.
|
||||||
|
.TP
|
||||||
|
.BR \-f ,\ \-\-force
|
||||||
|
overwrite stale lock files. Use this if
|
||||||
|
.B wmwork
|
||||||
|
says that it's already running but it isn't.
|
||||||
|
.TP
|
||||||
|
.BR \-h ,\ \-\-help
|
||||||
|
display a command line summary.
|
||||||
|
.TP
|
||||||
|
.BR \-v ,\ \-\-version
|
||||||
|
display the version number.
|
||||||
|
.TP
|
||||||
|
.BI \-\-display= id
|
||||||
|
set the display to use, e.g.
|
||||||
|
.RI \-\-display= :0.0 .
|
||||||
|
.TP
|
||||||
|
.BI \-\-geometry= pos
|
||||||
|
set the position of the dock app, e.g.
|
||||||
|
.RI \-\-geometry= +10+10 .
|
||||||
|
Note that the size (64x64) is hard-coded and cannot be changed.
|
||||||
|
.
|
||||||
|
.SH USAGE
|
||||||
|
.
|
||||||
|
When
|
||||||
|
.B wmwork
|
||||||
|
is started, the uppermost line shows the accumulated time spent on the
|
||||||
|
project, identified by a three letter code in the third line. The second
|
||||||
|
line shows the current time spent on the project and is initially zero.
|
||||||
|
.PP
|
||||||
|
The button
|
||||||
|
.B V
|
||||||
|
starts the timer, the button
|
||||||
|
.B ||
|
||||||
|
pauses it. The button
|
||||||
|
.B X
|
||||||
|
stops the timer, saving the accumulated time in
|
||||||
|
.IR ~/.wmwork/worklog ,
|
||||||
|
adding the current session time to
|
||||||
|
.I ~/.wmwork/worklog.XYZ
|
||||||
|
and resetting the latter.
|
||||||
|
.PP
|
||||||
|
The buttons
|
||||||
|
.B <
|
||||||
|
and
|
||||||
|
.B >
|
||||||
|
switch between the projects found in the file
|
||||||
|
.IR ~/.wmwork/worklog .
|
||||||
|
This can be done only if the timer is neither running nor paused.
|
||||||
|
.
|
||||||
|
.SH FILES
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.B ~/.wmwork/worklog
|
||||||
|
contains the projects configuration and log summaries.
|
||||||
|
.PP
|
||||||
|
Each line has the form
|
||||||
|
.IR identifier:timestamp[:comment] .
|
||||||
|
Empty lines and lines beginning with a
|
||||||
|
.I #
|
||||||
|
are ignored. Only the first three characters of the (case-insensitive)
|
||||||
|
identifier are relevant. When
|
||||||
|
.B wmwork
|
||||||
|
is overwriting
|
||||||
|
.I ~/.wmwork/worklog
|
||||||
|
it cuts the identifiers down that way.
|
||||||
|
.TP
|
||||||
|
.B ~/.wmwork/???
|
||||||
|
contains human readable timestamps for the project
|
||||||
|
.IR XYZ ,
|
||||||
|
where
|
||||||
|
.I XYZ
|
||||||
|
is the truncated identifier from
|
||||||
|
.IR ~/.wmwork/worklog .
|
||||||
|
.PP
|
||||||
|
Having multiple entries of the same identifier in
|
||||||
|
.I ~/.wmwork/worklog
|
||||||
|
is possible. They are counted independently, but will share the same
|
||||||
|
project file.
|
||||||
|
.
|
||||||
|
.SH BUGS
|
||||||
|
.
|
||||||
|
Please send any bugs to <@PACKAGE_BUGREPORT@>. Debian users are encouraged
|
||||||
|
to use the Debian Bug Tracking System <http://bugs.debian.org/wmwork>.
|
||||||
|
.
|
||||||
|
.SH AUTHOR
|
||||||
|
.
|
||||||
|
.B wmwork
|
||||||
|
was written by Martin A. Godisch <martin@godisch.de>. It is based on the
|
||||||
|
program wmppp written by Martijn Pieterse and Antoine Nulle. Thanks to the
|
||||||
|
following people, who have contributed to wmwork:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
Adam Lackorzynski <adam@os.inf.tu-dresden.de>
|
||||||
|
Gordon Fraser <gordon@freakzone.net>
|
||||||
|
Daniel Tschan <tschan@devzone.ch>
|
||||||
|
Alexey Dokuchaev <danfe@danfe.ru>
|
||||||
|
Josep Portella Florit <jpf@sdf.lonestar.org>
|
||||||
|
Ben Stern <ben.stern@gmail.com>
|
||||||
|
.fi
|
||||||
|
.
|
730
wmwork/src/wmwork.c
Normal file
730
wmwork/src/wmwork.c
Normal file
|
@ -0,0 +1,730 @@
|
||||||
|
/* $Id: wmwork.c,v 1.67 2005/12/02 07:36:59 godisch Exp $
|
||||||
|
* vim: set noet ts=4:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2005 Martin A. Godisch <martin@godisch.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <X11/xpm.h>
|
||||||
|
|
||||||
|
#ifdef SOLARIS
|
||||||
|
# include <strings.h>
|
||||||
|
# define PID_T "%lu"
|
||||||
|
#else /* SOLARIS */
|
||||||
|
# include <getopt.h>
|
||||||
|
# define PID_T "%u"
|
||||||
|
#endif /* SOLARIS */
|
||||||
|
|
||||||
|
#include "wmgeneral.h"
|
||||||
|
#include "wmwork.h"
|
||||||
|
#include "wmwork.xpm"
|
||||||
|
|
||||||
|
#define BUT_START (1)
|
||||||
|
#define BUT_PAUSE (2)
|
||||||
|
#define BUT_STOP (3)
|
||||||
|
#define BUT_PREV (4)
|
||||||
|
#define BUT_NEXT (5)
|
||||||
|
|
||||||
|
#define CHAR_SRC_X1(N) ((N - 'A') * 5)
|
||||||
|
#define CHAR_SRC_Y1 (71)
|
||||||
|
#define CHAR_SRC_X2(N) ((N - ' ') * 5)
|
||||||
|
#define CHAR_SRC_Y2 (64)
|
||||||
|
#define CHAR_SRC_X3(N) ((N - '{') * 5 + 65)
|
||||||
|
#define CHAR_SRC_Y3 (57)
|
||||||
|
#define TIMER_SRC_X(N) (N * 5 + 80)
|
||||||
|
#define TIMER_SRC_Y (64)
|
||||||
|
|
||||||
|
char
|
||||||
|
wmwork_mask_bits[64*64],
|
||||||
|
*dirName = NULL,
|
||||||
|
*logname = NULL,
|
||||||
|
*lockname = NULL;
|
||||||
|
struct timeval
|
||||||
|
now;
|
||||||
|
struct timezone
|
||||||
|
tz;
|
||||||
|
struct Project
|
||||||
|
*current = NULL,
|
||||||
|
*first = NULL;
|
||||||
|
time_t
|
||||||
|
sess_time = 0;
|
||||||
|
int
|
||||||
|
path_len = 0,
|
||||||
|
do_exit = 0;
|
||||||
|
|
||||||
|
static void handler(int signo)
|
||||||
|
{
|
||||||
|
do_exit = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void at_exit(void)
|
||||||
|
{
|
||||||
|
write_log();
|
||||||
|
write_record();
|
||||||
|
if (unlink(lockname) < 0) {
|
||||||
|
fprintf(stderr, "%s: cannot unlink '%s'\n", PACKAGE_NAME, lockname);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int n,
|
||||||
|
show_days = 0,
|
||||||
|
but_stat = 0,
|
||||||
|
microtm = 0,
|
||||||
|
running = 0,
|
||||||
|
force = 0;
|
||||||
|
time_t
|
||||||
|
last_time = 0;
|
||||||
|
char
|
||||||
|
*geometry = NULL,
|
||||||
|
*xdisplay = NULL;
|
||||||
|
static int signals[] =
|
||||||
|
{SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2, 0};
|
||||||
|
XEvent Event;
|
||||||
|
|
||||||
|
assert(sizeof(char) == 1);
|
||||||
|
|
||||||
|
umask(077);
|
||||||
|
do_opts(argc, argv, &show_days, &xdisplay, &geometry, &force);
|
||||||
|
|
||||||
|
path_len = strlen(getenv("HOME")) + strlen("/.wmwork/worklog") + 1;
|
||||||
|
if ((dirName = malloc(path_len)) == NULL || (logname = malloc(path_len)) == NULL || (lockname = malloc(path_len)) == NULL) {
|
||||||
|
fprintf(stderr, "%s: cannot allocate memory for path variable\n", PACKAGE_NAME);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
snprintf(dirName, path_len, "%s/.wmwork", getenv("HOME"));
|
||||||
|
snprintf(logname, path_len, "%s/worklog", dirName);
|
||||||
|
snprintf(lockname, path_len, "%s/.#LOCK", dirName);
|
||||||
|
if (chdir(dirName) < 0) {
|
||||||
|
if (errno == ENOENT) {
|
||||||
|
if (mkdir(dirName, 0777)) {
|
||||||
|
fprintf(stderr, "%s: cannot mkdir '%s'\n", PACKAGE_NAME, dirName);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
compat();
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s: cannot chdir into '%s'\n", PACKAGE_NAME, dirName);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (n = 0; signals[n]; n++) {
|
||||||
|
if (signal(signals[n], handler) == SIG_ERR) {
|
||||||
|
fprintf(stderr, "%s: cannot set handler for signal %d\n", PACKAGE_NAME, signals[n]);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
make_lock(force);
|
||||||
|
atexit(at_exit);
|
||||||
|
read_log();
|
||||||
|
current = first;
|
||||||
|
|
||||||
|
initXwindow(xdisplay);
|
||||||
|
createXBMfromXPM(wmwork_mask_bits, wmwork_master_xpm, 64, 64);
|
||||||
|
openXwindow(argc, argv, wmwork_master_xpm, wmwork_mask_bits, 64, 64, geometry, NULL);
|
||||||
|
AddMouseRegion(BUT_START, 5, 48, 22, 58);
|
||||||
|
AddMouseRegion(BUT_PAUSE, 23, 48, 40, 58);
|
||||||
|
AddMouseRegion(BUT_STOP, 41, 48, 58, 58);
|
||||||
|
AddMouseRegion(BUT_PREV, 5, 33, 16, 43);
|
||||||
|
AddMouseRegion(BUT_NEXT, 47, 33, 58, 43);
|
||||||
|
drawTime(current->time, sess_time, microtm, show_days, running);
|
||||||
|
drawProject(current->name);
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
last_time = now.tv_sec;
|
||||||
|
gettimeofday(&now, &tz);
|
||||||
|
if (running) {
|
||||||
|
current->time += now.tv_sec - last_time;
|
||||||
|
sess_time += now.tv_sec - last_time;
|
||||||
|
microtm = now.tv_usec;
|
||||||
|
drawTime(current->time, sess_time, microtm, show_days, running);
|
||||||
|
RedrawWindow();
|
||||||
|
}
|
||||||
|
while (XPending(display)) {
|
||||||
|
XNextEvent(display, &Event);
|
||||||
|
switch (Event.type) {
|
||||||
|
case Expose:
|
||||||
|
RedrawWindow();
|
||||||
|
break;
|
||||||
|
case DestroyNotify:
|
||||||
|
XCloseDisplay(display);
|
||||||
|
exit(0);
|
||||||
|
case ButtonPress:
|
||||||
|
n = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
|
||||||
|
switch (n) {
|
||||||
|
case BUT_START:
|
||||||
|
case BUT_PAUSE:
|
||||||
|
case BUT_STOP:
|
||||||
|
case BUT_PREV:
|
||||||
|
case BUT_NEXT:
|
||||||
|
ButtonDown(n);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
but_stat = n;
|
||||||
|
RedrawWindow();
|
||||||
|
break;
|
||||||
|
case ButtonRelease:
|
||||||
|
n = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
|
||||||
|
switch (but_stat) {
|
||||||
|
case BUT_START:
|
||||||
|
case BUT_PAUSE:
|
||||||
|
case BUT_STOP:
|
||||||
|
case BUT_PREV:
|
||||||
|
case BUT_NEXT:
|
||||||
|
ButtonUp(but_stat);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (but_stat && n == but_stat) {
|
||||||
|
switch (but_stat) {
|
||||||
|
case BUT_START:
|
||||||
|
running = 1;
|
||||||
|
break;
|
||||||
|
case BUT_PAUSE:
|
||||||
|
running = 0;
|
||||||
|
break;
|
||||||
|
case BUT_STOP:
|
||||||
|
write_log();
|
||||||
|
write_record();
|
||||||
|
running = 0;
|
||||||
|
sess_time = 0;
|
||||||
|
break;
|
||||||
|
case BUT_PREV:
|
||||||
|
if (!running && sess_time == 0)
|
||||||
|
current = current->prev;
|
||||||
|
break;
|
||||||
|
case BUT_NEXT:
|
||||||
|
if (!running && sess_time == 0)
|
||||||
|
current = current->next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
drawTime(current->time, sess_time, microtm, show_days, running);
|
||||||
|
drawProject(current->name);
|
||||||
|
}
|
||||||
|
RedrawWindow();
|
||||||
|
but_stat = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
usleep(50000L);
|
||||||
|
if (do_exit)
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ButtonDown(int button)
|
||||||
|
{
|
||||||
|
switch (button) {
|
||||||
|
case BUT_START:
|
||||||
|
copyXPMArea( 65, 25, 18, 11, 5, 48);
|
||||||
|
break;
|
||||||
|
case BUT_PAUSE:
|
||||||
|
copyXPMArea( 84, 25, 18, 11, 23, 48);
|
||||||
|
break;
|
||||||
|
case BUT_STOP:
|
||||||
|
copyXPMArea(103, 25, 18, 11, 41, 48);
|
||||||
|
break;
|
||||||
|
case BUT_PREV:
|
||||||
|
copyXPMArea(122, 25, 12, 11, 5, 33);
|
||||||
|
break;
|
||||||
|
case BUT_NEXT:
|
||||||
|
copyXPMArea(135, 25, 12, 11, 47, 33);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ButtonUp(int button)
|
||||||
|
{
|
||||||
|
switch (button) {
|
||||||
|
case BUT_START:
|
||||||
|
copyXPMArea( 65, 13, 18, 11, 5, 48);
|
||||||
|
break;
|
||||||
|
case BUT_PAUSE:
|
||||||
|
copyXPMArea( 84, 13, 18, 11, 23, 48);
|
||||||
|
break;
|
||||||
|
case BUT_STOP:
|
||||||
|
copyXPMArea(103, 13, 18, 11, 41, 48);
|
||||||
|
break;
|
||||||
|
case BUT_PREV:
|
||||||
|
copyXPMArea(122, 13, 12, 11, 5, 33);
|
||||||
|
break;
|
||||||
|
case BUT_NEXT:
|
||||||
|
copyXPMArea(135, 13, 12, 11, 47, 33);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ButtonEnable(int button)
|
||||||
|
{
|
||||||
|
return ButtonUp(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ButtonDisable(int button)
|
||||||
|
{
|
||||||
|
switch (button) {
|
||||||
|
case BUT_START:
|
||||||
|
copyXPMArea( 65, 1, 18, 11, 5, 48);
|
||||||
|
break;
|
||||||
|
case BUT_PAUSE:
|
||||||
|
copyXPMArea( 84, 1, 18, 11, 23, 48);
|
||||||
|
break;
|
||||||
|
case BUT_STOP:
|
||||||
|
copyXPMArea(103, 1, 18, 11, 41, 48);
|
||||||
|
break;
|
||||||
|
case BUT_PREV:
|
||||||
|
copyXPMArea(122, 1, 12, 11, 5, 33);
|
||||||
|
break;
|
||||||
|
case BUT_NEXT:
|
||||||
|
copyXPMArea(135, 1, 12, 11, 47, 33);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_opts(int argc, char *argv[], int *show_days, char **xdisplay, char **geometry, int *force)
|
||||||
|
{
|
||||||
|
static struct option long_opts[] = {
|
||||||
|
{"days", 0, NULL, 'd'},
|
||||||
|
{"force", 0, NULL, 'f'},
|
||||||
|
{"help", 0, NULL, 'h'},
|
||||||
|
{"version", 0, NULL, 'v'},
|
||||||
|
{"display", 1, NULL, 0 },
|
||||||
|
{"geometry", 1, NULL, 1 },
|
||||||
|
{NULL, 0, NULL, 0}};
|
||||||
|
int i, opt_index = 0;
|
||||||
|
|
||||||
|
#ifdef SOLARIS
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if (*argv[i] == '-') {
|
||||||
|
if (argv[i][1] == 'd')
|
||||||
|
*show_days = 1;
|
||||||
|
else if (argv[i][1] == 'f')
|
||||||
|
*force = 1;
|
||||||
|
else if (argv[i][1] == 'h') {
|
||||||
|
#else /* SOLARIS */
|
||||||
|
while (1) {
|
||||||
|
if ((i = getopt_long(argc, argv, "dfhv", long_opts, &opt_index)) == -1)
|
||||||
|
break;
|
||||||
|
switch (i) {
|
||||||
|
case 'd':
|
||||||
|
*show_days = 1;
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
*force = 1;
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
#endif /* SOLARIS */
|
||||||
|
printf("usage: %s [options]\n", argv[0]);
|
||||||
|
printf(" -d, --days display time in ddd.hh:mm instead of hhh:mm:ss,\n");
|
||||||
|
printf(" -f, --force overwrite stale lock files,\n");
|
||||||
|
printf(" -h, --help display this command line summary,\n");
|
||||||
|
printf(" -v, --version display the version number,\n");
|
||||||
|
printf(" --display=<id> open the mini window on display <id>, e.g. ':0.0',\n");
|
||||||
|
printf(" --geometry=<pos> open the mini window at position <pos>, e.g. '+10+10'.\n");
|
||||||
|
exit(0);
|
||||||
|
#ifdef SOLARIS
|
||||||
|
} else if (argv[i][1] == 'v') {
|
||||||
|
#else /* SOLARIS */
|
||||||
|
case 'v':
|
||||||
|
#endif /* SOLARIS */
|
||||||
|
printf("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
|
||||||
|
printf("copyright (c) 2002-2005 Martin A. Godisch <martin@godisch.de>\n");
|
||||||
|
exit(0);
|
||||||
|
#ifdef SOLARIS
|
||||||
|
} else if (!strcmp(argv[i], "--display"))
|
||||||
|
*xdisplay = optarg;
|
||||||
|
else if (!strcmp(argv[i], "--geometry"))
|
||||||
|
*geometry = optarg;
|
||||||
|
else break;
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i < argc) {
|
||||||
|
fprintf(stderr, "%s: invalid argument -- %s\n", PACKAGE_NAME, argv[i]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
#else /* SOLARIS */
|
||||||
|
case 0:
|
||||||
|
*xdisplay = optarg;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
*geometry = optarg;
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (optind < argc) {
|
||||||
|
fprintf(stderr, "%s: invalid argument -- %s\n", PACKAGE_NAME, argv[optind]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
#endif /* SOLARIS */
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawTime(time_t time1, time_t time2, int microtm, int show_days, const int running)
|
||||||
|
{
|
||||||
|
time_t d1 = 0, d2 = 0, h1 = 0, h2 = 0;
|
||||||
|
short m1 = 0, m2 = 0, s1 = 0, s2 = 0;
|
||||||
|
|
||||||
|
if (time1 >= 3600000 || time2 >= 3600000)
|
||||||
|
show_days = 1;
|
||||||
|
|
||||||
|
if (show_days) {
|
||||||
|
d1 = time1 / 86400;
|
||||||
|
d2 = time2 / 86400;
|
||||||
|
time1 %= 86400;
|
||||||
|
time2 %= 86400;
|
||||||
|
if (d1 >= 1000 || d2 >= 1000) {
|
||||||
|
d1 %= 1000;
|
||||||
|
d2 %= 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
h1 = time1 / 3600;
|
||||||
|
h2 = time2 / 3600;
|
||||||
|
time1 %= 3600;
|
||||||
|
time2 %= 3600;
|
||||||
|
m1 = time1 / 60;
|
||||||
|
m2 = time2 / 60;
|
||||||
|
s1 = time1 % 60;
|
||||||
|
s2 = time2 % 60;
|
||||||
|
|
||||||
|
if (show_days) {
|
||||||
|
copyXPMArea(TIMER_SRC_X(d1 / 100), TIMER_SRC_Y, 5, 7, 7, 6);
|
||||||
|
d1 %= 100;
|
||||||
|
copyXPMArea(TIMER_SRC_X(d1 / 10), TIMER_SRC_Y, 5, 7, 13, 6);
|
||||||
|
copyXPMArea(TIMER_SRC_X(d1 % 10), TIMER_SRC_Y, 5, 7, 19, 6);
|
||||||
|
copyXPMArea(TIMER_SRC_X(h1 / 10), TIMER_SRC_Y, 5, 7, 29, 6);
|
||||||
|
copyXPMArea(TIMER_SRC_X(h1 % 10), TIMER_SRC_Y, 5, 7, 35, 6);
|
||||||
|
copyXPMArea(TIMER_SRC_X(m1 / 10), TIMER_SRC_Y, 5, 7, 45, 6);
|
||||||
|
copyXPMArea(TIMER_SRC_X(m1 % 10), TIMER_SRC_Y, 5, 7, 51, 6);
|
||||||
|
|
||||||
|
copyXPMArea(TIMER_SRC_X(d2 / 100), TIMER_SRC_Y, 5, 7, 7, 20);
|
||||||
|
d2 %= 100;
|
||||||
|
copyXPMArea(TIMER_SRC_X(d2 / 10), TIMER_SRC_Y, 5, 7, 13, 20);
|
||||||
|
copyXPMArea(TIMER_SRC_X(d2 % 10), TIMER_SRC_Y, 5, 7, 19, 20);
|
||||||
|
copyXPMArea(TIMER_SRC_X(h2 / 10), TIMER_SRC_Y, 5, 7, 29, 20);
|
||||||
|
copyXPMArea(TIMER_SRC_X(h2 % 10), TIMER_SRC_Y, 5, 7, 35, 20);
|
||||||
|
copyXPMArea(TIMER_SRC_X(m2 / 10), TIMER_SRC_Y, 5, 7, 45, 20);
|
||||||
|
copyXPMArea(TIMER_SRC_X(m2 % 10), TIMER_SRC_Y, 5, 7, 51, 20);
|
||||||
|
} else {
|
||||||
|
copyXPMArea(TIMER_SRC_X(h1 / 100), TIMER_SRC_Y, 5, 7, 7, 6);
|
||||||
|
h1 %= 100;
|
||||||
|
copyXPMArea(TIMER_SRC_X(h1 / 10), TIMER_SRC_Y, 5, 7, 13, 6);
|
||||||
|
copyXPMArea(TIMER_SRC_X(h1 % 10), TIMER_SRC_Y, 5, 7, 19, 6);
|
||||||
|
copyXPMArea(TIMER_SRC_X(m1 / 10), TIMER_SRC_Y, 5, 7, 29, 6);
|
||||||
|
copyXPMArea(TIMER_SRC_X(m1 % 10), TIMER_SRC_Y, 5, 7, 35, 6);
|
||||||
|
copyXPMArea(TIMER_SRC_X(s1 / 10), TIMER_SRC_Y, 5, 7, 45, 6);
|
||||||
|
copyXPMArea(TIMER_SRC_X(s1 % 10), TIMER_SRC_Y, 5, 7, 51, 6);
|
||||||
|
|
||||||
|
copyXPMArea(TIMER_SRC_X(h2 / 100), TIMER_SRC_Y, 5, 7, 7, 20);
|
||||||
|
h2 %= 100;
|
||||||
|
copyXPMArea(TIMER_SRC_X(h2 / 10), TIMER_SRC_Y, 5, 7, 13, 20);
|
||||||
|
copyXPMArea(TIMER_SRC_X(h2 % 10), TIMER_SRC_Y, 5, 7, 19, 20);
|
||||||
|
copyXPMArea(TIMER_SRC_X(m2 / 10), TIMER_SRC_Y, 5, 7, 29, 20);
|
||||||
|
copyXPMArea(TIMER_SRC_X(m2 % 10), TIMER_SRC_Y, 5, 7, 35, 20);
|
||||||
|
copyXPMArea(TIMER_SRC_X(s2 / 10), TIMER_SRC_Y, 5, 7, 45, 20);
|
||||||
|
copyXPMArea(TIMER_SRC_X(s2 % 10), TIMER_SRC_Y, 5, 7, 51, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (microtm < 500000 || !running) {
|
||||||
|
if (show_days) {
|
||||||
|
copyXPMArea(161, CHAR_SRC_Y1 + 4, 1, 3, 26, 10);
|
||||||
|
copyXPMArea(161, CHAR_SRC_Y1 + 4, 1, 3, 26, 24);
|
||||||
|
} else {
|
||||||
|
copyXPMArea(161, CHAR_SRC_Y1, 1, 7, 26, 6);
|
||||||
|
copyXPMArea(161, CHAR_SRC_Y1, 1, 7, 26, 20);
|
||||||
|
}
|
||||||
|
copyXPMArea(161, CHAR_SRC_Y1, 1, 7, 42, 6);
|
||||||
|
copyXPMArea(161, CHAR_SRC_Y1, 1, 7, 42, 20);
|
||||||
|
} else {
|
||||||
|
if (!show_days) {
|
||||||
|
copyXPMArea(163, CHAR_SRC_Y1, 1, 7, 26, 6);
|
||||||
|
copyXPMArea(163, CHAR_SRC_Y1, 1, 7, 26, 20);
|
||||||
|
}
|
||||||
|
copyXPMArea(163, CHAR_SRC_Y1, 1, 7, 42, 6);
|
||||||
|
copyXPMArea(163, CHAR_SRC_Y1, 1, 7, 42, 20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawProject(const char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
copyXPMArea(CHAR_SRC_X2(' '), CHAR_SRC_Y2, 5, 7, 23 + i * 6, 35);
|
||||||
|
if (i >= strlen(name))
|
||||||
|
continue;
|
||||||
|
if (name[i] >= 'A' && name[i] <= '`')
|
||||||
|
copyXPMArea(CHAR_SRC_X1(name[i]), CHAR_SRC_Y1, 5, 7, 23 + i * 6, 35);
|
||||||
|
else if (name[i] >= ' ' && name[i] <= '@')
|
||||||
|
copyXPMArea(CHAR_SRC_X2(name[i]), CHAR_SRC_Y2, 5, 7, 23 + i * 6, 35);
|
||||||
|
else if (name[i] >= '{' && name[i] <= '~')
|
||||||
|
copyXPMArea(CHAR_SRC_X3(name[i]), CHAR_SRC_Y3, 5, 7, 23 + i * 6, 35);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int read_log(void)
|
||||||
|
{
|
||||||
|
struct Project
|
||||||
|
*p = NULL;
|
||||||
|
FILE
|
||||||
|
*F = NULL;
|
||||||
|
char
|
||||||
|
buffer[512],
|
||||||
|
*colon = NULL,
|
||||||
|
*s = NULL;
|
||||||
|
int i, line, n = 0;
|
||||||
|
|
||||||
|
if ((first = malloc(sizeof(struct Project))) == NULL) {
|
||||||
|
fprintf(stderr, "%s: cannot allocate memory for element %d\n", PACKAGE_NAME, n);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
strcpy(first->name, "---");
|
||||||
|
first->time = 0;
|
||||||
|
first->prev = first;
|
||||||
|
first->next = first;
|
||||||
|
|
||||||
|
if ((F = fopen(logname, "r")) == NULL) {
|
||||||
|
if (errno != ENOENT) {
|
||||||
|
fprintf(stderr, "%s: cannot open '%s' for reading\n", PACKAGE_NAME, logname);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (line = 1;; line++) {
|
||||||
|
fgets(buffer, sizeof(buffer), F);
|
||||||
|
if (feof(F))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (n == 0) {
|
||||||
|
p = first;
|
||||||
|
} else if ((p = malloc(sizeof(struct Project))) == NULL) {
|
||||||
|
fprintf(stderr, "%s: cannot allocate memory for element %d\n", PACKAGE_NAME, n);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
return(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((s = index(buffer, '\n')) != NULL)
|
||||||
|
*s = '\0';
|
||||||
|
if (buffer[0] == '#' || buffer[0] == '\0') {
|
||||||
|
if (n)
|
||||||
|
free(p);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((colon = index(buffer, ':')) == NULL) {
|
||||||
|
fprintf(stderr, "%s: missing ':' in '%s' line %d\n", PACKAGE_NAME, logname, line);
|
||||||
|
if (n)
|
||||||
|
free(p);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
i = colon - buffer < 3 ? colon - buffer : 3;
|
||||||
|
p->name[i] = '\0';
|
||||||
|
for (i--; i >= 0; i--) {
|
||||||
|
p->name[i] = toupper(buffer[i]);
|
||||||
|
if (p->name[i] == '/') {
|
||||||
|
fprintf(stderr, "%s: '/' is fs delimiter in '%s' line %d\n", PACKAGE_NAME, logname, line);
|
||||||
|
fprintf(stderr, "%s: converting forbidden '/' in project id into '|'\n", PACKAGE_NAME);
|
||||||
|
p->name[i] = '|';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p->time = strtol(++colon, &s, 10);
|
||||||
|
if (*s && *s != ':' && *s != ' ') {
|
||||||
|
fprintf(stderr, "%s: error converting timestamp '%s' in '%s' line %d\n", PACKAGE_NAME, colon, logname, line);
|
||||||
|
if (n)
|
||||||
|
free(p);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (*s++ == ':') {
|
||||||
|
if ((p->comment = strdup(s)) == NULL) {
|
||||||
|
fprintf(stderr, "%s: ignored error while aquiring memory for comment string '%s' in '%s' line %d\n", PACKAGE_NAME, s, logname, line);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
p->comment = NULL;
|
||||||
|
|
||||||
|
p->prev = first->prev;
|
||||||
|
p->next = first;
|
||||||
|
p->prev->next = p;
|
||||||
|
p->next->prev = p;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(F);
|
||||||
|
return(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
int write_log(void)
|
||||||
|
{
|
||||||
|
struct Project
|
||||||
|
*p = NULL;
|
||||||
|
FILE
|
||||||
|
*F = NULL;
|
||||||
|
|
||||||
|
if ((F = fopen(logname, "w")) == NULL) {
|
||||||
|
fprintf(stderr, "%s: cannot open '%s' for writing\n", PACKAGE_NAME, logname);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
F = stderr;
|
||||||
|
} else {
|
||||||
|
fprintf(F, "# wmwork configuration file\n");
|
||||||
|
fprintf(F, "# do not edit while wmwork is running\n\n");
|
||||||
|
}
|
||||||
|
p = first;
|
||||||
|
do {
|
||||||
|
if (F == stderr)
|
||||||
|
fprintf(F, "%s: > %s:%li:%s\n", PACKAGE_NAME, p->name, p->time, p->comment ? p->comment : "");
|
||||||
|
else
|
||||||
|
fprintf(F, "%s:%li:%s\n", p->name, p->time, p->comment ? p->comment : "");
|
||||||
|
p = p->next;
|
||||||
|
} while (p != first);
|
||||||
|
|
||||||
|
if (F == stderr)
|
||||||
|
return 0;
|
||||||
|
fclose(F);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int write_record(void)
|
||||||
|
{
|
||||||
|
char
|
||||||
|
*fname = NULL,
|
||||||
|
tbuff[64],
|
||||||
|
rbuff[64];
|
||||||
|
FILE
|
||||||
|
*F = NULL;
|
||||||
|
|
||||||
|
if (sess_time == 0)
|
||||||
|
return 1;
|
||||||
|
strftime(tbuff, sizeof(tbuff), "%a, %d %b %Y %H:%M:%S %z", localtime(&now.tv_sec));
|
||||||
|
snprintf(rbuff, sizeof(rbuff), "%s %03li:%02li:%02li", tbuff, sess_time / 3600, sess_time / 60 % 60, sess_time % 60);
|
||||||
|
|
||||||
|
if ((fname = malloc(path_len)) == NULL) {
|
||||||
|
fprintf(stderr, "%s: cannot allocate memory for path variable\n", PACKAGE_NAME);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
fprintf(stderr, "%s: > %s\n", PACKAGE_NAME, rbuff);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
snprintf(fname, path_len, "%s/.wmwork/%s", getenv("HOME"), current->name);
|
||||||
|
if ((F = fopen(fname, "a")) == NULL) {
|
||||||
|
fprintf(stderr, "%s: cannot open '%s' for writing\n", PACKAGE_NAME, fname);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
fprintf(stderr, "%s: > %s\n", PACKAGE_NAME, rbuff);
|
||||||
|
free(fname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
fprintf(F, "%s\n", rbuff);
|
||||||
|
fclose(F);
|
||||||
|
free(fname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int make_lock(int force)
|
||||||
|
{
|
||||||
|
FILE
|
||||||
|
*F = NULL;
|
||||||
|
pid_t
|
||||||
|
pid = 0;
|
||||||
|
int
|
||||||
|
fd = 0,
|
||||||
|
i = 0;
|
||||||
|
char
|
||||||
|
*c = NULL,
|
||||||
|
proc[32],
|
||||||
|
buffer[256];
|
||||||
|
|
||||||
|
if ((fd = open(lockname, O_WRONLY | O_CREAT | (force ? 0 : O_EXCL), 0666)) < 0) {
|
||||||
|
if (errno == EEXIST) {
|
||||||
|
if ((F = fopen(lockname, "r")) != NULL) {
|
||||||
|
i = fscanf(F, PID_T, &pid);
|
||||||
|
fclose(F);
|
||||||
|
snprintf(proc, sizeof(proc), "/proc/"PID_T"/exe", pid);
|
||||||
|
if (i == 1 && ((i = readlink(proc, buffer, sizeof(buffer)-1)) >= 0 || errno == ENOENT)) {
|
||||||
|
buffer[i] = 0;
|
||||||
|
if (i < 0 || ((c = rindex(buffer, '/')) != NULL && strcmp(c+1, "wmwork") != 0)) {
|
||||||
|
fprintf(stderr, "%s: found stale lock file (pid "PID_T")\n", PACKAGE_NAME, pid);
|
||||||
|
return make_lock(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(stderr, "%s: already running, --force will overwrite the lock file\n", PACKAGE_NAME);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
fprintf(stderr, "%s: cannot create '%s'\n", PACKAGE_NAME, lockname);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ((F = fdopen(fd, "w")) != NULL) {
|
||||||
|
fprintf(F, PID_T"\n", getpid());
|
||||||
|
fclose(F);
|
||||||
|
} else
|
||||||
|
close(fd);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int compat(void)
|
||||||
|
{
|
||||||
|
char
|
||||||
|
*temp1 = NULL,
|
||||||
|
*temp2 = NULL;
|
||||||
|
DIR *dir = NULL;
|
||||||
|
struct dirent
|
||||||
|
*entry = NULL;
|
||||||
|
|
||||||
|
/* BEGIN compatibility section for wmwork < 0.2.0 */
|
||||||
|
|
||||||
|
if ((temp1 = malloc(path_len)) == NULL || (temp2 = malloc(path_len)) == NULL) {
|
||||||
|
fprintf(stderr, "%s: cannot allocate memory for path variable\n", PACKAGE_NAME);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(temp1, path_len, "%s/.wmworklog", getenv("HOME"));
|
||||||
|
if (rename(temp1, logname) < 0) {
|
||||||
|
if (errno == ENOENT)
|
||||||
|
return 0;
|
||||||
|
fprintf(stderr, "%s: cannot rename '%s' to '%s'\n", PACKAGE_NAME, temp1, logname);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
} else
|
||||||
|
fprintf(stderr, "%s: moving '%s' -> '%s'\n", PACKAGE_NAME, temp1, logname);
|
||||||
|
|
||||||
|
if ((dir = opendir(getenv("HOME"))) < 0) {
|
||||||
|
fprintf(stderr, "%s: cannot read '%s'\n", PACKAGE_NAME, getenv("HOME"));
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
while ((entry = readdir(dir))) {
|
||||||
|
if (strstr(entry->d_name, ".wmwork.") == entry->d_name &&
|
||||||
|
strlen(entry->d_name) > 8 && strlen(entry->d_name) <= 11) {
|
||||||
|
snprintf(temp1, path_len, "%s/%s", getenv("HOME"), entry->d_name);
|
||||||
|
snprintf(temp2, path_len, "%s/%s", dirName, entry->d_name + 8);
|
||||||
|
if (rename(temp1, temp2) < 0) {
|
||||||
|
fprintf(stderr, "%s: cannot rename '%s' to '%s'\n", PACKAGE_NAME, temp1, temp2);
|
||||||
|
fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
|
||||||
|
} else
|
||||||
|
fprintf(stderr, "%s: moving '%s' to '%s'\n", PACKAGE_NAME, temp1, temp2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* END compatibility section for wmwork < 0.2.0 */
|
||||||
|
}
|
36
wmwork/src/wmwork.h
Normal file
36
wmwork/src/wmwork.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/* $Id: wmwork.h,v 1.15 2005/02/14 19:14:58 godisch Exp $
|
||||||
|
* vim: set noet ts=4:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2005 Martin A. Godisch <martin@godisch.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _WMWORK_H
|
||||||
|
#define _WMWORK_H
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
struct Project {
|
||||||
|
char name[4];
|
||||||
|
time_t time;
|
||||||
|
char *comment;
|
||||||
|
struct Project *prev, *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
void ButtonDown(int);
|
||||||
|
void ButtonUp(int);
|
||||||
|
void ButtonEnable(int);
|
||||||
|
void ButtonDisable(int);
|
||||||
|
|
||||||
|
void do_opts(int, char**, int*, char**, char**, int*);
|
||||||
|
int compat(void);
|
||||||
|
|
||||||
|
void drawTime(time_t, time_t, int, int, int);
|
||||||
|
void drawProject(const char*);
|
||||||
|
|
||||||
|
int read_log(void);
|
||||||
|
int write_log(void);
|
||||||
|
int write_record(void);
|
||||||
|
|
||||||
|
int make_lock(int);
|
||||||
|
|
||||||
|
#endif
|
101
wmwork/src/wmwork.xpm
Normal file
101
wmwork/src/wmwork.xpm
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
/* XPM
|
||||||
|
* $Id: wmwork.xpm,v 1.10 2003/01/02 20:01:13 godisch Exp $
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2003 Martin A. Godisch <martin@godisch.de>
|
||||||
|
*/
|
||||||
|
static char *wmwork_master_xpm[] = {
|
||||||
|
"165 78 16 1",
|
||||||
|
" c #00000000FFFF",
|
||||||
|
". c #000000000000",
|
||||||
|
"X c #208120812081",
|
||||||
|
"o c #C71BC30BC71B",
|
||||||
|
"O c #000049244103",
|
||||||
|
"+ c #28A23CF338E3",
|
||||||
|
"@ c #F7DEF3CEFFFF",
|
||||||
|
"# c #861782078E38",
|
||||||
|
"$ c #AEBAAAAAAEBA",
|
||||||
|
"% c #2081B2CAAEBA",
|
||||||
|
"& c #18618A288617",
|
||||||
|
"* c #B6DA04101861",
|
||||||
|
"= c #0000EBAD0000",
|
||||||
|
"- c #E79DC30B0820",
|
||||||
|
"; c #71C6E38D71C6",
|
||||||
|
": c #4924C30B4924",
|
||||||
|
" ",
|
||||||
|
" @@@@@@@@@@@@@@@@@# @@@@@@@@@@@@@@@@@# @@@@@@@@@@@@@@@@@# @@@@@@@@@@@# @@@@@@@@@@@# ",
|
||||||
|
" @$$$$$$$$$$$$$$$$. @$$$$$$$$$$$$$$$$. @$$$$$$$$$$$$$$$$. @$$$$$$$$$$. @$$$$$$$$$$. ",
|
||||||
|
" @$$$$$$$$$..$$$$$. @$$$$$..$..$$$$$$. @$$$$..$$$..$$$$$. @$$$$$...$$. @$$...$$$$$. ",
|
||||||
|
" ........................................................ @$$$$$$$$...$$$$$. @$$$$$..$..$$$$$$. @$$$$...$...$$$$$. @$$$$...$$$. @$$$...$$$$. ",
|
||||||
|
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo @$$$$..$...$$$$$$. @$$$$$..$..$$$$$$. @$$$$$.....$$$$$$. @$$$...$$$$. @$$$$...$$$. ",
|
||||||
|
" .XXXOOOXXXOOOXXXOOOXXXXXXXOOOXXXOOOXXXXXXXOOOXXXOOOXXXXo @$$$$.....$$$$$$$. @$$$$$..$..$$$$$$. @$$$$$$...$$$$$$$. @$$...$$$$$. @$$$$$...$$. ",
|
||||||
|
" .XXOXXXOXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXXo @$$$$....$$$$$$$$. @$$$$$..$..$$$$$$. @$$$$$.....$$$$$$. @$$$...$$$$. @$$$$...$$$. ",
|
||||||
|
" .XXOXXXOXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXXo @$$$$...$$$$$$$$$. @$$$$$..$..$$$$$$. @$$$$...$...$$$$$. @$$$$...$$$. @$$$...$$$$. ",
|
||||||
|
" .XXXOOOXXXOOOXXXOOOXXXXXXXOOOXXXOOOXXXXXXXOOOXXXOOOXXXXo @$$$$..$$$$$$$$$$. @$$$$$..$..$$$$$$. @$$$$..$$$..$$$$$. @$$$$$...$$. @$$...$$$$$. ",
|
||||||
|
" .XXOXXXOXOXXXOXOXXXOXXXXXOXXXOXOXXXOXXXXXOXXXOXOXXXOXXXo @$$$$$$$$$$$$$$$$. @$$$$$$$$$$$$$$$$. @$$$$$$$$$$$$$$$$. @$$$$$$$$$$. @$$$$$$$$$$. ",
|
||||||
|
" .XXOXXXOXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXXo #................. #................. #................. #........... #........... ",
|
||||||
|
" .XXXOOOXXXOOOXXXOOOXXXOXXXOOOXXXOOOXXXOXXXOOOXXXOOOXXXXo ",
|
||||||
|
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo @@@@@@@@@@@@@@@@@# @@@@@@@@@@@@@@@@@# @@@@@@@@@@@@@@@@@# @@@@@@@@@@@# @@@@@@@@@@@# ",
|
||||||
|
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo @$$$$$$$$$$$$$$$$. @$$$$$$$$$$$$$$$$. @$$$$$$$$$$$$$$$$. @$$$$$$$$$$. @$$$$$$$$$$. ",
|
||||||
|
" oooooooooooooooooooooooooooooooooooooooooooooooooooooooo @$$$$$$$$$..$$$$$. @$$$$$..$..$$$$$$. @$$$$..$$$..$$$$$. @$$$$$...$$. @$$...$$$$$. ",
|
||||||
|
" @$$$$$$$$...$$$$$. @$$$$$..$..$$$$$$. @$$$$...$...$$$$$. @$$$$...$$$. @$$$...$$$$. ",
|
||||||
|
" @$$$$..$...$$$$$$. @$$$$$..$..$$$$$$. @$$$$$.....$$$$$$. @$$$...$$$$. @$$$$...$$$. ",
|
||||||
|
" ........................................................ @$$$$.....$$$$$$$. @$$$$$..$..$$$$$$. @$$$$$$...$$$$$$$. @$$...$$$$$. @$$$$$...$$. ",
|
||||||
|
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo @$$$$....$$$$$$$$. @$$$$$..$..$$$$$$. @$$$$$.....$$$$$$. @$$$...$$$$. @$$$$...$$$. ",
|
||||||
|
" .XXXOOOXXXOOOXXXOOOXXXXXXXOOOXXXOOOXXXXXXXOOOXXXOOOXXXXo @$$$$...$$$$$$$$$. @$$$$$..$..$$$$$$. @$$$$...$...$$$$$. @$$$$...$$$. @$$$...$$$$. ",
|
||||||
|
" .XXOXXXOXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXXo @$$$$..$$$$$$$$$$. @$$$$$..$..$$$$$$. @$$$$..$$$..$$$$$. @$$$$$...$$. @$$...$$$$$. ",
|
||||||
|
" .XXOXXXOXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXXo @$$$$$$$$$$$$$$$$. @$$$$$$$$$$$$$$$$. @$$$$$$$$$$$$$$$$. @$$$$$$$$$$. @$$$$$$$$$$. ",
|
||||||
|
" .XXXOOOXXXOOOXXXOOOXXXXXXXOOOXXXOOOXXXXXXXOOOXXXOOOXXXXo #................. #................. #................. #........... #........... ",
|
||||||
|
" .XXOXXXOXOXXXOXOXXXOXXXXXOXXXOXOXXXOXXXXXOXXXOXOXXXOXXXo ",
|
||||||
|
" .XXOXXXOXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXOXXOXXXOXOXXXOXXXo .................# .................# .................# ...........# ...........# ",
|
||||||
|
" .XXXOOOXXXOOOXXXOOOXXXOXXXOOOXXXOOOXXXOXXXOOOXXXOOOXXXXo .$$$$$$$$$$$$$$$$@ .$$$$$$$$$$$$$$$$@ .$$$$$$$$$$$$$$$$@ .$$$$$$$$$$@ .$$$$$$$$$$@ ",
|
||||||
|
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo .$$$$$$$$$..$$$$$@ .$$$$$..$..$$$$$$@ .$$$$..$$$..$$$$$@ .$$$$$...$$@ .$$...$$$$$@ ",
|
||||||
|
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo .$$$$$$$$...$$$$$@ .$$$$$..$..$$$$$$@ .$$$$...$...$$$$$@ .$$$$...$$$@ .$$$...$$$$@ ",
|
||||||
|
" oooooooooooooooooooooooooooooooooooooooooooooooooooooooo .$$$$..$...$$$$$$@ .$$$$$..$..$$$$$$@ .$$$$$.....$$$$$$@ .$$$...$$$$@ .$$$$...$$$@ ",
|
||||||
|
" .$$$$.....$$$$$$$@ .$$$$$..$..$$$$$$@ .$$$$$$...$$$$$$$@ .$$...$$$$$@ .$$$$$...$$@ ",
|
||||||
|
" .$$$$....$$$$$$$$@ .$$$$$..$..$$$$$$@ .$$$$$.....$$$$$$@ .$$$...$$$$@ .$$$$...$$$@ ",
|
||||||
|
" .............. ........................ .............. .$$$$...$$$$$$$$$@ .$$$$$..$..$$$$$$@ .$$$$...$...$$$$$@ .$$$$...$$$@ .$$$...$$$$@ ",
|
||||||
|
" .@@@@@@@@@@@#o .XXXXXXXXXXXXXXXXXXXXXXo .@@@@@@@@@@@#o .$$$$..$$$$$$$$$$@ .$$$$$..$..$$$$$$@ .$$$$..$$$..$$$$$@ .$$$$$...$$@ .$$...$$$$$@ ",
|
||||||
|
" .@$$$$$$$$$$.o .XXXXXXXXXXXXXXXXXXXXXXo .@$$$$$$$$$$.o .$$$$$$$$$$$$$$$$@ .$$$$$..$..$$$$$$@ .$$$$$$$$$$$$$$$$@ .$$$$$$$$$$@ .$$$$$$$$$$@ ",
|
||||||
|
" .@$$$$$...$$.o .XXXOOOXXXOOOXXXOOOXXXXo .@$$...$$$$$.o #@@@@@@@@@@@@@@@@@ #@@@@@@@@@@@@@@@@@ #@@@@@@@@@@@@@@@@@ #@@@@@@@@@@@ #@@@@@@@@@@@ ",
|
||||||
|
" .@$$$$...$$$.o .XXOXXXOXOXXXOXOXXXOXXXo .@$$$...$$$$.o ",
|
||||||
|
" .@$$$...$$$$.o .XXOXXXOXOXXXOXOXXXOXXXo .@$$$$...$$$.o ",
|
||||||
|
" .@$$...$$$$$.o .XXXOOOXXXOOOXXXOOOXXXXo .@$$$$$...$$.o ",
|
||||||
|
" .@$$$...$$$$.o .XXOXXXOXOXXXOXOXXXOXXXo .@$$$$...$$$.o ",
|
||||||
|
" .@$$$$...$$$.o .XXOXXXOXOXXXOXOXXXOXXXo .@$$$...$$$$.o ",
|
||||||
|
" .@$$$$$...$$.o .XXXOOOXXXOOOXXXOOOXXXXo .@$$...$$$$$.o ",
|
||||||
|
" .@$$$$$$$$$$.o .XXXXXXXXXXXXXXXXXXXXXXo .@$$$$$$$$$$.o ",
|
||||||
|
" .#...........o .XXXXXXXXXXXXXXXXXXXXXXo .#...........o ",
|
||||||
|
" oooooooooooooo oooooooooooooooooooooooo oooooooooooooo ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ........................................................ ",
|
||||||
|
" .@@@@@@@@@@@@@@@@@#@@@@@@@@@@@@@@@@@#@@@@@@@@@@@@@@@@@#o ",
|
||||||
|
" .@$$$$$$$$$$$$$$$$.@$$$$$$$$$$$$$$$$.@$$$$$$$$$$$$$$$$.o ",
|
||||||
|
" .@$$$$$$$$$..$$$$$.@$$$$$..$..$$$$$$.@$$$$..$$$..$$$$$.o ",
|
||||||
|
" .@$$$$$$$$...$$$$$.@$$$$$..$..$$$$$$.@$$$$...$...$$$$$.o ",
|
||||||
|
" .@$$$$..$...$$$$$$.@$$$$$..$..$$$$$$.@$$$$$.....$$$$$$.o ",
|
||||||
|
" .@$$$$.....$$$$$$$.@$$$$$..$..$$$$$$.@$$$$$$...$$$$$$$.o ",
|
||||||
|
" .@$$$$....$$$$$$$$.@$$$$$..$..$$$$$$.@$$$$$.....$$$$$$.o ",
|
||||||
|
" .@$$$$...$$$$$$$$$.@$$$$$..$..$$$$$$.@$$$$...$...$$$$$.o ",
|
||||||
|
" .@$$$$..$$$$$$$$$$.@$$$$$..$..$$$$$$.@$$$$..$$$..$$$$$.o ",
|
||||||
|
" .@$$$$$$$$$$$$$$$$.@$$$$$$$$$$$$$$$$.@$$$$$$$$$$$$$$$$.o X%%&XXO&OXX&%%XX%%O%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
" .#.................#.................#.................o %XXXOOX%XOOXXX%%X&%OXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
" oooooooooooooooooooooooooooooooooooooooooooooooooooooooo O%XXOOX%XOOXX%OOXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
" &%%OXXO&OXXO%%%XOOOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
" O%XXOOX%XOOXX%OOXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
" %XXXOOX%XOOXXX%OXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
" X%%&XXO&OXX&%%XXOOOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
"XOOOXXO&OXX%O%XX&O&XX%&%X%%OO%X%%%XXOO%XX%%OXXO%%XXOOOXXOOOXXOOOXXOOOXXOOOXXOOO%X%%%XXOOO&&%%%&&%%%&&OOO&&%%%&&%%%&&%%%&&%%%&&%%%&XOOOXXOOOXXOO%XXOOOXX%OOXX%%%XX%%%X",
|
||||||
|
"OXXXOOX%XOO%X%OO%X%O%X%X&%%X%O%XXX%OXX%O%XXXOOXXX%%XXX%OX&XOOXXXOOXXXOOXXXOOXX%O%XXX%OXXX%OXXX%OXXX%%XXX%%XXXO%XXXOOXXX%%XXX%%XXX%OX%XOOX%XOOX%XOOXXXOOX%XO%XXX%%XXX%",
|
||||||
|
"OXXXOOX%XOOXXXO&%%%&%X%XOOXX%O%XXX%OX%XO%XXXOOXXX%O%X%OOX%XOOXXXOOXXXOOXXXOOXX%O%XXX%OXXX%OXXX%OXXX%%XXX%%XXXO%XXXOOXXX%%XXX%%XXX%OX&XOOX&XOO%XXO&%%%&OXX%OOXXX%%X%%%",
|
||||||
|
"XOOOXXO&OXXOOOXX&O&XX%&%XXO%OXX%%OXXOOOX&OOOXXOOO&&%%%&&%%%&XOOOX&%%%&XOOOXXO%OX&OOO&XOOO&&%%%&X%%%&&%%%&&%%%&&%%%&XOOO&&%%%&&%%%&XOOOXXOOOX%OOOXXOOOXXOOO%XOO%X&O&O&",
|
||||||
|
"OXXXOOX%XOOXXXO&%%%&OX%X%O%XXO%XX%%OXXXO%XXXOOXXX%O%X%OOX%XOOX%XOOXXXOOXXXOO%XXO%XXX%OXXX%%XXXOOXXX%OXXX%OXXX%%XXX%OXXX%%XXX%OXXX%OX%XOOX%XOO%XXO&%%%&OXX%OOX%XO%X%%%",
|
||||||
|
"OXXXOOXXXOOXXXOO%X%O&X%X%O%X%%%XX%OOXXXO%XXXOOXXX%%XXX%OX&XOOX%XOOXXXOO%%XOO%XXO%XXX%OXXX%%XXXOOXXX%OXXX%OXXX%%XXX%OXXX%%XXX%OXXX%OX&XOOX%XOOX%XOOXXXOOX%XOOXXXO%XXXO",
|
||||||
|
"XOOOXXO%OXXOOOXX&O&XX%&%X%OO%%X%%O%XOOOXX%%OXXO%%XXOOOXXOOOXX%OOXXOOOXX%%OX%OOOXX%%%XXOOO&&%%%&&%%%&XOOO&&%%%&&%%%&XOOO&&%%%&&%%%&XOOOXX%OOXXOO%XXOOOXX%OOXXO%OXX%%%X",
|
||||||
|
"X%%%X&%%%XX%%%X&%%%X&%%%&&%%%&X%%%X&OOO&X%&%X&%%%&&OOO&&OOOX&XXX&&OOO&X%%%X&%%%XX%%%X&%%%XX%%%X&%%%&&OOO&&OOO&&OOO&&OOO&&OOO&&%%%&&%%OX%OOOXXO%%&XO%OXXOOOXXO%OXXXXXX",
|
||||||
|
"%XXX%%XXX%%XXX&%XXX%%XXXX%XXXO%XXX&%XXX%OX%XOOXXX%%XXX%%XXXO%%X%%%XXX%%XXX%%XXX%%XXX%%XXX%%XXX&OX%XO%XXX%%XXX%%XXX%%XXX%%XXX%OXXX%%XXXOO%XXOOXXX%O%X%OOXXXOOXX%OX%XOX",
|
||||||
|
"%XXX%%XXX%%XXXO%XXX%%XXXX%XXXO%XXXO%XXX%OX%XOOXXX%%XX%O%XXXO%X%X%%%XX%%XXX%%XXX%%XXX%%XXX%%XXXOOX%XO%XXX%%XXX%%XXX%O%X%O%XXX%OXX%O%XXXOO%XXOOXXX%%XXX%OXXXOOXXX%X&XOX",
|
||||||
|
"&%%%&&%%%X&OOOX&OOO&&%%%&&%%%&&O%%X&%%%&XX&XXXOOO&&%%OX&OOOX&O%O&&O%O&&OOO&&%%%X&OOO&&%%%XX%%%XXO&OX&OOO&&OOO&&OOO&XO%OXX%%%XXO%OX&OOOXXO%OXXOOO&XOOOXXOOOXXOOOXXXXXX",
|
||||||
|
"%XXX%%XXX%%XXXO%XXX%%XXXX%XXXO%XXX%%XXX%OX%XOOXXX%%XX%O%XXXO%XXX%%XX%%%XXX%%XXXO%X%X%%XX%OOXXX%OX%XO%XXX%O%X%O%X%X%O%X%OOXXX%O%XXO%XXXOOXX%OOXXX%OXXXOOXXXOOXXXOXXXXX",
|
||||||
|
"%XXX%%XXX%%XXX&%XXX%%XXXX%XXXO%XXX%%XXX%OX%XO%XXX%%XXX%%XXXO%XXX%%XXX%%XXX%%XXXO%XX%%%XXX%&XXX%OX%XO%XXX%O%X%O%X%X%%XXX%&XXX%%XXXO%XXXOOXX%OOXXX%OXXXOOXXXOOXXXOX%XOX",
|
||||||
|
"&OOO&&%%%XX%%%X&%%%X&%%%&&OOOXX%%%X&OOO&X%&%XX%%%X&OOO&&%%%&&OOO&&OOO&X%%%X&OOOXX%%%&&OOO&X%%%XXO&OXX%%%XXO%OXX%O%X&OOO&X%%%X&%%%&&%%OXXOOO%XO%%&XOOOX&%%%&XOOOXX&XOX"};
|
Loading…
Reference in a new issue