From: short <> Date: Thu, 10 Jul 2003 12:01:38 +0000 (+0000) Subject: Update for recent build tools X-Git-Tag: mdsms_1_5_3~2 X-Git-Url: https://git.jankratochvil.net/?p=mdsms.git;a=commitdiff_plain;h=3b014e78c3dff6daa5ba9b60fb34aa8d3f1e3e01 Update for recent build tools --- diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 3906665..0000000 --- a/.cvsignore +++ /dev/null @@ -1,39 +0,0 @@ -getopt.c -getopt.h -getopt1.c -need-declaration.m4 -strdup.c -usleep.c -memmove.c -aclocal.m4 -intl -ABOUT-NLS -missing -config.h.in -configure -install-sh -mkinstalldirs -INSTALL -COPYING -stamp-h.in -Makefile.in -config.log -config.h -config.cache -config.status -stamp-h -Makefile -mdsms.spec -.deps -ChangeLog -mdsms -manfmt -mdsms.1.in2 -mdsms.1 -*.o -*.tar.gz -*.tar.Z -*.rpm -tags -TAGS -.cvsignore diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..67c1181 --- /dev/null +++ b/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 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. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We this +license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + Another cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does insure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. 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) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + 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. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..54caf7c --- /dev/null +++ b/INSTALL @@ -0,0 +1,229 @@ +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +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, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + 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 you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' 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. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +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 support 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' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + 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 machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +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. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--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. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile-head.am b/Makefile-head.am new file mode 100644 index 0000000..2001544 --- /dev/null +++ b/Makefile-head.am @@ -0,0 +1,87 @@ +# $Id$ +# automake source include to the begin of all Makefile.am's +# Copyright (C) 2003 Jan Kratochvil +# +# 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; exactly version 2 of June 1991 is required +# +# 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 + + +# Set all needed variables to their empty values to prevent "variable `...' not defined" +# Any further settings should be done exclusively by += operator +EXTRA_DIST= +BUILT_SOURCES= +CLEANFILES= +MAINTAINERCLEANFILES= +# default DEFAULT_INCLUDES=' -I. -I$(srcdir)'.(dirnames of 'CONFIG_HEADER') , +# we neeed such $(DEFAULT_INCLUDES) but we need to prefer our $(INCLUDES) +# thus we postpone them later by moving them to $(AM_CPPFLAGS). +# It prevent us the inclusion of own wrappers +# when we want direct include during (test) compilations +# in $(top_srcdir)/src/libcaptive/include/reactos/ +# as -I. is always as one of the first '-I's in $(INCLUDES). +# It will be utilized in $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am . +# It would be also possible to use some #include_next's but it is pretty +# hassle to guess the right ordering in such case. +# FIXME: $(addprefix ) and $(dir /) are GNU make dependent! +AM_CPPFLAGS=-I. -I$(srcdir) $(addprefix -I,$(dir $(CONFIG_HEADER))) +# 'DEFAULT_INCLUDES=' will drop its contents. +# 'DEFAULT_INCLUDES:=' will cause: automake-X.Y/am/compile.am: DEFAULT_INCLUDES was set with `:=' and is now set with `=' +# %DEFAULT_INCLUDES% is permitted only in automake system files. +# No possibility to keep its state therefore we generate +# (I hope) the same contents in 'AM_CPPFLAGS=...' line above +DEFAULT_INCLUDES= +INCLUDES= +lib_LTLIBRARIES= +pkginclude_HEADERS= +bin_PROGRAMS= +sbin_PROGRAMS= +noinst_HEADERS= +# Prevent: noinst_DATA was already defined in condition TRUE, which implies condition MAINTAINER_MODE_TRUE +# You should only unconditionally do: noinst_DATA+=... +noinst_DATA= + +# Custom variables +localedir=$(datadir)/locale + +# Standard settings +INCLUDES+=-DLOCALEDIR=\"$(localedir)\" +INCLUDES+=-I$(top_srcdir)/intl + +# Force delete of target file if command fails. +# Generally better behaviour but it requires GNU make. Harmless otherwise. +.DELETE_ON_ERROR: + + +# This target is used during ./autogen.pl POTFILES.in generation +distfiles: $(DISTFILES) + @if test -n "$(DISTFILES_PRINT)";then \ + echo -n ":DISTFILES:"; \ + for distfile in . $(DISTFILES);do \ + if test -n 1 \ + -a "$$distfile" '!=' . \ + -a "$$distfile" '!=' Makefile.am \ + -a "$$distfile" '!=' Makefile.in \ + ;then \ + if echo " $(BUILT_SOURCES) "|grep -q " $$distfile ";then :;else \ + echo -n " $(subdir)/$$distfile"; \ + fi; \ + fi; \ + done; \ + echo; \ + fi; + @for subdir in . $(SUBDIRS);do \ + if test "$$subdir" = . -o "$$subdir" = intl -o "$$subdir" = po -o "$$subdir" = m4;then :;else \ + (cd "$$subdir" && $(MAKE) $(AM_MAKEFLAGS) distfiles) || exit 1; \ + fi; \ + done + diff --git a/Makefile.am b/Makefile.am index 5665fa3..2939690 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,22 +1,24 @@ # $Id$ -AUTOMAKE_OPTIONS = dist-tarZ -SUBDIRS = intl . po -#?: @@INTLSUB@@ src @@POSUB@@ +include $(top_srcdir)/Makefile-head.am -EXTRA_DIST = autogen.sh mdsms.1.c mdsms.1.in ChangeLog need-declaration.m4 ABOUT-NLS mdsms.spec.in +AUTOMAKE_OPTIONS = dist-tarZ +SUBDIRS = macros intl . po +## to automatically rebuild aclocal.m4 if any of the macros in +## `macros/' change +@MAINT@include macros/macros.dep +@MAINT@macros/macros.dep: macros/Makefile.am +@MAINT@ cd macros && $(MAKE) macros.dep -CLEANFILES = ChangeLog mdsms.1 mdsms.1.in2 +EXTRA_DIST += autogen.pl mdsms.1.c mdsms.1.in ChangeLog ABOUT-NLS mdsms.spec.in INSTALL mkinstalldirs -# assumed to exist: datadir = $(prefix)/@DATADIRNAME@ -localedir = $(datadir)/locale -INCLUDES += -DLOCALEDIR=\"$(localedir)\" +CLEANFILES += mdsms.1 mdsms.1.in2 -bin_PROGRAMS = mdsms +bin_PROGRAMS += mdsms man_MANS = mdsms.1 noinst_PROGRAMS = manfmt noinst_SCRIPTS = mdsms.1 mdsms.1.in2 -noinst_HEADERS = setup.h getopt.h +noinst_HEADERS += setup.h getopt.h manfmt_SOURCES = manfmt.c @@ -32,7 +34,18 @@ mdsms.1.o: mdsms.1.c mdsms.1.in2 config.h setup.h mdsms.1: manfmt mdsms.1.o ./manfmt > mdsms.1 < mdsms.1.o +MAINTAINERCLEANFILES+= \ + ChangeLog + +CLEANFILES+= \ + ChangeLog.bak + +if MAINTAINER_MODE +ChangeLog: + cvs2cl.pl --usermap cvs2cl-usermap --window 3600 --separate-header --no-wrap --file $@ . $(REACTOS_SOURCES) + +else ChangeLog: - rcs2log | sed 's/short@short\.ucw\.cz/short@ucw.cz/g' >ChangeLog + touch $@ -Makefile.in: ChangeLog +endif diff --git a/NEWS b/NEWS index ee5f9a1..f69f308 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ $Id$ 1.5.3: Sending of picture messages implemented New option -w|--waittime as requested by Markus Widauer + Update for recent build tools 1.5.2: Minor crossplatformity fixes diff --git a/autogen.pl b/autogen.pl new file mode 100755 index 0000000..1a8a263 --- /dev/null +++ b/autogen.pl @@ -0,0 +1,43 @@ +#! /usr/bin/perl +# +# $Id$ +# Run to generate the initial Makefiles etc. after CVS checkout. +# Copyright (C) 2003 Jan Kratochvil +# +# 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; exactly version 2 of June 1991 is required +# +# 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 + + +require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway +use vars qw($VERSION); +$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; }; +use strict; +use warnings; + +use lib "./macros/"; +use AutoGen; + +use Carp qw(cluck confess); + + +AutoGen->run( + "name"=>"mdsms", + "COPYRIGHT_HOLDER"=>'Jan Kratochvil ', + "ARGV"=>\@ARGV, + "clean"=>[qw( + ./mdsms + ./mdsms.1 + ./mdsms.1.in2 + ./manfmt + )], + ); diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 2776969..0000000 --- a/autogen.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/sh -# Run this to generate all the initial makefiles, etc. - -# $Id$ - -# /lib/gconv/ISO8859-2.so is apparently clashing with EFence. :-( -CONFDEFS="--enable-maintainer-mode --enable-debug --without-efence" - -if [ "$1" = rpm -o "$1" = rpmup ];then - ./autogen.sh - make - make dist - cp mdsms-[0-9]*.tar.gz /usr/src/redhat/SOURCES - rpm -ba --sign mdsms.spec - make dist-tarZ - rm /usr/src/redhat/SOURCES/mdsms-[0-9]*.tar.gz - mv /usr/src/redhat/SRPMS/mdsms-[0-9]*-*.src.rpm . - mv /usr/src/redhat/RPMS/i386/mdsms-[0-9]*-*.i386.rpm . - ls -l mdsms-[0-9]* - if [ "$1" = rpm ];then exit;fi - echo "Uploading $[`cat mdsms-[0-9]*|wc -c`] bytes..." -# tar cf - mdsms-[0-9]*|ssh twilight ssh atrey.karlin.mff.cuni.cz 'cd WWW/sw\;tar xvvf -' - scp -v mdsms-[0-9]* atrey.karlin.mff.cuni.cz:WWW/sw/ - exit -fi - -# if [ -f Makefile ];then touch ChangeLog;make maintainer-clean;fi -rm -r -f \ - `find -name "*~"` \ - errs* \ - `find po -type f -not '(' -name POTFILES.in -o -name "*.po" -o -name ".cvsignore" -o -path "po/CVS*" ')'` \ - intl \ - install-sh \ - mkinstalldirs \ - missing \ - INSTALL \ - COPYING \ - ABOUT-NLS \ - Makefile \ - Makefile.in \ - */Makefile \ - */Makefile.in \ - configure \ - configure.scan \ - config.guess \ - config.status \ - config.sub \ - config.log \ - config.h \ - confdefs.h \ - conftest* \ - autoh[0-9]* \ - config.cache \ - config.h.in \ - stamp-h \ - stamp-h.in \ - aclocal.m4 \ - getopt.c \ - getopt.h \ - getopt1.c \ - need-declaration.m4 \ - strdup.c \ - usleep.c \ - memmove.c \ - mdsms.1 \ - mdsms.1.in2 \ - mdsms \ - mdsms-[0-9]* \ - mdsms.spec \ - manfmt \ - .deps \ - ChangeLog \ - *.o \ - tags \ - TAGS \ - - -if [ "$1" = clean ];then exit;fi - - d="`pwd`" - (cd $HOME/src/misc - (cd getopt - cp getopt.c getopt.h getopt1.c $d - ) - (cd macros - cp need-declaration.m4 $d - ) - cp strdup.c usleep.c memmove.c $d - ) - -aclocal -I . -gettextize --copy -autoheader -touch ChangeLog -automake --gnu -c --add-missing -rm -f ChangeLog -cp $HOME/src/misc/LGPL2.1 COPYING -ed po/Makefile.in.in < po/Makefile]) +intl/Makefile]) + +dnl FIXME: Why is "po/POTFILES" being substituted? +echo mdsms.c >po/POTFILES.in +make -C po Makefile + +echo done. diff --git a/cvs2cl-usermap b/cvs2cl-usermap new file mode 100644 index 0000000..a2fb6d8 --- /dev/null +++ b/cvs2cl-usermap @@ -0,0 +1,2 @@ +short:Jan Kratochvil +lace:Jan Kratochvil diff --git a/getopt.c b/getopt.c new file mode 100644 index 0000000..81cef23 --- /dev/null +++ b/getopt.c @@ -0,0 +1,1051 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to drepper@gnu.org + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 + Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in . + Ditto for AIX 3.2 and . */ +#ifndef _NO_PROTO +# define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +# ifndef const +# define const +# endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +# include +# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +# define ELIDE_CODE +# endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +# include +# include +#endif /* GNU C library. */ + +#ifdef VMS +# include +# if HAVE_STRING_H - 0 +# include +# endif +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +# ifdef HAVE_LIBINTL_H +# include +# define _(msgid) gettext (msgid) +# else +# define _(msgid) (msgid) +# endif +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = NULL; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* 1003.2 says this must be 1 before any call. */ +int optind = 1; + +/* Formerly, initialization of getopt depended on optind==0, which + causes problems with re-calling getopt as programs generally don't + know that. */ + +int __getopt_initialized = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +# include +# define my_index strchr +#else + +# if HAVE_STRING_H +# include +# else +# include +# endif + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +#ifndef getenv +extern char *getenv (); +#endif + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +# if (!defined __STDC__ || !__STDC__) && !defined strlen +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +# endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +#ifdef _LIBC +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +/* Defined in getopt_init.c */ +extern char *__getopt_nonoption_flags; + +static int nonoption_flags_max_len; +static int nonoption_flags_len; + +static int original_argc; +static char *const *original_argv; + +/* Make sure the environment variable bash 2.0 puts in the environment + is valid for the getopt call we must make sure that the ARGV passed + to getopt is that one passed to the process. */ +static void +__attribute__ ((unused)) +store_args_and_env (int argc, char *const *argv) +{ + /* XXX This is no good solution. We should rather copy the args so + that we can compare them later. But we must not use malloc(3). */ + original_argc = argc; + original_argv = argv; +} +# ifdef text_set_element +text_set_element (__libc_subinit, store_args_and_env); +# endif /* text_set_element */ + +# define SWAP_FLAGS(ch1, ch2) \ + if (nonoption_flags_len > 0) \ + { \ + char __tmp = __getopt_nonoption_flags[ch1]; \ + __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ + __getopt_nonoption_flags[ch2] = __tmp; \ + } +#else /* !_LIBC */ +# define SWAP_FLAGS(ch1, ch2) +#endif /* _LIBC */ + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined __STDC__ && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + +#ifdef _LIBC + /* First make sure the handling of the `__getopt_nonoption_flags' + string can work normally. Our top argument must be in the range + of the string. */ + if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) + { + /* We must extend the array. The user plays games with us and + presents new arguments. */ + char *new_str = malloc (top + 1); + if (new_str == NULL) + nonoption_flags_len = nonoption_flags_max_len = 0; + else + { + memset (__mempcpy (new_str, __getopt_nonoption_flags, + nonoption_flags_max_len), + '\0', top + 1 - nonoption_flags_max_len); + nonoption_flags_max_len = top + 1; + __getopt_nonoption_flags = new_str; + } + } +#endif + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + SWAP_FLAGS (bottom + i, middle + i); + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined __STDC__ && __STDC__ +static const char *_getopt_initialize (int, char *const *, const char *); +#endif +static const char * +_getopt_initialize (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + +#ifdef _LIBC + if (posixly_correct == NULL + && argc == original_argc && argv == original_argv) + { + if (nonoption_flags_max_len == 0) + { + if (__getopt_nonoption_flags == NULL + || __getopt_nonoption_flags[0] == '\0') + nonoption_flags_max_len = -1; + else + { + const char *orig_str = __getopt_nonoption_flags; + int len = nonoption_flags_max_len = strlen (orig_str); + if (nonoption_flags_max_len < argc) + nonoption_flags_max_len = argc; + __getopt_nonoption_flags = + (char *) malloc (nonoption_flags_max_len); + if (__getopt_nonoption_flags == NULL) + nonoption_flags_max_len = -1; + else + memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), + '\0', nonoption_flags_max_len - len); + } + } + nonoption_flags_len = nonoption_flags_max_len; + } + else + nonoption_flags_len = 0; +#endif + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns -1. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0 || !__getopt_initialized) + { + if (optind == 0) + optind = 1; /* Don't scan ARGV[0], the program name. */ + optstring = _getopt_initialize (argc, argv, optstring); + __getopt_initialized = 1; + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. The later information + is only used when the used in the GNU libc. */ +#ifdef _LIBC +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && __getopt_nonoption_flags[optind] == '1')) +#else +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') +#endif + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return -1; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return -1; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = -1; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) + == (unsigned int) strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + } + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + + /* optarg is now the argument, see if it's in the + table of longopts. */ + + for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + fprintf (stderr, _("\ +%s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + nextchar = NULL; + return 'W'; /* Let the application handle it. */ + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == -1) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/getopt.h b/getopt.h new file mode 100644 index 0000000..b0147e9 --- /dev/null +++ b/getopt.h @@ -0,0 +1,169 @@ +/* Declarations for getopt. + Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _GETOPT_H + +#ifndef __need_getopt +# define _GETOPT_H 1 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +#ifndef __need_getopt +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +# if defined __STDC__ && __STDC__ + const char *name; +# else + char *name; +# endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +# define no_argument 0 +# define required_argument 1 +# define optional_argument 2 +#endif /* need getopt */ + + +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. + + Return the option character from OPTS just read. Return -1 when + there are no more options. For unrecognized options, or options + missing arguments, `optopt' is set to the option letter, and '?' is + returned. + + The OPTS string is a list of characters which are recognized option + letters, optionally followed by colons, specifying that that letter + takes an argument, to be placed in `optarg'. + + If a letter in OPTS is followed by two colons, its argument is + optional. This behavior is specific to the GNU `getopt'. + + The argument `--' causes premature termination of argument + scanning, explicitly telling `getopt' that there are no more + options. + + If OPTS begins with `--', then non-option arguments are treated as + arguments to the option '\0'. This behavior is specific to the GNU + `getopt'. */ + +#if defined __STDC__ && __STDC__ +# ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int __argc, char *const *__argv, const char *__shortopts); +# else /* not __GNU_LIBRARY__ */ +extern int getopt (); +# endif /* __GNU_LIBRARY__ */ + +# ifndef __need_getopt +extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, + const struct option *__longopts, int *__longind); +extern int getopt_long_only (int __argc, char *const *__argv, + const char *__shortopts, + const struct option *__longopts, int *__longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int __argc, char *const *__argv, + const char *__shortopts, + const struct option *__longopts, int *__longind, + int __long_only); +# endif +#else /* not __STDC__ */ +extern int getopt (); +# ifndef __need_getopt +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +# endif +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +/* Make sure we later can get all the definitions and declarations. */ +#undef __need_getopt + +#endif /* getopt.h */ diff --git a/getopt1.c b/getopt1.c new file mode 100644 index 0000000..3d264f2 --- /dev/null +++ b/getopt1.c @@ -0,0 +1,188 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "getopt.h" + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +#include +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +#include + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == -1) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/mdsms.c b/mdsms.c index f50b12a..757124d 100644 --- a/mdsms.c +++ b/mdsms.c @@ -63,6 +63,9 @@ static char rcsid[] ATTR_UNUSED = "$Id$"; #ifdef HAVE_LOCALE_H #include #endif +#ifdef HAVE_STDDEF_H +#include +#endif #ifdef HAVE_GETOPT_LONG #include diff --git a/memmove.c b/memmove.c new file mode 100644 index 0000000..2c0d1d1 --- /dev/null +++ b/memmove.c @@ -0,0 +1,22 @@ +#include "config.h" +#ifndef lint +static char rcsid[] ATTR_UNUSED = "$Id$"; +#endif + +/* This part of code is a public domain */ + +/* CONFORMING TO SVID 3, BSD 4.3, ISO 9899 */ + +void *memmove(void *dest, const void *src, size_t n) +{ +char *cdest,*csrc; + + if (dest==src || !n) return; + cdest=dest; csrc=src; + if (dest\n" +"Last-Translator: Jan Kratochvil \n" "Language-Team: Czech \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-2\n" "Content-Transfer-Encoding: 8bit\n" -#: mdsms.c:170 +#: mdsms.c:184 msgid "" msgstr "" -#: mdsms.c:217 +#: mdsms.c:231 msgid "!Virtual memory exhausted" msgstr "!Dostupná pamìt vyèerpána" -#: mdsms.c:229 +#: mdsms.c:243 #, c-format msgid "^Error removing my device lockfile \"%s\"" msgstr "^Nemohu odstranit zámek zaøízení pojmenovaný \"%s\"" -#: mdsms.c:246 +#: mdsms.c:260 msgid "^Error restoring termios for device" msgstr "^Nemohu obnovit nastavení terminálu (termios) zaøízení" -#: mdsms.c:256 +#: mdsms.c:270 +#, c-format msgid "" "\n" "%s\n" @@ -38,7 +39,8 @@ msgid "" " [-s|--smsc ] [-m|--maxretry <#>]\n" " [-r|--readtime ] [-t|--chartime ] [-T|--cmdtime " "]\n" -" [-v|--verbose] [-h|--help] [-V|--version]\n" +" [-w|--waittime ] [-v|--verbose] [-h|--help] [-V|--" +"version]\n" " {--send | --send-mobildock | --receive | --logo-send}\n" " --send / --send-mobildock:\n" " [-f|--file] \n" @@ -48,6 +50,8 @@ msgid "" " []\n" " --ring-send:\n" " \n" +" --picture-send:\n" +" \n" "\n" " -c, --config\tRead this additional config file\n" "\t\t(def. \"%s\" and \"$HOME%s\")\n" @@ -70,6 +74,7 @@ msgid "" "\t\t multiplied %dx for long cmds)\n" " -t, --chartime\tMilliseconds between each char (def. %dms)\n" " -T, --cmdtime\tMilliseconds before each whole AT command (def. %dms)\n" +" -w, --waittime\tSeconds to prevent timeout of 9110 FaxModem (def. %ds)\n" " -v, --verbose\tIncrease verbosity level, more \"-v\"s give more messages\n" " -h, --help\tPrint a summary of the options\n" " -V, --version\tPrint the version number\n" @@ -134,6 +139,8 @@ msgstr "" "\t\t vynásobeno %dx pro dlouhotrvající pøíkazy)\n" " -t, --chartime\tPoèet milisekund mezi ka¾dým znakem (std. %dms)\n" " -T, --cmdtime\ttPoèet milisekund pøed AT pøíkazem (std. %dms)\n" +" -w, --waittime\tPoèet sekund pro prevenci vypr¹ení 9110 FaxModemu (def. %" +"ds)\n" " -v, --verbose\tZvý¹ení úrovnì informativních výpisù, více \"-v\" pro více " "zpráv\n" " -h, --help\tTento seznam mo¾ných argumentù\n" @@ -148,8 +155,8 @@ msgstr "" "\t\t%%p - telefonní èíslo odesilatele zprávy\n" "\t\t%%T - èas odeslání (ze SMSC) jako poèet sekund od roku 1970,\n" "\t\t hodnota -1 je-li nekorektní\n" -"\t\t%%t - èas odeslání ve stylu ctime(3) (napø. \"Wed Jun 30 21:49:08 " -"1993\"),\n" +"\t\t%%t - èas odeslání ve stylu ctime(3) (napø. \"Wed Jun 30 21:49:08 1993" +"\"),\n" "\t\t prázdný øetìzec je-li pøijaty èas nekorektní\n" "\t\t%%s - èíslo SMSC pøíchozí zprávy, je-li k dispozici (jinak prázdné)\n" "--logo-send: odeslat Nokia logo\n" @@ -164,7 +171,7 @@ msgstr "" "./mdsms -h 2>&1|more\n" "\n" -#: mdsms.c:320 +#: mdsms.c:337 msgid "" "\n" "\t\t(Not supported on this platform!)" @@ -172,50 +179,50 @@ msgstr "" "\n" "\t\t(Není podporováno na této platformì!)" -#: mdsms.c:368 +#: mdsms.c:388 #, c-format msgid "^Error closing \"%s\"" msgstr "^Chyba pøi uzavírání \"%s\"" -#: mdsms.c:376 +#: mdsms.c:396 #, c-format msgid "^Error seeking to end of \"%s\"" msgstr "^Nemohu nastavit ukazatel (seek) na konec \"%s\"" -#: mdsms.c:378 +#: mdsms.c:398 #, c-format msgid "^Error measuring length of \"%s\"" msgstr "^Nemohu zjistit délku \"%s\"" -#: mdsms.c:394 +#: mdsms.c:414 #, c-format msgid "Too many config files to read, max is %d, break-out" msgstr "" "Pøíli¹ konfiguraèních souborù pro naèítání, maximum je %d, konèím s jejich " "ètením" -#: mdsms.c:398 +#: mdsms.c:418 #, c-format msgid "^Can't open config file \"%s\" for r/o" msgstr "^Nemohu otevøít konfiguraèní soubor \"%s\" pro ètení" -#: mdsms.c:402 +#: mdsms.c:422 #, c-format msgid ".Reading config file \"%s\"" msgstr ".Naèítám konfiguraèní soubor \"%s\"" -#: mdsms.c:405 +#: mdsms.c:425 #, c-format msgid "File \"%s\" is too long, read only %d bytes" msgstr "Soubor \"%s\" je pøíli¹ dlouhy, naèetl jsem pouze %d bajtù" -#: mdsms.c:409 +#: mdsms.c:429 #, c-format msgid "File \"%s\" read error, got only %u bytes of %ld" msgstr "" "Chyba pøi ètení \"%s\", naèetl jsem pouze %u bajtù z celkem %ld po¾adovaných" -#: mdsms.c:420 +#: mdsms.c:440 #, c-format msgid "" "\n" @@ -224,19 +231,19 @@ msgstr "" "\n" "Konf. soubor \"%s\": argument #%d: %s" -#: mdsms.c:426 +#: mdsms.c:446 #, c-format msgid "Too many arguments in \"%s\", from offset %d ignored" msgstr "Pøíli¹ argumentù v \"%s\", od pozice %d ignorovány" -#: mdsms.c:578 +#: mdsms.c:599 #, c-format msgid "Looping (%d) during attempt to read config file \"%s\", break-out" msgstr "" "Pokus o zacyklení (%d) pøi ètení konfiguraèního souboru \"%s\", konèím " "naèítání" -#: mdsms.c:604 +#: mdsms.c:625 #, c-format msgid "" "!RTS/CTS handshake NOT supported on this platform! Occured during parsing " @@ -245,7 +252,7 @@ msgstr "" "!RTS/CTS handshake NENÍ na této platformì podporován! Nastalo pøi zpracování " "argumentu %d ze \"%s\"" -#: mdsms.c:627 +#: mdsms.c:651 #, c-format msgid "" "\n" @@ -256,31 +263,35 @@ msgstr "" "Poslední zobrazená chyba getopt(3)-u nastala pøi zpracování argumentu %d ze " "\"%s\"! Následuje nápovìda:" -#: mdsms.c:648 +#: mdsms.c:676 msgid "destination phone number" msgstr "cílový telefon" -#: mdsms.c:649 +#: mdsms.c:677 msgid "logo filename" msgstr "soubor s logem" -#: mdsms.c:650 +#: mdsms.c:678 msgid "ring filename" msgstr "soubor se zvonìním" -#: mdsms.c:651 +#: mdsms.c:679 +msgid "picture filename" +msgstr "soubor s obrázkem" + +#: mdsms.c:680 msgid "body text" msgstr "text zprávy" -#: mdsms.c:653 +#: mdsms.c:682 msgid "GSM operator network code" msgstr "kód GSM sítì operátora" -#: mdsms.c:654 +#: mdsms.c:683 msgid "device for communication" msgstr "zaøízení pro komunikaci" -#: mdsms.c:674 +#: mdsms.c:703 #, c-format msgid "" "\n" @@ -289,28 +300,29 @@ msgstr "" "\n" "Pøebyteèný argument %d ze \"%s\" zignorován: %s" -#: mdsms.c:688 +#: mdsms.c:717 #, c-format msgid "Invalid digit '%c' in phone number - at offset %d" msgstr "Chybný znak '%c' v telefonním èísle na pozici %d" -#: mdsms.c:693 +#: mdsms.c:722 #, c-format msgid "Phone number too long (%d), max. %d digits allowed" msgstr "Telefonní èíslo je pøíli¹ dlouhé (%d), povoleno max. %d èíslic" -#: mdsms.c:704 +#: mdsms.c:733 #, c-format msgid "!%s in option %d from \"%s\": %s" msgstr "!%s v argumentu %d ze \"%s\": %s" -#: mdsms.c:719 +#: mdsms.c:748 +#, c-format msgid "Unknown formatsymbol '%c' (use \"%%%%%c\" to fix it) at pos %d in: %s" msgstr "" "Neznámý formátovací znak '%c' (pou¾ijte \"%%%%%c\" pro opravu) na pozici %d " "ve: %s" -#: mdsms.c:746 +#: mdsms.c:775 #, c-format msgid "" "\n" @@ -319,7 +331,7 @@ msgstr "" "\n" "Chybný znak '%c' v kódu GSM sítì na pozici %d: %s" -#: mdsms.c:752 +#: mdsms.c:781 #, c-format msgid "" "\n" @@ -330,7 +342,7 @@ msgstr "" "Kód GSM sítì musí mít pøesnì 5 cifer nebo musí být buï\n" "\"%s\" èi \"%s\", ale jeho `nalezená délka je %d: %s" -#: mdsms.c:759 +#: mdsms.c:788 #, c-format msgid "" "\n" @@ -339,123 +351,122 @@ msgstr "" "\n" "Kód GSM sítì, argument %d ze \"%s\" zahozen pro pøedchozí chyby: %s" -#: mdsms.c:777 +#: mdsms.c:812 #, c-format msgid "Error closing lockfile \"%s\"" msgstr "^Nemohu uzavøít uzamykací soubor \"%s\"" -#: mdsms.c:796 +#: mdsms.c:831 #, c-format msgid ".Checking the lockfile \"%s\".." msgstr ".Kontroluji uzamykací soubor \"%s\".." -#: mdsms.c:801 +#: mdsms.c:836 #, c-format msgid ".Lockfile \"%s\" is still not valid, removing it" msgstr ".Uzamykací soubor \"%s\" je¹tì stále není korektní, odstraòuji jej" -#: mdsms.c:813 +#: mdsms.c:848 #, c-format msgid "^Error during checking consciousness of PID %d" msgstr "^Chyba pøi kontrole ¾ivotaschopnosti procesu s PID %d" -#: mdsms.c:818 +#: mdsms.c:853 #, c-format msgid ".Lockfile \"%s\" is stale (PID %d), removing it" msgstr ".Uzamykací soubor \"%s\" je ji¾ neplatný (PID %d), odstraòuji jej" -#: mdsms.c:822 +#: mdsms.c:857 #, c-format msgid "^Error removing foreign lockfile \"%s\"" msgstr "^Nemohu odstranit cizí uzamykací soubor \"%s\"" -#: mdsms.c:828 +#: mdsms.c:863 #, c-format msgid "^!Error creating lockfile \"%s\"" msgstr "^Nemohu vytvoøit uzamykací soubor \"%s\"" -#: mdsms.c:833 +#: mdsms.c:868 #, c-format msgid "^!Error writing data to lockfile \"%s\"" msgstr "^Nemohu zapisovat do uzamykacího souboru \"%s\"" -#: mdsms.c:853 +#: mdsms.c:888 msgid "Timed out" msgstr "Maximální doba vypr¹ela" -#: mdsms.c:861 +#: mdsms.c:896 #, c-format msgid "^!fcntl() on device for %s mode" msgstr "^!Volání fcntl() na zaøizení pro získáni %s re¾imu" -#: mdsms.c:861 +#: mdsms.c:896 msgid "blocking" msgstr "blokujícího" -#: mdsms.c:861 +#: mdsms.c:896 msgid "non-blocking" msgstr "neblokujícího" -#: mdsms.c:895 +#: mdsms.c:930 #, c-format msgid "!Maximum command retry count (%ld) exceeded" msgstr "!Maximální poèet opakování pøíkazu (%ld) pøekroèen" -#: mdsms.c:896 +#: mdsms.c:931 #, c-format msgid ".Retrying phase, %d out of %ld.." msgstr ".Fáze opakování, poøadí %d z celkem %ld.." -#: mdsms.c:909 +#: mdsms.c:944 msgid "" msgstr "" -#. GCC formatstring-check workaround -#: mdsms.c:955 +#: mdsms.c:990 #, c-format msgid ".devcmd(sendfmt=%s,term=%s,catch=%s)" msgstr ".devcmd(poslatformát=%s,skonèit=%s,zachytit=%s)" -#: mdsms.c:981 +#: mdsms.c:1016 #, c-format msgid "!Command too big (%d>%d)" msgstr "!Pøíkaz je pøíli¹ velký (%d>%d)" -#: mdsms.c:982 +#: mdsms.c:1017 #, c-format msgid ".devcmd formatted send=%s%s" msgstr ".devcmd zformátované poslání=%s%s" -#: mdsms.c:988 +#: mdsms.c:1023 msgid "^Error flushing I/O queue of device" msgstr "^Nemohu vyprázdnit I/O frontu zaøízení" -#: mdsms.c:992 +#: mdsms.c:1027 #, c-format msgid "^Error forcing output of char at pos %d of cmd %s" msgstr "^Nemohu zajistit výstup znaku na pozici %d pøíkazu %s" -#: mdsms.c:996 +#: mdsms.c:1031 #, c-format msgid "^Wrote only %d of %d bytes of command" msgstr "^Zapsáno pouze %d z celkem %d bajtù pøíkazu" -#: mdsms.c:1033 +#: mdsms.c:1068 #, c-format msgid ".Blank (%d newlines) input read, ignoring it" msgstr ".Pøeèten prázdný (%d koncù øádkù) vstup, ignoruji jej" -#: mdsms.c:1037 +#: mdsms.c:1072 #, c-format msgid "Maximum response timeout (%lds) exceeded" msgstr "Maximální doba odezvy (%lds) pøekroèena" -#: mdsms.c:1038 +#: mdsms.c:1073 #, c-format msgid "^Couldn't read device data (ret=%d)" msgstr "^Nemohu èíst data zaøízení (návratový kód=%d)" -#: mdsms.c:1046 +#: mdsms.c:1081 #, c-format msgid "" "\n" @@ -464,28 +475,28 @@ msgstr "" "\n" "Data ze zaøízení: %s" -#: mdsms.c:1059 +#: mdsms.c:1094 #, c-format msgid "Found ERROR response on command %s" msgstr "Nalezl jsem ERROR v odpovìdi na pøíkaz %s" -#: mdsms.c:1092 +#: mdsms.c:1127 #, c-format msgid ".Returning data %s for cmd %s" msgstr ".Vracím data %s pro pøíkaz %s" -#: mdsms.c:1106 +#: mdsms.c:1141 #, c-format msgid "!Error during conversion of number at: %s" msgstr "!Chyba pøi konverzi èísla od pozice: %s" -#: mdsms.c:1145 +#: mdsms.c:1180 msgid "!No SMSC set in mobile station found, please use option \"-s\"" msgstr "" -"!V mobilním zaøízení nebylo nalezeno èíslo SMSC, prosím pou¾ijte argument " -"\"-s\"" +"!V mobilním zaøízení nebylo nalezeno èíslo SMSC, prosím pou¾ijte argument \"-" +"s\"" -#: mdsms.c:1146 +#: mdsms.c:1181 #, c-format msgid "" "\n" @@ -494,33 +505,33 @@ msgstr "" "\n" "Nalezl jsem SMSC v mobilu: %s" -#: mdsms.c:1147 +#: mdsms.c:1182 #, c-format msgid "!No left-quote found in: %s" msgstr "!Chybí levé uvozovky: %s" -#: mdsms.c:1148 +#: mdsms.c:1183 #, c-format msgid "!No right-quote found in: %s" msgstr "!Chybí pravé uvozovky: %s" -#: mdsms.c:1150 +#: mdsms.c:1185 msgid "!No SMS set in mobile station found, please use option \"-s\"" msgstr "" -"!V mobilním zaøízení nebylo nalezeno èíslo SMSC, prosím pou¾ijte argument " -"\"-s\"" +"!V mobilním zaøízení nebylo nalezeno èíslo SMSC, prosím pou¾ijte argument \"-" +"s\"" -#: mdsms.c:1156 +#: mdsms.c:1191 #, c-format msgid "!No comma found after quotes in: %s" msgstr "!Nenalezl jsem po uvozovkách èárku ve: %s" -#: mdsms.c:1160 +#: mdsms.c:1195 #, c-format msgid "!Type parse error in: %s" msgstr "!Chyba pøi dekódování typu ve: %s`" -#: mdsms.c:1164 +#: mdsms.c:1199 #, c-format msgid "" "\n" @@ -529,14 +540,14 @@ msgstr "" "\n" "Zji¹tìné èíslo SMSC: %s" -#: mdsms.c:1182 +#: mdsms.c:1217 #, c-format msgid "" "Can't convert character '%c' (0x%02X) at offs %d (0-based), substituted '?'" msgstr "" "Nemohu zkonvertovat znak '%c' (0x%02X) na pozici %d (od 0-ly), substituji '?'" -#: mdsms.c:1220 +#: mdsms.c:1255 #, c-format msgid "" "\n" @@ -545,27 +556,27 @@ msgstr "" "\n" "Pøipravil jsem hexdata: %s" -#: mdsms.c:1242 +#: mdsms.c:1277 #, c-format msgid "^!Cannot open logo file \"%s\" for r/o" msgstr "^!Nemohu otevøít soubor s logem \"%s\" pro ètení" -#: mdsms.c:1249 +#: mdsms.c:1284 #, c-format msgid ".Reading NOL file \"%s\", GSMnet \"%s\", word@4=%d.." msgstr ".Naèítám NOL soubor \"%s\", èíslo GSM sítì \"%s\", hodnota@4=%d.." -#: mdsms.c:1254 +#: mdsms.c:1289 #, c-format msgid ".Reading NGG file \"%s\", word@4=%d.." msgstr ".Naèítám NGG soubor \"%s\", hodnota@4=%d.." -#: mdsms.c:1257 +#: mdsms.c:1292 #, c-format msgid "!Unknown file format of logo file \"%s\"" msgstr "!Neznámý formát souboru s logem \"%s\"" -#: mdsms.c:1259 +#: mdsms.c:1294 msgid "" "!NOL network code detection requested but NOL file not loaded, please " "specify network code" @@ -573,7 +584,7 @@ msgstr "" "!Byla po¾adována detekce èíslá GSM sítì z NOL, ale NOL soubor není k " "dispozici, specifikujte prosím èíslo GSM sítì" -#: mdsms.c:1263 +#: mdsms.c:1298 msgid "" "\n" "Sending logo as: group graphics" @@ -581,7 +592,7 @@ msgstr "" "\n" "Posílám logo jako: symbol skupiny" -#: mdsms.c:1267 +#: mdsms.c:1302 #, c-format msgid "" "\n" @@ -590,65 +601,65 @@ msgstr "" "\n" "Posílám logo jako: logo operátora \"%s\"" -#: mdsms.c:1272 +#: mdsms.c:1307 #, c-format msgid ".Magic words: @+4=%d, @+6=%d, @+8=%d" msgstr ".Magické hodnoty: @+4=%d, @+6=%d, @+8=%d" -#: mdsms.c:1276 +#: mdsms.c:1311 #, c-format msgid "!Invalid size: %dx%d" msgstr "!Nesprávná velikost: %dx%d" -#: mdsms.c:1278 +#: mdsms.c:1313 #, c-format msgid "!Logo file \"%s\" too short - actual=%d, need(%dx%d)=%d" msgstr "!Soubor loga \"%s\" je pøíli¹ krátký - velikost=%d, potøebná(%dx%d)=%d" -#: mdsms.c:1281 +#: mdsms.c:1316 #, c-format msgid "Ignoring trailing garbage in \"%s\", used only %d bytes" msgstr "Ignoruji pøebyteèná data v \"%s\", pou¾il jsem pouze %d bajtù" -#: mdsms.c:1283 +#: mdsms.c:1318 #, c-format msgid "!SMS size would be %d bytes but 140 is maximum" msgstr "!Velikost SMS zprávy by byla %d bajtù, ale 140 je maximum" -#: mdsms.c:1297 +#: mdsms.c:1332 #, c-format msgid "" "!Invalid character (neither '0' nor '1') in logo file \"%s\" at offset 0x%X" msgstr "" "!Nekorektní znak (ani '0', ani '1') v souboru s logem \"%s\" na pozici 0x%X" -#: mdsms.c:1338 +#: mdsms.c:1373 #, c-format msgid "^!Cannot open ring file \"%s\" for r/o" msgstr "^!Nemohu otevøít soubor se zvonìním \"%s\" pro ètení" -#: mdsms.c:1340 +#: mdsms.c:1375 mdsms.c:1459 msgid "!File size determination is essential to continue operation" msgstr "!Zji¹tìní velikosti souboru je nutné pro pokraèování" -#: mdsms.c:1342 +#: mdsms.c:1377 #, c-format msgid "!File \"%s\" size %ld too small (must >=0x103)! Is it .000 file?" msgstr "" -"!Velikost souboru \"%s\" %ld je pøíli¹ malá (musí být >=0x103)! Je to vùbec " -".000 soubor?" +"!Velikost souboru \"%s\" %ld je pøíli¹ malá (musí být >=0x103)! Je to " +"vùbec .000 soubor?" -#: mdsms.c:1345 +#: mdsms.c:1380 #, c-format msgid "^Seeking error on \"%s\", ignoring" msgstr "^Chyba pøi nastavování ukazatele (seek) ve \"%s\", ignoruji" -#: mdsms.c:1349 +#: mdsms.c:1384 mdsms.c:1466 #, c-format msgid "^Read error on \"%s\", wanted %ld, got %d" msgstr "^Chyba pøi ètení \"%s\", vy¾aduji %ld, získal jsem %d" -#: mdsms.c:1350 +#: mdsms.c:1385 #, c-format msgid "" "\n" @@ -657,13 +668,13 @@ msgstr "" "\n" "Posílám zvonìní \"%s\" jako jedinou SMS zprávu (velikost %ld, maximum je %d)" -#: mdsms.c:1357 +#: mdsms.c:1392 #, c-format msgid "!File size %ld too large even for multi-SMS ring upload (max=%d)" msgstr "" "!Velikost souboru %ld je pøíli¹ velká i pro víceèás»ové SMS (maximum=%d)" -#: mdsms.c:1361 +#: mdsms.c:1396 #, c-format msgid "" "\n" @@ -673,7 +684,7 @@ msgstr "" "Posílám zvonìní \"%s\" jako %d zpráv(y) (velikost %ld, maximum je %d, " "fragment %d)" -#: mdsms.c:1365 +#: mdsms.c:1400 mdsms.c:1483 #, c-format msgid "" "\n" @@ -682,17 +693,55 @@ msgstr "" "\n" "Pou¾ívám unikátní èíslo víceèás»ové SMS 0x%02X" -#: mdsms.c:1370 +#: mdsms.c:1405 mdsms.c:1490 #, c-format msgid "^Read error on \"%s\", wanted %d, got %d" msgstr "^Chyba pøi ètení \"%s\", vy¾aduji %d, získal jsem %d" -#: mdsms.c:1396 +#: mdsms.c:1457 +#, c-format +msgid "^!Cannot open picture file \"%s\" for r/o" +msgstr "^!Nemohu otevøít soubor s obrázkem \"%s\" pro ètení" + +#: mdsms.c:1461 +#, c-format +msgid "!File \"%s\" size %ld doesn't match .res size for %dx%d picture" +msgstr "" +"!Velikost souboru \"%s\" %ld neodpovídá .res velikosti pro obrázek %dx%d" + +#: mdsms.c:1467 +#, c-format +msgid "" +"\n" +"Sending picture \"%s\" as single SMS (size %ld, max %d)" +msgstr "" +"\n" +"Posílám obrázek \"%s\" jako jedinou SMS zprávu (velikost %ld, maximum je %d)" + +#: mdsms.c:1475 +#, c-format +msgid "!File size %ld too large even for multi-SMS picture upload (max=%d)" +msgstr "" +"!Velikost souboru %ld je pøíli¹ velká i pro víceèás»ové obrázkové SMS " +"(maximum=%d)" + +#: mdsms.c:1479 +#, c-format +msgid "" +"\n" +"Sending picture \"%s\" as %d multi-SMSes (size %ld, max %d, frag %d, header %" +"d)" +msgstr "" +"\n" +"Posílám obrázek \"%s\" jako %d zpráv(y) (velikost %ld, maximum je %d, " +"fragment %d, hlavièka %d)" + +#: mdsms.c:1516 #, c-format msgid "Body too large (%d>%d), cut" msgstr "Velikost SMS textu pøíli¹ velká (%d>%d), zkrátil jsem jej" -#: mdsms.c:1443 +#: mdsms.c:1563 msgid "" "\n" "Please enter the SMS text body, end with EOF (ctrl-D):" @@ -700,324 +749,323 @@ msgstr "" "\n" "Prosím zadejte text SMS zprávy, ukonèení pøes EOF (ctrl-D):" -#: mdsms.c:1447 +#: mdsms.c:1567 #, c-format msgid "^!Can't open data file \"%s\" for r/o" msgstr "^!Nemohu otevøít datový soubor \"%s\" pro ètení" -#: mdsms.c:1452 +#: mdsms.c:1572 #, c-format msgid "^!Error reading stream \"%s\"" msgstr "^!Nemohu èíst soubor \"%s\"" -#: mdsms.c:1452 +#: mdsms.c:1572 msgid "" msgstr "" -#: mdsms.c:1471 +#: mdsms.c:1591 msgid ".Waiting for device incoming data.." msgstr ".Èekám na vstupní data ze zaøízení.." -#: mdsms.c:1481 +#: mdsms.c:1601 #, c-format msgid "!Device file descriptor %d can't fit in select() FD_SETSIZE (%d)" msgstr "!Deskriptor zaøízení %d se nevejde do FD_SETSIZE (%d) funkce select()" -#: mdsms.c:1493 +#: mdsms.c:1613 #, c-format msgid "^Failed (retval %d) while waiting for data, ignoring" msgstr "^Selhání (retval %d) pøí èekání na data, ignoruji" -#: mdsms.c:1500 +#: mdsms.c:1620 msgid "^Error while waiting for data, ignoring" msgstr "^Chyba pøi èekání na data, ignoruji" -#: mdsms.c:1508 +#: mdsms.c:1628 msgid "^No data input after waited for data, retrying" msgstr "^Po èekání na data jsem ¾ádná nezískal, zkou¹ím znovu" -#: mdsms.c:1527 +#: mdsms.c:1647 msgid "digit" msgstr "èíslici" -#: mdsms.c:1531 +#: mdsms.c:1651 msgid "+/- sign" msgstr "znaménko + èi -" -#: mdsms.c:1538 +#: mdsms.c:1658 #, c-format msgid "Expected %s, found '%c' at pos %d of string [%s], formatstring [%s]" msgstr "" "Oèekávám %s, nalezl jsem '%c' na pozici %d øetìzce [%s], formátovací øetìzec " "je [%s]" -#: mdsms.c:1543 +#: mdsms.c:1663 #, c-format msgid "String too short for format, string [%s], formatstring [%s]" msgstr "" "Øetìzec je pro daný formát pøíli¹ krátký, øetìzec [%s], formátovací øetìzec " "je [%s]" -#: mdsms.c:1548 +#: mdsms.c:1668 #, c-format msgid "Trailing garbage in string [%s], formatstring [%s]" msgstr "Koncová pøebyteèná data v øetìzci [%s], formátovací øetìzec je [%s]" -#: mdsms.c:1566 +#: mdsms.c:1686 msgid "year" msgstr "roku" -#: mdsms.c:1567 +#: mdsms.c:1687 msgid "month" msgstr "mìsíce" -#: mdsms.c:1568 +#: mdsms.c:1688 msgid "day of month" msgstr "dne v mìsíci" -#: mdsms.c:1569 +#: mdsms.c:1689 msgid "hour" msgstr "hodiny" -#: mdsms.c:1570 +#: mdsms.c:1690 msgid "minute" msgstr "minuty" -#: mdsms.c:1571 +#: mdsms.c:1691 msgid "second" msgstr "sekundy" -#: mdsms.c:1584 +#: mdsms.c:1704 #, c-format msgid "Weird value of %s, is %d but expected %d..%d, setting to %d" msgstr "Divná hodnota %s, je %d, ale oèekávám %d..%d, nastavuji na %d" -#: mdsms.c:1595 +#: mdsms.c:1715 #, c-format msgid "^mktime(3) failed for %s" msgstr "^mktime(3) selhal pro %s" -#: mdsms.c:1608 +#: mdsms.c:1728 #, c-format msgid "Cannot find initial '\"' in CMT header: %s" msgstr "Nemohu nalézt poèáteèní '\"' v CMT hlavièce: %s" -#: mdsms.c:1613 +#: mdsms.c:1733 #, c-format msgid "Only one '\"' found in CMT header: %s" msgstr "Nalezl jsem pouze jednu '\"' v CMT hlavièce: %s" -#: mdsms.c:1623 +#: mdsms.c:1743 #, c-format msgid "%s in CMT header: %s" msgstr "%s v CMT hlavièce: %s" -#: mdsms.c:1644 +#: mdsms.c:1765 #, c-format msgid ".Child process w/PID %d has exited, %s, status=%d" -msgstr ".Spu¹tìný proces s PID %d skonèil, %s, status=%s" +msgstr ".Spu¹tìný proces s PID %d skonèil, %s, status=%d" -#: mdsms.c:1645 +#: mdsms.c:1766 msgid "normally" msgstr "normálnì" -#: mdsms.c:1645 +#: mdsms.c:1766 msgid "abnormally" msgstr "nekorektnì" -#: mdsms.c:1666 +#: mdsms.c:1787 #, c-format msgid ".Spawned child receive-SMS process w/PID %d" msgstr ".Spu¹tìn proces po pøijetí SMS s PID %d" -#: mdsms.c:1670 +#: mdsms.c:1791 msgid "Can't fork(2), process spawning may block receive" msgstr "Nemohu provést fork(2), spou¹tìní procesu mù¾e zablokovat ètení zpráv" -#: mdsms.c:1699 +#: mdsms.c:1820 msgid "Failing ctime(3), ignoring substitution" msgstr "ctime(3) sehlal, ignoruji substituci" -#: mdsms.c:1713 +#: mdsms.c:1834 #, c-format msgid "^Failing spawn of receive command: %s" msgstr "^Selhalo spu¹tìní pøíjímacího pøíkazu: %s" -#: mdsms.c:1717 +#: mdsms.c:1838 #, c-format msgid "^Failing write to child receive command: %s" msgstr "^Selhal zápis na vstup pøijímacího pøíkazu: %s" -#: mdsms.c:1719 +#: mdsms.c:1840 #, c-format msgid "^Spawned receive command failure (code %d): %s" msgstr "^Selhání pøijímacího pøíkazu (kód %d): %s" -#: mdsms.c:1761 +#: mdsms.c:1882 #, c-format msgid "Invalid value of \"%s\" at offset %d in: %s" msgstr "Nepovolená hodnota \"%s\" na pozici %d ve: %s" -#: mdsms.c:1783 +#: mdsms.c:1904 #, c-format msgid "PDU too long (%d/2) to be valid: %s" msgstr "PDU zprávy pøíli¹ dlouhé (%d/2) na to, aby mohlo být správné: %s" -#: mdsms.c:1785 +#: mdsms.c:1906 #, c-format msgid "PDU length odd (%d): %s" msgstr "Délka PDU zprávy je lichá (%d): %s" -#: mdsms.c:1787 +#: mdsms.c:1908 #, c-format msgid "PDU length %d too small (min. 2*%d): %s" msgstr "Délka PDU zprávy %d je pøíli¹ malá (min. 2*%d): %s" -#: mdsms.c:1790 +#: mdsms.c:1911 #, c-format msgid "Invalid hex byte: %c%c on byte %d in: %s" msgstr "Nepovolené hexadecimální vyjádøení bajtu: %c%c na bajtu %d ve: %s" -#: mdsms.c:1801 +#: mdsms.c:1922 #, c-format msgid "SMSC length too large (%d, max. %d): %s" msgstr "Délka SMSC pøíli¹ velká (%d, max. %d): %s" -#: mdsms.c:1807 mdsms.c:1826 +#: mdsms.c:1928 mdsms.c:1947 #, c-format msgid "Unknown address type 0x%02X of %s, ignoring in PDU: %s" msgstr "Neznámý typ adresy 0x%02X v %s, ignoruji v PDU: %s" -#: mdsms.c:1807 mdsms.c:1810 +#: mdsms.c:1928 mdsms.c:1931 msgid "SMSC" msgstr "SMSC" -#: mdsms.c:1810 +#: mdsms.c:1931 #, c-format msgid "Some digits unrecognized in %s \"%s\", ignoring in PDU: %s" msgstr "Nìkteré èíslice nebyly rozpoznány ve %s \"%s\", ignoruji v PDU: %s" -#. PDU type -#: mdsms.c:1814 +#: mdsms.c:1935 #, c-format msgid "Unrecognized PDU type 0x%02X at offset %d, dropping: %s" msgstr "Nerozpoznaný typ PDU 0x%02X na pozici %d, zahazuji: %s" -#. OA len -#: mdsms.c:1818 +#: mdsms.c:1939 #, c-format msgid "Originating number too large (0x%X, max. 2*0x%X): %s" msgstr "Telefonní èíslo odesílate pøíli¹ dlouhé (0x%X, max. 2*0x%X): %s" -#: mdsms.c:1820 +#: mdsms.c:1941 #, c-format msgid "PDU length too short (want %d, is %d): %s" msgstr "Délka PDU pøíli¹ krátká (po¾aduji %d, je %d): %s" -#: mdsms.c:1826 mdsms.c:1831 +#: mdsms.c:1947 mdsms.c:1952 msgid "originating number" msgstr "zdrojovém telefonním èíslu" -#: mdsms.c:1830 +#: mdsms.c:1951 #, c-format msgid "Some digits unrecognized in %s \"%s\", ignoring in PDU at offset %d: %s" msgstr "" "Nìkteré èíslice nebyly rozpoznány ve %s \"%s\", ignoruji v PDU na pozici %d: " "%s" -#. PID -#: mdsms.c:1834 +#: mdsms.c:1955 #, c-format msgid "PID number %02X unsupported, ignoring: %s" msgstr "Hodnota PID %02X nepodporována, ignoruji: %s" -#: mdsms.c:1838 +#: mdsms.c:1959 #, c-format msgid "DCS 0x%02X indicates 8-bit data, unsupported, dropping: %s" msgstr "" "Hodnota DCS 0x%02X vyjadøuje 8-mi bitová data, nepodporováno, zahazuji: %s" -#: mdsms.c:1839 +#: mdsms.c:1960 #, c-format msgid "DCS 0x%02X unsupported, will attempt decoding: %s" msgstr "Hodnota DCS 0x%02X nepodporována, pokusím se o dekódování: %s" -#: mdsms.c:1847 +#: mdsms.c:1968 #, c-format msgid "PDU data (%d) exceed maximum length of %d bytes, cut: %s" msgstr "Délka PDU dat (%d) pøekraèuje maximální hodnotu %d bajtù, oøíznuto: %s" -#: mdsms.c:1857 +#: mdsms.c:1978 #, c-format msgid "" "PDU data length (%d/7->%d/8) longer than data (%d), cut to %d/7->%d/8: %s" msgstr "" -"Délka PDU dat (%d/7->%d/8) del¹í ne¾ naètená data (%d), oøíznuto na " -"%d/7->%d/8: %s" +"Délka PDU dat (%d/7->%d/8) del¹í ne¾ naètená data (%d), oøíznuto na %d/7->%" +"d/8: %s" -#: mdsms.c:1926 +#: mdsms.c:2048 msgid "" "atexit(3) not available at compilation time, device cleanup may be missed" msgstr "" "atexit(3) nebyla pøi kompilaci k dispozici, úklid stavu zaøízení nemusí být " "vykonán" -#: mdsms.c:1944 +#: mdsms.c:2066 msgid "" msgstr "" -#: mdsms.c:1957 +#: mdsms.c:2079 #, c-format msgid ".Detected mode \"%s\" from my program name \"%s\"" -msgstr ".Zdetekován re¾im \"%s\" z mého jména programu \"%\"" +msgstr ".Zdetekován re¾im \"%s\" z mého jména programu \"%s\"" -#: mdsms.c:1959 +#: mdsms.c:2081 #, c-format msgid ".Automatic mode detection unsuccessul for my progam name \"%s\"" msgstr "" ".Automatická detekce re¾imu byla pro mé jméno programu \"%s\" neúspì¹ná" -#: mdsms.c:1963 +#: mdsms.c:2085 msgid "!Operation mode unset, use --send or similiar command, see help (-h)" msgstr "" "!Re¾im operace není nastaven, pou¾ijte --send èi jiný podobný argument, více " "viz nápovìda (-h)" -#: mdsms.c:1964 +#: mdsms.c:2086 #, c-format msgid ".Running program in mode \"%s\"" msgstr ".Program byl spu¹tìn v re¾imu \"%s\"" -#: mdsms.c:1980 +#: mdsms.c:2103 #, c-format msgid "Missing parameter \"%s\"" msgstr "Chybí argument \"%s\"" -#: mdsms.c:1983 +#: mdsms.c:2106 #, c-format msgid "!Previous %s considered unrecoverable" msgstr "!Pøedchozí %s pova¾uji za fatální" -#: mdsms.c:1983 +#: mdsms.c:2106 msgid "error" msgstr "chybu" -#: mdsms.c:1983 +#: mdsms.c:2106 msgid "errors" msgstr "chyby" -#: mdsms.c:1994 +#: mdsms.c:2117 #, c-format msgid "!Number parse error for parameter \"%s\" of \"%s\" at: %s" msgstr "" "!Chyba pøi dekódování èísla pro argument \"%s\" ze \"%s\" na pozici: %s" -#: mdsms.c:2015 +#: mdsms.c:2138 +#, c-format msgid "!Only one \"%%s\" permitted in lockfile format-string" msgstr "" "!Ve formátovacím øetìzci uzamykacího soubor je \"%%s\" povoleno jen jedno" -#: mdsms.c:2018 +#: mdsms.c:2141 +#, c-format msgid "" "!Invalid format-character '%c' in lockfile format-string, only \"%%s\" " "allowed" @@ -1025,94 +1073,104 @@ msgstr "" "!Neznámý formátovací znak '%c' ve formátovacím øetìzci uzamykacího souboru, " "pouze \"%%s\" je povoleno" -#: mdsms.c:2023 +#: mdsms.c:2146 #, c-format msgid "^!Error opening log \"%s\" for append" msgstr "^!Chyba pøi otevírání logovacího souboru \"%s\" pro pøidávání (append)" -#: mdsms.c:2024 +#: mdsms.c:2147 #, c-format msgid "Starting up: %s" msgstr "Program spu¹tìn: %s" -#: mdsms.c:2043 +#: mdsms.c:2169 #, c-format msgid "Warning: -f / --file is forbidden with mode \"%s\"" msgstr "Varování: -f / --file jsou povoleny jen v re¾imu \"%s\"" -#: mdsms.c:2050 mdsms.c:2060 +#: mdsms.c:2176 mdsms.c:2186 #, c-format msgid "!Unrecognized %s argument \"%s\", supported only: %s" msgstr "!Nerozpoznaný %s argument \"%s\", podporovány pouze: %s" -#: mdsms.c:2072 +#: mdsms.c:2198 #, c-format msgid "!Specified baudrate %ld is not supported" msgstr "!Specifikovaná baudová rychlost %ld není podporována" -#: mdsms.c:2074 +#: mdsms.c:2200 #, c-format msgid ".Will use baudrate %ld with hexval 0x%X" msgstr ".Pou¾iji baudovou rychlost %ld, hex hodnota 0x%X" -#: mdsms.c:2078 +#: mdsms.c:2204 #, c-format msgid ".Locking device \"%s\" by \"%s\".." msgstr ".Uzamykám zaøízení \"%s\" souborem \"%s\".." -#: mdsms.c:2083 +#: mdsms.c:2209 #, c-format msgid "Device lock succeeded after %ld seconds" msgstr "Uzamknutí zaøízení uspìlo po %ld sekundách" -#: mdsms.c:2085 +#: mdsms.c:2214 #, c-format msgid ".Opening device \"%s\".." msgstr ".Otevírám zaøízení \"%s\".." -#: mdsms.c:2087 +#: mdsms.c:2216 #, c-format msgid "^!Cannot open device \"%s\" for r/w access" msgstr "^!Nemohu otevøít zaøízení \"%s\" pro ètení i zápis" -#: mdsms.c:2090 +#: mdsms.c:2221 msgid "^Unable to get termios settings" msgstr "^Nemohu získat terminálová nastavení (termios)" -#: mdsms.c:2104 +#: mdsms.c:2235 msgid "^Error setting termios baudrate on device" msgstr "^Nemohu nastavit vlastnosti terminálu (termios) zaøízení" -#: mdsms.c:2106 +#: mdsms.c:2237 msgid "^Error flushing termios (TCIOFLUSH) on device" msgstr "^Nemohu vyprázdnit vstupnì-výstupní fronty (TCIOFLUSH) zaøízení" -#: mdsms.c:2108 +#: mdsms.c:2239 msgid "^!Unable to set initial termios device settings" msgstr "^!Nemohu nastavit poèáteèní vlastnosti terminálu (termios)" -#: mdsms.c:2125 +#: mdsms.c:2255 msgid ".Using AT+CMGF=1 (text mode).." msgstr ".Pou¾ívám AT+CMGF=1 (textový re¾im).." -#: mdsms.c:2131 +#: mdsms.c:2261 msgid ".Using AT+CMGF=0 (PDU mode).." msgstr ".Pou¾ívám AT+CMGF=0 (PDU re¾im).." -#: mdsms.c:2180 +#: mdsms.c:2312 msgid ".Initialization successful, infinite retry count set" msgstr ".Inicializace úspì¹ná, nastavil jsem nekoneèné opakování" -#: mdsms.c:2190 +#: mdsms.c:2322 msgid ".Dialout detected, waiting for lock.." msgstr ".Detekováno odchozí voláni, èekám na uzamknutí.." -#: mdsms.c:2202 +#: mdsms.c:2323 +#, c-format +msgid ".Closing device \"%s\".." +msgstr ".Uzavírám zaøízení \"%s\".." + +#: mdsms.c:2325 +#, c-format +msgid "Error closing device \"%s\"" +msgstr "Chyba pøi uzavírání zaøízení \"%s\"" + +#: mdsms.c:2340 #, c-format msgid "Receive-header parsing failed on: %s" msgstr "Selhalo dekódování pøijímací hlavièky na: %s" -#: mdsms.c:2219 +#: mdsms.c:2358 #, c-format msgid "" "\n" @@ -1121,12 +1179,12 @@ msgstr "" "\n" "Zpráva úspì¹nì odeslána s MR (referenèní èíslo zprávy): %s" -#: mdsms.c:2224 +#: mdsms.c:2363 #, c-format msgid "SMS sent (after %d retries), %d part(s)" msgstr "SMS odeslána (po %d opakováních), celkem %d èást(í)" -#: mdsms.c:2226 +#: mdsms.c:2365 #, c-format msgid "SMS sent (after %d retries)" msgstr "SMS odeslána (po %d opakováních)" diff --git a/strdup.c b/strdup.c new file mode 100644 index 0000000..1dfd7e7 --- /dev/null +++ b/strdup.c @@ -0,0 +1,24 @@ +#include "config.h" +#ifndef lint +static char rcsid[] ATTR_UNUSED = "$Id$"; +#endif + +/* This part of code is a public domain */ + +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +/* CONFORMING TO SVID 3, BSD 4.3 */ + +char *strdup(const char *s) +{ +size_t l; +char *d; + + if (!(d=malloc(l=strlen(s)+1))) return(NULL); + return memcpy(d,s,l); +} diff --git a/usleep.c b/usleep.c new file mode 100644 index 0000000..ecbd104 --- /dev/null +++ b/usleep.c @@ -0,0 +1,27 @@ +#include "config.h" +#ifndef lint +static char rcsid[] ATTR_UNUSED = "$Id$"; +#endif + +/* This part of code is a public domain */ + +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +/* CONFORMING TO BSD 4.3 */ + +void usleep(unsigned long usec) +{ +struct timeval tv; + + tv.tv_sec =usec/1000000; + tv.tv_usec=usec%1000000; + select(0,NULL,NULL,NULL,&tv); +}