diff options
Diffstat (limited to '')
42 files changed, 223 insertions, 4505 deletions
@@ -1,19 +1,6 @@ -_/ -/bin/ -/obj/ -/aux/ -\#*\# -.* -!.git* +*\#* *~ -*.bak -*.new -*.swo -*.swp *.out *.o *.su -*.gch -/Makefile -/config.status - +/learn-your-telephone-number diff --git a/COPYING b/COPYING deleted file mode 100644 index d409432..0000000 --- a/COPYING +++ /dev/null @@ -1,20 +0,0 @@ -Copyright © 2016 Mattias Andrée <maandree@member.fsf.org> - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - diff --git a/DEPENDENCIES b/DEPENDENCIES deleted file mode 100644 index 4905e5a..0000000 --- a/DEPENDENCIES +++ /dev/null @@ -1,23 +0,0 @@ -RUNTIME DEPENDENCIES: - - libc - - -BUILD DEPENDENCIES: - - libc - make - coreutils - c99 - texinfo>=4.11 (opt-out, for info, pdf, dvi, ps, and html manuals) - texlive-plainextra (opt-in, for pdf, dvi, and ps manuals) - - texinfo<4.11 can be used if '@frenchspacing on' is removed. - - -INSTALL DEPENDENCIES: - - make - coreutils - texinfo (opt-out, for dir-entry of info manual) - diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 524a678..0000000 --- a/INSTALL +++ /dev/null @@ -1,98 +0,0 @@ -Type './configure --help' for configuration options. The normal settings for a -GNU package should work. If not, please make a bug report. - - On a common GNU/Linux distribution the following should - be sufficient for most users: - - ./configure --prefix=/usr - make - make install DESTDIR="somewhere you want the files for now" - # Now let the package manager put the files in place... - - Or for an unstaged install: - - ./configure --prefix=/usr - make - sudo make install - -By default any applicable pre-install, post-install, pre-uninstall, and -post-install commands is run. This suppress these, run 'make' with 'N=true' -or 'N=:'. IF you want to know which these commands are, you can use the -methods specificed in the GNU Coding Standards. Another method is found in -mk/README. However, for this packages, these will be: - - infodir="usr/local/share/info" ## Assuming default prefix. - - post_install () { - install-info -- "${infodir}/learn-your-telephone-number.info" "${infodir}/dir" - } - - pre_uninstall () { - install-info --delete -- "${infodir}/learn-your-telephone-number.info" "${infodir}/dir" - } - - -──────────────────────────────────────────────────────────────────────────────── -INTERNATIONALISATION -──────────────────────────────────────────────────────────────────────────────── - -You can select which translations of the man page you -want to install too: - - ./configure MAN_LOCALES=sv - -(Note, there are no translation as of yet.) - - -──────────────────────────────────────────────────────────────────────────────── -CUSTOMISED COMPILATION -──────────────────────────────────────────────────────────────────────────────── - -The makefile is configured to compile the C code with -O2 -g, you can -change this by setting OPTIMISE, or with CFLAGS and LDFLAGS if you want -to change all optional flags compiling and linking flags: - - ./configure OPTIMISE="-Og -g" - - -──────────────────────────────────────────────────────────────────────────────── -CUSTOMISED INSTALLATION -──────────────────────────────────────────────────────────────────────────────── - -If you want to install absolutely everything, you can -instead use the commands below: - - make everything - make install-everything DESTDIR="pkg" - -Or if you only want to absolute basics: - - make base - make install-base DESTDIR="pkg" - -You can select freely what parts of the package to install and not -to install. This rules are available: - -┌─────────────┬─────────────────────┬────────────────────────────────────────────┐ -│ COMPILATION │ INSTALLATION │ DESCRIPTION │ -├─────────────┼─────────────────────┼────────────────────────────────────────────┤ -│ base │ install-base │ Install be basics: │ -│ cmd │ install-cmd │ Install the command. │ -│ │ install-copyright │ Install the Expat license. │ -│ doc │ install-doc │ Include all manuals: │ -│ info │ install-info │ Include info manual. (Texinfo) │ -│ dvi │ install-dvi │ Include DVI manual. (Texinfo) │ -│ pdf │ install-pdf │ Include PDF manual. (Texinfo) │ -│ ps │ install-ps │ Include PostScript manual. (Texinfo) │ -│ html │ install-html │ Include multifile HTML manual. (Texinfo) │ -│ │ install-man │ Include man pages. │ -└─────────────┴─────────────────────┴────────────────────────────────────────────┘ - -install, install-everything, install-base, and install-cmd, have alternatives -that installs a stripped binary: install-strip, install-everything-strip, -install-base-strip, and install-cmd-strip, respectively. - -The untranslated man page is installed via the rule install-man-untranslated. -Additional translations are installed via the rule install-man-locale, which -installs the locales listed in MAN_LOCALES. - @@ -0,0 +1,15 @@ +ISC License + +© 2016, 2017 Mattias Andrée <maandree@kth.se> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..73e7fb2 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +.POSIX: + +CONFIGFILE = config.mk +include $(CONFIGFILE) + +all: learn-your-telephone-number + +learn-your-telephone-number: learn-your-telephone-number.o + $(CC) -o $@ $@.o $(LDFLAGS) + +clean: + -rm -f -- learn-your-telephone-number *.o + +.SUFFIXES: +.SUFFIXES: .o .c + +.PHONY: all install uninstall clean diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index d0b14bf..0000000 --- a/Makefile.in +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright (C) 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -### This file will be stored to Makefile once you have run ./configure. ### -### See INSTALL for information on how to install this package. ### - - - -# List of translations to install. -#LOCALES = - -# List of man page translations to install. -#MAN_LOCALES = - -# Can change these variables with ./configure in the same why you -# would configure them when running make. - - - -##### What is below this line is configurable, but is seldom useful. ##### - - -# Additional options for compiling info and HTML manuals. -INFO_FLAGS = - -# Additional options for compiling DVI, PDF, and PostScript manuals. -TEXINFO_FLAGS = - -# The name of the package as it should be installed. -PKGNAME = learn-your-telephone-number - -# The name of the command as it should be installed. -COMMAND = learn-your-telephone-number - - - -##### Nothing interesting below this. ##### - - -# In case you want add some configurations. Primarily -# intended for maintainers. Perhaps add GPG_KEY here. -# Of course, you can declare everthing with ./configure, -# but with this you are less likely to forget it. --include .make-configurations - - -# YOU, AS A USER, SHOULD NOT CHANGE THESE VARIABLES. {{ -# They specify how the reusable makefiles in mk/ shall behave. - -# Package information. -_PROJECT = learn-your-telephone-number -_VERSION = 1.0 - -# Used by mk/lang-c.mk -_C_STD = c99 -_PEDANTIC = yes -_BIN = learn-your-telephone-number -_OBJ_learn-your-telephone-number = learn-your-telephone-number -_HEADER_DIRLEVELS = 0 -_CPPFLAGS = -D'PACKAGE="$(PKGNAME)"' -D'PROGRAM_VERSION="$(_VERSION)"' - -# Used by mk/texinfo.mk -_TEXINFO_DIRLEVELS = 2 -_INFOPARTS = 0 -_HAVE_TEXINFO_MANUAL = yes -_HTML_FILES = Free-Software-Needs-Free-Documentation.html GNU-Free-Documentation-License.html \ - index.html Invoking.html Overview.html - -# Used by mk/man.mk -_MAN_PAGE_SECTIONS = 1 -_MAN_1 = learn-your-telephone-number - -# Used by mk/copy.mk -_COPYING = COPYING - -# Used by mk/dist.mk -___EVERYTHING_INFO = sleeping-getty titlepage-data content hardcopy-copying \ - appx/fdl appx/free-software-needs-free-documentation \ - chap/invoking chap/overview \ - reusable/macros reusable/paper reusable/titlepage -_SRC = $(foreach B,$(_SBIN),$(foreach F,$(_OBJ_$(B)),$(F).c)) -_EVERYTHING = $(__EVERYTHING_ALL_COMMON) DEPENDENCIES INSTALL NEWS \ - $(foreach F,$(___EVERYTHING_INFO),doc/info/$(F).texinfo) - -# }} - - -# All of the make rules and the configurations. -include $(v)mk/all.mk - @@ -1,6 +0,0 @@ -learn-your-telephone-number NEWS -*- outline -*- - -* Noteworthy changes in release 1.0 (TO BE DETERMINED) [stable] - - Initial release. - @@ -2,11 +2,11 @@ NAME learn-your-telephone-number - Learn your telephone number SYNOPSIS - learn-your-telephone-number TELEPHONE-NUMBER + learn-your-telephone-number telephone-number DESCRIPTION learn-your-telephone-number asks you to enter your - telephone number. If the entered number is TELEPHONE-NUMBER + telephone number. If the entered number is telephone-number the program exits with status 0, if not the program will print the differences and exit with status 1. @@ -15,9 +15,9 @@ DESCRIPTION laptop. EXIT STATUS - 0 The entered number matched TELEPHONE-NUMBER. + 0 The entered number matched telephone-number. - 1 The entered number did not match TELEPHONE-NUMBER. + 1 The entered number did not match telephone-number. 2 The command fail. diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..72bb488 --- /dev/null +++ b/config.mk @@ -0,0 +1,6 @@ +PREFIX = /usr/local +MANPREFIX = $(PREFIX)/share/man + +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 +CPFLAGS = -std=c99 -Wall -Wextra -O2 $(CPPFLAGS) +LDFLAGS = -s diff --git a/configure b/configure deleted file mode 100755 index 6e7e342..0000000 --- a/configure +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -# Run './configure --help' for usage information. - - -PKGNAME=learn-your-telephone-number -MAN_SECTION_SUFFIX= -MAN_SECTION=1 - - -list_optional_features_help () -{ - true -} - -unrecognised_argument () -{ - option="${1}" - case "${option}" in - (--build | --target | --host) - incomplete="${option}" ;; - (--build=*) - ;; - (--target=*) - ;; - (--host=*) - ;; - (*) - ;; - esac -} - -. "$(dirname "${0}")"/mk/configure - - -cat <<EOF - -You can now run 'make && make install'. - -EOF - diff --git a/doc/info/appx/fdl.texinfo b/doc/info/appx/fdl.texinfo deleted file mode 100644 index cb71f05..0000000 --- a/doc/info/appx/fdl.texinfo +++ /dev/null @@ -1,505 +0,0 @@ -@c The GNU Free Documentation License. -@center Version 1.3, 3 November 2008 - -@c This file is intended to be included within another document, -@c hence no sectioning command or @node. - -@display -Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. -@uref{http://fsf.org/} - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -@end display - -@enumerate 0 -@item -PREAMBLE - -The purpose of this License is to make a manual, textbook, or other -functional and useful document @dfn{free} in the sense of freedom: to -assure everyone the effective freedom to copy and redistribute it, -with or without modifying it, either commercially or noncommercially. -Secondarily, this License preserves for the author and publisher a way -to get credit for their work, while not being considered responsible -for modifications made by others. - -This License is a kind of ``copyleft'', which means that derivative -works of the document must themselves be free in the same sense. It -complements the GNU General Public License, which is a copyleft -license designed for free software. - -We have designed this License in order to use it for manuals for free -software, because free software needs free documentation: a free -program should come with manuals providing the same freedoms that the -software does. But this License is not limited to software manuals; -it can be used for any textual work, regardless of subject matter or -whether it is published as a printed book. We recommend this License -principally for works whose purpose is instruction or reference. - -@item -APPLICABILITY AND DEFINITIONS - -This License applies to any manual or other work, in any medium, that -contains a notice placed by the copyright holder saying it can be -distributed under the terms of this License. Such a notice grants a -world-wide, royalty-free license, unlimited in duration, to use that -work under the conditions stated herein. The ``Document'', below, -refers to any such manual or work. Any member of the public is a -licensee, and is addressed as ``you''. You accept the license if you -copy, modify or distribute the work in a way requiring permission -under copyright law. - -A ``Modified Version'' of the Document means any work containing the -Document or a portion of it, either copied verbatim, or with -modifications and/or translated into another language. - -A ``Secondary Section'' is a named appendix or a front-matter section -of the Document that deals exclusively with the relationship of the -publishers or authors of the Document to the Document's overall -subject (or to related matters) and contains nothing that could fall -directly within that overall subject. (Thus, if the Document is in -part a textbook of mathematics, a Secondary Section may not explain -any mathematics.) The relationship could be a matter of historical -connection with the subject or with related matters, or of legal, -commercial, philosophical, ethical or political position regarding -them. - -The ``Invariant Sections'' are certain Secondary Sections whose titles -are designated, as being those of Invariant Sections, in the notice -that says that the Document is released under this License. If a -section does not fit the above definition of Secondary then it is not -allowed to be designated as Invariant. The Document may contain zero -Invariant Sections. If the Document does not identify any Invariant -Sections then there are none. - -The ``Cover Texts'' are certain short passages of text that are listed, -as Front-Cover Texts or Back-Cover Texts, in the notice that says that -the Document is released under this License. A Front-Cover Text may -be at most 5 words, and a Back-Cover Text may be at most 25 words. - -A ``Transparent'' copy of the Document means a machine-readable copy, -represented in a format whose specification is available to the -general public, that is suitable for revising the document -straightforwardly with generic text editors or (for images composed of -pixels) generic paint programs or (for drawings) some widely available -drawing editor, and that is suitable for input to text formatters or -for automatic translation to a variety of formats suitable for input -to text formatters. A copy made in an otherwise Transparent file -format whose markup, or absence of markup, has been arranged to thwart -or discourage subsequent modification by readers is not Transparent. -An image format is not Transparent if used for any substantial amount -of text. A copy that is not ``Transparent'' is called ``Opaque''. - -Examples of suitable formats for Transparent copies include plain -ASCII without markup, Texinfo input format, La@TeX{} input -format, SGML or XML using a publicly available -DTD, and standard-conforming simple HTML, -PostScript or PDF designed for human modification. Examples -of transparent image formats include PNG, XCF and -JPG. Opaque formats include proprietary formats that can be -read and edited only by proprietary word processors, SGML or -XML for which the DTD and/or processing tools are -not generally available, and the machine-generated HTML, -PostScript or PDF produced by some word processors for -output purposes only. - -The ``Title Page'' means, for a printed book, the title page itself, -plus such following pages as are needed to hold, legibly, the material -this License requires to appear in the title page. For works in -formats which do not have any title page as such, ``Title Page'' means -the text near the most prominent appearance of the work's title, -preceding the beginning of the body of the text. - -The ``publisher'' means any person or entity that distributes copies -of the Document to the public. - -A section ``Entitled XYZ'' means a named subunit of the Document whose -title either is precisely XYZ or contains XYZ in parentheses following -text that translates XYZ in another language. (Here XYZ stands for a -specific section name mentioned below, such as ``Acknowledgements'', -``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' -of such a section when you modify the Document means that it remains a -section ``Entitled XYZ'' according to this definition. - -The Document may include Warranty Disclaimers next to the notice which -states that this License applies to the Document. These Warranty -Disclaimers are considered to be included by reference in this -License, but only as regards disclaiming warranties: any other -implication that these Warranty Disclaimers may have is void and has -no effect on the meaning of this License. - -@item -VERBATIM COPYING - -You may copy and distribute the Document in any medium, either -commercially or noncommercially, provided that this License, the -copyright notices, and the license notice saying this License applies -to the Document are reproduced in all copies, and that you add no other -conditions whatsoever to those of this License. You may not use -technical measures to obstruct or control the reading or further -copying of the copies you make or distribute. However, you may accept -compensation in exchange for copies. If you distribute a large enough -number of copies you must also follow the conditions in section 3. - -You may also lend copies, under the same conditions stated above, and -you may publicly display copies. - -@item -COPYING IN QUANTITY - -If you publish printed copies (or copies in media that commonly have -printed covers) of the Document, numbering more than 100, and the -Document's license notice requires Cover Texts, you must enclose the -copies in covers that carry, clearly and legibly, all these Cover -Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -the back cover. Both covers must also clearly and legibly identify -you as the publisher of these copies. The front cover must present -the full title with all words of the title equally prominent and -visible. You may add other material on the covers in addition. -Copying with changes limited to the covers, as long as they preserve -the title of the Document and satisfy these conditions, can be treated -as verbatim copying in other respects. - -If the required texts for either cover are too voluminous to fit -legibly, you should put the first ones listed (as many as fit -reasonably) on the actual cover, and continue the rest onto adjacent -pages. - -If you publish or distribute Opaque copies of the Document numbering -more than 100, you must either include a machine-readable Transparent -copy along with each Opaque copy, or state in or with each Opaque copy -a computer-network location from which the general network-using -public has access to download using public-standard network protocols -a complete Transparent copy of the Document, free of added material. -If you use the latter option, you must take reasonably prudent steps, -when you begin distribution of Opaque copies in quantity, to ensure -that this Transparent copy will remain thus accessible at the stated -location until at least one year after the last time you distribute an -Opaque copy (directly or through your agents or retailers) of that -edition to the public. - -It is requested, but not required, that you contact the authors of the -Document well before redistributing any large number of copies, to give -them a chance to provide you with an updated version of the Document. - -@item -MODIFICATIONS - -You may copy and distribute a Modified Version of the Document under -the conditions of sections 2 and 3 above, provided that you release -the Modified Version under precisely this License, with the Modified -Version filling the role of the Document, thus licensing distribution -and modification of the Modified Version to whoever possesses a copy -of it. In addition, you must do these things in the Modified Version: - -@enumerate A -@item -Use in the Title Page (and on the covers, if any) a title distinct -from that of the Document, and from those of previous versions -(which should, if there were any, be listed in the History section -of the Document). You may use the same title as a previous version -if the original publisher of that version gives permission. - -@item -List on the Title Page, as authors, one or more persons or entities -responsible for authorship of the modifications in the Modified -Version, together with at least five of the principal authors of the -Document (all of its principal authors, if it has fewer than five), -unless they release you from this requirement. - -@item -State on the Title page the name of the publisher of the -Modified Version, as the publisher. - -@item -Preserve all the copyright notices of the Document. - -@item -Add an appropriate copyright notice for your modifications -adjacent to the other copyright notices. - -@item -Include, immediately after the copyright notices, a license notice -giving the public permission to use the Modified Version under the -terms of this License, in the form shown in the Addendum below. - -@item -Preserve in that license notice the full lists of Invariant Sections -and required Cover Texts given in the Document's license notice. - -@item -Include an unaltered copy of this License. - -@item -Preserve the section Entitled ``History'', Preserve its Title, and add -to it an item stating at least the title, year, new authors, and -publisher of the Modified Version as given on the Title Page. If -there is no section Entitled ``History'' in the Document, create one -stating the title, year, authors, and publisher of the Document as -given on its Title Page, then add an item describing the Modified -Version as stated in the previous sentence. - -@item -Preserve the network location, if any, given in the Document for -public access to a Transparent copy of the Document, and likewise -the network locations given in the Document for previous versions -it was based on. These may be placed in the ``History'' section. -You may omit a network location for a work that was published at -least four years before the Document itself, or if the original -publisher of the version it refers to gives permission. - -@item -For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve -the Title of the section, and preserve in the section all the -substance and tone of each of the contributor acknowledgements and/or -dedications given therein. - -@item -Preserve all the Invariant Sections of the Document, -unaltered in their text and in their titles. Section numbers -or the equivalent are not considered part of the section titles. - -@item -Delete any section Entitled ``Endorsements''. Such a section -may not be included in the Modified Version. - -@item -Do not retitle any existing section to be Entitled ``Endorsements'' or -to conflict in title with any Invariant Section. - -@item -Preserve any Warranty Disclaimers. -@end enumerate - -If the Modified Version includes new front-matter sections or -appendices that qualify as Secondary Sections and contain no material -copied from the Document, you may at your option designate some or all -of these sections as invariant. To do this, add their titles to the -list of Invariant Sections in the Modified Version's license notice. -These titles must be distinct from any other section titles. - -You may add a section Entitled ``Endorsements'', provided it contains -nothing but endorsements of your Modified Version by various -parties---for example, statements of peer review or that the text has -been approved by an organization as the authoritative definition of a -standard. - -You may add a passage of up to five words as a Front-Cover Text, and a -passage of up to 25 words as a Back-Cover Text, to the end of the list -of Cover Texts in the Modified Version. Only one passage of -Front-Cover Text and one of Back-Cover Text may be added by (or -through arrangements made by) any one entity. If the Document already -includes a cover text for the same cover, previously added by you or -by arrangement made by the same entity you are acting on behalf of, -you may not add another; but you may replace the old one, on explicit -permission from the previous publisher that added the old one. - -The author(s) and publisher(s) of the Document do not by this License -give permission to use their names for publicity for or to assert or -imply endorsement of any Modified Version. - -@item -COMBINING DOCUMENTS - -You may combine the Document with other documents released under this -License, under the terms defined in section 4 above for modified -versions, provided that you include in the combination all of the -Invariant Sections of all of the original documents, unmodified, and -list them all as Invariant Sections of your combined work in its -license notice, and that you preserve all their Warranty Disclaimers. - -The combined work need only contain one copy of this License, and -multiple identical Invariant Sections may be replaced with a single -copy. If there are multiple Invariant Sections with the same name but -different contents, make the title of each such section unique by -adding at the end of it, in parentheses, the name of the original -author or publisher of that section if known, or else a unique number. -Make the same adjustment to the section titles in the list of -Invariant Sections in the license notice of the combined work. - -In the combination, you must combine any sections Entitled ``History'' -in the various original documents, forming one section Entitled -``History''; likewise combine any sections Entitled ``Acknowledgements'', -and any sections Entitled ``Dedications''. You must delete all -sections Entitled ``Endorsements.'' - -@item -COLLECTIONS OF DOCUMENTS - -You may make a collection consisting of the Document and other documents -released under this License, and replace the individual copies of this -License in the various documents with a single copy that is included in -the collection, provided that you follow the rules of this License for -verbatim copying of each of the documents in all other respects. - -You may extract a single document from such a collection, and distribute -it individually under this License, provided you insert a copy of this -License into the extracted document, and follow this License in all -other respects regarding verbatim copying of that document. - -@item -AGGREGATION WITH INDEPENDENT WORKS - -A compilation of the Document or its derivatives with other separate -and independent documents or works, in or on a volume of a storage or -distribution medium, is called an ``aggregate'' if the copyright -resulting from the compilation is not used to limit the legal rights -of the compilation's users beyond what the individual works permit. -When the Document is included in an aggregate, this License does not -apply to the other works in the aggregate which are not themselves -derivative works of the Document. - -If the Cover Text requirement of section 3 is applicable to these -copies of the Document, then if the Document is less than one half of -the entire aggregate, the Document's Cover Texts may be placed on -covers that bracket the Document within the aggregate, or the -electronic equivalent of covers if the Document is in electronic form. -Otherwise they must appear on printed covers that bracket the whole -aggregate. - -@item -TRANSLATION - -Translation is considered a kind of modification, so you may -distribute translations of the Document under the terms of section 4. -Replacing Invariant Sections with translations requires special -permission from their copyright holders, but you may include -translations of some or all Invariant Sections in addition to the -original versions of these Invariant Sections. You may include a -translation of this License, and all the license notices in the -Document, and any Warranty Disclaimers, provided that you also include -the original English version of this License and the original versions -of those notices and disclaimers. In case of a disagreement between -the translation and the original version of this License or a notice -or disclaimer, the original version will prevail. - -If a section in the Document is Entitled ``Acknowledgements'', -``Dedications'', or ``History'', the requirement (section 4) to Preserve -its Title (section 1) will typically require changing the actual -title. - -@item -TERMINATION - -You may not copy, modify, sublicense, or distribute the Document -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense, or distribute it is void, and -will automatically terminate your rights under this License. - -However, if you cease all violation of this License, then your license -from a particular copyright holder is reinstated (a) provisionally, -unless and until the copyright holder explicitly and finally -terminates your license, and (b) permanently, if the copyright holder -fails to notify you of the violation by some reasonable means prior to -60 days after the cessation. - -Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - -Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, receipt of a copy of some or all of the same material does -not give you any rights to use it. - -@item -FUTURE REVISIONS OF THIS LICENSE - -The Free Software Foundation may publish new, revised versions -of the GNU Free Documentation 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. See -@uref{http://www.gnu.org/copyleft/}. - -Each version of the License is given a distinguishing version number. -If the Document specifies that a particular numbered version of this -License ``or any later version'' applies to it, you have the option of -following the terms and conditions either of that specified version or -of any later version that has been published (not as a draft) by the -Free Software Foundation. If the Document does not specify a version -number of this License, you may choose any version ever published (not -as a draft) by the Free Software Foundation. If the Document -specifies that a proxy can decide which future versions of this -License can be used, that proxy's public statement of acceptance of a -version permanently authorizes you to choose that version for the -Document. - -@item -RELICENSING - -``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any -World Wide Web server that publishes copyrightable works and also -provides prominent facilities for anybody to edit those works. A -public wiki that anybody can edit is an example of such a server. A -``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the -site means any set of copyrightable works thus published on the MMC -site. - -``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0 -license published by Creative Commons Corporation, a not-for-profit -corporation with a principal place of business in San Francisco, -California, as well as future copyleft versions of that license -published by that same organization. - -``Incorporate'' means to publish or republish a Document, in whole or -in part, as part of another Document. - -An MMC is ``eligible for relicensing'' if it is licensed under this -License, and if all works that were first published under this License -somewhere other than this MMC, and subsequently incorporated in whole -or in part into the MMC, (1) had no cover texts or invariant sections, -and (2) were thus incorporated prior to November 1, 2008. - -The operator of an MMC Site may republish an MMC contained in the site -under CC-BY-SA on the same site at any time before August 1, 2009, -provided the MMC is eligible for relicensing. - -@end enumerate - -@page -@heading ADDENDUM: How to use this License for your documents - -To use this License in a document you have written, include a copy of -the License in the document and put the following copyright and -license notices just after the title page: - -@smallexample -@group - Copyright (C) @var{year} @var{your name}. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.3 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. A copy of the license is included in the section entitled ``GNU - Free Documentation License''. -@end group -@end smallexample - -If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, -replace the ``with@dots{}Texts.''@: line with this: - -@smallexample -@group - with the Invariant Sections being @var{list their titles}, with - the Front-Cover Texts being @var{list}, and with the Back-Cover Texts - being @var{list}. -@end group -@end smallexample - -If you have Invariant Sections without Cover Texts, or some other -combination of the three, merge those two alternatives to suit the -situation. - -If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, -to permit their use in free software. - -@c Local Variables: -@c ispell-local-pdict: "ispell-dict" -@c End: diff --git a/doc/info/appx/free-software-needs-free-documentation.texinfo b/doc/info/appx/free-software-needs-free-documentation.texinfo deleted file mode 100644 index 8800993..0000000 --- a/doc/info/appx/free-software-needs-free-documentation.texinfo +++ /dev/null @@ -1,31 +0,0 @@ -@node Free Software Needs Free Documentation -@appendix Free Software Needs Free Documentation - -@indent -@i{The following article was written by Richard Stallman, founder of the GNU Project.} -@* - -@noindent -The biggest deficiency in the free software community today is not in the software --- it is the lack of good free documentation that we can include with the free software. Many of our most important programs do not come with free reference manuals and free introductory texts. Documentation is an essential part of any software package; when an important free software package does not come with a free manual and a free tutorial, that is a major gap. We have many such gaps today. - -Consider Perl, for instance. The tutorial manuals that people normally use are non-free. How did this come about? Because the authors of those manuals published them with restrictive terms --- no copying, no modification, source files not available --- which exclude them from the free software world. - -That wasn't the first time this sort of thing happened, and it was far from the last. Many times we have heard a @sc{GNU} user eagerly describe a manual that he is writing, his intended contribution to the community, only to learn that he had ruined everything by signing a publication contract to make it non-free. - -Free documentation, like free software, is a matter of freedom, not price. The problem with the non-free manual is not that publishers charge a price for printed copies --- that in itself is fine. (The Free Software Foundation sells printed copies of manuals, too.) The problem is the restrictions on the use of the manual. Free manuals are available in source code form, and give you permission to copy and modify. Non-free manuals do not allow this. - -The criteria of freedom for a free manual are roughly the same as for free software. Redistribution (including the normal kinds of commercial redistribution) must be permitted, so that the manual can accompany every copy of the program, both on-line and on paper. - -Permission for modification of the technical content is crucial too. When people modify the software, adding or changing features, if they are conscientious they will change the manual too --- so they can provide accurate and clear documentation for the modified program. A manual that leaves you no choice but to write a new manual to document a changed version of the program is not really available to our community. - -Some kinds of limits on the way modification is handled are acceptable. For example, requirements to preserve the original author's copyright notice, the distribution terms, or the list of authors, are ok. It is also no problem to require modified versions to include notice that they were modified. Even entire sections that may not be deleted or changed are acceptable, as long as they deal with nontechnical topics (like this one). These kinds of restrictions are acceptable because they don't obstruct the community's normal use of the manual. - -However, it must be possible to modify all the technical content of the manual, and then distribute the result in all the usual media, through all the usual channels. Otherwise, the restrictions obstruct the use of the manual, it is not free, and we need another manual to replace it. - -Please spread the word about this issue. Our community continues to lose manuals to proprietary publishing. If we spread the word that free software needs free reference manuals and free tutorials, perhaps the next person who wants to contribute by writing documentation will realize, before it is too late, that only free manuals contribute to the free software community. - -If you are writing documentation, please insist on publishing it under the @sc{GNU} Free Documentation License or another free documentation license. Remember that this decision requires your approval --- you don't have to let the publisher decide. Some commercial publishers will use a free license if you insist, but they will not propose the option; it is up to you to raise the issue and say firmly that this is what you want. If the publisher you are dealing with refuses, please try other publishers. If you're not sure whether a proposed license is free, write to licensing@@gnu.org. - -You can encourage commercial publishers to sell more free, copylefted manuals and tutorials by buying them, and particularly by buying copies from the publishers that paid for their writing or for major improvements. Meanwhile, try to avoid buying non-free documentation at all. Check the distribution terms of a manual before you buy it, and insist that whoever seeks your business must respect your freedom. Check the history of the book, and try reward the publishers that have paid or pay the authors to work on it. - -The Free Software Foundation maintains a list of free documentation published by other publishers, at @url{http://www.fsf.org/doc/other-free-books.html}. diff --git a/doc/info/chap/invoking.texinfo b/doc/info/chap/invoking.texinfo deleted file mode 100644 index 6fdedad..0000000 --- a/doc/info/chap/invoking.texinfo +++ /dev/null @@ -1,15 +0,0 @@ -@node Invoking -@chapter Invoking - -@command{learn-your-telephone-number} takes exactly one -argument: your telephone number. It will ask you to enter -it --- so you should not invoke @command{learn-your-telephone-number} -directly. - -If the telephone number you enters matches the specified -number, the program will exit with status 0. If they do -not match, the program will show the difference and exit -with status 1. - -On failure the program exits with status 2. - diff --git a/doc/info/chap/overview.texinfo b/doc/info/chap/overview.texinfo deleted file mode 100644 index 57785d2..0000000 --- a/doc/info/chap/overview.texinfo +++ /dev/null @@ -1,13 +0,0 @@ -@node Overview -@chapter Overview - -@command{learn-your-telephone-number} is a simple command -that can be used to force yourself learn your telephone -number, or any sequence of digits. - -@command{learn-your-telephone-number} recognises @code{+} -as an alias for @code{00}. All other non-digits are ignored. - -It is recommended to make your shell sometimes when opened, -starts this program. Or when you log in on your laptop. - diff --git a/doc/info/content.texinfo b/doc/info/content.texinfo deleted file mode 100644 index 052c1f0..0000000 --- a/doc/info/content.texinfo +++ /dev/null @@ -1,28 +0,0 @@ -@c This file includes everything after the titlepage. - - -@ifnothtml -@c @shortcontents @c (if the table of content gets too large.) -@contents -@end ifnothtml - - -@menu -* Overview:: Brief overview of @command{learn-your-telephone-number}. -* Invoking:: How to use @command{learn-your-telephone-number}. - -* Free Software Needs Free Documentation:: Why free documentation is important. -* GNU Free Documentation License:: Copying and sharing this manual. -@end menu -@c In GNU Emacs a @detailmenu can be created with `C-c C-u m`. - - -@include chap/overview.texinfo -@include chap/invoking.texinfo - -@include appx/free-software-needs-free-documentation.texinfo - -@node GNU Free Documentation License -@appendix GNU Free Documentation License -@include appx/fdl.texinfo - diff --git a/doc/info/hardcopy-copying.texinfo b/doc/info/hardcopy-copying.texinfo deleted file mode 100644 index 11d7204..0000000 --- a/doc/info/hardcopy-copying.texinfo +++ /dev/null @@ -1,69 +0,0 @@ -@c --- This is a template for the hardcopy-copying.texinfo file. --- - -@c Uncomment this when dead tree editions can be ordered. -@c @set HARDCOPY_AVAILABLE - - -@set PRINTINGNUMBER First -@set PRINTINGDATE Januari 0000 -@set ISBNNUMBER 0000000000 - -@ifset HARDCOPY -@copying -@ifset VERSION -This manual documents @value{programnamewiththe} version @value{VERSION}@. -@end ifset -@ifclear VERSION -This manual documents @value{programnamewiththe}. -@end ifclear -@* -@ifset EDITION -@sc{ISBN} @value{ISBNNUMBER}, @value{EDITION} Edition, @value{PRINTINGNUMBER} Printing, @value{PRINTINGDATE}. -@end ifset -@ifclear EDITION -@sc{ISBN} @value{ISBNNUMBER}, @value{PRINTINGNUMBER} Printing, @value{PRINTINGDATE}. -@end ifclear -@* - -Printed by: -@* - -X - -@*@* -Copyright @copyright{} 2016 Mattias Andrée @e{maandree@@member.fsf.org} -@* - -@c The copyright information from the main file, add any required -@c Invariant Sections being used on the dead tree edition. -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version@tie{}1.3 or -any later version published by the Free Software Foundation; -with the Invariant Sections being -``Free Software Needs Free Documentation'', -the ``GNU Free Documentation License'', -with no Front-Cover Texts, -and with no Back-Cover Texts. -A copy of the license is included in the section entitled -``GNU Free Documentation License''. -@c THIS WAS LAST UPPDATE 2016-JANUARY-04 UTC -@c AUTHORITATIVE COPYRIGHT INFORMATION IS AVAILABLE -@c IN learn-your-telephone-number.texinfo. THIS FILL MUST BE UPDATED -@c BEFORE PRINTING. - -@* -Cover art by XY Z. Cover design by XY Z. Printed in XYZ. -@end copying -@end ifset - - - -@ifclear HARDCOPY -@ifset HARDCOPY_AVAILABLE -@macro orderhardcopy{} -If you prefer a dead tree edition, you can order one from -... -@endif -@end ifset -@end ifclear - diff --git a/doc/info/learn-your-telephone-number.texinfo b/doc/info/learn-your-telephone-number.texinfo deleted file mode 100644 index 4ffdb69..0000000 --- a/doc/info/learn-your-telephone-number.texinfo +++ /dev/null @@ -1,104 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@documentencoding UTF-8 -@include reusable/macros.texinfo -@copying -@c -------------------------------------------------------------------------------- -Copyright @copyright{} 2016 @w{Mattias Andrée @e{maandree@@member.fsf.org}} - -@quotation -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version@tie{}1.3 or -any later version published by the Free Software Foundation; with the -Invariant Sections being ``Free Software Needs Free Documentation'', the -``GNU Free Documentation License'', with no Front-Cover Texts, and with -no Back-Cover Texts. A copy of the license is included in the section -entitled ``GNU Free Documentation License''. -@end quotation -@c THIS WAS LAST CHANGED 2016-JANUARY-04 UTC -@c When updated, please remember to update hardcopy-copying.texinfo too. -@c -------------------------------------------------------------------------------- -@end copying - -@setfilename learn-your-telephone-number.info -@settitle learn-your-telephone-number -@documentlanguage en_GB -@include titlepage-data.texinfo - -@c You can change the title of the document in dir by compiling with -@c INFO_FLAGS='-c CATEGORY=your_new_category' -@ifclear CATEGORY -@set CATEGORY Library -@end ifclear - -@dircategory @value{CATEGORY} -@direntry -* learn-your-telephone-number: (learn-your-telephone-number). @value{subtitle} -@end direntry - -@documentdescription -Reference manual for learn-your-telephone-number. -A way to force yourself to learn your telephone number. -@end documentdescription -@c %**end of header - - -@iftex -@c @set USLETTER -@c @set AFOURPAPER -@c @set AFIVEPAPER -@c @set SMALLBOOK - -@c @set HARDCOPY -@c @set CROPMARKS -@c @set SKIPCHAPTERNEWPAGE -@c @set SKIPFONTTEXTSIZE -@end iftex -@c @set LOGO -@c @set DOUBLEHEADINGS -@c @set SINGLEHEADINGS -@c @set AMERICANSPACING -@c @set NOFINALOUT - -@ignore - - CROPMARKS has no effect unless HARDCOPY is set. CROPMARKS - and AFIVEPAPER (or actually @cropmarks and @afivepaper) does - not play well together. - - You can configure how TeX output files should look by uncommenting - @set commands above. Do not uncomment more than one of the paper - sizes (USLETTER, AFOURPAPER, AFIVEPAPER and SMALLBOOK); if none is - uncomment AFOURPAPER will be set unless HARDCOPY is set, in which - case SMALLBOOK will be set. However, if you do not want to modify - this source file, you can run `make` with for example - `TEXINFO_FLAGS='--texinfo="@set HARDCOPY"'`. - - Finally, you can include, on the front page, the version of - learn-your-telephone-number that the manual is up to date with, - by setting the value of VERSION to the version of - learn-your-telephone-number, as well as date of the last update by - setting DATE, and edition by setting EDITION. This is intended for - printed manuals. The date is recommended to not be more accurate, - or less accurate, than to the month. The edition should be formatted - as, for example, ``1@sup{st}''. - -@end ignore - -@comment You can see these too with TEXINFO_FLAGS. -@c @paragraphindent asis -@c @firstparagraphindent none -@c @exampleindent asis -@c @kbdinputstyle distinct - -@include reusable/paper.texinfo - - -@include hardcopy-copying.texinfo -@include reusable/titlepage.texinfo -@setheadings{} - -@include content.texinfo - -@bye - diff --git a/doc/info/reusable/macros.texinfo b/doc/info/reusable/macros.texinfo deleted file mode 100644 index 8d95983..0000000 --- a/doc/info/reusable/macros.texinfo +++ /dev/null @@ -1,48 +0,0 @@ -@c GENERAL ADVICE. -@c Because of an previous regression bug in Texinfo -@c it is a good idea to use @w around lines using -@c macros. - - -@c Use this comment to get a good looking e-mail -@c address in both the info output and the TeX -@c processed output. -@iftex -@macro e{a} -(@email{\a\}) -@end macro -@end iftex -@ifnottex -@macro e{a} -@email{\a\} -@end macro -@end ifnottex - -@c This is intented do be used inside @example. -@c At the beginning of non-code text in a source -@c code comment, use this macro to make it look -@c good in TeX processed output. End with @xtt. -@iftex -@macro xrm{} -@rm{} -@end macro -@end iftex -@ifnottex -@macro xrm{} -@end macro -@end ifnottex - -@c This is intented do be used inside @example. -@c At the end of non-code text in a source code -@c comment, use this macro to make it look -@c good in TeX processed output. -@iftex -@macro xtt{} -@tt{} -@end macro -@end iftex -@ifnottex -@macro xtt{} -@end macro -@end ifnottex - diff --git a/doc/info/reusable/paper.texinfo b/doc/info/reusable/paper.texinfo deleted file mode 100644 index 5a6aca8..0000000 --- a/doc/info/reusable/paper.texinfo +++ /dev/null @@ -1,109 +0,0 @@ -@c This file is used, by inclusion, to allow the -@c builder to specify how output shall be formatted. - -@c On dead tree editions we defailt to smallbook format. -@ifset HARDCOPY -@ifclear USLETTER -@ifclear AFOURPAPER -@ifclear AFIVEPAPER -@ifclear SMALLBOOK -@set SMALLBOOK -@end ifclear -@end ifclear -@end ifclear -@end ifclear -@end ifset - -@c On dead tree editions the heading on the left page -@c is different from the heading on the right page. -@c On online editions the heading is identical on the -@c left pages and on the right pages. -@ifclear SINGLE_HEADINGS -@ifclear DOUBLE_HEADINGS -@ifclear HARDCOPY -@set SINGLE_HEADINGS -@end ifclear -@ifset HARDCOPY -@set DOUBLE_HEADINGS -@end ifset -@end ifclear -@end ifclear - -@c Apply paper format. Default to A4. (Remember -@c dead tree editions defaulted to smallbook.) -@ifset AFIVEPAPER -@afivepaper -@end ifset -@ifset SMALLBOOK -@smallbook -@end ifset -@ifclear AFIVEPAPER -@ifclear SMALLBOOK -@ifclear USLETTER -@afourpaper -@set AFOURPAPER -@end ifclear -@end ifclear -@end ifclear -@c (Texinfo defaults to US letter, thus nothing is -@c done for USLETTER.) - -@c Only on dead tree editions: optionally add -@c cropmarks, and by default, chapters begin -@c on odd page numbers (the right side.) -@ifset HARDCOPY -@ifset CROPMARKS -@cropmarks -@end ifset -@ifclear SKIPCHAPTERNEWPAGE -@setchapternewpage odd -@end ifclear -@end ifset - -@c Apply font size. On smallbook and A5 default to -@c 10 points, on A4 and US letter we default to -@c 11 points. -@ifclear SKIPFONTTEXTSIZE -@ifset SMALLBOOK -@set SMALLFONT -@end ifset -@ifset AFIVEPAPER -@set SMALLFONT -@end ifset -@end ifclear -@ifset SMALLFONT -@fonttextsize 10 -@end ifset -@ifclear SMALLFONT -@iftex @c Because of bug in Texinfo<=4.13 -@fonttextsize 11 -@end iftex -@end ifclear - -@c In America it is customary to have two spaces after -@c a period. It is not elsewhere. (@frenchspacing is a -@c misnomer) -@ifclear AMERICANSPACING -@frenchspacing on -@end ifclear - -@c This should only be used when writting the document. -@c It is used to locate overflows. It should be be used -@c in a printed version. It can be used in an online come -@c use users can easier detect overflows and report them. -@ifclear NOFINALOUT -@finalout -@end ifclear - - -@c Call this macro after the title page, but before the -@c table of content, or the short table of content. -@macro setheadings{} -@ifset DOUBLEHEADINGS -@headings double -@end ifset -@ifset SINGLEHEADINGS -@headings single -@end ifset -@end macro - diff --git a/doc/info/reusable/titlepage.texinfo b/doc/info/reusable/titlepage.texinfo deleted file mode 100644 index 55981f7..0000000 --- a/doc/info/reusable/titlepage.texinfo +++ /dev/null @@ -1,79 +0,0 @@ -@c This file @top or @titlepage. - -@ifnottex -@node Top -@top @value{title} -- @value{subtitle} -@insertcopying -@end ifnottex - -@titlepage -@title @value{title} -@subtitle @value{subtitle} - -@c Date, edition, and version of the program. -@c Should be set on dead tree editions. Not too -@c important on online editions. -@ifset DATE -@ifset VERSION -@ifset EDITION -@subtitle @value{DATE}, @value{programname} version@tie{}@value{VERSION}, @value{EDITION} edition -@end ifset -@ifclear EDITION -@subtitle @value{DATE}, @value{programname} version@tie{}@value{VERSION} -@end ifclear -@end ifset -@ifclear VERSION -@ifset EDITION -@subtitle @value{DATE}, @value{EDITION} edition -@end ifset -@ifclear EDITION -@subtitle @value{DATE} -@end ifclear -@end ifclear -@end ifset -@ifclear DATE -@ifset VERSION -@ifset EDITION -@subtitle @value{programname} version@tie{}@value{VERSION}, @value{EDITION} edition -@end ifset -@ifclear EDITION -@subtitle @value{programname} version@tie{}@value{VERSION} -@end ifclear -@end ifset -@ifclear VERSION -@ifset EDITION -@subtitle @value{EDITION} edition -@end ifset -@end ifclear -@end ifclear - -@ifset LOGO -@vskip 0pt plus 1filll -@c This way, it is centered exactly in pdf and approximently -@c in dvi and ps. @center does not work for @image in dvi and ps. -@multitable @columnfractions 0.15 0.7 -@item @tab @center @image{../logo,250px} -@end multitable -@vskip 0pt plus 2filll -@end ifset -@authors{} - -@page -@ifset HARDCOPY -@vskip 0pt plus 1filll -@insertcopying -@page -@end ifset -@ifset HAVE_DEDICATION -@dedication{} -@end ifset -@ifclear HARDCOPY -@vskip 0pt plus 1filll -@ifset HARDCOPY_AVAILABLE -@orderhardcopy{} -@* -@end ifset -@insertcopying -@end ifclear -@end titlepage - diff --git a/doc/info/titlepage-data.texinfo b/doc/info/titlepage-data.texinfo deleted file mode 100644 index cf5a975..0000000 --- a/doc/info/titlepage-data.texinfo +++ /dev/null @@ -1,23 +0,0 @@ -@c The title and the subtitle of the manual. -@set title learn-your-telephone-number -@set subtitle A way to force yourself to learn your telephone number - -@c The full name of the documented program or package. -@set programname @command{learn-your-telephone-number} -@set programnamewiththe @command{learn-your-telephone-number} - - -@c Authors of the manual. Included at the bottom -@c of the titlepage on TeX processed output. -@macro authors{} -@author by Mattias Andrée (maandree) -@end macro - - -@c Dedication for TeX processed output. -@c @set HAVE_DEDICATION -@c @macro dedication{} -@c @center `' -@c @end macro -@c (I don't use dedications, I use quotes.) - diff --git a/doc/man/learn-your-telephone-number.1 b/learn-your-telephone-number.1 index 3813666..2fc5770 100644 --- a/doc/man/learn-your-telephone-number.1 +++ b/learn-your-telephone-number.1 @@ -3,11 +3,11 @@ learn-your-telephone-number - Learn your telephone number .SH SYNOPSIS .B learn-your-telephone-number -.I TELEPHONE-NUMBER +.I telephone-number .SH DESCRIPTION .B learn-your-telephone-number asks you to enter your telephone number. If the entered number is -.I TELEPHONE-NUMBER +.I telephone-number the program exits with status 0, if not the program will print the differences and exit with status 1. .PP @@ -20,22 +20,13 @@ EXIT STATUS .TP 0 The entered number matched -.IR TELEPHONE-NUMBER . +.IR telephone-number . .TP 1 The entered number did not match -.IR TELEPHONE-NUMBER . +.IR telephone-number . .TP 2 The command fail. .SH "SEE ALSO" No related or similar projects known. -.SH AUTHORS -Principal author, Mattias Andrée. See the LICENSE file for the -full list of authors. -.SH LICENSE -Expat License. -.SH BUGS -Please report bugs to -https://github.com/maandree/learn-your-telephone-number/issues -or to maandree@member.fsf.org diff --git a/learn-your-telephone-number.c b/learn-your-telephone-number.c new file mode 100644 index 0000000..9aa0f38 --- /dev/null +++ b/learn-your-telephone-number.c @@ -0,0 +1,175 @@ +/* See LICENSE file for copyright and license details. */ +#include <alloca.h> +#include <ctype.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +#define t(...) do { if (__VA_ARGS__) goto fail; } while (0) + + +static const char *argv0; + + +static char * +compare(const char *restrict e, const char *restrict c) +{ + size_t en = strlen(e); + size_t cn = strlen(c); + size_t **matrix = alloca((en + 1) * sizeof(size_t *)); + char **path_matrix = alloca((en + 1) * sizeof(char *)); + size_t ei, ci, ri = 0; + char* rc = NULL; + size_t d, l, u, lu; + int ch; + + for (ei = 0; ei <= en; ei++) { + matrix[ei] = alloca((cn + 1) * sizeof(size_t)); + matrix[ei][0] = ei; + path_matrix[ei] = alloca((cn + 1) * sizeof(char)); + path_matrix[ei][0] = '|'; + } + for (ci = 0; ci <= cn; ci++) { + matrix[0][ci] = ci; + path_matrix[0][ci] = '-'; + } + path_matrix[0][0] = '\0'; + + e--, c--; + + for (ei = 1; ei <= en; ei++) { + for (ci = 1; ci <= cn; ci++) { + d = matrix[ei - 1][ci - 1]; + l = matrix[ei + 0][ci - 1]; + u = matrix[ei - 1][ci + 0]; + lu = 1 + (l < u ? l : u); + ch = (e[ei] != c[ci]); + d += (size_t)ch; + matrix[ei][ci] = d < lu ? d : lu; + path_matrix[ei][ci] = d < lu ? (ch ? '\\' : '=') : (l < u ? '-' : '|'); + } + } + + t (!(rc = malloc((en + cn + 2) * sizeof(char)))); + +#if 0 + for (ei = 0; ei <= en; ei++) { + for (ci = 0; ci <= cn; ci++) + printf("%zu%s", matrix[ei][ci], ci == cn ? "" : + path_matrix[ei][ci + 1] == '-' ? "\033[1;32m-\033[m" : " "); + printf("\n"); + if (ei < en) + for (ci = 0; ci < cn; ci++) + printf("%s%s", path_matrix[ei + 1][ci + 0] == '|' ? "\033[1;31m|\033[m" : " ", + path_matrix[ei + 1][ci + 1] == '\\' ? "\033[1;33m\\\033[m" : + path_matrix[ei + 1][ci + 1] == '=' ? "\033[1;39m\\\033[m" : " "); + printf("\n"); + } +#endif + + rc[ri++] = '\0'; + for (ei = en, ci = cn; ei + ci;) { + switch (path_matrix[ei][ci]) { + case '=': ei--, ci--; rc[ri++] = '='; break; + case '\\': ei--, ci--; rc[ri++] = '!'; break; + case '|': ei--; rc[ri++] = '-'; break; + case '-': ci--; rc[ri++] = '+'; break; + default: + abort(); + } + } + rc[ri] = '\0'; + +fail: + return rc; +} + + +int +main(int argc, char *argv[]) +{ + char *correct; + char *entered = NULL; + size_t n = 0; + void *new; + char *w; + char *r; + char *path = NULL; + char *path_; + char *p; + int rc = 0; + + argv0 = argc ? argv[0] : "learn-your-telephone-number"; + if (argc != 2) + goto usage; + + correct = alloca((2 * strlen(argv[1]) + 1) * sizeof(char)); + for (w = correct, r = argv[1]; *r; r++) { + if (isdigit(*r)) *w++ = *r; + else if (isalpha(*r)) goto usage; + else if (*r == '+') *w++ = '0', *w++ = '0'; + } + *w = '\0'; + + t (fprintf(stdout, "Enter your telephone number: ") < 0); + t (fflush(stdout)); + t (errno = 0, getline(&entered, &n, stdin) < 0); + n = strlen(entered) - 1; + entered[n] = '\0'; + + t (!(new = realloc(entered, (2 * n + 1) * sizeof(char)))); + entered = new; + memmove(r = (entered + n), w = (entered), n + 1); + for (; *r; r++) { + if (isdigit(*r)) *w++ = *r; + else if (*r == '+') *w++ = '0', *w++ = '0'; + } + *w = '\0'; + + if (!strcmp(entered, correct)) + goto done; + t (!(path = compare(entered, correct))); + + path_ = strchr(path + 1, '\0'); + t (fprintf(stdout, "\033[A\033[KEntered: ") < 0); + for (p = entered; *--path_;) { + switch (*path_) { + case '=': t (fprintf(stdout, "\033[39m%c", *p++) < 0); break; + case '!': t (fprintf(stdout, "\033[31m%c", *p++) < 0); break; + case '+': t (fprintf(stdout, " ") < 0); break; + case '-': t (fprintf(stdout, "\033[31m%c", *p++) < 0); break; + } + } + t (fprintf(stdout, "\033[m\n") < 0); + + path_ = strchr(path + 1, '\0'); + t (fprintf(stdout, "Correct: ") < 0); + for (p = correct; *--path_;) { + switch (*path_){ + case '=': t (fprintf(stdout, "\033[39m%c", *p++) < 0); break; + case '!': t (fprintf(stdout, "\033[32m%c", *p++) < 0); break; + case '+': t (fprintf(stdout, "\033[32m%c", *p++) < 0); break; + case '-': t (fprintf(stdout, " ") < 0); break; + } + } + t (fprintf(stdout, "\033[m\n") < 0); + + rc = 1; +done: + free(entered); + free(path); + return rc; +fail: + rc = 1; + if (!errno) + goto done; + perror(argv0); + rc = 2; + goto done; +usage: + fprintf(stderr, "usage: %s your-telephone-number\n", argv0); + return 2; +} + diff --git a/mk/README b/mk/README deleted file mode 100644 index e79926d..0000000 --- a/mk/README +++ /dev/null @@ -1,71 +0,0 @@ -This is a collection of generic enough makefiles. -Please feel free to use them in your project. - -Usage: - Include all.mk from your makefile. - - Read the top of each file for details. - - Define the variables: - - _VERSION - This version of the package. - - _PROJECT - The name of the project. Must only include [a-z0-9_-]. - - _PROJECT_FULL - The name of the project. May include any character. - - _SRC - All source code files. This list is used when - generating the translation template file. - - _COPYRIGHT_HOLDER - The copyright holder's full name and e-mail address. - - COMMAND - The name of the command. Must not be declared if - the package does not include exactly one runnable - command. - - PKGNAME - The name of the package. - - Variables beginning with __ are used internally by - the files where they appear, or in rare cases, - internally between these files. - - Variables beginning with _ but not __ are set in the - makefile to specify for these files how they should - behave. They should not be changed by a user of the - package. - - Variables that do not begin with _ are configurable - by the user of the package. - - Do no use single character variables in your Makefile. - - To suppress pre-install, post-install, pre-uninstall, - and post-uninstall instructions, set N=true. - PRE_INSTALL, POST_INSTALL, PRE_UNINSTALL, and - POST_UNINSTALL are supportered as specified by the - GNU coding standardars. - - To figure out what pre-install commands to run in your package, run: - make -n a=% install | sed -e 's/\\$//' -e 's/^ *//' | sed -n '/^% /s/^..//p' - - To figure out what post-install commands to run in your package, run: - make -n z=% uninstall | sed -e 's/\\$//' -e 's/^ *//' | sed -n '/^% /s/^..//p' - - To figure out what pre-uninstall commands to run in your package, run: - make -n a=% uninstall | sed -e 's/\\$//' -e 's/^ *//' | sed -n '/^% /s/^..//p' - - To figure out what post-uninstall commands to run in your package, run: - make -n z=% uninstall | sed -e 's/\\$//' -e 's/^ *//' | sed -n '/^% /s/^..//p' - - To suppress verbatim which commands Make runs, - set Q=@. (Excluding the period.) - -Developers should use DEBUG=1 when running make, when possible. - diff --git a/mk/all.mk b/mk/all.mk deleted file mode 100644 index 032718d..0000000 --- a/mk/all.mk +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== This file includes all the other files in appropriate order. ===# - - -ifndef Q -A = \e[35m -Z = [m[D -endif - -include $(v)mk/path.mk -include .config.mk -include $(v)mk/path.mk -include $(v)mk/lowerpath.mk -include $(v)mk/empty.mk -include $(v)mk/tools.mk -include $(v)mk/copy.mk -include $(v)mk/lang-c.mk -include $(v)mk/texinfo.mk -include $(v)mk/man.mk -include $(v)mk/i18n.mk -include $(v)mk/clean.mk -include $(v)mk/dist.mk -include $(v)mk/tags.mk -include $(v)mk/prologue.mk - diff --git a/mk/clean.mk b/mk/clean.mk deleted file mode 100644 index 1ae4fdc..0000000 --- a/mk/clean.mk +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== These rules are used for cleaning the repository of generated files. ===# - - -# Delete all files are normally created during a build. -.PHONY: clean -clean: clean-dist - @$(PRINTF_INFO) '\e[00;01;31mCLEANING BUILT FILES\e[34m\e[00m\n' - -$(Q)$(RM) -r -- bin aux *.su src/*.su src/*/*.su src/*/*/*.su src/*/*/*/*.su - @$(ECHO) - -# Delete all files that are created during configuration or building. -.PHONY: distclean -distclean: clean - @$(PRINTF_INFO) '\e[00;01;31mCLEANING CONFIGURATIONS\e[34m\e[00m\n' - -$(Q)$(RM) -- .config.mk config.status Makefile - @$(ECHO) - -# Like `make clean` but do not remove massive binaries -# that are seldom recompiled. -.PHONY: mostlyclean -mostlyclean: clean - -# Delete everything except ./configure -.PHONY: maintainer-clean -maintainer-clean: clean distclean - @$(ECHO) - @$(ECHO) 'This command is intended for maintainers to use; it' - @$(ECHO) 'deletes files that may need special tools to rebuild.' - @$(ECHO) - -# Delete all files generated by `make dist` -.PHONY: clean-dist -clean-dist: - @$(PRINTF_INFO) '\e[00;01;31mCLEANING RELEASES\e[34m\e[00m\n' - -$(Q)$(RM) -r -- $(_PROJECT)-*.tar* $(_PROJECT)-*.checksums* $(_PROJECT)-* - @$(ECHO) - diff --git a/mk/configure b/mk/configure deleted file mode 100644 index 4b6e61a..0000000 --- a/mk/configure +++ /dev/null @@ -1,732 +0,0 @@ -# -*- shell-script -*- - -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -# Run './configure --help' for usage information. - - -# FOR DEVELOPERS USING THIS SCRIPT: -# This file is used by include this file, via the . builtin, -# in your ./configure. Before doing so, you must declare -# PKGNAME=the_name_of_your_package -# MAN_SECTION_SUFFIX=default_suffix_to_append_to_man_page_section # (usually empty) -# MAN_SECTION=the_section_your_man_page_is_in # (do no declare if you do not use exacly one section) -# Define the function list_optional_features_help, see the help output. -# Define the function unrecognised_argument to deal with any unrecognised argument. - - - -# Store command for rebuilding Makefile to config.status. -exec 10>config.status - -# Store configurations to .config.mk. -exec 20>.config.mk - - -# Print a quoted (if necessary) version of a string -quote () -{ - value="$1" - if ! test "${value%%\'*}" = "${value}"; then - value="'$(echo "${value}" | sed "s/'/'\\\\''/g")'" - elif ! test "$(printf '%s' ${value})" = "${value}"; then - value="'${value}'" - elif ! test "$(echo ${value}) | tr -d a-zA-Z0-9+_@%/=-" = ""; then - value="'${value}'" - fi - echo "${value}" -} - - -# Parse command line. -incomplete= -dashed= -f_help= -f_gnulinux= -f_bin_merger= -for option; do - if test -n "${incomplete}"; then - option="${incomplete}=${option}" - incomplete= - fi - - # For --{with{,out},{en,dis}able}-*. - feature="${option#--*}" - feature="${feature#*-}" - feature="$(echo "${feature}" | tr a-z- A-Z_)" - - # For directories and filename tweaks. - nodash=_novar - - case "${dashed}${option}" in -# general - (--) - dashed=yes ;; - (--help) - f_help=yes ;; - (--destdir | --destdir=* | --pkgdir | --pkgdir=*) - nodash=destdir ;; - (--srcdir | --srcdir) - nodash=srcdir ;; - -# directory automation - (--gnu-linux) - f_gnulinux=yes ;; - (--bin-merger) - f_bin_merger=yes ;; - -# directories and filenames - (--prefix | --prefix=*) - nodash=prefix ;; - (--exec-prefix | --exec-prefix=* | --exec_prefix | --exec_prefix=*) - nodash=exec_prefix ;; - (--bindir | --bindir=*) - nodash=bindir ;; - (--sbindir | --sbindir=*) - nodash=sbindir ;; - (--libexecdir | --libexecdir=*) - nodash=libexecdir ;; - (--libdir | --libdir=*) - nodash=libdir ;; - (--includedir | --includedir=*) - nodash=includedir ;; - (--oldincludedir | --oldincludedir=*) - nodash=oldincludedir ;; - (--datarootdir | --datarootdir=*) - nodash=datarootdir ;; - (--datadir | --datadir=*) - nodash=datadir ;; - (--libdatarootdir | --libdatarootdir=*) - nodash=libdatarootdir ;; - (--libdatadir | --libdatadir=*) - nodash=libdatadir ;; - (--sysconfdir | --sysconfdir=*) - nodash=sysconfdir ;; - (--sharedstatedir | --=sharedstatedir*) - nodash=sharedstatedir ;; - (--localstatedir | --localstatedir=*) - nodash=localstatedir ;; - (--runstatedir | --runstatedir=*) - nodash=runstatedir ;; - (--lispdir | --lispdir=*) - nodash=lispdir ;; - (--localedir | --localedir=*) - nodash=localedir ;; - (--licensedir | --licensedir=*) - nodash=licensedir ;; - (--emptydir | --emptydir=*) - nodash=emptydir ;; - (--cachedir | --cachedir=*) - nodash=cachedir ;; - (--spooldir | --spooldir=*) - nodash=spooldir ;; - (--logdir | --logdir=*) - nodash=logdir ;; - (--statedir | --statedir=*) - nodash=statedir ;; - (--gamedir | --gamedir=*) - nodash=gamedir ;; - (--sharedcachedir | --sharedcachedir=*) - nodash=sharedcachedir ;; - (--sharedspooldir | --sharedspooldir=*) - nodash=sharedspooldir ;; - (--sharedlogdir | --sharedlogdir=*) - nodash=sharedlogdir ;; - (--sharedstatedir | --sharedstatedir=*) - nodash=sharedstatedir ;; - (--sharedgamedir | --sharedgamedir=*) - nodash=sharedgamedir ;; - (--tmpdir | --tmpdir=*) - nodash=tmpdir ;; - (--localtmpdir | --localtmpdir=*) - nodash=localtmpdir ;; - (--sharedtmpdir | --sharedtmpdir=*) - nodash=sharedtmpdir ;; - (--lockdir | --lockdir=*) - nodash=lockdir ;; - (--skeldir | --skeldir=*) - nodash=skeldir ;; - (--devdir | --devdir=*) - nodash=devdir ;; - (--sysdir | --sysdir=*) - nodash=sysdir ;; - (--procdir | --procdir=*) - nodash=procdir ;; - (--selfprocdir | --selfprocdir=*) - nodash=selfprocdir ;; - (--docdir | --docdir=*) - nodash=docdir ;; - (--infodir | --infodir=*) - nodash=infodir ;; - (--dvidir | --dvidir=*) - nodash=dvidir ;; - (--pdfdir | --pdfdir=*) - nodash=pdfdir ;; - (--psdir | --psdir=*) - nodash=psdir ;; - (--htmldir | --htmldir=*) - nodash=htmldir ;; - (--mandir | --mandir=*) - nodash=mandir ;; - (--man0 | --man0=*) - nodash=man0 ;; - (--man1 | --man1=*) - nodash=man1 ;; - (--man2 | --man2=*) - nodash=man2 ;; - (--man3 | --man3=*) - nodash=man3 ;; - (--man4 | --man4=*) - nodash=man4 ;; - (--man5 | --man5=*) - nodash=man5 ;; - (--man6 | --man6=*) - nodash=man6 ;; - (--man7 | --man7=*) - nodash=man7 ;; - (--man8 | --man8=*) - nodash=man8 ;; - (--man9 | --man9=*) - nodash=man9 ;; - (--man0ext | --man0ext=*) - nodash=man0ext ;; - (--man1ext | --man1ext=*) - nodash=man1ext ;; - (--man2ext | --man2ext=*) - nodash=man2ext ;; - (--man3ext | --man3ext=*) - nodash=man3ext ;; - (--man4ext | --man4ext=*) - nodash=man4ext ;; - (--man5ext | --man5ext=*) - nodash=man5ext ;; - (--man6ext | --man6ext=*) - nodash=man6ext ;; - (--man7ext | --man7ext=*) - nodash=man7ext ;; - (--man8ext | --man8ext=*) - nodash=man8ext ;; - (--man9ext | --man9ext=*) - nodash=man9ext ;; - (--manext | --manext=*) - if test -n "${MAN_SECTION}"; then - nodash=manext - else - printf "\e[01;31m%s: warning: ignoring: %s\e[00m\n" "${0}" "${option}" >&2 - sleep 1 - fi - ;; - -# ignored - # Unrecognised directories, and settings that cannot be used with internationalisation. - (--*dir=* | --*dir | --man?dir | --man?dir=*) - printf "\e[01;31m%s: warning: ignoring: %s\e[00m\n" "${0}" "${option}" >&2 - sleep 1 - ;; - -# feature tweaking - (--with-*) - feature="WITH_${feature}" - echo "${feature}" = yes >&20 - export "${feature}"=yes - option="${option}=x" - ;; - - (--without-*) - feature="WITHOUT_${feature}" - echo "${feature}" = yes >&20 - export "${feature}"=yes - option="${option}=x" - ;; - - (--enable-*=*) - param="${feature#*=}" - feature="${feature%%=*}" - if ! test "${param}" = "no"; then - feature="ENABLE_${feature}" - else - feature="DISABLE_${feature}" - param=yes - fi - echo "${feature}" = "${param}" >&20 - export "${feature}"="${param}" - ;; - - (--enable-*) - feature="DISABLE_${feature}" - echo "${feature}" = yes >&20 - export "${feature}"=yes - option="${option}=x" - ;; - - (--disable-*) - feature="DISABLE_${feature}" - echo "${feature}" = yes >&20 - export "${feature}"=yes - option="${option}=x" - ;; - -# unrecognised - (${dashed}--*) - unrecognised_argument "${option}" - ;; - -# variables - (${dashed}*=*) - var="${option%%=*}" - val="${option#*=}" - if test -n "$(echo "${var}" | tr -d '[_a-zA-Z0-9-]')"; then - # Variable is not used and is potentially not - # formatted in a compatible way. - printf "\e[01;31m%s: warning: ignoring because of bad format: %s\e[00m\n" "${0}" "${option}" >&2 - sleep 1 - fi - echo "${var}" = "${val}" >&20 - ;; - -# unrecognised - (*) - unrecognised_argument "${option}" - ;; - esac - - if test "${option%%=*}" = "${option}"; then - incomplete="${option}" - else - eval "${nodash}=$(quote "${option#*=}")" - eval "have_${nodash}=yes" - fi -done - - -# Print usage information. This is parsed by -# the auto-completion script for ./configure. -if test -n "${f_help}"; then - cat <<EOF -Configure the package (${PKGNAME}) before building and installing. - -OPTIONS - -general - --help Print usage information. - --destdir=DIR Output directory for staged install. - --srcdir=DIR The directory for the sources being compiled. - VARIABLE=VALUE Override a variable in the Makefile. - -directory automation - --gnu-linux Use default configurations for GNU/Linux. - --bin-merger The OS distribution has symlinked sbin to bin for the select exec-prefix. - -tweaking of features -EOF - list_optional_features_help - cat <<EOF - -tweaking of directories and filenames - --prefix=DIR Prefix used for other directories than. - --exec-prefix=DIR Prefix used for /bin, /sbin, /libexec, and /lib. - --bindir=DIR Executable programs that users can run. - --sbindir=DIR Executable administrative programs. - --libexecdir=DIR Executable programs run by other programs and not be users. - --libdir=DIR Object files and libraries of object code. - --includedir=DIR Header files. - --oldincludedir=DIR Header files. Should have the prefix /usr if the canonical prefix is /usr/local. - --datarootdir=DIR Architecture-independent data files. - --datadir=DIR Architecture-independent resource files. - --libdatarootdir=DIR Architecture-dependent data files. - --libdatadir=DIR Architecture-dependent resource files. - --sysconfdir=DIR Machine-local configuration files. - --sharedstatedir=DIR Network-shared architecture-independent state files. - --localstatedir=DIR Machine-local architecture-independent state files. - --runstatedir=DIR Machine-local runtime state files. - --lispdir=DIR Emacs LISP files. - --localedir=DIR Locale-specific message catalogues. - --licensedir=DIR License files. - --emptydir=DIR An always empty directory. - --cachedir=DIR Machine-local cached files. - --spooldir=DIR Machine-local spooled files. - --logdir=DIR Machine-local log files - --statedir=DIR Machine-local persistent state files - --gamedir=DIR Machine-local highscore files. - --sharedcachedir=DIR Network-shared cached files. - --sharedspooldir=DIR Network-shared spooled files. - --sharedlogdir=DIR Network-shared log files - --sharedstatedir=DIR Network-shared persistent state files - --sharedgamedir=DIR Network-shared highscore files. - --tmpdir=DIR Machine-local volatile temporary files. - --localtmpdir=DIR Machine-local persistent temporary files. - --sharedtmpdir=DIR Network-shared temporary files. - --lockdir=DIR Lock files. - --skeldir=DIR User skeleton. - --devdir=DIR Devices and pseudo-devices. - --sysdir=DIR System-information logical file. - --procdir=DIR Process-information logical file. - --selfprocdir=DIR Process-information logical file for the process itself. - --docdir=DIR Documentation files, other then info manuals and man pages. - --infodir=DIR Info manuals. - --dvidir=DIR DVI manuals. - --pdfdir=DIR PDF manuals. - --psdir=DIR PostScript manuals. - --htmldir=DIR HTML manuals. - --mandir=DIR Top-level directory for man pages. - --man0=DIR Basename of the directory for section 0 man pages. - --man1=DIR Basename of the directory for section 1 man pages. - --man2=DIR Basename of the directory for section 2 man pages. - --man3=DIR Basename of the directory for section 3 man pages. - --man4=DIR Basename of the directory for section 4 man pages. - --man5=DIR Basename of the directory for section 5 man pages. - --man6=DIR Basename of the directory for section 6 man pages. - --man7=DIR Basename of the directory for section 7 man pages. - --man8=DIR Basename of the directory for section 8 man pages. - --man9=DIR Basename of the directory for section 9 man pages. -EOF - if test -n "${MAN_SECTION}"; then - cat <<EOF - --manext=EXT Filename suffix for the man page. -EOF - fi - cat <<EOF - --man0ext=EXT Filename suffix for section 0 man pages. - --man1ext=EXT Filename suffix for section 1 man pages. - --man2ext=EXT Filename suffix for section 2 man pages. - --man3ext=EXT Filename suffix for section 3 man pages. - --man4ext=EXT Filename suffix for section 4 man pages. - --man5ext=EXT Filename suffix for section 5 man pages. - --man6ext=EXT Filename suffix for section 6 man pages. - --man7ext=EXT Filename suffix for section 7 man pages. - --man8ext=EXT Filename suffix for section 8 man pages. - --man9ext=EXT Filename suffix for section 9 man pages. -EOF - exit 0 -fi - - -# Set unset directories to their default. -defdir () -{ - p="$(quote "${2}")" - if ! test -n "$(eval echo '${have_'"${1}"'}')"; then - eval "${1}=${p}" - fi -} -if test -n "${f_gnulinux}"; then - defdir prefix "/usr" - _prefix= - case ${prefix} in - ('' | / | /usr | /usr/ | /games | /games | /usr/games | /usr/games/) - _infix= - ;; - (/usr/local | /usr/local/ | /usr/local/games | /usr/local/games/) - _infix=/local - ;; - (/opt/*) - _infix=${prefix} - ;; - (*) - # This probably means somewhere in /home, we do not - # checked because we do not know what else to do. - _infix= - _prefix="${prefix}" - ;; - esac - defdir sysconfdir "${_prefix}/etc${_infix}" - defdir sharedstatedir "${_prefix}/com${_infix}" - defdir localstatedir "${_prefix}/var${_infix}" - defdir runstatedir "${_prefix}/run${_infix}" - defdir tmpdir "${_prefix}/tmp${_infix}" -else - defdir prefix "/usr/local" - defdir sysconfdir "${prefix}/etc" - defdir sharedstatedir "${prefix}/com" - defdir localstatedir "${prefix}/var" - defdir runstatedir "${localstatedir}/run" - defdir tmpdir "${prefix}/tmp" -fi -defdir exec_prefix "${prefix}" -defdir bindir "${exec_prefix}/bin" -if test -n "${f_bin_merger}"; then - defdir sbindir "${bindir}" -else - defdir sbindir "${exec_prefix}/sbin" -fi -defdir libexecdir "${exec_prefix}/libexec" -defdir libdir "${exec_prefix}/lib" -defdir includedir "${prefix}/include" -defdir oldincludedir "${includedir}" -defdir datarootdir "${prefix}/share" -defdir datadir "${datarootdir}" -defdir libdatarootdir "${libdir}" -defdir libdatadir "${libdir}" -defdir lispdir "${datarootdir}/emacs/site-lisp" -defdir localedir "${datarootdir}/locale" -defdir licensedir "${datarootdir}/licenses" -defdir cachedir "${localstatedir}/cache" -defdir spooldir "${localstatedir}/spool" -defdir emptydir "${localstatedir}/empty" -defdir logdir "${localstatedir}/log" -defdir statedir "${localstatedir}/lib" -defdir gamedir "${localstatedir}/games" -defdir sharedcachedir "${sharedstatedir}/cache" -defdir sharedpooldir "${sharedstatedir}/spool" -defdir sharedlogdir "${sharedstatedir}/log" -defdir sharedstatedir "${sharedstatedir}/lib" -defdir sharedgamedir "${sharedstatedir}/games" -defdir localtmpdir "${localstatedir}/tmp" -defdir sharedtmpdir "${sharedstatedir}/tmp" -defdir lockdir "${runstatedir}/lock" -defdir skeldir "${sysconfdir}/skel" -defdir devdir "/dev" -defdir sysdir "/sys" -defdir procdir "/proc" -defdir selfprocdir "${procdir}/self" -defdir docdir "${datarootdir}/doc/${PKGNAME}" -defdir infodir "${datarootdir}/info" -defdir dvidir "${docdir}" -defdir pdfdir "${docdir}" -defdir psdir "${docdir}" -defdir htmldir "${docdir}" -defdir mandir "${datarootdir}/man" -defdir man0 "man0${MAN_SECTION_SUFFIX}" -defdir man1 "man1${MAN_SECTION_SUFFIX}" -defdir man2 "man2${MAN_SECTION_SUFFIX}" -defdir man3 "man3${MAN_SECTION_SUFFIX}" -defdir man4 "man4${MAN_SECTION_SUFFIX}" -defdir man5 "man5${MAN_SECTION_SUFFIX}" -defdir man6 "man6${MAN_SECTION_SUFFIX}" -defdir man7 "man7${MAN_SECTION_SUFFIX}" -defdir man8 "man8${MAN_SECTION_SUFFIX}" -defdir man9 "man9${MAN_SECTION_SUFFIX}" -if test -n "${MAN_SECTION}" && ! test -n "$(eval echo '${man'"${MAN_SECTION}"'ext}')"; then - defdir "man${MAN_SECTION}ext" "$(eval echo '${man'"${MAN_SECTION}"'ext}')" -fi -defdir man0ext ".0" -defdir man1ext ".1" -defdir man2ext ".2" -defdir man3ext ".3" -defdir man4ext ".4" -defdir man5ext ".5" -defdir man6ext ".6" -defdir man7ext ".7" -defdir man8ext ".8" -defdir man9ext ".9" - -# Found source directory. -if ! test -n "${srcdir}"; then - if test -f "Makefile.in"; then - : - elif test -f "${PWD}/Makefile.in"; then - srcdir="${PWD}" - elif test -f "${PWD}/../Makefile.in"; then - srcdir="${PWD}/.." - fi -fi -if test -n "${srcdir}"; then - srcdir="$(realpath "${srcdir}")/" - srcdir_proper="${srcdir}" - srcdir="$(quote "${srcdir}")" -fi -if ! test -f "${srcdir_proper}Makefile.in"; then - echo "${0}: error: cannot found source directory." - exit 1 -fi - - -# Add shebang and "generated"-comment to config.status. -echo '#!/bin/sh' >&10 -echo >&10 -echo '# This file was generated by ./configure, its purpose is two-fold:' >&10 -echo '# 1) It lets you rebuild Makefile with the same configurations you' >&10 -echo '# used last time you run ./configure.' >&10 -echo '# 2) It lets Makefile rebuild itself transparently when out of date.' >&10 -echo >&10 - -# config.status should adjust CWD. -echo 'cd "$(dirname "${0}")"' >&10 - -# config.status calls ./configure with all arguments you called ./configure. -printf "exec %s" "${0}" >&10 -for option; do - printf " %s" "$(quote "${option}")" >&10 -done -echo >&10 - -# Close config.status. -exec 10>&- - - -# Store environment (with restrictions). -env | while read line; do - var="${line%%=*}" - val="${line#*=}" - if test "${var}" = "${line}"; then - # Malformated variables. (Can happen!, sigh...) - continue - elif test -n "$(echo "${var}" | tr -d '[_a-zA-Z0-9-]')"; then - # Variable is not used and is potentially not - # formatted in a compatible way. - continue - fi - case "${var}" in - (_ | PWD | SHELL | SHLVL | TERM | COLORTERM | MAKEFLAGS) - # We do not want to propagate these. - ;; - (*) - echo "${var}" = "${val}" >&20 - ;; - esac -done - -# Store directories and filenames. -if test -n "${destdir}"; then - echo DESTDIR = "${destdir}" >&20 -fi -echo PREFIX = "${prefix}" >&20 -echo SYSCONFDIR = "${sysconfdir}" >&20 -echo COMDIR = "${sharedstatedir}" >&20 -echo VARDIR = "${localstatedir}" >&20 -echo RUNDIR = "${runstatedir}" >&20 -echo TMPDIR = "${tmpdir}" >&20 -echo DEVDIR = "${devdir}" >&20 -echo SYSDIR = "${sysdir}" >&20 -echo PROCDIR = "${procdir}" >&20 -echo EXEC_PREFIX = "${exec_prefix}" >&20 -echo BINDIR = "${bindir}" >&20 -echo SBINDIR = "${sbindir}" >&20 -echo LIBEXECDIR = "${libexecdir}" >&20 -echo LIBDIR = "${libdir}" >&20 -echo INCLUDEDIR = "${includedir}" >&20 -echo OLDINCLUDEDIR = "${oldincludedir}" >&20 -echo DATADIR = "${datarootdir}" >&20 -echo RESDIR = "${datadir}" >&20 -echo SYSDEPDATADIR = "${libdatarootdir}" >&20 -echo SYSDEPRESDIR = "${libdatadir}" >&20 -echo LISPDIR = "${lispdir}" >&20 -echo LOCALEDIR = "${localedir}" >&20 -echo LICENSEDIR = "${licensedir}" >&20 -echo CACHEDIR = "${cachedir}" >&20 -echo SPOOLDIR = "${spooldir}" >&20 -echo EMPTYDIR = "${emptydir}" >&20 -echo LOGDIR = "${logdir}" >&20 -echo STATEDIR = "${statedir}" >&20 -echo GAMEDIR = "${gamedir}" >&20 -echo COMCACHEDIR = "${sharedcachedir}" >&20 -echo COMPOOLDIR = "${sharedpooldir}" >&20 -echo COMLOGDIR = "${sharedlogdir}" >&20 -echo COMSTATEDIR = "${sharedstatedir}" >&20 -echo COMGAMEDIR = "${sharedgamedir}" >&20 -echo LOCALTMPDIR = "${localtmpdir}" >&20 -echo SHAREDTMPDIR = "${sharedtmpdir}" >&20 -echo LOCKDIR = "${lockdir}" >&20 -echo SKELDIR = "${skeldir}" >&20 -echo SELFPROCDIR = "${selfprocdir}" >&20 -echo DOCDIR = "${docdir}" >&20 -echo INFODIR = "${infodir}" >&20 -echo DVIDIR = "${dvidir}" >&20 -echo PDFDIR = "${pdfdir}" >&20 -echo PSDIR = "${psdir}" >&20 -echo HTMLDIR = "${htmldir}" >&20 -echo MANDIR = "${mandir}" >&20 -echo MAN0 = "${man0}" >&20 -echo MAN1 = "${man1}" >&20 -echo MAN2 = "${man2}" >&20 -echo MAN3 = "${man3}" >&20 -echo MAN4 = "${man4}" >&20 -echo MAN5 = "${man5}" >&20 -echo MAN6 = "${man6}" >&20 -echo MAN7 = "${man7}" >&20 -echo MAN8 = "${man8}" >&20 -echo MAN9 = "${man9}" >&20 -echo MAN0EXT = "${man0ext}" >&20 -echo MAN1EXT = "${man1ext}" >&20 -echo MAN2EXT = "${man2ext}" >&20 -echo MAN3EXT = "${man3ext}" >&20 -echo MAN4EXT = "${man4ext}" >&20 -echo MAN5EXT = "${man5ext}" >&20 -echo MAN6EXT = "${man6ext}" >&20 -echo MAN7EXT = "${man7ext}" >&20 -echo MAN8EXT = "${man8ext}" >&20 -echo MAN9EXT = "${man9ext}" >&20 - -# Close .config.mk. -exec 20>&- - -# Now, make Makefile available. -if test -f Makefile; then - chmod u+w Makefile # This scripts makes it read-only. -fi -exec 30>Makefile -echo "# ----------------------------------------------------- #" >&30 -echo "# This file was created by ./configure from Makefile.in #" >&30 -echo "# ----------------------------------------------------- #" >&30 -echo >&30 -if test -n "${srcdir}"; then - echo v = "${srcdir}" >&30 -fi -cat "${srcdir_proper}"Makefile.in >&30 -exec 30>&- - - -# config.status should be executable. -chmod a+x config.status - -# Makefile should be read-only to ones does not edit it by mistake. -chmod a-w Makefile - - -# Help functions for the parent script. -test_with () -{ - with="$(eval echo '${WITH_'"${1}"'}')" - without="$(eval echo '${WITHOUT_'"${1}"'}')" - if ! test -n "${with}" && ! test -n "${without}"; then - echo "${2}" - elif ! test -n "${with}" && test -n "${without}"; then - echo "no" - elif test -n "${with}" && ! test -n "${without}"; then - echo "yes" - elif test "${2}" = yes; then - echo "no" - else - echo "yes" - fi -} -test_enable () -{ - enable="$(eval echo '${ENABLE_'"${1}"'}')" - disable="$(eval echo '${DISABLE_'"${1}"'}')" - if ! test -n "${enable}" && ! test -n "${disable}"; then - echo "${2}" - elif ! test -n "${enable}" && test -n "${disable}"; then - echo "no" - elif test -n "${enable}" && ! test -n "${disable}"; then - echo "${enable}" - elif test "${2}" = yes ; then - echo "no" - else - echo "${enable}" - fi -} - - -# After including this file, you may want -# to do something like: -# -# cat <<EOF -# -# Enabled features, see ${0} for more infomation: -# -# Internationalisation $(test_with GETTEXT yes) -# GNU Bash tab-completion $(test_with BASH yes) -# Fish tab-completion $(test_with FISH yes) -# Z shell tab-completion $(test_with ZSH yes) -# -# You can now run 'make && make install'. -# -# EOF - diff --git a/mk/copy.mk b/mk/copy.mk deleted file mode 100644 index c9067a4..0000000 --- a/mk/copy.mk +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== These rules are used for legal files. ===# - - -# Enables the rules: -# install-copyright Install all files in _COPYING and _LICENSE -# install-copying Install all files in _COPYING -# install-license Install all files in _LICENSE - - -# WHEN TO BUILD, INSTALL, AND UNINSTALL: - -install-base: install-copyright -uninstall: uninstall-copyright - - -# INSTALL RULES: - -.PHONY: install-copyright -install-copyright: - -ifdef _COPYING -.PHONY: install-copyright -install-copyright: install-copying - -.PHONY: install-copying -install-copying: $(foreach F,$(_COPYING),$(v)$(F)) - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" - $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" - @$(ECHO_EMPTY) -endif - -ifdef _LICENSE -.PHONY: install-copyright -install-copyright: install-license - -.PHONY: install-license -install-license: $(foreach F,$(_LICENSE),$(v)$(F)) - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" - $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" - @$(ECHO_EMPTY) -endif - - -# UNINSTALL RULES: - -.PHONY: uninstall-copyright -uninstall-copyright: - -ifdef _COPYING -.PHONY: uninstall-copyright -uninstall-copyright: uninstall-copying - -.PHONY: uninstall-copying -uninstall-copying: - -$(Q)$(RM) -- $(foreach F,$(_COPYING),"$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/$(F)") - -$(Q)$(RMDIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" -endif - -ifdef _LICENSE -.PHONY: uninstall-copyright -uninstall-copyright: uninstall-license - -.PHONY: uninstall-license -uninstall-license: - -$(Q)$(RM) -- $(foreach F,$(_LICENSE),"$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/$(F)") - -$(Q)$(RMDIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" -endif - diff --git a/mk/dist.mk b/mk/dist.mk deleted file mode 100644 index 9f8c48b..0000000 --- a/mk/dist.mk +++ /dev/null @@ -1,189 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== These rules are used for making releases. ===# - - -# CONFIGURATIONS: - -# Formats for packages to generate. -DIST_FORMATS = tar tar.xz tar.bz2 tar.gz - -# Define DO_NOT_SIGN if you do not want sign the release. - -# You can select checksums to generate: -# Declaring NO_BSD_SUM will omit `sum -r`. -# Declaring NO_SYSV_SUM will omit `sum -s`. -# List all checksum programs, that do not require any flags, in DIST_CHECKSUMS. - -# Any missing flags for GnuPG? -GPG_FLAGS = - -# What key should be used for signing? -GPG_KEY ?= - -# You should define _EVERYTHING to enumerate all files that belong in -# the release tarball, lest 'git archive' will be used as a fallback. - - - -# HELP VARIALES: - -# You may use these to help list all files in _EVERYTHING -__EVERYTHING_COMMON = $(_COPYING) $(_LICENSE) README -__EVERYTHING_SRC = $(foreach F,$(_SRC),src/$(F)) -__EVERYTHING_LOCALE = $(foreach L,$(LOCALES),po/$(L).po) -__EVERYTHING_SHELL = $(foreach F,$(_AUTO_COMPLETE),src/$(F).auto-completion) \ - $(foreach F,$(_AUTO_COMPLETE),$(foreac F,$(_SHELL_LOCALES),src/$(F).$(L),auto-completion)) -__EVERYTHING_MK_ = all clean copy dist empty i18n lang-c lowerpath man path prologue shell tags texinfo tools -__EVERYTHING_MK = $(foreach F,$(__EVERYTHING_MK_),mk/$(F).mk) mk/configure mk/README configure Makefile.in -__EVERYTHING_MAN = $(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),doc/man/$(P).$(S))) \ - $(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach L,$(MAN_LOCALES),$(foreach P,$(_MAN_$(L)_$(S)),doc/man/$(P).$(L).$(S)))) -__EVERYTHING_ALL_COMMON = $(__EVERYTHING_COMMON) $(__EVERYTHING_MK) $(__EVERYTHING_MAN) \ - $(__EVERYTHING_LOCALE) $(__EVERYTHING_SRC) $(__EVERYTHING_SHELL) -# This one (__todo) if you have a todo file, but do not want it to be greped. -__TO__ = TO -__DO__ = DO -__todo = $(__TO__)$(__DO__) - - -# The packages and there detached signatures (if any.) -ifndef DO_NOT_SIGN -__DIST_FILES = $(foreach F,$(DIST_FORMATS),$(_PROJECT)-$(_VERSION).$(F) $(_PROJECT)-$(_VERSION).$(F).sig) -endif -ifdef DO_NOT_SIGN -__DIST_FILES = $(foreach F,$(DIST_FORMATS),$(_PROJECT)-$(_VERSION).$(F)) -endif - -# All known checksum programs that are unambiguous. -__DIST_CHECKSUMS_ALL = cksum md2sum md4sum md5sum md6sum sha0sum sha1sum sha224sum \ - sha256sum sha384sum sha512sum sha512-224sum sha512-256sum \ - sha3-224sum sha3-256sum sha3-384sum sha3-512sum shake256sum \ - shake512sum rawshake256sum rawshake512sum keccak-224sum \ - keccak-256sum keccak-384sum keccak-512sum keccaksum - -# All installed checksum programs that are unambiguous. -DIST_CHECKSUMS = $(foreach C,$(__DIST_CHECKSUMS_ALL),$(shell if command -v $(C) >/dev/null; then $(ECHO) $(C); fi)) - - - -# MAKE RULES: - -# Generate release files. (Tarballs, compressed and uncompressed; signatures; checksums.) -.PHONY: dist -dist: dist-balls dist-checksums - - - -# HELP MAKE RULES: - -# Generate tarballs, compressed and uncompressed, -.PHONY: dist-balls -dist-balls: $(__DIST_FILES) - -ifndef DO_NOT_SIGN -# Generate checksums and signature of checksums. -.PHONY: dist-checksums -dist-checksums: $(_PROJECT)-$(_VERSION).checksums $(_PROJECT)-$(_VERSION).checksums.sig - -# Generate uncompressed tarball and signature of it. -.PHONY: dist-tar -dist-tar: $(_PROJECT)-$(_VERSION).tar $(_PROJECT)-$(_VERSION).tar.sig - -# Generate xz-copressed tarball and signature of it. -.PHONY: dist-xz -dist-xz: $(_PROJECT)-$(_VERSION).tar.xz $(_PROJECT)-$(_VERSION).tar.xz.sig - -# Generate bz2-copressed tarball and signature of it. -.PHONY: dist-bzip2 -dist-bz2: $(_PROJECT)-$(_VERSION).tar.bz2 $(_PROJECT)-$(_VERSION).tar.bz2.sig - -# Generate gzip-copressed tarball and signature of it. -.PHONY: dist-gz -dist-gz: $(_PROJECT)-$(_VERSION).tar.gz $(_PROJECT)-$(_VERSION).tar.sig -endif -ifdef DO_NOT_SIGN -# Generate checksums, but no signature. -.PHONY: dist-checksums -dist-checksums: $(_PROJECT)-$(_VERSION).checksums - -# Generate uncompressed tarball, but no signature. -.PHONY: dist-tar -dist-tar: $(_PROJECT)-$(_VERSION).tar - -# Generate xz-compressed tarball, but no signature. -.PHONY: dist-xz -dist-xz: $(_PROJECT)-$(_VERSION).tar.xz - -# Generate bzip2-compressed tarball, but no signature. -.PHONY: dist-bz2 -dist-bz2: $(_PROJECT)-$(_VERSION).tar.bz2 - -# Generate gzip-compressed tarball, but no signature. -.PHONY: dist-gz -dist-gz: $(_PROJECT)-$(_VERSION).tar.gz -endif - -# Generate the tarball for the release. -ifdef v -__GIT_DIR = --git-dir=$(v) -endif -$(_PROJECT)-$(_VERSION).tar: $(foreach F,$(_EVERYTHING),$(v)$(F)) - @$(PRINTF_INFO) '\e[00;01;31mTAR\e[34m %s\e[00m$A\n' "$@" - @if $(TEST) -f $@; then $(RM) $@; fi -ifndef _EVERYTHING - $(Q)git archive --prefix=$(_PROJECT)-$(_VERSION)/ --format=tar $(__GIT_DIR) $(_VERSION) -o $@ #$Z -endif -ifdef _EVERYTHING - $(Q)$(LN) -s . $(_PROJECT)-$(_VERSION) - $(Q)$(TAR) c -- $(foreach F,$(_EVERYTHING),$(v)$(_PROJECT)-$(_VERSION)/$(F)) > $@ - $(Q)$(RM) $(_PROJECT)-$(_VERSION) -endif - @$(ECHO_EMPTY) - -# Compression rule for xz-compression. Used on the tarball. -%.xz: % - @$(PRINTF_INFO) '\e[00;01;31mXZ\e[34m %s\e[00m$A\n' "$@" - @if $(TEST) -f $@; then $(RM) $@; fi - $(Q)$(XZ_COMPRESS) $< #$Z - @$(ECHO_EMPTY) - -# Compression rule for bzip2-compression. Used on the tarball. -%.bz2: % - @$(PRINTF_INFO) '\e[00;01;31mBZIP2\e[34m %s\e[00m$A\n' "$@" - @if $(TEST) -f $@; then $(RM) $@; fi - $(Q)$(BZIP2_COMPRESS) $< #$Z - @$(ECHO_EMPTY) - -# Compression rule for gzip-compression. Used on the tarball. -%.gz: % - @$(PRINTF_INFO) '\e[00;01;31mGZIP\e[34m %s\e[00m$A\n' "$@" - @if $(TEST) -f $@; then $(RM) $@; fi - $(Q)$(GZIP_COMPRESS) $< #$Z - @$(ECHO_EMPTY) - -# Generate checksums of tarballs, compressed and uncompressed, and of their detached signatures. -$(_PROJECT)-$(_VERSION).checksums: $(__DIST_FILES) - @$(PRINTF_INFO) '\e[00;01;31mCHECKSUM\e[34m %s\e[00m\n' "$@" - @$(PRINTF) '' > $@ -ifndef NO_BSD_SUM - @if ! ($(ECHO) ':: sum -r ::' && sum -r $^ && $(ECHO)) >> $@ ; then $(PRINTF) '' > $@; fi -endif -ifndef NO_SYSV_SUM - @if ! ($(ECHO) ':: sum -s ::' && sum -s $^ && $(ECHO)) >> $@ ; then $(PRINTF) '' > $@; fi -endif - @$(foreach C,$(DIST_CHECKSUMS),$(ECHO) ':: $(C) ::' >> $@ && $(C) $^ | $(GREP) -v '^--' >> $@ && $(ECHO) >> $@ &&) $(TRUE) - @$(ECHO_EMPTY) - -# Signing rule. Used on the tarballs, compressed and uncompressed, and on the checksum file. -%.sig: % - @$(PRINTF_INFO) '\e[00;01;31mSIG\e[34m %s\e[00m$A\n' "$@" - @if $(TEST) -f $@; then $(RM) $@; fi - $(Q)$(GPG) $(GPG_FLAGS) --local-user $(GPG_KEY) --detach-sign --armor --output $@ < $< #$Z - @$(ECHO_EMPTY) - diff --git a/mk/empty.mk b/mk/empty.mk deleted file mode 100644 index fd684f6..0000000 --- a/mk/empty.mk +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== This file includes empty rules that are filled by other files. ===# - - -.PHONY: all -all: - -.PHONY: everything -everything: - -.PHONY: base -base: - -.PHONY: cmd -cmd: - -.PHONY: lib -lib: - -.PHONY: doc -doc: - - -.PHONY: check -check: - - -.PHONY: install -install: - -.PHONY: install-everything -install-everything: - -.PHONY: install-base -install-base: - -.PHONY: install-cmd -install-cmd: - -.PHONY: install-lib -install-lib: - -.PHONY: install-doc -install-doc: - - -.PHONY: installcheck -installcheck: - - -.PHONY: uninstall -uninstall: - - - -.PHONY: all -all: base - -.PHONY: everything -everything: base - -.PHONY: base -base: cmd lib - - -.PHONY: install -install: install-base - -.PHONY: install-everything -install-everything: install-base - -.PHONY: install-base -install-base: install-cmd install-lib - - - -.PHONY: install-strip -install-strip: __STRIP = -s -install-strip: install - -.PHONY: install-everything-strip -install-everything-strip: __STRIP = -s -install-everything-strip: install-everything - -.PHONY: install-base-strip -install-base-strip: __STRIP = -s -install-base-strip: install-base - -.PHONY: install-cmd-strip -install-cmd-strip: __STRIP = -s -install-cmd-strip: install-cmd - -.PHONY: install-lib-strip -install-lib-strip: __STRIP = -s -install-lib-strip: install-lib - diff --git a/mk/i18n.mk b/mk/i18n.mk deleted file mode 100644 index ed6ec79..0000000 --- a/mk/i18n.mk +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== These rules are used for internationalisation. ===# - - -# Enables the rules: -# locale Build all translations. -# update-po Update all .po files for further translation. -# install-locale Install all locales. -# -# "All locales" are those listed in LOCALES. -# If LOCALES is not defined, this file is ignored. -# -# If WITHOUT_GETTEXT is defined, `locale` and -# `install-locale` will not do anything. -# -# _SRC should list all sources files, excluding the src/ -# at the beginning of the pathnames. - - -ifdef LOCALES - - -# WHEN TO BUILD, INSTALL, AND UNINSTALL: - -all: locale -everything: locale -install: install-locale -install-everything: install-locale -uninstall: uninstall-locale - - -# BUILD RULES: - -# Build all translations. -ifdef WITHOUT_GETTEXT -.PHONY: locale -locale: -endif -ifndef WITHOUT_GETTEXT -.PHONY: locale -locale: $(foreach L,$(LOCALES),bin/mo/$(L)/messages.mo) -endif - -# Update all translation files for further translation. -.PHONY: update-po -update-po: $(foreach L,$(LOCALES),po/$(L).po) - -# Generate template for translations. -aux/$(_PROJECT).pot: $(foreach S,$(_SRC),$(v)src/$(S)) - @$(PRINTF_INFO) '\e[00;01;31mPOT\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p aux - $(Q)$(CPP) -DUSE_GETTEXT=1 $^ | \ - $(XGETTEXT) -o "$@" -Lc --from-code utf-8 --package-name "$(_PROJECT_FULL)" \ - --package-version $(_VERSION) --no-wrap --force-po \ - --copyright-holder '$(_COPYRIGHT_HOLDER)' - #$Z - @$(ECHO_EMPTY) - -# Create or update a translation file. -po/%.po: aux/$(_PROJECT).pot - @$(PRINTF_INFO) '\e[00;01;31mPO\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p po - $(Q)if ! $(TEST) -e $@; then \ - $(MSGINIT) --no-translator --no-wrap -i aux/$(_PROJECT).pot -o $@ -l $*; \ - else \ - $(MSGMERGE) --no-wrap -U $@ aux/$(_PROJECT).pot; \ - fi #$Z - @$(TOUCH) $@ - @$(ECHO_EMPTY) - -# Compile a translation file. -bin/mo/%/messages.mo: $(v)po/%.po - @$(PRINTF_INFO) '\e[00;01;31mMO\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p bin/mo/$* - $(Q)cd bin/mo/$* && $(MSGFMT) $(__back3unless_v)$< #$Z - @$(ECHO_EMPTY) - - -# INSTALL RULES: - -# Install all locales. -ifdef WITHOUT_GETTEXT -.PHONY: install-locale -install-locale: -endif -ifndef WITHOUT_GETTEXT -.PHONY: install-locale -install-locale: $(foreach L,$(LOCALES),bin/mo/$(L)/messages.mo) - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL) -dm755 -- $(foreach L,$(LOCALES),"$(DESTDIR)$(LOCALEDIR)/$(L)/LC_MESSAGES") - $(Q)$(foreach L,$(LOCALES),$(INSTALL_DATA) bin/mo/$(L)/messages.mo -- "$(DESTDIR)$(LOCALEDIR)/$(L)/LC_MESSAGES/$(PKGNAME).mo" &&) $(TRUE) - @$(ECHO_EMPTY) -endif - - -# UNINSTALL RULES: - -# Uninstall all locales. -.PHONY: uninstall-locale -uninstall-locale: - -$(Q)$(RM) -- $(foreach L,$(LOCALES),"$(DESTDIR)$(LOCALEDIR)/$(L)/LC_MESSAGES/$(PKGNAME).mo") - - -endif - diff --git a/mk/lang-c.mk b/mk/lang-c.mk deleted file mode 100644 index 25d2a7f..0000000 --- a/mk/lang-c.mk +++ /dev/null @@ -1,307 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== This file includes rules for C programs. ===# - - -# This file is ignored unless _C_STD is defined. -# _C_STD should be set the the version of C that -# is used. -# -# If you want to compile with -pedantic, define -# the variable _PEDANTIC. -# -# Define _CPPFLAGS with any additional CPP -# flags to use, _CFLAGS with any additional CC -# flags to use, and _LDFLAGS with any additional -# LD flags to use. -# -# Defined in path.mk, you can change _ALL_DIRS -# if you do not want CPP definitions for all -# directories. -# -# Define _HEADER_DIRLEVELS to specify the directory -# nesting level in src. It is assumed that all -# directories contain header files. Set to '0' if -# there are no header files. -# -# _BIN shall list all commands to build. These -# should be the basenames. For each command -# you should be the variable _OBJ_$(COMMAND) -# that lists all objects files (without the -# suffix and without the aux/ prefix) that -# are required to build the command. -# -# Binary you want installed to /sbin rather than -# /bin shall be listed in _SBIN rather than in -# _BIN. _SBIN and _BIN may not list binaries -# with identical names. Analogically, you may -# add _LIBEXEC for binary to be installed to -# /libexec. -# -# If you only have one binary, you may select -# to define _BINDIR to name the variable with -# the pathname for the directory the binary -# shall be installed. For example, if you want -# the binary to be installed to /usr/sbin, -# define _BINDIR = SBINDIR. -# -# List libraries to compile in in _LIB. For each -# library, sould should also define -# _SO_VERSION_$(LIBRARY) and _SO_MAJOR_$(LIBRARY) -# with the full version number and the major -# version number, respectively. Additionally, -# list all header files that shall be installed -# in _H, these should not contain the 'src/' prefix -# or the '.h' suffix. - - -ifdef _C_STD - - - -# HELP VARIABLES: - -# Figure out whether the GCC is being used. -ifeq ($(shell $(PRINTF) '%s\n' ${CC} | $(HEAD) -n 1),gcc) -__USING_GCC = 1 -endif - -# Are there any commands? -ifdef _BIN -__HAVE_CMD_C = 1 -endif -ifdef _SBIN -__HAVE_CMD_C = 1 -endif -ifdef _LIBEXEC -__HAVE_CMD_C = 1 -endif - - -# WHEN TO BUILD, INSTALL, AND UNINSTALL: - -ifdef __HAVE_CMD_C -cmd: cmd-c -install-cmd: install-cmd-c -uninstall: uninstall-cmd-c -endif -ifdef _LIB -lib: lib-c -install-lib: install-lib-c -uninstall: uninstall-lib-c -endif - - -# BUILD VARIABLES: - -# Optimisation settings for C code compilation. -ifndef OPTIMISE -ifndef DEBUG -OPTIMISE = -O2 -g -endif -ifdef DEBUG -ifdef __USING_GCC -OPTIMISE = -Og -g -endif -ifndef __USING_GCC -OPTIMISE = -g -endif -endif -endif - -# Warning settings for C code compilation. -ifdef _PEDANTIC -_PEDANTIC = -pedantic -endif -ifndef WARN -ifndef DEBUG -WARN = -Wall -endif -ifdef DEBUG -ifdef __USING_GCC -WARN = -Wall -Wextra $(_PEDANTIC) -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \ - -Wtrampolines -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \ - -Wno-variadic-macros -Wsync-nand -Wunsafe-loop-optimizations -Wcast-align \ - -Wdeclaration-after-statement -Wundef -Wbad-function-cast -Wwrite-strings -Wlogical-op \ - -Wstrict-prototypes -Wold-style-definition -Wpacked -Wvector-operation-performance \ - -Wunsuffixed-float-constants -Wsuggest-attribute=const -Wsuggest-attribute=noreturn \ - -Wsuggest-attribute=format -Wnormalized=nfkc -fstrict-aliasing -fipa-pure-const -ftree-vrp \ - -fstack-usage -funsafe-loop-optimizations -Wshadow -Wredundant-decls -Winline -Wcast-qual \ - -Wsign-conversion -Wstrict-overflow=5 -Wconversion -Wsuggest-attribute=pure -Wswitch-default \ - -Wstrict-aliasing=1 -fstrict-overflow -Wfloat-equal -Wpadded -Waggregate-return \ - -Wtraditional-conversion -endif -ifndef __USING_GCC -WARN = -Wall -Wextra $(_PEDANTIC) -endif -endif -endif - -# Support for internationalisation? -ifndef WITHOUT_GETTEXT -_CPPFLAGS += -D'USE_GETTEXT=1' -endif - -# Add CPP definitions for all directories. -_CPPFLAGS += $(foreach D,$(_ALL_DIRS),-D'$(D)="$($(D))"') - -# Compilation and linking flags, and command. -ifndef CPPFLAGS -CPPFLAGS = -endif -ifndef CFLAGS -CFLAGS = $(OPTIMISE) $(WARN) -endif -ifndef LDFLAGS -LDFLAGS = $(OPTIMISE) $(WARN) -endif -__CC = $(CC) -std=$(_C_STD) -c $(_CPPFLAGS) $(_CFLAGS) -__LD = $(CC) -std=$(_C_STD) $(_LDFLAGS) -__CC_POST = $(CPPFLAGS) $(CFLAGS) $(EXTRA_CPPFLAGS) $(EXTRA_CFLAGS) -__LD_POST = $(LDFLAGS) $(EXTRA_LDFLAGS) - -# Header files. -__H = -ifdef _HEADER_DIRLEVELS -ifeq ($(_HEADER_DIRLEVELS),1) -__H += src/*.h -endif -ifneq ($(_HEADER_DIRLEVELS),1) -ifeq ($(_HEADER_DIRLEVELS),2) -__H += src/*.h -__H += src/*/*.h -endif -ifneq ($(_HEADER_DIRLEVELS),2) -ifneq ($(_HEADER_DIRLEVELS),0) -__H += $(foreach W,$(shell $(SEQ) $(_HEADER_DIRLEVELS) | while read n; do $(ECHO) $$($(SEQ) $$n)" " | $(SED) 's/[^ ]* /\/\*/g'; done | $(XARGS) $(ECHO)),src$(W).h) -endif -endif -endif -endif - -# Directory for the binary if there is only one binary. -ifndef _BINDIR -_BINDIR = BINDIR -endif - - -# BUILD RULES: - -.PHONY: cmd-c -cmd-c: $(foreach B,$(_BIN) $(_SBIN) $(_LIBEXEC),bin/$(B)) - -.PHONY: lib-c -lib-c: $(foreach B,$(_LIB),bin/$(B).so) - -# Compile a C file into an object file for a command. -aux/%.o: $(v)src/%.c $(foreach H,$(__H),$(v)$(H)) - @$(PRINTF_INFO) '\e[00;01;31mCC\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p $(shell $(DIRNAME) $@) - $(Q)$(__CC) -o $@ $< $(__CC_POST) #$Z - @$(ECHO_EMPTY) - -# Compile a C file into an object file for a library. -aux/%.pic.o: $(v)src/%.c $(foreach H,$(__H),$(v)$(H)) - @$(PRINTF_INFO) '\e[00;01;31mCC\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p $(shell $(DIRNAME) $@) - $(Q)$(__CC) -fPIC -o $@ $< $(__CC_POST) #$Z - @$(ECHO_EMPTY) - -# Link object files into a library. -# Dependencies are declared below. -bin/%.so: - @$(PRINTF_INFO) '\e[00;01;31mLD\e[34m %s\e[00;32m$A\n' "$@" - @$(MKDIR) -p bin - $(Q)$(__LD) -shared -Wl,-soname,$*.so.$(_SO_MAJOR_$($*)) -o $@ $^ $(__LD_POST) #$Z - @$(ECHO_EMPTY) - -# Link object files into a command. -# Dependencies are declared below. -bin/%: - @$(PRINTF_INFO) '\e[00;01;31mLD\e[34m %s\e[00;32m$A\n' "$@" - @$(MKDIR) -p bin - $(Q)$(__LD) -o $@ $^ $(__LD_POST) #$Z - @$(ECHO_EMPTY) - -# Dependencies for the rule above. -include aux/lang-c.mk -aux/lang-c.mk: Makefile - @$(MKDIR) -p aux - @$(ECHO) > aux/lang-c.mk - @$(foreach B,$(_BIN) $(_SBIN) $(_LIBEXEC),$(ECHO) bin/$(B): $(foreach O,$(_OBJ_$(B)),aux/$(O).o) >> aux/lang-c.mk &&) $(TRUE) - @$(foreach B,$(_LIB),$(ECHO) bin/$(B).so: $(foreach O,$(_OBJ_$(B)),aux/$(O).pic.o) >> aux/lang-c.mk &&) $(TRUE) - - -# INSTALL RULES: - -.PHONY: install-cmd-c -install-cmd-c: $(foreach B,$(_BIN) $(_SBIN) $(_LIBEXEC),bin/$(B)) - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" -ifndef COMMAND -ifdef _BIN - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(BINDIR)" - $(Q)$(INSTALL_PROGRAM) $(__STRIP) $(foreach B,$(_BIN),bin/$(B)) -- "$(DESTDIR)$(BINDIR)" -endif -ifdef _SBIN - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(SBINDIR)" - $(Q)$(INSTALL_PROGRAM) $(__STRIP) $(foreach B,$(_SBIN),bin/$(B)) -- "$(DESTDIR)$(SBINDIR)" -endif -ifdef _LIBEXEC - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(LIBEXECDIR)/$(PKGNAME)" - $(Q)$(INSTALL_PROGRAM) $(__STRIP) $(foreach B,$(_LIBEXEC),bin/$(B)) -- "$(DESTDIR)$(LIBEXECDIR)/$(PKGNAME)" -endif -endif -ifdef COMMAND - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$($(_BINDIR))" - $(Q)$(INSTALL_PROGRAM) $(__STRIP) $^ -- "$(DESTDIR)$($(_BINDIR))/$(COMMAND)" -endif - @$(ECHO_EMPTY) - -.PHONY: install-lib-c -install-lib-c: $(foreach B,$(_LIB),bin/$(B).so) - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(LIBDIR)" - $(Q)$(foreach B,$(_LIB),$(LN) -sf -- "$(B).so.$(_SO_VERSION_$(B))" "$(DESTDIR)$(LIBDIR)/$(B).so.$(_SO_MAJOR_$(B))" &&) $(TRUE) - $(Q)$(foreach B,$(_LIB),$(INSTALL_PROGRAM) $(foreach B,$(_LIB),bin/$(B).so) -- "$(DESTDIR)$(LIBDIR)/$(B).so.$(_SO_VERSION_$(B))" &&) $(TRUE) - $(Q)$(foreach B,$(_LIB),$(LN) -sf -- "$(B).so.$(_SO_VERSION_$(B))" "$(DESTDIR)$(LIBDIR)/$(B).so" &&) $(TRUE) - $(Q)$(INSTALL_DIR) -- $(foreach H,$(_H),"$(DESTDIR)$(INCLUDEDIR)/$(shell $(DIRNAME) "$(H)")") - $(Q)$(foreach H,$(_H),$(INSTALL_DATA) "src/$(H).h" -- "$(DESTDIR)$(INCLUDEDIR)/$(H).h" &&) $(TRUE) - @$(ECHO_EMPTY) - - -# UNINSTALL RULES: - -.PHONY: uninstall-cmd-c -uninstall-cmd-c: -ifdef COMMAND - -$(Q)$(RM) -- "$(DESTDIR)$($(_BINDIR))/$(COMMAND)" -endif -ifndef COMMAND -ifdef _BIN - -$(Q)$(RM) -- $(foreach B,$(_BIN),"$(DESTDIR)$(BINDIR)/$(B)") -endif -ifdef _SBIN - -$(Q)$(RM) -- $(foreach B,$(_SBIN),"$(DESTDIR)$(SBINDIR)/$(B)") -endif -ifdef _LIBEXEC - -$(Q)$(RM) -- $(foreach B,$(_LIBEXEC),"$(DESTDIR)$(LIBEXECDIR)/$(PKGNAME)/$(B)") - -$(Q)$(RMDIR) -- "$(DESTDIR)$(LIBEXECDIR)/$(PKGNAME)" -endif -endif - -.PHONY: uninstall-lib-c -uninstall-lib-c: - -$(Q)$(RM) -- $(foreach B,$(_LIB),"$(DESTDIR)$(LIBDIR)/$(B).so") - -$(Q)$(RM) -- $(foreach B,$(_LIB),"$(DESTDIR)$(LIBDIR)/$(B).so.$(_SO_MAJOR_$(B))") - -$(Q)$(RM) -- $(foreach B,$(_LIB),"$(DESTDIR)$(LIBDIR)/$(B).so.$(_SO_VERSION_$(B))") - -$(Q)$(RM) -- $(foreach H,$(_H),"$(DESTDIR)$(INCLUDEDIR)/$(H).h") - -$(Q)$(foreach H,$(_H),if ! $(TEST) "$(shell $(ECHO) "$(H)" | $(CUT) -d / -f 1)" = "$(H)"; then $(RMDIR) -- "$(DESTDIR)$(INCLUDEDIR)/$(shell $(DIRNAME) "$(H)")"; fi;) - -endif - diff --git a/mk/lowerpath.mk b/mk/lowerpath.mk deleted file mode 100644 index 77b3542..0000000 --- a/mk/lowerpath.mk +++ /dev/null @@ -1,279 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== This file overrides values uppercase path variables with values lowercase path variables. ===# - - -ifdef srcdir -VPATH = $(srcdir) -endif - -ifdef prefix -PREFIX = $(prefix) -endif - -ifdef sysconfdir -SYSCONFDIR = $(sysconfdir) -endif - -ifdef sharedstatedir -COMDIR = $(sharedstatedir) -endif - -ifdef localstatedir -VARDIR = $(localstatedir) -endif - -ifdef runstatedir -RUNDIR = $(runstatedir) -endif - -ifdef tmpdir -TMPDIR = $(tmpdir) -endif - -ifdef devdir -DEVDIR = $(devdir) -endif - -ifdef sysdir -SYSDIR = $(sysdir) -endif - -ifdef procdir -PROCDIR = $(procdir) -endif - -ifdef exec_prefix -EXEC_PREFIX = $(exec_prefix) -endif - -ifdef bindir -BINDIR = $(bindir) -endif - -ifdef sbindir -SBINDIR = $(sbindir) -endif - -ifdef libexecdir -LIBEXECDIR = $(libexecdir) -endif - -ifdef libdir -LIBDIR = $(libdir) -endif - -ifdef includedir -INCLUDEDIR = $(includedir) -endif - -ifdef oldincludedir -OLDINCLUDEDIR = $(oldincludedir) -endif - -ifdef datarootdir -DATADIR = $(datarootdir) -endif - -ifdef datadir -RESDIR = $(datadir) -endif - -ifdef libdatarootdir -SYSDEPDATADIR = $(libdatarootdir) -endif - -ifdef libdatadir -SYSDEPRESDIR = $(libdatadir) -endif - -ifdef lispdir -LISPDIR = $(lispdir) -endif - -ifdef localedir -LOCALEDIR = $(localedir) -endif - -ifdef licensedir -LICENSEDIR = $(licensedir) -endif - -ifdef cachedir -CACHEDIR = $(cachedir) -endif - -ifdef spooldir -SPOOLDIR = $(spooldir) -endif - -ifdef emptydir -EMPTYDIR = $(emptydir) -endif - -ifdef logdir -LOGDIR = $(logdir) -endif - -ifdef statedir -STATEDIR = $(statedir) -endif - -ifdef gamedir -GAMEDIR = $(gamedir) -endif - -ifdef sharedcachedir -COMCACHEDIR = $(sharedcachedir) -endif - -ifdef sharedpooldir -COMPOOLDIR = $(sharedpooldir) -endif - -ifdef sharedlogdir -COMLOGDIR = $(sharedlogdir) -endif - -ifdef sharedlogdir -COMSTATEDIR = $(sharedstatedir) -endif - -ifdef sharedgamedir -COMGAMEDIR = $(sharedgamedir) -endif - -ifdef localtmpdir -VARTMPDIR = $(localtmpdir) -endif - -ifdef sharedtmpdir -COMTMPDIR = $(sharedtmpdir) -endif - -ifdef lockdir -LOCKDIR = $(lockdir) -endif - -ifdef skeldir -SKELDIR = $(skeldir) -endif - -ifdef selfprocdir -SELFPROCDIR = $(selfprocdir) -endif - -ifdef docdir -DOCDIR = $(docdir) -endif - -ifdef infodir -INFODIR = $(infodir) -endif - -ifdef dvidir -DVIDIR = $(dvidir) -endif - -ifdef pdfdir -PDFDIR = $(pdfdir) -endif - -ifdef psdir -PSDIR = $(psdir) -endif - -ifdef htmldir -HTMLDIR = $(htmldir) -endif - -ifdef mandir -MANDIR = $(mandir) -endif - -ifdef man0 -MAN0 = $(man0) -endif - -ifdef man1 -MAN1 = $(man1) -endif - -ifdef man2 -MAN2 = $(man2) -endif - -ifdef man3 -MAN3 = $(man3) -endif - -ifdef man4 -MAN4 = $(man4) -endif - -ifdef man5 -MAN5 = $(man5) -endif - -ifdef man6 -MAN6 = $(man6) -endif - -ifdef man7 -MAN7 = $(man7) -endif - -ifdef man8 -MAN8 = $(man8) -endif - -ifdef man9 -MAN9 = $(man9) -endif - -ifdef man0ext -MAN0EXT = $(man0ext) -endif - -ifdef man1ext -MAN1EXT = $(man1ext) -endif - -ifdef man2ext -MAN2EXT = $(man2ext) -endif - -ifdef man3ext -MAN3EXT = $(man3ext) -endif - -ifdef man4ext -MAN4EXT = $(man4ext) -endif - -ifdef man5ext -MAN5EXT = $(man5ext) -endif - -ifdef man6ext -MAN6EXT = $(man6ext) -endif - -ifdef man7ext -MAN7EXT = $(man7ext) -endif - -ifdef man8ext -MAN8EXT = $(man8ext) -endif - -ifdef man9ext -MAN9EXT = $(man9ext) -endif - diff --git a/mk/man.mk b/mk/man.mk deleted file mode 100644 index acde35e..0000000 --- a/mk/man.mk +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== These rules are used for man pages. ===# - - -# Enables the rules: -# install-man Install all man page -# install-man-untranslated Install untranslated man page -# install-man-locale Install translated man page -# -# This file is ignored unless _MAN_PAGE_SECTIONS -# is defined. _MAN_PAGE_SECTIONS should list all -# used man page sections. For all used sections -# there should also be a variable named -# _MAN_$(SECTION) that lists the suffixless -# basename of all man pages in that section. -# -# The pathname of a man page should look -# like this: doc/man/$(DOCUMENT).$(SECTION) -# Translations looks like this: -# doc/man/$(DOCUMENT).$(LANGUAGE).$(SECTION) -# -# For each language and section, there should -# be a variable _MAN_$(LANGUAGE)_$(SECTION) -# that lists all translated documents in that -# section and for that lanuage. These should -# be suffixless basenames. The lanuage counts -# as a suffix. -# -# The translations of the man pages to -# install should be specified, by language, -# in the variable MAN_LOCALES. - - -ifdef _MAN_PAGE_SECTIONS - - -# WHEN TO BUILD, INSTALL, AND UNINSTALL: - -install: install-man -install-everything: install-man -install-doc: install-man -uninstall: uninstall-man - - -# HELP VARIABLES - -# Customisable man page filename. -ifdef COMMAND -ifeq ($(shell $(PRINTF) '%s\n' $(COMMAND) | $(WC) -l),1) -ifeq ($(shell $(PRINTF) '%s\n' $(_MAN_PAGE_SECTIONS) | $(WC) -l),1) -ifeq ($(shell $(PRINTF) '%s\n' $(_MAN_$(_MAN_PAGE_SECTIONS)) | $(WC) -l),1) -__MAN_COMMAND = $(COMMAND)$(MAN$(_MAN_PAGE_SECTIONS)EXT) -endif -endif -endif -endif - - -# INSTALL RULES: - -.PHONY: install-man -install-man: install-man-untranslated install-man-locale - -.PHONY: install-man-untranslated -install-man-untranslated: - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- $(foreach S,$(_MAN_PAGE_SECTIONS),"$(DESTDIR)$(MANDIR)/$(MAN$(S))") -ifndef __MAN_COMMAND - $(Q)$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),$(INSTALL_DATA) $(v)doc/man/$(P).$(S) -- "$(DESTDIR)$(MANDIR)/$(MAN$(S))/$(P)$(MAN$(S)EXT)" &&)) $(TRUE) -endif -ifdef __MAN_COMMAND - $(Q)$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),$(INSTALL_DATA) $(v)doc/man/$(P).$(S) -- "$(DESTDIR)$(MANDIR)/$(MAN$(S))/$(__MAN_COMMAND)" &&)) $(TRUE) -endif - @$(ECHO_EMPTY) - -.PHONY: install-man-locale -install-man-locale: - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(foreach L,$(MAN_LOCALES),$(INSTALL_DIR) -- $(foreach S,$(_MAN_PAGE_SECTIONS),"$(DESTDIR)$(MANDIR)/$(L)/$(MAN$(S))") &&) $(TRUE) -ifndef __MAN_COMMAND - $(Q)$(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),$(INSTALL_DATA) $(v)doc/man/$(P).$(L).$(S) -- "$(DESTDIR)$(MANDIR)/$(L)/$(MAN$(S))/$(P)$(MAN$(S)EXT)" &&))) $(TRUE) -endif -ifdef __MAN_COMMAND - $(Q)$(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),$(INSTALL_DATA) $(v)doc/man/$(P).$(L).$(S) -- "$(DESTDIR)$(MANDIR)/$(L)/$(MAN$(S))/$(__MAN_COMMAND)" &&))) $(TRUE) -endif - @$(ECHO_EMPTY) - - -# UNINSTALL RULES: - -.PHONY: uninstall-man -uninstall-man: -ifndef __MAN_COMMAND - -$(Q)$(RM) -- $(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),"$(DESTDIR)$(MANDIR)/$(MAN$(S))/$(P).$(MAN$(S)EXT)")) - -$(Q)$(RM) -- $(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),"$(DESTDIR)$(MANDIR)/$(L)/$(MAN$(S))/$(P)$(MAN$(S)EXT)"))) -endif -ifdef __MAN_COMMAND - -$(Q)$(RM) -- "$(DESTDIR)$(MANDIR)/$(MAN$(_MAN_PAGE_SECTIONS))/$(__MAN_COMMAND)" - -$(Q)$(RM) -- $(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),"$(DESTDIR)$(MANDIR)/$(L)/$(MAN$(S))/$(__MAN_COMMAND)"))) -endif - - -endif - diff --git a/mk/path.mk b/mk/path.mk deleted file mode 100644 index 9d9d855..0000000 --- a/mk/path.mk +++ /dev/null @@ -1,176 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== This file define path variables. ===# - - -ifndef __PATH_MK_INCLUDED -__PATH_MK_INCLUDED = 1 - - -# DIRECTORIES: - -# The package path prefix, if you want to install to another root, set DESTDIR to that root. -PREFIX = /usr -# The package path prefix for /bin, /sbin, /lib and /libexec. -EXEC_PREFIX = /usr -# The command path excluding prefix. -BIN = /bin -# The administration command path excluding prefix. -SBIN = /sbin -# The library path excluding prefix. -LIB = /lib -# The executable library path excluding prefix. -LIBEXEC = /libexec -# The header-file path excluding prefix. -INCLUDE = /include -# The resource path excluding prefix. -DATA = /share -# The man page sections path excluding prefix. -MAN0 = /man0 -MAN1 = /man1 -MAN2 = /man2 -MAN3 = /man3 -MAN4 = /man4 -MAN5 = /man5 -MAN6 = /man6 -MAN7 = /man7 -MAN8 = /man8 -MAN9 = /man9 - -# The command path including prefix. -BINDIR = $(EXEC_PREFIX)$(BIN) -# The administration command path including prefix. -SBINDIR = $(EXEC_PREFIX)$(SBIN) -# The library path including prefix. -LIBDIR = $(EXEC_PREFIX)$(LIB) -# The executable library path including prefix. -LIBEXECDIR = $(EXEC_PREFIX)$(LIBEXEC) -# The header-file path including prefix. -INCLUDEDIR = $(PREFIX)$(INCLUDE) -# The header-file path including prefix. Must not be /usr/local. -ifeq ($(PREFIX),/usr/lcoal) -OLDINCLUDEDIR = /usr$(INCLUDE) -endif -ifneq ($(PREFIX),/usr/lcoal) -OLDINCLUDEDIR = $(PREFIX)$(INCLUDE) -endif -# The data path including prefix. -DATADIR = $(PREFIX)$(DATA) -# The architecture-dependent data path including prefix. -SYSDEPDATADIR = $(DATADIR) -# The resource path including prefix. -RESDIR = $(DATADIR) -# The architecture-dependent resource path including prefix. -SYSDEPRESDIR = $(RESDIR) -# The generic documentation path including prefix. -DOCDIR = $(DATADIR)/doc/$(PKGNAME) -# The info manual documentation path including prefix. -INFODIR = $(DATADIR)/info -# The DVI documentation path including prefix. -DVIDIR = $(DOCDIR) -# The PDF documentation path including prefix. -PDFDIR = $(DOCDIR) -# The PostScript documentation path including prefix. -PSDIR = $(DOCDIR) -# The HTML documentation path including prefix. -HTMLDIR = $(DOCDIR) -# The man page documentation path including prefix. -MANDIR = $(DATADIR)/man -# The Emacs LISP path including prefix. -LISPDIR = $(DATADIR)/emacs/site-lisp -# The locale path including prefix. -LOCALEDIR = $(DATADIR)/locale -# The license base path including prefix. -LICENSEDIR = $(DATADIR)/licenses -# The persistent variable data directory. -VARDIR = /var -# The persistent directory for temporary files. -VARTMPDIR = $(VARDIR)/tmp -# The network-common persistent variable data directory. -COMDIR = /com -# The network-common persistent directory for temporary files. -COMTMPDIR = $(COMDIR)/tmp -# The transient directory for temporary files. -TMPDIR = /tmp -# The transient directory for runtime files. -RUNDIR = /run -# The directory for site-specific configurations. -SYSCONFDIR = /etc -# The directory for pseudo-devices. -DEVDIR = /dev -# The /sys directory. -SYSDIR = /sys -# The /proc directory -PROCDIR = /proc -# The /proc/self directory -SELFPROCDIR = $(PROCDIR)/self -# The cache directory. -CACHEDIR = $(VARDIR)/cache -# The spool directory. -SPOOLDIR = $(VARDIR)/spool -# The empty directory. -EMPTYDIR = $(VARDIR)/empty -# The logfile directory. -LOGDIR = $(VARDIR)/log -# The state directory. -STATEDIR = $(VARDIR)/lib -# The highscore directory. -GAMEDIR = $(VARDIR)/games -# The lockfile directory. -LOCKDIR = $(RUNDIR)/lock -# The user skeleton directory. -SKELDIR = $(SYSCONFDIR)/skel -# The network-common cache directory. -COMCACHEDIR = $(COMDIR)/cache -# The network-common spool directory. -COMSPOOLDIR = $(COMDIR)/spool -# The network-common logfile directory. -COMLOGDIR = $(COMDIR)/log -# The network-common state directory. -COMSTATEDIR = $(COMDIR)/lib -# The network-common highscore directory. -COMGAMEDIR = $(COMDIR)/games - - -# FILENAME SUFFIXES: - -# Filename suffixes for man pages by section. -MAN0EXT = .0 -MAN1EXT = .1 -MAN2EXT = .2 -MAN3EXT = .3 -MAN4EXT = .4 -MAN5EXT = .5 -MAN6EXT = .6 -MAN7EXT = .7 -MAN8EXT = .8 -MAN9EXT = .9 - - -# HELP VARIABLES: - -# All path variables that includes the prefix, -# or are unaffected by the prefix. -_ALL_DIRS = BINDIR SBINDIR LIBDIR LIBEXECDIR INCLUDEDIR DATADIR SYSDEPDATADIR DOCDIR \ - INFODIR DVIDIR PDFDIR PSDIR HTMLDIR MANDIR LOCALEDIR LICENSEDIR VARDIR \ - RESDIR VARTMPDIR COMDIR COMTMPDIR TMPDIR RUNDIR SYSCONFDIR DEVDIR SYSDIR \ - PROCDIR SELFPROCDIR CACHEDIR SPOOLDIR EMPTYDIR LOGDIR STATEDIR GAMEDIR \ - LOCKDIR SKELDIR COMCACHEDIR COMSPOOLDIR COMLOGDIR COMSTATEDIR COMGAMEDIR \ - SYSDEPRESDIR OLDINCLUDEDIR - -# ../, ../../, and ../../../, ignored if v is used, which if an absolute path. -ifndef v -__back1unless_v = ../ -__back2unless_v = ../../ -__back3unless_v = ../../../ -endif - - -endif - diff --git a/mk/prologue.mk b/mk/prologue.mk deleted file mode 100644 index 5d9a558..0000000 --- a/mk/prologue.mk +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== This file includes rules for automatically rebuilding the makefile. ===# - - -base: Makefile - -Makefile: $(v)Makefile.in config.status $(v)configure $(v)mk/configure - ./config.status - diff --git a/mk/shell.mk b/mk/shell.mk deleted file mode 100644 index 2747152..0000000 --- a/mk/shell.mk +++ /dev/null @@ -1,233 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== These rules are used for shell tab-completion using auto-auto-complete. ===# - - -# Enables the rules: -# shell Build tab-completion for all supported shells -# bash Build GNU Bash tab-completion -# fish Build fish tab-completion -# zhs Build Z shell tab-completion -# install-shell Install tab-completion for all supported shells -# install-bash Install GNU Bash tab-completion -# install-fish Install fish tab-completion -# install-zsh Install Z shell tab-completion -# -# This file is ignored unless -# _AUTO_COMPLETE is defined. -# -# _AUTO_COMPLETE shall list all commands that -# have an auto-auto-complete. These should be -# named src/$(COMMAND).auto-completion, where -# $(COMMAND) is the command with the script. -# If all auto-auto-complete scripts translations -# named src/$(COMMAND).$(LOCALE).auto-completion, -# SHELL_LOCALE can be set to install exactly -# on translation in place of the non-translated -# versions. -# -# Although not used by this file, you should -# define _SHELL_LOCALES that lists all available -# translations. (it is used by dist.mk.) -# -# You should also define _WITH_SHELL if you -# want shell tab-completion unless the user -# specifies otherwise. If you want it for -# just some shells, define _WITH_$(SHELL) -# for those shells instead of _WITH_SHELL. - - -ifdef _AUTO_COMPLETE - - -# HELP VARIABLES: - -# Include all that were not explicitly excluded? -ifdef _WITH_SHELL -_WITH_BASH = 1 -_WITH_FISH = 1 -_WITH_ZSH = 1 -endif - -# Include for GNU Bash? -ifdef WITH_BASH -__WITH_BASH = 1 -endif -ifndef WITH_BASH -ifndef WITHOUT_BASH -ifdef _WITH_BASH -__WITH_BASH = 1 -endif -endif -endif - -# Include for fish? -ifdef WITH_FISH -__WITH_FISH = 1 -endif -ifndef WITH_FISH -ifndef WITHOUT_FISH -ifdef _WITH_FISH -__WITH_FISH = 1 -endif -endif -endif - -# Include for Z Shell? -ifdef WITH_ZSH -__WITH_ZSH = 1 -endif -ifndef WITH_ZSH -ifndef WITHOUT_ZSH -ifdef _WITH_ZSH -__WITH_ZSH = 1 -endif -endif -endif - -# WHEN TO BUILD, INSTALL, AND UNINSTALL: - -all: shell -everything: shell -install: install-shell -install-doc: install-info install-dvi install-pdf install-ps install-html -uninstall: uninstall-shell - -shell: -install-shell: - -ifdef __WITH_BASH -shell: bash -install-shell: install-bash -endif -ifdef __WITH_FISH -shell: fish -install-shell: install-fish -endif -ifdef __WITH_ZSH -shell: zsh -install-shell: install-zsh -endif - - -# HELP VARIABLES: - -# Affixes on the source files. -ifdef SHELL_LOCALE -__AAC_L = .$(SHELL_LOCALE) -endif -__AAC = $(__AAC_L).auto-completion - -# Customised command name. -ifdef COMMAND -ifeq ($(shell $(PRINTF) '%s\n' $(COMMAND) | $(WC) -l),1) -ifeq ($(shell $(PRINTF) '%s\n' $(_AUTO_COMPLETE) | $(WC) -l),1) -__SHELL_COMMAND = "command=$(COMMAND)" -endif -endif -endif - - -# BUILD RULES: - -# Built tab-completion scripts for GNU Bash. -.PHONY: bash -bash: $(foreach F,$(_AUTO_COMPLETE),bin/$(F).bash-completion) - -# Built tab-completion scripts for fish. -.PHONY: fish -fish: $(foreach F,$(_AUTO_COMPLETE),bin/$(F).fish-completion) - -# Built tab-completion scripts for Z shell. -.PHONY: zsh -zsh: $(foreach F,$(_AUTO_COMPLETE),bin/$(F).zsh-completion) - -# Built a tab-completion script for GNU Bash. -bin/%.bash-completion: $(v)src/%$(__AAC) - @$(PRINTF_INFO) '\e[00;01;31mAUTO-AUTO-COMPLETE\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p bin - $(Q)$(AUTO_AUTO_COMPLETE) bash -o $@ -s $< $(__SHELL_COMMAND) #$Z - @$(ECHO_EMPTY) - -# Built a tab-completion script for fish. -bin/%.fish-completion: $(v)src/%$(__AAC) - @$(PRINTF_INFO) '\e[00;01;31mAUTO-AUTO-COMPLETE\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p bin - $(Q)$(AUTO_AUTO_COMPLETE) fish -o $@ -s $< $(__SHELL_COMMAND) #$Z - @$(ECHO_EMPTY) - -# Built a tab-completion script for Z shell. -bin/%.zsh-completion: $(v)src/%$(__AAC) - @$(PRINTF_INFO) '\e[00;01;31mAUTO-AUTO-COMPLETE\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p bin - $(Q)$(AUTO_AUTO_COMPLETE) zsh -o $@ -s $< $(__SHELL_COMMAND) #$Z - @$(ECHO_EMPTY) - - -# INSTALL RULES: - -# Install tab-completion scripts for GNU Bash. -.PHONY: install-bash -install-bash: $(foreach F,$(_AUTO_COMPLETE),bin/$(F).bash-completion) - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(DATADIR)/bash-completion/completions" -ifndef __SHELL_COMMAND - $(Q)$(foreach F,$(_AUTO_COMPLETE),$(INSTALL_DATA) bin/$(F).bash-completion -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(F)" &&) $(TRUE) -endif -ifdef __SHELL_COMMAND - $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)" -endif - @$(ECHO_EMPTY) - -# Install tab-completion scripts for fish. -.PHONY: install-fish -install-fish: $(foreach F,$(_AUTO_COMPLETE),bin/$(F).fish-completion) - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(DATADIR)/fish/completions" -ifndef __SHELL_COMMAND - $(Q)$(foreach F,$(_AUTO_COMPLETE),$(INSTALL_DATA) bin/$(F).fish-completion -- "$(DESTDIR)$(DATADIR)/fish/completions/$(F).fish" &&) $(TRUE) -endif -ifdef __SHELL_COMMAND - $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish" -endif - @$(ECHO_EMPTY) - -# Install tab-completion scripts for Z shell. -.PHONY: install-zsh -install-zsh: $(foreach F,$(_AUTO_COMPLETE),bin/$(F).zsh-completion) - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(DATADIR)/zsh/site-functions" -ifndef __SHELL_COMMAND - $(Q)$(foreach F,$(_AUTO_COMPLETE),$(INSTALL_DATA) bin/$(F).zsh-completion -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(F)" &&) $(TRUE) -endif -ifdef __SHELL_COMMAND - $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)" -endif - @$(ECHO_EMPTY) - - -# UNINSTALL RULES: - -# Uninstall tab-completion. -.PHONY: uninstall-shell -uninstall-shell: -ifndef __SHELL_COMMAND - -$(Q)$(RM) -- $(foreach F,$(_AUTO_COMPLETE),"$(DESTDIR)$(DATADIR)/bash-completion/completions/$(F)") - -$(Q)$(RM) -- $(foreach F,$(_AUTO_COMPLETE),"$(DESTDIR)$(DATADIR)/fish/completions/$(F).fish") - -$(Q)$(RM) -- $(foreach F,$(_AUTO_COMPLETE),"$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(F)") -endif -ifdef __SHELL_COMMAND - -$(Q)$(RM) -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)" - -$(Q)$(RM) -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish" - -$(Q)$(RM) -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)" -endif - - -endif - diff --git a/mk/tags.mk b/mk/tags.mk deleted file mode 100644 index 926cb5d..0000000 --- a/mk/tags.mk +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== These rules are used for generate etags- and ctags-tablse. ===# - - -# Generate etags-table. -.PHONY: TAGS -TAGS: - @$(ECHO) - @$(ECHO) "TAGS is not implemented. Did not see the need. Feel free to implement if you want." - @$(ECHO) - -# Generate ctags-table -.PHONY: tags -tags: - @$(ECHO) - @$(ECHO) "tags is not implemented. Did not see the need. Feel free to implement if you want." - @$(ECHO) - diff --git a/mk/texinfo.mk b/mk/texinfo.mk deleted file mode 100644 index e2ccb12..0000000 --- a/mk/texinfo.mk +++ /dev/null @@ -1,294 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -# TODO ((support translations)) -#=== These rules are used for Texinfo manuals. ===# - - -# Enables the rules: -# info Build info manual -# dvi Build DVI manual -# pdf Build PDF manual -# ps Build PostScript manual -# html Build HTML manual -# install-info Install info manual -# install-dvi Install DVI manual -# install-pdf Install PDF manual -# install-ps Install PostScript manual -# install-html Install HTML manual -# -# This file is ignored unless -# _HAVE_TEXINFO_MANUAL is defined. -# -# This file can only build output for -# one Texinfo manual. This manual must -# be named doc/info/$(_PROJECT).texinfo. -# Additional sourced are set by specifing -# how man directories deep doc/info nests -# in the variable _TEXINFO_DIRLEVELS. -# -# If the info manual splits, specify the -# split-number, of the file with the highest -# split-number, in the variable _INFOPARTS. -# -# If the project has a logo, _LOGO should -# name the suffixless basename of the SVG -# files that contains the logo. This file -# must be located in doc/. -# -# _HTML_FILES should the basename (with -# suffix) of all files generated by `html`. -# -# The user may define TEXINFO_FLAGS that -# adds additional flags when compiling -# DVI, PDF, and PostScript manuals. The -# user may also define INFO_FLAGS that -# adds additional flags when compiling -# info and HTML manuals. - - -ifdef _HAVE_TEXINFO_MANUAL - - -# WHEN TO BUILD, INSTALL, AND UNINSTALL: - -all: info -everything: info dvi pdf ps html -doc: info dvi pdf ps html -install: install-info -install-everything: install-info install-dvi install-pdf install-ps install-html -install-doc: install-info install-dvi install-pdf install-ps install-html -uninstall: uninstall-info uninstall-dvi uninstall-pdf uninstall-ps uninstall-html - - -# HELP VARIABLES: - -# Files from which the Texinfo manuals are built. -ifdef _TEXINFO_DIRLEVELS -ifeq ($(_TEXINFO_DIRLEVELS),1) -__TEXI_SRC_ = *.texinfo -endif -ifeq ($(_TEXINFO_DIRLEVELS),2) -__TEXI_SRC_ = *.texinfo */*.texinfo -endif -ifeq ($(_TEXINFO_DIRLEVELS),3) -__TEXI_SRC_ = *.texinfo */*.texinfo */*/*.texinfo -endif -ifneq ($(_TEXINFO_DIRLEVELS),1) -ifneq ($(_TEXINFO_DIRLEVELS),2) -ifneq ($(_TEXINFO_DIRLEVELS),3) -__TEXI_SRC_ = $(foreach W,$(shell $(SEQ) $(_TEXINFO_DIRLEVELS) | while read n; do $(ECHO) $$($(SEQ) $$n)" " | $(SED) 's/[^ ]* /\/\*/g'; done | $(XARGS) $(ECHO)),$(shell $(ECHO) $(W).texinfo | $(SED) 's/^.//')) -endif -endif -endif -__TEXI_SRC = $(foreach S,$(__TEXI_SRC_),$(foreach F,$(shell cd $(v)doc/info && $(ECHO) $(S)),aux/doc/$(F))) -endif - -# Split parts of the info manual. -ifdef _INFOPARTS -ifneq ($(_INFOPARTS),0) -__INFOPARTS = $(shell $(SEQ)) -endif -endif - -# Flags for TeX processed output. -__TEXINFO_FLAGS = $(TEXINFO_FLAGS) -ifdef _LOGO -__TEXINFO_FLAGS += '--texinfo="@set LOGO $(_LOGO)"' -endif - - -# BUILD RULES: - -ifdef _LOGO -# Prepare conversion of logo. -aux/$(_LOGO).svg: $(v)doc/$(_LOGO).svg - @$(PRINTF_INFO) '\e[00;01;31mCP\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p aux - $(Q)$(CP) $^ $@ #$Z - @$(ECHO_EMPTY) - -# Intermediate format for the logo for DVI and PostScript manuals. -aux/$(_LOGO).ps: $(v)doc/$(_LOGO).svg - @$(PRINTF_INFO) '\e[00;01;31mPS\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p aux - $(Q)$(SVG2PS) $^ > $@ #$Z - @$(ECHO_EMPTY) - -# Logo for DVI and PostScript manuals. -aux/$(_LOGO).eps: aux/$(_LOGO).ps - @$(PRINTF_INFO) '\e[00;01;31mEPS\e[34m %s\e[00m$A\n' "$@" - $(Q)$(PS2EPS) $^ #$Z - @$(ECHO_EMPTY) - -# Logo for PDF manual. -aux/$(_LOGO).pdf: $(v)doc/$(_LOGO).svg - @$(PRINTF_INFO) '\e[00;01;31mPDF\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p aux - $(Q)$(SVG2PDF) $^ > $@ #$Z - @$(ECHO_EMPTY) -endif - -# Copy texinfo files to aux/doc. -aux/doc/%.texinfo: $(v)doc/info/%.texinfo - @$(PRINTF_INFO) '\e[00;01;31mCP\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p $(shell $(DIRNAME) $@) - $(Q)$(CP) $< $@ #$Z - @$(ECHO_EMPTY) - -# Build info manual. -.PHONY: info -info: $(__TEXI_SRC) bin/$(_PROJECT).info -bin/%.info $(foreach P,$(__INFOPARTS),bin/%.info-$(P)): aux/doc/%.texinfo $(__TEXI_SRC) - @$(PRINTF_INFO) '\e[00;01;31mTEXI\e[34m %s\e[00m$A\n' "$@" - @$(MKDIR) -p bin - $(Q)$(MAKEINFO) $(INFO_FLAGS) $< #$Z - @$(PRINTF_INFO) '$A' - $(Q)$(MV) $*.info $@ #$Z - @$(ECHO_EMPTY) - -# Build DVI manual. -.PHONY: dvi -dvi: $(__TEXI_SRC) bin/$(_PROJECT).dvi -bin/%.dvi: aux/doc/%.texinfo $(__TEXI_SRC) $(foreach L,$(_LOGO),aux/$(L).eps) - @$(PRINTF_INFO) '\e[00;01;31mTEXI\e[34m %s\e[00m$A\n' "$@" - @! $(TEST) -d aux/dvi/$* || $(RM) -rf aux/dvi/$* - @$(MKDIR) -p aux/dvi/$* bin - $(Q)cd aux/dvi/$* && $(TEXI2DVI) $(__back3unless_v)$< $(__TEXINFO_FLAGS) < /dev/null #$Z - @$(PRINTF_INFO) '$A' - $(Q)$(MV) aux/dvi/$*/$*.dvi $@ #$Z - @$(ECHO_EMPTY) - -# Build PDF manual. -.PHONY: pdf -pdf: $(__TEXI_SRC) bin/$(_PROJECT).pdf -bin/%.pdf: aux/doc/%.texinfo $(__TEXI_SRC) $(foreach L,$(_LOGO),aux/$(L).pdf) - @$(PRINTF_INFO) '\e[00;01;31mTEXI\e[34m %s\e[00m$A\n' "$@" - @! $(TEST) -d aux/pdf/$* || $(RM) -rf aux/pdf/$* - @$(MKDIR) -p aux/pdf/$* bin - $(Q)cd aux/pdf/$* && $(TEXI2PDF) $(__back3unless_v)$< $(__TEXINFO_FLAGS) < /dev/null #$Z - @$(PRINTF_INFO) '$A' - $(Q)$(MV) aux/pdf/$*/$*.pdf $@ #$Z - @$(ECHO_EMPTY) - -# Build PostScript manual. -.PHONY: ps -ps: $(__TEXI_SRC) bin/$(_PROJECT).ps -bin/%.ps: aux/doc/%.texinfo $(__TEXI_SRC) $(foreach L,$(_LOGO),aux/$(L).eps) - @$(PRINTF_INFO) '\e[00;01;31mTEXI\e[34m %s\e[00m$A\n' "$@" - @! $(TEST) -d aux/ps/$* || $(RM) -rf aux/ps/$* - @$(MKDIR) -p aux/ps/$* bin - $(Q)cd aux/ps/$* && $(TEXI2PS) $(__back3unless_v)$< $(__TEXINFO_FLAGS) < /dev/null #$Z - @$(PRINTF_INFO) '$A' - $(Q)$(MV) aux/ps/$*/$*.ps $@ #$Z - @$(ECHO_EMPTY) - -# Build HTML manual. -.PHONY: html -html: $(__TEXI_SRC) bin/html/$(_PROJECT)/index.html -bin/html/%/index.html: aux/doc/%.texinfo $(__TEXI_SRC) - @$(PRINTF_INFO) '\e[00;01;31mTEXI\e[34m %s\e[00m$A\n' "$@" - @! $(TEST) -d bin/html/$* || $(RM) -rf bin/html/$* - @$(MKDIR) -p bin/html - $(Q)cd bin/html && $(MAKEINFO_HTML) $(INFO_FLAGS) $(__back2unless_v)$< < /dev/null #$Z - @$(ECHO_EMPTY) - - -# INSTALL RULES: - -# Install info manual. -.PHONY: install-info -install-info: bin/$(_PROJECT).info $(foreach P,$(__INFOPARTS),bin/%.info-$(P)) - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(INFODIR)" - $(Q)$(INSTALL_DATA) bin/$(_PROJECT).info -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info" - $(Q)$(forearch P,$(__INFOPARTS),$(INSTALL_DATA) bin/$*.info-$(P) -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info-$(P)" &&) $(TRUE) -ifdef POST_INSTALL - $(POST_INSTALL) -endif - $(Q)if $(SHELL) -c '$(N) $(INSTALL_INFO) --version' > /dev/null 2>&1; then \ - $(N)$(z) $(INSTALL_INFO) -- "${DESTDIR}${INFODIR}/$(PKGNAME).info" "${DESTDIR}${INFODIR}/dir"; \ - else \ - $(TRUE); \ - fi -ifdef POST_INSTALL - $(NORMAL_INSTALL) -endif - @$(ECHO_EMPTY) - -# Install DVI manual. -.PHONY: install-dvi -install-dvi: bin/$(_PROJECT).dvi - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(DVIDIR)" - $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(DVIDIR)/$(PKGNAME).dvi" - @$(ECHO_EMPTY) - -# Install PDF manual. -.PHONY: install-pdf -install-pdf: bin/$(_PROJECT).pdf - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(PDFDIR)" - $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(PDFDIR)/$(PKGNAME).pdf" - @$(ECHO_EMPTY) - -# Install PostScript manual. -.PHONY: install-ps -install-ps: bin/$(_PROJECT).ps - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(PSDIR)" - $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(PSDIR)/$(PKGNAME).ps" - @$(ECHO_EMPTY) - -# Install HTML manual. -.PHONY: install-html -install-html: $(foreach F,$(_HTML_FILES),bin/html/$(_PROJECT)/$(F)) - @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@" - $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(HTMLDIR)/$(PKGNAME)" - $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(HTMLDIR)/$(PKGNAME)/" - @$(ECHO_EMPTY) - - -# UNINSTALL RULES: - -# Uninstall info manual. -.PHONY: uninstall-info -uninstall-info: -ifdef PRE_UNINSTALL - $(PRE_UNINSTALL) -endif - -$(Q)$(N)$(a) $(INSTALL_INFO) --delete -- "${DESTDIR}${INFODIR}/$(PKGNAME).info" "${DESTDIR}${INFODIR}/dir" -ifdef PRE_UNINSTALL - $(NORMAL_UNINSTALL) -endif - -$(Q)$(RM) -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info" $(forearch P,$(__INFOPARTS),"$(DESTDIR)$(INFODIR)/$(PKGNAME).info-$(P)") - -# Uninstall DVI manual. -.PHONY: uninstall-dvi -uninstall-dvi: - -$(Q)$(RM) -- "$(DESTDIR)$(DVIDIR)/$(PKGNAME).dvi" - -# Uninstall PDF manual. -.PHONY: uninstall-pdf -uninstall-pdf: - -$(Q)$(RM) -- "$(DESTDIR)$(PDFDIR)/$(PKGNAME).pdf" - -# Uninstall PostScript manual. -.PHONY: uninstall-ps -uninstall-ps: - -$(Q)$(RM) -- "$(DESTDIR)$(PSDIR)/$(PKGNAME).ps" - -# Uninstall HTML manual. -.PHONY: uninstall-html -uninstall-html: - -$(Q)$(RM) -- $(foreach F,$(_HTML_FILES),"$(DESTDIR)$(HTMLDIR)/$(PKGNAME)/$(F)") - -$(Q)$(RM) -- "$(DESTDIR)$(HTMLDIR)/$(PKGNAME)" - - -endif - diff --git a/mk/tools.mk b/mk/tools.mk deleted file mode 100644 index e3d9bfe..0000000 --- a/mk/tools.mk +++ /dev/null @@ -1,163 +0,0 @@ -# Copyright (C) 2015, 2016 Mattias Andrée <maandree@member.fsf.org> -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - - -#=== This file defines variables for all used commands. ===# - - -# Part of GNU Coreutils: -BASENAME ?= basename -CHGRP ?= chgrp -CHMOD ?= chmod -CHOWN ?= chown -CP ?= cp -CPLIT ?= cplit -CUT ?= cut -DATE ?= date -DIRNAME ?= dirname -ECHO ?= echo -ENV ?= env -EXPAND ?= expand -EXPR ?= expr -FALS ?= false -FMT ?= fmt -FOLD ?= fold -HEAD ?= head -INSTALL ?= install -INSTALL_DATA ?= $(INSTALL) -m644 -INSTALL_DIR ?= $(INSTALL) -dm755 -INSTALL_PROGRAM ?= $(INSTALL) -m755 -JOIN ?= join -LN ?= ln -MKDIR ?= mkdir -MKFIFO ?= mkfifo -MKNOD ?= mknod -MV ?= mv -NL ?= nl -NPROC ?= nproc -NUMFMT ?= numfmt -OD ?= od -PASTE ?= paste -PATHCHK ?= pathchk -PR ?= pr -PRINTF ?= printf -READLINK ?= readlink -REALPATH ?= realpath -RM ?= rm -RMDIR ?= rmdir -SEQ ?= seq -SLEEP ?= sleep -SORT ?= sort -SPLIT ?= split -STAT ?= stat -TAC ?= tac -TAIL ?= tail -TEE ?= tee -TEST ?= test -TOUCH ?= touch -TR ?= tr -TRUE ?= true -TRUNCATE ?= truncate -TSORT ?= tsort -UNAME ?= uname -UNEXPAND ?= unexpand -UNIQ ?= uniq -WC ?= wc -YES ?= yes - -# Part of GNU help2man: -HELP2MAN ?= help2man - -# Part of GNU tar: -TAR ?= tar - -# Part of GNU Findutils: -FIND ?= find -XARGS ?= xargs - -# Part of GNU Grep: -GREP ?= grep -EGREP ?= egrep -FGREP ?= fgrep - -# Part of GNU Sed: -SED ?= sed - -# Part of GNU Privacy Guard: -GPG ?= gpg - -# Part of Texinfo: -MAKEINFO ?= makeinfo -MAKEINFO_HTML ?= $(MAKEINFO) --html -INSTALL_INFO ?= install-info - -# Part of Texlive-plainextra: -TEXI2PDF ?= texi2pdf -TEXI2DVI ?= texi2dvi -TEXI2PS ?= texi2pdf --ps - -# Part of Texlive-core: -PS2EPS ?= ps2eps - -# Part of librsvg: -RSVG_CONVERT ?= rsvg-convert -SVG2PS ?= $(RSVG_CONVERT) --format=ps -SVG2PDF ?= $(RSVG_CONVERT) --format=pdf - -# Part of GNU Compiler Collection: -CC ?= cc -CPP ?= cpp -CXX ?= c++ - -# Part of GNU Binutils: -AR ?= ar -LD ?= ld -RANLIB ?= ranlib - -# Part of GNU Bison: -BISON ?= bison -YACC ?= yacc - -# Part of Flex: -FLEX ?= FLEX -LEX ?= lex - -# Part of GNU C Library: -LDCONFIG ?= ldconfig - -# Part of GNU Gettext: -XGETTEXT ?= xgettext -MSGFMT ?= msgfmt -MSGMERGE ?= msgmerge -MSGINIT ?= msginit - -# Part of gzip: -GZIP ?= gzip -GZIP_COMPRESS ?= $(GZIP) -k9 - -# Part of bzip2: -BZIP2 ?= bzip2 -BZIP2_COMPRESS ?= $(BZIP2) -k9 - -# Part of xz: -XZ ?= xz -XZ_COMPRESS ?= $(XZ) -ke9 - -# Part of auto-auto-complete: -AUTO_AUTO_COMPLETE ?= auto-auto-complete - - -# Change to $(TRUE) to suppress the bold red and blue output. -ifndef PRINTF_INFO -PRINTF_INFO = $(PRINTF) -endif - -# Change to $(TRUE) to suppress empty lines -ifndef ECHO_EMPTY -ECHO_EMPTY = $(ECHO) -endif - diff --git a/src/learn-your-telephone-number.c b/src/learn-your-telephone-number.c deleted file mode 100644 index 6540feb..0000000 --- a/src/learn-your-telephone-number.c +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright © 2016 Mattias Andrée <maandree@member.fsf.org> - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -#define _DEFAULT_SOURCE -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <alloca.h> -#include <errno.h> -#include <string.h> - - -#define t(...) do { if (__VA_ARGS__) goto fail; } while (0) - - -static const char* argv0; - - -char* compare(const char* restrict e, const char* restrict c) -{ - size_t en = strlen(e); - size_t cn = strlen(c); - size_t** matrix = alloca((en + 1) * sizeof(size_t*)); - char** path_matrix = alloca((en + 1) * sizeof(char*)); - size_t ei, ci, ri = 0; - char* rc = NULL; - - for (ei = 0; ei <= en; ei++) - { - matrix[ei] = alloca((cn + 1) * sizeof(size_t)); - matrix[ei][0] = ei; - path_matrix[ei] = alloca((cn + 1) * sizeof(char)); - path_matrix[ei][0] = '|'; - } - for (ci = 0; ci <= cn; ci++) - { - matrix[0][ci] = ci; - path_matrix[0][ci] = '-'; - } - path_matrix[0][0] = '\0'; - - e--, c--; - - for (ei = 1; ei <= en; ei++) - for (ci = 1; ci <= cn; ci++) - { - size_t d = matrix[ei - 1][ci - 1]; - size_t l = matrix[ei + 0][ci - 1]; - size_t u = matrix[ei - 1][ci + 0]; - size_t lu = 1 + (l < u ? l : u); - int ch = (e[ei] != c[ci]); - d += (size_t)ch; - matrix[ei][ci] = d < lu ? d : lu; - path_matrix[ei][ci] = d < lu ? (ch ? '\\' : '=') : (l < u ? '-' : '|'); - } - - t (!(rc = malloc((en + cn + 2) * sizeof(char)))); - -#if 0 - for (ei = 0; ei <= en; ei++) - { - for (ci = 0; ci <= cn; ci++) - printf("%zu%s", matrix[ei][ci], ci == cn ? "" : - path_matrix[ei][ci + 1] == '-' ? "\033[1;32m-\033[m" : " "); - printf("\n"); - if (ei < en) - for (ci = 0; ci < cn; ci++) - printf("%s%s", path_matrix[ei + 1][ci + 0] == '|' ? "\033[1;31m|\033[m" : " ", - path_matrix[ei + 1][ci + 1] == '\\' ? "\033[1;33m\\\033[m" : - path_matrix[ei + 1][ci + 1] == '=' ? "\033[1;39m\\\033[m" : " "); - printf("\n"); - } -#endif - - rc[ri++] = '\0'; - for (ei = en, ci = cn; ei + ci;) - switch (path_matrix[ei][ci]) - { - case '=': ei--, ci--; rc[ri++] = '='; break; - case '\\': ei--, ci--; rc[ri++] = '!'; break; - case '|': ei--; rc[ri++] = '-'; break; - case '-': ci--; rc[ri++] = '+'; break; - default: - abort(); - } - rc[ri] = '\0'; - - fail: - return rc; -} - - -int main(int argc, char* argv[]) -{ - char* correct; - char* entered = NULL; - size_t n = 0; - void* new; - char* w; - char* r; - char* path = NULL; - char* path_; - char* p; - int rc = 0; - - argv0 = argc ? argv[0] : "learn-your-telephone-number"; - if (argc != 2) - goto usage; - - correct = alloca((2 * strlen(argv[1]) + 1) * sizeof(char)); - for (w = correct, r = argv[1]; *r; r++) - if (isdigit(*r)) *w++ = *r; - else if (isalpha(*r)) goto usage; - else if (*r == '+') *w++ = '0', *w++ = '0'; - *w = '\0'; - - t (fprintf(stdout, "Enter your telephone number: ") < 0); - t (fflush(stdout)); - t (errno = 0, getline(&entered, &n, stdin) < 0); - n = strlen(entered) - 1; - entered[n] = '\0'; - - t (!(new = realloc(entered, (2 * n + 1) * sizeof(char)))); - entered = new; - memmove(r = (entered + n), w = (entered), n + 1); - for (; *r; r++) - if (isdigit(*r)) *w++ = *r; - else if (*r == '+') *w++ = '0', *w++ = '0'; - *w = '\0'; - - if (!strcmp(entered, correct)) - goto done; - t (!(path = compare(entered, correct))); - - path_ = strchr(path + 1, '\0'); - t (fprintf(stdout, "\033[A\033[KEntered: ") < 0); - for (p = entered; *--path_;) - switch (*path_) - { - case '=': t (fprintf(stdout, "\033[39m%c", *p++) < 0); break; - case '!': t (fprintf(stdout, "\033[31m%c", *p++) < 0); break; - case '+': t (fprintf(stdout, " ") < 0); break; - case '-': t (fprintf(stdout, "\033[31m%c", *p++) < 0); break; - } - t (fprintf(stdout, "\033[m\n") < 0); - - path_ = strchr(path + 1, '\0'); - t (fprintf(stdout, "Correct: ") < 0); - for (p = correct; *--path_;) - switch (*path_) - { - case '=': t (fprintf(stdout, "\033[39m%c", *p++) < 0); break; - case '!': t (fprintf(stdout, "\033[32m%c", *p++) < 0); break; - case '+': t (fprintf(stdout, "\033[32m%c", *p++) < 0); break; - case '-': t (fprintf(stdout, " ") < 0); break; - } - t (fprintf(stdout, "\033[m\n") < 0); - - rc = 1; - done: - free(entered); - free(path); - return rc; - fail: - rc = 1; - if (errno == 0) - goto done; - perror(argv0); - rc = 2; - goto done; - usage: - fprintf(stderr, "usage: %s YOUR-TELEPHONE-NUMBER\n", argv0); - return 2; -} - |