[-]
[+]
|
Changed |
ddate.spec
|
|
[-]
[+]
|
Added |
0.2.2-to-master.diff
^
|
@@ -0,0 +1,110 @@
+diff --git a/.gitignore b/.gitignore
+index 378eac2..10036ed 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -1 +1,4 @@
+ build
++ddate.exe
++ddate.obj
++.vscode/
+diff --git a/ddate.1 b/ddate.1
+index 3dd1c40..c340578 100644
+--- a/ddate.1
++++ b/ddate.1
+@@ -32,9 +32,9 @@ Full name of the season (i.e., Chaos)
+ .IP %b
+ Abbreviated name of the season (i.e., Chs)
+ .IP %d
+-Ordinal number of day in season (i.e., 23)
++Cardinal number of day in season (i.e., 23)
+ .IP %e
+-Cardinal number of day in season (i.e., 23rd)
++Ordinal number of day in season (i.e., 23rd)
+ .IP %H
+ Name of current Holyday, if any
+ .IP %N
+@@ -47,6 +47,8 @@ Tab
+ .IP %X
+ Number of days remaining until X-Day. (Not valid if the SubGenius options
+ are not compiled in.)
++.IP %Y
++The year of our Lady Discord (i.e., 3182)
+ .IP %{
+ .IP %}
+ Used to enclose the part of the string which is to be replaced with the
+diff --git a/ddate.c b/ddate.c
+index 4c2a0f8..2d41c4c 100644
+--- a/ddate.c
++++ b/ddate.c
+@@ -76,25 +76,14 @@
+ #include <stdio.h>
+
+
+-// work around includes and defines from formerly c.h
+ #ifndef ARRAY_SIZE
+-# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
++#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr)[0])
+ #endif
+
+-/* &a[0] degrades to a pointer: a different type from an array */
+-# define __must_be_array(a) \
+- BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(__typeof__(a), __typeof__(&a[0])))
+-
+-#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
+-
+ /* work around hacks for standalone package */
+ #define PACKAGE "ddate"
+ #define PACKAGE_STRING "Stand Alone"
+
+-#ifndef __GNUC__
+-#define inline /* foo */
+-#endif
+-
+ #ifdef KILL_BOB
+ int xday_countdown(int yday, int year);
+ #endif
+@@ -160,30 +149,27 @@ default_fmt
+
+ #define DY(y) (y+1166)
+
+-static inline char *ending(int i) {
++static char *ending(int i) {
+ return i/10==1?"th":(i%10==1?"st":(i%10==2?"nd":(i%10==3?"rd":"th")));
+ }
+
+-static inline int leapp(int i) {
++static int leapp(int i) {
+ return (!(DY(i)%4))&&((DY(i)%100)||(!(DY(i)%400)));
+ }
+
+ /* select a random string */
+-static inline char *sel(char **strings, int num) {
+- return(strings[random()%num]);
++static char *sel(char **strings, int num) {
++ return(strings[rand()%num]);
+ }
+
+-void print(struct disc_time,char **); /* old */
+ void format(char *buf, const char* fmt, struct disc_time dt);
+-/* read a fortune file */
+-int load_fortunes(char *fn, char *delim, char** result);
+
+ struct disc_time convert(int,int);
+ struct disc_time makeday(int,int,int);
+
+ int
+ main (int argc, char *argv[]) {
+- long t;
++ time_t t;
+ struct tm *eris;
+ int bob,raw;
+ struct disc_time hastur;
+@@ -195,7 +181,7 @@ main (int argc, char *argv[]) {
+ if ((p = strrchr(progname, '/')) != NULL)
+ progname = p+1;
+
+- srandom(time(NULL));
++ srand(time(NULL));
+ /* do args here */
+ for(pi=1; pi<argc; pi++) {
+ switch(argv[pi][0]) {
|
[-]
[+]
|
Added |
PR12.diff
^
|
@@ -0,0 +1,78 @@
+diff --git a/README.org b/README.org
+index 6a14e38..604488b 100644
+--- a/README.org
++++ b/README.org
+@@ -52,7 +52,7 @@
+ Occurs once every four years (1 + 4 = 5) and is inserted between
+ the 59th and 60th days of the Season of Chaos.
+ ** THE YEAR
+-| | | | | | | | ST | BT | PD | PP | SO | | | | | | | | | SM | BT | PD | PP | SO | |
++| | | | | | | | SM | BT | PD | PP | SO | | | | | | | | | SM | BT | PD | PP | SO | |
+ |-----+----+----+----+----+-----+---+----+----+----+----+----+-----+-----+----+----+----+----+----+---+----+----+----+----+----+-----|
+ | Jan | 1 | 2 | 3 | 4 | 5 | | 1 | 2 | 3 | 4 | 5 | Chs | Jul | 5 | 6 | 7 | 8 | 9 | | 40 | 41 | 42 | 43 | 44 | Cfn |
+ | | 6 | 7 | 8 | 9 | 10 | | 6 | 7 | 8 | 9 | 10 | | | 10 | 11 | 12 | 13 | 14 | | 45 | 46 | 47 | 48 | 49 | |
+diff --git a/ddate.c b/ddate.c
+index c0a6bf3..3e34fd4 100644
+--- a/ddate.c
++++ b/ddate.c
+@@ -43,6 +43,9 @@
+ 15th of Confusion, 3180:
+ - call out adherents of the wrong fruit
+
++ 3181-Afm-51 Jim Wisniewski <wisnij+ddate@gmail.com>
++ - added ISO_FORMAT option
++
+ FIVE TONS OF FLAX
+ */
+
+@@ -54,6 +57,12 @@
+
+ #define OLD_IMMEDIATE_FMT
+
++/* If you wish to use the ISO 8601 format for aneristic dates (y-m-d), as
++ * opposed to the Commonwealth format, define ISO_FORMAT.
++ */
++
++/* #define ISO_FORMAT */
++
+ /* If you wish to use the US format for aneristic dates (m-d-y), as opposed to
+ * the Commonwealth format, define US_FORMAT.
+ */
+@@ -214,12 +223,17 @@ main (int argc, char *argv[]) {
+ if (argc-pi==3){
+ int moe=atoi(argv[pi]), larry=atoi(argv[pi+1]), curly=atoi(argv[pi+2]);
+ hastur=makeday(
+-#ifdef US_FORMAT
+- moe,larry,
++#ifdef ISO_FORMAT
++ larry,curly,moe
+ #else
++# ifdef US_FORMAT
++ moe,larry,
++# else
+ larry,moe,
++# endif
++ curly
+ #endif
+- curly);
++ );
+ if (hastur.season == -1) {
+ printf("Invalid date -- out of range\n");
+ return -1;
+@@ -227,7 +241,15 @@ main (int argc, char *argv[]) {
+ fnord=fnord?fnord:default_fmt;
+ } else if (argc!=pi) {
+ usage:
+- fprintf(stderr,("usage: %s [+format] [day month year]\n"), argv[0]);
++ fprintf(stderr,("usage: %s [+format] ["
++#if defined(ISO_FORMAT)
++ "year month day"
++#elif defined(US_FORMAT)
++ "month day year"
++#else
++ "day month year"
++#endif
++ "]\n"), argv[0]);
+ exit(1);
+ } else {
+ t= time(NULL);
|
[-]
[+]
|
Added |
PR16.diff
^
|
@@ -0,0 +1,134 @@
+diff --git a/ddate.1 b/ddate.1
+index c340578..035b92e 100644
+--- a/ddate.1
++++ b/ddate.1
+@@ -7,6 +7,9 @@ ddate \- convert Gregorian dates to Discordian dates
+ .B ddate
+ .RI [ \fB+\fPformat]
+ .RI [ date ]
++.B ddate
++.RI \-a
++.RI [ date ]
+ .SH DESCRIPTION
+ .B ddate
+ prints the date in Discordian date format.
+@@ -77,6 +80,9 @@ Celebrate Bureflux
+ Today's St. Tib's Day, 3162.
+ .br
+
++.SH OPTIONS
++.br -a converts a discordian date into gregorian date
++
+ .SH BUGS
+
+ .B ddate(1)
+@@ -98,6 +104,8 @@ Major rewrite by Lee H:. O:. Smith, KYTP, aka Andrew Bulhak (acb@dev.null.org)
+ .br
+ Gregorian B.C.E. dates fixed by Chaplain Nyan the Wiser, aka Dan Dart (ntw@dandart.co.uk)
+ .br
++Added curse of the greyface by Franz_Nord
++.br
+ Five tons of flax.
+
+ .SH DISTRIBUTION POLICY
+diff --git a/ddate.c b/ddate.c
+index c0a6bf3..97042d7 100644
+--- a/ddate.c
++++ b/ddate.c
+@@ -43,6 +43,9 @@
+ 15th of Confusion, 3180:
+ - call out adherents of the wrong fruit
+
++ 40th of Confusion, 3184 Franz_Nord
++ - -a option added the curse of the greyface
++
+ FIVE TONS OF FLAX
+ */
+
+@@ -180,6 +183,7 @@ int load_fortunes(char *fn, char *delim, char** result);
+
+ struct disc_time convert(int,int);
+ struct disc_time makeday(int,int,int);
++struct disc_time unmakeday(int,int,int);
+
+ int
+ main (int argc, char *argv[]) {
+@@ -204,6 +208,7 @@ main (int argc, char *argv[]) {
+ switch(argv[pi][1]) {
+ case 'V':
+ printf(("%s (%s)\n"), progname, PACKAGE_STRING);
++ case 'a': goto aneris;
+ default: goto usage;
+ }
+ default: goto thud;
+@@ -240,6 +245,27 @@ main (int argc, char *argv[]) {
+ format(schwa, fnord, hastur);
+ printf("%s\n", schwa);
+
++ return 0;
++ aneris:
++ if (argc-pi==4){
++ int moe=atoi(argv[pi+1]), larry=atoi(argv[pi+2]), curly=atoi(argv[pi+3]);
++ hastur = unmakeday(
++ #ifdef US_FORMAT
++ moe,larry,
++ #else
++ larry,moe,
++ #endif
++ curly);
++ if (hastur.season == -1){
++ printf("Invalid date -- out of range\n");
++ return -1;
++ }
++#ifdef US_FORMAT
++ printf("%d %d %d\n", hastur.season, hastur.day, hastur.year);
++#else
++ printf("%d %d %d\n", hastur.day, hastur.season, hastur.year);
++#endif
++ }
+ return 0;
+ }
+
+@@ -356,6 +382,42 @@ struct disc_time makeday(int imonth,int iday,int iyear) /*i for input */
+ return funkychickens;
+ }
+
++struct disc_time unmakeday(int imonth, int iday, int iyear)
++{
++ struct disc_time funkychickens;
++ int days;
++ int month;
++ int cal[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
++ int leap;
++
++ memset(&funkychickens,0,sizeof(funkychickens));
++
++ /* basic range checks */
++ if(iday < 1 || iday > 73 | imonth < 1 || imonth > 5)
++ {
++ funkychickens.season = -1;
++ return funkychickens;
++ }
++
++ month = 0;
++ days = iday + (imonth - 1) * 73;
++ funkychickens.year = iyear-1166;
++ leap = leapp(iyear);
++ days += leap;
++
++ while(days>cal[month] || (leap && month == 1 && days>cal[month]+1)) {
++ days -= (cal[month] + ((leap && month == 1) ? 1 : 0));
++ month++;
++ }
++
++ month++;
++ funkychickens.season = month;
++ funkychickens.day = days;
++
++ // TODO: restumrechnung
++ return funkychickens;
++}
++
+ struct disc_time convert(int nday, int nyear)
+ { struct disc_time funkychickens;
+
|
[-]
[+]
|
Changed |
ddate.yaml
^
|
@@ -3,15 +3,18 @@
URL: https://github.com/bo0ts/ddate
SCM: https://github.com/bo0ts/ddate
Version: 0.2.2
-Release: 1
+Release: 2
Group: System
License: GPLv2 and GPLv2+ and BSD with advertising and Public Domain
Sources:
- '%{name}-%{version}.tar.gz'
Patches:
+ - '0.2.2-to-master.diff'
- 'PR12.diff'
- 'PR16.diff'
Description: |
+ The ddate source ripped out of util-linux
+
%if "%{?vendor}" == "chum"
#PackageName: ddate
DeveloperName: Philipp Möller
@@ -25,6 +28,8 @@
Bugtracker: https://github.com/bo0ts/ddate/issues
%endif
Builder: cmake
+Conflicts:
+ - util-linux < 2.24.2
Files:
- '%{_bindir}/%{name}'
- '%{_mandir}/*/*'
|