From cc1d109aa9a71b8b91dbbafb7f6c6eb150118148 Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Wed, 11 Apr 2012 17:33:26 +0100 Subject: [PATCH] Linux compilation of dtcm (Calendar), (Matthew Howkins) --- cde/programs/dtcm/dtcm/Imakefile | 6 +++ cde/programs/dtcm/dtcm/MonthPanel.c | 3 ++ cde/programs/dtcm/dtcm/calendarA.c | 3 ++ cde/programs/dtcm/dtcm/dayglance.c | 3 ++ cde/programs/dtcm/dtcm/find.c | 3 ++ cde/programs/dtcm/dtcm/format.c | 3 ++ cde/programs/dtcm/dtcm/monthglance.c | 3 ++ cde/programs/dtcm/dtcm/tempbr.c | 4 ++ cde/programs/dtcm/dtcm/weekglance.c | 3 ++ cde/programs/dtcm/dtcm/x_graphics.c | 3 ++ cde/programs/dtcm/dtcm/yearglance.c | 3 ++ cde/programs/dtcm/libDtCmP/getdate.y | 62 +++++++++++++-------------- cde/programs/dtcm/libDtCmP/timeops.c | 6 +++ cde/programs/dtcm/libDtCmP/util.c | 3 ++ cde/programs/dtcm/server/Imakefile | 6 +++ cde/programs/dtcm/server/garbage.c | 3 ++ cde/programs/dtcm/server/log.c | 3 ++ cde/programs/dtcm/server/parser.y | 2 +- cde/programs/dtcm/server/reclotick.c | 3 ++ cde/programs/dtcm/server/recount.c | 3 ++ cde/programs/dtcm/server/relasttick.c | 3 ++ cde/programs/dtcm/server/renexttick.c | 3 ++ cde/programs/dtcm/server/repeat.c | 3 ++ cde/programs/dtcm/server/reprevtick.c | 3 ++ cde/programs/dtcm/server/reutil.c | 3 ++ cde/programs/dtcm/server/svcmain.c | 4 ++ cde/programs/dtcm/server/utility.c | 2 + 27 files changed, 117 insertions(+), 32 deletions(-) diff --git a/cde/programs/dtcm/dtcm/Imakefile b/cde/programs/dtcm/dtcm/Imakefile index 4e36ab44..bb2d86d1 100644 --- a/cde/programs/dtcm/dtcm/Imakefile +++ b/cde/programs/dtcm/dtcm/Imakefile @@ -47,6 +47,12 @@ EXTRA_CCOPTIONS = -xstrconst -Xc -v EXTRA_LIBRARIES = $(FNS_EXTRA_LIBS) #endif +XCOMM On Linux once you link against a C++ library the whole program +XCOMM has to be linked with the C++ linker +#if defined(LinuxDistribution) +CCLINK = $(CXX) +#endif + PROG1 = dtcm SRCS1 = MonthPanel.c RFCMIME.c about.c \ alarm.c blist.c browser.c \ diff --git a/cde/programs/dtcm/dtcm/MonthPanel.c b/cde/programs/dtcm/dtcm/MonthPanel.c index 2726b294..d884f841 100644 --- a/cde/programs/dtcm/dtcm/MonthPanel.c +++ b/cde/programs/dtcm/dtcm/MonthPanel.c @@ -69,6 +69,9 @@ #define XOS_USE_XT_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include /* diff --git a/cde/programs/dtcm/dtcm/calendarA.c b/cde/programs/dtcm/dtcm/calendarA.c index 1e3551a9..b3f391b6 100644 --- a/cde/programs/dtcm/dtcm/calendarA.c +++ b/cde/programs/dtcm/dtcm/calendarA.c @@ -131,6 +131,9 @@ static char sccsid[] = "@(#)calendarA.c 1.196 95/04/12 Copyr 1991 Sun Microsyst #include "cmtt.h" #endif +#if defined(linux) +#undef SVR4 +#endif #include #include #ifdef X_NOT_STDC_ENV diff --git a/cde/programs/dtcm/dtcm/dayglance.c b/cde/programs/dtcm/dtcm/dayglance.c index 65775eab..12aef5ce 100644 --- a/cde/programs/dtcm/dtcm/dayglance.c +++ b/cde/programs/dtcm/dtcm/dayglance.c @@ -81,6 +81,9 @@ static char sccsid[] = "@(#)dayglance.c 1.76 95/04/24 Copyr 1991 Sun Microsystem #define XOS_USE_XT_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include extern int debug; diff --git a/cde/programs/dtcm/dtcm/find.c b/cde/programs/dtcm/dtcm/find.c index 7339c1f5..ecbf9232 100644 --- a/cde/programs/dtcm/dtcm/find.c +++ b/cde/programs/dtcm/dtcm/find.c @@ -60,6 +60,9 @@ #define XOS_USE_XT_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include static void layout_labels(Widget, Widget, Widget, Widget); diff --git a/cde/programs/dtcm/dtcm/format.c b/cde/programs/dtcm/dtcm/format.c index e92aa9d8..29f6e940 100644 --- a/cde/programs/dtcm/dtcm/format.c +++ b/cde/programs/dtcm/dtcm/format.c @@ -69,6 +69,9 @@ static char sccsid[] = "@(#)format.c 1.27 95/01/19 Copyr 1991 Sun Microsystems, #define XOS_USE_XT_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include /* diff --git a/cde/programs/dtcm/dtcm/monthglance.c b/cde/programs/dtcm/dtcm/monthglance.c index 9f9a7c67..9d8e1fe0 100644 --- a/cde/programs/dtcm/dtcm/monthglance.c +++ b/cde/programs/dtcm/dtcm/monthglance.c @@ -101,6 +101,9 @@ static char sccsid[] = "@(#)monthglance.c 1.82 95/07/27 Copyr 1994 Sun Microsys #define XOS_USE_XT_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include static void paint_day_entries(Tick, int, int, int, int, diff --git a/cde/programs/dtcm/dtcm/tempbr.c b/cde/programs/dtcm/dtcm/tempbr.c index c9aa48d3..7b0759e4 100644 --- a/cde/programs/dtcm/dtcm/tempbr.c +++ b/cde/programs/dtcm/dtcm/tempbr.c @@ -89,7 +89,11 @@ static char sccsid[] = "@(#)tempbr.c 1.48 95/03/28 Copyr 1991 Sun Microsystems, static void tb_cancel_cb(); static void tb_close_cb(); static void tempbr_show_cb(Widget w, XtPointer data, XtPointer cbs); +#if defined(linux) +#include +#else extern char *strdup(const char *); +#endif #ifdef FNS_DEMO /* This stuff is currently broken */ diff --git a/cde/programs/dtcm/dtcm/weekglance.c b/cde/programs/dtcm/dtcm/weekglance.c index 1d3a49d5..2e398e90 100644 --- a/cde/programs/dtcm/dtcm/weekglance.c +++ b/cde/programs/dtcm/dtcm/weekglance.c @@ -77,6 +77,9 @@ #define XOS_USE_XT_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include static int week_xytoclock(Week *w, int x, int y); diff --git a/cde/programs/dtcm/dtcm/x_graphics.c b/cde/programs/dtcm/dtcm/x_graphics.c index b7e1c849..d65b9883 100644 --- a/cde/programs/dtcm/dtcm/x_graphics.c +++ b/cde/programs/dtcm/dtcm/x_graphics.c @@ -66,6 +66,9 @@ #define XOS_USE_XT_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include /* diff --git a/cde/programs/dtcm/dtcm/yearglance.c b/cde/programs/dtcm/dtcm/yearglance.c index ac0f457e..066e28fa 100644 --- a/cde/programs/dtcm/dtcm/yearglance.c +++ b/cde/programs/dtcm/dtcm/yearglance.c @@ -88,6 +88,9 @@ static char sccsid[] = "@(#)yearglance.c 1.37 95/07/27 Copyr 1991 Sun Microsyste #define XOS_USE_XT_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include /* if positioning of months in year view changes this must change too! diff --git a/cde/programs/dtcm/libDtCmP/getdate.y b/cde/programs/dtcm/libDtCmP/getdate.y index 1faecc7a..35a1aa32 100644 --- a/cde/programs/dtcm/libDtCmP/getdate.y +++ b/cde/programs/dtcm/libDtCmP/getdate.y @@ -73,76 +73,76 @@ extern long timezone; timedate: /* empty */ | timedate item; -item: tspec = +item: tspec {timeflag++;} - | zone = + | zone {zoneflag++;} - | dtspec = + | dtspec {dateflag++;} - | dyspec = + | dyspec {dayflag++;} - | rspec = + | rspec {relflag++;} | nspec; -nspec: NUMBER = +nspec: NUMBER {if (timeflag && dateflag && !relflag) year = $1; else {timeflag++;hh = $1/100;mm = $1%100;ss = 0;merid = 24;}}; -tspec: NUMBER MERIDIAN = +tspec: NUMBER MERIDIAN {hh = $1; mm = 0; ss = 0; merid = $2;} - | NUMBER ':' NUMBER = + | NUMBER ':' NUMBER {hh = $1; mm = $3; merid = 24;} - | NUMBER ':' NUMBER MERIDIAN = + | NUMBER ':' NUMBER MERIDIAN {hh = $1; mm = $3; merid = $4;} - | NUMBER ':' NUMBER ':' NUMBER = + | NUMBER ':' NUMBER ':' NUMBER {hh = $1; mm = $3; ss = $5; merid = 24;} - | NUMBER ':' NUMBER ':' NUMBER MERIDIAN = + | NUMBER ':' NUMBER ':' NUMBER MERIDIAN {hh = $1; mm = $3; ss = $5; merid = $6;}; -zone: ZONE = +zone: ZONE {ourzone = $1; daylightsavings = STANDARD;} - | DAYZONE = + | DAYZONE {ourzone = $1; daylightsavings = DAYLIGHT;}; -dyspec: DAY = +dyspec: DAY {dayord = 1; dayreq = $1;} - | DAY ',' = + | DAY ',' {dayord = 1; dayreq = $1;} - | NUMBER DAY = + | NUMBER DAY {dayord = $1; dayreq = $2;}; -dtspec: NUMBER '/' NUMBER = +dtspec: NUMBER '/' NUMBER {month = $1; day = $3; noyear = 1;} - | NUMBER '/' NUMBER '/' NUMBER = + | NUMBER '/' NUMBER '/' NUMBER {month = $1; day = $3; year = $5;} - | NUMBER '-' NUMBER = + | NUMBER '-' NUMBER {month = $1; day = $3; noyear = 1;} - | NUMBER '-' NUMBER '-' NUMBER = + | NUMBER '-' NUMBER '-' NUMBER {month = $1; day = $3; year = $5;} - | MONTH NUMBER = + | MONTH NUMBER {month = $1; day = $2; noyear = 1;} - | MONTH NUMBER ',' NUMBER = + | MONTH NUMBER ',' NUMBER {month = $1; day = $2; year = $4;} - | NUMBER MONTH = + | NUMBER MONTH {month = $2; day = $1; noyear = 1;} - | NUMBER MONTH NUMBER = + | NUMBER MONTH NUMBER {month = $2; day = $1; year = $3;}; -rspec: NUMBER UNIT = +rspec: NUMBER UNIT {relsec += 60L * $1 * $2;} - | NUMBER MUNIT = + | NUMBER MUNIT {relmonth += $1 * $2;} - | NUMBER SUNIT = + | NUMBER SUNIT {relsec += $1;} - | UNIT = + | UNIT {relsec += 60L * $1;} - | MUNIT = + | MUNIT {relmonth += $1;} - | SUNIT = + | SUNIT {relsec++;} - | rspec AGO = + | rspec AGO {relsec = -relsec; relmonth = -relmonth;}; %% diff --git a/cde/programs/dtcm/libDtCmP/timeops.c b/cde/programs/dtcm/libDtCmP/timeops.c index c87fd05f..f0cdbbd7 100644 --- a/cde/programs/dtcm/libDtCmP/timeops.c +++ b/cde/programs/dtcm/libDtCmP/timeops.c @@ -58,7 +58,13 @@ static char sccsid[] = "@(#)timeops.c 1.13 95/05/02 Copyr 1991 Sun Microsystems, #define XOS_USE_NO_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include +#if defined(linux) +#define SVR4 +#endif #include #include diff --git a/cde/programs/dtcm/libDtCmP/util.c b/cde/programs/dtcm/libDtCmP/util.c index 57a21630..69ad7482 100644 --- a/cde/programs/dtcm/libDtCmP/util.c +++ b/cde/programs/dtcm/libDtCmP/util.c @@ -72,6 +72,9 @@ #define X_INCLUDE_STRING_H #define X_INCLUDE_TIME_H #define XOS_USE_NO_LOCKING +#if defined(linux) +#undef SVR4 +#endif #include #include diff --git a/cde/programs/dtcm/server/Imakefile b/cde/programs/dtcm/server/Imakefile index f3158cea..78c30061 100644 --- a/cde/programs/dtcm/server/Imakefile +++ b/cde/programs/dtcm/server/Imakefile @@ -49,6 +49,12 @@ EXTRA_CCOPTIONS = -xstrconst -Xc -v EXTRA_LIBRARIES = -lsocket -lnsl -lintl #endif +XCOMM On Linux once you link against a C++ library the whole program +XCOMM has to be linked with the C++ linker +#if defined(LinuxDistribution) +CCLINK = $(CXX) +#endif + SRCS = \ parser.y access.c callback.c \ cmscalendar.c cmsconvert.c cmsentry.c \ diff --git a/cde/programs/dtcm/server/garbage.c b/cde/programs/dtcm/server/garbage.c index a071213b..c2a2aa3c 100644 --- a/cde/programs/dtcm/server/garbage.c +++ b/cde/programs/dtcm/server/garbage.c @@ -35,6 +35,9 @@ #include #define XOS_USE_NO_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include #include "log.h" #include "rtable4.h" diff --git a/cde/programs/dtcm/server/log.c b/cde/programs/dtcm/server/log.c index de5cfa38..9b44ecb2 100644 --- a/cde/programs/dtcm/server/log.c +++ b/cde/programs/dtcm/server/log.c @@ -39,6 +39,9 @@ #include #define XOS_USE_NO_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include #include "cm.h" #include "rtable4.h" diff --git a/cde/programs/dtcm/server/parser.y b/cde/programs/dtcm/server/parser.y index b49a02cb..f07bd698 100644 --- a/cde/programs/dtcm/server/parser.y +++ b/cde/programs/dtcm/server/parser.y @@ -12,7 +12,7 @@ #include #include #include -#if defined(sun) && defined(_XOPEN_SOURCE) +#if (defined(sun) && defined(_XOPEN_SOURCE)) || defined(linux) #include #endif #include "csa.h" diff --git a/cde/programs/dtcm/server/reclotick.c b/cde/programs/dtcm/server/reclotick.c index 8d37ce6b..5733241a 100644 --- a/cde/programs/dtcm/server/reclotick.c +++ b/cde/programs/dtcm/server/reclotick.c @@ -30,6 +30,9 @@ #define XOS_USE_NO_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include #include diff --git a/cde/programs/dtcm/server/recount.c b/cde/programs/dtcm/server/recount.c index 638f84ad..1f3d0c2c 100644 --- a/cde/programs/dtcm/server/recount.c +++ b/cde/programs/dtcm/server/recount.c @@ -30,6 +30,9 @@ #define XOS_USE_NO_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include #include diff --git a/cde/programs/dtcm/server/relasttick.c b/cde/programs/dtcm/server/relasttick.c index cbd9c1ba..6109f12f 100644 --- a/cde/programs/dtcm/server/relasttick.c +++ b/cde/programs/dtcm/server/relasttick.c @@ -30,6 +30,9 @@ #define XOS_USE_NO_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include #include diff --git a/cde/programs/dtcm/server/renexttick.c b/cde/programs/dtcm/server/renexttick.c index 5cbe0d40..7dbf6904 100644 --- a/cde/programs/dtcm/server/renexttick.c +++ b/cde/programs/dtcm/server/renexttick.c @@ -31,6 +31,9 @@ #define XOS_USE_NO_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include #include "rerule.h" diff --git a/cde/programs/dtcm/server/repeat.c b/cde/programs/dtcm/server/repeat.c index 0f93c441..89fa9e4c 100644 --- a/cde/programs/dtcm/server/repeat.c +++ b/cde/programs/dtcm/server/repeat.c @@ -32,6 +32,9 @@ #include #define XOS_USE_NO_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include #include "csa.h" #include "rtable4.h" diff --git a/cde/programs/dtcm/server/reprevtick.c b/cde/programs/dtcm/server/reprevtick.c index 1b47c70d..3316a03b 100644 --- a/cde/programs/dtcm/server/reprevtick.c +++ b/cde/programs/dtcm/server/reprevtick.c @@ -30,6 +30,9 @@ #define XOS_USE_NO_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include #include "rerule.h" diff --git a/cde/programs/dtcm/server/reutil.c b/cde/programs/dtcm/server/reutil.c index 289fec7e..bb4f7ed6 100644 --- a/cde/programs/dtcm/server/reutil.c +++ b/cde/programs/dtcm/server/reutil.c @@ -37,6 +37,9 @@ #define XOS_USE_NO_LOCKING #define X_INCLUDE_TIME_H +#if defined(linux) +#undef SVR4 +#endif #include extern int monthdays[12]; diff --git a/cde/programs/dtcm/server/svcmain.c b/cde/programs/dtcm/server/svcmain.c index 08785f84..62230ad5 100644 --- a/cde/programs/dtcm/server/svcmain.c +++ b/cde/programs/dtcm/server/svcmain.c @@ -28,6 +28,10 @@ * (c) Copyright 1993, 1994 Sun Microsystems, Inc. */ +#if defined(linux) +#define _POSIX_C_SOURCE 2 +#endif + #include #include #include diff --git a/cde/programs/dtcm/server/utility.c b/cde/programs/dtcm/server/utility.c index c0ae66e3..1e8e0180 100644 --- a/cde/programs/dtcm/server/utility.c +++ b/cde/programs/dtcm/server/utility.c @@ -41,7 +41,9 @@ #include "utility.h" #include "lutil.h" +#if !defined(linux) extern char * strdup(const char *); +#endif /* * calendar_name@host[.domain] -> calendar_name -- 2.25.1