From: Jaakko Heinonen Date: Mon, 12 Mar 2001 10:12:51 +0000 (+0000) Subject: Initial revision X-Git-Tag: upstream/0.6.1~2^2~402 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=0d3c17d9ab127e5596c8fb97d65122b3b90f6b11;p=pkg%2Fabook.git Initial revision --- 0d3c17d9ab127e5596c8fb97d65122b3b90f6b11 diff --git a/ANNOUNCE b/ANNOUNCE new file mode 100644 index 0000000..0bb5a73 --- /dev/null +++ b/ANNOUNCE @@ -0,0 +1,7 @@ +abook v 0.4 + +Abook is small and powerful addressbook program designed to use with mutt mail +client. Abook runs on Linux / FreeBSD and propably with small changes on other +unices. Ncurses library is required to compile abook. + +Abook is available at http://abook.sourceforge.net/ diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..8111da0 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,17 @@ +abook AUTHORS +------------- + +Jaakko Heinonen + +Alan Ford + - Debian package + - manual pages + - GnomeCard, csv, text, elm export filters + - etc. + +Josua Groeger + - spruce export filter + - text export filter update + +Matt Kraai + - patches diff --git a/BUGS b/BUGS new file mode 100644 index 0000000..57d4df3 --- /dev/null +++ b/BUGS @@ -0,0 +1,12 @@ +known bugs in abook + +* in X terminals keyboard may not behave as expected - this is propably + a ncurses problem +* incompatible with some terminals +* --datafile option is a bit broken + +* mutt / elm / pine export filters allows to create a file with dublicate + aliases + +* mutt alias import filter is quite poor. It only handles correctly aliases + formatted like this: alias myalias Firstname Familyname diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..eeb586b --- /dev/null +++ b/COPYING @@ -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. + + + Copyright (C) 19yy + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) 19yy 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. + + , 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. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..f94c8d6 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,160 @@ +0.4.12 + - added man page for abookrc (Alan Ford) + - notes are returned as optional data in mutt queries + - created a workaround for a mutt query bug + - new "extra_alternative" config option (Alan) + - added undo feature to editor + - FAQ + - macro updates + - fixed the cancel key behavior in editor + +0.4.11 + - new configuration file format + - new sorting routines + - minor mutt query patch (Matt) + - html filter update + - added mail2abook.py script to improve the mutt integration + - memory allocation changes + - contrib update + +0.4.10 + - mutt alias import filter + - --datafile option should work better now + - merged HPUX patch (submitted by Matt Kraai) + - added field for nickname/alias + - bugfixes + +0.4.9 + - increased the maximum length of an e-mail address + - added Spruce and ldif export filters + - text filter update + - added support for systemwide configuration file (/etc/abook.conf) + - list.c cleanup + - minor fixes + +0.4.8 + - new enter_string function (scrollable input) + - fileselector + - new fields for phone numbers + - extra field support + - added open database command and --datafile option + +0.4.7 + - fixed terminal resizing bug + - new man page + - fixed "roll emails" bug + - merged Alan's urlview patch + - fixed some compile warnings on some systems + +0.4.6 + - new proper ldif import filter + - printing + - GnomeCard export filter + - improved ui + - csv export filter + - elm alias export filter + - plain text export filter + - improved import / export system + - a man page (contributed by Alan Ford) + - some fixes + +0.4.5 + - new command line option --convert to make format conversions + - new common functions for filters + - mutt alias export filter + - minor filter updates + - fixed a compile problem in list.c + +0.4.4 + - fixed a serious segfault bug in editor + - conff.c update + +0.4.3 + - improved "send mail with mutt" command + - optimized screen refreshing + - abook handles now SIGINT, SIGKILL, SIGTERM signals + +0.4.2 + - new editor + - added fields for address (address, city, state, zip, country) + - terminal resizing is now handled by abook + - improved scrolling + - bugfixes + - dropped support for abook 0.1 / 0.2 file format + +0.4.1 + - fixed a redraw bug in editor which occurred only with old ncurses library + - minor updates + +0.4.0 + - PINE addressbook import and export filters added + - new faster load and save functions + - changed memory allocation method + - better configuration system - options.c rewritten + - new version of conff.c + - find segfault bug fixed + - fixed overwriting policy + +0.3.1 + - fixed a bug which caused list to disappear sometimes after removing items + - minor changes in datafile loader + - abook.gz import filter is now disabled as default + +0.3.0 + - new portable file format + - import filter for old data format + - now compiles on FreeBSD + - new "send mail with mutt" command + - multiple e-mail address support + - html export filter + - improved cursor behavior + - fixed misc.c + - new configuration system ( ~/.abook.conf ) + - improved memory allocation functions + - added invert selection command + - minor filter updates + +0.2.4 + - minor memory freeing fix + +0.2.3 + - major memory allocation bugfix + +0.2.2 + - bugfixes + +0.2.1 + - abook finaly uses automake/autoconf setup + - documentation updated + - minor changes + +0.2.0 + - multiple selection + - added find function + - ldif import filter update (still some bugs?) + - added check for terminal size + - removed obsolete rcfile code + - some changes in list.c + - new file: help.h + - Makefiles modified + - complete rewrote of misc.c + - fixed a bug in mutt query + - changed first_item to first_list_item and LAST_ITEM to LAST_LIST_ITEM + - lots of minor improvements + - documentation updated (it's still very bad) + +0.1.0 + - removed dummy defaultrc.h file + - README and COPYING + - minor ldif import filter update + - minor changes and fixes + +0.1.0-pre-release 2 + - locale support + - mutt query now ignores case + - rcfile support is compiled only if -DEXPERIMENTAL option is selected (see + Makefile) because the rcfile support is very poor and should + be rewritten for 0.2 or something + - new file: defaultrc.h + +0.1.0-pre-release 1 diff --git a/FAQ b/FAQ new file mode 100644 index 0000000..c179799 --- /dev/null +++ b/FAQ @@ -0,0 +1,35 @@ +abook FAQ +~~~~~~~~~ + +Q: How to query all addresses when I press 'Q' in mutt? + +A: Type "all" to the prompt. + + +Q: Can I mark multiple addresses in mutt after a query? + +A: You can tag addresses with 't'. When ready, type ";m" (press first ';' + and then 'm') and all tagged addresses will appear to your "To:" + line. + + +Q: How to insert an address (or many) with abook when I'm forwarding + a message in mutt? ("To:" and "Cc:" prompts) + +A: When "To:" or "Cc:" prompt appears press ^t for query. (After query + you can tag multiple addresses with 't') + + +Q: Can I add addresses to the abook addressbook from mutt? + +A: It's not supported directly by abook or mutt. However abook comes with + mail2abook.py python script which does this. (See the contrib directory) + + +Q: Does abook support palm addressbooks? + +A: No, but there are utilities to convert palm addressbooks to ldif + files. Abook can import ldif files. + + +last update: 2001-03-07 / JH diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..b42a17a --- /dev/null +++ b/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..5bc5d55 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,18 @@ + +bin_PROGRAMS = abook + +abook_SOURCES = abook.c database.c filter.c list.c misc.c conff.c \ + options.c edit.c ldif.c estr.c \ + abook.h database.h filter.h list.h misc.h help.h conff.h \ + options.h edit.h ldif.h estr.h abook_curses.h + +EXTRA_DIST = ANNOUNCE BUGS FAQ abook.1 abookrc.5 sample.abookrc + +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 + $(INSTALL_DATA) $(srcdir)/abook.1 $(DESTDIR)$(mandir)/man1/ + $(INSTALL_DATA) $(srcdir)/abookrc.5 $(DESTDIR)$(mandir)/man5/ + +uninstall-local: + -rm -f $(DESTDIR)$(mandir)/man1/abook.1 + -rm -f $(DESTDIR)$(mandir)/man5/abookrc.5 diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..b9ffdc5 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,368 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +CC = @CC@ +CPP = @CPP@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +U = @U@ +VERSION = @VERSION@ + +bin_PROGRAMS = abook + +abook_SOURCES = abook.c database.c filter.c list.c misc.c conff.c options.c edit.c ldif.c estr.c abook.h database.h filter.h list.h misc.h help.h conff.h options.h edit.h ldif.h estr.h abook_curses.h + + +EXTRA_DIST = ANNOUNCE BUGS FAQ abook.1 abookrc.5 sample.abookrc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +abook_OBJECTS = abook.o database.o filter.o list.o misc.o conff.o \ +options.o edit.o ldif.o estr.o +abook_LDADD = $(LDADD) +abook_DEPENDENCIES = +abook_LDFLAGS = +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ +Makefile.am Makefile.in NEWS THANKS TODO acconfig.h acinclude.m4 \ +aclocal.m4 config.guess config.h.in config.sub configure configure.in \ +install-sh missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +SOURCES = $(abook_SOURCES) +OBJECTS = $(abook_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in acinclude.m4 + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/config.h.in: $(srcdir)/stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h.in; \ + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +abook: $(abook_OBJECTS) $(abook_DEPENDENCIES) + @rm -f abook + $(LINK) $(abook_LDFLAGS) $(abook_OBJECTS) $(abook_LDADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: install-binPROGRAMS +install-exec: install-exec-am + +install-data-am: install-data-local +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-binPROGRAMS uninstall-local +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) config.h +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ + mostlyclean-compile mostlyclean-tags \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \ + clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \ + distclean-tags distclean-generic clean-am + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ +check-am installcheck-am installcheck all-recursive-am install-exec-am \ +install-exec install-data-local install-data-am install-data install-am \ +install uninstall-local uninstall-am uninstall all-redirect all-am all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 + $(INSTALL_DATA) $(srcdir)/abook.1 $(DESTDIR)$(mandir)/man1/ + $(INSTALL_DATA) $(srcdir)/abookrc.5 $(DESTDIR)$(mandir)/man5/ + +uninstall-local: + -rm -f $(DESTDIR)$(mandir)/man1/abook.1 + -rm -f $(DESTDIR)$(mandir)/man5/abookrc.5 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ + diff --git a/README b/README new file mode 100644 index 0000000..7205ede --- /dev/null +++ b/README @@ -0,0 +1,57 @@ + + ABOOK by JH + ----- + +Abook is an addressbook program with mutt mail client support. + +COMPILATION + +To compile abook you must have ncurses developement libraries installed. +Starting from version 0.4.10 abook is know to compile with the native curses +library of SUN Solaris and OpenBSD. + +If you compile with --enable-debug flag you should run abook like this: +abook 2> debug or abook 2> /dev/null. Abook 0.4.8 has been compiled and tested +successfully on following platforms: + +Linux (Debian GNU/Linux 2.1, RedHat 6.1) +FreeBSD 3.3 +Solaris 2.5 / 2.6 (thanks Michael Wiedmann) +AIX 3.2.5 (tested by Brian Salter-Duke) +DEC alpha ? (tested by Brian Salter-Duke) + +INSTALLATION + +See INSTALL for detailed instructions. + +If you want to use abook with mutt you should add following line to your +~/.muttrc or to the systemwide /etc/Muttrc file. + +set query_command="abook --mutt-query '%s'" + +After this you can make queries from mutt using the query command ( Q ). + +NOTES + +If your language specific characters doesn't work correctly make sure +that your locale configuration has been done properly. (On Linux you +must set at least LC_CTYPE environment variable) + +If you want to import a ldif file generated by abook in Netscape you +must use the extension ``.4ld''. + +OBTAINING ABOOK + +Get the latest version from http://abook.sourceforge.net/ + +LICENSE + +All files in this distribution are released under GNU GENERAL PUBLIC LICENSE. +See COPYING for details. + +CONTACT AUTHOR + +Send bugreports, fixes, wishes etc. to Jaakko Heinonen +or preferably use the mailing list. (See http://abook.sourceforge.net/ for +details) + diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..6a04e23 --- /dev/null +++ b/THANKS @@ -0,0 +1,14 @@ +abook THANKS +------------ + +Michael Wiedmann +Brian Salter-Duke +An Thi-Nguyen Le +Reinhard J Sammer +Matt Anderson +R. Shohn Trojacek +? +Shao Zhang +Gustavo Niemeyer + +See also AUTHORS diff --git a/TODO b/TODO new file mode 100644 index 0000000..f9d5771 --- /dev/null +++ b/TODO @@ -0,0 +1,4 @@ + general: + - colors 0.8 - 1.0 ? + - custom fields (partially done) + diff --git a/abook.1 b/abook.1 new file mode 100644 index 0000000..dad151f --- /dev/null +++ b/abook.1 @@ -0,0 +1,76 @@ +.TH ABOOK 1 "March 18, 2000" +.nh +.SH NAME +abook \- text-based address book program +.SH SYNOPSIS +.B abook +[ \fB--help\fP | \fB--datafile\fP | \fB--mutt-query\fP | \fB--convert\fP ] +.SH DESCRIPTION +This manual page documents briefly the +.B abook +program. +This manual page was written for the Debian GNU/Linux distribution +because the original program does not have a manual page. +.PP +.B abook +is a text-based address book program. It contains Name, Email, Address +and various Phone fields. It is designed for use with mutt, but can be +equally useful on its own. +.SH OPTIONS +.TP +\fB\-\-help\fP +Show usage. +.TP +\fB\-\-datafile\fP +Use an alternative addressbook file (default is $HOME/.abook.addressbook). +.TP +\fB\-\-mutt-query\fP +Make a query for mutt (search the addressbook for ). +.br +The \fB\-\-datafile\fP option, as documented above, may be used BEFORE this +option to search a different addressbook file. +.TP +\fB\-\-convert\fP +Converts in to in + +.br +The following \fBinputformats\fP are supported: +.br +- \fBabook\fP abook native format +.br +- \fBldif\fP ldif / Netscape addressbook +.br +- \fBpine\fP pine addressbook + +.br +The following \fBoutputformats\fP are supported: +.br +- \fBabook\fP abook native format +.br +- \fBmutt\fP mutt alias +.br +- \fBhtml\fP html document +.br +- \fBpine\fP pine addressbook +.br +- \fBgcrd\fP GnomeCard (VCard) addressbook +.br +- \fBcsv\fP comma separated values +.br +- \fBelm\fP elm alias +.br +- \fBtext\fP plain text + +.SH COMMANDS DURING USE +Press '\fB?\fP' during use to get a list of commands. +.SH SEE ALSO +.BR mutt (1), +.BR abookrc (5) +.br +.SH AUTHOR +This manual page was written by Alan Ford , +for the Debian GNU/Linux system (but may be used by others). + +.br +.B abook +was written by Jaakko Heinonen diff --git a/abook.c b/abook.c new file mode 100644 index 0000000..db761df --- /dev/null +++ b/abook.c @@ -0,0 +1,925 @@ +/* + * abook.c + * by JH + * + * Copyright (C) 1999, 2000 Jaakko Heinonen + */ + +#include +#include +#include +#include +#include +#include +#include "abook_curses.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) +# include +#endif +#ifdef HAVE_TERMIOS_H +# include +#else +# ifdef HAVE_LINUX_TERMIOS_H +# include +# endif +#endif +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#include "abook.h" +#include "database.h" +#include "list.h" +#include "filter.h" +#include "edit.h" +#include "misc.h" +#include "help.h" +#include "options.h" +#include "estr.h" + +static void init_abook(); +static void set_filenames(); +static void free_filenames(); +static void display_help(char **tbl); +static void get_commands(); +static void parse_command_line(int argc, char **argv); +static void show_usage(); +static void mutt_query(char *str); +static void init_mutt_query(); +static void quit_mutt_query(); +static void launch_mutt(); +static void launch_lynx(); +static void win_changed(int dummy); +static void open_datafile(); +#ifdef SIGWINCH +static void resize_abook(); +#endif +static void convert(char *srcformat, char *srcfile, + char *dstformat, char *dstfile); + +int should_resize = FALSE; +int can_resize = FALSE; + +char *datafile = NULL; +char *rcfile = NULL; + +WINDOW *top = NULL, *bottom = NULL; + +static void +init_windows() +{ + top = newwin(LIST_TOP - 1, COLS, 0, 0); + + bottom = newwin(LINES - LIST_BOTTOM, COLS, LIST_BOTTOM, 0); +} + +static void +free_windows() +{ + delwin(top); + delwin(bottom); +} + +static void +init_abook() +{ + set_filenames(); + init_options(); + + initscr(); cbreak(); noecho(); + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); +#ifdef DEBUG + fprintf(stderr, "init_abook():\n"); + fprintf(stderr, " COLS = %d, LINES = %d\n", COLS, LINES); +#endif + if( LINES < MIN_LINES || COLS < MIN_COLS ) { + clear(); refresh(); endwin(); + fprintf(stderr, "Your terminal size is %dx%d\n", COLS, LINES); + fprintf(stderr, "Terminal is too small. Minium terminal size " + "for abook is " + "%dx%d\n", MIN_COLS, MIN_LINES); + exit(1); + } + umask(DEFAULT_UMASK); +#ifdef SIGWINCH + signal(SIGWINCH, win_changed); +#endif + signal(SIGINT, quit_abook); + signal(SIGKILL, quit_abook); + signal(SIGTERM, quit_abook); + + init_list(); + init_windows(); + + /* + * this is very ugly for now + */ + /*if( options_get_int("datafile", "autosave") )*/ + + if( load_database(datafile) == 2 ) { + char *tmp = strconcat(getenv("HOME"), + "/" DATAFILE, NULL); + + if( safe_strcmp(tmp, datafile) ) { + refresh_screen(); + statusline_msg("Sorry, the specified file does " + "not appear to be a valid abook addressbook"); + statusline_msg("Will open default addressbook..."); + free(datafile); + datafile = tmp; + load_database(datafile); + } else + free(tmp); + } + + refresh_screen(); +} + +void +quit_abook() +{ + if( options_get_int("autosave") ) + save_database(); + else { + statusline_addstr("Save database (y/N)"); + switch( getch() ) { + case 'y': + case 'Y': + save_database(); + default: break; + } + } + close_config(); + close_database(); + close_list(); + free_windows(); + clear(); + refresh(); + endwin(); + + exit(0); +} + +int +main(int argc, char **argv) +{ +#if defined(HAVE_SETLOCALE) && defined(HAVE_LOCALE_H) + setlocale(LC_ALL, "" ); +#endif + + parse_command_line(argc, argv); + + init_abook(); + + get_commands(); + + quit_abook(); + + return 0; +} + +static void +set_filenames() +{ + struct stat s; + + if( (stat(getenv("HOME"), &s)) == -1 || ! S_ISDIR(s.st_mode) ) { + fprintf(stderr,"%s is not a valid HOME directory\n", getenv("HOME") ); + exit(1); + } + + if (!datafile) + datafile = strconcat(getenv("HOME"), "/" DATAFILE, NULL); + + rcfile = strconcat(getenv("HOME"), "/" RCFILE, NULL); + + atexit(free_filenames); +} + +static void +free_filenames() +{ + my_free(rcfile); + my_free(datafile); +} + +void +headerline(char *str) +{ + werase(top); + + mvwhline(top, 1, 0, ACS_HLINE, COLS); + + mvwprintw(top, 0, 0, "%s | %s", PACKAGE " " VERSION, str); + + refresh(); + wrefresh(top); +} + + +void +refresh_screen() +{ +#ifdef SIGWINCH + if( should_resize ) { + resize_abook(); + return; + } +#endif + clear(); + + refresh_statusline(); + headerline(MAIN_HELPLINE); + list_headerline(); + + refresh_list(); +} + +#ifdef DEBUG +extern int curitem; +extern list_item *database; +static void +dump_item() +{ + int i; + + fprintf(stderr,"sizeof(list_item) = %d\n", sizeof(list_item)); + fprintf(stderr,"--- dumping item %d ---\n", curitem); + + for(i=0; i= 0) { + selected[curitem] = !selected[curitem]; + print_number_of_items(); + refresh_list(); + } + break; + case '+': select_all(); + refresh_list(); + break; + case '-': select_none(); + refresh_list(); + break; + case '*': invert_selection(); + refresh_list(); + break; + case 'A': move_curitem(MOVE_ITEM_UP); + break; + case 'Z': move_curitem(MOVE_ITEM_DOWN); + break; + + case 'm': launch_mutt(); break; + + case 'p': print_database(); break; + + case 'u': launch_lynx(); break; +#ifdef DEBUG + case 'D': dump_item(); +#endif + } + } +} + + +static void +display_help(char **tbl) +{ + int i, j = 3; + + erase(); + headerline("help"); + refresh_statusline(); + + for( i = 0; tbl[i] != NULL; i++) { + mvaddstr(j++, 0, tbl[i]); + if( ( !( (i+1) % (LINES-7) ) ) || + (tbl[i+1] == NULL) ) { + refresh(); + statusline_msg("Press any key to continue..."); + erase(); + refresh_statusline(); + headerline("help"); + j = 3; + } + } + refresh_screen(); +} + +void +display_editor_help(WINDOW *w) +{ + int i; + + werase(w); + + headerline("editor help"); + + for( i = 0; editorhelp[i] != NULL; i++) { + waddstr(w, editorhelp[i]); + if( ( !( (i+1) % (LINES-8) ) ) || + (editorhelp[i+1] == NULL) ) { + refresh(); + wrefresh(w); + statusline_msg("Press any key to continue..."); + wclear(w); + } + } +} + + +void +statusline_msg(char *msg) +{ + clear_statusline(); + statusline_addstr(msg); + getch(); +#ifdef DEBUG + fprintf(stderr, "statusline_msg(\"%s\")\n", msg); +#endif + clear_statusline(); +} + +void +statusline_addstr(char *str) +{ + mvwaddstr(bottom, 1, 0, str); + refresh(); + wrefresh(bottom); +} + +/* + * function statusline_getnstr + * + * parameters: + * (char *str) + * if n >= 0 str is a pointer which points a place where to store + * the string, else str is ingnored + * (int n) + * the maximum length of the string + * If n < 0 function will allocate needed space for the string. + * Value 0 is not allowed for n. + * (int use_filesel) + * if this value is nonzero the fileselector is enabled + * + * returns (char *) + * If n < 0 a pointer to a newly allocated string is returned. + * If n > 0 a nonzero value is returned if user has typed a valid + * string. If not NULL value is returned. Never really use the + * _pointer_ if n > 0. + * + */ + +char * +statusline_getnstr(char *str, int n, int use_filesel) +{ + char *buf; + int y, x; + + getyx(bottom, y, x); + wmove(bottom, 1, x); + + buf = wenter_string(bottom, n, + (use_filesel ? ESTR_USE_FILESEL:0) | ESTR_DONT_WRAP); + + if(n < 0) + return buf; + + if(buf == NULL) + str[0] = 0; + else + strncpy(str, buf, n); + + str[n-1] = 0; + + free(buf); + + return buf; +} + +void +refresh_statusline() +{ + werase(bottom); + + mvwhline(bottom, 0, 0, ACS_HLINE, COLS); + mvwhline(bottom, 2, 0, ACS_HLINE, COLS); + + refresh(); + wrefresh(bottom); +} + + +char * +ask_filename(char *prompt, int flags) +{ + char *buf = NULL; + + clear_statusline(); + + statusline_addstr(prompt); + buf = statusline_getnstr(NULL, -1, flags); + + clear_statusline(); + + return buf; +} + +void +clear_statusline() +{ + wmove(bottom, 1, 0); + wclrtoeol(bottom); + wrefresh(bottom); + refresh(); +} + +static void +parse_command_line(int argc, char **argv) +{ + int i; + + for( i = 1; i < argc; i++ ) { + if( !strcmp(argv[i], "--help") ) { + show_usage(); + exit(1); + } else + if( !strcmp(argv[i], "--mutt-query") ) + mutt_query(argv[i + 1]); + else + if( !strcmp(argv[i], "--datafile") ) { + if (argv[i+1]) { + if (argv[i+1][0] != '/') { + char *cwd = my_getcwd(); + datafile = strconcat(cwd, "/", argv[i+1], NULL); + free(cwd); + } else { + datafile = strdup(argv[i+1]); + } + i++; + } else { + show_usage(); + exit(1); + } + } else + if( !strcmp(argv[i], "--convert") ) { + if( argc < 5 || argc > 6 ) { + fprintf(stderr, "incorrect number of argumets to make conversion\n"); + fprintf(stderr, "try %s --help\n", argv[0]); + exit(1); + } + if( argv[i+4] ) + convert(argv[i+1], argv[i+2], + argv[i+3], argv[i+4]); + else + convert(argv[i+1], argv[i+2], argv[i+3], "-"); + } else { + printf("option %s not recognized\n", argv[i]); + printf("try %s --help\n", argv[0]); + exit(1); + } + } +} + + +static void +show_usage() +{ + puts (PACKAGE " v " VERSION "\n"); + puts (" --help show usage"); + puts (" --datafile use an alternative addressbook file"); + puts (" --mutt-query make a query for mutt"); + puts (" --convert " + " "); + putchar('\n'); + puts ("available formats for --convert option:"); + print_filters(); +#ifdef DEBUG + puts ("\nWarning: this version compiled with DEBUG flag ON"); +#endif +} + +extern list_item *database; +extern int items; + +static void +muttq_print_item(int item) +{ + char emails[MAX_EMAILS][MAX_EMAIL_LEN]; + int i; + + split_emailstr(item, emails); + + for(i = 0; i < (options_get_int("mutt_return_all_emails") ? + MAX_EMAILS : 1) ; i++) + if( *emails[i] ) + printf("%s\t%s\t%s\n", emails[i], + database[item][NAME], + database[item][NOTES] == NULL ? " " : + database[item][NOTES] + ); +} + +static int +mutt_query_name(char *str) +{ + int i, j; + char *tmp; + + for(i = 0, j = 0 ; i < items; i++) { + tmp = strdup(database[i][NAME]); + if( strstr( strupper(tmp), strupper(str) ) != NULL ) { + if( !j ) + putchar('\n'); + muttq_print_item(i); + j++; + } + free(tmp); + } + + return j; +} + +static int +mutt_query_email(char *str) +{ + int i, j, k; + char *tmp, emails[MAX_EMAILS][MAX_EMAIL_LEN]; + + for(i = 0, j = 0; i < items; i++) { + split_emailstr(i, emails); + for(k = 0; k < MAX_EMAILS; k++) { + if( *emails[k] ) { + tmp = strdup( emails[k] ); + if( strstr( strupper(tmp), strupper(str) ) != NULL ) { + if( !j ) + putchar('\n'); + j++; + if( options_get_int("mutt_return_all_emails") ) { + muttq_print_item(i); + free(tmp); + break; + } else + printf("%s\t%s\n", emails[k], + database[i][NAME]); + } + free(tmp); + } + } + } + + return j; +} + +static void +mutt_query(char *str) +{ + int i; + + init_mutt_query(); + + if( str == NULL || !strcasecmp(str, "all") ) { + printf("All items\n"); + for(i = 0; i < items; i++) + muttq_print_item(i); + } else { + if( !mutt_query_name(str) && !mutt_query_email(str) ) { + printf("Not found\n"); + quit_mutt_query(1); + } + } + + quit_mutt_query(0); +} + +static void +init_mutt_query() +{ + set_filenames(); + init_options(); + + if( load_database(datafile) ) { + printf("Cannot open database\n"); + quit_mutt_query(1); + exit(1); + } +} + +static void +quit_mutt_query(int status) +{ + close_database(); + close_config(); + + exit(status); +} + + +static void +launch_mutt() +{ + int i; + char email[MAX_EMAIL_LEN]; + char *cmd; + char *tmp = options_get_str("mutt_command"); + + if(curitem < 0) + return; + + cmd = strconcat(tmp, " '", NULL ); + + for(i=0; i < items; i++) { + if( ! selected[i] && i != curitem ) + continue; + get_first_email(email, i); + tmp = mkstr("%s \"%s\"", cmd, database[i][NAME]); + my_free(cmd); + if( *database[i][EMAIL] ) { + cmd = mkstr("%s <%s>", tmp, email); + free(tmp); + tmp = cmd; + } + cmd = strconcat(tmp, " ", NULL); + free(tmp); + } + + tmp = mkstr("%s%c", cmd, '\''); + free(cmd); + cmd = tmp; +#ifdef DEBUG + fprintf(stderr, "cmd: %s\n", cmd); +#endif + system(cmd); + + free(cmd); + refresh_screen(); +} + +static void +launch_lynx() +{ + char *cmd = NULL; + + if(curitem < 0) + return; + + if( database[curitem][URL] ) + cmd = mkstr("%s '%s'", + options_get_str("www_command"), + safe_str(database[curitem][URL])); + else + return; + + if ( cmd ) + system(cmd); + + free(cmd); + refresh_screen(); +} + +void * +abook_malloc(size_t size) +{ + void *ptr; + + if ( (ptr = malloc(size)) == NULL ) { + if(top) /* determinate if init_abook has been called */ + quit_abook(); + perror("malloc() failed"); + exit(1); + } + + return ptr; +} + +void * +abook_realloc(void *ptr, size_t size) +{ + ptr = realloc(ptr, size); + + if( size == 0 ) + return NULL; + + if( ptr == NULL ) { + if(top) /* determinate if init_abook has been called */ + quit_abook(); + perror("realloc() failed"); + exit(1); + } + + return ptr; +} + +FILE * +abook_fopen (const char *path, const char *mode) +{ + struct stat s; + + if( ! strchr(mode, 'r') ) + return fopen(path, mode); + + if ( (stat(path, &s)) == -1 ) + return NULL; + + return S_ISREG(s.st_mode) ? fopen(path, mode) : NULL; +} + + +static void +win_changed(int i) +{ + if( can_resize ) + resize_abook(); + else + should_resize = TRUE; +} + +#ifdef SIGWINCH +static void +resize_abook() +{ +#ifdef TIOCGWINSZ + struct winsize winsz; + + ioctl (0, TIOCGWINSZ, &winsz); +#ifdef DEBUG + if(winsz.ws_col >= MIN_COLS && winsz.ws_row >= MIN_LINES) { + fprintf(stderr, "Warning: COLS=%d, LINES=%d\n", winsz.ws_col, winsz.ws_row); + } +#endif + + if(winsz.ws_col >= MIN_COLS && winsz.ws_row >= MIN_LINES) { +#ifdef HAVE_RESIZETERM + resizeterm(winsz.ws_row, winsz.ws_col); +#else + COLS = winsz.ws_col; + LINES = winsz.ws_row; +#endif + } + + should_resize = FALSE; + close_list(); /* we need to recreate windows */ + init_list(); + free_windows(); + init_windows(); + refresh_screen(); + refresh(); +#endif /* TIOCGWINSZ */ +} +#endif /* SIGWINCH */ + + +static void +convert(char *srcformat, char *srcfile, char *dstformat, char *dstfile) +{ + int ret=0; + + if( !srcformat || !srcfile || !dstformat || !dstfile ) { + fprintf(stderr, "too few argumets to make conversion\n"); + fprintf(stderr, "try --help\n"); + } + + strlower(srcformat); + strlower(dstformat); + + if( !strcmp(srcformat, dstformat) ) { + printf( "input and output formats are the same\n" + "exiting...\n"); + exit(1); + } + + set_filenames(); + init_options(); + + switch( import(srcformat, srcfile) ) { + case -1: + printf("input format %s not supported\n", srcformat); + ret = 1; + case 1: + printf("cannot read file %s\n", srcfile); + ret = 1; + } + + if(!ret) + switch( export(dstformat, dstfile) ) { + case -1: + printf("output format %s not supported\n", + dstformat); + ret = 1; + break; + case 1: + printf("cannot write file %s\n", dstfile); + ret = 1; + break; + } + + close_database(); + close_config(); + exit(ret); +} + + +static void +open_datafile() +{ + char *filename; + + filename = ask_filename("File to open: ", 1); + + if( !filename ) { + refresh_screen(); + return; + } + + if( options_get_int("autosave") ) + save_database(); + else { + statusline_addstr("Save current database (y/N)"); + switch( getch() ) { + case 'y': + case 'Y': + save_database(); + default: break; + } + } + + close_database(); + + load_database(filename); + + if( items == 0 ) { + statusline_msg("Sorry, that specified file appears not to be a valid abook addressbook"); + load_database(datafile); + } else { + free(datafile); + datafile = strdup(filename); + } + + refresh_screen(); + free(filename); +} diff --git a/abook.h b/abook.h new file mode 100644 index 0000000..64ea077 --- /dev/null +++ b/abook.h @@ -0,0 +1,60 @@ +#ifndef _ABOOK_H +#define _ABOOK_H + +void refresh_screen(); +void statusline_msg(char *msg); +char *ask_filename(char *prompt, int flags); +void clear_statusline(); +void statusline_addstr(char *str); +char *statusline_getnstr(char *str, int n, int use_filesel); +void headerline(char *str); +void refresh_statusline(); +void display_editor_help(); +void *abook_malloc(size_t size); +void *abook_realloc(void *ptr, size_t size); +FILE *abook_fopen (const char *path, const char *mode); +void quit_abook(); +#ifdef _AIX +int strcasecmp (const char *, const char *); +int strncasecmp (const char *, const char *, size_t); +#endif + +#define MAIN_HELPLINE "q:quit ?:help a:add r:remove" + +#define Y_STATUSLINE (LINES - 2) + +#define MIN_LINES 20 +#define MIN_COLS 70 + +#define DEFAULT_UMASK 066 +#define DATAFILE ".abook.addressbook" + +/* + * some "abookwide" useful macros + */ + +#define hide_cursor() curs_set(0) +#define show_cursor() curs_set(1) + +#define safe_atoi(X) (X == NULL) ? 0 : atoi(X) +#define my_free(X) do {free(X); X=NULL;} while(0) +#define safe_str(X) X == NULL ? "" : X +#define safe_strdup(X) (X == NULL) ? NULL : strdup(X) + +#ifndef min +# define min(x,y) (((x)<(y)) ? (x):(y)) +#endif + +#ifndef max +# define max(x,y) (((x)>(y)) ? (x):(y)) +#endif + +#define ISSPACE(c) isspace((unsigned char)c) + +#ifndef DEBUG +# define NDEBUG 1 +#else +# undef NDEBUG +#endif + +#endif diff --git a/abook_curses.h b/abook_curses.h new file mode 100644 index 0000000..94e0012 --- /dev/null +++ b/abook_curses.h @@ -0,0 +1,16 @@ +#ifndef _ABOOK_CURSES_H +#define _ABOOK_CURSES_H + +#include "config.h" + +#ifdef HAVE_NCURSES_H +# include +#else +# include +#endif + +#ifndef getnstr +# define getnstr(s, n) wgetnstr(stdscr, s, n) +#endif + +#endif diff --git a/abookrc.5 b/abookrc.5 new file mode 100644 index 0000000..33076d2 --- /dev/null +++ b/abookrc.5 @@ -0,0 +1,157 @@ +.TH ABOOKRC 5 "Jan 2, 2001" +.nh +.SH NAME +\fB$HOME/.abookrc\fP \- configuration file for abook address book program +.SH DESCRIPTION +This manual page documents briefly the +.B .abookrc +file. +.br +.B .abookrc +is the (optional) configuration file for use with the +.B abook(1) +address book program. + +.B .abookrc +is stored in a user's $HOME directory. It follows a format of option=value. +The following information lists each of these options and the values they +may take. + +If a variable is not set in +.B .abook.conf +, a sensible default, as +listed with the description below, will be used. + +Comments in +.B .abook.conf +are on lines beginning with '#'. + +.SH VARIABLES + +.TP +\fBautosave\fP=[true|false] +Defines whether the addressbook is automatically saved on exit. Default is true. + +.TP +\fBshow_all_emails\fP=[true|false] +Defines whether all email addresses for a contact are shown in the main list view. Default is true + +.TP +\fBemailpos\fP=column +Defines the screen column on the main list where the email address is to begin. Default is 25. + +.TP +\fBextra_column\fP=field +Defines the variable to display in the extra (third) column on the main list. Default is 7 (Home Phone). +.br +The following numbers are used to represent commonly used \fIfield\fPs: +.br +-1 = disabled +.br + 7 = Home Phone +.br + 8 = Work Phone +.br + 9 = Fax +.br +10 = Mobile Phone +.br +11 = Nick / Alias +.br +12 = URL +.br +13 = Notes + +.TP +\fBextra_alternative\fP=field +This is an optional setting that allows you to specify an alternative field to be displayed in the extra (third) column if there is no data for the field specified in extra_column for a particular item. The numerical codes for the fields are the same as above. Please note that the data shown where the alternative field has been used will NOT be marked differently in any way from the rest of the extra column. There is no default. + +.TP +\fBextrapos\fP=column +Defines the screen column on the main list where the extra field is to begin. Default is 65. + +.TP +\fBmutt_command\fP=command +Defines the command to start mutt. Default is "mutt". + +.TP +\fBmutt_return_all_emails\fP=[true|false] +Defines whether to return all email addresses matching the search criteria to a mutt query. Default is true. + +.TP +\fBprint_command\fP=command +Defines the command to used when printing the addressbook. Default is "lpr". + +.TP +\fBfilesel_sort\fP=[true|false] +Defines whether to sort the files in the fileselector in alphabetical order. Default is false. + +.TP +\fBwww_command\fP=command +Defines the command used to start the web browser to view a contact's URL. Default is "lynx". + +.TP +\fBaddress_style\fP=[eu|uk|us] +Defines the style of address formatting to be used when exporting as text / printing the database (European, UK, or USA). Default is European ("eu"). + +.SH SAMPLE CONFIGURATION FILE + +.nf +# sample abook configuration file +# + +# Automatically save database on exit +autosave=true + +# Show all email addresses in list +show_all_emails=true + +# Screen column for email field to start +emailpos=25 + +# Field to be used in the extra column +extra_column=7 +# frequently used values: +# -1 = disabled +# 7 = Home Phone +# 8 = Work Phone +# 9 = Fax +# 10 = Mobile Phone +# 11 = Nick / Alias +# 12 = URL + +# +extra_alternative=-1 + +# Screen column for the extra field to start +extrapos=65 + +# Command used to start mutt +mutt_command=mutt + +# Return all email addresses to a mutt query +mutt_return_all_emails=true + +# Command used to print +print_command=lpr + +# Sort files in fileselector (alphabetic order) +filesel_sort=false + +# Command used to start the web browser +www_command=lynx + +# address style [eu|us|uk] +address_style=eu + +.fi + +.SH SEE ALSO +.BR abook (1). +.br +.SH AUTHOR +This manual page was written by Alan Ford . + +.br +.B abook +was written by Jaakko Heinonen diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 0000000..3e221f5 --- /dev/null +++ b/acconfig.h @@ -0,0 +1,12 @@ +#undef VERSION +#undef PACKAGE + +/* Define if you have the header file. */ +#undef HAVE_STDARG_H + +/* Define if you have the header file. */ +#undef HAVE_NCURSES_H + +#undef HAVE_SNPRINTF +#undef HAVE_VSNPRINTF + diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..5d443ec --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,83 @@ +dnl --------------------------------------------------------------------------- +dnl Look for the curses libraries. Older curses implementations may require +dnl termcap/termlib to be linked as well. +AC_DEFUN([CF_CURSES_LIBS],[ +AC_CHECK_FUNC(initscr,,[ +case $host_os in #(vi +freebsd*) #(vi + AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"]) + ;; +hpux10.*|hpux11.*) + AC_CHECK_LIB(cur_colr,initscr,[ + LIBS="-lcur_colr $LIBS" + CFLAGS="-I/usr/include/curses_colr $CFLAGS" + ac_cv_func_initscr=yes + ],[ + AC_CHECK_LIB(Hcurses,initscr,[ + # HP's header uses __HP_CURSES, but user claims _HP_CURSES. + LIBS="-lHcurses $LIBS" + CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS" + ac_cv_func_initscr=yes + ])]) + ;; +linux*) # Suse Linux does not follow /usr/lib convention + LIBS="$LIBS -L/lib" + ;; +esac + +if test ".$With5lib" != ".no" ; then +if test -d /usr/5lib ; then + # SunOS 3.x or 4.x + CPPFLAGS="$CPPFLAGS -I/usr/5include" + LIBS="$LIBS -L/usr/5lib" +fi +fi + +if test ".$ac_cv_func_initscr" != .yes ; then + cf_save_LIBS="$LIBS" + cf_term_lib="" + cf_curs_lib="" + + # Check for library containing tgoto. Do this before curses library + # because it may be needed to link the test-case for initscr. + AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ + for cf_term_lib in termcap termlib unknown + do + AC_CHECK_LIB($cf_term_lib,tgoto,[break]) + done + ]) + + # Check for library containing initscr + test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" + for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown + do + AC_CHECK_LIB($cf_curs_lib,initscr,[break]) + done + test $cf_curs_lib = unknown && AC_ERROR(no curses library found) + + LIBS="-l$cf_curs_lib $cf_save_LIBS" + if test "$cf_term_lib" = unknown ; then + AC_MSG_CHECKING(if we can link with $cf_curs_lib library) + AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], + [initscr()], + [cf_result=yes], + [cf_result=no]) + AC_MSG_RESULT($cf_result) + test $cf_result = no && AC_ERROR(Cannot link curses library) + elif test "$cf_term_lib" != predefined ; then + AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) + AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], + [initscr(); tgoto((char *)0, 0, 0);], + [cf_result=no], + [ + LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" + AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], + [initscr()], + [cf_result=yes], + [cf_result=error]) + ]) + AC_MSG_RESULT($cf_result) + fi +fi + +])]) diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..5358101 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,321 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +dnl --------------------------------------------------------------------------- +dnl Look for the curses libraries. Older curses implementations may require +dnl termcap/termlib to be linked as well. +AC_DEFUN([CF_CURSES_LIBS],[ +AC_CHECK_FUNC(initscr,,[ +case $host_os in #(vi +freebsd*) #(vi + AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"]) + ;; +hpux10.*|hpux11.*) + AC_CHECK_LIB(cur_colr,initscr,[ + LIBS="-lcur_colr $LIBS" + CFLAGS="-I/usr/include/curses_colr $CFLAGS" + ac_cv_func_initscr=yes + ],[ + AC_CHECK_LIB(Hcurses,initscr,[ + # HP's header uses __HP_CURSES, but user claims _HP_CURSES. + LIBS="-lHcurses $LIBS" + CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS" + ac_cv_func_initscr=yes + ])]) + ;; +linux*) # Suse Linux does not follow /usr/lib convention + LIBS="$LIBS -L/lib" + ;; +esac + +if test ".$With5lib" != ".no" ; then +if test -d /usr/5lib ; then + # SunOS 3.x or 4.x + CPPFLAGS="$CPPFLAGS -I/usr/5include" + LIBS="$LIBS -L/usr/5lib" +fi +fi + +if test ".$ac_cv_func_initscr" != .yes ; then + cf_save_LIBS="$LIBS" + cf_term_lib="" + cf_curs_lib="" + + # Check for library containing tgoto. Do this before curses library + # because it may be needed to link the test-case for initscr. + AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ + for cf_term_lib in termcap termlib unknown + do + AC_CHECK_LIB($cf_term_lib,tgoto,[break]) + done + ]) + + # Check for library containing initscr + test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" + for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown + do + AC_CHECK_LIB($cf_curs_lib,initscr,[break]) + done + test $cf_curs_lib = unknown && AC_ERROR(no curses library found) + + LIBS="-l$cf_curs_lib $cf_save_LIBS" + if test "$cf_term_lib" = unknown ; then + AC_MSG_CHECKING(if we can link with $cf_curs_lib library) + AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], + [initscr()], + [cf_result=yes], + [cf_result=no]) + AC_MSG_RESULT($cf_result) + test $cf_result = no && AC_ERROR(Cannot link curses library) + elif test "$cf_term_lib" != predefined ; then + AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) + AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], + [initscr(); tgoto((char *)0, 0, 0);], + [cf_result=no], + [ + LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" + AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], + [initscr()], + [cf_result=yes], + [cf_result=error]) + ]) + AC_MSG_RESULT($cf_result) + fi +fi + +])]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + + +# serial 1 + +AC_DEFUN(AM_C_PROTOTYPES, +[AC_REQUIRE([AM_PROG_CC_STDC]) +AC_REQUIRE([AC_PROG_CPP]) +AC_MSG_CHECKING([for function prototypes]) +if test "$am_cv_prog_cc_stdc" != no; then + AC_MSG_RESULT(yes) + AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes]) + U= ANSI2KNR= +else + AC_MSG_RESULT(no) + U=_ ANSI2KNR=./ansi2knr + # Ensure some checks needed by ansi2knr itself. + AC_HEADER_STDC + AC_CHECK_HEADERS(string.h) +fi +AC_SUBST(U)dnl +AC_SUBST(ANSI2KNR)dnl +]) + + +# serial 1 + +# @defmac AC_PROG_CC_STDC +# @maindex PROG_CC_STDC +# @ovindex CC +# If the C compiler in not in ANSI C mode by default, try to add an option +# to output variable @code{CC} to make it so. This macro tries various +# options that select ANSI C on some system or another. It considers the +# compiler to be in ANSI C mode if it handles function prototypes correctly. +# +# If you use this macro, you should check after calling it whether the C +# compiler has been set to accept ANSI C; if not, the shell variable +# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +# code in ANSI C, you can make an un-ANSIfied copy of it by using the +# program @code{ansi2knr}, which comes with Ghostscript. +# @end defmac + +AC_DEFUN(AM_PROG_CC_STDC, +[AC_REQUIRE([AC_PROG_CC]) +AC_BEFORE([$0], [AC_C_INLINE]) +AC_BEFORE([$0], [AC_C_CONST]) +dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require +dnl a magic option to avoid problems with ANSI preprocessor commands +dnl like #elif. +dnl FIXME: can't do this because then AC_AIX won't work due to a +dnl circular dependency. +dnl AC_BEFORE([$0], [AC_PROG_CPP]) +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(am_cv_prog_cc_stdc, +[am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( +[#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT($am_cv_prog_cc_stdc) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) + diff --git a/conff.c b/conff.c new file mode 100644 index 0000000..5ca11fa --- /dev/null +++ b/conff.c @@ -0,0 +1,201 @@ + +/* + * + * conff.c by JH + * + * Copyright (C) Jaakko Heinonen + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * conff.c version 0.3.0 + */ + +#include +#include +#include +#include +#include "misc.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include "conff.h" + +#ifndef DEBUG +# define NDEBUG 1 +#else +# undef NDEBUG +#endif + +#include + +#ifdef _AIX +int strcasecmp (const char *, const char *); +int strncasecmp (const char *, const char *, size_t); +#endif + +#define COMMENT_CHAR '#' + +static void +conff_free_node(struct conff_node *node) +{ + free(node -> value); + free(node -> key); + free(node); +} + +void +conff_add_key(struct conff_node **ptr, char *key, char *value, int flags) +{ + struct conff_node *new_item, *next = NULL; + + assert(key != NULL && value != NULL); + + for(; *ptr; ptr = &( (*ptr) -> next) ) + if(!strcasecmp(key, (*ptr) -> key ) ) { + if (flags & REPLACE_KEY) { + next = (*ptr) -> next; + conff_free_node(*ptr); + break; + } else + return; + } + + /* + * out of memory - error is ingnored + * NOTE: with REPLACE_KEY flag the node will be deleted in OOM + * situation + */ + if( (new_item = malloc(sizeof(struct conff_node))) == NULL ) + return; + + new_item -> key = strdup(key); + new_item -> value = strdup(value); + new_item -> next = next; + + *ptr = new_item; +} + +char * +conff_get_value(struct conff_node *node, char *key) +{ + + assert(key != NULL); + + for(; node ; node = node -> next) { + if(!strcasecmp(node -> key, key)) + return node -> value; + } + + return NULL; /* not found */ +} + +void +conff_free_nodes(struct conff_node *node) +{ + if(node != NULL) { + conff_free_nodes( node -> next ); + conff_free_node( node ); + } +} + +#ifdef DEBUG +void +print_values(struct conff_node *node) +{ + for(;node; node = node -> next) + fprintf(stderr, "%s - %s\n", node -> key, node -> value); +} +#endif + +void +conff_remove_key(struct conff_node **node, char *key) +{ + assert(key != NULL); + + for(; *node; node = &((*node) -> next) ) { + if(!strcasecmp(key, (*node) -> key ) ) { + struct conff_node *tmp = *node; + *node = (*node) -> next; + conff_free_node(tmp); + return; + } + } +} + +int +conff_save_file(struct conff_node *node, char *filename) +{ + FILE *out; + + assert(filename != NULL); + + if (!(out = fopen(filename, "w"))) + return -1; + + for(; node; node = node -> next) + fprintf(out, "%s=%s\n", node -> key, node -> value); + + fputc('\n', out); + fclose(out); + + return 0; +} + +int +conff_load_file(struct conff_node **node, char *filename, int flags) +{ + FILE *in; + char *line = NULL, *tmp; + int i = 0; + + if (!(in = fopen(filename, "r"))) + return -1; + + for(;;) { + i++; + + line = getaline(in); + if( feof(in) ) + break; + if(!line) + continue; + + strtrim(line); + + if(*line == '\n' || *line == '\0' || *line == COMMENT_CHAR) { + free(line); + continue; + } + + if ( (tmp = strchr(line, '=') )) { + *tmp++ = 0; + conff_add_key(node, strtrim(line), strtrim(tmp), flags); + } else { +/* fprintf(stderr, "parse error2,line #%d\n",i);*/ + fclose(in); + free(line); + return i; + } + free(line); + } + + free(line); + fclose(in); + + return 0; +} + diff --git a/conff.h b/conff.h new file mode 100644 index 0000000..740dbd6 --- /dev/null +++ b/conff.h @@ -0,0 +1,54 @@ + +/* + * + * conff.h by JH + * + * Copyright (C) Jaakko Heinonen + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _CONFF_H +#define _CONFF_H + +#include + + +struct conff_node +{ + char *key, *value; + + struct conff_node *next; +}; + + +void conff_add_key(struct conff_node **ptr, char *key, + char *value, int flags); +char *conff_get_value(struct conff_node *node, char *key); +#ifdef DEBUG +void print_values(struct conff_node *root); +#endif +void conff_free_nodes(struct conff_node *node); +void conff_remove_key(struct conff_node **node, char *key); +int conff_save_file(struct conff_node *node, char *filename); +int conff_load_file(struct conff_node **node, + char *filename, int flags); +char *strtrim(char *); + + +#define DONT_REPLACE_KEY 0 +#define REPLACE_KEY 1 + +#endif diff --git a/config.guess b/config.guess new file mode 100644 index 0000000..0ce538b --- /dev/null +++ b/config.guess @@ -0,0 +1,1183 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. +# +# This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# Use $HOST_CC if defined. $CC may point to a cross-compiler +if test x"$CC_FOR_BUILD" = x; then + if test x"$HOST_CC" != x; then + CC_FOR_BUILD="$HOST_CC" + else + if test x"$CC" != x; then + CC_FOR_BUILD="$CC" + else + CC_FOR_BUILD=cc + fi + fi +fi + + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-cbm ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format. + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + rm -f $dummy.c $dummy + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_help_string=`cd /; ld --help 2>&1` + ld_supported_emulations=`echo $ld_help_string \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + *ia64) + echo "${UNAME_MACHINE}-unknown-linux" + exit 0 + ;; + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + elf_i?86) + echo "${UNAME_MACHINE}-pc-linux" + exit 0 + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + sparclinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + armlinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32arm*) + echo "${UNAME_MACHINE}-unknown-linux-gnuoldld" + exit 0 + ;; + armelf_linux*) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; + m68klinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32ppc | elf32ppclinux) + # Determine Lib Version + cat >$dummy.c < +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unkown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 + ;; + esac + + if test "${UNAME_MACHINE}" = "alpha" ; then + cat <$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >$dummy.c < /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + elif test "${UNAME_MACHINE}" = "s390"; then + echo s390-ibm-linux && exit 0 + else + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" + test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + fi ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i?86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i?86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:*:6*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-W:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..2e29e1b --- /dev/null +++ b/config.h.in @@ -0,0 +1,53 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + +/* Define if you need to in order for stat and other things to work. */ +#undef _POSIX_SOURCE + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you have the header file. */ +#undef HAVE_STDARG_H + +#undef HAVE_SNPRINTF +#undef HAVE_VSNPRINTF + +/* Define if you have the resizeterm function. */ +#undef HAVE_RESIZETERM + +/* Define if you have the setlocale function. */ +#undef HAVE_SETLOCALE + +/* Define if you have the header file. */ +#undef HAVE_LINUX_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define if you have the header file. */ +#undef HAVE_NCURSES_H + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + +/* Define if compiler has function prototypes */ +#undef PROTOTYPES + diff --git a/config.sub b/config.sub new file mode 100644 index 0000000..c8e7785 --- /dev/null +++ b/config.sub @@ -0,0 +1,1268 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. +# +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | fr30 | avr) + basic_machine=$basic_machine-unknown + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[34567]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ + | bs2000-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + i386-go32 | go32) + basic_machine=i386-unknown + os=-go32 + ;; + i386-mingw32 | mingw32) + basic_machine=i386-unknown + os=-mingw32 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-unknown + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc | sparcv9) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i[34567]86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -*MiNT) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -*MiNT) + vendor=atari + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/configure b/configure new file mode 100755 index 0000000..c67069c --- /dev/null +++ b/configure @@ -0,0 +1,2791 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --with-curses=DIR Where ncurses is installed " +ac_help="$ac_help + --enable-debug Enable debugging support " + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=abook.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:560: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:613: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:670: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=abook + +VERSION=0.4.12pre1 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:716: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:729: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:742: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:755: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:768: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + + + + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:792: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:816: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:846: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:897: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:929: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 940 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:971: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:976: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1004: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:1036: checking for POSIXized ISC" >&5 +if test -d /etc/conf/kconfig.d && + grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 +then + echo "$ac_t""yes" 1>&6 + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + echo "$ac_t""no" 1>&6 + ISC= +fi + + + + +echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 +echo "configure:1060: checking for ${CC-cc} option to accept ANSI C" >&5 +if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + cat > conftest.$ac_ext < +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; + +int main() { + +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + +; return 0; } +EOF +if { (eval echo configure:1113: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + am_cv_prog_cc_stdc="$ac_arg"; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +CC="$ac_save_CC" + +fi + +if test -z "$am_cv_prog_cc_stdc"; then + echo "$ac_t""none needed" 1>&6 +else + echo "$ac_t""$am_cv_prog_cc_stdc" 1>&6 +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1137: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1158: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1175: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1192: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + + + +echo $ac_n "checking for function prototypes""... $ac_c" 1>&6 +echo "configure:1219: checking for function prototypes" >&5 +if test "$am_cv_prog_cc_stdc" != no; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define PROTOTYPES 1 +EOF + + U= ANSI2KNR= +else + echo "$ac_t""no" 1>&6 + U=_ ANSI2KNR=./ansi2knr + # Ensure some checks needed by ansi2knr itself. + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1232: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + + for ac_hdr in string.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1339: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +fi + +if test "x$U" != "x"; then + { echo "configure: error: Compiler not ANSI compliant" 1>&2; exit 1; } +fi +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:1381: checking for inline" >&5 +if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <&6 +echo "configure:1432: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1485: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_hdr in unistd.h locale.h termios.h linux/termios.h sys/ioctl.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1592: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1602: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +ac_safe=`echo "stdarg.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for stdarg.h""... $ac_c" 1>&6 +echo "configure:1630: checking for stdarg.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_STDARG_H 1 +EOF + +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: *** stdarg.h is missing on your system ***" 1>&2; exit 1; } +fi + +for ac_func in setlocale +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1668: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + + +abook_cv_curses=/usr +# Check whether --with-curses or --without-curses was given. +if test "${with_curses+set}" = set; then + withval="$with_curses" + if test $withval != yes; then + abook_cv_curses=$withval + fi + if test x$abook_cv_curses != x/usr; then + LDFLAGS="-L${abook_cv_curses}/lib $LDFLAGS" + CPPFLAGS="$CPPFLAGS -I${abook_cv_curses}/include" + fi +fi + + +echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6 +echo "configure:1737: checking for initscr in -lncurses" >&5 +ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lncurses $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lncurses" + if test x$abook_cv_curses = x/usr -a -d /usr/include/ncurses; then + CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses" + fi + for ac_hdr in ncurses.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1779: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +else + echo "$ac_t""no" 1>&6 + +echo $ac_n "checking for initscr""... $ac_c" 1>&6 +echo "configure:1819: checking for initscr" >&5 +if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_initscr) || defined (__stub___initscr) +choke me +#else +initscr(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_initscr=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_initscr=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'initscr`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 + +case $host_os in #(vi +freebsd*) #(vi + echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 +echo "configure:1868: checking for tgoto in -lmytinfo" >&5 +ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lmytinfo $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="-lmytinfo $LIBS" +else + echo "$ac_t""no" 1>&6 +fi + + ;; +hpux10.*|hpux11.*) + echo $ac_n "checking for initscr in -lcur_colr""... $ac_c" 1>&6 +echo "configure:1910: checking for initscr in -lcur_colr" >&5 +ac_lib_var=`echo cur_colr'_'initscr | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lcur_colr $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + LIBS="-lcur_colr $LIBS" + CFLAGS="-I/usr/include/curses_colr $CFLAGS" + ac_cv_func_initscr=yes + +else + echo "$ac_t""no" 1>&6 + + echo $ac_n "checking for initscr in -lHcurses""... $ac_c" 1>&6 +echo "configure:1953: checking for initscr in -lHcurses" >&5 +ac_lib_var=`echo Hcurses'_'initscr | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lHcurses $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + # HP's header uses __HP_CURSES, but user claims _HP_CURSES. + LIBS="-lHcurses $LIBS" + CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS" + ac_cv_func_initscr=yes + +else + echo "$ac_t""no" 1>&6 +fi + +fi + + ;; +linux*) # Suse Linux does not follow /usr/lib convention + LIBS="$LIBS -L/lib" + ;; +esac + +if test ".$With5lib" != ".no" ; then +if test -d /usr/5lib ; then + # SunOS 3.x or 4.x + CPPFLAGS="$CPPFLAGS -I/usr/5include" + LIBS="$LIBS -L/usr/5lib" +fi +fi + +if test ".$ac_cv_func_initscr" != .yes ; then + cf_save_LIBS="$LIBS" + cf_term_lib="" + cf_curs_lib="" + + # Check for library containing tgoto. Do this before curses library + # because it may be needed to link the test-case for initscr. + echo $ac_n "checking for tgoto""... $ac_c" 1>&6 +echo "configure:2021: checking for tgoto" >&5 +if eval "test \"`echo '$''{'ac_cv_func_tgoto'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_tgoto) || defined (__stub___tgoto) +choke me +#else +tgoto(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_tgoto=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_tgoto=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'tgoto`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cf_term_lib=predefined +else + echo "$ac_t""no" 1>&6 + + for cf_term_lib in termcap termlib unknown + do + echo $ac_n "checking for tgoto in -l$cf_term_lib""... $ac_c" 1>&6 +echo "configure:2070: checking for tgoto in -l$cf_term_lib" >&5 +ac_lib_var=`echo $cf_term_lib'_'tgoto | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-l$cf_term_lib $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + break +else + echo "$ac_t""no" 1>&6 +fi + + done + +fi + + + # Check for library containing initscr + test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" + for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown + do + echo $ac_n "checking for initscr in -l$cf_curs_lib""... $ac_c" 1>&6 +echo "configure:2119: checking for initscr in -l$cf_curs_lib" >&5 +ac_lib_var=`echo $cf_curs_lib'_'initscr | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-l$cf_curs_lib $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + break +else + echo "$ac_t""no" 1>&6 +fi + + done + test $cf_curs_lib = unknown && { echo "configure: error: no curses library found" 1>&2; exit 1; } + + LIBS="-l$cf_curs_lib $cf_save_LIBS" + if test "$cf_term_lib" = unknown ; then + echo $ac_n "checking if we can link with $cf_curs_lib library""... $ac_c" 1>&6 +echo "configure:2164: checking if we can link with $cf_curs_lib library" >&5 + cat > conftest.$ac_ext < +int main() { +initscr() +; return 0; } +EOF +if { (eval echo configure:2173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_result=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_result=no +fi +rm -f conftest* + echo "$ac_t""$cf_result" 1>&6 + test $cf_result = no && { echo "configure: error: Cannot link curses library" 1>&2; exit 1; } + elif test "$cf_term_lib" != predefined ; then + echo $ac_n "checking if we need both $cf_curs_lib and $cf_term_lib libraries""... $ac_c" 1>&6 +echo "configure:2187: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 + cat > conftest.$ac_ext < +int main() { +initscr(); tgoto((char *)0, 0, 0); +; return 0; } +EOF +if { (eval echo configure:2196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_result=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" + cat > conftest.$ac_ext < +int main() { +initscr() +; return 0; } +EOF +if { (eval echo configure:2213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_result=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_result=error +fi +rm -f conftest* + +fi +rm -f conftest* + echo "$ac_t""$cf_result" 1>&6 + fi +fi + + +fi + +fi + + + +for ac_func in resizeterm +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2240: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking for snprintf""... $ac_c" 1>&6 +echo "configure:2294: checking for snprintf" >&5 +if eval "test \"`echo '$''{'ac_cv_func_snprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char snprintf(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_snprintf) || defined (__stub___snprintf) +choke me +#else +snprintf(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_snprintf=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_snprintf=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'snprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_SNPRINTF 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6 +echo "configure:2345: checking for vsnprintf" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vsnprintf(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vsnprintf) || defined (__stub___vsnprintf) +choke me +#else +vsnprintf(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_vsnprintf=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vsnprintf=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vsnprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VSNPRINTF 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + +# Check whether --enable-debug or --disable-debug was given. +if test "${enable_debug+set}" = set; then + enableval="$enable_debug" + case "${enableval}" in + yes) debug=true ;; + no) debug=false ;; + *) { echo "configure: error: bad value ${enableval} for --enable-debug" 1>&2; exit 1; } ;; + esac +else + debug=false +fi + + +if test x$debug = xtrue; then + CPPFLAGS="-DDEBUG $CPPFLAGS" + CFLAGS="-g $CFLAGS" +fi + +if test x$GCC = xyes; then + CFLAGS="-Wall $CFLAGS" +fi + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@U@%$U%g +s%@ANSI2KNR@%$ANSI2KNR%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..0a49f8c --- /dev/null +++ b/configure.in @@ -0,0 +1,69 @@ +dnl abook configure.in + +AC_INIT(abook.c) +AM_INIT_AUTOMAKE(abook, 0.4.12pre1) +AM_CONFIG_HEADER(config.h) + +AC_CANONICAL_HOST + +AC_PROG_CC +AC_ISC_POSIX +AM_C_PROTOTYPES +if test "x$U" != "x"; then + AC_MSG_ERROR(Compiler not ANSI compliant) +fi +AC_C_INLINE +AC_PROG_INSTALL +AC_HEADER_STDC +AC_CHECK_HEADERS(unistd.h locale.h termios.h linux/termios.h sys/ioctl.h) +AC_CHECK_HEADER(stdarg.h,AC_DEFINE(HAVE_STDARG_H),AC_MSG_ERROR([*** stdarg.h is missing on your system ***])) +AC_CHECK_FUNCS(setlocale) + +dnl ------------------- +dnl (n)curses detection +dnl ------------------- + +abook_cv_curses=/usr +AC_ARG_WITH(curses, [ --with-curses=DIR Where ncurses is installed ], + [if test $withval != yes; then + abook_cv_curses=$withval + fi + if test x$abook_cv_curses != x/usr; then + LDFLAGS="-L${abook_cv_curses}/lib $LDFLAGS" + CPPFLAGS="$CPPFLAGS -I${abook_cv_curses}/include" + fi]) + +AC_CHECK_LIB(ncurses, initscr, + [LIBS="$LIBS -lncurses" + if test x$abook_cv_curses = x/usr -a -d /usr/include/ncurses; then + CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses" + fi + AC_CHECK_HEADERS(ncurses.h)], + [CF_CURSES_LIBS]) + +dnl -------------------------- +dnl end of (n)curses detection +dnl -------------------------- + +AC_CHECK_FUNCS(resizeterm) + +AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)],) +AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF)],) + +AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging support ], [case "${enableval}" in + yes) debug=true ;; + no) debug=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; + esac], [debug=false]) + +if test x$debug = xtrue; then + CPPFLAGS="-DDEBUG $CPPFLAGS" + CFLAGS="-g $CFLAGS" +fi + +if test x$GCC = xyes; then + CFLAGS="-Wall $CFLAGS" +fi + +AC_OUTPUT(Makefile) + diff --git a/database.c b/database.c new file mode 100644 index 0000000..03e20ed --- /dev/null +++ b/database.c @@ -0,0 +1,502 @@ + +/* + * database.c + * by JH + * + * Copyright (C) Jaakko Heinonen + */ + +#include +#include +#include +#include +#include +#include "abook_curses.h" +#include "abook.h" +#include "database.h" +#include "list.h" +#include "misc.h" +#include "options.h" +#include "filter.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +static void free_item(int i); + + +list_item *database = NULL; + +int items = 0; + +#define INITIAL_LIST_CAPACITY 30 + +int list_capacity = 0; + +extern int first_list_item; +extern int curitem; +extern char *selected; + +extern char *datafile; +extern char *rcfile; + +/* + * field definitions + */ + +#include "edit.h" + +/* + * notes about adding fields: + * - do not change any fields in TAB_CONTACT + * - do not add fields to contact tab + * - 6 fields per tab is maximum + * - reorganize the field numbers in database.h + */ + +struct abook_field abook_fields[ITEM_FIELDS] = { + {"Name", "name", TAB_CONTACT},/* NAME */ + {"E-mails", "email", TAB_CONTACT},/* EMAIL */ + {"Address", "address", TAB_ADDRESS},/* ADDRESS */ + {"City", "city", TAB_ADDRESS},/* CITY */ + {"State/Province","state", TAB_ADDRESS},/* STATE */ + {"ZIP/Postal Code","zip", TAB_ADDRESS},/* ZIP */ + {"Country", "country", TAB_ADDRESS},/* COUNTRY */ + {"Home Phone", "phone", TAB_PHONE},/* PHONE */ + {"Work Phone", "workphone", TAB_PHONE},/* WORKPHONE */ + {"Fax", "fax", TAB_PHONE},/* FAX */ + {"Mobile", "mobile", TAB_PHONE},/* MOBILEPHONE */ + {"Nickname/Alias", "nick", TAB_OTHER},/* NICK */ + {"URL", "url", TAB_OTHER},/* URL */ + {"Notes", "notes", TAB_OTHER},/* NOTES */ +}; + + +int +parse_database(FILE *in) +{ + char *line = NULL; + char *tmp; + int sec=0, i; + list_item item; + + memset(&item, 0, sizeof(item)); + + for(;;) { + line = getaline(in); + if( feof(in) ) { + if( item[NAME] && sec ) + add_item2database(item); + else + free_list_item(item); + break; + } + + if( !*line || *line == '\n' || *line == '#' ) { + free(line); + continue; + } else if( *line == '[' ) { + if( item[NAME] && sec ) + add_item2database(item); + else + free_list_item(item); + memset(&item, 0, sizeof(item)); + sec = 1; + if ( !(tmp = strchr(line, ']'))) + sec = 0; /*incorrect section lines are skipped*/ + } else if((tmp = strchr(line, '=') ) && sec ) { + *tmp++ = '\0'; + for(i=0; i _MAX_FIELD_LEN(i) ) ) { + tmp = item[i]; + item[i][_MAX_FIELD_LEN(i)-1] = 0; + item[i] = strdup(item[i]); + free(tmp); + } +} + + +static void +adjust_list_capacity() +{ + if(list_capacity < 1) + list_capacity = INITIAL_LIST_CAPACITY; + else if(items >= list_capacity) + list_capacity *= 2; + else if(list_capacity / 2 > items) + list_capacity /= 2; + else + return; + + database = abook_realloc(database, + sizeof(list_item) * list_capacity); + selected = abook_realloc(selected, list_capacity); +} + +int +add_item2database(list_item item) +{ + if( item[NAME] == NULL || ! *item[NAME] ) { + free_list_item(item); + return 1; + } + + if( ++items > list_capacity) + adjust_list_capacity(); + + validate_item(item); + + selected[LAST_ITEM] = 0; + itemcpy(database[LAST_ITEM], item); + + return 0; +} + +void +remove_items() +{ + int i, j; + + if( items < 1 || curitem < 0 ) + return; + + statusline_addstr("Remove selected item(s) (Y/n)"); + switch( getch() ) { + case '\r': + case 'y': + case 'Y': break; + default: + clear_statusline(); + return; + } + + if( ! selected_items() ) + selected[ curitem ] = 1; + + for( j = LAST_ITEM; j >= 0; j-- ) { + if( selected[j] ) { + free_item(j); /* added for .4 data_s_ */ + for( i = j; i < LAST_ITEM; i++ ) { + itemcpy(database[ i ], database[ i + 1 ]); + selected[ i ] = selected[ i + 1 ]; + } + items--; + } + } + + if( curitem > LAST_ITEM && items > 0 ) + curitem = LAST_ITEM; + + + adjust_list_capacity(); + + select_none(); + clear_statusline(); + refresh_list(); +} + +char * +get_surname(char *s) +{ + int i, a; + int len = strlen(s); + char *name = strdup(s); + + for( a = 0, i = len - 1; i >= 0; i--, a++ ) { + name[a] = s[i]; + if(name[a] == ' ') + break; + } + + name[ a ] = 0; + + revstr(name); + + return name; +} + +static int +surnamecmp(const void *i1, const void *i2) +{ + int ret; + list_item a,b; + char *s1, *s2; + + itemcpy(a, i1); + itemcpy(b, i2); + + s1 = get_surname(a[NAME]); + s2 = get_surname(b[NAME]); + + if( !(ret = safe_strcmp(s1, s2)) ) + ret = safe_strcmp(a[NAME], b[NAME]); + + free(s1); + free(s2); + + return ret; +} + +static int +namecmp(const void *i1, const void *i2) +{ + list_item a, b; + + itemcpy(a, i1); + itemcpy(b, i2); + + return safe_strcmp( a[NAME], b[NAME] ); +} + +void +sort_database() +{ + select_none(); + + qsort((void *)database, items, sizeof(list_item), namecmp); + + refresh_screen(); +} + +void +sort_surname() +{ + select_none(); + + qsort((void *)database, items, sizeof(list_item), surnamecmp); + + refresh_screen(); +} + +void +clear_database() +{ + + statusline_addstr("Clear WHOLE database (y/N)"); + switch( getch() ) { + case 'y': + case 'Y': break; + default: + clear_statusline(); + return; + } + + close_database(); + + refresh_screen(); +} + +void +find(int next) +{ + int i; + static char findstr[81]; + char tmp[81]; + +#ifdef DEBUG + fprintf(stderr, "find(): findstr = |%s|\n", findstr); +#endif + + if(next) { + if( !*findstr ) + return; + } else { + clear_statusline(); + statusline_addstr("/"); + statusline_getnstr(findstr, 67, 0); + strupper(findstr); + clear_statusline(); + } + + if(items < 1) + return; + + for( i = (curitem < LAST_ITEM) && next ? curitem+1 : curitem; + i < items; i++ ) { + strcpy(tmp, database[i][NAME]); + if( strstr(strupper(tmp), findstr) != NULL ) { + curitem = i; + refresh_list(); + break; + } + } +} + + +void +print_number_of_items() +{ + char *str = + mkstr(" |%3d/%3d", selected_items(), items); + + mvaddstr(0, COLS-strlen(str), str); + + free(str); +} + +void +read_database() +{ + if(items > 0) { + statusline_addstr("Your current data will be lost - Press 'y' to continue"); + switch( getch() ) { + case 'y': + case 'Y': break; + default: clear_statusline(); + return; + } + clear_statusline(); + } + + load_database(datafile); + refresh_list(); +} + + +void +print_database() +{ + FILE *handle; + char *command = options_get_str("print_command"); + + statusline_addstr("Print addressbook? (y/N)"); + switch( getch() ) { + case 'y': + case 'Y': + break; + default: clear_statusline(); return; + } + clear_statusline(); + + if( ! *command || (handle = popen(command, "w")) == NULL) + return; + + fexport("text", handle); + + pclose(handle); +} + diff --git a/database.h b/database.h new file mode 100644 index 0000000..9ab2c0c --- /dev/null +++ b/database.h @@ -0,0 +1,77 @@ +#ifndef _DATABASE_H +#define _DATABASE_H + + +#define MAX_EMAILS 4 +#define MAX_EMAIL_LEN 80 +#define MAX_EMAILSTR_LEN (MAX_EMAILS*MAX_EMAIL_LEN + MAX_EMAILS + 1) +#define MAX_FIELD_LEN 81 + +enum { + NAME, + EMAIL, + ADDRESS, + CITY, + STATE, + ZIP, + COUNTRY, + PHONE, + WORKPHONE, + FAX, + MOBILEPHONE, + NICK, + URL, + NOTES +}; + +#define LAST_FIELD NOTES + +#define ITEM_FIELDS (LAST_FIELD+1) + +typedef char * list_item[ITEM_FIELDS]; + +struct abook_field { + char *name; + char *key; + int tab; +}; + +int parse_database(FILE *in); +int write_database(FILE *out); +int load_database(char *filename); +int save_database(); +void close_database(); +int add_item2database(list_item item); +void free_list_item(list_item item); +void remove_items(); +void sort_surname(); +void sort_database(); +void clear_database(); +void find(int next); +void print_number_of_items(); +void read_database(); +char *get_surname(char *s); +void print_database(); + +#define LAST_ITEM (items - 1) + +#define itemcpy(dest, src) memmove(dest, src, sizeof(list_item)) + +#define split_emailstr(item, emails) do {\ + int _i,_j,_k,len; \ + memset(&emails, 0, sizeof(emails) ); \ + len = strlen(database[item][EMAIL]); \ + for( _i=0,_j=0, _k=0; _i < len && _j < 4; _i++ ) { \ + if( database[item][EMAIL][_i] ==',' ) { \ + _j++; \ + _k = 0; \ + } else \ + if( _k < MAX_EMAIL_LEN -1 ) \ + emails[_j][_k++] = database[item][EMAIL][_i]; \ + } \ +} while(0) + +#define have_multiple_emails(item) \ + strchr(database[item][EMAIL], ',') + +#endif diff --git a/edit.c b/edit.c new file mode 100644 index 0000000..50363f3 --- /dev/null +++ b/edit.c @@ -0,0 +1,417 @@ + +/* + * edit.c + * by JH + * + * Copyright (C) Jaakko Heinonen + */ + +#include +#include +#include "abook_curses.h" +#include "abook.h" +#include "database.h" +#include "list.h" +#include "edit.h" +#include "misc.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* + * some extern variables + */ + +extern struct abook_field abook_fields[]; + +extern list_item *database; +extern int curitem; +extern int items; + +WINDOW *editw; + +static void +editor_tab(int tab) +{ + int i; + char *tab_names[] = { + "/ CONTACT \\", + "/ ADDRESS \\", + "/ PHONE \\", + "/ OTHER \\" + }; + + mvwhline(editw, TABLINE+1, 0, ACS_HLINE, EDITW_COLS); + + for(i=0; i < TABS; i++) + mvwaddstr(editw, TABLINE, 16 * i + 3, tab_names[i]); + + mvwaddstr(editw, TABLINE+1, 16 * tab + 2, "/ \\"); +} + +void +get_first_email(char *str, int item) +{ + char *tmp; + + if(database[item][EMAIL] == NULL) { + *str = 0; + return; + } + + strncpy(str, database[item][EMAIL], MAX_EMAIL_LEN); + if( (tmp = strchr(str, ',')) ) + *tmp=0; + else + str[MAX_EMAIL_LEN-1] = 0; +} + +static void +roll_emails(int item) +{ + char tmp[MAX_EMAILSTR_LEN]; + char *p; + + strcpy(tmp, database[item][EMAIL]); + + if( !(p = strchr(tmp, ',')) ) + return; + else + *p=0; + + strcpy(database[item][EMAIL], p+1); + strcat(database[item][EMAIL], ","); + strcat(database[item][EMAIL], tmp); +} + +static void +init_editor() +{ + clear(); + editw = newwin(EDITW_LINES, EDITW_COLS, EDITW_TOP, EDITW_X); + + refresh_statusline(); +} + +/* + * we have to introduce edit_undo here + */ +static void edit_undo(int item, int mode); + +enum { + BACKUP_ITEM, + RESTORE_ITEM, + CLEAR_UNDO +}; + + +static void +close_editor() +{ + edit_undo(-1, CLEAR_UNDO); + delwin(editw); + refresh_screen(); +} + +static void +print_editor_header(int item) +{ + char *header; + char email[MAX_EMAIL_LEN]; + int i, x, len; + + if( (header = (char *)malloc(EDITW_COLS)) == NULL ) + return; + + get_first_email(email, item); + + if( snprintf(header, EDITW_COLS, "%s <%s>", database[item][NAME], + email ) == -1 || !*database[item][EMAIL] ) + if( snprintf(header, EDITW_COLS, "%s", database[item][NAME]) == -1) { + free(header); + return; + } + + len = strlen(header); + x = (EDITW_COLS - len) / 2; + mvwaddstr(editw, 0, x, header); + for(i = x; i < x + len; i++) + mvwaddch(editw,1, i, '^'); + free(header); +} + +static void +editor_print_data(int tab, int item) +{ + const int pos_x = EDITW_COLS > 70 ? 8:4; + int i, j; + + for(i = 0, j = 1; i < ITEM_FIELDS; i++) { + if(abook_fields[i].tab != tab) + continue; + + if(i==EMAIL) { /* special field */ + int k; + char emails[MAX_EMAILS][MAX_EMAIL_LEN]; + split_emailstr(item, emails); + mvwaddstr(editw, (LINES > 21 ? 7:6), pos_x, "E-mail addresses:"); + for(k=0; k < MAX_EMAILS; k++) + mvwprintw(editw, (LINES > 21 ? 9:7)+k*2, pos_x, + "%c -\t\t%s", '2' + k, emails[k] ); + continue; + } + + mvwprintw(editw, 3+j*2, pos_x, "%d - %s", + j, + abook_fields[i].name); + mvwaddch(editw, 3+j*2, 28, ':'); + mvwaddstr(editw, 3+j*2, 30, safe_str(database[item][i])); + j++; + } +} + +/* + * function: change_field + * + * parameters: + * (char *msg) + * message to display as a prompt + * (char **field) + * a pointer to pointer which will point a new string. if the latter + * pointer != NULL it will be freed (if user doesn't cancel) + * + * returns (int) + * a nonzero value if user has cancelled and zero if user has typed a + * valid string + */ + +static int +change_field(char *msg, char **field) +{ + char tmp[MAX_FIELD_LEN]; + int max_len = MAX_FIELD_LEN; + int ret; + + if( !strncmp("E-mail", msg, 6) ) + max_len = MAX_EMAIL_LEN; + + statusline_addstr(msg); + if( (ret = statusline_getnstr( tmp, max_len - 1, 0 ) ? 1:0 ) ) { + my_free(*field); + if( *tmp ) + *field = strdup(tmp); + } + + clear_statusline(); + refresh_statusline(); + + return !ret; +} + +static void +change_name_field(char **field) +{ + char *tmp; + + tmp = strdup(*field); + change_field("Name: ", field); + + if( *field == NULL || ! **field ) { + my_free(*field); + *field = strdup(tmp); + } + + my_free(tmp); +} + +static void +fix_email_str(char *str) +{ + for(; *str; str++ ) + *str = *str == ',' ? '_' : *str; +} + +static void +edit_emails(char c, int item) +{ + char *field = NULL; + char emails[4][MAX_EMAIL_LEN]; + char tmp[MAX_EMAILSTR_LEN] = ""; + int i, len; + + split_emailstr(item, emails); + + if(change_field("E-mail: ", &field)) { + fprintf(stderr, "change_field = TRUE\n"); + return; /* user cancelled ( C-g ) */ + } + if(field) { + strncpy(emails[c - '2'], field, MAX_EMAIL_LEN); + fix_email_str(emails[c - '2']); + } else + *emails[c - '2'] = 0; + + my_free(database[item][EMAIL]); + + for(i=0; i<4; i++) { + if( *emails[i] ) { + strcat(tmp, emails[i]); + strcat(tmp, ","); + } + } + + len = strlen(tmp); + if(tmp[len -1] == ',') + tmp[len-1] =0; + + database[item][EMAIL] = strdup(tmp); +} + +static int +edit_field(int tab, char c, int item) +{ + int i, j; + int n = c - '1' + 1; + char *str; + + if(n < 1 || n > 6) + return 0; + + edit_undo(item, BACKUP_ITEM); + + if(tab == TAB_CONTACT) { + switch(c) { + case '1': change_name_field(&database[item][NAME]); + break; + case '2': + case '3': + case '4': + case '5': edit_emails(c, item); break; + default: return 0; + } + return 1; + } + + for(i=0, j=0; i< ITEM_FIELDS; i++) { + if(abook_fields[i].tab == tab) + j++; + if(j==n) + break; + } + + if(j!=n) + return 0; + + str = mkstr("%s: ", abook_fields[i].name); + change_field(str, &database[item][i]); + + free(str); + + return 1; +} + +static void +edit_undo(int item, int mode) +{ + int i; + static list_item *backup = NULL; + + switch(mode) { + case CLEAR_UNDO: + if(backup) { + free_list_item(backup[0]); + my_free(backup); + } + break; + case BACKUP_ITEM: + if(backup) { + free_list_item(backup[0]); + my_free(backup); + } + backup = abook_malloc(sizeof(list_item)); + for(i = 0; i < ITEM_FIELDS; i++) + backup[0][i] = safe_strdup(database[item][i]); + break; + case RESTORE_ITEM: + if(backup) { + free_list_item(database[item]); + itemcpy(database[item], backup[0]); + my_free(backup); + } + break; + } +} + +static int +edit_loop(int item) +{ + static int tab = 0; /* first tab */ + int c; + + werase(editw); + headerline(EDITOR_HELPLINE); + print_editor_header(item); + editor_tab(tab); + editor_print_data(tab, item); + wmove(editw, EDITW_LINES - 1, EDITW_COLS - 1); + + refresh(); + wrefresh(editw); + + switch( (c = getch()) ) { + case 'c': tab = TAB_CONTACT; break; + case 'a': tab = TAB_ADDRESS; break; + case 'p': tab = TAB_PHONE; break; + case 'o': tab = TAB_OTHER; break; + case KEY_LEFT: tab = tab == 0 ? MAX_TAB : tab - 1; + break; + case KEY_RIGHT: tab = tab == MAX_TAB ? 0 : tab + 1; + break; + case 'r': roll_emails(item); break; + case '?': display_editor_help(editw); break; + case 'u': edit_undo(item, RESTORE_ITEM); break; + default: return edit_field(tab, c, item); + } + + return 1; +} + +void +edit_item(int item) +{ + if( item < 0 ) { + if( curitem < 0 ) + return; + else + item = curitem; + } + + init_editor(); + while( edit_loop(item) ) + ; + + close_editor(); +} + +void +add_item() +{ + char *field = NULL; + list_item item; + + change_field("Name: ", &field); + + if( field == NULL ) + return; + + memset(item, 0, sizeof(item)); + + item[NAME] = field; + + add_item2database(item); + + curitem = LAST_ITEM; + + edit_item(LAST_ITEM); +} + diff --git a/edit.h b/edit.h new file mode 100644 index 0000000..1b8c8f6 --- /dev/null +++ b/edit.h @@ -0,0 +1,28 @@ +#ifndef _EDIT_H +#define _EDIT_H + +void edit_item(int item); +void get_first_email(char *str, int item); +void add_item(); + +#define EDITW_COLS (COLS - 6) +#define EDITW_LINES (LINES - 5) +#define EDITW_TOP 2 +#define EDITW_X 3 + +#define EDITOR_HELPLINE "?:help c:contact a:address p:phone o:other" + +#define TABLINE 2 + +enum { + TAB_CONTACT, + TAB_ADDRESS, + TAB_PHONE, + TAB_OTHER +}; + +#define MAX_TAB TAB_OTHER + +#define TABS (MAX_TAB+1) + +#endif diff --git a/estr.c b/estr.c new file mode 100644 index 0000000..9f8d7f0 --- /dev/null +++ b/estr.c @@ -0,0 +1,610 @@ + +/* + * + * estr.c + * + * by JH + * + * Copyright (C) Jaakko Heinonen + * + */ + + +#define USE_FILESEL 1 +/*#undef USE_FILESEL*/ + +#define ABOOK_SRC 1 +/*#undef ABOOK_SRC*/ + +#include +#include +#include +#ifdef ABOOK_SRC +# include "abook_curses.h" +# include "options.h" +#else +# include +#endif +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include "estr.h" + +#if defined(HAVE_LOCALE_H) || defined(HAVE_SETLOCALE) +# include +#else +/* + * this is a quick and dirty hack and it is + * not likely to work well + */ +# undef iscntrl +# undef isprint +# define iscntrl(X) (X < 32) +# define isprint(X) (!iscntrl(X)) +#endif + +/* + * hmmm, these should be universal and nice :) + */ + +#define XCTRL(x) ((x) & 31) + +#define ENTER_KEY KEY_ENTER +#define BACKSPACE_KEY KEY_BACKSPACE +#define CANCEL_KEY XCTRL('g') +#define TAB_KEY '\t' + +#ifdef ABOOK_SRC +# include "abook.h" +# define MALLOC(X) abook_malloc(X) +# define REALLOC(X, XX) abook_realloc(X, XX) +#else +# define MALLOC(X) malloc(X) +# define REALLOC(X, XX) realloc(X, XX) +#endif + +/* introduce filesel */ +#ifdef USE_FILESEL +char *filesel(); +#endif + +#define INITIAL_BUFSIZE 100 + +char * +wenter_string(WINDOW *win, const int maxlen, const int flags) +{ + int i = 0; + int y, x; + int ch; + char *str = NULL; + int size = maxlen > 0 ? maxlen + 1 : INITIAL_BUFSIZE; + + getyx(win, y, x); + str = MALLOC(size); + + for( ;; ) { /* main loop */ + if(flags & ESTR_DONT_WRAP && x+i>COLS-2) { + mvwaddnstr(win, y, x, str+(1+x+i-COLS), COLS-x-1); + wmove(win, y, COLS-1); + wclrtoeol(win); + } else + wmove(win, y, x + i); + + wrefresh(win); + + switch( (ch = getch()) ) { + case ENTER_KEY: + case 10: + case 13: + goto out; + case BACKSPACE_KEY: + case 127: + if(i > 0) + mvwdelch(win, y, x + --i); + continue; + case CANCEL_KEY: + free(str); + return NULL; +#ifdef USE_FILESEL + case TAB_KEY: + if( ! (flags & ESTR_USE_FILESEL) ) + continue; + i = -1; + free(str); + str = filesel(); + goto out; +#endif + } + if( !isprint(ch) || iscntrl(ch) + || (maxlen > 0 && i + 1 > maxlen) ) + continue; + str[i++] = ch; + waddch(win,ch); + if( i + 1 > size ) + str = REALLOC( str, size *= 2 ); + if( maxlen > 0 && i > maxlen) + break; + } +out: + if( i >= 0 && str != NULL ) + str[i] = 0; + + return str; +} + + +#ifdef USE_FILESEL + +/* + * filesel.c + * by JH + * + * Copyright (C) Jaakko Heinonen + */ + +#include +#include +#include +#include +#include + + +#define FILESEL_STATUSLINE 2 + +#define FILESEL_LIST_TOP 4 +#define FILESEL_LIST_BOTTOM (LINES-2) + +#define FILESEL_LIST_LINES (FILESEL_LIST_BOTTOM-FILESEL_LIST_TOP) +#define FILESEL_LIST_COLS COLS + +#define FILESEL_LAST_LIST_ITEM ( filesel_first_list_item + FILESEL_LIST_LINES - 1 ) + + +#define FLSL_TYPE_DIR 0 +#define FLSL_TYPE_OTHER 1 + +struct filesel_list_item { + char filename[256]; + char type; +}; + +#ifndef ABOOK_SRC + +#include + +static char * +my_getcwd() +{ + char *dir = NULL; + int size = 100; + + dir = MALLOC(size); + + while( getcwd(dir, size) == NULL && errno == ERANGE ) + dir = REALLOC(dir, size *= 2); + + return dir; +} + +#else +# include "misc.h" +#endif + + +#define FILESEL_LAST_ITEM (filesel_items -1) + +int filesel_curitem = -1; +int filesel_first_list_item = -1; + +int filesel_items=0; +struct filesel_list_item *lst = NULL ; + +int filesel_list_capacity = 0; + +WINDOW *filesel_list; + +static void +filesel_close_list() +{ + free(lst); + lst = NULL; + filesel_items = 0; + filesel_first_list_item = filesel_curitem = -1; + filesel_list_capacity = 0; +} + +static void +filesel_init_list() +{ + filesel_list = newwin(FILESEL_LIST_LINES, FILESEL_LIST_COLS, + FILESEL_LIST_TOP, 0); +} + +static void +init_filesel() +{ + if( isendwin() ) { + initscr(); + } + + cbreak(); noecho(); + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + filesel_init_list(); + clear(); +} + +static void +close_filesel() +{ + filesel_close_list(); + delwin(filesel_list); + clear(); + refresh(); + endwin(); +} + +static void +filesel_check_list() +{ + if( filesel_curitem < 0 && filesel_first_list_item < 0 && filesel_items > 0 ) + filesel_curitem = filesel_first_list_item = 0; +} + + +static int +filesel_add_filesel_list_item(struct filesel_list_item item) +{ + if( ++filesel_items > filesel_list_capacity) { + filesel_list_capacity = + filesel_list_capacity < 1 ? 30:filesel_list_capacity << 1; + lst = REALLOC(lst, filesel_list_capacity * + sizeof(struct filesel_list_item) ); + } + + lst[FILESEL_LAST_ITEM] = item; + + filesel_check_list(); + + return 0; +} + + +#define FILESEL_DIRS_FIRST +#define FILESEL_ALPHABETIC_ORDER + +#ifdef FILESEL_ALPHABETIC_ORDER +# ifndef FILESEL_DIRS_FIRST +# define FILESEL_DIRS_FIRST +# endif +#endif + +#ifdef FILESEL_ALPHABETIC_ORDER +static int +filenamecmp(const void *a, const void *b) +{ + return strcmp( ((struct filesel_list_item *)a) -> filename, + ((struct filesel_list_item *)b) -> filename ); +} +#endif + +static void +filesel_sort_list() +{ +#ifdef FILESEL_DIRS_FIRST + int i, j, fdp=0; + struct filesel_list_item tmp; + + while(lst[fdp].type == FLSL_TYPE_DIR) + if( ++fdp >= FILESEL_LAST_ITEM ) + return; + + for(i = fdp + 1; i < filesel_items; i++) { + if(lst[i].type == FLSL_TYPE_DIR ) { + tmp = lst[fdp]; + lst[fdp++] = lst[i]; + for( j = i; j > fdp ; j--) + lst[j] = lst[j - 1]; + lst[fdp] = tmp; + } + } +#endif +#ifdef FILESEL_ALPHABETIC_ORDER +#ifdef ABOOK_SRC + if( options_get_int("filesel_sort") ) { +#endif + if(fdp > 1) + qsort((void *)lst, fdp, sizeof(struct filesel_list_item), + filenamecmp ); + + qsort((void *)lst + fdp * sizeof(struct filesel_list_item), + FILESEL_LAST_ITEM - fdp + 1, + sizeof(struct filesel_list_item), + filenamecmp ); + +#ifdef ABOOK_SRC + } +#endif +#endif +} + +static void +filesel_refresh_statusline() +{ + char *p = NULL; + + move(FILESEL_STATUSLINE,0); + clrtoeol(); + + mvaddnstr(FILESEL_STATUSLINE, 5, + ( p = my_getcwd() ), COLS-5 ); + + free(p); +} + +static void +filesel_highlight_line(WINDOW *win, int line) +{ + int i; + + wattron(win, A_STANDOUT); + + wmove(win, line, 0); + for(i = 0; i < FILESEL_LIST_COLS; i++) + waddch(win, ' '); +} + +static void +filesel_print_list_line(int i, int line) +{ + if( lst[i].type == FLSL_TYPE_DIR ) + wattron(filesel_list, A_BOLD); + + mvwaddnstr(filesel_list, line, 5, lst[i].filename, COLS - 5); +} + +static void +filesel_refresh_list() +{ + int i, line; + + werase(filesel_list); + + if( filesel_first_list_item < 0 || filesel_items < 1 ) { + refresh(); + wrefresh(filesel_list); + return; + } + + for( line = 0, i = filesel_first_list_item ; + i <= FILESEL_LAST_LIST_ITEM && i < filesel_items; line++, i++ ) { + + if(i == filesel_curitem) { + filesel_highlight_line(filesel_list, line); + wattron(filesel_list, A_STANDOUT); + } else + wattrset(filesel_list, 0); + + filesel_print_list_line(i, line); + } + + refresh(); + wrefresh(filesel_list); +} + +static void +filesel_scroll_up() +{ + if( filesel_curitem < 1 ) + return; + filesel_curitem--; + + if( filesel_first_list_item > 0 && filesel_curitem < filesel_first_list_item ) + filesel_first_list_item--; + + filesel_refresh_list(); +} + +static void +filesel_scroll_down() +{ + if( filesel_curitem > filesel_items - 2 ) + return; + filesel_curitem++; + + if( filesel_curitem > FILESEL_LAST_LIST_ITEM ) + filesel_first_list_item++; + + filesel_refresh_list(); +} + + +static void +filesel_page_up() +{ + if( filesel_curitem < 1 ) + return; + + if( filesel_curitem == filesel_first_list_item ) { + filesel_curitem = (filesel_curitem -= FILESEL_LIST_LINES) < 0 ? 0 : filesel_curitem; + filesel_first_list_item = filesel_curitem; + } else + filesel_curitem = filesel_first_list_item; + + filesel_refresh_list(); +} + +static void +filesel_page_down() +{ + if( filesel_curitem > filesel_items - 2 ) + return; + + if( filesel_curitem == FILESEL_LAST_LIST_ITEM ) { + filesel_curitem = (filesel_curitem += FILESEL_LIST_LINES) > FILESEL_LAST_ITEM ? + FILESEL_LAST_ITEM : filesel_curitem; + filesel_first_list_item = filesel_curitem - FILESEL_LIST_LINES + 1; + if( filesel_first_list_item < 0 ) + filesel_first_list_item = 0; + } else + filesel_curitem = FILESEL_LAST_LIST_ITEM < FILESEL_LAST_ITEM ? + FILESEL_LAST_LIST_ITEM : FILESEL_LAST_ITEM; + + filesel_refresh_list(); +} + + +static void +filesel_goto_home() +{ + if(filesel_items > 0) { + filesel_first_list_item = 0; + filesel_curitem = 0; + } + filesel_refresh_list(); +} + +static void +filesel_goto_end() +{ + if(filesel_items > 0) { + filesel_curitem = FILESEL_LAST_ITEM; + filesel_first_list_item = filesel_curitem - FILESEL_LIST_LINES + 1; + if( filesel_first_list_item < 0 ) + filesel_first_list_item = 0; + } + filesel_refresh_list(); +} + + +static int +filesel_read_dir() +{ + DIR *dir; + struct dirent *entry; + struct stat st; + struct filesel_list_item item; + + dir = opendir("."); + for(;;) { + entry = readdir(dir); + + if(entry == NULL) + break; + + stat(entry->d_name, &st); + strcpy(item.filename, entry->d_name); + item.type = S_ISDIR(st.st_mode) ? + FLSL_TYPE_DIR : FLSL_TYPE_OTHER; + filesel_add_filesel_list_item(item); + } + + closedir(dir); + filesel_sort_list(); + filesel_check_list(); + filesel_refresh_statusline(); + filesel_refresh_list(); + + return 0; +} + +static int +filesel_enter() +{ + char *dir, *newdir; + + if(lst[filesel_curitem].type == FLSL_TYPE_DIR) { + dir = my_getcwd(); + newdir = MALLOC(strlen(dir)+strlen(lst[filesel_curitem].filename) +2 ); + strcpy(newdir, dir); + strcat(newdir, "/"); + strcat(newdir,lst[filesel_curitem].filename); + free(dir); + if( (chdir(newdir)) != -1) { + filesel_close_list(); + filesel_read_dir(); + } + free(newdir); + return 0; + } else + return 1; +} + +static void +filesel_goto_item(int ch) +{ + int i; + + for(i=filesel_curitem+1; i FILESEL_LAST_LIST_ITEM) + filesel_first_list_item=filesel_curitem; + + filesel_refresh_list(); +} + + +static int +filesel_loop() +{ + int ch; + + for(;;) { + switch( (ch = getch()) ) { + case '\t': + case 'q': return 1; + case 'R': filesel_close_list(); filesel_read_dir(); + break; + case 'k': + case KEY_UP: filesel_scroll_up(); break; + case 'j': + case KEY_DOWN: filesel_scroll_down(); break; + case 'K': + case KEY_PPAGE: filesel_page_up(); break; + case 'J': + case KEY_NPAGE: filesel_page_down(); break; + + case KEY_HOME: filesel_goto_home(); break; + case KEY_END: filesel_goto_end(); break; + + case '\n': + case '\r': if( filesel_enter() ) { + return 0; + } + break; + default: filesel_goto_item(ch); + } + } +} + +char * +filesel() +{ + char *dir, *tmp, *ptr = NULL; + + init_filesel(); + filesel_read_dir(); + + if( !filesel_loop() ) { + dir = my_getcwd(); + tmp = MALLOC(strlen(dir) + strlen(lst[filesel_curitem].filename) + 2); + strcpy(tmp,dir); + strcat(tmp, "/"); + strcat(tmp, lst[filesel_curitem].filename); + ptr = strdup(tmp); + free(tmp); + free(dir); + } + + close_filesel(); + + return ptr; +} + +#endif /* USE_FILESEL */ + diff --git a/estr.h b/estr.h new file mode 100644 index 0000000..2455d48 --- /dev/null +++ b/estr.h @@ -0,0 +1,27 @@ + +/* + * + * estr.h + * + * by JH + * + * Copyright (C) Jaakko Heinonen + * + */ + +#ifndef _ESTR_H +#define _ESTR_H + + +/* + * + * + */ + +char *wenter_string(WINDOW *win, const int maxlen, const int flags); + +#define ESTR_USE_FILESEL 1 +#define ESTR_DONT_WRAP 2 + +#endif + diff --git a/filter.c b/filter.c new file mode 100644 index 0000000..f760f6b --- /dev/null +++ b/filter.c @@ -0,0 +1,1284 @@ + +/* + * filter.c for abook + * by JH + * + * Copyright (C) Jaakko Heinonen + */ + +#include +#include +#include +#include +#include +#include +#include "abook_curses.h" +#include "filter.h" +#include "abook.h" +#include "database.h" +#include "edit.h" +#include "list.h" +#include "misc.h" +#include "options.h" + +extern int items; +extern list_item *database; +extern struct abook_field abook_fields[]; + +/* + * function declarations + */ + +static int ldif_parse_file(FILE *handle); +static int mutt_parse_file(FILE *in); +static int pine_parse_file(FILE *in); + +static int ldif_export_database(FILE *out); +static int html_export_database(FILE *out); +static int pine_export_database(FILE *out); +static int csv_export_database(FILE *out); +static int gcrd_export_database(FILE *out); +static int mutt_alias_export(FILE *out); +static int elm_alias_export(FILE *out); +static int text_export_database(FILE *out); +static int spruce_export_database(FILE *out); + + +struct abook_filter i_filters[] = { + { "abook", "abook native format", parse_database }, + { "ldif", "ldif / Netscape addressbook", ldif_parse_file }, + { "mutt", "mutt alias (beta)", mutt_parse_file }, + { "pine", "pine addressbook", pine_parse_file }, + { "\0", NULL, NULL } +}; + +struct abook_filter e_filters[] = { + { "abook", "abook native format", write_database }, + { "ldif", "ldif / Netscape addressbook (.4ld)", ldif_export_database }, + { "mutt", "mutt alias", mutt_alias_export }, + { "html", "html document", html_export_database }, + { "pine", "pine addressbook", pine_export_database }, + { "gcrd", "GnomeCard (VCard) addressbook", gcrd_export_database }, + { "csv", "comma separated values", csv_export_database }, + { "elm", "elm alias", elm_alias_export }, + { "text", "plain text", text_export_database }, + { "spruce", "Spruce address book", spruce_export_database }, + { "\0", NULL, NULL } +}; + +/* + * common functions + */ + +void +print_filters() +{ + int i; + + puts("input:"); + for(i=0; *i_filters[i].filtname ; i++) + printf("\t%s\t%s\n", i_filters[i].filtname, + i_filters[i].desc); + + putchar('\n'); + + puts("output:"); + for(i=0; *e_filters[i].filtname ; i++) + printf("\t%s\t%s\n", e_filters[i].filtname, + e_filters[i].desc); + + putchar('\n'); +} + +static int +number_of_filters(struct abook_filter * filters) +{ + int i; + + for(i=0; *filters[i].filtname ; i++) + ; + + return i; +} + +static char * +get_real_name() +{ + char *username = getenv("USER"); + struct passwd *pwent; + int rtn; + char *tmp; + + pwent = getpwnam(username); + + if( (tmp = malloc(strlen(pwent->pw_gecos) +1)) == NULL) + return strdup(username); + + rtn = sscanf(pwent->pw_gecos, "%[^,]", tmp); + if (rtn == EOF || rtn == 0) { + free(tmp); + return strdup(username); + } else + return tmp; +} + +/* + * import + */ + +static int i_read_file(char *filename, int (*func) (FILE *in)); + +static void +import_screen() +{ + int i; + + clear(); + + refresh_statusline(); + headerline("import database"); + + mvaddstr(3, 1, "please select a filter"); + + + for(i=0; *i_filters[i].filtname ; i++) + mvprintw(5 + i, 6, "%c -\t%s\t%s\n", 'a' + i, + i_filters[i].filtname, + i_filters[i].desc); + + mvprintw(6 + i, 6, "x -\tcancel"); +} + +int +import_database() +{ + int filter; + char *filename; + int tmp = items; + + import_screen(); + + filter = getch() - 'a'; + if(filter == 'x' - 'a' || filter >= number_of_filters(e_filters) || + filter < 0) { + refresh_screen(); + return 1; + } + + mvaddstr(5+filter, 2, "->"); + + filename = ask_filename("Filename: ", 1); + if( !filename ) { + refresh_screen(); + return 2; + } + + if( i_read_file(filename, i_filters[filter].func ) ) + statusline_msg("Error occured while opening the file"); + else + if( tmp == items ) + statusline_msg("Hmm.., file seems not to be a valid file"); + + refresh_screen(); + free(filename); + + return 0; +} + + + +static int +i_read_file(char *filename, int (*func) (FILE *in)) +{ + FILE *in; + int ret = 0; + + if( ( in = fopen( filename, "r" ) ) == NULL ) + return 1; + + ret = (*func) (in); + + fclose(in); + + return ret; +} + +int +import(char filtname[FILTNAME_LEN], char *filename) +{ + int i; + int tmp = items; + int ret = 0; + + for(i=0;; i++) { + if( ! strncmp(i_filters[i].filtname, filtname, FILTNAME_LEN) ) + break; + if( ! *i_filters[i].filtname ) { + i = -1; + break; + } + } + + if( i<0 ) + return -1; + + if( !strcmp(filename, "-") ) + ret = (*i_filters[i].func) (stdin); + else + ret = i_read_file(filename, i_filters[i].func); + + if( tmp == items ) + ret = 1; + + return ret; +} + +/* + * export + */ + +static int e_write_file(char *filename, int (*func) (FILE *in)); + +static void +export_screen() +{ + int i; + + clear(); + + + refresh_statusline(); + headerline("export database"); + + mvaddstr(3, 1, "please select a filter"); + + + for(i=0; *e_filters[i].filtname ; i++) + mvprintw(5 + i, 6, "%c -\t%s\t%s\n", 'a' + i, + e_filters[i].filtname, + e_filters[i].desc); + + mvprintw(6 + i, 6, "x -\tcancel"); +} + +int +export_database() +{ + int filter; + char *filename; + + export_screen(); + + filter = getch() - 'a'; + if(filter == 'x' - 'a' || filter >= number_of_filters(e_filters) || + filter < 0) { + refresh_screen(); + return 1; + } + + mvaddstr(5+filter, 2, "->"); + + filename = ask_filename("Filename: ", 0); + if( !filename ) { + refresh_screen(); + return 2; + } + + if( e_write_file(filename, e_filters[filter].func ) ) + statusline_msg("Error occured while exporting"); + + refresh_screen(); + free(filename); + + return 0; +} + +static int +e_write_file(char *filename, int (*func) (FILE *in)) +{ + FILE *out; + int ret = 0; + + if( (out = fopen(filename, "a")) == NULL ) + return 1; + + if( ftell(out) ) + return 1; + + ret = (*func) (out); + + fclose(out); + + return ret; +} + +int +fexport(char filtname[FILTNAME_LEN], FILE *handle) +{ + int i; + + for(i=0;; i++) { + if( ! strncmp(e_filters[i].filtname, filtname, FILTNAME_LEN) ) + break; + if( ! *e_filters[i].filtname ) { + i = -1; + break; + } + } + + return (e_filters[i].func) (handle); +} + + + +int +export(char filtname[FILTNAME_LEN], char *filename) +{ + int i; + int ret = 0; + + for(i=0;; i++) { + if( ! strncmp(e_filters[i].filtname, filtname, FILTNAME_LEN) ) + break; + if( ! *e_filters[i].filtname ) { + i = -1; + break; + } + } + + if( i<0 ) + return -1; + + if( !strcmp(filename, "-") ) + ret = (e_filters[i].func) (stdout); + else + ret = e_write_file(filename, e_filters[i].func); + + return ret; +} + +/* + * end of common functions + */ + +/* + * ldif import + */ + +#include "ldif.h" + +static void ldif_fix_string(char *str); + +#ifndef LINESIZE +# define LINESIZE 1024 +#endif + +#define LDIF_ITEM_FIELDS 15 + +typedef char* ldif_item[LDIF_ITEM_FIELDS]; + +static ldif_item ldif_field_names = { + "cn", + "mail", + "streetaddress", + "locality", + "st", + "postalcode", + "countryname", + "homephone", + "description", + "homeurl", + "facsimiletelephonenumber", + "cellphone", + "xmozillaanyphone", + "xmozillanickname", + "objectclass", /* this must be the last entry */ +}; + +static int ldif_conv_table[LDIF_ITEM_FIELDS] = { + NAME, /* "cn" */ + EMAIL, /* "mail" */ + ADDRESS, /* "streetaddress" */ + CITY, /* "locality" */ + STATE, /* "st" */ + ZIP, /* "postalcode" */ + COUNTRY, /* "countryname" */ + PHONE, /* "homephone" */ + NOTES, /* "description" */ + URL, /* "homeurl" */ + FAX, /* "facsimiletelephonenumber" */ + MOBILEPHONE, /* "cellphone" */ + WORKPHONE, /* "xmozillaanyphone" */ + NICK, /* "xmozillanickname" */ + -1, /* "objectclass" */ /* this must be the last entry */ +}; + + +static char * +ldif_read_line(FILE *in) +{ + char line[LINESIZE]; + char *buf=NULL; + char *ptr, *tmp; + long pos; + int i; + + for(i=1;;i++) { + pos = ftell(in); + fgets(line, LINESIZE, in); + + if( feof(in) ) + break; + + if(i == 1) { + buf = strdup(line); + continue; + } + + if(*line != ' ') { + fseek(in, pos, SEEK_SET); + break; + } + + ptr = (char *)&line; + while( *ptr == ' ') + ptr++; + + tmp = buf; + buf = strconcat(buf, ptr, NULL); + free(tmp); + } + + if( *buf == '#' ) { + free(buf); + return NULL; + } + + if(buf) { + int i,j; + for(i=0,j=0; j < strlen(buf); i++, j++) + buf[i] = buf[j] == '\n' ? buf[++j] : buf[j]; + } + + return buf; +} + +static void +ldif_add_item(ldif_item ldif_item) +{ + list_item abook_item; + int i; + + memset(abook_item, 0, sizeof(abook_item)); + + if( !ldif_item[LDIF_ITEM_FIELDS -1] ) + goto bail_out; + + + for(i=0; i < LDIF_ITEM_FIELDS; i++) { + if(ldif_conv_table[i] >= 0 && ldif_item[i] && *ldif_item[i] ) + abook_item[ldif_conv_table[i]] = strdup(ldif_item[i]); + } + + add_item2database(abook_item); + +bail_out: + for(i=0; i < LDIF_ITEM_FIELDS; i++) + my_free(ldif_item[i]); + +} + +static void +ldif_convert(ldif_item item, char *type, char *value) +{ + int i; + + if( !strcmp(type, "dn") ) { + ldif_add_item(item); + return; + } + + for(i=0; i < LDIF_ITEM_FIELDS; i++) { + if( !safe_strcmp(ldif_field_names[i], type) && *value ) { + if( i == LDIF_ITEM_FIELDS -1) /* this is a dirty hack */ + if( safe_strcmp("person", value)) + break; + if(item[i]) + my_free(item[i]); + item[i] = strdup(value); + } + } +} + +static int +ldif_parse_file(FILE *handle) +{ + char *line = NULL; + char *type, *value; + int vlen; + ldif_item item; + + memset(item, 0, sizeof(item)); + + do { + if( ! (line = ldif_read_line(handle)) ) + continue; + + if( -1 == ( str_parse_line(line, &type, &value, &vlen)) ) { + my_free(line); + continue; /* just skip the errors */ + } + + ldif_fix_string(value); + + ldif_convert(item, type, value); + + my_free(line); + } while ( !feof(handle) ); + + ldif_convert(item, "dn", ""); + + return 0; +} + +static void +ldif_fix_string(char *str) +{ + int i, j; + + for( i = 0, j = 0; j < strlen(str); i++, j++) + str[i] = ( str[j] == (char)0xc3 ? + (char) str[++j] + (char) 0x40 : + str[j] ); + + str[i] = 0; +} + +/* + * end of ldif import + */ + +/* + * mutt alias import filter + */ + +enum { + MUTT_ALIAS, + MUTT_NAME, + MUTT_EMAIL +}; + +static void +remove_newlines(char *buf) +{ + int i,j; + + for(i=0,j=0; j < strlen(buf); i++, j++) + buf[i] = buf[j] == '\n' ? buf[++j] : buf[j]; +} + +static int +mutt_read_line(FILE *in, char **alias, char **rest) +{ + char line[LINESIZE]; + char *ptr=(char *)&line; + char *tmp; + + fgets(line, LINESIZE, in); + remove_newlines(line); + + while( ISSPACE(*ptr) ) + ptr++; + + if( strncmp("alias", ptr, 5) ) { + return 1; + } + + ptr += 5; + + while( ISSPACE(*ptr) ) + ptr++; + + tmp = ptr; + + while( ! ISSPACE(*ptr) ) + ptr++; + + if( (*alias = malloc(ptr-tmp+1)) == NULL) + return 1; + + strncpy(*alias, tmp, ptr-tmp); + *(*alias+(ptr-tmp)) = 0; + + while( ISSPACE(*ptr) ) + ptr++; + + *rest = strdup(ptr); + + return 0; +} + +static void +mutt_parse_email(char *mutt_item[3]) +{ + char *tmp; + int i; + + if( (tmp = strchr(mutt_item[MUTT_NAME], '<')) ) + *tmp = 0; + else + return; + + mutt_item[MUTT_EMAIL] = strdup(tmp+1); + + if( (tmp = strchr(mutt_item[MUTT_EMAIL], '>')) ) + *tmp = 0; + + tmp = mutt_item[MUTT_NAME]; + + for(i=strlen(tmp)-1; i>0; i--) + if(ISSPACE(tmp[i])) + tmp[i] = 0; + else + break; + + mutt_item[MUTT_NAME] = strdup(tmp); + + free(tmp); +} + +static void +mutt_add_mutt_item(char *mutt_item[3]) +{ + list_item abook_item; + + memset(abook_item, 0, sizeof(abook_item)); + + abook_item[NAME] = safe_strdup(mutt_item[MUTT_NAME]); + abook_item[EMAIL] = safe_strdup(mutt_item[MUTT_EMAIL]); + abook_item[NICK] = safe_strdup(mutt_item[MUTT_ALIAS]); + + add_item2database(abook_item); +} + +static int +mutt_parse_file(FILE *in) +{ + char *mutt_item[3]; + + for(;;) { + + memset(mutt_item, 0, sizeof(mutt_item) ); + + if( mutt_read_line(in, &mutt_item[MUTT_ALIAS], + &mutt_item[MUTT_NAME]) ) + continue; + + mutt_parse_email(mutt_item); + + if( feof(in) ) { + free(mutt_item[MUTT_ALIAS]); + free(mutt_item[MUTT_NAME]); + free(mutt_item[MUTT_EMAIL]); + break; + } + + mutt_add_mutt_item(mutt_item); + + free(mutt_item[MUTT_ALIAS]); + free(mutt_item[MUTT_NAME]); + free(mutt_item[MUTT_EMAIL]); + } + + + return 0; +} + +/* + * end of mutt alias import filter + */ + +/* + * ldif export filter + */ + +static void +ldif_fput_type_and_value(FILE *out,char *type, char *value ) +{ + char *tmp; + + tmp = ldif_type_and_value(type, value, strlen(value)); + + fputs(tmp, out); + + free(tmp); +} + +static int +ldif_export_database(FILE *out) +{ + int i; + char email[MAX_EMAILSTR_LEN]; + + fprintf(out, "version: 1\n"); + for(i=0; i= 0) { + if(ldif_conv_table[j] == EMAIL) + ldif_fput_type_and_value(out, + ldif_field_names[j], email); + else if(database[i][ldif_conv_table[j]]) + ldif_fput_type_and_value(out, + ldif_field_names[j], + database[i][ldif_conv_table[j]]); + } + } + + fprintf(out, "objectclass: top\n" + "objectclass: person\n\n"); + } + + return 0; +} + +/* + * end of ldif export filter + */ + +/* + * html export filter + */ + +static void html_export_write_head(FILE *out, int extra_column); +static void html_export_write_tail(FILE *out); + +static int +html_export_database(FILE *out) +{ + char tmp[MAX_EMAILSTR_LEN]; + int i; + int extra_column = options_get_int("extra_column"); + + if( items < 1 ) + return 2; + + extra_column = (extra_column > 2 && extra_column < ITEM_FIELDS) ? + extra_column : PHONE; + + html_export_write_head(out, extra_column); + for( i = 0; i < items; i++ ) { + get_first_email(tmp, i); + fprintf(out, "\n%s\n", + tmp, + database[i][NAME] ); + + fprintf(out, "%s\n%s\n", + database[i][EMAIL], + safe_str(database[i][extra_column]) ); + fprintf(out, "\n\n"); + } + html_export_write_tail(out); + + return 0; +} + + +static void +html_export_write_head(FILE *out, int extra_column) +{ + char *realname = get_real_name(); + + fprintf(out, "\n\n %s's addressbook", + realname ); + fprintf(out, "\n\n\n"); + fprintf(out, "\n

