Search
SailfishOS Open Build Service
>
Projects
>
sailfishos
:
chum
:
testing
>
ddate
> 0.2.2-to-master.diff
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File 0.2.2-to-master.diff of Package ddate
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]) {