pax_global_header00006660000000000000000000000064116012017260014506gustar00rootroot0000000000000052 comment=8c256468eb1e4434c8c67aa1d65c79e30714bc27 michiexile-hodie-8c25646/000077500000000000000000000000001160120172600151775ustar00rootroot00000000000000michiexile-hodie-8c25646/BUGS000066400000000000000000000002421160120172600156600ustar00rootroot00000000000000Hodie is mostly stabilized. Please submit change requests, bug reports, and patches at https://github.com/michiexile/hodie/issues if you wish it changed somehow. michiexile-hodie-8c25646/CHANGELOG000066400000000000000000000056731160120172600164240ustar00rootroot000000000000000.4 Was capable of converting the date and printing it verbosely. No command line options accepted. 0.7 Had a man-page, certain command line options and a brief error/usage message. 0.8 Implemented the ab urbe condita mode of dates and a version option. 1.0pre Tried building a RPM-package of it. 1.0 Grammar checked. Due to grammar details, internal representation was slightly changed (had to cover both ablative and accusative in the verbose output). 1.1 Verbosified ab urbe condita display as well. Bug fixes arriving on first day online fixed (platform-specific coding and bad month calculations). 1.2 Modularised code structure... Now it is organised after one function, one source file, and the makefile and headers have been hacked to support this. Man page partially rewritten. Tnx to Ted Rolle for his extensive tips on improvements. __isleap portability issues resolved. I simply replaced all calls to it with calls to my own leap-year calculator. The --version call is more extensive and even contains a few words about licensing and author :-) The republican switch is added, as well as a BUGS and a CREDITS file to the tarball. The month handling is slightly redone, removing all those nasty bugs I found as soon as I was able to play around with the dates on my own :-) 1.3 Modularized the help-texts and error messages. At least a bit. Those of you interested in translating the english bits of hodie into other languages will find most of what you need in strings.h.en and the manual in hodie.1.en. I will include a diff from the last release of these two files to allow for simple incremental translation. Kudos to Jose Ivan Juanes for doing a translation into spanish for me! Fixed the core-dumping bugs. I think. Mail me if it still screws up. 1.4pre New feature: extremely verbose display. Declines the number of days till the next main day as well instead of just displaying it as a roman numeral. The sourcefile split of version 1.3 has transceded into split source branches instead. It's easier to maintain that way... sscanf changed to atoi in several places in the parse_date.c-file -- improved security (atoi actually checks data and does other neat stuff :-) Support for any separator in date parsing added (i.e. it's done by a 'sscanf(str,"%d%c%d%c%d"...)' instead of a 'sscanf(str,"%d-%d-%d"...)'. Display of numerals off as default - -x turns it on. 1.4 'extremely verbose display' now _implemented_. The function taking care of the declensions will be basis for another, parallel program to hodie -- that simply will put out any number in any of the wanted forms, declined as asked for. Support for this kind of program lies in the to_roman.c file, but the actual program is not yet implemented. (Due to large parts of my audience in this question, a Windoze port of hodie is coming up :-) 1.5 Replaced Makefile with autoconf/automake Replaced option parsing with getopt michiexile-hodie-8c25646/CREDITS000066400000000000000000000005471160120172600162250ustar00rootroot00000000000000Maintainer, Programmer and Copyright holder Mikael Vejdemo-Johansson Debian maintenance and help Christian T. Steiges Translation into spanish Ivan Juanez Bug reports and feature requests from Ted Rolle, Thanh Christian Ionescu-Idbohrn Philip Zeyliger Harri Haataja André Simões Anders Sandberg Peter Pentchev michiexile-hodie-8c25646/DISTRIBUTORS000066400000000000000000000032641160120172600170640ustar00rootroot00000000000000Note to re-distributors of hodie The copyright notice and the License terms are to be included in every distribution or redistribution of the program and/or its source codes. The name of the file including these, may be as the distributor wishes _AS_ _LONG_ _AS_ it is still clear where to find it. I.e. permutations such as renaming it to 'copyright' instead of 'LICENSE' or similar renamings is perfectly ok, and may be done without consulting the author. Permutations such as renaming it to 'BAD_VBA_VIRUS' '00_index' or other utterly misleading names, is not wished for; should be done only after consulting the author _AND_ receiving his blessing for the renaming -- which is unlikely anyway. Grey areas may always be resolved by emailing the author. ...:::ooo***OOO***ooo:::... This code is licensed under the MIT license. I chose the MIT because I've read it and understood it. I still haven't managed to plough throw the tonnes of legalese that constitute the GPL, and I won't release under GPL until I've read and understood it. Explaining the GPL to me won't help. I have nothing principally against relicensing it under another license if you need it -- mail me and ask. I still have the requirement though that I must read it, understand it and approve of it before the license is changed. You may of course -- as stated in the license -- redistribute it under a new sub-license. This license may broaden, but not restrict the MIT license. The MIT license must still be included in the new distribution -- granting anyone the right to relicense it once again. And, please contact me if you plan to distribute it. I'm such a fan of hearing what became of my toy project :-) michiexile-hodie-8c25646/LICENSE000066400000000000000000000020431160120172600162030ustar00rootroot00000000000000Copyright (c) 2000 Mikael Johansson 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 NOT 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.michiexile-hodie-8c25646/Makefile.am000066400000000000000000000001641160120172600172340ustar00rootroot00000000000000AUTOMAKE_OPTIONS = subdir-objects ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} SUBDIRS = src dist_noinst_SCRIPTS = autogen.sh michiexile-hodie-8c25646/README000066400000000000000000000031731160120172600160630ustar00rootroot00000000000000Welcome to hodie and the fascinating world of latin speakers. This program exists because of my getting a few wild ideas while browsing the challenges of dotcomma . What does it do? It has the same functionality as the date (1) program, only... It has it in grammatically correct latin :-) How do I install it? Hodie now has support for autoconf/automake, so you install it just as you would any source tarball. Most cases will install cleanly with the sequence ./configure make make install Dependencies??? I do assume, that you have a halfways decent UNIX-system, preferrably with make, a c-compiler and enough standard libraries to support printfs and time-functions... Apart from that, it should be totally ANSI-C, and I cannot see why it shouldn't be fully portable. It's nothing *really* fancy anyway :-) Licenses? I release this software under the MIT license. (No, not the GPL license. Mainly because I do not quite understand the GPL license myself as I do with the MIT and the BSD types.) The license conditions are reproduced in the file LICENSE, which should be included in every distribution of this software. All the spanish stuff is (c) Ivan Juanes. If you can't find any spanish stuff, then this does not apply (beginning with my moving in at sourceforge, I split spanish and english into two different branches. Who did this? Responsible for this hacklet is Mikael Vejdemo-Johansson Please do e-mail... I'm only happy for feedback :-) michiexile-hodie-8c25646/TODO000066400000000000000000000002411160120172600156640ustar00rootroot00000000000000Hodie is mostly stabilized. Please submit change requests, bug reports, and patches at https://github.com/michiexile/hodie/issues if you wish it changed somehow.michiexile-hodie-8c25646/autogen.sh000066400000000000000000000002721160120172600171760ustar00rootroot00000000000000#!/bin/sh -e test -n "$srcdir" || srcdir=`dirname "$0"` test -n "$srcdir" || srcdir=. autoreconf --force --install --verbose "$srcdir" test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"michiexile-hodie-8c25646/configure.ac000066400000000000000000000004231160120172600174640ustar00rootroot00000000000000AC_INIT([Hodie], [1.5], [https://github.com/michiexile/hodie/issues], [hodie], [https://github.com/michiexile/hodie]) AC_PREREQ([2.59]) AM_INIT_AUTOMAKE([1.10 foreign -Wall -Werror]) AC_CONFIG_HEADERS([config.h]) AC_PROG_CC AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT michiexile-hodie-8c25646/hodie.1000066400000000000000000000102411160120172600163470ustar00rootroot00000000000000.\"Process this file with .\"groff -man -Tascii hodie.1 .\" .TH HODIE 1 "AUGUST 2000" Linux "User Manuals" .SH NAME hodie \- Print current date and time... in Latin .SH SYNOPSIS .BR "hodie " "[" .I "OPTION" ]... .SH DESCRIPTION .B hodie prints out the current date using classic Latin, and in addition also prints it out and time using Roman numerals. .SH OPTIONS .IP "-h, --help" Print short help message with syntax .IP "-v, --verbose" Print months and days (pridie, Kalends, Nones, Ides) full and not the respective abbreviations (standard mode of operation) .IR "Two occurrences of " "-v" " as well as the use of " "-vv" .IR " or " "--extremely-verbose " will include the numerals where applicable fully declined, as in .RB "'ante diem " quintum " Kalends Septembres'." .IP "-n, --numerals" Don't print anything in Latin \- only the date and time as Roman numerals. .IP "-x, --force-numerals" Print both the verbose latin and the date and time as Roman numerals. .IP "-c, --classic, --auc" Print the year in the classic manner .I "ab urbe condita" instead of the more modern .I "anno domini". .IP "-a, --ante-diem" Print the date expressing the number of days to the next main day with the .I "ante diem" expression instead of ablative case. .IP "-d, --date" Print out any date. This has a rather special syntax, with a keyword following the .I -d flag choosing input format. See section on .I DATE INPUT below. .IP "-r, --republican OFFSET" Print out the date dated .I ab urbe tua condita with the offset counted in years as compared to the modern european kalendar (originating with the hypothetical birth of christ). .BI "hodie " "-r -753" would be equivalent with .BI "hodie " "-c" . .IP "--version" Print out the version number of this release and exit. No matter whether other options appear on the command line or not. .SH DATE INPUT Following the .I -d or the .I --date option flags, the first item .B must be one of the following: .IP verbose In this case, the year, month and day are given by following the .I verbose keyword by the flags .I -y, --year, -m, --month, -d, --day for year, month and date respectively .IP ymd After this flag, the date comes in the format .I YYYY-MM-DD , where the numbers may be separated by any non-numeric character. .IP dmy With this flag, the date is given as .I DD-MM-YYYY .IP mdy With this flag, the date is given as .I MM-DD-YYYY . Restrictions on the characters that may replace the hyphen apply as above. .SH HISTORY The story began on the 10. of August, 2000 (a.d. VI Id. Iul., MM). Having finished most of my assignment for my two-month summer job at Ericsson Eurolab Deutschland, Nuremberg, I was idling around on the Internet, and stumbled over the dotcomma-challenges .I , where especially the Roman numeral challenge started my mind. Almost an hour hacking, and there it was, another hour, and the .I "language support" was there. Before the night was over, I had written this man page and had the layout of a decent .B Makefile drawn out mentally. At the end of the next day, I was so far that I actually had the workings of .I RPM worked out, constructed a .rpm-package and a .src.rpm-package, which was promptly released on my home-page, announced on freshmeat and uploaded to metalab (apps/misc :-). Response was quick and plentiful. By now, I have compilation reports from Linux, FreeBSD and SCO Unixware 7; there are a few compability issues to put aside, but it works surprisingly well. .SH RETURN VALUES .B hodie returns zero. Always. If it doesn't, then something is .B really bad with the code. For some really unreadable code, this means that .B hodie could be used as a strange replacement for .B true . .SH BUGS It doesn't sanity check the input... telling .B hodie to display the roman form of the 99th of march gives a slightly jumbled output, which most definitely does not make sense. Reports are more than welcome (e-mail below). .SH AUTHOR Now, who would come up with such a thing? Well, I'm Mikael Johansson, a rather all-round geek from Stockholm. I'm gravely interested in languages, in computers and in mathematics; a combination more dangerous than you might think. E-mails to .I .SH SEE ALSO .BR date (1) michiexile-hodie-8c25646/hodie.spec000066400000000000000000000057671160120172600171620ustar00rootroot00000000000000Summary: A program that prints out the current date and time in latin. Name: hodie Version: 1.4 Release: 1 Copyright: MIT Group: Amusement/Games Source: hodie-1.4.tar.gz BuildRoot: /tmp/RPM_BUILD %description hodie was originally written to participate in the roman-numeral challenge from dotcomma. It has extensive, grammatical correct functionality of the same type as date (1)... only difference is the language. Author: Mikael Johansson %prep %setup -q %build CFLAGS=$RPM_EXTRA_CFLAGS make all %install install -s hodie $RPM_BUILD_ROOT/usr/bin install hodie.1 $RPM_BUILD_ROOT/usr/man/man1 %clean %files %defattr(-,root,root) %doc LICENSE README BUGS CREDITS CHANGELOG TODO %attr(755,-,-) /usr/bin/hodie %attr(644,-,-) /usr/man/man1/hodie.1 %changelog * Fri Nov 17 2000 Mikael Johansson - Added support for explicit numbers (i.e. fully declined and written out...) * Mon Sep 11 2000 Mikael Johansson - See CHANGELOG for details about new implementation. Mainly bugfixing though. - Added CHANGELOG to the project. * Wed Sep 6 2000 Mikael Johansson - Added some extra functionality (i.e. verbosified numbers) and Sourceforgified the project. - Beautified the Makefile after FreeBSD-recommendations from Peter Pentchev. * Thu Aug 24 2000 Mikael Johansson - Twiddled the .spec. - Fixed all core dumps when not giving enough arguments (ex. 'hodie -r') --- I think... :-) * Sun Aug 20 2000 Mikael Johansson - Fixed a ton of bugs in the month handling. - Added the BUGS and CREDITS files. - Added the --republican feature (tnx to Anders Sandberg for the idea) - Popped up to v1.2 and released. * Thu Aug 17 2000 Mikael Johansson - Partial revamp of .spec according to tips from *Insert name here* - Started adding a custom date feature on request from Philip Zeyliger. - Corrected bad grammar for accusative of September through December * Mon Aug 14 2000 Harri Haataja - Checked and fixed the spec file some * Mon Aug 14 2000 Mikael Johansson - Responded to most of the bugs reported. Should be running rather well rather soon now :-) - To be more specific, the man page got a revamp, the source coded was splitted into one source file per callable function and the header and makefile were extensively cleaned up and improved (at least in my own opinion :-) * Sun Aug 13 2000 Mikael Johansson - Verbosified a lot more. Fixed a few bugs. Got overwhelmed by the response from my release (6 e-mails overnight! WOW!) * Sat Aug 12 2000 Mikael Johansson - Grammar check done. Leap year february done. We are ready to launch. :-) * Fri Aug 11 2000 Mikael Johansson - Nearing full release state. Put version number on 1.0pre, awaiting grammar control. michiexile-hodie-8c25646/src/000077500000000000000000000000001160120172600157665ustar00rootroot00000000000000michiexile-hodie-8c25646/src/Makefile.am000066400000000000000000000003341160120172600200220ustar00rootroot00000000000000bin_PROGRAMS = hodie hodie_SOURCES = \ hodie.h \ hodie.c \ date_to_roman.c \ help.c \ isleap.c \ parse_date.c \ strings.h \ to_roman.c \ to_roman.h \ to_roman_numerals.c \ version.c \ version.h \ includes.h michiexile-hodie-8c25646/src/Makefile.in000066400000000000000000000316041160120172600200370ustar00rootroot00000000000000# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = hodie$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_hodie_OBJECTS = hodie.$(OBJEXT) date_to_roman.$(OBJEXT) \ help.$(OBJEXT) isleap.$(OBJEXT) parse_date.$(OBJEXT) \ to_roman.$(OBJEXT) to_roman_numerals.$(OBJEXT) \ version.$(OBJEXT) hodie_OBJECTS = $(am_hodie_OBJECTS) hodie_LDADD = $(LDADD) DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(hodie_SOURCES) DIST_SOURCES = $(hodie_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EXEEXT = @EXEEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ hodie_SOURCES = \ hodie.h \ hodie.c \ date_to_roman.c \ help.c \ isleap.c \ parse_date.c \ strings.h \ to_roman.c \ to_roman.h \ to_roman_numerals.c \ version.c \ version.h \ includes.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) hodie$(EXEEXT): $(hodie_OBJECTS) $(hodie_DEPENDENCIES) @rm -f hodie$(EXEEXT) $(LINK) $(hodie_OBJECTS) $(hodie_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/date_to_roman.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hodie.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isleap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse_date.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/to_roman.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/to_roman_numerals.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-exec-am: install-binPROGRAMS install-html: install-html-am install-info: install-info-am install-man: install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: michiexile-hodie-8c25646/src/date_to_roman.c000066400000000000000000000146441160120172600207560ustar00rootroot00000000000000#include "includes.h" /* For addressing pripost-arrays */ #define PR 0 #define POS 1 #define AD 2 /* Handles for switch statements */ #define PRID 2 #define POST 1 #define DIES 0 static const char* abl[4]={"","Kalendis","Nonis","Idibus"}; static const char* ack[4]={"","Kalendas","Nonas","Idus"}; static const char* terse[4]={"","Kal.","Non.","Id."}; static const char* pripost[3]={"pridie","postridie","ante diem"}; static const char* pripost_terse[3]={"pr.","post.","a.d."}; static const char* month_abl[13]={"", "Ianuariis", "Februariis", "Martiis", "Aprilibus", "Maiis", "Iuniis", "Iuliis", "Augustis", "Septembribus", "Octobribus", "Novembribus", "Decembribus"}; static const char* month_ack[13]={"", "Ianuarias", "Februarias", "Martias", "Apriles", "Maias", "Iunias", "Iulias", "Augustas", "Septembres", "Octobres", "Novembres", "Decembres"}; static const char* month_terse[13]={"", "Ian.", "Feb.", "Mar.", "Apr.", "Mai.", "Iun.", "Iul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."}; void date_to_roman(struct tm* t, char* s, verb_struct verbosity, int ad, int leap) { int kni; /* Which of Kalends, Nones or Ides is the next *day*/ /* Kalends=1, Nones=2, Ides=3 */ int n; /* Number of days to the next */ char numeral[80], num_year[80]; int bis; /* Is it the second of the two a.d. V Kal. Mar. of a leap year? */ int year;/* In special cases (end of december), the year verbose and */ int month;/* terse are non-identical. */ mode m; bis=0; month=t->tm_mon; if(leap!=0 && t->tm_mon==2 && t->tm_mday>23) { month++; /* Special treatment for leap year days!! */ switch(t->tm_mday) { case 24: n=6; break; case 25: n=6; bis=1; break; case 26: n=5; break; case 27: n=4; break; case 28: n=3; break; case 29: n=PRID; /* pridie */ break; default: /* should **NEVER** occur */ break; } kni=1; } else if(t->tm_mon==3 || t->tm_mon==7 || t->tm_mon==10 || t->tm_mon==5) { switch(t->tm_mday) { case 1: kni=1; n=DIES; break; case 2: kni=1; n=POST; break; case 3: case 4: case 5: kni=2; n=8-t->tm_mday; break; case 6: kni=2; n=PRID; break; case 7: kni=2; n=DIES; break; case 8: kni=2; n=POST; break; case 9: case 10: case 11: case 12: case 13: kni=3; n=16-t->tm_mday; break; case 14: kni=3; n=PRID; break; case 15: kni=3; n=DIES; break; case 16: kni=3; n=POST; break; default: kni=1; month++; n=33-t->tm_mday; break; } } else { switch(t->tm_mday) { case 1: kni=1; n=DIES; break; case 2: kni=1; n=POST; break; case 3: kni=2; n=3; break; case 4: kni=2; n=PRID; break; case 5: kni=2; n=DIES; break; case 6: kni=2; n=POST; break; case 7: case 8: case 9: case 10: case 11: kni=3; n=14-t->tm_mday; break; case 12: kni=3; n=PRID; break; case 13: kni=3; n=DIES; break; case 14: kni=3; n=POST; break; default: kni=1; month++; if(t->tm_mon==2) n=30-t->tm_mday; else if(t->tm_mon==4 || t->tm_mon==6 || t->tm_mon==9 || t->tm_mon==11) n=32-t->tm_mday; else { n=33-t->tm_mday; } } } /* What if we have a day in the end of December? */ if(month==13) { month=1; year=t->tm_year+1; } else { year=t->tm_year; } if(!verbosity.year) /* Year non-verbose */ { m.numeral=1; to_roman(year,num_year,m); } if(!verbosity.day && !verbosity.year) /* Nonverbose display */ { if(n==DIES) /* On a main day */ { sprintf(s,"%s %s %s",terse[kni],month_terse[month], num_year); return; } else { if(n==POST) /* postridie */ { sprintf(s,"%s %s %s %s",pripost_terse[POS],terse[kni], month_terse[month],num_year); return; } else if(n==PRID) /* pridie */ { sprintf(s,"%s %s %s %s",pripost_terse[PR],terse[kni], month_terse[month], num_year); return; } else if(bis==1) /* Second VI Kal. Mar. */ { m.numeral=1; to_roman(n,numeral,m); if(ad) { sprintf(s,"%s %s %s %s bis %s",pripost_terse[AD], numeral, terse[kni], month_terse[month],num_year); } else { sprintf(s,"%s %s %s bis %s", numeral, terse[kni], month_terse[month],num_year); } return; } else { m.numeral=1; to_roman(n,numeral,m); if(ad) sprintf(s,"%s %s %s %s %s",pripost_terse[AD], numeral, terse[kni], month_terse[month],num_year); else sprintf(s,"%s %s %s %s", numeral, terse[kni], month_terse[month],num_year); return; } } } else /* Verbose or ExVerbose display */ { m.numeral=verbosity.year?0:1; if(year!=1) m.numerus=1; /* plural */ else m.numerus=0; /* singular */ m.genus=0; /* masculine */ m.casus=4; /* ablative */ m.et_bind=0; m.type=1; to_roman(year,num_year,m); if(n==DIES) /* On the main day */ { sprintf(s,"%s %s %s",abl[kni],month_abl[month],num_year); return; } else { if(n==POST) /* Postridie */ { sprintf(s,"%s %s %s %s",pripost[POS],ack[kni], month_ack[month], num_year); return; } else if(n==PRID) /* pridie */ { sprintf(s,"%s %s %s %s",pripost[PR],ack[kni], month_ack[month], num_year); return; } else { if(ad==0) /* Ante diem controls acc. */ m.casus=4; else m.casus=3; m.numerus=0; m.genus=0; m.numeral=verbosity.day?0:1; m.et_bind=0; m.type=1; to_roman(n,numeral,m); } } if(bis==1) { if(ad) sprintf(s,"%s %s %s %s bis %s", pripost[AD], numeral, ack[kni], month_ack[month],num_year); else sprintf(s,"%s %s %s bis %s", numeral, ack[kni], month_ack[month],num_year); return; } else { if(ad) sprintf(s,"%s %s %s %s %s", pripost[AD], numeral, ack[kni], month_ack[month],num_year); else sprintf(s,"%s %s %s %s", numeral, ack[kni], month_ack[month],num_year); return; } } } michiexile-hodie-8c25646/src/help.c000066400000000000000000000010301160120172600170540ustar00rootroot00000000000000#include "includes.h" void print_usage(void) { printf("%s",HELP_1); printf("%s",HELP_2); printf("%s",HELP_3); printf("%s",HELP_4); printf("%s",HELP_5); printf("%s",HELP_7); printf("%s",HELP_8); printf("%s",HELP_9); printf("%s",HELP_10); printf("%s",HELP_11); printf("%s",HELP_12); printf("%s",HELP_13); printf("%s",HELP_14); printf("%s",HELP_15); printf("%s",HELP_16); printf("%s",HELP_17); printf("%s",HELP_18); printf("%s",HELP_19); printf("%s",HELP_20); } michiexile-hodie-8c25646/src/hodie.c000066400000000000000000000077461160120172600172400ustar00rootroot00000000000000#include "includes.h" #include const char* AUC[3]={"ab urbe condita","AUC","ab urbe condita"}; int main(int argc, char** argv) { char sec[16],min[16],hrs[16],day[16],mon[16],year[16],verbose[80],datetype[16],dateval[16]; struct tm* p_ts; time_t t; int auc_base; short numerals, auc, leap, custom, ad; mode m; verb_struct verbosity; int verbosity_level = 0; int c; int xverbosity = 0; verbosity.year=0; verbosity.day=0; numerals=1; auc=0; leap=0; custom=0; auc_base=0; ad=0; t=time(NULL); p_ts=localtime(&t); /* Parsing command line arguments with getopt */ while (1) { int option_index = 0; static struct option long_options[] = { {"help", 0, 0, 'h'}, {"verbose", 0, 0, 'v'}, {"extremely-verbose", 0, 0, 'X'}, {"version", 0, 0, 'V'}, {"numerals", 0, 0, 'n'}, {"force-numerals", 0, 0, 'x'}, {"classic", 0, 0, 'c'}, {"auc", 0, 0, 'c'}, {"ante-diem", 0, 0, 'a'}, {"date", 1, 0, 'd'}, {"republican", 0, 0, 'r'}, {"year", 0, 0, 'Y'}, {"month", 0, 0, 'M'}, {"day", 0, 0, 'D'}, {0,0,0,0}, }; c = getopt_long(argc, argv, "a:cd:hr:nvxD:M:VXY:", long_options, &option_index); if(c == -1) break; switch(c) { case 'h': print_usage(); exit(0); break; case 'V': print_version(); exit(0); break; case 'v': verbosity_level++; break; case 'X': xverbosity++; break; case 'n': numerals = 0; break; case 'x': numerals = -1; break; case 'c': auc = 1; auc_base = 753; break; case 'a': ad = 1; break; case 'd': if(optarg) { strncpy(datetype,optarg,16); } custom=1; break; case 'r': auc = 1; if(optarg) auc_base = atoi(optarg); break; case 'Y': if(optarg) p_ts->tm_year = atoi(optarg); break; case 'M': if(optarg) p_ts->tm_mon = atoi(optarg)-1; // 0-indexed months break; case 'D': if(optarg) p_ts->tm_mday = atoi(optarg); break; default: break; } } if(verbosity_level > 2) verbosity_level = 2; switch(verbosity_level) { case 2: verbosity.year = 1; case 1: verbosity.day = 1; break; } if(optind < argc && custom == 1) { strncpy(dateval,argv[optind++],16); } if(custom) parse_date(datetype, dateval, p_ts); if(hodie_isleap(p_ts->tm_year)==1) leap=1; if(custom==0) { p_ts->tm_year=p_ts->tm_year+auc_base+1900; } p_ts->tm_mon++; /* Setup the mode struct */ m.numeral=1; to_roman(p_ts->tm_sec,sec,m); to_roman(p_ts->tm_min,min,m); to_roman(p_ts->tm_hour,hrs,m); to_roman(p_ts->tm_mday,day,m); to_roman(p_ts->tm_mon,mon,m); to_roman(p_ts->tm_year,year,m); date_to_roman(p_ts, verbose, verbosity, ad, leap); if(numerals!=0 && auc!=0) { printf("Hodie %s %s est\n",verbose,AUC[verbosity.day+1]); } else if(numerals!=0) { printf("Hodie %s est\n",verbose); } if(numerals==-1) /* The only case where both numerals and text exist */ printf("\n"); if(numerals < 1) { if(auc!=0) printf("%s/%s-%s %s\n%s:%s:%s\n", day,mon,year,AUC[verbosity.day+1],hrs,min,sec); else printf("%s/%s-%s\n%s:%s:%s\n", day,mon,year,hrs,min,sec); } return 0; } michiexile-hodie-8c25646/src/hodie.h000066400000000000000000000005501160120172600172270ustar00rootroot00000000000000typedef struct { unsigned int day:1; unsigned int year:1; } verb_struct; /* Function prototypes */ void date_to_roman(struct tm*, char*, verb_struct, int, int); void to_roman_numerals(int,char*); void to_roman(int,char*,struct mode); int hodie_isleap(int); void print_usage(void); void print_version(void); int parse_date(char*,char*,struct tm*); michiexile-hodie-8c25646/src/includes.h000066400000000000000000000003071160120172600177450ustar00rootroot00000000000000#include #include #include #include #include #include #include "version.h" #include "to_roman.h" #include "hodie.h" #include "strings.h" michiexile-hodie-8c25646/src/isleap.c000066400000000000000000000002561160120172600174120ustar00rootroot00000000000000#include "includes.h" int hodie_isleap(int year) { if(year%400 == 0) return 1; if(year%100 == 0) return 0; if(year%4==0) return 1; return 0; } michiexile-hodie-8c25646/src/parse_date.c000066400000000000000000000016361160120172600202470ustar00rootroot00000000000000#include "includes.h" #define YMD 0 #define VERB 1 #define DMY 2 #define MDY 3 int parse_date(char* datetype, char* dateval, struct tm* p_ts) { int ret; char flag,tmp1,tmp2; if(strcmp(datetype,"ymd")==0) { flag=YMD; } else if(strcmp(datetype,"verbose")==0) { flag=VERB; } else if(strcmp(datetype,"dmy")==0) { flag=DMY; } else if(strcmp(datetype,"mdy")==0) { flag=MDY; } else { print_usage(); exit(1); } switch(flag) { case YMD: sscanf(dateval,"%d%c%d%c%d",&(p_ts->tm_year),&tmp1, &(p_ts->tm_mon),&tmp2,&(p_ts->tm_mday)); break; case DMY: sscanf(dateval,"%d%c%d%c%d",&(p_ts->tm_mday),&tmp1, &(p_ts->tm_mon),&tmp2,&(p_ts->tm_year)); break; case MDY: sscanf(dateval,"%d%c%d%c%d",&(p_ts->tm_mon),&tmp1, &(p_ts->tm_mday),&tmp2,&(p_ts->tm_year)); break; } p_ts->tm_mon--; return ret; } michiexile-hodie-8c25646/src/strings.h000066400000000000000000000026001160120172600176260ustar00rootroot00000000000000/* Error messages */ #define ERR_NO_REP "Please supply an offset to the republican option" /* help.c strings */ #define HELP_1 "Usage: hodie [OPTION]\n" #define HELP_2 "Print current time and date in latin and/or with roman numerals\n\n" #define HELP_3 " -h, --help Print this message\n" #define HELP_4 " -v, --verbose Print fully declined months and days\n" #define HELP_5 " as opposed to the abbreviations\n" #define HELP_6 " -n, --numerals Print numerals only\n" #define HELP_7 " -x, --force-numerals Do print the numerals\n" #define HELP_8 " -c, --classic Print the date ab urbe condita.\n" #define HELP_9 " -ad, --ante-diem Print the date using ante diem.\n" #define HELP_10 " -d, --date Print a custom date. For details on call\n" #define HELP_11 " syntax, please consult the manual.\n" #define HELP_12 " -r, --republican OFFSET\n" #define HELP_13 " Print the date counted ab urbe tua condita\n" #define HELP_14 " with the offset OFFSET counted in years from\n" #define HELP_15 " the western year 0.\n" #define HELP_16 " --version Prints the current version of hodie\n" #define HELP_17 "\nPlease mail comments or suggestions to mikael@johanssons.org\n" #define HELP_18 "" #define HELP_19 "" #define HELP_20 "" michiexile-hodie-8c25646/src/to_roman.c000066400000000000000000000221121160120172600177460ustar00rootroot00000000000000#include "includes.h" const char *unus[32]={ "unus", "una", "unum", "unius", "unius", "unius", "uni","uni","uni", "unum","unam","unum", "uno","una","uno", "uni","unae","una", "unorum","unarum","unorum", "unis","unis","unis", "unos","unas","una", "unis","unis","unis"}; const char *duo[16]={ "duo","duae","duo", "duorum","duarum","duorum", "duobus","duabus","duobus", "duos","duas","duo", "duobus","duabus","duobus"}; const char *tres[16]={ "tres","tres","tria", "trium","trium","trium", "tribus","tribus","tribus", "tres","tres","tria", "tribus","tribus","tribus"}; const char *duode[2]={"unde","duode"}; const char *one[20]={"", "", "", "", "quattuor", "quinque", "sex", "septem", "octo", "novem", "decem", "undecim", "duodecim", "tredecim", "quattuordecim", "quindecim", "sedecim", "septendecim"}; const char *ten[15]={"", "decem", "viginti", "triginta", "quadraginta", "quinquaginta", "sexaginta", "septuaginta", "octoginta", "nonaginta",}; const char *cent[15]={"", "centum", "ducent", "trecent", "quadringent", "quingent", "sescent", "septingent", "octingent", "nongent"}; const char *regular[32]={"us","a","um", "i","ae","i", "o","ae","o", "um","am","um", "o","a","o", "i","ae","a", "orum","arum","orum", "is","is","is", "os","as","a", "is","is","is"}; const char *milia[16]={"milia", "milium", "milibus", "milia", "milibus"}; const char *primus[13]={"", "prim", "secund", "terti", "quart", "quint", "sext", "septim", "octav", "non", "decim", "undecim", "duodecim"}; const char* decimus[13]={"", "decim", "vicesim", "tricesim", "quadragesim", "quinquagesim", "sexagesim", "septuagesim", "octogesim", "nonagesim", "centesim"}; const char* centesimus[13]={"", "centesim", "ducentesim", "trecentesim", "quadringentesim", "quingentesim", "sescentesim", "septingentesim", "octingentesim", "nongentesim"}; const char* millesimus="millesim"; const char* semel[13]={"", "semel", "bis", "ter", "quater", "quinquies", "sexies", "septies", "octies", "novies", "decies", "undecies", "duodecies"}; const char* decies[12]={"", "decies", "vicies", "tricies", "quadragies", "quinquagies", "sexagies", "septuagies", "octogies", "nonagies", "centies"}; const char* centies[12]={"", "centies", "ducenties", "trecenties", "quadringenties", "quingenties", "sescenties", "septingenties", "octingenties", "nongenties", "milies"}; const char* milies="milies"; void build_one(int n, char* str, mode m); void build_first(int n, char* str, mode m); void build_singuli(int n, char* str, mode m); void build_semel(int n, char* str, mode m); void to_roman(int n, char* str, mode m) { if(m.numeral) { to_roman_numerals(n, str); return; } switch(m.type) { case 0: build_one(n, str, m); break; case 1: build_first(n, str, m); break; case 2: build_singuli(n, str, m); break; case 3: build_semel(n, str, m); break; } return; } void build_one(int n, char* str, mode m) { char tmp[80], tmp1[80]; mode M; M=m; if(n==0) { sprintf(str, " "); return; } if(n>=2000) { if(n%1000 < 100) M.et_bind=0; build_one(n%1000, tmp, M); build_one(n/1000, tmp1, m); if(m.et_bind) sprintf(str, "%s %s et %s", tmp1, milia[m.casus], tmp); else sprintf(str, "%s %s %s", tmp1, milia[m.casus], tmp); } else if(n>=1000) { if(n%1000 < 100) M.et_bind=0; build_one(n%1000, tmp, M); if(m.et_bind) sprintf(str, "mille et %s", tmp); else sprintf(str, "mille %s", tmp); } else if(n>=200) { M.et_bind=0; build_one(n%100, tmp, M); if(m.et_bind) sprintf(str, "%s%s et %s", cent[(n-(n%100))/100], regular[15+m.casus*3+m.genus], tmp); else sprintf(str, "%s%s %s", cent[(n-(n%100))/100], regular[15+m.casus*3+m.genus], tmp); } else if(n>=100) { M.et_bind=0; build_one(n%100, tmp, M); if(m.et_bind) sprintf(str, "%s et %s", cent[1], tmp); else sprintf(str, "%s %s", cent[1], tmp); } else { if((n==98)||(n==99)) { if(m.et_bind) sprintf(str, "%s et %s", one[n%10], ten[9]); else sprintf(str, "%s %s", one[n%10], ten[9]); } else if(n>=20) { switch(n%10) { case 0: sprintf(str,"%s", ten[n/10]); break; case 1: if(m.et_bind) sprintf(str,"%s et %s", unus[15*m.numerus+3*m.casus+m.genus],ten[(n-1)/10]); else sprintf(str,"%s %s", ten[(n-1)/10], unus[15*m.numerus+3*m.casus+m.genus]); break; case 2: if(m.et_bind) sprintf(str,"%s et %s", duo[3*m.casus+m.genus],ten[(n-1)/10]); else sprintf(str,"%s %s", ten[(n-1)/10], duo[3*m.casus+m.genus]); break; case 3: if(m.et_bind) sprintf(str,"%s et %s", tres[3*m.casus+m.genus],ten[(n-1)/10]); else sprintf(str,"%s %s", ten[(n-1)/10], tres[3*m.casus+m.genus]); break; case 8: sprintf(str,"%s%s", duode[1], ten[(n+2)/10]); break; case 9: sprintf(str,"%s%s", duode[0], ten[(n+1)/10]); break; default: if(m.et_bind) sprintf(str,"%s et %s", one[n%10],ten[(n-(n%10))/10]); else sprintf(str,"%s %s", ten[(n-(n%10))/10], one[n%10]); break; } } else { switch(n) { case 1: sprintf(str, "%s", unus[15*m.numerus+3*m.casus+m.genus]); break; case 2: sprintf(str, "%s", duo[3*m.casus+m.genus]); break; case 3: sprintf(str, "%s", tres[3*m.casus+m.genus]); break; case 18: sprintf(str,"%s%s", duode[1], ten[2]); break; case 19: sprintf(str,"%s%s", duode[0], ten[2]); break; default: sprintf(str, "%s", one[n]); } } } } void build_first(int n,char* str,mode m) { char tmp[80], tmp1[80]; if(n<13) { sprintf(str,"%s%s",primus[n],regular[m.numerus*15+m.casus*3+m.genus]); return; } else if(n<18) { sprintf(str,"%s%s %s%s",decimus[1], regular[m.numerus*15+m.casus*3+m.genus],primus[n-10], regular[m.numerus*15+m.casus*3+m.genus]); return; } if(n>1000) { if(n%1000==0) { if(n/1000>1) { build_semel(n/1000, tmp, m); sprintf(str, "%s %s%s", tmp, millesimus, regular[m.numerus*15+m.casus*3+m.genus]); } else { sprintf(str, "%s%s", millesimus, regular[m.numerus*15+m.casus*3+m.genus]); } } else { build_first(n%1000,tmp,m); if((n-(n%1000))/1000>1) { build_semel((n-(n%1000))/1000, tmp1, m); sprintf(str,"%s %s%s %s", tmp1, millesimus, regular[m.numerus*15+m.casus*3+m.genus],tmp); } else { sprintf(str,"%s%s %s", millesimus, regular[m.numerus*15+m.casus*3+m.genus],tmp); } } return; } if(n>100) { if(n%100!=0) build_first(n%100,tmp,m); sprintf(tmp1,"%s%s",centesimus[(n-(n%100))/100], regular[m.numerus*15+m.casus*3+m.genus]); if(n%100!=0) sprintf(str,"%s %s",tmp1, tmp); else sprintf(str,"%s",tmp1); return; } if(n<100) { if((n%10==8)||(n%10==9)) { sprintf(str,"%s%s%s",duode[9-n%10],decimus[(n+(10-n%10))/10], regular[m.numerus*15+m.casus*3+m.genus]); return; } if(n%10==0) { sprintf(str,"%s%s",decimus[n/10], regular[m.numerus*15+m.casus*3+m.genus]); return; } sprintf(str,"%s%s %s%s",decimus[(n-(n%10))/10], regular[m.numerus*15+m.casus*3+m.genus], primus[n%10], regular[m.numerus*15+m.casus*3+m.genus]); return; } } void build_singuli(int n,char* str, mode m) { sprintf(str,"Distributives coming soon"); } void build_semel(int n, char* str, mode m) { char tmp[80], tmp1[80]; int n_hi, n_lo; if(n==0) { str[0]=0; return; } if(n==1000) sprintf(str,"%s",milies); if(n>1000) { n_lo=n%1000; n_hi=(n-n_lo)/1000; build_semel(n_lo,tmp,m); build_semel(n_hi,tmp1,m); if(n_lo) sprintf(str,"%s %s %s",tmp1, milies, tmp); else sprintf(str,"%s %s",tmp1, milies); return; } if(n>100) { n_lo=n%100; n_hi=(n-n_lo)/1000; build_semel(n_lo,tmp,m); sprintf(str, "%s %s", centies[n_hi], tmp); return; } if(n>12) { switch(n%10) { case 0: sprintf(str,"%s",decies[n/10]); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: sprintf(str, "%s et %s", semel[n%10], decies[(n-(n%10))/10]); break; case 8: case 9: sprintf(str, "%s%s", duode[9-(n%10)], decies[(n+10-(n%10))/10]); break; } return; } sprintf(str,"%s", semel[n]); return; } michiexile-hodie-8c25646/src/to_roman.h000066400000000000000000000007771160120172600177700ustar00rootroot00000000000000typedef struct mode { unsigned char numeral : 1; /* 0 if verbose, 1 if of the form CXCVII */ unsigned char numerus : 1; /* 0 if singular, 1 if plural */ unsigned char casus : 3; /* 0 Nom, 1 Gen, 2 Dat, 3 Ack, 4 Abl */ unsigned char genus : 2; /* 0 M, 1 F, 2 N */ unsigned char et_bind : 1; /* 1 string high numbers together with 'et' */ unsigned char type : 2; /* 0: one two three, * 1: first second third * 2: one each, two each ... * 3: once, twice, ... */ } mode; michiexile-hodie-8c25646/src/to_roman_numerals.c000066400000000000000000000013051160120172600216550ustar00rootroot00000000000000#include "includes.h" static const char* ones[10]={"","I","II","III","IV","V","VI","VII","VIII","IX"}; static const char* tens[10]={"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"}; static const char* cents[10]={"","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"}; static const char* mils[10]={"","M","MM","MMM","MMMM","MMMMM","MMMMMM","MMMMMMMM","MMMMMMMMM"}; static const char* naught="-"; void to_roman_numerals(int n, char* str) { int o,t,c,m; if(n==0) { sprintf(str,"%s",naught); return; } o=n%10; n=n/10; t=n%10; n=n/10; c=n%10; n=n/10; m=n%10; if(m>9) m=0; sprintf(str, "%s%s%s%s",mils[m],cents[c],tens[t],ones[o]); } michiexile-hodie-8c25646/src/version.c000066400000000000000000000006071160120172600176220ustar00rootroot00000000000000#include "includes.h" #ifndef HODIE_RELEASE #define HODIE_RELEASE "Please include 'version.h' before compilation" #endif void print_version(void) { printf("hodie %s\n", HODIE_RELEASE); printf("\nCopyright (c) 2000, Mikael Johansson\n"); printf("Released under MIT-style license. Please read the file\n"); printf("LICENSE distributed with the source code for details\n"); } michiexile-hodie-8c25646/src/version.h000066400000000000000000000000731160120172600176240ustar00rootroot00000000000000/* Version number of hodie */ #define HODIE_RELEASE "1.4"