%s's addressbook

\n", realname ); + fprintf(out, "

\n\n"); + + fprintf(out, "
\n"); + fprintf(out, "\n\n\n", + abook_fields[extra_column].name); + + free(realname); +} + +static void +html_export_write_tail(FILE *out) +{ + fprintf(out, "\n
NameE-mail address(es)%s
\n"); + fprintf(out, "\n\n\n"); +} + +/* + * end of html export filter + */ + +/* + * pine addressbook import filter + */ + +static void +pine_fixbuf(char *buf) +{ + int i,j; + + for(i=0,j=0; j < strlen(buf); i++, j++) + buf[i] = buf[j] == '\n' ? buf[++j] : buf[j]; +} + +static void +pine_convert_emails(char *s) +{ + int i; + char *tmp; + + if( s == NULL || *s != '(' ) + return; + + for(i=0; s[i]; i++ ) + s[i] = s[i+1]; + + if( ( tmp = strchr(s,')')) ) + *tmp=0; + + for(i=1; ( tmp = strchr(s, ',') ) != NULL ; i++, s=tmp+1 ) + if( i > 3 ) { + *tmp = 0; + break; + } + +} + +static void +pine_parse_buf(char *buf) +{ + list_item item; + char *start = buf; + char *end; + char tmp[400]; + int i, len, last; + int pine_conv_table[]= {NICK, NAME, EMAIL, -1, NOTES}; + + memset(&item, 0, sizeof(item) ); + + for(i=0, last=0; !last ; i++) { + if( ! (end = strchr(start, '\t')) ) + last=1; + + len = last ? strlen(start) : (int) (end-start); + len = min(len, 400-1); + + if(i < sizeof(pine_conv_table) / sizeof(*pine_conv_table) + && pine_conv_table[i] >= 0) { + strncpy(tmp, start, len); + tmp[len] = 0; + item[pine_conv_table[i]] = strdup(tmp); + } + start = end + 1; + } + + pine_convert_emails(item[EMAIL]); + add_item2database(item); +} + + +#define LINESIZE 1024 + +static int +pine_parse_file(FILE *in) +{ + char line[LINESIZE]; + char *buf=NULL; + char *ptr; + int i; + + fgets(line, LINESIZE, in); + + while(!feof(in)) { + for(i=2;;i++) { + buf = realloc(buf, i*LINESIZE); + if(i==2) + strcpy(buf, line); + fgets(line, LINESIZE, in); + ptr=(char *)&line; + if(*ptr != ' ' || feof(in) ) + break; + else + while( *ptr == ' ') ptr++; + + strcat(buf, ptr); + } + if( *buf == '#' ) + continue; + pine_fixbuf(buf); + + pine_parse_buf(buf); + + my_free(buf); + } + + return 0; +} + +/* + * end of pine addressbook import filter + */ + +/* + * pine addressbook export filter + * + * filter doesn't wrap the lines as it should but Pine seems to handle + * created files without problems - JH + */ + +static int +pine_export_database(FILE *out) +{ + int i; + + for(i=0; i < items; i++ ) { + fprintf(out, have_multiple_emails(i) ? + "%s\t%s\t(%s)\t\t%s\n" : "%s\t%s\t%s\t\t%s\n", + safe_str(database[i][NICK]), + safe_str(database[i][NAME]), + safe_str(database[i][EMAIL]), + safe_str(database[i][NOTES]) + ); + } + + return 0; +} + +/* + * end of pine addressbook export filter + */ + + +/* + * csv addressbook export filter + */ + +static int +csv_export_database(FILE *out) +{ + int i, j; + int csv_export_fields[] = { + NAME, + EMAIL, + PHONE, + NOTES, + -1 + }; + + for(i=0; i < items; i++ ) { + for(j = 0; csv_export_fields[j] >= 0; j++) { + fprintf(out, strchr(safe_str(database[i][csv_export_fields[j]]), ',') ? + "\"%s\"" : "%s", + safe_str(database[i][csv_export_fields[j]]) + ); + if(csv_export_fields[j+1] >= 0) + fputc(',', out); + } + fputc('\n', out); + } + + + + return 0; +} + +/* + * end of csv export filter + */ + + +/* + * GnomeCard (VCard) addressbook export filter + */ + +static int +gcrd_export_database(FILE *out) +{ + char emails[MAX_EMAILS][MAX_EMAIL_LEN]; + int i, j; + char *name; + + for(i=0; i < items; i++ ) { + fprintf(out, "BEGIN:VCARD\nFN:%s\n", + safe_str(database[i][NAME])); + + name = get_surname(database[i][NAME]); + for( j = strlen(database[i][NAME]) - 1; j >= 0; j-- ) { + if(database[i][NAME][j] == ' ') + break; + } + fprintf(out, "N:%s;%.*s\n", + safe_str(name), + j, + safe_str(database[i][NAME]) + ); + + free(name); + + if ( database[i][ADDRESS] ) + fprintf(out, "ADR:;;%s;%s;%s;%s;%s\n", + safe_str(database[i][ADDRESS]), + safe_str(database[i][CITY]), + safe_str(database[i][STATE]), + safe_str(database[i][ZIP]), + safe_str(database[i][COUNTRY]) + ); + + if (database[i][PHONE]) + fprintf(out, "TEL;HOME:%s\n", database[i][PHONE]); + if (database[i][WORKPHONE]) + fprintf(out, "TEL;WORK:%s\n", database[i][WORKPHONE]); + if (database[i][FAX]) + fprintf(out, "TEL;FAX:%s\n", database[i][FAX]); + if (database[i][MOBILEPHONE]) + fprintf(out, "TEL;CELL:%s\n", database[i][MOBILEPHONE]); + + if ( database[i][EMAIL] ) { + split_emailstr(i, emails); + for(j=0; j < MAX_EMAILS ; j++) { + if ( *emails[j] ) + fprintf(out, "EMAIL;INTERNET:%s\n", + emails[j]); + } + } + + if ( database[i][NOTES] ) + fprintf(out, "NOTE:%s\n", database[i][NOTES]); + if (database[i][URL]) + fprintf(out, "URL:%s\n", database[i][URL]); + + fprintf(out, "END:VCARD\n\n"); + + } + + return 0; +} + +/* + * end of GnomeCard export filter + */ + + +/* + * mutt alias export filter + */ + +static char * +mutt_alias_genalias(int i) +{ + char *tmp, *pos; + + if(database[i][NICK]) + return strdup(database[i][NICK]); + + tmp = strdup(database[i][NAME]); + + if( ( pos = strchr(tmp, ' ') ) ) + *pos = 0; + + strlower(tmp); + + return tmp; +} + +static int +mutt_alias_export(FILE *out) +{ + int i; + char email[MAX_EMAIL_LEN]; + char *alias = NULL; + + for(i=0; i\n": "alias %s %s%s\n", + alias, + database[i][NAME], + email); + my_free(alias); + } + + return 0; +} + +/* + * end of mutt alias export filter + */ + + +/* + * printable export filter + */ + +static int +text_export_database(FILE * out) +{ + char emails[MAX_EMAILS][MAX_EMAIL_LEN]; + int i, j; + char *realname = get_real_name(); + char *style = options_get_str("address_style"); + + fprintf(out, + "-----------------------------------------\n%s's address book\n" + "-----------------------------------------\n\n\n", + realname); + free(realname); + + for (i = 0; i < items; i++) { + fprintf(out, + "-----------------------------------------\n\n"); + fprintf(out, "%s", database[i][NAME]); + if (database[i][NICK]) + fprintf(out, "\n(%s)", database[i][NICK]); + fprintf(out, "\n"); + + if (*database[i][EMAIL]) { + fprintf(out, "\n"); + split_emailstr(i, emails); + for (j = 0; j < MAX_EMAILS; j++) + if (*emails[j]) + fprintf(out, "%s\n", emails[j]); + } + /* Print address */ + if (database[i][ADDRESS]) { + if (!safe_strcmp(style, "us")) { /* US like */ + fprintf(out, "\n%s", database[i][ADDRESS]); + if (database[i][CITY]) + fprintf(out, "\n%s", + database[i][CITY]); + if (database[i][STATE] || database[i][ZIP]) + fprintf(out, "\n%s %s", + safe_str(database[i] + [STATE]), + safe_str(database[i] + [ZIP])); + if (database[i][COUNTRY]) + fprintf(out, "\n%s", + database[i][COUNTRY]); + } + + else if (!safe_strcmp(style, "uk")) { /* UK like */ + for (j = ADDRESS; j <= COUNTRY; j++) + if (database[i][j]) + fprintf(out, "\n%s", + database[i][j]); + } else { /* EU like */ + fprintf(out, "\n%s", database[i][ADDRESS]); + if (database[i][ZIP] || database[i][CITY]) + fprintf(out, "\n%s %s", + safe_str(database[i][ZIP]), + safe_str(database[i] + [CITY])); + if (database[i][STATE]) + fprintf(out, "\n%s", + database[i][STATE]); + if (database[i][COUNTRY]) + fprintf(out, "\n%s", + database[i][COUNTRY]); + } + + fprintf(out, "\n"); + } + + if ((database[i][PHONE]) || (database[i][WORKPHONE]) || + (database[i][FAX]) || (database[i][MOBILEPHONE])) { + fprintf(out, "\n"); + for (j = PHONE; j <= MOBILEPHONE; j++) + if (database[i][j]) + fprintf(out, "%s: %s\n", + abook_fields[j].name, + database[i][j]); + } + + if (database[i][URL]) + fprintf(out, "\n%s\n", database[i][URL]); + if (database[i][NOTES]) + fprintf(out, "\n%s\n", database[i][NOTES]); + + fprintf(out, "\n"); + } + + fprintf(out, "-----------------------------------------\n"); + + return 0; +} + +/* + * end of printable export filter + */ + +/* + * elm alias export filter + */ + +static int +elm_alias_export(FILE *out) +{ + int i; + char email[MAX_EMAIL_LEN]; + char *alias = NULL; + + for(i=0; i + */ + +/* + * + * Copyright (c) 1992-1996 Regents of the University of Michigan. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of Michigan at Ann Arbor. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + * + */ + +#include +#include +#include +#include +#include +#include +#include "ldif.h" + +#define ISSPACE(c) isspace((unsigned char)c) + +#define LDAP_DEBUG_PARSE 0x800 +#define LDAP_DEBUG_ANY 0xffff +#define LDIF_LINE_WIDTH 76 /* maximum length of LDIF lines */ +#define LDIF_BASE64_LEN(vlen) (((vlen) * 4 / 3 ) + 3) + +#define LDIF_SIZE_NEEDED(tlen,vlen) \ + ((tlen) + 4 + LDIF_BASE64_LEN(vlen) \ + + ((LDIF_BASE64_LEN(vlen) + tlen + 3) / LDIF_LINE_WIDTH * 2 )) + + +#define Debug( level, fmt, arg1, arg2, arg3 ) + +#define RIGHT2 0x03 +#define RIGHT4 0x0f +#define CONTINUED_LINE_MARKER '\001' + +static char nib2b64[0x40f] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +static unsigned char b642nib[0x80] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f, + 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, + 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, + 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, + 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +/* + * str_parse_line - takes a line of the form "type:[:] value" and splits it + * into components "type" and "value". if a double colon separates type from + * value, then value is encoded in base 64, and parse_line un-decodes it + * (in place) before returning. + */ + +int +str_parse_line( + char *line, + char **type, + char **value, + int *vlen +) +{ + char *p, *s, *d, *byte, *stop; + char nib; + int i, b64; + + /* skip any leading space */ + while ( ISSPACE( *line ) ) { + line++; + } + *type = line; + + for ( s = line; *s && *s != ':'; s++ ) + ; /* NULL */ + if ( *s == '\0' ) { + Debug( LDAP_DEBUG_PARSE, "parse_line missing ':'\n", 0, 0, 0 ); + return( -1 ); + } + + /* trim any space between type and : */ + for ( p = s - 1; p > line && ISSPACE( *p ); p-- ) { + *p = '\0'; + } + *s++ = '\0'; + + /* check for double : - indicates base 64 encoded value */ + if ( *s == ':' ) { + s++; + b64 = 1; + + /* single : - normally encoded value */ + } else { + b64 = 0; + } + + /* skip space between : and value */ + while ( ISSPACE( *s ) ) { + s++; + } + + /* if no value is present, error out */ + if ( *s == '\0' ) { + Debug( LDAP_DEBUG_PARSE, "parse_line missing value\n", 0,0,0 ); + return( -1 ); + } + + /* check for continued line markers that should be deleted */ + for ( p = s, d = s; *p; p++ ) { + if ( *p != CONTINUED_LINE_MARKER ) + *d++ = *p; + } + *d = '\0'; + + *value = s; + if ( b64 ) { + stop = strchr( s, '\0' ); + byte = s; + for ( p = s, *vlen = 0; p < stop; p += 4, *vlen += 3 ) { + for ( i = 0; i < 3; i++ ) { + if ( p[i] != '=' && (p[i] & 0x80 || + b642nib[ p[i] & 0x7f ] > 0x3f) ) { + Debug( LDAP_DEBUG_ANY, + "invalid base 64 encoding char (%c) 0x%x\n", + p[i], p[i], 0 ); + return( -1 ); + } + } + + /* first digit */ + nib = b642nib[ p[0] & 0x7f ]; + byte[0] = nib << 2; + /* second digit */ + nib = b642nib[ p[1] & 0x7f ]; + byte[0] |= nib >> 4; + byte[1] = (nib & RIGHT4) << 4; + /* third digit */ + if ( p[2] == '=' ) { + *vlen += 1; + break; + } + nib = b642nib[ p[2] & 0x7f ]; + byte[1] |= nib >> 2; + byte[2] = (nib & RIGHT2) << 6; + /* fourth digit */ + if ( p[3] == '=' ) { + *vlen += 2; + break; + } + nib = b642nib[ p[3] & 0x7f ]; + byte[2] |= nib; + + byte += 3; + } + s[ *vlen ] = '\0'; + } else { + *vlen = (int) (d - s); + } + + return( 0 ); +} + +#if 0 + +/* + * str_getline - return the next "line" (minus newline) of input from a + * string buffer of lines separated by newlines, terminated by \n\n + * or \0. this routine handles continued lines, bundling them into + * a single big line before returning. if a line begins with a white + * space character, it is a continuation of the previous line. the white + * space character (nb: only one char), and preceeding newline are changed + * into CONTINUED_LINE_MARKER chars, to be deleted later by the + * str_parse_line() routine above. + * + * it takes a pointer to a pointer to the buffer on the first call, + * which it updates and must be supplied on subsequent calls. + */ + +char * +str_getline( char **next ) +{ + char *l; + char c; + + if ( *next == NULL || **next == '\n' || **next == '\0' ) { + return( NULL ); + } + + l = *next; + while ( (*next = strchr( *next, '\n' )) != NULL ) { + c = *(*next + 1); + if ( ISSPACE( c ) && c != '\n' ) { + **next = CONTINUED_LINE_MARKER; + *(*next+1) = CONTINUED_LINE_MARKER; + } else { + *(*next)++ = '\0'; + break; + } + (*next)++; + } + + return( l ); +} + +#endif + +void +put_type_and_value( char **out, char *t, char *val, int vlen ) +{ + unsigned char *byte, *p, *stop; + unsigned char buf[3]; + unsigned long bits; + char *save; + int i, b64, pad, len, savelen; + len = 0; + + /* put the type + ": " */ + for ( p = (unsigned char *) t; *p; p++, len++ ) { + *(*out)++ = *p; + } + *(*out)++ = ':'; + len++; + save = *out; + savelen = len; + *(*out)++ = ' '; + b64 = 0; + + stop = (unsigned char *) (val + vlen); + if ( isascii( val[0] ) && (ISSPACE( val[0] ) || val[0] == ':') ) { + b64 = 1; + } else { + for ( byte = (unsigned char *) val; byte < stop; + byte++, len++ ) { + if ( !isascii( *byte ) || !isprint( *byte ) ) { + b64 = 1; + break; + } + if ( len > LDIF_LINE_WIDTH ) { + *(*out)++ = '\n'; + *(*out)++ = ' '; + len = 1; + } + *(*out)++ = *byte; + } + } + if ( b64 ) { + *out = save; + *(*out)++ = ':'; + *(*out)++ = ' '; + len = savelen + 2; + /* convert to base 64 (3 bytes => 4 base 64 digits) */ + for ( byte = (unsigned char *) val; byte < stop - 2; + byte += 3 ) { + bits = (byte[0] & 0xff) << 16; + bits |= (byte[1] & 0xff) << 8; + bits |= (byte[2] & 0xff); + + for ( i = 0; i < 4; i++, len++, bits <<= 6 ) { + if ( len > LDIF_LINE_WIDTH ) { + *(*out)++ = '\n'; + *(*out)++ = ' '; + len = 1; + } + + /* get b64 digit from high order 6 bits */ + *(*out)++ = nib2b64[ (bits & 0xfc0000L) >> 18 ]; + } + } + + /* add padding if necessary */ + if ( byte < stop ) { + for ( i = 0; byte + i < stop; i++ ) { + buf[i] = byte[i]; + } + for ( pad = 0; i < 3; i++, pad++ ) { + buf[i] = '\0'; + } + byte = buf; + bits = (byte[0] & 0xff) << 16; + bits |= (byte[1] & 0xff) << 8; + bits |= (byte[2] & 0xff); + + for ( i = 0; i < 4; i++, len++, bits <<= 6 ) { + if ( len > LDIF_LINE_WIDTH ) { + *(*out)++ = '\n'; + *(*out)++ = ' '; + len = 1; + } + + /* get b64 digit from low order 6 bits */ + *(*out)++ = nib2b64[ (bits & 0xfc0000L) >> 18 ]; + } + + for ( ; pad > 0; pad-- ) { + *(*out - pad) = '='; + } + } + } + *(*out)++ = '\n'; +} + + +char * +ldif_type_and_value( char *type, char *val, int vlen ) +/* + * return malloc'd, zero-terminated LDIF line + */ +{ + char *buf, *p; + int tlen; + + tlen = strlen( type ); + if (( buf = (char *)malloc( LDIF_SIZE_NEEDED( tlen, vlen ) + 1 )) != + NULL ) { + } + + p = buf; + put_type_and_value( &p, type, val, vlen ); + *p = '\0'; + + return( buf ); +} + diff --git a/ldif.h b/ldif.h new file mode 100644 index 0000000..1672cfb --- /dev/null +++ b/ldif.h @@ -0,0 +1,16 @@ +#ifndef _LDIF_H +#define _LDIF_H + + +/* + * prototypes + */ + +int str_parse_line(char *line, char **type, + char **value, int *vlen); +char *str_getline( char **next ); +void put_type_and_value( char **out, char *t, char *val, int vlen ); +char *ldif_type_and_value( char *type, char *val, int vlen ); + + +#endif diff --git a/list.c b/list.c new file mode 100644 index 0000000..ce0f9ef --- /dev/null +++ b/list.c @@ -0,0 +1,292 @@ + +/* + * list.c + * by JH + * + * Copyright (C) Jaakko Heinonen + */ + +#include +#include +#include "abook_curses.h" +#include "abook.h" +#include "database.h" +#include "edit.h" +#include "list.h" +#include "misc.h" +#include "options.h" + +int curitem = -1; +int first_list_item = -1; +char *selected = NULL; + +extern int items; +extern list_item *database; +extern struct abook_field abook_fields[]; + +WINDOW *list = NULL; + +void +init_list() +{ + list = newwin(LIST_LINES, LIST_COLS, LIST_TOP, 0); + scrollok(list, TRUE); +} + +void +close_list() +{ + delwin(list); + list = NULL; +} + +void +refresh_list() +{ + int i, line; + + werase(list); + + print_number_of_items(); + + if( items < 1 ) { + refresh(); + wrefresh(list); + return; + } + + if(curitem < 0) + curitem = 0; + + if(first_list_item < 0) + first_list_item = 0; + + if(curitem < first_list_item) + first_list_item = curitem; + else if(curitem > LAST_LIST_ITEM) + first_list_item = max(curitem - LIST_LINES + 1, 0); + + for( line = 0, i = first_list_item ; i <= LAST_LIST_ITEM && i < items; + line++, i++ ) { + + if(i == curitem) + highlight_line(list, line); + + print_list_line(i, line); + + wstandend(list); + } + + wrefresh(list); +} + +void +print_list_line(int i, int line) +{ + char tmp[MAX_EMAILSTR_LEN]; + int extra_column = options_get_int("extra_column"); + int real_emaillen = (extra_column > 2 && extra_column < ITEM_FIELDS) ? + EMAILLEN : EMAILPOS - COLS; + + scrollok(list, FALSE); + + if( selected[i] ) + mvwaddch(list, line, 0, '*' ); + + mvwaddnstr(list, line, NAMEPOS, database[i][NAME], NAMELEN); + if( options_get_int( "show_all_emails" ) ) + mvwaddnstr(list, line, EMAILPOS, database[i][EMAIL], + real_emaillen); + else { + get_first_email(tmp, i); + mvwaddnstr(list, line, EMAILPOS, tmp, real_emaillen); + } + + if(extra_column > 2 && extra_column < ITEM_FIELDS) { + if( !database[i][extra_column] ) { + int extra_alternative = + options_get_int("extra_alternative"); + + if(extra_alternative > 2 && + extra_alternative < ITEM_FIELDS) + extra_column = extra_alternative; + } + mvwaddnstr(list, line, EXTRAPOS, + safe_str(database[i][extra_column]), + EXTRALEN); + } + + scrollok(list, TRUE); +} + + +void +list_headerline() +{ + int extra_column = options_get_int("extra_column"); + + attrset(A_BOLD); + mvaddstr(2, NAMEPOS, abook_fields[NAME].name); + mvaddstr(2, EMAILPOS, abook_fields[EMAIL].name); + if( extra_column > 2 && extra_column < ITEM_FIELDS ) + mvaddnstr(2, EXTRAPOS, abook_fields[extra_column].name, + COLS-EXTRAPOS); + attrset(A_NORMAL); +} + +void +scroll_up() +{ + if( curitem < 1 ) + return; + + curitem--; + + refresh_list(); +} + +void +scroll_down() +{ + if( curitem > items - 2 ) + return; + + curitem++; + + refresh_list(); +} + + +void +page_up() +{ + if( curitem < 1 ) + return; + + curitem = curitem == first_list_item ? + ((curitem -= LIST_LINES) < 0 ? 0 : curitem) : first_list_item; + + refresh_list(); +} + +void +page_down() +{ + if( curitem > items - 2 ) + return; + + curitem = curitem == LAST_LIST_ITEM ? + ((curitem += LIST_LINES) > LAST_ITEM ? LAST_ITEM : curitem) : + min(LAST_LIST_ITEM, LAST_ITEM); + + refresh_list(); +} + + +void +select_none() +{ + memset( selected, 0, items ); +} + +void +select_all() +{ + memset( selected, 1, items ); +} + +void +move_curitem(int direction) +{ + list_item tmp; + + if( curitem < 0 || curitem > LAST_ITEM ) + return; + + itemcpy(tmp, database[curitem]); + + switch(direction) { + case MOVE_ITEM_UP: + if( curitem < 1 ) + return; + itemcpy(database[curitem], database[curitem - 1]); + itemcpy(database[curitem-1], tmp); + scroll_up(); + break; + + case MOVE_ITEM_DOWN: + if( curitem >= LAST_ITEM ) + return; + itemcpy(database[curitem], database[curitem + 1]); + itemcpy(database[curitem+1], tmp); + scroll_down(); + break; + } +} + +void +goto_home() +{ + if(items > 0) + curitem = 0; + + refresh_list(); +} + +void +goto_end() +{ + if(items > 0) + curitem = LAST_ITEM; + + refresh_list(); +} + + +void +highlight_line(WINDOW *win, int line) +{ + wstandout(win); + +#ifdef mvwchgat + mvwchgat(win, line, 0, -1, A_STANDOUT, 0, NULL); +#else + /* + * buggy function: FIXME + */ + scrollok(win, FALSE); + { + int i; + wmove(win, line, 0); + for(i = 0; i < COLS; i++) + waddch(win, ' '); + /*wattrset(win, 0);*/ + } + scrollok(win, TRUE); +#endif +} + +int +selected_items() +{ + int i, a=0; + + for(i = 0; i < items; i++) + if(selected[i]) + a++; + + return a; +} + +void +invert_selection() +{ + int i; + + if( items < 1 ) + return; + + for(i = 0; i < items; i++) + selected[i] = !selected[i]; +} + diff --git a/list.h b/list.h new file mode 100644 index 0000000..f76928e --- /dev/null +++ b/list.h @@ -0,0 +1,45 @@ +#ifndef _LIST_H +#define _LIST_H + + +void init_list(); +void close_list(); +void refresh_list(); +void print_list_line(int i, int line); +void list_headerline(); +void scroll_up(); +void scroll_down(); +void page_up(); +void page_down(); +void select_none(); +void select_all(); +void move_curitem(int direction); +void goto_home(); +void goto_end(); +void highlight_line(WINDOW *win, int line); +int selected_items(); +void invert_selection(); + + +enum { + MOVE_ITEM_UP, + MOVE_ITEM_DOWN +}; + +#define LIST_TOP 3 +#define LIST_BOTTOM (LINES-3) + +#define LIST_LINES (LIST_BOTTOM-LIST_TOP) +#define LIST_COLS COLS + +#define NAMEPOS 2 +#define EMAILPOS options_get_int("emailpos") +#define EXTRAPOS options_get_int("extrapos") + +#define NAMELEN (EMAILPOS-NAMEPOS -1) +#define EMAILLEN (EXTRAPOS-EMAILPOS -1) +#define EXTRALEN (COLS-EXTRAPOS) + +#define LAST_LIST_ITEM ( first_list_item + LIST_LINES - 1 ) + +#endif diff --git a/misc.c b/misc.c new file mode 100644 index 0000000..0a58cb9 --- /dev/null +++ b/misc.c @@ -0,0 +1,1054 @@ + +/* + * misc.c + * by JH + * + * Copyright (C) Jaakko Heinonen + */ + +#define ABOOK_SRC 1 +/*#undef ABOOK_SRC*/ + +#include +#include +#include +#include +#include +#include +#include "misc.h" +#ifdef ABOOK_SRC +# include "abook.h" +#endif + +#ifndef DEBUG +# define NDEBUG 1 +#else +# undef NDEBUG +#endif + +#include + +char * +revstr(char *str) +{ + char *s, *s2; + + s = s2 = strdup(str); + + while( *str ) + str++; + + while( *s ) + *--str = *s++; + + free(s2); + return str; +} + +char * +strupper(char *str) +{ + char *tmp = str; + + while( ( *str = toupper( *str ) ) ) + str++; + + return tmp; +} + +char * +strlower(char *str) +{ + char *tmp = str; + + while( ( *str = tolower ( *str ) ) ) + str++; + + return tmp; +} + +char * +strtrim(char *s) +{ + char *t, *tt; + + assert(s != NULL); + + for(t = s; ISSPACE(*t); t++); + + memmove(s, t, strlen(t)+1); + + for (tt = t = s; *t != '\0'; t++) + if(!ISSPACE(*t)) + tt = t+1; + + *tt = '\0'; + + return s; +} + + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* varargs declarations: */ + +#ifdef HAVE_STDARG_H +# define MY_VA_LOCAL_DECL va_list ap +# define MY_VA_START(f) va_start(ap, f) +# define MY_VA_SHIFT(v,t) v = va_arg(ap, t) +# define MY_VA_END va_end(ap) +#else +# error HAVE_STDARG_H not defined +#endif + +char * +mkstr (const char *format, ... ) +{ + MY_VA_LOCAL_DECL; + int size = 100; + char *buffer = +#ifdef ABOOK_SRC + (char *) abook_malloc (size); +#else + (char *) malloc (size); +#endif + + for(;;) { + int n; + MY_VA_START(format); + n = vsnprintf (buffer, size, + format, ap); + MY_VA_END; + + if (n > -1) + return buffer; + + size *= 2; + + buffer = +#ifdef ABOOK_SRC + (char *) abook_realloc (buffer, size); +#else + (char *) realloc (buffer, size); +#endif + } +} + + +char* +strconcat (const char *str, ...) +{ + int l; + MY_VA_LOCAL_DECL; + char *s, *concat; + + if(str == NULL) + return NULL; + + l = 1 + strlen (str); + MY_VA_START(str); + MY_VA_SHIFT(s, char*); + while (s) { + l += strlen (s); + MY_VA_SHIFT(s, char*); + } + MY_VA_END; + + concat = (char *) +#ifdef ABOOK_SRC + abook_malloc(l); +#else + malloc(l); +#endif + + strcpy (concat, str); + MY_VA_START(str); + MY_VA_SHIFT(s, char*); + while (s) { + strcat (concat, s); + MY_VA_SHIFT(s, char*); + } + MY_VA_END; + + return concat; +} + + +int +safe_strcmp(const char *s1, const char * s2) +{ + if (s1 == NULL && s2 == NULL) return 0; + if (s1 == NULL) return -1; + if (s2 == NULL) return 1; + + return strcmp(s1, s2); +} + +char * +my_getcwd() +{ + char *dir = NULL; + int size = 100; + + dir = malloc(size); + + while( getcwd(dir, size) == NULL && errno == ERANGE ) + dir = realloc(dir, size *=2); + + return dir; +} + +#define INITIAL_SIZE 128 +#ifndef ABOOK_SRC +# define abook_malloc(X) malloc(X) +# define abook_realloc(X, XX) realloc(X, XX) +#endif + +char * +getaline(FILE *f) +{ + char *buf; /* buffer for line */ + size_t size; /* size of buffer */ + size_t inc; /* how much to enlarge buffer */ + size_t len; /* # of chars stored into buf before '\0' */ + char *p; + const size_t thres = 128; /* initial buffer size (most lines should + fit into this size, so think of this as + the "long line threshold"). */ + const size_t mucho = 128; /* if there is at least this much wasted + space when the whole buffer has been + read, try to reclaim it. Don't make + this too small, else there is too much + time wasted trying to reclaim a couple + of bytes. */ + const size_t mininc = 64; /* minimum number of bytes by which + to increase the allocated memory */ + + len = 0; + size = thres; + buf = abook_malloc(size); + + while (fgets(buf+len, size-len, f) != NULL) { + len += strlen(buf+len); + if (len > 0 && buf[len-1] == '\n') + break; /* the whole line has been read */ + + for (inc = size, p = NULL; inc > mininc; inc /= 2) + if ((p = abook_realloc(buf, size + inc)) != NULL) + break; + + size += inc; + buf = p; + } + + if (len == 0) { + free(buf); + return NULL; /* nothing read (eof or error) */ + } + + if (buf[len-1] == '\n') /* remove newline, if there */ + buf[--len] = '\0'; + + if (size - len > mucho) { /* a plenitude of unused memory? */ + p = abook_realloc(buf, len+1); + if (p != NULL) { + buf = p; + size = len+1; + } + } + + return buf; +} + +/************************************************************** + * Original: + * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 + * A bombproof version of doprnt (dopr) included. + * Sigh. This sort of thing is always nasty do deal with. Note that + * the version here does not include floating point... + * + * snprintf() is used instead of sprintf() as it does limit checks + * for string length. This covers a nasty loophole. + * + * The other functions are there to prevent NULL pointers from + * causing nast effects. + * + * More Recently: + * Brandon Long 9/15/96 for mutt 0.43 + * This was ugly. It is still ugly. I opted out of floating point + * numbers, but the formatter understands just about everything + * from the normal C string format, at least as far as I can tell from + * the Solaris 2.5 printf(3S) man page. + * + * Brandon Long 10/22/97 for mutt 0.87.1 + * Ok, added some minimal floating point support, which means this + * probably requires libm on most operating systems. Don't yet + * support the exponent (e,E) and sigfig (g,G). Also, fmtint() + * was pretty badly broken, it just wasn't being exercised in ways + * which showed it, so that's been fixed. Also, formated the code + * to mutt conventions, and removed dead code left over from the + * original. Also, there is now a builtin-test, just compile with: + * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm + * and run snprintf for results. + * + * Thomas Roessler 01/27/98 for mutt 0.89i + * The PGP code was using unsigned hexadecimal formats. + * Unfortunately, unsigned formats simply didn't work. + * + * Michael Elkins 03/05/98 for mutt 0.90.8 + * The original code assumed that both snprintf() and vsnprintf() were + * missing. Some systems only have snprintf() but not vsnprintf(), so + * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF. + * + **************************************************************/ + +#include "config.h" + +#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) + +#include +# include +#include + +/* Define this as a fall through, HAVE_STDARG_H is probably already set */ + +#if !defined(HAVE_STDARG_H) && !defined(HAVE_VARARGS_H) +# define HAVE_VARARGS_H 1 +#endif + +/* varargs declarations: */ + +#if defined(HAVE_STDARG_H) +/*# include */ +# define HAVE_STDARGS /* let's hope that works everywhere (mj) */ +# define VA_LOCAL_DECL va_list ap +# define VA_START(f) va_start(ap, f) +# define VA_SHIFT(v,t) ; /* no-op for ANSI */ +# define VA_END va_end(ap) +#else +# if defined(HAVE_VARARGS_H) +# include +# undef HAVE_STDARGS +# define VA_LOCAL_DECL va_list ap +# define VA_START(f) va_start(ap) /* f is ignored! */ +# define VA_SHIFT(v,t) v = va_arg(ap,t) +# define VA_END va_end(ap) +# else +/*XX ** NO VARARGS ** XX*/ +# endif +#endif + +/*int snprintf (char *str, size_t count, const char *fmt, ...);*/ +/*int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);*/ + +static void dopr (char *buffer, size_t maxlen, const char *format, + va_list args); +static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, + char *value, int flags, int min, int max); +static void fmtint (char *buffer, size_t *currlen, size_t maxlen, + long value, int base, int min, int max, int flags); +static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, + long double fvalue, int min, int max, int flags); +static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c ); + +/* + * dopr(): poor man's version of doprintf + */ + +/* format read states */ +#define DP_S_DEFAULT 0 +#define DP_S_FLAGS 1 +#define DP_S_MIN 2 +#define DP_S_DOT 3 +#define DP_S_MAX 4 +#define DP_S_MOD 5 +#define DP_S_CONV 6 +#define DP_S_DONE 7 + +/* format flags - Bits */ +#define DP_F_MINUS (1 << 0) +#define DP_F_PLUS (1 << 1) +#define DP_F_SPACE (1 << 2) +#define DP_F_NUM (1 << 3) +#define DP_F_ZERO (1 << 4) +#define DP_F_UP (1 << 5) +#define DP_F_UNSIGNED (1 << 6) + +/* Conversion Flags */ +#define DP_C_SHORT 1 +#define DP_C_LONG 2 +#define DP_C_LDOUBLE 3 + +#define char_to_int(p) (p - '0') +#define MAX(p,q) ((p >= q) ? p : q) + +static void dopr (char *buffer, size_t maxlen, const char *format, va_list args) +{ + char ch; + long value; + long double fvalue; + char *strvalue; + int min; + int max; + int state; + int flags; + int cflags; + size_t currlen; + + state = DP_S_DEFAULT; + currlen = flags = cflags = min = 0; + max = -1; + ch = *format++; + + while (state != DP_S_DONE) + { + if ((ch == '\0') || (currlen >= maxlen)) + state = DP_S_DONE; + + switch(state) + { + case DP_S_DEFAULT: + if (ch == '%') + state = DP_S_FLAGS; + else + dopr_outch (buffer, &currlen, maxlen, ch); + ch = *format++; + break; + case DP_S_FLAGS: + switch (ch) + { + case '-': + flags |= DP_F_MINUS; + ch = *format++; + break; + case '+': + flags |= DP_F_PLUS; + ch = *format++; + break; + case ' ': + flags |= DP_F_SPACE; + ch = *format++; + break; + case '#': + flags |= DP_F_NUM; + ch = *format++; + break; + case '0': + flags |= DP_F_ZERO; + ch = *format++; + break; + default: + state = DP_S_MIN; + break; + } + break; + case DP_S_MIN: + if (isdigit((unsigned char)ch)) + { + min = 10*min + char_to_int (ch); + ch = *format++; + } + else if (ch == '*') + { + min = va_arg (args, int); + ch = *format++; + state = DP_S_DOT; + } + else + state = DP_S_DOT; + break; + case DP_S_DOT: + if (ch == '.') + { + state = DP_S_MAX; + ch = *format++; + } + else + state = DP_S_MOD; + break; + case DP_S_MAX: + if (isdigit((unsigned char)ch)) + { + if (max < 0) + max = 0; + max = 10*max + char_to_int (ch); + ch = *format++; + } + else if (ch == '*') + { + max = va_arg (args, int); + ch = *format++; + state = DP_S_MOD; + } + else + state = DP_S_MOD; + break; + case DP_S_MOD: + /* Currently, we don't support Long Long, bummer */ + switch (ch) + { + case 'h': + cflags = DP_C_SHORT; + ch = *format++; + break; + case 'l': + cflags = DP_C_LONG; + ch = *format++; + break; + case 'L': + cflags = DP_C_LDOUBLE; + ch = *format++; + break; + default: + break; + } + state = DP_S_CONV; + break; + case DP_S_CONV: + switch (ch) + { + case 'd': + case 'i': + if (cflags == DP_C_SHORT) + value = va_arg (args, short int); + else if (cflags == DP_C_LONG) + value = va_arg (args, long int); + else + value = va_arg (args, int); + fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); + break; + case 'o': + flags |= DP_F_UNSIGNED; + if (cflags == DP_C_SHORT) + value = va_arg (args, unsigned short int); + else if (cflags == DP_C_LONG) + value = va_arg (args, unsigned long int); + else + value = va_arg (args, unsigned int); + fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags); + break; + case 'u': + flags |= DP_F_UNSIGNED; + if (cflags == DP_C_SHORT) + value = va_arg (args, unsigned short int); + else if (cflags == DP_C_LONG) + value = va_arg (args, unsigned long int); + else + value = va_arg (args, unsigned int); + fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); + break; + case 'X': + flags |= DP_F_UP; + case 'x': + flags |= DP_F_UNSIGNED; + if (cflags == DP_C_SHORT) + value = va_arg (args, unsigned short int); + else if (cflags == DP_C_LONG) + value = va_arg (args, unsigned long int); + else + value = va_arg (args, unsigned int); + fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags); + break; + case 'f': + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg (args, long double); + else + fvalue = va_arg (args, double); + /* um, floating point? */ + fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); + break; + case 'E': + flags |= DP_F_UP; + case 'e': + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg (args, long double); + else + fvalue = va_arg (args, double); + break; + case 'G': + flags |= DP_F_UP; + case 'g': + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg (args, long double); + else + fvalue = va_arg (args, double); + break; + case 'c': + dopr_outch (buffer, &currlen, maxlen, va_arg (args, int)); + break; + case 's': + strvalue = va_arg (args, char *); + if (max < 0) + max = maxlen; /* ie, no max */ + fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); + break; + case 'p': + strvalue = va_arg (args, void *); + fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); + break; + case 'n': + if (cflags == DP_C_SHORT) + { + short int *num; + num = va_arg (args, short int *); + *num = currlen; + } + else if (cflags == DP_C_LONG) + { + long int *num; + num = va_arg (args, long int *); + *num = currlen; + } + else + { + int *num; + num = va_arg (args, int *); + *num = currlen; + } + break; + case '%': + dopr_outch (buffer, &currlen, maxlen, ch); + break; + case 'w': + /* not supported yet, treat as next char */ + ch = *format++; + break; + default: + /* Unknown, skip */ + break; + } + ch = *format++; + state = DP_S_DEFAULT; + flags = cflags = min = 0; + max = -1; + break; + case DP_S_DONE: + break; + default: + /* hmm? */ + break; /* some picky compilers need this */ + } + } + if (currlen < maxlen - 1) + buffer[currlen] = '\0'; + else + buffer[maxlen - 1] = '\0'; +} + +static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, + char *value, int flags, int min, int max) +{ + int padlen, strln; /* amount to pad */ + int cnt = 0; + + if (value == 0) + { + value = ""; + } + + for (strln = 0; value[strln]; ++strln); /* strlen */ + padlen = min - strln; + if (padlen < 0) + padlen = 0; + if (flags & DP_F_MINUS) + padlen = -padlen; /* Left Justify */ + + while ((padlen > 0) && (cnt < max)) + { + dopr_outch (buffer, currlen, maxlen, ' '); + --padlen; + ++cnt; + } + while (*value && (cnt < max)) + { + dopr_outch (buffer, currlen, maxlen, *value++); + ++cnt; + } + while ((padlen < 0) && (cnt < max)) + { + dopr_outch (buffer, currlen, maxlen, ' '); + ++padlen; + ++cnt; + } +} + +/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ + +static void fmtint (char *buffer, size_t *currlen, size_t maxlen, + long value, int base, int min, int max, int flags) +{ + int signvalue = 0; + unsigned long uvalue; + char convert[20]; + int place = 0; + int spadlen = 0; /* amount to space pad */ + int zpadlen = 0; /* amount to zero pad */ + int caps = 0; + + if (max < 0) + max = 0; + + uvalue = value; + + if(!(flags & DP_F_UNSIGNED)) + { + if( value < 0 ) { + signvalue = '-'; + uvalue = -value; + } + else + if (flags & DP_F_PLUS) /* Do a sign (+/i) */ + signvalue = '+'; + else + if (flags & DP_F_SPACE) + signvalue = ' '; + } + + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ + + do { + convert[place++] = + (caps? "0123456789ABCDEF":"0123456789abcdef") + [uvalue % (unsigned)base ]; + uvalue = (uvalue / (unsigned)base ); + } while(uvalue && (place < 20)); + if (place == 20) place--; + convert[place] = 0; + + zpadlen = max - place; + spadlen = min - MAX (max, place) - (signvalue ? 1 : 0); + if (zpadlen < 0) zpadlen = 0; + if (spadlen < 0) spadlen = 0; + if (flags & DP_F_ZERO) + { + zpadlen = MAX(zpadlen, spadlen); + spadlen = 0; + } + if (flags & DP_F_MINUS) + spadlen = -spadlen; /* Left Justifty */ + +#ifdef DEBUG_SNPRINTF + dprint (1, (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n", + zpadlen, spadlen, min, max, place)); +#endif + + /* Spaces */ + while (spadlen > 0) + { + dopr_outch (buffer, currlen, maxlen, ' '); + --spadlen; + } + + /* Sign */ + if (signvalue) + dopr_outch (buffer, currlen, maxlen, signvalue); + + /* Zeros */ + if (zpadlen > 0) + { + while (zpadlen > 0) + { + dopr_outch (buffer, currlen, maxlen, '0'); + --zpadlen; + } + } + + /* Digits */ + while (place > 0) + dopr_outch (buffer, currlen, maxlen, convert[--place]); + + /* Left Justified spaces */ + while (spadlen < 0) { + dopr_outch (buffer, currlen, maxlen, ' '); + ++spadlen; + } +} + +static long double abs_val (long double value) +{ + long double result = value; + + if (value < 0) + result = -value; + + return result; +} + +static long double pow10 (int exp) +{ + long double result = 1; + + while (exp) + { + result *= 10; + exp--; + } + + return result; +} + +static long round (long double value) +{ + long intpart; + + intpart = value; + value = value - intpart; + if (value >= 0.5) + intpart++; + + return intpart; +} + +static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, + long double fvalue, int min, int max, int flags) +{ + int signvalue = 0; + long double ufvalue; + char iconvert[20]; + char fconvert[20]; + int iplace = 0; + int fplace = 0; + int padlen = 0; /* amount to pad */ + int zpadlen = 0; + int caps = 0; + long intpart; + long fracpart; + + /* + * AIX manpage says the default is 0, but Solaris says the default + * is 6, and sprintf on AIX defaults to 6 + */ + if (max < 0) + max = 6; + + ufvalue = abs_val (fvalue); + + if (fvalue < 0) + signvalue = '-'; + else + if (flags & DP_F_PLUS) /* Do a sign (+/i) */ + signvalue = '+'; + else + if (flags & DP_F_SPACE) + signvalue = ' '; + +#if 0 + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ +#endif + + intpart = ufvalue; + + /* + * Sorry, we only support 9 digits past the decimal because of our + * conversion method + */ + if (max > 9) + max = 9; + + /* We "cheat" by converting the fractional part to integer by + * multiplying by a factor of 10 + */ + fracpart = round ((pow10 (max)) * (ufvalue - intpart)); + + if (fracpart >= pow10 (max)) + { + intpart++; + fracpart -= pow10 (max); + } + +#ifdef DEBUG_SNPRINTF + dprint (1, (debugfile, "fmtfp: %f =? %d.%d\n", fvalue, intpart, fracpart)); +#endif + + /* Convert integer part */ + do { + iconvert[iplace++] = + (caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10]; + intpart = (intpart / 10); + } while(intpart && (iplace < 20)); + if (iplace == 20) iplace--; + iconvert[iplace] = 0; + + /* Convert fractional part */ + do { + fconvert[fplace++] = + (caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10]; + fracpart = (fracpart / 10); + } while(fracpart && (fplace < 20)); + if (fplace == 20) fplace--; + fconvert[fplace] = 0; + + /* -1 for decimal point, another -1 if we are printing a sign */ + padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); + zpadlen = max - fplace; + if (zpadlen < 0) + zpadlen = 0; + if (padlen < 0) + padlen = 0; + if (flags & DP_F_MINUS) + padlen = -padlen; /* Left Justifty */ + + if ((flags & DP_F_ZERO) && (padlen > 0)) + { + if (signvalue) + { + dopr_outch (buffer, currlen, maxlen, signvalue); + --padlen; + signvalue = 0; + } + while (padlen > 0) + { + dopr_outch (buffer, currlen, maxlen, '0'); + --padlen; + } + } + while (padlen > 0) + { + dopr_outch (buffer, currlen, maxlen, ' '); + --padlen; + } + if (signvalue) + dopr_outch (buffer, currlen, maxlen, signvalue); + + while (iplace > 0) + dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); + + /* + * Decimal point. This should probably use locale to find the correct + * char to print out. + */ + dopr_outch (buffer, currlen, maxlen, '.'); + + while (fplace > 0) + dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); + + while (zpadlen > 0) + { + dopr_outch (buffer, currlen, maxlen, '0'); + --zpadlen; + } + + while (padlen < 0) + { + dopr_outch (buffer, currlen, maxlen, ' '); + ++padlen; + } +} + +static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) +{ + if (*currlen < maxlen) + buffer[(*currlen)++] = c; +} +#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */ + +#ifndef HAVE_VSNPRINTF +int vsnprintf (char *str, size_t count, const char *fmt, va_list args) +{ + str[0] = 0; + dopr(str, count, fmt, args); + return(strlen(str)); +} +#endif /* !HAVE_VSNPRINTF */ + +#ifndef HAVE_SNPRINTF +/* VARARGS3 */ +#ifdef HAVE_STDARGS +int snprintf (char *str,size_t count,const char *fmt,...) +#else +int snprintf (va_alist) va_dcl +#endif +{ +#ifndef HAVE_STDARGS + char *str; + size_t count; + char *fmt; +#endif + VA_LOCAL_DECL; + + VA_START (fmt); + VA_SHIFT (str, char *); + VA_SHIFT (count, size_t ); + VA_SHIFT (fmt, char *); + (void) vsnprintf(str, count, fmt, ap); + VA_END; + return(strlen(str)); +} + +#ifdef TEST_SNPRINTF +#ifndef LONG_STRING +#define LONG_STRING 1024 +#endif +int main (void) +{ + char buf1[LONG_STRING]; + char buf2[LONG_STRING]; + char *fp_fmt[] = { + "%-1.5f", + "%1.5f", + "%123.9f", + "%10.5f", + "% 10.5f", + "%+22.9f", + "%+4.9f", + "%01.3f", + "%4f", + "%3.1f", + "%3.2f", + NULL + }; + double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, + 0.9996, 1.996, 4.136, 0}; + char *int_fmt[] = { + "%-1.5d", + "%1.5d", + "%123.9d", + "%5.5d", + "%10.5d", + "% 10.5d", + "%+22.33d", + "%01.3d", + "%4d", + NULL + }; + long int_nums[] = { -1, 134, 91340, 341, 0203, 0}; + int x, y; + int fail = 0; + int num = 0; + + printf ("Testing snprintf format codes against system sprintf...\n"); + + for (x = 0; fp_fmt[x] != NULL ; x++) + for (y = 0; fp_nums[y] != 0 ; y++) + { + snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]); + sprintf (buf2, fp_fmt[x], fp_nums[y]); + if (strcmp (buf1, buf2)) + { + printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", + fp_fmt[x], buf1, buf2); + fail++; + } + num++; + } + + for (x = 0; int_fmt[x] != NULL ; x++) + for (y = 0; int_nums[y] != 0 ; y++) + { + snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]); + sprintf (buf2, int_fmt[x], int_nums[y]); + if (strcmp (buf1, buf2)) + { + printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", + int_fmt[x], buf1, buf2); + fail++; + } + num++; + } + printf ("%d tests failed out of %d.\n", fail, num); +} +#endif /* SNPRINTF_TEST */ + +#endif /* !HAVE_SNPRINTF */ diff --git a/misc.h b/misc.h new file mode 100644 index 0000000..7cee128 --- /dev/null +++ b/misc.h @@ -0,0 +1,31 @@ +#ifndef _MISC_H +#define _MISC_H + +char *revstr(char *str); +char *strupper(char *str); +char *strlower(char *str); +char *strtrim(char *); + +char *mkstr (const char *format, ... ); +char *strconcat (const char *str, ...); + +int safe_strcmp(const char *s1, const char * s2); + +char *my_getcwd(); + +char *getaline(FILE *f); + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#ifndef HAVE_SNPRINTF +int snprintf (char *str, size_t count, const char *fmt, ...); +#endif +#ifndef HAVE_VSNPRINTF +int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); +#endif + +#endif diff --git a/missing b/missing new file mode 100755 index 0000000..cbe2b0e --- /dev/null +++ b/missing @@ -0,0 +1,188 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# 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, 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER([^):]*:\([^)]*\)).*/\1/p' configure.in` + if test -z "$files"; then + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^):]*\)).*/\1/p' configure.in` + test -z "$files" || files="$files.in" + else + files=`echo "$files" | sed -e 's/:/ /g'` + fi + test -z "$files" && files="config.h.in" + touch $files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print \ + | sed 's/^\(.*\).am$/touch \1.in/' \ + | sh + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..d0fd194 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id$ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/options.c b/options.c new file mode 100644 index 0000000..f9a1144 --- /dev/null +++ b/options.c @@ -0,0 +1,164 @@ + +/* + * options.c + * by JH + * + * Copyright (C) Jaakko Heinonen + */ + +#include +#include +#include +#include +#include "abook_curses.h" +#include "abook.h" +#include "options.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +struct conff_node *abook_config; + +static int rcfile_exist(); +static void default_options(); + +extern char *rcfile; + +static char * +abook_opt_conff_get_val(char *key) +{ + int tried; + char *value = NULL; + + + for(tried = 0; tried < 2; ) { + if( ( value = conff_get_value(abook_config, key) ) + == 0 ) { + tried ++; + default_options(); /* try with defaults */ + } else + return value; + } + return NULL; +} + +int +options_get_int(char *key) +{ + char *value; + int ret; + + if( ( value = abook_opt_conff_get_val(key) ) + == NULL) + return 1; + + if( !strcasecmp(value, "true") ) + ret = 1; + else + if( !strcasecmp(value, "false") ) + ret = 0; + else + ret = safe_atoi(value); + + return ret; +} + +char * +options_get_str(char *key) +{ + return abook_opt_conff_get_val(key); +} + +void +init_options() +{ + abook_config = NULL; + + if( rcfile_exist() ) + load_options(); + else + default_options(); +} + +void +close_config() +{ + save_options(); + + conff_free_nodes(abook_config); +} + +void +edit_options() +{ + /* + * not yet implemented + * edit your ~/.abook.conf manually + */ +} + +static int +rcfile_exist() +{ + return ( (0 == access(SYSWIDE_RCFILE, F_OK)) || + (0 == access(rcfile, F_OK)) ); +} + +void +load_options() +{ + int ret; + + if( (ret = conff_load_file(&abook_config, rcfile, + REPLACE_KEY)) > 0) { + fprintf(stderr, "%s: parse error at line %d\n", rcfile, ret); + exit(1); + } + + if( (ret = conff_load_file(&abook_config, SYSWIDE_RCFILE, + DONT_REPLACE_KEY )) > 0) { + fprintf(stderr, "%s: parse error at line %d\n", + SYSWIDE_RCFILE, ret); + exit(1); + } +} + +void +save_options() +{ + if( rcfile_exist() ) /* don't overwrite existing config */ + return; + + conff_save_file(abook_config, rcfile); +} + +static void +options_add_key(char *key, char *value) +{ + const int flags = DONT_REPLACE_KEY; + + conff_add_key(&abook_config, key, value, flags); +} + +static void +default_options() +{ + options_add_key("autosave", "true"); + + options_add_key("show_all_emails", "true"); + options_add_key("emailpos", "25"); + options_add_key("extra_column", "7"); + options_add_key("extra_alternative", "-1"); + options_add_key("extrapos", "65"); + + options_add_key("mutt_command", "mutt"); + options_add_key("mutt_return_all_emails", "true"); + + options_add_key("print_command", "lpr"); + + options_add_key("filesel_sort", "false"); + + options_add_key("www_command", "lynx"); + + options_add_key("address_style", "eu"); +} diff --git a/options.h b/options.h new file mode 100644 index 0000000..1aea84f --- /dev/null +++ b/options.h @@ -0,0 +1,17 @@ +#ifndef _OPTIONS_H +#define _OPTIONS_H + +#define RCFILE ".abookrc" +#define SYSWIDE_RCFILE "/etc/abookrc" + +#include "conff.h" + +int options_get_int(char *key); +char *options_get_str(char *key); +void init_options(); +void edit_options(); +void close_config(); +void load_options(); +void save_options(); + +#endif diff --git a/sample.abookrc b/sample.abookrc new file mode 100644 index 0000000..a12b512 --- /dev/null +++ b/sample.abookrc @@ -0,0 +1,49 @@ +# sample abook configuration file +# see abookrc(5) for detailed explanation + +# Automatically save database on exit +autosave=true + +# Show all email addresses in list +show_all_emails=true + +# Screen column for email field to start +emailpos=25 + +# Field to be used in the extra column +extra_column=7 +# frequently used values: +# -1 = disabled +# 7 = Home Phone +# 8 = Work Phone +# 9 = Fax +# 10 = Mobile Phone +# 11 = Nick / Alias +# 12 = URL + +# Specify an alternative field to be displayed in the extra +# column if there is no data for the field specified in +# extra_column for a particular item. +extra_alternative=-1 + +# Screen column for the extra field to start +extrapos=65 + +# Command used to start mutt +mutt_command=mutt + +# Return all email addresses to a mutt query +mutt_return_all_emails=true + +# Command used to print +print_command=lpr + +# Sort files in fileselector (alphabetic order) +filesel_sort=false + +# Command used to start the web browser +www_command=lynx + +# address style [eu|us|uk] +address_style=eu + diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp